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
8f6b7a85c8b62eb399e7d3b47c96bf14307571b8
b32c6cbdb19f3fdda0b0105120a74d37b557e179
/src/test/java/de/adesso/nlpshowcase/nlp/service/NlpServiceTest.java
4fe3006e2a260a7617f500ef5916c160080cd524
[]
no_license
sasfeld/NaturalLanguageProcessing_Showcase
578a232f6f49ae19f6aaf8baa8ad37911cd6b335
ba83dd0a3ab02c6b2dfae5142ea89171e7d3832a
refs/heads/master
2020-04-05T01:06:46.026208
2020-03-13T15:14:18
2020-03-13T15:14:18
156,423,806
0
1
null
null
null
null
UTF-8
Java
false
false
1,750
java
package de.adesso.nlpshowcase.nlp.service; import de.adesso.nlpshowcase.nlp.external.adapter.StanfordCoreNlpAdapter; import de.adesso.nlpshowcase.nlp.model.AnnotatedSentences; import de.adesso.nlpshowcase.nlp.model.AnnotatedWord; import de.adesso.nlpshowcase.nlp.model.NlpResult; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Import; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Java6Assertions.assertThat; /** * Tests the {@link NlpService} component using Spring runner. */ @RunWith(SpringRunner.class) @Import({StanfordCoreNlpAdapter.class, NlpService.class}) public class NlpServiceTest { @Autowired private NlpService nlpService; @Test public void annotate_shouldAnnotateGermanRawText() throws Exception { // given final String givenRawText = "Berlin ist die Hauptstadt von Deutschland."; // when NlpResult nlpResult = nlpService.annotate(givenRawText); // then assertThat(nlpResult).isNotNull(); assertThat(nlpResult.getRawText()).isEqualTo(givenRawText); assertThat(nlpResult.getAnnotatedSentences().size()).isEqualTo(1); AnnotatedSentences firstSentence = nlpResult.getAnnotatedSentences().get(0); assertThat(firstSentence.getAnnotatedWords().size()).isGreaterThan(6); AnnotatedWord firstWord = firstSentence.getAnnotatedWords().get(0); assertThat(firstWord.getWord()).isEqualTo("Berlin"); assertThat(firstWord.getPartOfSpeechTag()).isEqualTo("NE"); assertThat(firstWord.getNamedEntityRecognitionTag()).isEqualTo("LOCATION"); } }
[ "sascha.feldmann@adesso.de" ]
sascha.feldmann@adesso.de
e4c77fbda2a1232d37c8ef1ebdd4b049fb7e8e91
8b715126b25feda7bd309bae14c6e258bd733b8d
/app/src/main/java/com/example/myapp/Addskill.java
190d1ab4ef1d4a0a431044ea7c5581837c7c8f45
[]
no_license
777-chintan/myAPP
24c360f02dcad25b3acbdd0b73f9eec4322ad423
9be1327d1b1134ce51e9e73b69a0364b2dc7d5c1
refs/heads/master
2022-11-30T18:34:32.822535
2020-08-05T14:00:30
2020-08-05T14:00:30
279,568,334
0
0
null
null
null
null
UTF-8
Java
false
false
2,814
java
package com.example.myapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; public class Addskill extends AppCompatActivity { private Spinner spn; private DatabaseReference ref1,ref2; private Button btn; private EditText price; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_addskill); setTitle("Add Skill"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setup(); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(check()){ String id=FirebaseAuth.getInstance().getUid(); String skill=spn.getSelectedItem().toString(); int x=Integer.parseInt(price.getText().toString().trim()); ref1.child(skill).child("price").setValue(x); ref2.child(skill).child(id).child("id").setValue(id); ref2.child(skill).child(id).child("price").setValue(x); } } }); } private boolean check(){ if(price!=null && price.getText().toString().isEmpty()==false){ return true; } Toast.makeText(Addskill.this,"Enter Price plz",Toast.LENGTH_SHORT).show(); return false; } private void setup(){ spn=findViewById(R.id.skill); price=findViewById(R.id.etprice); btn=findViewById(R.id.add_skill); ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,R.array.skill,R.layout.support_simple_spinner_dropdown_item); spn.setAdapter(adapter); ref1= FirebaseDatabase.getInstance().getReference("Skill").child(FirebaseAuth.getInstance().getUid()); ref2=FirebaseDatabase.getInstance().getReference("All Services and Providers"); } public boolean onOptionsItemSelected(MenuItem item){ Intent myIntent = new Intent(getApplicationContext(), SkillActivity.class); startActivityForResult(myIntent, 0); finish(); return true; } public void onBackPressed(){ Intent myIntent = new Intent(getApplicationContext(), SkillActivity.class); startActivityForResult(myIntent, 0); finish(); } }
[ "chintansojitra136@gmail.com" ]
chintansojitra136@gmail.com
94990726f2dea8d0e96882caf6a83184e4d8911b
d55286f1a727cc779b363b747d441fae0d44dbdf
/src/main/java/com/app/dao/PostsDaoImpl.java
477d0833acde9188001a9f72716cc1ed0268b0ff
[]
no_license
plkkoko/jetty-cassandra-authentication-webservice
6de4f98e54dabe6a07c48e3c5df8b539506750c1
f77c497777c6ccbfceff5f8bfef3f96bcfa4b864
refs/heads/master
2021-01-21T02:37:30.149754
2014-08-04T05:37:01
2014-08-04T05:37:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.app.dao; import java.io.Serializable; /** * * @author korena */ public class PostsDaoImpl implements PostsDao, Serializable{ }
[ "moazkorena@gmail.com" ]
moazkorena@gmail.com
c554da9d604d06949648ff399a1e1e0038f3d361
7b6c9b18b67adb038d2e4d749ff922641ec19c12
/backend/build/generated-source/endpoints/java/com/cadan/myapplication/backend/registration/model/CollectionResponseRegistrationRecord.java
68f6347a1d86e31be342a086ee33c27ba79b3c03
[]
no_license
cojalvo/HelloEndpoints
7192f479770341deb67e50dbe02edaaf43b09c1d
db85de8bb850a91a2d7f3a3e98965c12e324b548
refs/heads/master
2016-08-11T15:50:51.293743
2015-06-02T19:08:35
2015-06-02T19:08:35
36,755,233
0
0
null
null
null
null
UTF-8
Java
false
false
2,669
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://code.google.com/p/google-apis-client-generator/ * (build: 2015-03-26 20:30:19 UTC) * on 2015-06-02 at 19:02:48 UTC * Modify at your own risk. */ package com.cadan.myapplication.backend.registration.model; /** * Model definition for CollectionResponseRegistrationRecord. * * <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 registration. For a detailed explanation see: * <a href="http://code.google.com/p/google-http-java-client/wiki/JSON">http://code.google.com/p/google-http-java-client/wiki/JSON</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class CollectionResponseRegistrationRecord extends com.google.api.client.json.GenericJson { /** * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<RegistrationRecord> items; /** * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String nextPageToken; /** * @return value or {@code null} for none */ public java.util.List<RegistrationRecord> getItems() { return items; } /** * @param items items or {@code null} for none */ public CollectionResponseRegistrationRecord setItems(java.util.List<RegistrationRecord> items) { this.items = items; return this; } /** * @return value or {@code null} for none */ public java.lang.String getNextPageToken() { return nextPageToken; } /** * @param nextPageToken nextPageToken or {@code null} for none */ public CollectionResponseRegistrationRecord setNextPageToken(java.lang.String nextPageToken) { this.nextPageToken = nextPageToken; return this; } @Override public CollectionResponseRegistrationRecord set(String fieldName, Object value) { return (CollectionResponseRegistrationRecord) super.set(fieldName, value); } @Override public CollectionResponseRegistrationRecord clone() { return (CollectionResponseRegistrationRecord) super.clone(); } }
[ "cadan85@gmail.com" ]
cadan85@gmail.com
4559a44f0483127a29ebe43c1643ae524dafa423
1137e095233cbc2d38eb8c240654268031a58e55
/src/com/froalacharts/events/CanvasWheel.java
332c8440f527310ae7d60052095ea14184f65816
[]
no_license
froala/frocharts_ft_events_automation
73735712865123a7c06180a1eb3d571a3ebf3358
d9e535f21c98f8fd0e980bb6bdbab9da82880f49
refs/heads/master
2023-01-08T19:34:21.733366
2020-10-30T11:11:42
2020-10-30T11:11:42
297,573,065
0
0
null
2020-10-30T11:11:43
2020-09-22T07:41:29
HTML
UTF-8
Java
false
false
3,126
java
package com.froalacharts.events; import java.util.Map; import org.openqa.selenium.JavascriptExecutor; import org.testng.Assert; import org.testng.annotations.Test; import com.froalacharts.base.EventsTestBase; import com.froalacharts.pom.EventsPageObjectModel; import com.froalacharts.testcases.EventsCountTest; import com.froalacharts.util.EventsBO; public class CanvasWheel extends EventsTestBase{ public static EventsBO canvaswheel; private static String eventName = "canvaswheel"; @Test() public static void canvaswheel() { JavascriptExecutor js = (JavascriptExecutor) driver; canvaswheel = new EventsBO(); EventsPageObjectModel pomObj = new EventsPageObjectModel(); canvaswheel.setEventID((long) js.executeScript("return events.canvaswheel.eObj.eventId")); canvaswheel.setEventType((String) js.executeScript("return events.canvaswheel.eObj.eventType")); canvaswheel.setCancelled((boolean) js.executeScript("return events.canvaswheel.eObj.cancelled")); canvaswheel.setStopPropagation((Map<String, Object>) js.executeScript("return events.canvaswheel.eObj.stopPropagation")); canvaswheel.setDefaultPrevented((boolean) js.executeScript("return events.canvaswheel.eObj.defaultPrevented")); canvaswheel.setPreventDefault((Map<String, Object>) js.executeScript("return events.canvaswheel.eObj.preventDefault")); canvaswheel.setDetached((boolean) js.executeScript("return events.canvaswheel.eObj.detached")); canvaswheel.setDetachHandler((Map<String, Object>) js.executeScript("return events.canvaswheel.eObj.detachHandler")); canvaswheel.setChartType((String) js.executeScript("return events.canvaswheel.eObj.sender.chartType()")); long start = (long) js.executeScript("return events.canvaswheel.eObj.data.start"); long end = (long) js.executeScript("return events.canvaswheel.eObj.data.end"); Assert.assertTrue(canvaswheel.getEventType().equals(eventName), "eventType is event name"); Assert.assertTrue(canvaswheel.getCancelled()==false, "cancelled is false"); Assert.assertTrue(canvaswheel.getStopPropagation().toString().equals("{}"), "stopPropagation is a function"); Assert.assertTrue(canvaswheel.getDefaultPrevented()==false, "defaultPrevented is false"); Assert.assertTrue(canvaswheel.getPreventDefault().toString().equals("{}"), "preventDefault is a function"); Assert.assertTrue(canvaswheel.getDetached()==false, "detached is false"); Assert.assertTrue(canvaswheel.getDetachHandler().toString().equals("{}"), "detachHandler is a function"); Assert.assertTrue(canvaswheel.getChartType().equals("timeseries"), "sender.chartType is timeseries"); Assert.assertTrue(end>start, "end is more than start"); CanvasWheel.canvaswheelCount(); } public static void canvaswheelCount() { JavascriptExecutor js = (JavascriptExecutor) driver; long count = (long) js.executeScript("return getEventCount('"+eventName+"')"); EventsCountTest.eventCount.put(eventName,(int)count); } }
[ "admin@CELSYS130-BLR.CELSYSWTC.IN" ]
admin@CELSYS130-BLR.CELSYSWTC.IN
f7154a137e29abe7d93261ccff6ec7b6b97da8d3
405522dea72ba340dbf3ad6f1d50aecf5789143f
/code_java/src/main/java/code_java/garbage_collection/PhantomRefExample.java
33325452e061ca94d51af2c58f6d920d3a0f0df8
[]
no_license
yanghaitao0410/thinkingInJava
963786074ed4a32f7df21e402ba2c1f0b162cb02
b288e98d98247458aad42afe5ae7c694ccd4f2f1
refs/heads/master
2022-06-26T17:10:09.470745
2021-01-12T07:20:29
2021-01-12T07:20:29
128,611,161
0
0
null
2022-06-17T03:12:04
2018-04-08T07:16:28
Java
UTF-8
Java
false
false
2,029
java
package code_java.garbage_collection; import java.lang.ref.PhantomReference; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; /** * @Desc * @Author water * @date 2020/5/18 **/ public class PhantomRefExample { public static void main(String[] args) { ReferenceQueue<MyObject> referenceQueue = new ReferenceQueue<>(); MyObject myObject1 = new MyObject("phantom"); Reference<MyObject> ref = new PhantomReference<>(myObject1, referenceQueue); System.out.println("ref#get(): " + ref.get()); //获取虚引用对象 MyObject myObject2 = new MyObject("normal"); //make objects unreacheable myObject1 = null; myObject2 = null; if(checkObjectGced(ref, referenceQueue)){ takeAction(); } System.out.println("-- do some memory intensive work --"); for (int i = 0; i < 10; i++) { int[] ints = new int[100000]; try { Thread.sleep(10); } catch (InterruptedException e) { } } if(checkObjectGced(ref, referenceQueue)){ takeAction(); } } private static boolean checkObjectGced(Reference<MyObject> ref, ReferenceQueue<MyObject> referenceQueue) { boolean gced = false; System.out.println("-- Checking whether object garbage collection due --"); //运行后可以看出虚引用里面的对象会先执行finalized方法,然后再将该虚引用放入队列 Reference<? extends MyObject> polledRef = referenceQueue.poll(); System.out.println("polledRef: "+polledRef); System.out.println("Is polledRef same: "+ (gced=polledRef==ref)); if(polledRef!=null) { System.out.println("Ref#get(): " + polledRef.get()); } return gced; } //处理特定逻辑 比如清理DirectByteBuffer分配的堆外内存 private static void takeAction() { System.out.println("pre-mortem cleanup actions"); } }
[ "water@yeahka.com" ]
water@yeahka.com
5d0cb6aa0b17cfce0e6cef871a662aec49d14edc
1b000e3739478af22713e0dc2929e46883508b9a
/zookeeper-server/src/test/java/org/apache/zookeeper/server/watch/WatchesPathReportTest.java
34e378952bf80a2387c4f1c3e41272958fea034d
[ "Apache-2.0" ]
permissive
gxstax/zookeeper
ea674ba0e028637d4ee9bfbbb56da1588ba92df4
6c5f1924c9ea10c947a6407482cf6d509782d0c0
refs/heads/master
2022-11-22T06:52:42.108643
2019-02-27T01:15:35
2019-02-27T01:15:35
172,818,274
3
0
Apache-2.0
2022-11-16T11:39:29
2019-02-27T01:16:57
Java
UTF-8
Java
false
false
2,128
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.zookeeper.server.watch; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.zookeeper.ZKTestCase; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class WatchesPathReportTest extends ZKTestCase { private Map<String, Set<Long>> m; private WatchesPathReport r; @Before public void setUp() { m = new HashMap<String, Set<Long>>(); Set<Long> s = new HashSet<Long>(); s.add(101L); s.add(102L); m.put("path1", s); s = new HashSet<Long>(); s.add(201L); m.put("path2", s); r = new WatchesPathReport(m); } @Test public void testHasSessions() { assertTrue(r.hasSessions("path1")); assertTrue(r.hasSessions("path2")); assertFalse(r.hasSessions("path3")); } @Test public void testGetSessions() { Set<Long> s = r.getSessions("path1"); assertEquals(2, s.size()); assertTrue(s.contains(101L)); assertTrue(s.contains(102L)); s = r.getSessions("path2"); assertEquals(1, s.size()); assertTrue(s.contains(201L)); assertNull(r.getSessions("path3")); } @Test public void testToMap() { assertEquals(m, r.toMap()); } }
[ "gaoxx@fxiaoke.com" ]
gaoxx@fxiaoke.com
782397754a4a3c8c0d208616747ee469c8e545f5
d10209e8560f7553e9ede0511f7f3fd6ef267691
/src/main/java/com/space/config/RedisConfig.java
017bb625b74c65b0555ef71610cf8f7ee9d1dc97
[]
no_license
lgc-666/space
d9437ac93b9a45b27e39dd14b5657ae2d402b7bc
c70307ce57a8c66f72e47a8ead391de2757df60d
refs/heads/master
2022-12-09T11:44:15.794658
2020-09-10T16:01:00
2020-09-10T16:01:00
294,460,785
0
0
null
null
null
null
UTF-8
Java
false
false
2,372
java
package com.space.config; import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.cache.RedisCacheConfiguration; import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheWriter; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.serializer.*; import java.time.Duration; @Configuration @EnableCaching //Redis 缓存配置类(防止可视化工具查看redis时数据为乱码) public class RedisConfig extends CachingConfigurerSupport { private RedisSerializer<String> keySerializer() { return new StringRedisSerializer(); //key值使用json序列化器 } private RedisSerializer<Object> valueSerializer() { return new GenericJackson2JsonRedisSerializer();//value值也使用json序列化器 } @Bean public CacheManager cacheManager(RedisConnectionFactory factory) { /* 不同的缓存对应不同的存储类型,不同的存储类型对应着不同的序列化和反序列化器,因此要统一使用的缓存; RedisCacheConfiguration 为容器注入了新的缓存管理器 RedisCacheManager ,其他的CacheManager将不在起作用。防止可视化工具查看为乱码; 容器中由 ConcurrentMapCacheManager 变为 RedisCacheManager。*/ RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig(); redisCacheConfiguration = redisCacheConfiguration.entryTtl(Duration.ofMinutes(30L))//设置缓存延时时间为30分钟 .disableCachingNullValues()//如果是空值,不缓存 .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(keySerializer()))//设置key值序列化 .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(valueSerializer()));//设置value值序列化为json return RedisCacheManager.builder(RedisCacheWriter.nonLockingRedisCacheWriter(factory)) .cacheDefaults(redisCacheConfiguration).build(); } }
[ "lgc-888@qq.com" ]
lgc-888@qq.com
0b69cd104f0c77cc0269ba812a95a722c4a9456a
20c6383ad6faf5845c2bf34b903b209e1f12bb41
/client/alpha/Sprite.java
c411f2e5015185d612689c528f14bd4a21de6b23
[]
no_license
daxxog/project317
5719fd0827e63901c2de489eba77ac6275433530
6f440125117ba4ecc6753adb114f8d52449fb3e8
refs/heads/master
2016-09-05T10:23:26.712788
2015-03-23T15:56:17
2015-03-23T15:56:17
26,290,603
5
2
null
null
null
null
UTF-8
Java
false
false
16,007
java
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) import java.awt.*; import java.awt.image.PixelGrabber; public final class Sprite extends DrawingArea { public Sprite(int i, int j) { myPixels = new int[i * j]; myWidth = anInt1444 = i; myHeight = anInt1445 = j; anInt1442 = anInt1443 = 0; } public Sprite(byte abyte0[], Component component) { try { // Image image = Toolkit.getDefaultToolkit().getImage(signlink.findcachedir()+"mopar.jpg"); Image image = Toolkit.getDefaultToolkit().createImage(abyte0); MediaTracker mediatracker = new MediaTracker(component); mediatracker.addImage(image, 0); mediatracker.waitForAll(); myWidth = image.getWidth(component); myHeight = image.getHeight(component); anInt1444 = myWidth; anInt1445 = myHeight; anInt1442 = 0; anInt1443 = 0; myPixels = new int[myWidth * myHeight]; PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, myWidth, myHeight, myPixels, 0, myWidth); pixelgrabber.grabPixels(); } catch(Exception _ex) { System.out.println("Error converting jpg"); } } public Sprite(StreamLoader streamLoader, String s, int i) { Stream stream = new Stream(streamLoader.getDataForName(s + ".dat")); Stream stream_1 = new Stream(streamLoader.getDataForName("index.dat")); stream_1.currentOffset = stream.readUnsignedWord(); anInt1444 = stream_1.readUnsignedWord(); anInt1445 = stream_1.readUnsignedWord(); int j = stream_1.readUnsignedByte(); int ai[] = new int[j]; for(int k = 0; k < j - 1; k++) { ai[k + 1] = stream_1.read3Bytes(); if(ai[k + 1] == 0) ai[k + 1] = 1; } for(int l = 0; l < i; l++) { stream_1.currentOffset += 2; stream.currentOffset += stream_1.readUnsignedWord() * stream_1.readUnsignedWord(); stream_1.currentOffset++; } anInt1442 = stream_1.readUnsignedByte(); anInt1443 = stream_1.readUnsignedByte(); myWidth = stream_1.readUnsignedWord(); myHeight = stream_1.readUnsignedWord(); int i1 = stream_1.readUnsignedByte(); int j1 = myWidth * myHeight; myPixels = new int[j1]; if(i1 == 0) { for(int k1 = 0; k1 < j1; k1++) myPixels[k1] = ai[stream.readUnsignedByte()]; return; } if(i1 == 1) { for(int l1 = 0; l1 < myWidth; l1++) { for(int i2 = 0; i2 < myHeight; i2++) myPixels[l1 + i2 * myWidth] = ai[stream.readUnsignedByte()]; } } } public void method343() { DrawingArea.initDrawingArea(myHeight, myWidth, myPixels); } public void method344(int i, int j, int k) { for(int i1 = 0; i1 < myPixels.length; i1++) { int j1 = myPixels[i1]; if(j1 != 0) { int k1 = j1 >> 16 & 0xff; k1 += i; if(k1 < 1) k1 = 1; else if(k1 > 255) k1 = 255; int l1 = j1 >> 8 & 0xff; l1 += j; if(l1 < 1) l1 = 1; else if(l1 > 255) l1 = 255; int i2 = j1 & 0xff; i2 += k; if(i2 < 1) i2 = 1; else if(i2 > 255) i2 = 255; myPixels[i1] = (k1 << 16) + (l1 << 8) + i2; } } } public void method345() { int ai[] = new int[anInt1444 * anInt1445]; for(int j = 0; j < myHeight; j++) { System.arraycopy(myPixels, j * myWidth, ai, j + anInt1443 * anInt1444 + anInt1442, myWidth); } myPixels = ai; myWidth = anInt1444; myHeight = anInt1445; anInt1442 = 0; anInt1443 = 0; } public void method346(int i, int j) { i += anInt1442; j += anInt1443; int l = i + j * DrawingArea.width; int i1 = 0; int j1 = myHeight; int k1 = myWidth; int l1 = DrawingArea.width - k1; int i2 = 0; if(j < DrawingArea.topY) { int j2 = DrawingArea.topY - j; j1 -= j2; j = DrawingArea.topY; i1 += j2 * k1; l += j2 * DrawingArea.width; } if(j + j1 > DrawingArea.bottomY) j1 -= (j + j1) - DrawingArea.bottomY; if(i < DrawingArea.topX) { int k2 = DrawingArea.topX - i; k1 -= k2; i = DrawingArea.topX; i1 += k2; l += k2; i2 += k2; l1 += k2; } if(i + k1 > DrawingArea.bottomX) { int l2 = (i + k1) - DrawingArea.bottomX; k1 -= l2; i2 += l2; l1 += l2; } if(k1 <= 0 || j1 <= 0) { } else { method347(l, k1, j1, i2, i1, l1, myPixels, DrawingArea.pixels); } } private void method347(int i, int j, int k, int l, int i1, int k1, int ai[], int ai1[]) { int l1 = -(j >> 2); j = -(j & 3); for(int i2 = -k; i2 < 0; i2++) { for(int j2 = l1; j2 < 0; j2++) { ai1[i++] = ai[i1++]; ai1[i++] = ai[i1++]; ai1[i++] = ai[i1++]; ai1[i++] = ai[i1++]; } for(int k2 = j; k2 < 0; k2++) ai1[i++] = ai[i1++]; i += k1; i1 += l; } } public void drawSprite1(int i, int j) { int k = 128;//was parameter i += anInt1442; j += anInt1443; int i1 = i + j * DrawingArea.width; int j1 = 0; int k1 = myHeight; int l1 = myWidth; int i2 = DrawingArea.width - l1; int j2 = 0; if(j < DrawingArea.topY) { int k2 = DrawingArea.topY - j; k1 -= k2; j = DrawingArea.topY; j1 += k2 * l1; i1 += k2 * DrawingArea.width; } if(j + k1 > DrawingArea.bottomY) k1 -= (j + k1) - DrawingArea.bottomY; if(i < DrawingArea.topX) { int l2 = DrawingArea.topX - i; l1 -= l2; i = DrawingArea.topX; j1 += l2; i1 += l2; j2 += l2; i2 += l2; } if(i + l1 > DrawingArea.bottomX) { int i3 = (i + l1) - DrawingArea.bottomX; l1 -= i3; j2 += i3; i2 += i3; } if(!(l1 <= 0 || k1 <= 0)) { method351(j1, l1, DrawingArea.pixels, myPixels, j2, k1, i2, k, i1); } } public void drawSprite(int i, int k) { i += anInt1442; k += anInt1443; int l = i + k * DrawingArea.width; int i1 = 0; int j1 = myHeight; int k1 = myWidth; int l1 = DrawingArea.width - k1; int i2 = 0; if(k < DrawingArea.topY) { int j2 = DrawingArea.topY - k; j1 -= j2; k = DrawingArea.topY; i1 += j2 * k1; l += j2 * DrawingArea.width; } if(k + j1 > DrawingArea.bottomY) j1 -= (k + j1) - DrawingArea.bottomY; if(i < DrawingArea.topX) { int k2 = DrawingArea.topX - i; k1 -= k2; i = DrawingArea.topX; i1 += k2; l += k2; i2 += k2; l1 += k2; } if(i + k1 > DrawingArea.bottomX) { int l2 = (i + k1) - DrawingArea.bottomX; k1 -= l2; i2 += l2; l1 += l2; } if(!(k1 <= 0 || j1 <= 0)) { method349(DrawingArea.pixels, myPixels, i1, l, k1, j1, l1, i2); } } private void method349(int ai[], int ai1[], int j, int k, int l, int i1, int j1, int k1) { int i;//was parameter int l1 = -(l >> 2); l = -(l & 3); for(int i2 = -i1; i2 < 0; i2++) { for(int j2 = l1; j2 < 0; j2++) { i = ai1[j++]; if(i != 0) ai[k++] = i; else k++; i = ai1[j++]; if(i != 0) ai[k++] = i; else k++; i = ai1[j++]; if(i != 0) ai[k++] = i; else k++; i = ai1[j++]; if(i != 0) ai[k++] = i; else k++; } for(int k2 = l; k2 < 0; k2++) { i = ai1[j++]; if(i != 0) ai[k++] = i; else k++; } k += j1; j += k1; } } private void method351(int i, int j, int ai[], int ai1[], int l, int i1, int j1, int k1, int l1) { int k;//was parameter int j2 = 256 - k1; for(int k2 = -i1; k2 < 0; k2++) { for(int l2 = -j; l2 < 0; l2++) { k = ai1[i++]; if(k != 0) { int i3 = ai[l1]; ai[l1++] = ((k & 0xff00ff) * k1 + (i3 & 0xff00ff) * j2 & 0xff00ff00) + ((k & 0xff00) * k1 + (i3 & 0xff00) * j2 & 0xff0000) >> 8; } else { l1++; } } l1 += j1; i += l; } } public void method352(int i, int j, int ai[], int k, int ai1[], int i1, int j1, int k1, int l1, int i2) { try { int j2 = -l1 / 2; int k2 = -i / 2; int l2 = (int)(Math.sin((double)j / 326.11000000000001D) * 65536D); int i3 = (int)(Math.cos((double)j / 326.11000000000001D) * 65536D); l2 = l2 * k >> 8; i3 = i3 * k >> 8; int j3 = (i2 << 16) + (k2 * l2 + j2 * i3); int k3 = (i1 << 16) + (k2 * i3 - j2 * l2); int l3 = k1 + j1 * DrawingArea.width; for(j1 = 0; j1 < i; j1++) { int i4 = ai1[j1]; int j4 = l3 + i4; int k4 = j3 + i3 * i4; int l4 = k3 - l2 * i4; for(k1 = -ai[j1]; k1 < 0; k1++) { DrawingArea.pixels[j4++] = myPixels[(k4 >> 16) + (l4 >> 16) * myWidth]; k4 += i3; l4 -= l2; } j3 += l2; k3 += i3; l3 += DrawingArea.width; } } catch(Exception _ex) { } } public void method353(int i, double d, int l1) { //all of the following were parameters int j = 15; int k = 20; int l = 15; int j1 = 256; int k1 = 20; //all of the previous were parameters try { int i2 = -k / 2; int j2 = -k1 / 2; int k2 = (int)(Math.sin(d) * 65536D); int l2 = (int)(Math.cos(d) * 65536D); k2 = k2 * j1 >> 8; l2 = l2 * j1 >> 8; int i3 = (l << 16) + (j2 * k2 + i2 * l2); int j3 = (j << 16) + (j2 * l2 - i2 * k2); int k3 = l1 + i * DrawingArea.width; for(i = 0; i < k1; i++) { int l3 = k3; int i4 = i3; int j4 = j3; for(l1 = -k; l1 < 0; l1++) { int k4 = myPixels[(i4 >> 16) + (j4 >> 16) * myWidth]; if(k4 != 0) DrawingArea.pixels[l3++] = k4; else l3++; i4 += l2; j4 -= k2; } i3 += k2; j3 += l2; k3 += DrawingArea.width; } } catch(Exception _ex) { } } public void method354(Background background, int i, int j) { j += anInt1442; i += anInt1443; int k = j + i * DrawingArea.width; int l = 0; int i1 = myHeight; int j1 = myWidth; int k1 = DrawingArea.width - j1; int l1 = 0; if(i < DrawingArea.topY) { int i2 = DrawingArea.topY - i; i1 -= i2; i = DrawingArea.topY; l += i2 * j1; k += i2 * DrawingArea.width; } if(i + i1 > DrawingArea.bottomY) i1 -= (i + i1) - DrawingArea.bottomY; if(j < DrawingArea.topX) { int j2 = DrawingArea.topX - j; j1 -= j2; j = DrawingArea.topX; l += j2; k += j2; l1 += j2; k1 += j2; } if(j + j1 > DrawingArea.bottomX) { int k2 = (j + j1) - DrawingArea.bottomX; j1 -= k2; l1 += k2; k1 += k2; } if(!(j1 <= 0 || i1 <= 0)) { method355(myPixels, j1, background.aByteArray1450, i1, DrawingArea.pixels, 0, k1, k, l1, l); } } private void method355(int ai[], int i, byte abyte0[], int j, int ai1[], int k, int l, int i1, int j1, int k1) { int l1 = -(i >> 2); i = -(i & 3); for(int j2 = -j; j2 < 0; j2++) { for(int k2 = l1; k2 < 0; k2++) { k = ai[k1++]; if(k != 0 && abyte0[i1] == 0) ai1[i1++] = k; else i1++; k = ai[k1++]; if(k != 0 && abyte0[i1] == 0) ai1[i1++] = k; else i1++; k = ai[k1++]; if(k != 0 && abyte0[i1] == 0) ai1[i1++] = k; else i1++; k = ai[k1++]; if(k != 0 && abyte0[i1] == 0) ai1[i1++] = k; else i1++; } for(int l2 = i; l2 < 0; l2++) { k = ai[k1++]; if(k != 0 && abyte0[i1] == 0) ai1[i1++] = k; else i1++; } i1 += l; k1 += j1; } } public int myPixels[]; public int myWidth; public int myHeight; private int anInt1442; private int anInt1443; public int anInt1444; public int anInt1445; }
[ "david@volminator.com" ]
david@volminator.com
f8fd5e532d61ab3e6ed0ac406ee14fd8057ba8ce
c120828d138ba1df82c013c8f6bb5483ee4f409e
/app/src/main/java/imc/cursoandroid/gdgcali/com/imccalculator/api/Server.java
c9a961fc092c60872c0cd99b9c149c2fc5763c3d
[]
no_license
fcamargovalencia/claseAndroid
dbc77b303ae54a94a15b30625735663829e032c3
4133b5b2541b3f54d4498bea37516dc83e1350a4
refs/heads/master
2020-12-05T23:41:22.932603
2016-08-22T19:46:45
2016-08-22T19:46:45
66,298,634
0
0
null
null
null
null
UTF-8
Java
false
false
1,854
java
package imc.cursoandroid.gdgcali.com.imccalculator.api; import android.content.Context; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; /** * Created by joseberna on 16/08/16. */ public class Server { private static Server instance; private IServer facade; protected Server() { } public static Server getInstance() { if (instance == null) { instance = new Server(); } return instance; } public void init(String url, final Context context) { /* Gson gson = new GsonBuilder() .registerTypeAdapterFactory(new ItemTypeAdapterFactory()) // This is the important line ;) .create(); RestAdapter AdapterWithHeaders = new RestAdapter.Builder() .setEndpoint(url) .setLogLevel(RestAdapter.LogLevel.FULL) .setConverter(new GsonConverter(gson)) .build(); facade = AdapterWithHeaders.create(IServer.class);*/ //Adicionar con ssl HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(url) .addConverterFactory(GsonConverterFactory.create()) .client(client) .build(); facade = retrofit.create(IServer.class); } public static IServer getSingleton() { return getInstance().facade; } }
[ "fv@iagree.co" ]
fv@iagree.co
84a1280b153c06cadff67298c8ed4cc24933c718
892abb9ebd5896264041fcca64d4f4ce46d17865
/src/Mock/servlet/PostListServlet.java
c818ba2c451113e4597211cce520375e4a89fe19
[]
no_license
khoa23/BlogChiaSeKienThuc_JavaWeb
01787a8c4e30cf19a9d1e8b168fcca2073e40969
be1229a8f11382798d96ef45d20865a241974457
refs/heads/master
2022-12-26T12:45:19.494438
2020-10-08T11:51:22
2020-10-08T11:51:22
302,323,458
0
0
null
null
null
null
UTF-8
Java
false
false
1,591
java
package Mock.servlet; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import Mock.model.Post; import Mock.dao.PostDao; import Mock.utils.MyUtils; @WebServlet(urlPatterns = { "/postList" }) public class PostListServlet extends HttpServlet{ private static final long serialVersionUID = 1L; public PostListServlet() { super(); } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection conn = MyUtils.getStoredConnection(request); String errorString = null; List<Post> list = null; try { list = PostDao.getListPost(conn); } catch (SQLException e) { e.printStackTrace(); errorString = e.getMessage(); } // Store info in request attribute, before forward to views request.setAttribute("errorString", errorString); request.setAttribute("postList", list); // Forward to /WEB-INF/views/productListView.jsp RequestDispatcher dispatcher = request.getServletContext() .getRequestDispatcher("/WEB-INF/views/admin/listPost.jsp"); dispatcher.forward(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "hodangkhoa1998@gmail.com" ]
hodangkhoa1998@gmail.com
79eac1254e561bb5b1924bed47a57b2a6e45a839
cf29ccb4411a2652e95f1b2496c435a0850f3540
/main/java/marlon/minecraftai/ai/strategy/CraftPickaxeStrategy.java
0a7becf8f748f5c6f5b9aebd92a6bcadc9aa583b
[]
no_license
marloncalleja/MC-Experiment-AI
0799cbad4f7f75f5d7c010fb3debd4cf63302048
95d5019dac85353b11d176a838fc265ddcb83eab
refs/heads/master
2022-07-21T04:10:44.333081
2022-07-10T10:13:24
2022-07-10T10:13:24
93,537,809
4
1
null
2018-10-01T09:44:24
2017-06-06T16:05:36
Java
UTF-8
Java
false
false
15,281
java
package marlon.minecraftai.ai.strategy; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.MarkerManager; import marlon.minecraftai.ai.AIHelper; import marlon.minecraftai.ai.command.BlockWithDataOrDontcare; import marlon.minecraftai.ai.path.world.BlockSet; import marlon.minecraftai.ai.path.world.WorldData; import marlon.minecraftai.ai.scanner.BlockRangeFinder; import marlon.minecraftai.ai.scanner.BlockRangeScanner; import marlon.minecraftai.ai.scanner.RangeBlockHandler; import marlon.minecraftai.ai.strategy.CraftStrategy.CraftingPossibility; import marlon.minecraftai.ai.strategy.CraftStrategy.CraftingTableData; import marlon.minecraftai.ai.strategy.CraftStrategy.CraftingTableFinder; import marlon.minecraftai.ai.strategy.CraftStrategy.CraftingTableHandler; import marlon.minecraftai.ai.strategy.CraftStrategy.CraftingWish; import marlon.minecraftai.ai.task.CloseScreenTask; import marlon.minecraftai.ai.task.UseItemOnBlockAtTask; import marlon.minecraftai.ai.task.WaitTask; import marlon.minecraftai.ai.task.error.TaskError; import marlon.minecraftai.ai.task.inventory.ItemCountList; import marlon.minecraftai.ai.task.inventory.ItemWithSubtype; import marlon.minecraftai.ai.task.inventory.PutOnCraftingTableTask; import marlon.minecraftai.ai.task.inventory.TakeResultItem; import marlon.minecraftai.ai.utils.PrivateFieldUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiCrafting; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.util.BlockPos; import net.minecraftforge.oredict.ShapedOreRecipe; public class CraftPickaxeStrategy extends PathFinderStrategy { //added Marlon.C public static boolean active = true; private static final Marker MARKER_RECIPE = MarkerManager .getMarker("recipe"); private static final Logger LOGGER = LogManager .getLogger(CraftPickaxeStrategy.class); public static final class CraftingPossibility { public static final int SUBTYPE_IGNORED = 32767; private static final int WIDTH = 0; private static final int HEIGHT = 1; private final ItemWithSubtype[][] slots = new ItemWithSubtype[3][3]; public CraftingPossibility(IRecipe r) { LOGGER.trace(MARKER_RECIPE, "Parsing recipe: " + r); if (r instanceof ShapedRecipes) { ShapedRecipes shapedRecipes = (ShapedRecipes) r; LOGGER.trace(MARKER_RECIPE, "Interpreting ShapedRecipes: " + shapedRecipes.getRecipeOutput().getItem() .getUnlocalizedName()); int[] dim = getSizes(shapedRecipes); ItemStack[] items = PrivateFieldUtils.getFieldValue( shapedRecipes, ShapedRecipes.class, ItemStack[].class); LOGGER.trace(MARKER_RECIPE, "Found items of size " + dim[WIDTH] + "x" + dim[HEIGHT] + ": " + Arrays.toString(items)); for (int x = 0; x < dim[WIDTH]; x++) { for (int y = 0; y < dim[HEIGHT]; y++) { ItemStack itemStack = items[x + y * dim[WIDTH]]; if (itemStack != null) { this.slots[x][y] = new ItemWithSubtype(itemStack); } } } LOGGER.trace(MARKER_RECIPE, "Slots " + Arrays.toString(slots)); } else if (r instanceof ShapedOreRecipe) { ShapedOreRecipe shapedRecipes = (ShapedOreRecipe) r; try { // Width is the first integer field. int width = PrivateFieldUtils.getField(shapedRecipes, ShapedOreRecipe.class, Integer.TYPE).getInt(shapedRecipes); for (int x = 0; x < width; x++) { int height = shapedRecipes.getRecipeSize() / width; for (int y = 0; y < height; y++) { Object itemStack = shapedRecipes.getInput()[x + y * width]; if (itemStack instanceof ItemStack) { this.slots[x][y] = new ItemWithSubtype( (ItemStack) itemStack); } else if (itemStack instanceof List) { List list = (List) itemStack; this.slots[x][y] = new ItemWithSubtype( (ItemStack) list.get(0)); if (list.size() > 1) { LOGGER.warn(MARKER_RECIPE, "Multiple items found, only using first: " + list); } } else if (itemStack != null) { LOGGER.error(MARKER_RECIPE, "Cannot handle " + itemStack.getClass()); throw new IllegalArgumentException("Cannot handle " + itemStack.getClass()); } } } } catch (SecurityException e) { throw new IllegalArgumentException("Cannot access " + r); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Cannot access " + r); } } else { LOGGER.error(MARKER_RECIPE, "An item recipe has been found but the item cannot be crafted. The class " + r.getClass().getCanonicalName() + " cannot be understood."); throw new IllegalArgumentException("Cannot (yet) craft " + r); } } private ItemStack[] getItems(ShapedRecipes shapedRecipes) { for (Field f : ShapedRecipes.class.getDeclaredFields()) { if (f.getType().isArray()) { Class<?> componentType = f.getType().getComponentType(); if (componentType == ItemStack.class) { f.setAccessible(true); try { return (ItemStack[]) f.get(shapedRecipes); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } } return null; } private int[] getSizes(ShapedRecipes shapedRecipes) { int i = 0; int[] sizes = new int[2]; for (Field f : ShapedRecipes.class.getDeclaredFields()) { if (f.getType() == Integer.TYPE) { f.setAccessible(true); try { sizes[i] = f.getInt(shapedRecipes); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } i++; if (i >= sizes.length) { break; } } } return sizes; } public ItemCountList getRequiredItems(int count) { ItemCountList list = new ItemCountList(); for (ItemWithSubtype[] s : slots) { for (ItemWithSubtype ss : s) { list.add(ss, count); } } LOGGER.trace(MARKER_RECIPE, "Items required for " + this + ": " + list); return list; } public boolean goodForPosition(ItemWithSubtype item, int x, int y) { return slots[x][y] != null ? item != null && (slots[x][y].equals(item) || slots[x][y].equals(item .withSubtype(SUBTYPE_IGNORED))) : item == null; } @Override public String toString() { return "CraftingPossibility [slots=" + Arrays.toString(slots) + "]"; } } public static final class CraftingWish { private final int amount; private final ItemWithSubtype item; public CraftingWish(int amount, ItemWithSubtype item) { this.amount = amount; this.item = item; } public List<CraftingPossibility> getPossibility() { List<IRecipe> recipes = CraftingManager.getInstance() .getRecipeList(); List<CraftingPossibility> possible = new ArrayList<CraftingPossibility>(); for (IRecipe r : recipes) { ItemStack out = r.getRecipeOutput(); if (out != null && new ItemWithSubtype(out).equals(item)) { try { possible.add(new CraftingPossibility(r)); } catch (IllegalArgumentException e) { System.err.println("Cannot craft:" + e.getMessage()); } } } return possible; } @Override public String toString() { return "CraftingWish [amount=" + amount + ", item=" + item + "]"; } } public static class CraftingTableData { public final BlockPos pos; public BlockPos getPos() { //Added Marlon.C return pos; } public CraftingTableData(BlockPos pos) { this.pos = pos; } @Override public String toString() { return "CraftingTableData [" + pos + "]"; } } public final static class CraftingTableHandler extends RangeBlockHandler<CraftingTableData> { private static final BlockSet IDS = new BlockSet(Blocks.crafting_table); private final HashMap<BlockPos, CraftingTableData> found = new HashMap<BlockPos, CraftingTableData>(); //changed from hashtable to map @Override public BlockSet getIds() { return IDS; } @Override public void scanBlock(WorldData world, int id, int x, int y, int z) { BlockPos pos = new BlockPos(x, y, z); found.put(pos, new CraftingTableData(pos)); } @Override protected Collection<Entry<BlockPos, CraftingTableData>> getTargetPositions() { return found.entrySet(); } public HashMap<BlockPos, CraftingTableData> getCraftingTables() { //added Marlon.C return found; } } public static class CannotCraftError extends TaskError { public CannotCraftError(CraftingWish wish) { super("Cannor craft " + wish.item); } @Override public String toString() { return "CannotCraftError []"; } } public static class CraftingTableFinder extends BlockRangeFinder { private final CraftingWish wish; CraftingTableHandler h = new CraftingTableHandler(); private boolean failed; private int oldItemCount = -1; public CraftingTableFinder(CraftingWish wish) { this.wish = wish; } public HashMap<BlockPos, CraftingTableData> getCraftingTables() //added Marlon.C { return this.h.getCraftingTables(); } @Override protected boolean runSearch(BlockPos playerPosition) { int missing = getMissing(); if (failed || missing <= 0) { return true; } return super.runSearch(playerPosition); } /** * Might be negative. * * @return */ private int getMissing() { int itemCount = countInInventory(wish.item); if (oldItemCount < 0) { oldItemCount = itemCount; } return oldItemCount + wish.amount - itemCount; } @Override public BlockRangeScanner constructScanner(BlockPos playerPosition) { //changed Marlon.C from protected to public BlockRangeScanner scanner = super.constructScanner(playerPosition); scanner.addHandler(h); return scanner; } @Override protected float rateDestination(int distance, int x, int y, int z) { ArrayList<CraftingTableData> tables = h .getReachableForPos(new BlockPos(x, y, z)); return !failed && tables != null && tables.size() > 0 ? distance : -1; } @Override protected void addTasksForTarget(BlockPos currentPos) { ArrayList<CraftingTableData> tables = h .getReachableForPos(currentPos); CraftingTableData table = tables.get(0); List<CraftingPossibility> possibilities = wish.getPossibility(); System.out.println("Crafting one of: " + possibilities); ItemWithSubtype[][] grid = getCraftablePossibility(helper, possibilities); if (grid == null) { failed = true; System.err.println("Could not find any way to craft this."); // FIXME: Desync. Error. return; } addTask(new UseItemOnBlockAtTask(table.pos) { @Override protected boolean isBlockAllowed(AIHelper h, BlockPos pos) { return h.getBlock(pos) == Blocks.crafting_table; } @Override public boolean isFinished(AIHelper h) { return super.isFinished(h) && h.getMinecraft().currentScreen instanceof GuiCrafting; } }); addCraftTaks(grid); addTask(new WaitTask(5)); addTask(new TakeResultItem(GuiCrafting.class, 0)); addTask(new WaitTask(5)); addTask(new CloseScreenTask()); active = false; } private void addCraftTaks(ItemWithSubtype[][] grid) { int missing = getMissing(); if (missing <= 0) { return; } for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { if (grid[x][y] != null) { int inventoryTotal = countInInventory(grid[x][y]); int slotCount = countInGrid(grid, grid[x][y]); int itemCount = Math.min(inventoryTotal / slotCount, missing); addTask(new PutOnCraftingTableTask(y * 3 + x, grid[x][y], itemCount)); addTask(new WaitTask(3)); } } } } private int countInGrid(ItemWithSubtype[][] grid, ItemWithSubtype itemWithSubtype) { int count = 0; for (ItemWithSubtype[] ss : grid) { for (ItemWithSubtype s : ss) { if (itemWithSubtype.equals(s)) { count++; } } } return count; } private int countInInventory(ItemWithSubtype itemWithSubtype) { int count = 0; for (ItemStack s : helper.getMinecraft().thePlayer.inventory.mainInventory) { if (itemWithSubtype.equals(ItemWithSubtype.fromStack(s))) { count += s.stackSize; } } return count; } /** * Gets an array of items that specifies how they need to be placed on * the crafting grid. * * @param h * @param possibilities * @return */ private ItemWithSubtype[][] getCraftablePossibility(AIHelper h, List<CraftingPossibility> possibilities) { for (CraftingPossibility p : possibilities) { ItemWithSubtype[][] assignedSlots = new ItemWithSubtype[3][3]; // TODO: Order this in a better way. We need to have multiples // of our item count first. for (ItemStack i : h.getMinecraft().thePlayer.inventory.mainInventory) { if (i == null) { continue; } ItemWithSubtype item = new ItemWithSubtype(i); int leftOver = i.stackSize; for (int x = 0; x < 3 && leftOver > 0; x++) { for (int y = 0; y < 3 && leftOver > 0; y++) { if (p.goodForPosition(item, x, y) && assignedSlots[x][y] == null) { assignedSlots[x][y] = item; leftOver--; LOGGER.trace("Placing at " + x + "," + y + ": " + item); } } } } boolean allGood = true; for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { if (!p.goodForPosition(assignedSlots[x][y], x, y)) { allGood = false; LOGGER.warn(MARKER_RECIPE, "Placed wrong item at " + x + "," + y + ": " + assignedSlots[x][y]); } } } if (allGood) { return assignedSlots; } } LOGGER.warn("Could not find any way to craft any of " + possibilities); return null; } @Override public String toString() { return "CraftingTableFinder [wish=" + wish + ", failed=" + failed + ", oldItemCount=" + oldItemCount + "]"; } } public CraftPickaxeStrategy(int amount, int itemId, int subtype) { this(amount, new ItemWithSubtype(itemId, subtype)); } public CraftPickaxeStrategy(int amount, ItemWithSubtype item) { super(new CraftingTableFinder(new CraftingWish(amount, item)), "Crafting"); } public CraftPickaxeStrategy(int amount, BlockWithDataOrDontcare itemType) { this(amount, itemType.getItemType()); } @Override public void searchTasks(AIHelper helper) { // If chest open, close it. if (helper.getMinecraft().currentScreen instanceof GuiContainer) { addTask(new CloseScreenTask()); } super.searchTasks(helper); } @Override public boolean checkShouldTakeOver(AIHelper helper) { if (active) { return true; } return false; } @Override public String getDescription(AIHelper helper) { return "Craft Pickaxe"; } }
[ "marlon.calleja1994@gmail.com" ]
marlon.calleja1994@gmail.com
a40fcefc5e9231ebb834e65c5779e36065549fa7
e472859fb7cfbb4bcd1932b06639bcfc8748b019
/src/main/java/ru/ptrofimov/demo/App.java
d3c987933533c009bf44ca86c97239f374bcf383
[]
no_license
ptrfmv/money-transfer-rest-demo
6396b9800eeedca8c78632e20cb5c4f21af056fa
8ed1bac0226fe7450c68458416b4e2d5c539c9d8
refs/heads/master
2020-05-05T07:22:19.684520
2019-04-27T13:07:36
2019-04-27T13:07:36
179,822,696
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
package ru.ptrofimov.demo; import org.eclipse.jetty.server.Server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ru.ptrofimov.demo.utils.JettyUtils; /** * Money Transfer Demo Main Class. * Starts a Jetty instance for user to play freely with {@link ru.ptrofimov.demo.rest.MoneyTransferEntryPoint}. */ public class App { private static final Logger logger = LoggerFactory.getLogger(App.class); public static void main(String[] args) throws Exception { logger.trace("invoked main"); Server jettyServer = JettyUtils.createServer(); try { jettyServer.start(); jettyServer.join(); } catch (Exception e) { logger.error(e.getMessage(), e); throw e; } finally { jettyServer.destroy(); } } }
[ "trpm.ja.nai@protonmail.com" ]
trpm.ja.nai@protonmail.com
1ed875f16d66b610e2d9f6b81dc5bd172634ab84
0299fcc64fd197f46f5f25beb786ebe202559803
/src/patterns/strategy/IQuackBehavior.java
d1b2e2d58af314b7624a52f037fbdd217035e0c0
[]
no_license
viniciosbastos/hands-on-design-patterns
b9ff7f2d3e1419fa6ca5abf1855ba79d7534e1cb
1ea65f946d12c308f6517d8e26e7c0ff390c1505
refs/heads/master
2020-07-15T16:45:37.103027
2019-09-01T23:57:50
2019-09-01T23:57:50
205,608,103
0
0
null
null
null
null
UTF-8
Java
false
false
79
java
package patterns.strategy; public interface IQuackBehavior { void quack(); }
[ "aurelio.vinicios1996@gmail.com" ]
aurelio.vinicios1996@gmail.com
f76ef8b45b554cf90e8305c0498ba3fef9a070c1
2453c2753404494e861d2ab5af2bffb512a3e430
/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/GroupDAO.java
1ee1cf1eea9c59f741b56ea6e1c57865b3684cbb
[ "Apache-2.0" ]
permissive
pzhao12/syncope
65120d1103b5009ba3619a8335ded3db9dc1153a
10d03d4f3a4d772b1a3790e50a4adf4219b913d9
refs/heads/master
2021-09-06T06:32:44.806647
2018-02-03T06:36:17
2018-02-03T06:36:17
105,491,474
0
0
null
2017-10-02T02:35:09
2017-10-02T02:35:09
null
UTF-8
Java
false
false
3,349
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.syncope.core.persistence.api.dao; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.core.persistence.api.entity.AnyTypeClass; import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership; import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.group.TypeExtension; import org.apache.syncope.core.persistence.api.entity.user.UMembership; import org.apache.syncope.core.persistence.api.entity.user.User; public interface GroupDAO extends AnyDAO<Group> { Map<String, Integer> countByRealm(); Group findByName(String name); List<Group> findOwnedByUser(String userKey); List<Group> findOwnedByGroup(String groupKey); List<AMembership> findAMemberships(Group group); List<UMembership> findUMemberships(Group group); List<TypeExtension> findTypeExtensions(AnyTypeClass anyTypeClass); List<String> findADynMembers(Group group); Collection<String> findAllResourceKeys(final String key); void clearADynMembers(Group group); /** * Evaluates all the dynamic group membership conditions against the given anyObject (invoked during save). * * @param anyObject anyObject being saved * @return pair of groups dynamically assigned before and after refresh */ Pair<Set<String>, Set<String>> refreshDynMemberships(AnyObject anyObject); /** * Removes the dynamic group memberships of the given anyObject (invoked during delete). * * @param anyObject anyObject being deleted * @return groups dynamically assigned before refresh */ Set<String> removeDynMemberships(AnyObject anyObject); List<String> findUDynMembers(Group group); void clearUDynMembers(Group group); /** * Evaluates all the dynamic group membership conditions against the given user (invoked during save). * * @param user user being saved * @return pair of groups dynamically assigned before and after refresh */ Pair<Set<String>, Set<String>> refreshDynMemberships(User user); /** * Removes the dynamic group memberships of the given anyObject (invoked during delete). * * @param user user being deleted * @return groups dynamically assigned before refresh */ Set<String> removeDynMemberships(User user); }
[ "ilgrosso@apache.org" ]
ilgrosso@apache.org
d7f3c021120158aaacd3a9ae94fb92a6ed272bfc
508609d0f53cf0cf467cc869d0489988e87f04c4
/src/main/java/com/vsii/service/SchoolService.java
79511a2313a079cf206bd16258f4b1b79ded6d78
[]
no_license
phinamdesign/Student-Management
d1e8752e85a0b83ad7ade24a6ff520bdcb5e3356
afe0e0c8a7955457d6603fdf8ff5a6d4753e193b
refs/heads/master
2022-04-21T06:26:32.695510
2020-04-15T06:24:25
2020-04-15T06:24:25
255,498,337
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package com.vsii.service; import com.vsii.model.School; import java.util.Optional; public interface SchoolService { Optional<School> findById(Long id); Iterable<School> findAll(); School save(School school); void delete(Long id); }
[ "phinamhd1992@gmail.com" ]
phinamhd1992@gmail.com
0751e5455ff1fa0758afe857d9c9368c4be37a1c
f9a6ccb684883180bc5438ee5383fcf680bc5561
/app/src/main/java/com/tpcodl/billingreading/database/CustomMessageEvent.java
9e125b5855014721268d1b46c6e5da8fa96451b1
[]
no_license
avik1990/BILLY
ad6ba454916d66a723231626a4f0a92da58a4d6d
a07818db3ecb78ca5fac33ac8576da060da14208
refs/heads/master
2023-03-22T10:23:46.148147
2021-03-22T06:36:23
2021-03-22T06:36:23
350,233,643
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package com.tpcodl.billingreading.database; public class CustomMessageEvent { public String customMessage; public String getCustomMessage() { return customMessage; } public void setCustomMessage(String customMessage) { this.customMessage = customMessage; } }
[ "avik1990@gmail.com" ]
avik1990@gmail.com
ee6d6e491e07985fb37a0c9a798a23cddeb79d53
52217ffd952c271b4aa759960244bfc1d26e8687
/src/com/dsa/dp/PalindromePartitioningII.java
222c7b64da18df6f42e528fa4d133eb984976ea7
[ "MIT" ]
permissive
amygeek/cs
3496eed0da1a8e9eec0bc8524c978f879e7addfc
716e5f06c97ed5b0dbf79d7db483cefe43e48640
refs/heads/master
2021-10-07T20:35:39.342307
2018-12-05T07:25:07
2018-12-05T07:25:07
115,767,240
0
0
null
null
null
null
UTF-8
Java
false
false
2,624
java
package com.dsa.dp; import java.util.HashMap; public class PalindromePartitioningII { static HashMap<String,Integer> map = new HashMap<String, Integer>(); public int splitDP(String x){ if( x == "" || isPalindrome(x)){ // System.out.println(x); return 0; }else{ int cuts = Integer.MAX_VALUE; for (int i = 1; i < x.length() ; i++) { int leftCut =0; int rightCut = 0; String leftStr = x.substring(0, i ); String rightStr = x.substring(i, x.length()); if(map.containsKey(leftStr)){ leftCut = map.get(leftStr); }else{ leftCut = splitDP(leftStr); map.put(leftStr,leftCut); } if(map.containsKey(rightStr)){ rightCut = map.get(rightStr); }else{ rightCut = splitDP(rightStr); map.put(rightStr,rightCut); } cuts = Math.min( 1 + leftCut + rightCut, cuts); } return cuts; } } public int splitRecursion(String x){ if(x=="" || isPalindrome(x)){ // System.out.println(x); return 0; }else{ int cuts = Integer.MAX_VALUE; for (int i = 1; i <x.length() ; i++) { cuts = Math.min(1+ splitRecursion(x.substring(0, i)) + splitRecursion(x.substring(i, x.length())),cuts); } return cuts; } } public boolean isPalindrome(String s){ int n = s.length(); for (int i=0;i<(n / 2) + 1;++i) { if (s.charAt(i) != s.charAt(n - i - 1)) { return false; } } return true; } public static void main(String[] args) { String a = "cdcdddcdadcdcdcd"; PalindromePartitioningII s = new PalindromePartitioningII(); long startTime = System.currentTimeMillis(); System.out.println("Recursion- Cuts Required: " + s.splitRecursion(a)); long stopTime = System.currentTimeMillis(); long elapsedTime = stopTime - startTime; System.out.println("Recursion- Time Taken(ms): " + elapsedTime); startTime = System.currentTimeMillis(); System.out.println("Dynamic Programming- Cuts Required: "+ s.splitDP(a)); stopTime = System.currentTimeMillis(); elapsedTime = stopTime - startTime; System.out.println("Dynamic Programming- Time Taken(ms): " + elapsedTime); } }
[ "Amy.huang@fox.com" ]
Amy.huang@fox.com
bce46f58599637db39e7c92f7a1a2f80a4a3eb7a
8416357ce61cde4b075689e072dcf37bae595598
/src/main/java/Model/InsertDB.java
938acf55280e05c7b2a6935b11d8e31dbaad2dfb
[]
no_license
JoseMariaMQ/DI_UD8_Caso1
5dd1247a9d107462d714b2eca8eea97a4519a6fc
884b1e6a30ef7e1131f1c5f718f246de17a36aa6
refs/heads/master
2023-02-28T02:36:03.875782
2021-02-04T17:36:27
2021-02-04T17:36:27
336,023,747
0
0
null
null
null
null
UTF-8
Java
false
false
7,244
java
package Model; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.query.Query; import java.time.LocalDate; import java.time.LocalTime; import java.util.ArrayList; public class InsertDB { //Método de consulta de trabajador por nombre public int buscarTrabajador(String nombre) { try { //Creamos y abrimos sesión SessionFactory myFactory = SessionManagement.getMyFactory(); Session mySession = myFactory.openSession(); //Creamos consulta con parámetro Query query = mySession.createQuery("FROM Trabajadores WHERE nombre LIKE :nombre"); query.setParameter("nombre", nombre); ArrayList<Trabajadores> trabajador = (ArrayList<Trabajadores>) query.list(); //Comprobamos que devuelve datos y retornamos el id if (trabajador.size() > 0) { return trabajador.get(0).getId(); } } catch (HibernateException e) { e.printStackTrace(); } return -1; //Si no devuelve datos retornamos -1 } //Método de consulta de asistencia de trabajador por id de trabajador y fecha public Asistencias buscarAsistencia(int id, LocalDate fecha) { Asistencias asistencia = null; //Inicializamos asistencia en null try { //Creamos y abrimos sesión SessionFactory myFactory = SessionManagement.getMyFactory(); Session mySession = myFactory.openSession(); //Creamos consulta con parámetros Query query = mySession.createQuery("FROM Asistencias WHERE id_trabajador=:id AND fecha=:fecha"); query.setParameter("id", id); query.setParameter("fecha", fecha); ArrayList<Asistencias> asistencias = (ArrayList<Asistencias>) query.list(); //Comprobamos que devuelve datos y retornamos la asistencia que devuelve if (asistencias.size() > 0) { asistencia = new Asistencias(asistencias.get(0).getId(), asistencias.get(0).getFecha(), asistencias.get(0).getHora_entrada(), asistencias.get(0).getHora_salida(), asistencias.get(0).getId_trabajador()); return asistencia; } } catch (HibernateException e) { e.printStackTrace(); } return asistencia; //Si no devuelve nada retornamos asistencia en null } //Método para el registro de hora de entrada public int registrarEntrada(String nombre, LocalDate fecha, LocalTime hora) { //Almacenamos el id del trabajador int idTrabajador = buscarTrabajador(nombre); //Comprobamos que existe trabajador if (idTrabajador != -1) { Asistencias asistencia = buscarAsistencia(idTrabajador, fecha); if (asistencia == null) { Asistencias registroEntrada = new Asistencias(fecha, hora, null, idTrabajador); try { //Creamos y abrimos sesión SessionFactory myFactory = SessionManagement.getMyFactory(); Session mySession = myFactory.openSession(); //Insertamos registro de asistencia con entrada mySession.beginTransaction(); mySession.save(registroEntrada); mySession.getTransaction().commit(); return 1; } catch (HibernateException e) { e.printStackTrace(); System.out.println("Error de registro de entrada, prueba de nuevo"); return -2; } //Si la asistencia existe ya retornamos 0 } else if (asistencia != null && asistencia.getHora_entrada() != null) { System.out.println("Ya hay registro de hora de entrada para ese trabajador"); return 0; } else { //Si por alguna circunstancia existe asistencia sin hora de entrada la actualizamos Asistencias registroEntrada = new Asistencias(fecha, hora, null, idTrabajador); try { //Creamos y abrimos sesión SessionFactory myFactory = SessionManagement.getMyFactory(); Session mySession = myFactory.openSession(); //Insertamos registro de asistencia con entrada mySession.beginTransaction(); mySession.update(registroEntrada); mySession.getTransaction().commit(); return 1; } catch (HibernateException e) { e.printStackTrace(); System.out.println("Error de registro de entrada, prueba de nuevo"); return -2; } } } else { //Si el trabajador no existe en la base de datos retornamos -1 System.out.println("No existe un trabajador con ese nombre"); return -1; } } //Método para el registro de hora de salida public int registrarSalida(String nombre, LocalDate fecha, LocalTime hora) { //Almacenamos id trabajador int idTrabajador = buscarTrabajador(nombre); //Comprobamos su existe trabajador if (idTrabajador != -1) { Asistencias asistencia = buscarAsistencia(idTrabajador, fecha); if (asistencia == null) { //Comprobamos que existe asistencia System.out.println("Debe registrar primero la hora de entrada"); return 0; //Comprobamos que existe asistencia y hora de entrada } else if (asistencia != null && asistencia.getHora_entrada() != null && asistencia.getHora_salida() == null) { Asistencias registroSalida = new Asistencias(asistencia.getId(), asistencia.getFecha(), asistencia.getHora_entrada(), hora, asistencia.getId_trabajador()); try { //Creamos y abrimos sesión SessionFactory myFactory = SessionManagement.getMyFactory(); Session mySession = myFactory.openSession(); //Actualizamos registro de asistencia con salida mySession.beginTransaction(); mySession.update(registroSalida); mySession.getTransaction().commit(); return 1; } catch (HibernateException e) { e.printStackTrace(); System.out.println("Error de registro de salida, prueba de nuevo"); return -2; } //Comprobamos que existe asistencia pero no hora de entrada } else if (asistencia != null && asistencia.getHora_entrada() == null) { System.out.println("Debe registrar primero la hora de entrada"); return 0; } else { System.out.println("Ya hay registro de hora de salida para ese trabajador"); return -3; } } else { System.out.println("No existe un trabajador con ese nombre"); return -1; } } }
[ "JoseMariaMQ@users.noreply.github.com" ]
JoseMariaMQ@users.noreply.github.com
754264b40154cb4d87b2cc27a178dc9d625e4dba
45916953af97d7990f837530af5eb3bd09df6d7e
/src/main/java/com/youyuan/singleton/SingletonTest2.java
dc8fee37c014e324af236a0d009b560a0b498a05
[]
no_license
zhangyu2046196/design_mode
4bc5a016debe8a3f73ea53d908288a94cce50834
ed977e653c805e86cb624c51085ea706be3f91d0
refs/heads/master
2020-07-24T14:38:25.948260
2019-09-12T03:34:21
2019-09-12T03:34:21
207,957,499
0
0
null
null
null
null
GB18030
Java
false
false
681
java
package com.youyuan.singleton; /** * @author zhangyu * @version 1.0 * @description 单例模式:懒汉式(线程安全、调用率不高、能延迟加载) * @date 2018/11/25 18:00 */ public class SingletonTest2 { private static SingletonTest2 instance=null; private SingletonTest2(){} /** * 获取单例实例对象 * @return 返回实例对象 */ public static SingletonTest2 getInstance(){ if (instance!=null){ return instance; } synchronized (SingletonTest2.class){ if (instance==null){ instance=new SingletonTest2(); } } return instance; } }
[ "tom_glb@youyuan.com" ]
tom_glb@youyuan.com
c5e0a806d3084e54a9e9247bd6ade619d0081add
6ae2625852ab7e381c0dd49cbe61b6949aab6d61
/BE/src/main/java/com/codesquad/issuetracker/config/WebConfig.java
4d634bf7e7e79ba13e7a7877de33f2ac81a5c08b
[]
no_license
somedaycode/issue-tracker
4e031e69d6ff7e9d56aba510c991121a83b3f713
e9a0d40bea5fdc57974a021680d2bd791a56fef5
refs/heads/main
2023-07-16T09:47:26.868999
2021-07-30T13:59:21
2021-07-30T13:59:21
393,035,048
0
0
null
2021-08-05T12:31:50
2021-08-05T12:31:49
null
UTF-8
Java
false
false
1,122
java
package com.codesquad.issuetracker.config; import com.codesquad.issuetracker.auth.interceptor.AuthInterceptor; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebConfig implements WebMvcConfigurer { private final AuthInterceptor authInterceptor; public WebConfig(AuthInterceptor authInterceptor) { this.authInterceptor = authInterceptor; } @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/api/**") .allowedMethods("GET", "HEAD", "POST", "DELETE", "OPTIONS", "PUT") .allowedOrigins("http://localhost:3000"); } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(authInterceptor) .addPathPatterns("/api/**") .excludePathPatterns("/api/login/**"); } }
[ "PizzaCola.K@gmail.com" ]
PizzaCola.K@gmail.com
8a77bc5baf6ef51cdeb49f7320b9f9991ad629ce
8b7bbe32e5ea1dc6ee58323782accccd0f10102d
/src/main/java/ch/bullsoft/knapsack/greedy/Greedy.java
a91c6fcdee09c22a534ba78a6dfc93e6e4abc9de
[]
no_license
bombadil78/discrete-optimization
75dd0d0394afc922e150becfa14a52c85c4a4305
19306577c6e7786f35e9b9bfd45076e08c62679f
refs/heads/master
2017-12-16T05:58:42.517213
2017-12-06T05:12:43
2017-12-06T05:12:43
77,684,728
0
0
null
null
null
null
UTF-8
Java
false
false
2,088
java
package ch.bullsoft.knapsack.greedy; import ch.bullsoft.knapsack.Knapsack; import ch.bullsoft.knapsack.KnapsackSolution; import ch.bullsoft.knapsack.KnapsackStrategy; import java.util.Comparator; import java.util.List; import java.util.ArrayList; import java.util.stream.Collectors; public class Greedy implements KnapsackStrategy { public KnapsackSolution solve(Knapsack knapsack) { boolean[] taken = new boolean[knapsack.getNumberOfElements()]; int weight = 0; int value = 0; int capacity = knapsack.getCapacity(); for (Entry entry : orderedByDensity(knapsack)) { int position = entry.position; if (weight + knapsack.getWeight(position) <= capacity){ taken[position] = true; value += knapsack.getValue(position); weight += knapsack.getWeight(position); } else { taken[position] = false; } } return new KnapsackSolution(taken, value, true); } private List<Entry> orderedByDensity(Knapsack knapsack) { List<Entry> entries = new ArrayList<>(); for (int i = 0; i < knapsack.getNumberOfElements(); i++) { double density = (double) knapsack.getValue(i) / knapsack.getWeight(i); entries.add(new Entry(i, density)); } entries.sort(Comparator.comparing(Entry::getDensity).reversed()); return entries .stream() .collect(Collectors.toList()); } private static final class Entry { private final int position; private final double density; public Entry(int position, double density) { this.position = position; this.density = density; } public int getPosition() { return this.position; } public double getDensity() { return density; } @Override public String toString() { return String.format("density = %s, position = %s", density, position); } } }
[ "chkeller@gmx.net" ]
chkeller@gmx.net
015ef1aac401e585d8195d1525a435207828d4bb
e24b11535857b1e7c84eab5ad7a14c6c8038079c
/_3learn_audioplayers/src/main/java/com/allan/sound/ModelPermissions.java
f87b6554c5dc8109aa9436c3fe11d6151daa45ff
[]
no_license
jzlhll/MultiMediaSet
709cacb54e16ef1508215c3da88eaadaac07af26
0a620ec9adf2366a7afa6b2b0d829c95ead60484
refs/heads/master
2022-09-03T18:12:31.484456
2022-07-21T08:51:37
2022-07-23T03:04:38
220,014,717
1
0
null
null
null
null
UTF-8
Java
false
false
485
java
package com.allan.sound; import android.Manifest; import com.allan.baselib.IModulePermission; public class ModelPermissions implements IModulePermission { @Override public String[] getPermissions() { return new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE, }; } @Override public String getShowWords() { return "halo,给下存储权限吧?"; } }
[ "jzl.hll@163.com" ]
jzl.hll@163.com
2d7e2be899bdd1fddd0867c0b8b7a01aea4cf9c9
d9323331561065260b357b62f28d7a880d1986cb
/dams/dams/src/main/java/com/datacenter/dams/input/redis/worker/redis2hdfs/JobTypeEntity.java
00e50a06eaca071be777fdeb96db78c289e81ebd
[]
no_license
zhangkaite/mySelf
0c093742587a902bfc71488fc7baa81b3daf23c5
51538ffdd5260e7e6439af76c12b84f9f312ebed
refs/heads/master
2021-01-09T05:54:18.689655
2016-11-09T07:15:39
2016-11-09T07:15:39
64,741,237
2
1
null
null
null
null
UTF-8
Java
false
false
996
java
package com.datacenter.dams.input.redis.worker.redis2hdfs; import java.util.Date; public class JobTypeEntity { /** * 标识日榜、周榜、月榜、总榜 */ private String jobType; /** * 标识业务类型 富豪榜或者明星榜 */ private String jobBusType; /** * job统计截至天时间 */ private Date jobStatisticTime; /** * job调用启动时间 */ private Date jobRunTime; public String getJobBusType() { return jobBusType; } public void setJobBusType(String jobBusType) { this.jobBusType = jobBusType; } public String getJobType() { return jobType; } public void setJobType(String jobType) { this.jobType = jobType; } public Date getJobRunTime() { return jobRunTime; } public void setJobRunTime(Date jobRunTime) { this.jobRunTime = jobRunTime; } public Date getJobStatisticTime() { return jobStatisticTime; } public void setJobStatisticTime(Date jobStatisticTime) { this.jobStatisticTime = jobStatisticTime; } }
[ "zhangkaite@126.com" ]
zhangkaite@126.com
45b1c3a5b8d34ab360fdc12a1c4681c0a4484137
9eca4a973b99191fafb06b43ccd6004e7089aa2c
/src/main/java/com/company/app/controller/CustomerController.java
0c6d93268efc6a12d0cf92aa6c4a170460efb3da
[ "MIT" ]
permissive
SobhieSaad/spring_boot_inventory_system
4f35bd0f716a4a7f04295eb6d1848d1e1acdc5e7
6f0d2d7e25f5990d9225482f913917c2d83e28fc
refs/heads/master
2023-09-04T18:37:51.688681
2021-09-16T20:08:57
2021-09-16T20:08:57
407,290,175
0
0
MIT
2021-09-16T20:04:55
2021-09-16T19:27:38
Java
UTF-8
Java
false
false
3,309
java
package com.company.app.controller; import javax.servlet.http.HttpServletRequest; import com.company.app.model.Customer; import com.company.app.repository.CustomerDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class CustomerController { @Autowired private CustomerDao customerDao; @RequestMapping(value = "/customer", method = RequestMethod.GET) public String customerPage(ModelMap modelMap, HttpServletRequest request) { modelMap.addAttribute("sm", request.getParameter("sm")); modelMap.addAttribute("em", request.getParameter("em")); modelMap.addAttribute("customers", customerDao.getAllCustomer()); return "customer"; } @RequestMapping(value = "/addCustomer", method = RequestMethod.POST) public String saveCustomer(ModelMap modelMap, HttpServletRequest request) { Customer customer = new Customer(); customer.setCname(request.getParameter("cname")); customer.setPhone(request.getParameter("phone")); customer.setAddress(request.getParameter("address")); boolean status = customerDao.saveCustomer(customer); if (status) { modelMap.addAttribute("sm", "Customer Info Saved Successfully"); } else { modelMap.addAttribute("em", "Customer Info Not Saved"); } return "redirect:/customer"; } @RequestMapping(value = "/editCustomer/{id}", method = RequestMethod.GET) public String editCustomer(@PathVariable("id") String id, ModelMap modelMap) { Customer customer = customerDao.getCustomer(Integer.parseInt(id)); modelMap.addAttribute("customer", customer); modelMap.addAttribute("customers", customerDao.getAllCustomer()); return "customer"; } @RequestMapping(value = "/updateCustomer", method = RequestMethod.POST) public String updateCustomer(ModelMap modelMap, HttpServletRequest request) { Customer customer = new Customer(); customer.setCid(Integer.parseInt(request.getParameter("cid"))); customer.setCname(request.getParameter("cname")); customer.setPhone(request.getParameter("phone")); customer.setAddress(request.getParameter("address")); boolean status = customerDao.updateCustomer(customer); if (status) { modelMap.addAttribute("sm", "Customer Info Update Successfully"); } else { modelMap.addAttribute("em", "Customer Info Not Update"); } return "redirect:/customer"; } @RequestMapping(value = "/deleteCustomer/{id}", method = RequestMethod.GET) public String deleteCustomer(@PathVariable("id") String id, ModelMap modelMap) { boolean status = customerDao.deleteCustomer(Integer.parseInt(id)); if (status) { modelMap.addAttribute("sm", "Customer Info Deleted Successfully"); } else { modelMap.addAttribute("em", "Customer Info Not Deleted"); } return "redirect:/customer"; } }
[ "sobhie.saad1@hotmail.com" ]
sobhie.saad1@hotmail.com
501932b12d6736b190d32a04d71ff40bc93b1c61
96543a55c19ce56bc1c5de63dfd6a86355623efe
/ExamJavaAdvance2/src/main/java/com/vti/Specification/SpectificationGroup.java
7403c1ca0ca945e6d59106f773aade2b6b0a81da
[]
no_license
hienninh/RAIWALL5
f828c0afc6d79733c19cf5783a8d445716f8dfff
6f9c863d24b1905fe6a428ec231a262873e2501c
refs/heads/master
2023-03-20T11:34:40.445424
2021-03-17T18:23:10
2021-03-17T18:23:10
291,775,975
0
1
null
null
null
null
UTF-8
Java
false
false
1,223
java
package com.vti.Specification; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import org.springframework.data.jpa.domain.Specification; import com.vti.entity.Group; @SuppressWarnings("serial") public class SpectificationGroup implements Specification<Group> { private SearchCriterior criterior; public SearchCriterior getCriterior() { return criterior; } public SpectificationGroup(SearchCriterior criterior) { super(); this.criterior = criterior; } @Override public Predicate toPredicate(Root<Group> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) { if (criterior.getOperater().equalsIgnoreCase("Like")) { return criteriaBuilder.like(root.get(criterior.getKey()), "%" + criterior.getValue() + "%"); } if (criterior.getOperater().equalsIgnoreCase(">")) { return criteriaBuilder.greaterThan(root.get(criterior.getKey()), criterior.getValue().toString()); } if (criterior.getOperater().equalsIgnoreCase("<")) { return criteriaBuilder.lessThan(root.get(criterior.getKey()), criterior.getValue().toString()); } return null; } }
[ "hienninh1510@gmail.com" ]
hienninh1510@gmail.com
b89fb46a2d5477fb653cf596662be421d12af2b8
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_9d6ae6c5327acb81d9ebce8439b145e21a0f4852/Projection/4_9d6ae6c5327acb81d9ebce8439b145e21a0f4852_Projection_t.java
c915edd3fb6230612ab45619d4e90ffa3c8fc8d3
[]
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
3,683
java
/* * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.expression.spel.ast; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import org.antlr.runtime.Token; import org.springframework.core.convert.TypeDescriptor; import org.springframework.expression.EvaluationException; import org.springframework.expression.TypedValue; import org.springframework.expression.spel.ExpressionState; import org.springframework.expression.spel.SpelException; import org.springframework.expression.spel.SpelMessages; /** * Represents projection, where a given operation is performed on all elements in some input sequence, returning * a new sequence of the same size. For example: * "{1,2,3,4,5,6,7,8,9,10}.!{#isEven(#this)}" returns "[n, y, n, y, n, y, n, y, n, y]" * * @author Andy Clement * */ public class Projection extends SpelNodeImpl { public Projection(Token payload) { super(payload); } @Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue op = state.getActiveContextObject(); Object operand = op.getValue(); // TypeDescriptor operandTypeDescriptor = op.getTypeDescriptor(); // When the input is a map, we push a special context object on the stack // before calling the specified operation. This special context object // has two fields 'key' and 'value' that refer to the map entries key // and value, and they can be referenced in the operation // eg. {'a':'y','b':'n'}.!{value=='y'?key:null}" == ['a', null] if (operand instanceof Map) { Map<?, ?> mapdata = (Map<?, ?>) operand; List<Object> result = new ArrayList<Object>(); for (Map.Entry entry : mapdata.entrySet()) { try { state.pushActiveContextObject(new TypedValue(entry,TypeDescriptor.valueOf(Map.Entry.class))); result.add(getChild(0).getValueInternal(state).getValue()); } finally { state.popActiveContextObject(); } } return new TypedValue(result,TypeDescriptor.valueOf(List.class)); // TODO unable to build correct type descriptor } else if (operand instanceof List) { List<Object> data = new ArrayList<Object>(); data.addAll((Collection<?>) operand); List<Object> result = new ArrayList<Object>(); int idx = 0; for (Object element : data) { try { state.pushActiveContextObject(new TypedValue(element,TypeDescriptor.valueOf(op.getTypeDescriptor().getType()))); state.enterScope("index", idx); result.add(getChild(0).getValueInternal(state).getValue()); } finally { state.exitScope(); state.popActiveContextObject(); } idx++; } return new TypedValue(result,op.getTypeDescriptor()); } else { throw new SpelException(SpelMessages.PROJECTION_NOT_SUPPORTED_ON_TYPE, operand.getClass().getName()); } } @Override public String toStringAST() { StringBuilder sb = new StringBuilder(); return sb.append("![").append(getChild(0).toStringAST()).append("]").toString(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
ed4444d91e69a45e55c54d8d53f769a497293768
5b7f9768758b2332b4effd41d08e13f1c188ba8b
/hw05-spring-dao-jdbc/src/main/java/ru/otus/library/service/data/impl/BookServiceImpl.java
d8c69fa58db036750a2d170c16b18696d62c7398
[]
no_license
regulyator/otus-spring-homework
6e27aa42e18199fe5bbc2efed350cdff5289b5ba
02ba7e87bf87c85b2254f7eb6aad32b0bb91f9a5
refs/heads/master
2023-07-01T18:58:15.923960
2021-07-22T15:09:34
2021-07-22T15:09:34
343,099,726
0
0
null
2021-07-22T15:09:34
2021-02-28T12:27:45
Java
UTF-8
Java
false
false
3,032
java
package ru.otus.library.service.data.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import ru.otus.library.dao.BookDao; import ru.otus.library.domain.Author; import ru.otus.library.domain.Book; import ru.otus.library.domain.Genre; import ru.otus.library.exception.NoSuchReferenceIdException; import ru.otus.library.service.data.AuthorService; import ru.otus.library.service.data.BookService; import ru.otus.library.service.data.GenreService; import java.util.Collection; @Service public class BookServiceImpl implements BookService { private final BookDao bookDao; private final AuthorService authorService; private final GenreService genreService; @Autowired public BookServiceImpl(BookDao bookDao, AuthorService authorService, GenreService genreService) { this.bookDao = bookDao; this.authorService = authorService; this.genreService = genreService; } @Override public Book create(String bookName, String authorFio, String genreCaption) { final Author newAuthor = authorService.create(authorFio); final Genre newGenre = genreService.create(genreCaption); return create(new Book(0L, bookName, newAuthor, newGenre)); } @Override public Book create(String bookName, long authorId, long genreId) { final Author author = new Author(authorId, ""); final Genre genre = new Genre(genreId, ""); final Book newBook = new Book(0L, bookName, author, genre); checkReferenceId(newBook); return create(newBook); } @Override public void update(Book book) { bookDao.update(book); } @Override public void update(long bookId, String bookName, long authorId, long genreId) { final Author author = new Author(authorId, ""); final Genre genre = new Genre(genreId, ""); final Book updatedBook = new Book(bookId, bookName, author, genre); checkReferenceId(updatedBook); update(updatedBook); } @Override public Book getById(long id) { return bookDao.findById(id); } @Override public Collection<Book> getAll() { return bookDao.findAll(); } @Override public void removeById(long id) { bookDao.deleteById(id); } private void checkReferenceId(Book book) { final boolean isAuthorIdExist = authorService.checkExistById(book.getAuthor().getId()); final boolean isGenreIdExist = genreService.checkExistById(book.getGenre().getId()); if (!isAuthorIdExist || !isGenreIdExist) { throw new NoSuchReferenceIdException(String.format("No reference entity exist: %s %s", !isAuthorIdExist ? "Author" : "", !isGenreIdExist ? "Genre" : "")); } } private Book create(Book book) { checkReferenceId(book); final long generatedId = bookDao.insert(book); book.setId(generatedId); return book; } }
[ "regulyator777@gmail.com" ]
regulyator777@gmail.com
bfe1f9e242d242a663a208566080b24ead48460e
26617f89958559c797f981e3dd45a8e09119d91d
/src/test/java/com/vw/visitreporting/web/ControllerUtil.java
3f22809b78b6d5331edd1d7ca88578ebbeaaa16f
[]
no_license
vijkumar8765/visitreporting
178883f698f465e216952a1548fac86f5c163722
ff067961d3b7bb5d3a8d046b95427bed6abea74c
refs/heads/master
2021-01-10T01:59:57.630942
2016-02-10T18:07:27
2016-02-10T18:07:27
51,459,224
0
0
null
null
null
null
UTF-8
Java
false
false
5,901
java
package com.vw.visitreporting.web; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Assert; import org.springframework.beans.factory.BeanFactoryUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.core.OrderComparator; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerExecutionChain; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter; /** * Provides common functionality for controller integration tests. */ @Component public class ControllerUtil { @Autowired protected ApplicationContext context; /** * This is a helper method which invokes the Spring MVC framework and returns the * ModelAndView from a controller method call. * @param method - the HTTP method to simulate, e.g. GET or POST * @param requestUrl - the request URI to simulate */ public ModelAndView handle(String method, String requestUrl) { Map<String, Object> params = null; int pos = requestUrl.indexOf('?'); if(pos > 0) { params = new HashMap<String, Object>(); String[] keyValPairs = requestUrl.substring(pos+1).split("&"); for(String keyValPair : keyValPairs) { String[] tokens = keyValPair.split("="); params.put(tokens[0], tokens[1]); } requestUrl = requestUrl.substring(0, pos); } return this.handle(method, requestUrl, params); } /** * This is a helper method which invokes the Spring MVC framework and returns the * ModelAndView from a controller method call. * @param method - the HTTP method to simulate, e.g. GET or POST * @param requestUrl - the request URI to simulate */ public ModelAndView handle(String method, String requestUrl, Map<String, Object> params) { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); request.setMethod(method); request.setRequestURI(requestUrl); if(params != null) { request.setParameters(params); } return handle(request, response); } /** * This is a helper method which invokes the Spring MVC framework and returns the * ModelAndView from a controller method call. * @param request - an HTTP request simulating a request from a client browser * @param response - an HTTP response simulating the response to the client browser */ public ModelAndView handle(HttpServletRequest request, HttpServletResponse response) { try { //HandlerExecutionChain handler = handlerMapping.getHandler(request); //get HandlerExecutionChain based on application context Map<String, HandlerMapping> matchingMappings = BeanFactoryUtils.beansOfTypeIncludingAncestors(context, HandlerMapping.class, true, false); List<HandlerMapping> handlerMappings = new ArrayList<HandlerMapping>(matchingMappings.values()); OrderComparator.sort(handlerMappings); HandlerExecutionChain handler = null; for(HandlerMapping hm : handlerMappings) { handler = hm.getHandler(request); if(handler != null) { break; } } Assert.assertNotNull("No handler found for request, check you request mapping", handler); Object controller = handler.getHandler(); //get handler adapter /* Map<String, HandlerAdapter> matchingAdapters = BeanFactoryUtils.beansOfTypeIncludingAncestors(context, HandlerAdapter.class, true, false); List<HandlerAdapter> handlerAdapters = new ArrayList<HandlerAdapter>(matchingAdapters.values()); OrderComparator.sort(handlerAdapters); HandlerAdapter handlerAdapter = null; for(HandlerAdapter ha : handlerAdapters) { if(ha.supports(controller)) { handlerAdapter = ha; break; } } */ AnnotationMethodHandlerAdapter handlerAdapter = BeanFactoryUtils.beanOfType(context, AnnotationMethodHandlerAdapter.class); HandlerInterceptor[] interceptors = handler.getInterceptors(); for (HandlerInterceptor interceptor : interceptors) { boolean carryOn = interceptor.preHandle(request, response, controller); if (!carryOn) { return null; } } ModelAndView mav = handlerAdapter.handle(request, response, controller); for(HandlerMapping hm : handlerMappings) { handler = hm.getHandler(request); if(handler != null) { HandlerInterceptor[] interceptors2 = handler.getInterceptors(); for (HandlerInterceptor interceptor : interceptors2) { interceptor.postHandle(request, response, handlerAdapter, mav); } } } //if redirect returned then handle that redirect if(mav.getViewName().startsWith("redirect:")) { return handle("GET", mav.getViewName().substring("redirect:".length()).replace("content/", "")); //otherwise, just return mav as it is } else { return mav; } } catch(Exception err) { throw new RuntimeException("failed to handle mock request to: "+request.getRequestURI(), err); } } }
[ "vijkumar8765@gmail.com" ]
vijkumar8765@gmail.com
83456c32d081484c49fabec4e9a8f28046c0c07a
a224400bf0d826e4865fb08725b6f77b83fc47b4
/sc-provider/sc-xzsd-pc/src/main/java/com/xzsd/pc/ScXzsdPcApplication.java
965baee607592aca57eeeab097bfc914d930290d
[]
no_license
xky123566545/Study
3fc88beb49f09a7dc6ab7f675570b108cdf32a57
c2bacf6c921d947260a43966a03fcd155317ae2a
refs/heads/master
2021-03-25T02:26:53.421066
2020-05-02T12:04:32
2020-05-02T12:04:32
247,582,713
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package com.xzsd.pc; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.Transactional; import springfox.documentation.swagger2.annotations.EnableSwagger2; import javax.annotation.Resource; /** * <p>项目启动类</p> * <p>创建日期:2018-04-26</p> * * @author 杨洲 yangzhou@neusoft.com */ @SpringBootApplication @EnableDiscoveryClient @EnableResourceServer @EnableSwagger2 @EnableTransactionManagement @MapperScan("com.xzsd.pc") @EnableRedisHttpSession @Transactional(rollbackFor = Exception.class) public class ScXzsdPcApplication { @Resource private StringRedisTemplate template; public static void main(String[] args) { SpringApplication.run(ScXzsdPcApplication.class, args); } }
[ "1743429993@qq.com" ]
1743429993@qq.com
0f12178c70f2bf71befea709e0946d4516e15ebb
1c8ef4a59ce03ca7a32c3bb90b99405c79c22a75
/smallrye-reactive-messaging-amqp/src/test/java/io/smallrye/reactive/messaging/amqp/AmqpUsage.java
cfdcd8e5c66c19ea8d9d367991419570a6d146b3
[ "Apache-2.0" ]
permissive
michalszynkiewicz/smallrye-reactive-messaging
1fa017a66d49ecfd0b523f1dee7fede5a1b453b9
532833838c99d94e0b5237a1078a8d41419af978
refs/heads/master
2020-05-23T21:53:14.884269
2019-05-15T16:29:28
2019-05-15T16:29:28
186,963,658
0
0
Apache-2.0
2019-05-16T06:17:33
2019-05-16T06:17:32
null
UTF-8
Java
false
false
10,540
java
/* * Copyright (c) 2018-2019 The original author or authors * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.smallrye.reactive.messaging.amqp; import io.vertx.core.Context; import io.vertx.proton.ProtonClient; import io.vertx.proton.ProtonConnection; import io.vertx.proton.ProtonReceiver; import io.vertx.proton.ProtonSender; import io.vertx.reactivex.core.Vertx; import org.apache.qpid.proton.amqp.messaging.AmqpValue; import org.apache.qpid.proton.amqp.messaging.Section; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BooleanSupplier; import java.util.function.Consumer; import java.util.function.Supplier; import org.eclipse.microprofile.reactive.messaging.Message; import static io.vertx.proton.ProtonHelper.message; public class AmqpUsage { private static Logger LOGGER = LoggerFactory.getLogger(AmqpUsage.class); private final Context context; private ProtonClient client; private ProtonConnection connection; private List<ProtonSender> senders = new CopyOnWriteArrayList<>(); private List<ProtonReceiver> receivers = new CopyOnWriteArrayList<>(); public AmqpUsage(Vertx vertx, String host, int port) { this(vertx, host, port, "artemis", "simetraehcapa"); } public AmqpUsage(Vertx vertx, String host, int port, String user, String pwd) { CountDownLatch latch = new CountDownLatch(1); this.context = vertx.getDelegate().getOrCreateContext(); context.runOnContext(x -> { client = ProtonClient.create(vertx.getDelegate()); client.connect(host, port, user, pwd, conn -> { if (conn.succeeded()) { LOGGER.info("Connection to the AMQP host succeeded"); this.connection = conn.result(); this.connection .openHandler(connection -> latch.countDown()) .open(); } }); }); try { latch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } } /** * Use the supplied function to asynchronously produce messages and write them to the host. * * @param topic the topic, must not be null * @param messageCount the number of messages to produce; must be positive * @param messageSupplier the function to produce messages; may not be null */ void produce(String topic, int messageCount, Supplier<Object> messageSupplier) { CountDownLatch ready = new CountDownLatch(1); AtomicReference<ProtonSender> reference = new AtomicReference<>(); context.runOnContext(x -> { ProtonSender sender = connection.createSender(topic); reference.set(sender); senders.add(sender); sender .openHandler(s -> ready.countDown()) .open(); }); try { ready.await(); } catch (InterruptedException e) { e.printStackTrace(); } Thread t = new Thread(() -> { LOGGER.info("Starting AMQP sender to write {} messages", messageCount); try { for (int i = 0; i != messageCount; ++i) { Object payload = messageSupplier.get(); org.apache.qpid.proton.message.Message message = message(); if (payload instanceof Section) { message.setBody((Section) payload); } else if (payload != null) { message.setBody(new AmqpValue(payload)); } else { // Don't set a body. } message.setDurable(true); message.setTtl(10000); CountDownLatch latch = new CountDownLatch(1); context.runOnContext((y) -> reference.get().send(message, x -> latch.countDown() ) ); latch.await(); LOGGER.info("Producer sent message {}", payload); } } catch (Exception e) { LOGGER.error("Unable to send message", e); } finally { context.runOnContext(x -> reference.get().close()); } }); t.setName(topic + "-thread"); t.start(); try { ready.await(); } catch (InterruptedException e) { LOGGER.error("Interrupted while waiting for the ProtonSender to be opened", e); } } /** * Use the supplied function to asynchronously consume messages from the cluster. * * @param topic the topic * @param continuation the function that determines if the consumer should continue; may not be null * @param consumerFunction the function to consume the messages; may not be null */ private void consume(String topic, BooleanSupplier continuation, Consumer<AmqpMessage> consumerFunction) { CountDownLatch latch = new CountDownLatch(1); Thread t = new Thread(() -> { try { context.runOnContext(x -> { ProtonReceiver receiver = connection.createReceiver(topic); receivers.add(receiver); receiver.handler((delivery, message) -> { LOGGER.info("Consumer {}: consuming message {}", topic, message.getBody()); consumerFunction.accept(new AmqpMessage(delivery, message)); if (!continuation.getAsBoolean()) { receiver.close(); } }) .openHandler(r -> { LOGGER.info("Starting consumer to read messages on {}", topic); latch.countDown(); }) .open(); }); } catch (Exception e) { LOGGER.error("Unable to receive messages from {}", topic, e); } }); t.setName(topic + "-thread"); t.start(); try { latch.await(); } catch (InterruptedException e) { LOGGER.error("Interrupted while waiting for the ProtonReceiver to be opened", e); } } public void consumeIntegers(String topicName, int count, long timeout, TimeUnit unit, Consumer<Integer> consumer) { AtomicLong readCounter = new AtomicLong(); this.consumeStrings(topicName, this.continueIfNotExpired(() -> readCounter.get() < (long) count, timeout, unit), s -> { consumer.accept(Integer.valueOf(s)); readCounter.incrementAndGet(); }); } public void consumeStrings(String topicName, int count, long timeout, TimeUnit unit, Consumer<String> consumer) { AtomicLong readCounter = new AtomicLong(); this.consumeStrings(topicName, this.continueIfNotExpired(() -> readCounter.get() < (long) count, timeout, unit), s -> { consumer.accept(s); readCounter.incrementAndGet(); }); } private BooleanSupplier continueIfNotExpired(BooleanSupplier continuation, long timeout, TimeUnit unit) { return new BooleanSupplier() { long stopTime = 0L; public boolean getAsBoolean() { if (this.stopTime == 0L) { this.stopTime = System.currentTimeMillis() + unit.toMillis(timeout); } return continuation.getAsBoolean() && System.currentTimeMillis() <= this.stopTime; } }; } public void close() throws InterruptedException { CountDownLatch entities = new CountDownLatch(senders.size() + receivers.size()); context.runOnContext(ignored -> { senders.forEach(sender -> { if (sender.isOpen()) { sender.closeHandler(x -> entities.countDown()).close(); } else { entities.countDown(); } }); receivers.forEach(receiver -> { if (receiver.isOpen()) { receiver.closeHandler(x -> entities.countDown()).close(); } else { entities.countDown(); } }); }); entities.await(30, TimeUnit.SECONDS); if (connection != null && !connection.isDisconnected()) { CountDownLatch latch = new CountDownLatch(1); context.runOnContext(n -> connection .closeHandler(x -> latch.countDown()) .close()); latch.await(10, TimeUnit.SECONDS); } } void produceTenIntegers(String topic, Supplier<Integer> messageSupplier) { this.produce(topic, 10, messageSupplier::get); } private void consumeStrings(String topic, BooleanSupplier continuation, Consumer<String> consumerFunction) { this.consume(topic, continuation, value -> { consumerFunction.accept(value.getPayload().toString()); }); } private void consumeIntegers(String topic, BooleanSupplier continuation, Consumer<Integer> consumerFunction) { this.consume(topic, continuation, value -> consumerFunction.accept((Integer) value.getPayload())); } void consumeTenStrings(String topicName, Consumer<String> consumer) { AtomicLong readCounter = new AtomicLong(); this.consumeStrings(topicName, this.continueIfNotExpired(() -> readCounter.get() < (long) 10), s -> { consumer.accept(s); readCounter.incrementAndGet(); }); } <T> void consumeTenMessages(String topicName, Consumer<AmqpMessage<T>> consumer) { AtomicLong readCounter = new AtomicLong(); this.<T>consume(topicName, this.continueIfNotExpired(() -> readCounter.get() < (long) 10), s -> { consumer.accept(s); readCounter.incrementAndGet(); }); } void consumeTenIntegers(String topicName, Consumer<Integer> consumer) { AtomicLong readCounter = new AtomicLong(); this.consumeIntegers(topicName, this.continueIfNotExpired(() -> readCounter.get() < (long) 10), s -> { consumer.accept(s); readCounter.incrementAndGet(); }); } private BooleanSupplier continueIfNotExpired(BooleanSupplier continuation) { return new BooleanSupplier() { long stopTime = 0L; public boolean getAsBoolean() { if (this.stopTime == 0L) { this.stopTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis((long) 10); } return continuation.getAsBoolean() && System.currentTimeMillis() <= this.stopTime; } }; } }
[ "clement.escoffier@gmail.com" ]
clement.escoffier@gmail.com
44e6edd247e6de14d364ccca3f4aaf7087c8e689
4d5556326f49982c3c5cdbe189ab3dff1bd36f1d
/Homework06/src/lab6_2/Main.java
2a70acca253ee3899f1ee289792f7cc36c427d94
[]
no_license
orsolyaeva/OOP
41f4a91b263c45ae411e1cc0a9d394a353761a29
dc7b92a8e8b75bc3567ebdb4a16af8bfb1b090a3
refs/heads/main
2023-04-29T05:09:01.096145
2021-05-22T18:53:06
2021-05-22T18:53:06
339,101,701
0
0
null
null
null
null
UTF-8
Java
false
false
882
java
package lab6_2; import java.util.Random; import java.util.Stack; public class Main { public static void main(String[] args) { StackAggregation stack1 = new StackAggregation( 5 ); for( int i=0; i<10; ++i ){ stack1.push( i ); } System.out.print("StackAggregation : "); while( !stack1.isEmpty() ){ System.out.print( stack1.top() + " "); stack1.pop(); } System.out.println(); System.out.println(); StackInheritance stack2 = new StackInheritance( 5 ); for( int i=0; i < 10; ++i ){ stack2.push( i ); } // stack2.remove( 1 ); System.out.print("\nStackInheritance : "); while( !stack2.isEmpty() ){ System.out.print( stack2.top() + " "); stack2.pop(); } System.out.println(); } }
[ "orsinyitrai2001@gmail.com" ]
orsinyitrai2001@gmail.com
053a8668a35efd4d0e9071f9995324bf90716511
6c6f8abe7ed6b7f239713949bbcebd7e7d357595
/esup-activ-fo/src/org/esupportail/activfo/web/converters/StringConverter.java
1da4dbc3a9f5e75d925dba89acf12fd0ace3efe0
[]
no_license
GitHubsar/esup-activ
6fdce20b6ba28965171f90178fb93286aed7352a
4bbf47987d2ce829a50c100c4dc3e564000fe024
refs/heads/master
2021-01-21T13:04:58.006827
2016-05-03T16:45:56
2016-05-03T16:45:56
38,240,553
0
0
null
null
null
null
UTF-8
Java
false
false
1,559
java
/** * ESUP-Portail Commons - Copyright (c) 2006-2009 ESUP-Portail consortium. */ package org.esupportail.activfo.web.converters; import java.util.HashMap; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import org.esupportail.commons.services.logging.Logger; import org.esupportail.commons.services.logging.LoggerImpl; /** * A JSF converter to pass Integer instances. */ public class StringConverter implements Converter { private HashMap<String,String> mapping = new HashMap<String,String>(); private final Logger logger = new LoggerImpl(getClass()); public StringConverter() { } public Object getAsObject( @SuppressWarnings("unused") final FacesContext context, @SuppressWarnings("unused") final UIComponent component, final String value){ return value; } public String getAsString( @SuppressWarnings("unused") final FacesContext context, @SuppressWarnings("unused") final UIComponent component, final Object value) { logger.debug("value.toString : "+value.toString()); if (mapping.get(value)==null) return value.toString(); else return mapping.get(value).toString(); } /** * @return the mapping */ public HashMap<String, String> getMapping() { return mapping; } /** * @param mapping the mapping to set */ public void setMapping(HashMap<String, String> mapping) { this.mapping = mapping; } }
[ "bang@df3935f2-5e34-0410-be39-dc869cc82e10" ]
bang@df3935f2-5e34-0410-be39-dc869cc82e10
d25d980902ca87ef48606a0d6b1b3f7d980f5772
9f0d8ab7153cbdecd38f2ee7edc10bbe3e7f0280
/src/main/java/com/kaba/planner/service/PublicHolidayService.java
0e730bc9eafdfeaaeeabd7e2e1a82c6a04f78b70
[ "MIT" ]
permissive
kabanfaly/planner-java
5aa32c5ec15267b6f96028de4900f1d67cc70639
aa67a595c6f8681ea1cbfaa594da4262a1b6afdc
refs/heads/master
2021-01-12T08:17:53.732960
2016-12-18T07:03:14
2016-12-18T07:03:14
76,533,383
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.kaba.planner.service; import com.kaba.planner.entity.PublicHoliday; import org.springframework.data.domain.Page; /** * PublicHoliday service * * @author Kaba N'faly * @since 12/03/2016 * @version 2.0 */ public interface PublicHolidayService { /** * find all public holidays * @return */ Page<PublicHoliday> findAll(); /** * Create a public holiday * @param publicholiday * @return */ PublicHoliday create(PublicHoliday publicholiday); /** * Update a public holiday * @param publicholiday * @return */ PublicHoliday update(PublicHoliday publicholiday); /** * Delete a public holiday * @param id */ void delete(Integer id); }
[ "nfalykaba@gmail.com" ]
nfalykaba@gmail.com
0d6e2a1753c4441c07efbd30ac080d5085e34c72
ef567a9bd63742d6146681d209b049aaad082a69
/app/src/androidTest/java/com/example/sample5/ExampleInstrumentedTest.java
8401a92b1ca1c787801bce06a55cde68328a7e2a
[]
no_license
RodelMacavinta/sample52
8ff6077a2ad19bf57b25048288bdbda32d166386
d6b17314c2dc3af5150866702996c778b2e30a1e
refs/heads/master
2020-06-12T05:30:33.538003
2019-06-28T04:56:03
2019-06-28T04:56:03
194,208,768
0
0
null
null
null
null
UTF-8
Java
false
false
722
java
package com.example.sample5; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.sample5", appContext.getPackageName()); } }
[ "android@IICSGENERAL.com" ]
android@IICSGENERAL.com
3a60c1e719e1286e7b54292b7861c26d94bbf187
87cb5d74cddc1bf45189a5557ff485851556d3b8
/src/main/java/ci/proxybanquespring/service/impl/BilletageService.java
d0508716e180d2eafca41fc5afcd2b640ca7436a
[]
no_license
cannel001/proxybanque-spring
18e89eff197d78cd1ac8f70021fafe5bd3ccf854
17f617ba0e48be03bf27215c48329157e5979ba7
refs/heads/master
2020-04-22T06:12:00.729702
2019-06-07T01:48:15
2019-06-07T01:48:15
170,182,304
0
0
null
null
null
null
UTF-8
Java
false
false
1,752
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 ci.proxybanquespring.service.impl; import ci.proxybanquespring.repository.BilletageRepository; import ci.proxybanquespring.service.IBilletageService; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * * @author willi */ @Service public class BilletageService implements IBilletageService{ //les proprietes @Autowired private BilletageRepository billetageRepository; @Override public Billetage create(Billetage t) { if (t != null) { t.setDateCreation(new Date()); t.setDateUpdate(new Date()); t.setEnabled(true); return billetageRepository.save(t); } return null; } @Override public List<Billetage> readAll() { return billetageRepository.findByEnabledTrue(); } @Override public Billetage readOne(Long pk) { if (pk > 0) { return billetageRepository.findByIdAndEnabledTrue(pk); } return null; } @Override public Billetage update(Billetage t) { if (t != null) { t.setDateUpdate(new Date()); return billetageRepository.save(t); } return null; } @Override public Boolean delete(Billetage t) { if (t != null) { t.setDateUpdate(new Date()); t.setEnabled(false); return billetageRepository.save(t) != null; } return false; } }
[ "cannelseka@gmail.com" ]
cannelseka@gmail.com
4d7da37b54503ead31dea43313bebf55bc1818d6
dd2bf6b6fbd4dc8d68fee1e73214e4c047e8bff5
/dku-rest/src/main/java/com/ku/dku/controller/AdminUpdateRelationRequest.java
8e065e58cad18584b751e1dbfe5c33cb15e40d71
[]
no_license
warapawn24/Project_KU
5da8ab4737d98e1e6d83fe50f8e82de9369997ef
c8ab5394e5423d7d814f3d9fb555ed3a3aa5ebdd
refs/heads/master
2023-04-11T11:20:29.574686
2021-04-22T00:30:53
2021-04-22T00:30:53
346,169,335
0
0
null
null
null
null
UTF-8
Java
false
false
661
java
package com.ku.dku.controller; public class AdminUpdateRelationRequest { private String relationName; private String description; public AdminUpdateRelationRequest() { super(); } public AdminUpdateRelationRequest(String relationName, String description) { super(); this.relationName = relationName; this.description = description; } public String getRelationName() { return relationName; } public void setRelationName(String relationName) { this.relationName = relationName; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "warapawn24@gmail.com" ]
warapawn24@gmail.com
153d138aa894485b66a6f25f98c070105ab015be
ea5a093a88fb9c22fc87ab8b3c82c934f9d04770
/TutevERP/src/main/java/net/webservicex/GlobalWeather.java
a6ffb196b96550ef34f4bd3114ce790ce469f221
[]
no_license
ttemel/TutevERP
b4a41272379fc304facbbe64d23cf46fc64d0b87
b6eb9a12030c4982ada1ed23896649ab65d78568
refs/heads/master
2021-01-10T02:23:57.880143
2016-01-10T08:59:08
2016-01-10T08:59:08
46,612,113
1
8
null
null
null
null
UTF-8
Java
false
false
3,034
java
package net.webservicex; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.2.9-b130926.1035 * Generated source version: 2.2 * */ @WebServiceClient(name = "GlobalWeather", targetNamespace = "http://www.webserviceX.NET", wsdlLocation = "META-INF/wsdl/GlobalWeather.wsdl") public class GlobalWeather extends Service { private final static URL GLOBALWEATHER_WSDL_LOCATION; private final static WebServiceException GLOBALWEATHER_EXCEPTION; private final static QName GLOBALWEATHER_QNAME = new QName("http://www.webserviceX.NET", "GlobalWeather"); static { GLOBALWEATHER_WSDL_LOCATION = net.webservicex.GlobalWeather.class.getClassLoader().getResource("META-INF/wsdl/GlobalWeather.wsdl"); WebServiceException e = null; if (GLOBALWEATHER_WSDL_LOCATION == null) { e = new WebServiceException("Cannot find 'META-INF/wsdl/GlobalWeather.wsdl' wsdl. Place the resource correctly in the classpath."); } GLOBALWEATHER_EXCEPTION = e; } public GlobalWeather() { super(__getWsdlLocation(), GLOBALWEATHER_QNAME); } public GlobalWeather(WebServiceFeature... features) { super(__getWsdlLocation(), GLOBALWEATHER_QNAME, features); } public GlobalWeather(URL wsdlLocation) { super(wsdlLocation, GLOBALWEATHER_QNAME); } public GlobalWeather(URL wsdlLocation, WebServiceFeature... features) { super(wsdlLocation, GLOBALWEATHER_QNAME, features); } public GlobalWeather(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public GlobalWeather(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { super(wsdlLocation, serviceName, features); } /** * * @return * returns GlobalWeatherSoap */ @WebEndpoint(name = "GlobalWeatherSoap") public GlobalWeatherSoap getGlobalWeatherSoap() { return super.getPort(new QName("http://www.webserviceX.NET", "GlobalWeatherSoap"), GlobalWeatherSoap.class); } /** * * @param features * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. * @return * returns GlobalWeatherSoap */ @WebEndpoint(name = "GlobalWeatherSoap") public GlobalWeatherSoap getGlobalWeatherSoap(WebServiceFeature... features) { return super.getPort(new QName("http://www.webserviceX.NET", "GlobalWeatherSoap"), GlobalWeatherSoap.class, features); } private static URL __getWsdlLocation() { if (GLOBALWEATHER_EXCEPTION!= null) { throw GLOBALWEATHER_EXCEPTION; } return GLOBALWEATHER_WSDL_LOCATION; } }
[ "Tütev@tutev111" ]
Tütev@tutev111
8c7b2636a8d8bb58928fea553ae403c41736a7c5
221ba5d328f3468d27c15a91b20b69004340a821
/jme/src/com/jme/util/export/binary/modules/BinaryStencilStateModule.java
4d327659dafe61682e01ee60b10c76f582689705
[]
no_license
cjbush/burriswarehouse
49db0685163c8dbd43c3dbbbc6e17cb505b413f1
23bd43484387b7ccd5259c69cb9491bf8875b3f5
refs/heads/master
2016-09-06T11:17:03.659594
2015-04-04T22:42:39
2015-04-04T22:42:39
33,420,363
0
1
null
null
null
null
UTF-8
Java
false
false
2,153
java
/* * Copyright (c) 2003-2009 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'jMonkeyEngine' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.jme.util.export.binary.modules; import com.jme.scene.state.StencilState; import com.jme.system.DisplaySystem; import com.jme.util.export.InputCapsule; import com.jme.util.export.Savable; import com.jme.util.export.binary.BinaryLoaderModule; public class BinaryStencilStateModule implements BinaryLoaderModule { public String getKey() { return StencilState.class.getName(); } public Savable load(InputCapsule inputCapsule) { return DisplaySystem.getDisplaySystem().getRenderer().createStencilState(); } }
[ "cjbush77" ]
cjbush77
cbb4d5476ae713cecaaeea297b450d08b890a16b
47c20e8818673480fedadc7715a7fe2f0ccaa0c9
/src/cn/znnf/service/ZnnfMessageSendService.java
dcb5de5bd3cdf17d29cb37819d7843106d11327f
[]
no_license
zsljava/znnf
4103b2bb69a16b70356c6a4960910dbdbdf419b9
9352e40dd3385b6bb7d5362e95a7ab10af856fd5
refs/heads/master
2021-01-10T01:51:34.424794
2015-10-28T08:11:05
2015-10-28T08:11:05
45,102,550
0
0
null
null
null
null
UTF-8
Java
false
false
1,620
java
package cn.znnf.service; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import cn.znnf.mapper.ZnnfMessageSendMapper; import cn.znnf.model.ZnnfMessageSend; import cn.znnf.model.ZnnfMessageSendExample; @Service public class ZnnfMessageSendService{ @Resource private ZnnfMessageSendMapper znnfMessageSendMapper; public void addZnnfMessageSend(ZnnfMessageSend znnfMessageSend) { znnfMessageSendMapper.insertSelective(znnfMessageSend); } public void delZnnfMessageSendById(Integer id) { znnfMessageSendMapper.deleteByPrimaryKey(id); } public void updateZnnfMessageSendByExample(ZnnfMessageSend znnfMessageSend,ZnnfMessageSendExample znnfMessageSendExample) { znnfMessageSendMapper.updateByExampleSelective(znnfMessageSend,znnfMessageSendExample); } public void updateZnnfMessageSend(ZnnfMessageSend znnfMessageSend) { znnfMessageSendMapper.updateByPrimaryKeySelective(znnfMessageSend); } public ZnnfMessageSend getZnnfMessageSendById(Integer id) { return znnfMessageSendMapper.selectByPrimaryKey(id); } public List<ZnnfMessageSend> getPageZnnfMessageSend(ZnnfMessageSendExample znnfMessageSendExample) { return znnfMessageSendMapper.selectPage(znnfMessageSendExample); } public int countZnnfMessageSend(ZnnfMessageSendExample znnfMessageSendExample) { return znnfMessageSendMapper.countByExample(znnfMessageSendExample); } public List<ZnnfMessageSend> selectByExample(ZnnfMessageSendExample example) { return znnfMessageSendMapper.selectByExample(example); } }
[ "zhangshenglong@ciaapp.cn" ]
zhangshenglong@ciaapp.cn
03544324693e023daffa44e025b0601e79e0c242
7b0bbeb06112e179995728a11bb001184cc043a3
/src/main/java/ru/java/enums/Days.java
f311ff17617b33e1eedda92e336158e433d284ac
[]
no_license
lanasergeeva/java_black
b7c9ba36a98ab62a1f08bdb78e8ea51c68393320
f563869e25b070ea893fc4d8de91946dffe397e8
refs/heads/master
2023-08-24T21:52:52.639832
2021-09-20T12:58:47
2021-09-20T12:58:47
404,354,501
0
0
null
null
null
null
UTF-8
Java
false
false
1,121
java
package ru.java.enums; enum Days { MONDAY("amazing"), TUESDAY("amazing"), WEDNSDAY("nice"), THURSDAY("nice"), FRIDAY("good"), SATURDAY("amazing"), SUNDAY("amazing"); private String mood; Days(String mood) { this.mood = mood; } String getMood() { return mood; } } class Today { private Days days; public Today(Days days) { this.days = days; } void daysInfo() { switch (days) { case MONDAY: case TUESDAY: case WEDNSDAY: case THURSDAY: case FRIDAY: System.out.println("Let's go work"); case SATURDAY: case SUNDAY: System.out.println("Let's relax"); default: System.out.println("Wrong"); } System.out.println(days.getMood()); } public static void main(String[] args) { Today today = new Today(Days.SATURDAY); today.daysInfo(); Days d1 = Days.MONDAY; Days d2 = Days.SATURDAY; System.out.println(d1 == d2); } }
[ "marikakopina@gmail.com" ]
marikakopina@gmail.com
c653b3bbe6732fc2f63633a31ca17d12fccdc15d
5d30bef13a4278454fd9c38c9f528de35c1aaa52
/src/main/java/com/bitmovin/encoding/schedular/service/RabbitMqEncodingTaskCreated.java
9e1fb664558995001c81de5cc7777e379e3efcf7
[]
no_license
mosoahmed/bitmovinbackend
ae5d4899306889bb935eaff50b15d0d106a51be1
c5c0716b8f000ff14efdd7e87f975e8a7af7306f
refs/heads/master
2021-03-03T10:28:12.811340
2020-03-09T05:55:26
2020-03-09T05:55:26
245,954,413
0
0
null
null
null
null
UTF-8
Java
false
false
211
java
package com.bitmovin.encoding.schedular.service; public interface RabbitMqEncodingTaskCreated { void receiveTask(String encodingId, String serializedTask, String userId, int priority, String provider); }
[ "mosoahmed@Mosaads-MBP.mshome.net" ]
mosoahmed@Mosaads-MBP.mshome.net
b6f6bcd90c33ada5c32fa00ce545a498b2dbebe8
fb60413b02cdf8a5c38d24b033d2900832ba9f19
/log_server/src/com/pwrd/war/logserver/createtable/CreateTimer.java
cf816fa27351b8e090eb2e80aa006b1641c8fb06
[]
no_license
tommyadan/webgame
4729fc44617b9f104e0084d41763d98b3068f394
2117929e143e7498e524305ed529c4ee09163474
refs/heads/master
2021-05-27T04:59:34.506955
2012-08-20T14:30:07
2012-08-20T14:30:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
583
java
package com.pwrd.war.logserver.createtable; import java.util.Timer; import java.util.TimerTask; /** * 建立数据表的定时器 * * */ public class CreateTimer { /** * 启动一个Timer * * @param createTabaleTask * @param delay * 3600000 * @param period * 3600000 */ public static void scheduleTask(TimerTask timerTask, long delay, long period) { try { Timer timer = new Timer(); timer.schedule(timerTask, delay, period); } catch (Exception e) { throw new RuntimeException(e); } } }
[ "zhutao@brunjoy.com" ]
zhutao@brunjoy.com
9c2985b838f5b1ba6a9fcd31ebc1df33a806e7ce
c682a93f12a3282d0721508a178554999328316a
/design_patterns/src/main/java/design_patterns/com/milko/training/design_patterns/standard/creational/abstractfactory/validator/impl/VisaValidator.java
0675a60a3bd643ab60172b6671a77bafa3a1fcd2
[]
no_license
milkopg/design_patterns
b3a86fa4d70c37b6fcbbfc9c31302a543a7e442c
f73ea8d741b85b90c159856bfd58e9e025c52014
refs/heads/master
2022-07-08T21:38:00.676784
2021-01-02T21:01:29
2021-01-02T21:01:29
224,991,691
0
0
null
2022-07-01T21:28:27
2019-11-30T09:55:43
Java
UTF-8
Java
false
false
525
java
package design_patterns.com.milko.training.design_patterns.standard.creational.abstractfactory.validator.impl; import design_patterns.com.milko.training.design_patterns.standard.creational.abstractfactory.creditcard.base.CreditCard; import design_patterns.com.milko.training.design_patterns.standard.creational.abstractfactory.validator.base.Validator; public class VisaValidator implements Validator { @Override public boolean isValid(CreditCard creditCard) { // TODO Auto-generated method stub return false; } }
[ "milko.galev@effortel.com" ]
milko.galev@effortel.com
7fea3a92f71495477311eec372c273b755883bfd
6a2b54f5c9dbd281aaf64207b9ff5d4b569e0bd8
/src/que28/FactBelow.java
3d33c75dd20c94dbc3df299bce3a8d5298b49e8d
[]
no_license
BibekMahrzn/assignment
41e16b96adcd652dd0c0c18b6f31b8e1c2fd9b95
ecc40fc92b8a8aabec12d2e5f3cba808bfa0153e
refs/heads/master
2021-01-02T22:41:53.435779
2017-08-04T17:58:27
2017-08-04T17:58:27
99,370,527
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package que28; import java.util.Scanner; public class FactBelow { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("enter a number => "); int a = s.nextInt(); System.out.println("Answer => "+calculate(a)); s.close(); } private static double calculate(int a) { if(a == 2) return 2; return calculate(a-1)+(double)1/fact(a-1); } private static int fact(int i) { if (i==1) return 1; return fact(i-1)*i; } }
[ "rebibekiller1@hotmail.com" ]
rebibekiller1@hotmail.com
947f8b96dbf72be5deff539931de95d8b3e737c2
1b1c1d16ff0e3fc033c83c3151fb68ebabff09cb
/src/main/java/tn/esprit/spring/services/ReclamationServiceImpl.java
e13fa80e2b2c795671b1c03f1d8bc3d6871fe6cf
[]
no_license
atefkhelifi/springBoot
deb584b1e1aa1a5fb13d6b892ae4d2345fd57f84
8df7ee26e5e7415db01c3e0c224d877d6e4bf2d6
refs/heads/master
2023-04-07T05:47:07.626938
2020-06-16T19:22:22
2020-06-16T19:22:22
272,794,657
1
0
null
2023-03-27T22:19:40
2020-06-16T19:27:58
JavaScript
UTF-8
Java
false
false
1,633
java
package tn.esprit.spring.services; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import tn.esprit.spring.entities.Reclamation; import tn.esprit.spring.repository.ReclamationRepository; @Service public class ReclamationServiceImpl implements IReclamationService{ @Autowired ReclamationRepository reclamationRepository; @Override public List<Reclamation> afficherAllReclamations() { List<Reclamation> Reclamations=(List<Reclamation>)reclamationRepository.findAll(); return Reclamations; } @Override public Reclamation addReclamation(Reclamation r) { // TODO Auto-generated method stub return reclamationRepository.save(r); } @Override public void deleteReclamation(Long id) { // TODO Auto-generated method stub reclamationRepository.deleteById(id); } @Override public Reclamation updateReclamation(Reclamation r) { // TODO Auto-generated method stub return reclamationRepository.save(r); } @Override public Optional<Reclamation> afficherReclamation(Long id) { // TODO Auto-generated method stub return reclamationRepository.findById(id); } @Override public Reclamation traiterDecision(Long id, Reclamation r) { if (reclamationRepository.findById(id).isPresent()){ Reclamation tt = reclamationRepository.findById(id).get(); tt.setDecision(r.getDecision()); Reclamation traitedReclamation = reclamationRepository.save(tt); return traitedReclamation; }else{ return null; } } }
[ "atef.khelifi@esprit.tn" ]
atef.khelifi@esprit.tn
943e4a40a11f680fa3805d8f986f41add4e3499a
6ce9eb6cad1e0bcf901122c1e9d704f685f75520
/src/api/SendPost.java
52d1bb7725cce2a67b752457e186f1b00bbaab08
[]
no_license
brazvan/api
c3ef50c9be2131591f20d46c40f274f911ccebeb
31a7b717e8f88224929e048feeb7a50d8af0c43c
refs/heads/master
2021-01-18T16:35:06.355271
2017-03-29T09:18:10
2017-03-29T09:18:10
84,352,985
0
0
null
null
null
null
UTF-8
Java
false
false
3,122
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 api; import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.security.cert.X509Certificate; import java.util.Scanner; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager;; /** * * @author Razvanb */ public class SendPost { Scanner scanner = new Scanner(System.in); public void sendPost() throws Exception{ TrustManager(); System.out.println("Introdu URL: \r"); System.setProperty("jsse.enableSNIExtension", "false"); String url = "https://"+scanner.nextLine(); URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); //Autentificare String userCredentials = "georgei:!Q2w3e4r"; String basicAuth = "Basic " + new String(new Base64().encode(userCredentials.getBytes())); con.setRequestProperty ("Authorization", basicAuth); con.setDoOutput(true); con.setRequestMethod("POST"); con.setRequestProperty("Content-Type", "application/json"); //con.setRequestProperty("Accept", "application/json"); System.out.println("Introdu POST: \r"); String payload = scanner.next(); OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); osw.write(payload); osw.flush(); osw.close(); con.getInputStream(); } private static void TrustManager()throws Exception{ TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); // Create all-trusting host name verifier HostnameVerifier allHostsValid = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; // Install the all-trusting host verifier HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); /* * end of the fix */ } }
[ "Razvanb@liveu.tv" ]
Razvanb@liveu.tv
66cdabb7749641f817e3a1d9e909dec0cb3262c4
3355af66772780270057329253c5a910ed9e0874
/pattern/src/main/java/com/cuzofu/pattern/flyweight/Circle.java
39dcc88f1b9a857f4c99788c471244de98ac4ffb
[]
no_license
cuzofu/pattern
3a39ae44df5d22a753bb1b333f2c95e906d758b0
f49738468753b3685a4fb7ae56609490d49a9c00
refs/heads/master
2021-01-11T01:19:19.185615
2016-10-16T15:20:34
2016-10-16T15:20:34
71,057,321
2
1
null
null
null
null
UTF-8
Java
false
false
520
java
package com.cuzofu.pattern.flyweight; public class Circle implements Shape { private String color; private int x; private int y; private int radius; public Circle(String color) { this.color = color; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void setRadius(int radius) { this.radius = radius; } public void draw() { System.out.println( "Circle: Draw() [Color : " + color + ", x : " + x + ", y : " + y + ", radius : " + radius + "]"); } }
[ "cuzofu@qq.com" ]
cuzofu@qq.com
44e418e0e848143234eb930c80c4da8fad0a1da2
9d3c9618383c6f8c385ab37989074d9625f084b0
/src/test/java/com/qa/Pages/ReviewPage.java
f43cd8f07af0dc5ae20bb9d63b26f314a6e879ab
[]
no_license
shweta2001/WalletHubAssignment
487a60d909916a47b579018a95942337ebd97ea8
9ff09ab015a338d4f8bd4243f42cd98cb7f6afb9
refs/heads/master
2023-05-30T23:46:43.173292
2021-06-28T15:26:12
2021-06-28T15:26:12
381,053,698
0
0
null
null
null
null
UTF-8
Java
false
false
3,352
java
package com.qa.Pages; import java.util.List; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindAll; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.qa.TestBase.TestBase; import com.qa.TestConfig.testConfig; import com.qa.TestUtility.common; public class ReviewPage extends TestBase { public static String Profile_URL="https://wallethub.com/profile/67430782i"; public static String review_URL="http://wallethub.com/profile/test_insurance_company/"; public ReviewPage() { PageFactory.initElements(driver, this); } @FindBy(xpath = "//*[contains(@class,'wh-rating rating_5')]") private WebElement reviewTab; @FindAll({ @FindBy(xpath = "//review-star[@class='rvs-svg']//*[local-name()='svg']") }) private List<WebElement> star; @FindBy(xpath = "//review-star[@class='rvs-svg']//*[local-name()='svg']") private WebElement starSurface; @FindBy(xpath = "//span[normalize-space()='Select...']") private WebElement selectDropDown; @FindBy(xpath = "//li[normalize-space()='Health Insurance']") private WebElement selectHealthIns; @FindBy(xpath = "//textarea[@placeholder='Write your review...']") private WebElement reviewTextField; @FindBy(xpath = "//div[contains(@class,'sbn-action')]") private WebElement submitButton; @FindBy(xpath = "//span[normalize-space()='Your Review']") private WebElement yourReview; @FindBy(xpath = "//h4[normalize-space()='Your review has been posted.']") private WebElement reviewconfirmation; @FindBy(xpath = "//div[@class='btn rvc-continue-btn']") private WebElement continueButton; @FindBy(xpath = "//h2[normalize-space()='I RECOMMEND']") private WebElement recommendedFeed; //public void navigate to Review URL public void navigateToReview() { driver.navigate().to(review_URL); } //Click on Review Tab public void clickReviewTab() { reviewTab.click(); } //Hover and click into star public void clickStar() { // Hover Mouse on 4 star Actions action = new Actions(driver); action.moveToElement(star.get(2)).build().perform(); action.moveToElement(star.get(3)).click().perform(); } //Next window display public void switchToChildWindow() { driver.switchTo().window(driver.getWindowHandle()); } //Click on Health Insurance from select dropdown public void clickHealthInsurance() { selectDropDown.click(); selectHealthIns.click(); } //Enter min 200 text in text field public void enterTextInReview(int textlimit) { reviewTextField.sendKeys(common.randomAlphaNumeric(textlimit)); } //Click on submit button public void clickSubmitButton() { submitButton.click(); } //Review feed confirmation window public String ReviewFeedConfirm() { return reviewconfirmation.getText(); } public void waitforConfirmationForm() { WebDriverWait wait=new WebDriverWait(driver, testConfig.explicit_wait); wait.until(ExpectedConditions.elementToBeClickable(continueButton)); } public void gotoProfileLink() { driver.navigate().to(Profile_URL); } public boolean IsReviewFeed() { return recommendedFeed.isDisplayed(); } }
[ "shweta.saxena2010@gmail.com" ]
shweta.saxena2010@gmail.com
e30dadf196e7cd70d4c0e076a194b1d99f2d51b2
7c3f70ac64c96b798617672187a04c92acbeb693
/src/main/java/com/vasidzius/tradevalidator/validation/rules/general/valuedate/IsValueDateCurrencyHolidays.java
44a96d0f75bc799116accdfa899ea3eb8572de50
[]
no_license
vasidzius/tradevalidator
ee8244399b98705849218b210f9c8e7f6c6f0bd8
9d78c20f5f7fccf3d675e7050f5f18d5ef2e0c84
refs/heads/master
2020-03-20T03:14:41.488271
2018-06-19T10:21:28
2018-06-19T10:21:28
137,140,093
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package com.vasidzius.tradevalidator.validation.rules.general.valuedate; import javax.validation.Constraint; import javax.validation.Payload; import java.lang.annotation.*; /** * The interface Is value date currency holidays. */ @Documented @Constraint(validatedBy = IsValueDateCurrencyHolidaysValidator.class) @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface IsValueDateCurrencyHolidays { String message() default "valueDate is public holidays"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; }
[ "vasiliy.kovalchenko@sidenis.com" ]
vasiliy.kovalchenko@sidenis.com
a9bd64484b4f38e96deedced191b1942d105f8ee
3104bf351e4e879ad987198003ef2f75021994a3
/app/src/main/java/com/seuntech/seuntechpincode/example_custom_activity.java
50b17c168e6b5a895f470382b9ea5cb1f5dfa568
[ "Apache-2.0" ]
permissive
seuntech/seuntechfingerprint
0fa18c81d9392b6152f1924052785722e6064641
7703f4d12b9ee91c66ca99b1daadade99e5e6507
refs/heads/master
2020-04-19T23:33:15.012076
2019-02-01T21:59:05
2019-02-01T21:59:05
168,499,074
0
0
Apache-2.0
2019-01-31T13:56:34
2019-01-31T09:32:49
Java
UTF-8
Java
false
false
1,241
java
package com.seuntech.seuntechpincode; import android.widget.Toast; import com.seuntech.pinpad.pin_activity; /** * Created by seuntech on 1/29/2019. */ public class example_custom_activity extends pin_activity { @Override public int get_layout() { return R.layout.activity_pin; } @Override public int get_BodyColor() { return R.color.st_body; } @Override public int get_font_size(){ return 14; } @Override public void onForgot() { Toast.makeText(getApplicationContext(), "FORGOTSSSSSSSSSS", Toast.LENGTH_SHORT).show(); } @Override public void onPinFail(int attempts) { Toast.makeText(getApplicationContext(), String.valueOf(attempts), Toast.LENGTH_SHORT).show(); } @Override public void onPinSuccess(int attempts) { Toast.makeText(getApplicationContext(), String.valueOf(attempts), Toast.LENGTH_SHORT).show(); } @Override public void onFingerFail() { Toast.makeText(getApplicationContext(), "Yess Finger", Toast.LENGTH_SHORT).show(); } @Override public void onFingerSuccess() { Toast.makeText(getApplicationContext(), "No finger", Toast.LENGTH_SHORT).show(); } }
[ "seuntech2k@yahoo.com" ]
seuntech2k@yahoo.com
73f4609c4f3349548a1568303f29cf48c5609f53
59e6dc1030446132fb451bd711d51afe0c222210
/components/cassandra/org.wso2.carbon.cassandra.mgt/4.2.2/src/main/java/org/wso2/carbon/cassandra/mgt/CassandraManager.java
1688f426fbb06c65ea0b1ee2a0acf7cb29df0b8c
[]
no_license
Alsan/turing-chunk07
2f7470b72cc50a567241252e0bd4f27adc987d6e
e9e947718e3844c07361797bd52d3d1391d9fb5e
refs/heads/master
2020-05-26T06:20:24.554039
2014-02-07T12:02:53
2014-02-07T12:02:53
38,284,349
0
1
null
null
null
null
UTF-8
Java
false
false
2,005
java
/* * Copyright (c) 2005-2013, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. 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.wso2.carbon.cassandra.mgt; import me.prettyprint.hector.api.ddl.KeyspaceDefinition; import org.wso2.carbon.cassandra.dataaccess.ClusterInformation; public interface CassandraManager { String getClusterName() throws CassandraServerManagementException; String[] getKeyspaces(ClusterInformation cfInfo) throws CassandraServerManagementException; KeyspaceDefinition getKeyspaceDefinition(String ksName) throws CassandraServerManagementException; void addColumnFamily(ColumnFamilyInformation cfInfo) throws CassandraServerManagementException; void updateColumnFamily(ColumnFamilyInformation cfInfo) throws CassandraServerManagementException; boolean deleteKeyspace(String ksName) throws CassandraServerManagementException; void addKeyspace(KeyspaceInformation ksInfo) throws CassandraServerManagementException; void updatedKeyspace(KeyspaceInformation ksInfo) throws CassandraServerManagementException; ColumnFamilyInformation getColumnFamilyOfCurrentUser( String ksName, String cfName) throws CassandraServerManagementException; KeyspaceInformation getKeyspaceofCurrentUser(String ksName) throws CassandraServerManagementException; String[] listColumnFamiliesOfCurrentUser(String ksName) throws CassandraServerManagementException; }
[ "malaka@wso2.com" ]
malaka@wso2.com
a9f5399bf0d77429b449691c2b3aecc0f24f2030
83a3b2c3e29b811547a2200af4c5208b7f421cbf
/app/src/main/java/com/demo/marquee/model/MaqueeModel.java
316fda381570f4a9f13aad1773db0fa65c326fa3
[]
no_license
FX19970117/maquee_click
bfbe79ba82b35c8d620a4fd01eb6151dc84fff2d
5a4643968992b63f66eb96ffb3294f0ddfac720d
refs/heads/master
2021-01-21T09:14:50.711019
2016-10-23T10:10:04
2016-10-23T10:10:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
846
java
package com.demo.marquee.model; /** * Created by SEELE on 2016/8/26. */ public class MaqueeModel { /** * code : SZ3990011 * name : 深证成指1 * price : 10748 * percent : 10 */ private String code; private String name; private int price; private int percent; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public int getPercent() { return percent; } public void setPercent(int percent) { this.percent = percent; } }
[ "153437803@qq.com" ]
153437803@qq.com
f5553990f8d336854bae48fcd56b3847c8d97aa7
bd1de34bb9cef9c7c382a82dc849f35b18ed28c7
/src/main/java/com/cursomc/services/UserService.java
0eb0b7304d4c098e3245b2308b658f6aa5a1d915
[]
no_license
emersonabreu/Crud-Spring-Ionic
b9ccd14e5a37a03e27142f8be64fb10b443288ec
e8298b0bd3eef42b6026e969f240b67ac4734ef4
refs/heads/master
2020-03-08T05:10:02.242154
2018-06-16T12:09:53
2018-06-16T12:09:53
127,941,240
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.cursomc.services; import org.springframework.security.core.context.SecurityContextHolder; import com.cursomc.security.UserSS; /** Classe retorna o usuario logado */ public class UserService { public static UserSS authenticated() { try { return (UserSS) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); } catch (Exception e) { return null; } } }
[ "emersondamiaosouza@gmail.com" ]
emersondamiaosouza@gmail.com
33e56f9708ea8959afd90925ea48e9cf8180ebcd
31a40950fd1393cd00973cc8ef7f57d2976b376b
/src/main/java/com/iamfy/design/principle/factory/simple/pay/PayFactory.java
a3c9d2c7c88022cfb1d4b7d9b3171c7fb3706682
[]
no_license
xieluhua/pattern
93e6daddda9fac42adb0be653c75375e221759dc
beff6358a39bbfebab1f6afefd6fc7f9abd0fdaa
refs/heads/master
2022-12-23T08:40:43.154530
2020-03-26T08:04:35
2020-03-26T08:04:35
246,183,163
0
0
null
2022-12-15T23:33:12
2020-03-10T01:49:10
Java
UTF-8
Java
false
false
351
java
package com.iamfy.design.principle.factory.simple.pay; public class PayFactory { public IPay cratePay(Class<? extends IPay> classz) { try { if (null != classz) { return classz.newInstance(); } } catch (Exception e) { e.printStackTrace(); } return null; } }
[ "xielh@live.cn" ]
xielh@live.cn
3c79b9b17ca4381a4ecabd7a2f7fb38a4cfc0f11
c25b8554aa0f66803485d9b8c0f954c226b34e35
/src/test/java/com/jhklab/hellospring/service/MemberServiceTest.java
450990da888bda0525b181820e877c0442373c03
[]
no_license
jhk920613/inflearn-spring-introduction
45ee92de817ba6fb1985f09a262166a6c453ea91
0b38e2b189f49446fca6b7be1d96b6cfa3b5bdf7
refs/heads/master
2023-04-13T00:57:05.920688
2021-04-19T11:02:51
2021-04-19T11:02:51
357,537,088
0
0
null
null
null
null
UTF-8
Java
false
false
2,177
java
package com.jhklab.hellospring.service; import com.jhklab.hellospring.domain.Member; import com.jhklab.hellospring.repository.MemoryMemberRepository; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.Optional; import static org.assertj.core.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*; class MemberServiceTest { // 단위 테스트 MemoryMemberRepository memberRepository; MemberService memberService; @BeforeEach // 각 테스트의 실행 전 실행 public void beforeEach() { memberRepository = new MemoryMemberRepository(); memberService = new MemberService(memberRepository); } @AfterEach // 각 테스트가 끝나고 호출되는 메소드 public void afterEach() { memberRepository.clearStore(); } @Test void 회원가입() { //테스트는 과감하게 한글 메소드로 써도 괜찮 // given Member member = new Member(); member.setName("spring"); // when Long saveId = memberService.join(member); // then Member findMember = memberService.findOne(saveId).get(); assertThat(member.getName()).isEqualTo(findMember.getName()); } @Test public void 중복_회원_예외() { // given Member member1 = new Member(); member1.setName("spring"); // when Member member2 = new Member(); member2.setName("spring"); memberService.join(member1); IllegalStateException e = assertThrows(IllegalStateException.class, () -> memberService.join(member2)); assertThat(e.getMessage()).isEqualTo("이미 존재하는 회원입니다."); // try { // memberService.join(member2); // fail("예외가 발생해야 합니다."); // } catch (IllegalStateException e) { // assertThat(e.getMessage()).isEqualTo("이미 존재하는 회원입니다."); // } // then } @Test void findMembers() { } @Test void findOne() { } }
[ "926jhk@gmail.com" ]
926jhk@gmail.com
38457fb434abb50e345d4b34d9f876fa80e0db86
64abfc0130cfa0aeb85c2c0a7d2f95037a80271f
/ECO_EmployeeManagement-portlet/docroot/WEB-INF/src/vn/com/ecopharma/emp/service/http/EmpLaborContractServiceSoap.java
3f8a56c6234ee132e89a48b99204e8bbdd125c18
[]
no_license
taotran/eco
8c962eb918ad4675b535d775f7b8af99cfaab31b
22620bc21ceb8da83e06c402cfa7bd5a0ea05cee
refs/heads/master
2021-01-10T02:48:29.194619
2016-04-14T11:00:58
2016-04-14T11:00:58
44,424,693
0
0
null
null
null
null
UTF-8
Java
false
false
2,283
java
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package vn.com.ecopharma.emp.service.http; /** * Provides the SOAP utility for the * {@link vn.com.ecopharma.emp.service.EmpLaborContractServiceUtil} service utility. The * static methods of this class calls the same methods of the service utility. * However, the signatures are different because it is difficult for SOAP to * support certain types. * * <p> * ServiceBuilder follows certain rules in translating the methods. For example, * if the method in the service utility returns a {@link java.util.List}, that * is translated to an array of {@link vn.com.ecopharma.emp.model.EmpLaborContractSoap}. * If the method in the service utility returns a * {@link vn.com.ecopharma.emp.model.EmpLaborContract}, that is translated to a * {@link vn.com.ecopharma.emp.model.EmpLaborContractSoap}. Methods that SOAP cannot * safely wire are skipped. * </p> * * <p> * The benefits of using the SOAP utility is that it is cross platform * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and * even Perl, to call the generated services. One drawback of SOAP is that it is * slow because it needs to serialize all calls into a text format (XML). * </p> * * <p> * You can see a list of services at http://localhost:8080/api/axis. Set the * property <b>axis.servlet.hosts.allowed</b> in portal.properties to configure * security. * </p> * * <p> * The SOAP utility is only generated for remote services. * </p> * * @author tvt * @see EmpLaborContractServiceHttp * @see vn.com.ecopharma.emp.model.EmpLaborContractSoap * @see vn.com.ecopharma.emp.service.EmpLaborContractServiceUtil * @generated */ public class EmpLaborContractServiceSoap { }
[ "tao.tranv@gmail.com" ]
tao.tranv@gmail.com
af1db35b8fc510bbe87b02f70a487dbefdd2184c
87e5ba96bff8552a495ea7b73d63b2656e231180
/17/src/main/java/com/company/JavaPractice/controller/ItemController.java
71b577541c66604d49f154a09bffd4f9cd7da466
[]
no_license
laefad/Java-2
461b0d48c702fa5661024b16620236a2e2b45cc5
050e800e414a6b0dbd88026445aa0fd4dfe6e73f
refs/heads/master
2023-04-30T16:21:18.693654
2021-05-17T15:14:25
2021-05-17T15:14:25
368,230,276
0
0
null
null
null
null
UTF-8
Java
false
false
3,677
java
package com.company.JavaPractice.controller; import com.company.JavaPractice.entity.Item; import com.company.JavaPractice.repository.ItemRepository; import com.company.JavaPractice.repository.OrderRepository; import com.company.JavaPractice.util.ItemSpecification; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Sort; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.List; @Controller @RequestMapping(value = "/items") public class ItemController { @Autowired private OrderRepository orderRepository; @Autowired private ItemRepository itemRepository; @GetMapping public String items ( @RequestParam Long orderId, Model model ) { model.addAttribute("items", itemRepository.findAll( ItemSpecification.selectByOrderId(orderId) )) .addAttribute("orderId", orderId); return "items"; } private List<Item> getSorted( String field, Long orderId ) { return itemRepository.findAll( ItemSpecification.selectByOrderId(orderId) , Sort.by(Sort.Direction.ASC, field) ); } @GetMapping(value = "/sortById") public String sortById ( @RequestParam Long orderId, Model model ) { model.addAttribute("items", getSorted("id", orderId)) .addAttribute("orderId", orderId); return "items"; } @GetMapping(value = "/sortByName") public String sortByName ( @RequestParam Long orderId, Model model ) { model.addAttribute("items", getSorted("name", orderId)) .addAttribute("orderId", orderId); return "items"; } @GetMapping(value = "/sortByPrice") public String sortByPrice ( @RequestParam Long orderId, Model model ) { model.addAttribute("items", getSorted("price", orderId)) .addAttribute("orderId", orderId); return "items"; } @GetMapping(value = "/sortByDate") public String sortByDate ( @RequestParam Long orderId, Model model ) { model.addAttribute("items", getSorted("creationDate", orderId)) .addAttribute("orderId", orderId); return "items"; } @PostMapping("/remove") public String removeItem ( @RequestParam Long itemId, @RequestParam Long orderId, Model model ) { if (itemId != null) itemRepository.deleteById(itemId); return "redirect:/items?orderId=" + orderId; } @PostMapping("/add") public String addItem ( @DateTimeFormat(pattern = "dd-MM-yyyy") @RequestParam Date creationDate, @RequestParam String name, @RequestParam Double price, @RequestParam Long orderId, Model model ) { if (creationDate != null && name != null && price != null && orderId != null) itemRepository.save( Item.builder() .creationDate(creationDate) .name(name) .price(price) .order(orderRepository.getOne(orderId)) .build() ); return "redirect:/items?orderId=" + orderId; } }
[ "FreeFlightA@yandex.ru" ]
FreeFlightA@yandex.ru
2efcae98f59f30d7231864ba270a83bb90638a35
24a32bc2aafcca19cf5e5a72ee13781387be7f0b
/src/framework/tags/gwt-test-utils-parent-0.28.1/gwt-test-utils/src/test/java/com/octo/gwt/test/TreeTest.java
dd38acf8762ab62e9b9cf30e9171e4a6b9bf5f23
[]
no_license
google-code-export/gwt-test-utils
27d6ee080f039a8b4111e04f32ba03e5396dced5
0391347ea51b3db30c4433566a8985c4e3be240e
refs/heads/master
2016-09-09T17:24:59.969944
2012-11-20T07:13:03
2012-11-20T07:13:03
32,134,062
0
0
null
null
null
null
UTF-8
Java
false
false
3,642
java
package com.octo.gwt.test; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Tree; import com.google.gwt.user.client.ui.TreeItem; public class TreeTest extends GwtTestTest { private TreeItem clickedTreeItem; private TreeItem item0; private TreeItem item1; private TreeItem item2; private TreeItem parent; private Tree tree; @Test public void checkAddItem() { tree.addItem("parent2"); Assert.assertEquals(2, tree.getItemCount()); Assert.assertEquals("parent2", tree.getItem(1).getHTML()); } @Test public void checkAddSubItem() { tree.getItem(0).addItem("item3"); Assert.assertEquals(4, tree.getItem(0).getChildCount()); Assert.assertEquals(item0, tree.getItem(0).getChild(0)); Assert.assertEquals(item1, tree.getItem(0).getChild(1)); Assert.assertEquals(item2, tree.getItem(0).getChild(2)); Assert.assertEquals("item3", tree.getItem(0).getChild(3).getHTML()); } @Test public void checkAnimationEnabled() { tree.setAnimationEnabled(true); Assert.assertEquals(true, tree.isAnimationEnabled()); } @Test public void checkRemoveItem() { tree.removeItem(parent); Assert.assertEquals(0, tree.getItemCount()); } @Test public void checkRemoveSubItem() { tree.getItem(0).removeItem(item0); Assert.assertEquals(2, tree.getItem(0).getChildCount()); Assert.assertEquals(item1, tree.getItem(0).getChild(0)); Assert.assertEquals(item2, tree.getItem(0).getChild(1)); } @Test public void checkSelected() { // Setup tree.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { clickedTreeItem = event.getSelectedItem(); } }); // Test tree.setSelectedItem(item1); TreeItem selected = tree.getSelectedItem(); // Assert Assert.assertEquals(item1, clickedTreeItem); Assert.assertEquals(item1, selected); } @Test public void checkSelectedOnFocusWidget() { // Setup tree.addSelectionHandler(new SelectionHandler<TreeItem>() { public void onSelection(SelectionEvent<TreeItem> event) { clickedTreeItem = event.getSelectedItem(); } }); // Test on item2 which wrap a Checkbox tree.setSelectedItem(item2); TreeItem selected = tree.getSelectedItem(); // Assert Assert.assertEquals(item2, clickedTreeItem); Assert.assertEquals(item2, selected); } @Test public void checkTitle() { tree.setTitle("title"); Assert.assertEquals("title", tree.getTitle()); } @Test public void checkVisible() { Assert.assertEquals(true, tree.isVisible()); tree.setVisible(false); Assert.assertEquals(false, tree.isVisible()); } @Before public void setupTree() { // Create a tree with a few items in it. parent = new TreeItem("parent"); item0 = parent.addItem("item0"); item1 = parent.addItem("item1"); // Add a CheckBox to the tree item2 = new TreeItem(new CheckBox("item2")); parent.addItem(item2); tree = new Tree(); tree.addItem(parent); // Add it to the root panel. RootPanel.get().add(tree); Assert.assertTrue(tree.isVisible()); clickedTreeItem = null; } }
[ "gael.lazzari@d9eb14d4-a931-11de-b950-3d5b5f4ea0aa" ]
gael.lazzari@d9eb14d4-a931-11de-b950-3d5b5f4ea0aa
6f2c7c200e397937e50bcc34dfa9e77661fafc97
869bb55f283866d6447b4507d6f651f7b175f4d8
/Cesar/app/src/main/java/com/app/ahgas_c8688fe/util/IntentUtil.java
078152387c41541bf68693d3172818e2d059bfa7
[]
no_license
saif0347/AppsGas
1c45684beea52eb266cbb248d88f5dcafefda04e
2acf52a5647ce57ab7e798e232fd5c324b36635b
refs/heads/master
2023-04-06T02:48:55.230262
2021-04-13T23:02:32
2021-04-13T23:02:32
267,989,256
0
0
null
null
null
null
UTF-8
Java
false
false
6,616
java
package com.app.ahgas_c8688fe.util; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.StrictMode; import androidx.core.content.FileProvider; import android.util.Log; import android.webkit.MimeTypeMap; import android.widget.Toast; import java.io.File; import java.lang.reflect.Method; public class IntentUtil { private void sendSms(Context context, String number) { Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setData(Uri.parse("sms:" + number)); context.startActivity(sendIntent); } public static void uninstallApp(Activity activity, String packageName){ Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + packageName)); activity.startActivity(intent); } public static void openUrlInBrowser(Activity activity, String url){ Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); activity.startActivity(i); } public static void openUrlInChrome(Activity activity, String url){ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setPackage("com.android.chrome"); try { activity.startActivity(intent); } catch (ActivityNotFoundException ex) { // Chrome browser presumably not installed so allow user to choose instead intent.setPackage(null); activity.startActivity(intent); } } public static void openApp(Activity activity, String packageName){ Intent launchIntent = activity.getPackageManager().getLaunchIntentForPackage(packageName); if (launchIntent != null) { activity.startActivity(launchIntent); } } public static void openDocument(Activity activity, String path) { uriFix(); Intent intent = new Intent(Intent.ACTION_VIEW); File file = new File(path); String extension = MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(file).toString()); String mimetype = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); if (extension.equalsIgnoreCase("") || mimetype == null) { intent.setDataAndType(Uri.fromFile(file), "text/*"); } else { intent.setDataAndType(Uri.fromFile(file), mimetype); } activity.startActivity(Intent.createChooser(intent, "Choose an Application:")); } public static void openExcelFile(Activity activity, String path) { uriFix(); Uri uri = Uri.parse(path); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, "application/vnd.ms-excel"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); try { activity.startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(activity, "No Application Available to View Excel.", Toast.LENGTH_SHORT).show(); } } public static void openPdf(Activity activity, String path) { uriFix(); File file = new File(path); Uri uri1 = Uri.fromFile(file); Uri uri2 = FileProvider.getUriForFile(activity, activity.getApplicationContext().getPackageName() + ".my.package.name.provider", file); Log.e("tag", "uri1: "+uri1); Log.e("tag", "uri2: "+uri2); try { Intent intentUrl = new Intent(Intent.ACTION_VIEW); if(Build.VERSION.SDK_INT < 24){ intentUrl.setDataAndType(uri1, "application/pdf"); } else { intentUrl.setDataAndType(uri2, "application/pdf"); intentUrl.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } intentUrl.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); activity.startActivity(intentUrl); } catch (ActivityNotFoundException e) { Toast.makeText(activity, "No PDF Viewer Installed", Toast.LENGTH_LONG).show(); } } public static void shareImage(Activity activity, String path) { Intent share = new Intent(Intent.ACTION_SEND); share.setType("image/*"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///" + path)); activity.startActivity(Intent.createChooser(share, "Share")); } public static void shareText(Activity activity, String title, String text){ Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, title); i.putExtra(Intent.EXTRA_TEXT, text); activity.startActivity(Intent.createChooser(i, "Share")); } public static void openInstaller(Activity activity, String filePath, String packageName) { uriFix(); File file = new File(filePath); if(!file.exists()){ Log.e("tag", ""); } file.setReadable(true, false); Uri path = Uri.fromFile(file); Uri path2 = FileProvider.getUriForFile(activity, activity.getPackageName() + ".my.package.name.provider", file); if (Build.VERSION.SDK_INT >= 24) { Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE); intent.setData(path2); intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); activity.startActivity(intent); } else { Intent intent = new Intent(Intent.ACTION_VIEW); intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setDataAndType(path, "application/vnd.android.package-archive"); activity.startActivity(intent); } } private static void uriFix(){ if(Build.VERSION.SDK_INT>=24){ try{ Method m = StrictMode.class.getMethod("disableDeathOnFileUriExposure"); m.invoke(null); } catch(Exception e){ e.printStackTrace(); } } } }
[ "saif@saifs-MacBook-Pro.local" ]
saif@saifs-MacBook-Pro.local
1bb0d63cdd21bfbdc01b8128772978900da73648
d1f1a21c3ab225eaa8022c9623c224eedfe8c7b1
/MovieTvApp/src/neu/cs5200/movieTv/movie/Movie.java
e192e0abf6ff45bf3fa326b24a5790f63da18a00
[]
no_license
cheerhou/cs5200-final-project
a6cc03e6ccfbdcf6741fea944ee141809161d1de
b9c704ec6357baf1bd4ceecdd2d3728719acb01e
refs/heads/master
2020-06-06T13:32:30.868360
2014-12-11T22:51:49
2014-12-11T22:51:49
27,574,394
1
1
null
null
null
null
UTF-8
Java
false
false
2,206
java
package neu.cs5200.movieTv.movie; //@Entity //public class Movie { // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name="MOVIE_ID") // private int id; //// private int budget; //// private List<Genre> genres; //// private String homepage; //// private String title; //// private String overview; //// private String posterPath; //// private List<Company> productionCompanies; //// private List<Country> productionCountries; //// private String releaseDate; //// private int runtime; //// private List<Lan> spokenLanguages; //// private String status; //// private String tagline; //// private double voteAverage; //// private int voteCount; // //} import neu.cs5200.movieTv.user.User; import java.util.List; public class Movie { private long id; private List<User> users; private String title; private String overview; private String tagline; private String releaseDate; private double voteAverage; private String posterPath; public Movie() { } public Movie(long id) { super(); this.id = id; } public Movie(int movieId, String title) { super(); this.id = movieId; this.title = title; } public long getId() { return this.id; } public void setId(long movieId) { this.id = movieId; } public List<User> getUsers() { return this.users; } public void setUsers(List<User> users) { this.users = users; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getOverview() { return overview; } public void setOverview(String overview) { this.overview = overview; } public String getTagline() { return tagline; } public void setTagline(String tagline) { this.tagline = tagline; } public String getReleaseDate() { return releaseDate; } public void setReleaseDate(String releaseDate) { this.releaseDate = releaseDate; } public double getVoteAverage() { return voteAverage; } public void setVoteAverage(double voteAverage) { this.voteAverage = voteAverage; } public String getPosterPath() { return posterPath; } public void setPosterPath(String posterPath) { this.posterPath = posterPath; } }
[ "hou.c@husky.neu.edu" ]
hou.c@husky.neu.edu
79188e9bdff93c67d3d30704f2e31cb2e43bd383
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_8885561440891a8545db68bdee306fb6df6fe757/BigIntegers/2_8885561440891a8545db68bdee306fb6df6fe757_BigIntegers_s.java
bc4db4c3d97240e3efe990c62adb229a873b6b06
[]
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
3,472
java
package org.bouncycastle.util; import java.math.BigInteger; import java.security.SecureRandom; /** * BigInteger utilities. */ public final class BigIntegers { private static final int MAX_ITERATIONS = 1000; private static final BigInteger ZERO = BigInteger.valueOf(0); /** * Return the passed in value as an unsigned byte array. * * @param value value to be converted. * @return a byte array without a leading zero byte if present in the signed encoding. */ public static byte[] asUnsignedByteArray( BigInteger value) { byte[] bytes = value.toByteArray(); if (bytes[0] == 0) { byte[] tmp = new byte[bytes.length - 1]; System.arraycopy(bytes, 1, tmp, 0, tmp.length); return tmp; } return bytes; } /** * Return the passed in value as an unsigned byte array. * * @param value value to be converted. * @return a byte array without a leading zero byte if present in the signed encoding. */ public static byte[] asUnsignedByteArray( int length, BigInteger value) { byte[] bytes = value.toByteArray(); if (bytes[0] == 0) { if (bytes.length - 1 > length) { throw new IllegalArgumentException("standard length exceeded for value"); } byte[] tmp = new byte[length]; System.arraycopy(bytes, 1, tmp, tmp.length - (bytes.length - 1), tmp.length); return tmp; } else { if (bytes.length == length) { return bytes; } if (bytes.length > length) { throw new IllegalArgumentException("standard length exceeded for value"); } byte[] tmp = new byte[length]; System.arraycopy(bytes, 0, tmp, tmp.length - bytes.length - 1, tmp.length); return tmp; } } /** * Return a random BigInteger not less than 'min' and not greater than 'max' * * @param min the least value that may be generated * @param max the greatest value that may be generated * @param random the source of randomness * @return a random BigInteger value in the range [min,max] */ public static BigInteger createRandomInRange( BigInteger min, BigInteger max, SecureRandom random) { int cmp = min.compareTo(max); if (cmp >= 0) { if (cmp > 0) { throw new IllegalArgumentException("'min' may not be greater than 'max'"); } return min; } if (min.bitLength() > max.bitLength() / 2) { return createRandomInRange(ZERO, max.subtract(min), random).add(min); } for (int i = 0; i < MAX_ITERATIONS; ++i) { BigInteger x = new BigInteger(max.bitLength(), random); if (x.compareTo(min) >= 0 && x.compareTo(max) <= 0) { return x; } } // fall back to a faster (restricted) method return new BigInteger(max.subtract(min).bitLength() - 1, random).add(min); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
2809c425bd6ccc4abf31ec0c6343326c6933c5ed
a0bfaa198148a6d500800c54052d8b875f261e80
/go-concurrency-to-java/src/main/java/com/ywcjxf/java/go/concurrent/chan/impl/third/io/github/anolivetree/goncurrent/ThreadContext.java
040d406b4ad432f06c790601b3d35764e36f261b
[]
no_license
EugeneYoung1515/go-concurrency-to-java
070c551142babdf3539f3a312a58b95a7bc5288d
6c172e3b589508ca9a0260e21b5c6e645979b7da
refs/heads/master
2020-12-27T16:40:41.525355
2020-02-03T16:07:57
2020-02-03T16:07:57
237,974,721
0
0
null
2020-10-13T19:14:50
2020-02-03T13:43:48
Java
UTF-8
Java
false
false
7,345
java
/** * Copyright (C) 2015 Hiroshi Sakurai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ywcjxf.java.go.concurrent.chan.impl.third.io.github.anolivetree.goncurrent; import java.util.ArrayList; import java.util.concurrent.locks.Condition; class ThreadContext { private static final ThreadLocal<ThreadContext> context = new ThreadLocal<ThreadContext>() { @Override protected ThreadContext initialValue() { ThreadContext context = new ThreadContext(); return context; } }; public static ThreadContext get() { return context.get(); } static final Object sReceiveFlag = new Object(); final Condition mCond; int mUnblockedChanIndex = -1; Object mReceivedData; ArrayList<Chan> mChan = new ArrayList<Chan>(); ArrayList<Object> mSendData = new ArrayList<Object>(); private ThreadContext() { mCond = Chan.sLock.newCondition(); } /** * register send channel one by one * @param chan * @param data */ void addSendChan(Chan chan, Object data) { mChan.add(chan); mSendData.add(data); } /** * register receive channel one by one * @param chan */ void addReceiveChan(Chan chan) { mChan.add(chan); mSendData.add(sReceiveFlag); } /** * set send and receive channels * @param chan */ void setChanAndData(ArrayList<Chan> chan, ArrayList<Object> data) { if (chan.size() != data.size()) { throw new RuntimeException("size differ"); } mChan = chan; mSendData = data; } //一个select 能从某个channel A里取出东西 就要把这个select从其他channel的等待队列中移除 //为什么不用从channel A中移除select 因为已经移除了 void markReceiverUnblockedAndRemoveFromOtherChans(Chan chan, Object data) { //System.out.println("context: remove from all channels " + this + " target ch =" + chan); boolean found = false; int numChan = mChan.size(); for (int i = 0; i < numChan; i++) { Chan ch = mChan.get(i); if (ch == null) { continue; } //System.out.println(" ch=" + ch); if (ch == chan && mSendData.get(i) == sReceiveFlag && !found) { //System.out.println(" found"); mReceivedData = data; mUnblockedChanIndex = i; found = true; } else { //System.out.println(" differ. sSendData.get(i)=" + mSendData.get(i) + " sReceiveFlag=" + sReceiveFlag); if (mSendData.get(i) == sReceiveFlag) { ch.removeFromReceiverList(this); } else { ch.removeFromSenderList(this); } } } if (!found) { throw new RuntimeException("chan not found in context context=" + this + " chan=" + chan); } //这是把ThreadContext里放的channel移除掉 mChan.clear(); mSendData.clear(); } //这个方法和上面的方法作用类似 Object markSenderUnblockedAnsRemoveFromOtherChans(Chan chan) { boolean found = false; Object receivedData = null; int numChan = mChan.size(); for (int i = 0; i < numChan; i++) { Chan ch = mChan.get(i); if (Config.DEBUG_PRINT) { System.out.printf("markSenderUnblockedAnsRemoveFromOtherChans: ch=" + ch + " looking for=" + chan + "\n"); } if (ch == null) { continue; } if (ch == chan && mSendData.get(i) != sReceiveFlag && !found) { if (Config.DEBUG_PRINT) { System.out.printf(" found\n"); } mReceivedData = null; mUnblockedChanIndex = i; receivedData = mSendData.get(i); found = true; } else { if (Config.DEBUG_PRINT) { System.out.printf(" ignore\n"); } if (mSendData.get(i) == sReceiveFlag) { ch.removeFromReceiverList(this); } else { ch.removeFromSenderList(this); } } } if (!found) { if (Config.DEBUG_PRINT) { System.out.printf("try to find ch=" + chan + ", numChan=%d\n", numChan); for (int i = 0; i < numChan; i++) { Chan ch = mChan.get(i); if (ch != null && mSendData.get(i) == sReceiveFlag) { System.out.printf("ch(R)=" + ch + "\n"); } else if (ch != null && mSendData.get(i) != sReceiveFlag) { System.out.printf("ch(S)=" + ch + "\n"); } else { System.out.printf("ch(?)=" + ch + "\n"); } } System.out.printf("=================================\n"); System.out.flush(); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } throw new RuntimeException("chan not found in context context=" + this + " chan=" + chan); } mChan.clear(); mSendData.clear(); return receivedData; } /** * remove this context from waiting list of all channels. */ void removeFromAllChannel() { //System.out.println("context: remove from all channels " + this); int numChan = mChan.size(); for (int i = 0; i < numChan; i++) { Chan ch = mChan.get(i); if (ch == null) { continue; } if (mSendData.get(i) == sReceiveFlag) { ch.removeFromReceiverList(this); } else { ch.removeFromSenderList(this); } } } void clearChan() { //System.out.println("context: clear channels " + this); //for (Chan ch : mChan) { //System.out.println(" ch:" + ch); //} mUnblockedChanIndex = -1; mReceivedData = null; mChan.clear(); mSendData.clear(); } /** * for debug */ void ensureHasNoChan() { if (!Config.DEBUG_CHECK_STATE) { throw new RuntimeException("DEBUG_CHECK_STATE is false"); } if (mChan.size() > 0 || mSendData.size() > 0 || mUnblockedChanIndex != -1 || mReceivedData != null) { throw new RuntimeException("illegal state"); } } }
[ "ywcjxf1515@gmail.com" ]
ywcjxf1515@gmail.com
1b86062057f4474bb0b67827d36e182d5078fc7d
49fd920b67adbe41639ed028d014cf0ac50fe2d3
/branches/20200902/sskt/src/main/java/com/ry/sskt/mapper/SubjectMapper.java
4f8fe2125e0e8fd56126c85dee0cafc049fe95f8
[]
no_license
zhangjihai520/sskt
0c7b061eb140777bdc23aba52729797ab6fab67a
e104bb88ee894b74378f94371f5a903c2d3cb91c
refs/heads/master
2023-03-06T00:53:04.523901
2021-02-18T08:56:15
2021-02-18T08:56:15
339,985,213
0
0
null
null
null
null
UTF-8
Java
false
false
23,020
java
package com.ry.sskt.mapper; import com.ry.sskt.model.common.constant.SubjectGenreEnum; import com.ry.sskt.model.common.constant.SubjectStatusFlagEnum; import com.ry.sskt.model.common.entity.Course; import com.ry.sskt.model.common.entity.CourseType; import com.ry.sskt.model.common.entity.Grade; import com.ry.sskt.model.student.entity.view.*; import com.ry.sskt.model.subject.entity.Subject; import com.ry.sskt.model.subject.entity.view.SubjectListByFilterView; import org.apache.ibatis.annotations.*; import org.apache.ibatis.mapping.StatementType; import org.apache.ibatis.type.JdbcType; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; import java.util.List; import java.util.Map; /** * <p> * 课程表 Mapper 接口 * </p> * * @author xrq * @since 2020-04-20 */ public interface SubjectMapper { /// <summary> /// 新增或者更新一条Subject表数据 /// </summary> /// <param name="dataModel">实体类</param> /// <returns>新增或更新后的主键Id</returns> @Select({ "call VideoClassMain_SP_Subject_Save_V2(", "#{model.subjectId,mode=IN,jdbcType=INTEGER},", "#{model.subjectName,mode=IN,jdbcType=VARCHAR},", "#{model.registBeginTime,mode=IN,jdbcType=DATE},", "#{model.registEndTime,mode=IN,jdbcType=DATE},", "#{model.beginTime,mode=IN,jdbcType=DATE},", "#{model.endTime,mode=IN,jdbcType=DATE},", "#{model.gradeId,mode=IN,jdbcType=INTEGER},", "#{model.courseId,mode=IN,jdbcType=INTEGER},", "#{model.teacherId,mode=IN,jdbcType=INTEGER},", "#{model.imagePath,mode=IN,jdbcType=VARCHAR},", "#{model.comment,mode=IN,jdbcType=VARCHAR},", "#{model.statusFlag,mode=IN,jdbcType=INTEGER},", "#{model.subjectTypeId,mode=IN,jdbcType=INTEGER},", "#{model.videoRoom,mode=IN,jdbcType=VARCHAR},", "#{model.classStateId,mode=IN,jdbcType=INTEGER},", "#{model.filePath,mode=IN,jdbcType=VARCHAR},", "#{model.pptFilePath,mode=IN,jdbcType=VARCHAR},", "#{model.subjectGenreId,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) int save(@Param("model") Subject model); /// <summary> /// 根据主键获取一条Subject表数据 /// </summary> /// <param name="subjectId">课程id</param> /// <returns>查询到的表实体对象</returns> @Select("Call VideoClassMain_SP_Subject_ReadByKey(#{subjectId})") @Options(statementType = StatementType.CALLABLE) Subject getByKey(@Param("subjectId") int subjectId); /// <summary> /// 根据老师ID获取对应课程 /// </summary> /// <param name="teacherId"></param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetListByTeacherId(#{teacherId},#{isOnline})") @Options(statementType = StatementType.CALLABLE) List<Subject> getListByTeacherId(@Param("teacherId") int teacherId, @Param("isOnline") int isOnline); /** * 根据筛选条件获取课程列表 * * @return */ @Select({ "call VideoClassMain_SP_Subject_GetListByFilterV3(", "#{map.teacherId,mode=IN,jdbcType=INTEGER},", "#{map.key,mode=IN,jdbcType=VARCHAR},", "#{map.courseId,mode=IN,jdbcType=INTEGER},", "#{map.gradeId,mode=IN,jdbcType=INTEGER},", "#{map.maxTimeField,mode=IN,jdbcType=VARCHAR},", "#{map.minTimeField,mode=IN,jdbcType=VARCHAR},", "#{map.beginTime,mode=IN,jdbcType=VARCHAR},", "#{map.endTime,mode=IN,jdbcType=VARCHAR},", "#{map.beginTimeMax,mode=IN,jdbcType=VARCHAR},", "#{map.beginTimeMin,mode=IN,jdbcType=VARCHAR},", "#{map.status,mode=IN,jdbcType=INTEGER},", "#{map.classState,mode=IN,jdbcType=INTEGER},", "#{map.pageSkip,mode=IN,jdbcType=INTEGER},", "#{map.pageSize,mode=IN,jdbcType=INTEGER},", "#{map.isOnline,mode=IN,jdbcType=INTEGER},", "#{map.subjectGenreId,mode=IN,jdbcType=INTEGER},", "#{map.OrderByField,mode=IN,jdbcType=VARCHAR},", "#{map.totalCount,mode=OUT,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<SubjectListByFilterView> GetListByFilter(@Param("map") Map map); /// <summary> /// 修改指定课程的状态 /// </summary> /// <param name="subjectId"></param> /// <param name="status"></param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_UpdateStatusFlag(#{subjectId},#{status})") @Options(statementType = StatementType.CALLABLE) void updateStatusFlag(@Param("subjectId") int subjectId, @Param("status") int status);//int /// <summary> /// H5获取时间段内的学生开课情况 /// </summary> /// <param name="beginMonth"></param> /// <param name="endMonth"></param> /// <param name="beginDay"></param> /// <param name="endDay"></param> /// <param name="teacherId"></param> /// <param name="studentId"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_GetListH5(", "#{beginMonth,mode=IN,jdbcType=DATE},", "#{endMonth,mode=IN,jdbcType=DATE},", "#{beginDay,mode=IN,jdbcType=DATE},", "#{endDay,mode=IN,jdbcType=DATE},", "#{teacherId,mode=IN,jdbcType=INTEGER},", "#{studentId,mode=IN,jdbcType=INTEGER},", "#{isOnline,mode=IN,jdbcType=INTEGER},", "#{subjectGenreEnumCode,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<GetUserSubjectListH5View> GetUserSubjectListH5(@Param("beginMonth") LocalDate beginMonth, @Param("endMonth") LocalDate endMonth, @Param("beginDay") LocalDate beginDay, @Param("endDay") LocalDate endDay, @Param("teacherId") int teacherId, @Param("studentId") int studentId, @Param("isOnline") int isOnline, @Param("subjectGenreEnumCode") int subjectGenreEnumCode); /// <summary> /// 获取学生课程H5信息,包含作业信息 /// </summary> /// <param name="studentId">学生ID</param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetListByStudentH5(#{studentId},#{isOnline})") @Options(statementType = StatementType.CALLABLE) List<GetStudentSubjectListH5View> GetStudentSubjectListH5(@Param("studentId") int studentId, @Param("isOnline") int isOnline); /// <summary> /// 获取课程的评价数 /// </summary> /// <param name="subjectIds">课程ID列表</param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetPraise(#{subjectIds})") @Options(statementType = StatementType.CALLABLE) List<GetPraiseView> GetPraise(@Param("subjectIds") String subjectIds); /// <summary> /// 获取课程上课人数 /// </summary> /// <param name="subjectIds">课程ID列表</param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetClassAttendance(#{subjectIds})") @Options(statementType = StatementType.CALLABLE) List<GetClassAttendanceView> GetClassAttendance(@Param("subjectIds") String subjectIds); /// <summary> /// 搜索学生报名的课程,根据课程名称或主讲老师 /// </summary> /// <param name="key">搜索Key</param> /// <param name="studentId">学生ID</param> /// <param name="minBeginTime">最小开始时间</param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_SearchStudentSubject(", "#{key,mode=IN,jdbcType=VARCHAR},", "#{studentId,mode=IN,jdbcType=INTEGER},", "#{minBeginTime,mode=IN,jdbcType=DATE},", "#{isOnline,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<SearchStudentSubjectView> SearchStudentSubject(@Param("key") String key, @Param("studentId") int studentId, @Param("minBeginTime") LocalDateTime minBeginTime, @Param("isOnline") int isOnline); /// <summary> /// 根据老师ID和时间获取对应课程 /// </summary> /// <param name="teacherId"></param> /// <param name="helperTeacherId"></param> /// <param name="beginTime"></param> /// <param name="endDateTime"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_GetTeacherSubjectByDate(", "#{teacherId,mode=IN,jdbcType=INTEGER},", "#{helperTeacherId,mode=IN,jdbcType=INTEGER},", "#{endTime,mode=IN,jdbcType=DATE},", "#{beginTime,mode=IN,jdbcType=DATE},", "#{isOnline,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<Subject> GetTeacherSubjectByDate(@Param("teacherId") int teacherId, @Param("helperTeacherId") int helperTeacherId, @Param("beginTime") LocalDate beginTime, @Param("endTime") LocalDate endTime, @Param("isOnline") int isOnline); /// <summary> /// 获取学校/年级人数占比 /// </summary> /// <param name="teacherId"></param> /// <param name="dataType"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_GetSchoolStudentCount(", "#{teacherId,mode=IN,jdbcType=INTEGER},", "#{isOnline,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<SchoolStudentCountView> GetSchoolStudentCountView(@Param("teacherId") int teacherId, @Param("isOnline") int isOnline); /// <summary> /// 获取学校/年级人数占比 /// </summary> /// <param name="teacherId"></param> /// <param name="dataType"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_GetGradeStudentCount(", "#{teacherId,mode=IN,jdbcType=INTEGER},", "#{isOnline,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<SchoolStudentCountView> GetGradeStudentCountView(@Param("teacherId") int teacherId, @Param("isOnline") int isOnline); /// <summary> /// 根据课程ID集合获取课程列表 /// </summary> /// <param name="subjectIds">课程ID列表</param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetListBySubjectIds(#{subjectIds})") @Options(statementType = StatementType.CALLABLE) List<ExportSubjectListView> GetSubjectListBySubjectIds(@Param("subjectIds") String subjectIds); /// <summary> /// 获取课程热门数据 /// </summary> /// <param name="teacherId"></param> /// <param name="pageSize"></param> /// <param name="pageSkip"></param> /// <param name="count">总数</param> /// <returns></returns> ///int teacherId, int pageSize, int pageSkip, ref int count, int isOnline @Select({ "call VideoClassMain_SP_Subject_GetHotSubject(", "#{map.teacherId,mode=IN,jdbcType=INTEGER},", "#{map.pageSkip,mode=IN,jdbcType=INTEGER},", "#{map.pageSize,mode=IN,jdbcType=INTEGER},", "#{map.isOnline,mode=IN,jdbcType=INTEGER},", "#{map.totalCount,mode=OUT,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<HotDataView> GetHotSubjectList(@Param("map") Map map); /// <summary> /// 获取热门课程总数 /// </summary> /// <param name="teacherId"></param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetHotSubjectTotal(#{teacherId},#{isOnline})") @Options(statementType = StatementType.CALLABLE) HotDataTotalView GetHotSubjectTotal(@Param("teacherId") int teacherId, @Param("isOnline") int isOnline); /// <summary> /// 获取教师热门数据 /// </summary> /// <param name="pageSize"></param> /// <param name="pageSkip"></param> /// <param name="count">总数</param> /// <returns></returns> ///int pageSize, int pageSkip, ref int count, int isOnline @Select({ "call VideoClassMain_SP_Subject_GetHotTeacher(", "#{map.pageSkip,mode=IN,jdbcType=INTEGER},", "#{map.pageSize,mode=IN,jdbcType=INTEGER},", "#{map.isOnline,mode=IN,jdbcType=INTEGER},", "#{map.totalCount,mode=OUT,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<HotDataView> GetHotTeacherList(@Param("map") Map map); /// <summary> /// 获取热门教师总数 /// </summary> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetHotTeacherTotal(#{isOnline})") @Options(statementType = StatementType.CALLABLE) HotDataTotalView GetHotTeacherTotal(@Param("isOnline") int isOnline); /// <summary> /// 获取学校热门数据 /// </summary> /// <param name="pageSize"></param> /// <param name="pageSkip"></param> /// <param name="count">总数</param> /// <returns></returns> ///int pageSize, int pageSkip, ref int count, int isOnline @Select({ "call VideoClassMain_SP_Subject_GetHotSchool(", "#{map.pageSkip,mode=IN,jdbcType=INTEGER},", "#{map.pageSize,mode=IN,jdbcType=INTEGER},", "#{map.isOnline,mode=IN,jdbcType=INTEGER},", "#{map.totalCount,mode=OUT,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<HotDataView> GetHotSchoolList(@Param("map") Map map); /// <summary> /// 获取热门学校总数 /// </summary> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_GetHotSchoolTotal(#{isOnline})") @Options(statementType = StatementType.CALLABLE) HotDataTotalView GetHotSchoolTotal(@Param("isOnline") int isOnline); /// <summary> /// 插入学生学习轨迹并更新课程状态 /// </summary> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_UpdateStateTask()") @Options(statementType = StatementType.CALLABLE) void UpdateSubjectStateTask(); /// <summary> /// 课堂报名 /// </summary> /// <param name="subjectId"></param> /// <param name="userId"></param> /// <param name="statusFlag"></param> /// <returns></returns> //TODO @Select("Call VideoClassMain_SP_Subject_RegistSubjectV2(#{subjectId},#{userId},#{maxRegisterNumber},#{statusFlag})") @Options(statementType = StatementType.CALLABLE) int studentRegistSubject(@Param("subjectId") int subjectId, @Param("userId") int userId, @Param("maxRegisterNumber") int maxRegisterNumber, @Param("statusFlag") int statusFlag); /// <summary> /// 课堂报名 /// </summary> /// <param name="subjectId"></param> /// <param name="userId"></param> /// <param name="statusFlag"></param> /// <returns></returns> //TODO @Select("Call VideoClassMain_SP_Subject_TeacherRegistSubject(#{subjectId},#{userId},#{statusFlag})") @Options(statementType = StatementType.CALLABLE) int teacherRegistSubject(@Param("subjectId") int subjectId, @Param("userId") int userId, @Param("statusFlag") int statusFlag); /// <summary> /// 获取学生课程列表 /// </summary> /// <param name="studentId"></param> /// <param name="courseId"></param> /// <param name="gradeId"></param> /// <param name="typeEnum"></param> /// <param name="isMySubject"></param> /// <param name="pageSize"></param> /// <param name="pageSkip"></param> /// <param name="count"></param> /// <param name="isOnline"></param> /// <param name="keyWord"></param> /// <param name="subjectGenreEnum"></param> /// <returns></returns> ///int studentId, int courseId, int gradeId, GetStudentSubjectListEnum typeEnum, bool isMySubject, int pageSize, int pageSkip, ref int count, int isOnline, string keyWord, SubjectGenreEnum subjectGenreEnum @Select({ "call VideoClassMain_SP_Subject_GetStudentListByFilter(", "#{map.studentId,mode=IN,jdbcType=INTEGER},", "#{map.courseId,mode=IN,jdbcType=INTEGER},", "#{map.gradeId,mode=IN,jdbcType=INTEGER},", "#{map.isEnd,mode=IN,jdbcType=INTEGER},", "#{map.isMine,mode=IN,jdbcType=INTEGER},", "#{map.pageSkip,mode=IN,jdbcType=INTEGER},", "#{map.pageSize,mode=IN,jdbcType=INTEGER},", "#{map.isOnline,mode=IN,jdbcType=INTEGER},", "#{map.subjectGenreId,mode=IN,jdbcType=INTEGER},", "#{map.keyWord,mode=IN,jdbcType=VARCHAR},", "#{map.totalCount,mode=OUT,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<GetStudentSubjectListView> GetStudentSubjectList(@Param("map") Map map); /// <summary> /// 根据老师ID获取课程总数及时间间隔内的课程数 /// </summary> /// <param name="teacherId"></param> /// <param name="maxDateTime"></param> /// <param name="minDateTime">一般为本周第一天</param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_GetTeacherSubjectCount(", "#{teacherId,mode=IN,jdbcType=INTEGER},", "#{maxDateTime,mode=IN,jdbcType=DATE},", "#{minDateTime,mode=IN,jdbcType=DATE},", "#{isOnline,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) GetTeacherSubjectCountView GetTeacherSubjectCount(@Param("teacherId") int teacherId, @Param("maxDateTime") LocalDateTime maxDateTime, @Param("minDateTime") LocalDateTime minDateTime, @Param("isOnline") int isOnline); /// <summary> /// 更新主线路视频地址 /// </summary> /// <param name="dataModel"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_UpdateFilePathV2(", "#{model.subjectId,mode=IN,jdbcType=INTEGER},", "#{model.filePath,mode=IN,jdbcType=DATE},", "#{model.realBeginTimeZone,mode=IN,jdbcType=INTEGER},", "#{model.classStateId,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) void UpdateFilePath(@Param("model") Subject model); /// <summary> /// 更新PPT线路视频地址 /// </summary> /// <param name="dataModel"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_UpdatePPTFilePathV2(", "#{model.subjectId,mode=IN,jdbcType=INTEGER},", "#{model.pptFilePath,mode=IN,jdbcType=DATE},", "#{model.realBeginTimeZone,mode=IN,jdbcType=INTEGER},", "#{model.classStateId,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) void UpdatePPTFilePath(@Param("model") Subject model); /// <summary> /// H5获取时间段内开课情况 /// </summary> /// <param name="beginMonth"></param> /// <param name="endMonth"></param> /// <param name="beginDay"></param> /// <param name="endDay"></param> /// <param name="isOnline"></param> /// <param name="userId"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_GetAllListH5(", "#{beginMonth,mode=IN,jdbcType=DATE},", "#{endMonth,mode=IN,jdbcType=DATE},", "#{beginDay,mode=IN,jdbcType=DATE},", "#{endDay,mode=IN,jdbcType=DATE},", "#{isOnline,mode=IN,jdbcType=INTEGER},", "#{userId,mode=IN,jdbcType=INTEGER},", "#{subjectGenreId,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<GetUserSubjectListH5View> GetALLSubjectListH5(@Param("beginMonth") LocalDate beginMonth, @Param("endMonth") LocalDate endMonth, @Param("beginDay") LocalDate beginDay, @Param("endDay") LocalDate endDay, @Param("isOnline") int isOnline, @Param("userId") int userId, @Param("subjectGenreId") int subjectGenreId); /// <summary> /// 搜索上架课程 /// </summary> /// <param name="beginTime"></param> /// <param name="key"></param> /// <param name="systemTypeId"></param> /// <param name="userId"></param> /// <returns></returns> @Select({ "call VideoClassMain_SP_Subject_Search(", "#{key,mode=IN,jdbcType=DATE},", "#{beginTime,mode=IN,jdbcType=DATE},", "#{isOnline,mode=IN,jdbcType=INTEGER},", "#{userId,mode=IN,jdbcType=INTEGER})" }) @Options(statementType = StatementType.CALLABLE) List<SearchSubjectView> SearchSubject(@Param("beginTime") LocalDateTime beginTime, @Param("key") String key, @Param("isOnline") int isOnline, @Param("userId") int userId); /// <summary> /// 课程手动下课 /// </summary> /// <param name="subjectIds"></param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_UpdateClassStatusBySubjectIds(#{subjectIds})") @Options(statementType = StatementType.CALLABLE) void CloseSubjects(@Param("subjectIds") String subjectIds); /// <summary> /// 课程自动下课 /// </summary> /// <param name="maxDateTime">最晚上课时间,将在此时间之前的上课中课程改为已下课</param> /// <returns></returns> @Select("Call VideoClassMain_SP_Subject_UpdateClassStatusAutomatic(#{maxDateTime})") @Options(statementType = StatementType.CALLABLE) void CloseSubjectsForAutomatic(@Param("maxDateTime") LocalDateTime maxDateTime); /// <summary> /// 课程自动上课 /// </summary> /// <param name="maxDateTime">最晚上课时间,将在此时间之前的上课中课程改为已下课</param> /// <returns></returns> @Update("update Subject set ClassStateID = #{classStateId} , PPTFilePath= #{pptFilePath}, RealBeginTimeZone = #{realBeginTimeZone}, BeginTime = now(), UpdateDateTime = now() where subjectId = #{subjectId}") void attendSubject(@Param("subjectId") int subjectId, @Param("pptFilePath") String pptFilePath, @Param("realBeginTimeZone") long realBeginTimeZone, @Param("classStateId") int classStateId); /// <summary> /// 课程自动下课 /// </summary> /// <param name="maxDateTime">最晚上课时间,将在此时间之前的上课中课程改为已下课</param> /// <returns></returns> @Update("update Subject set ClassStateID = #{classStateId} , PPTFilePath = #{pptFilePath}, EndTime = now(), UpdateDateTime = now() where subjectId = #{subjectId}") void closeSubject(@Param("subjectId") int subjectId, @Param("pptFilePath") String pptFilePath, @Param("classStateId") int classStateId); }
[ "www.920175308@qq.com" ]
www.920175308@qq.com
8b340a47d92059836d9de7bd09d9ff238e6caa62
28aa97f7ca0eb7c9d28e404be4724a47cd87d402
/Elastic Search/src/Main.java
dcc91f9faf2d5d59e6665742c1757f060e1408b8
[]
no_license
Iboatwright/RubeGoldbergAWSMachine
70ed75aa089c70bad2aa99143c2390fa075c7437
dc3fa159ad0095b7069ca5b87a7a28a4891d10dd
refs/heads/master
2020-03-10T02:19:16.354090
2018-04-27T03:46:15
2018-04-27T03:46:15
129,133,750
0
0
null
null
null
null
UTF-8
Java
false
false
817
java
import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) { File search = new File("SourceBucket/test.java"); Scanner scan = null; try { scan = new Scanner(search); } catch (FileNotFoundException e) { e.printStackTrace(); } String out = ""; while (scan.hasNext()) { out += scan.nextLine(); out += "\n"; } out = out.replaceAll("package", "// package "); try { FileWriter newFile = new FileWriter("DestBucket/test.java"); newFile.write(out); newFile.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } scan.close(); } }
[ "noreply@github.com" ]
noreply@github.com
b3c4dd6787e2841f8bf07b7b07310ce57bb24e62
a9717fc777628e1cc1d847c23f5408679abfdf5a
/src/sicca-ejb/ejbModule/enums/UnidadPlazo.java
2c2d5d742a6e51d2869ee4b33af1cdbf1545c4c6
[]
no_license
marcosd94/trabajo
da678b69dca30d31a0c167ee76194ea1f7fb62f0
00a7b110b4f5f70df7fb83af967d9dcc0e488053
refs/heads/master
2021-01-19T02:40:58.253026
2016-07-20T18:15:44
2016-07-20T18:15:44
63,803,756
0
0
null
null
null
null
UTF-8
Java
false
false
1,148
java
package enums; public enum UnidadPlazo { NINGUNO(null, "Seleccionar...", null), DIA(1, "DIA", "D"), SEMANA(2, "SEMANA", "S"), MES(3, "MES", "M"); private Integer id; private String descripcion; private String valor; private UnidadPlazo(Integer id, String descripcion, String valor) { this.id = id; this.descripcion = descripcion; this.valor = valor; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getValor() { return valor; } public void setValor(String valor) { this.valor = valor; } public static UnidadPlazo getById(String id) { for (UnidadPlazo o : UnidadPlazo.values()) { if (id.equals("" + o.getId())) { return o; } } return null; } public static UnidadPlazo getPorValor(String valor) { for (UnidadPlazo o : UnidadPlazo.values()) { if (valor.equals("" + o.getValor())) { return o; } } return null; } }
[ "mrcperalta.mp@gmail.com" ]
mrcperalta.mp@gmail.com
f7af5ce7b9d1e7ae597f9c63ced1d50e45b5b58b
0ce4c8f3f5af2b579ef5276ce6aef5e5781e334f
/oop2/src/SimpleRps5/SimpleRPSController.java
77ee9972b87e24eaaebca5fbf318bf66473d363b
[]
no_license
mihwa/oop2
445f53406f805be9e9ee44957062c3f31f026ebe
cc2c6b7f6cefc25427379129368e4212b1e79d45
refs/heads/master
2021-01-20T18:28:22.578357
2016-06-28T07:53:05
2016-06-28T07:53:05
61,358,000
0
0
null
null
null
null
UTF-8
Java
false
false
141
java
package SimpleRps5; import javax.swing.JOptionPane; public class SimpleRPSController { public static void main(String[] args) { } }
[ "hb2019@hb2019-PC" ]
hb2019@hb2019-PC
e1ecf89b8306c6ebe4c8d010fbe2e2d6015dadc2
d6cfc76aebc983b75ad85c20a082229da574c181
/XiongMaoPinDao/app/src/main/java/lzm/jiyun/com/xiongmaopindao/net/NetContract.java
47dbdd6e093d818dfcf030c1f257032f5960418d
[]
no_license
lzm9960/XiongMaoPinDao
63d665b06eda17d9caa1265a013254e4bb8051b4
132d65e928a813178f0f747ec001b2bf2d5e4c6c
refs/heads/master
2021-05-06T02:58:15.602745
2017-12-27T02:36:33
2017-12-27T02:36:33
114,706,120
0
0
null
null
null
null
UTF-8
Java
false
false
663
java
package lzm.jiyun.com.xiongmaopindao.net; import android.support.v4.app.Fragment; import java.util.ArrayList; import lzm.jiyun.com.xiongmaopindao.base.BaseModel; import lzm.jiyun.com.xiongmaopindao.base.BasePresenter; import lzm.jiyun.com.xiongmaopindao.base.BaseView; /** * Created by lenovo on 2017/12/18. */ public interface NetContract { interface View extends BaseView { void view_Method(ArrayList<Fragment> fragments); } interface Model extends BaseModel { void model_Method(NetMp mp); } abstract static class Presenter extends BasePresenter<Model, View> { public abstract void presenter_Method(); } }
[ "2548868040@.com" ]
2548868040@.com
6ca41da7761462856f4f95080deeda34603ac1ca
bcb572b4c10f2df7510c8e341fde861022655f72
/src/main/java/learn/lang/TestAnon2.java
d4bbe9a9cd9174cd8ed0c871bd6d3cc240fd54a5
[]
no_license
kerghan-the-terrible/javasetest
42dc74648a38b6e106618497cdbcb891d9380965
83d013d7ea426d25a8e433db274cfbcff5ce6081
refs/heads/master
2022-09-15T10:12:45.010994
2019-11-07T18:26:34
2019-11-07T18:26:34
201,994,226
0
0
null
2022-02-16T01:02:14
2019-08-12T19:18:18
Java
UTF-8
Java
false
false
197
java
package learn.lang; public class TestAnon2 implements TestAnon { int i; public TestAnon2(int i) { this.i = i; } @Override public int a() { return i; } }
[ "DASmirnov@luxoft.com" ]
DASmirnov@luxoft.com
e23b674ffc717b221aafcfa1053ad1abb7f09d1f
a787fe5dcea17302e3407129bb59d08326051949
/src/main/java/com/gitters/domain/processors/Processor.java
5fb7a60fedbf895d110945d0cd7fc514e4b47a27
[]
no_license
GittersTeam/BankStatementAnalyzer
ba9f119ce00f06037fa584c195caa0293a34715c
01c2a23f2c01a1b178e3830acb6041082bbaa626
refs/heads/main
2023-05-02T20:02:02.457560
2021-05-16T12:25:49
2021-05-16T12:25:49
350,103,811
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package com.gitters.domain.processors; import com.gitters.domain.bankStatements.BankStatement; public interface Processor { public Object process(BankStatement statement); }
[ "ramiz_rizqallah@hotmail.com" ]
ramiz_rizqallah@hotmail.com
22ae2ba9f53816ac819f0ed7a16f2f9c1d28d395
541c1312fbcb0c74b6dc5a860331a10a9d063d6f
/Lab 3 - Pictures and Maps/Source/MarkYourPicture/app/src/test/java/com/weatherapp/mnpw3d/markyourpicture/ExampleUnitTest.java
9161fbbf9625d33101ef8bf361ed326ee5f4223a
[]
no_license
marmikpatel2621/ASE-Lab-Assignment
81593a9ee57cd8d9b5acf3f83671c53cf18d6df3
d6ba794433f131ccec48016dd8ca4c2aa4c2f6a0
refs/heads/master
2021-01-15T15:39:11.768505
2016-11-29T02:09:56
2016-11-29T02:09:56
51,508,906
0
1
null
null
null
null
UTF-8
Java
false
false
330
java
package com.weatherapp.mnpw3d.markyourpicture; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "marmikpatel262@gmail.com" ]
marmikpatel262@gmail.com
8006eadf97236a7f48ca68fdf34644b3b4d0f85a
fb59181e3ce82fb7ac22c4cce292e2f02e601690
/src/test/resources/assignment_testcases/a2/Je_2_Locals_Overlapping_InsideNewBlock.java
eb51beda7880b29b2da2fafc3c4c4f0b11a35896
[ "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
jrbeverly/jcompiler
c9ea6f3f56961d9a25d1a759fc4ad7548b2a235b
0ed0b813fd2f3452d9c5ecb284295f250bdfba20
refs/heads/main
2021-12-03T21:10:08.654297
2021-10-04T23:40:33
2021-10-04T23:40:33
155,794,215
4
0
MIT
2021-09-18T01:02:59
2018-11-02T00:52:14
Java
UTF-8
Java
false
false
411
java
// JOOS1:ENVIRONMENTS,DUPLICATE_VARIABLE // JOOS2:ENVIRONMENTS,DUPLICATE_VARIABLE // JAVAC:UNKNOWN // /** * Environments: * - Check that no two local variables with overlapping scope have the * same name. */ public class Je_2_Locals_Overlapping_InsideNewBlock { public Je_2_Locals_Overlapping_InsideNewBlock() {} public static int test() { int r = 0; { int r = 1; } return 123; } }
[ "jonathan@jrbeverly.me" ]
jonathan@jrbeverly.me
7851ac85fc6ba01c976517e6f3fe0f4fe7becc81
b4d942cdafdd1aaf7873664d336175ee360b9871
/src/Utils/ExceptionHandler.java
3e648e4bc226e351fee9edca09c986677e0df529
[ "MIT" ]
permissive
michalexvr/ModbusTCPTool
00f6e356b5e27c8e66dfd5a78bf5f71a1bbde742
bc5a7206f0dc17139ebe15aca18faf642d79a769
refs/heads/master
2020-06-06T05:44:13.849927
2019-09-27T01:16:40
2019-09-27T01:16:40
192,652,871
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Utils; /** * * @author michael */ public class ExceptionHandler { public static void handleException(Exception e){ String traza = ""; int errno = 0; String error = e.toString(); int indiceTraza = error.indexOf(":"); if(indiceTraza > 0) error = error.substring(0,indiceTraza).replace(".", " "); String resumen = e.getLocalizedMessage(); StackTraceElement el[] = e.getStackTrace(); for(int i=0; i<el.length; i++){ traza += el[i].getFileName()+"\n "+el[i].getLineNumber()+"\n\n"; } logDB.addRegError(errno, error, resumen, traza, 0, "Runtime"); } }
[ "michael@localhost.localdomain" ]
michael@localhost.localdomain
159804aea56cb6bcd2ee93c0c4290a3dcad3caa0
51292fd51d3312193f6b089750eff6396262e5b5
/androidlibrary/src/main/java/com/ruiyun/comm/library/widget/picker/task/SmoothScrollTimerTask.java
48f18d71251a0a6a2814df22ad94dee1fab48961
[]
no_license
2016lc/applibrary
5c0ab5e73b9254013bb972b06227c3880adbf0f0
170d7affa59ccb45e7b3b1f362cac04e10ed2f8c
refs/heads/master
2020-05-14T16:30:39.017136
2019-04-16T06:59:21
2019-04-16T06:59:21
181,873,499
1
0
null
2019-04-17T11:00:48
2019-04-17T11:00:47
null
UTF-8
Java
false
false
2,212
java
package com.ruiyun.comm.library.widget.picker.task; import com.ruiyun.comm.library.widget.picker.MessageHandler; import com.ruiyun.comm.library.widget.picker.view.WheelView; import java.util.TimerTask; public class SmoothScrollTimerTask extends TimerTask { int realTotalOffset; int realOffset; int offset; final WheelView loopView; public SmoothScrollTimerTask(WheelView loopview, int offset) { this.loopView = loopview; this.offset = offset; realTotalOffset = Integer.MAX_VALUE; realOffset = 0; } @Override public final void run() { if (realTotalOffset == Integer.MAX_VALUE) { realTotalOffset = offset; } //把要滚动的范围细分成十小份,按是小份单位来重绘 realOffset = (int) ((float) realTotalOffset * 0.1F); if (realOffset == 0) { if (realTotalOffset < 0) { realOffset = -1; } else { realOffset = 1; } } if (Math.abs(realTotalOffset) <= 1) { loopView.cancelFuture(); loopView.handler.sendEmptyMessage(MessageHandler.WHAT_ITEM_SELECTED); } else { loopView.totalScrollY = loopView.totalScrollY + realOffset; //这里如果不是循环模式,则点击空白位置需要回滚,不然就会出现选到-1 item的 情况 if (!loopView.isLoop) { float itemHeight = loopView.itemHeight; float top = (float) (-loopView.initPosition) * itemHeight; float bottom = (float) (loopView.getItemsCount() - 1 - loopView.initPosition) * itemHeight; if (loopView.totalScrollY <= top||loopView.totalScrollY >= bottom) { loopView.totalScrollY = loopView.totalScrollY - realOffset; loopView.cancelFuture(); loopView.handler.sendEmptyMessage(MessageHandler.WHAT_ITEM_SELECTED); return; } } loopView.handler.sendEmptyMessage(MessageHandler.WHAT_INVALIDATE_LOOP_VIEW); realTotalOffset = realTotalOffset - realOffset; } } }
[ "905196664@qq.com" ]
905196664@qq.com
e8c0d9ed05f40e8e3c2e2a3db55e7347b8b1202d
fe1b82b3d058231d94ea751ead87603e9e1e7723
/elancer/src/main/java/com/axboot/elancer/domain/program/menu/MenuRepository.java
071fc1939f409de9e629bb1e56223dac7e8f1df3
[]
no_license
designreuse/projects
c5bf6ede5afd08be6804270ac24eaf07dcfd7fef
d4149db321840371d82a61adf927f68f8ac107cb
refs/heads/master
2020-08-12T07:13:36.738560
2019-04-10T07:07:42
2019-04-10T07:07:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package com.axboot.elancer.domain.program.menu; import com.chequer.axboot.core.domain.base.AXBootJPAQueryDSLRepository; import org.springframework.stereotype.Repository; @Repository public interface MenuRepository extends AXBootJPAQueryDSLRepository<Menu, Long> { }
[ "kwpark@localhost" ]
kwpark@localhost
9a6b59430587656e30147ebe36bebe6c73f176e8
85f897cd093218ca78c1ee318596576f452011c4
/src/main/java/tokenbooking/config/JwtConfiguration.java
4c755fe8e6116d288719537dd229ac55f8ff5c0c
[]
no_license
kjethwa/restfulwebservices
d937f131e651b2b90ebf904b02fcec81fd047f94
7ed10742431204f386c25c55ead670286d1561f9
refs/heads/master
2022-07-23T07:04:23.857444
2022-07-19T06:37:04
2022-07-19T06:37:04
153,995,241
1
0
null
2020-10-13T10:31:03
2018-10-21T10:13:27
Java
UTF-8
Java
false
false
2,474
java
package tokenbooking.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component @ConfigurationProperties( prefix = "aws.cognito" ) public class JwtConfiguration { private String userPoolId; private String identityPoolId; private String jwkUrl; private String groups= "cognito:groups"; private String region = "us-east-1"; private String userNameField = "username"; private int connectionTimeout = 2000; private int readTimeout = 2000; private String httpHeader = "Authorization"; public JwtConfiguration() { } public String getJwkUrl() { return this.jwkUrl != null && !this.jwkUrl.isEmpty() ? this.jwkUrl : String.format("https://cognito-idp.%s.amazonaws.com/%s/.well-known/jwks.json", this.region, this.userPoolId); } public String getCognitoIdentityPoolUrl() { return String.format("https://cognito-idp.%s.amazonaws.com/%s", this.region, this.userPoolId); } public String getUserPoolId() { return userPoolId; } public void setUserPoolId(String userPoolId) { this.userPoolId = userPoolId; } public String getIdentityPoolId() { return identityPoolId; } public void setIdentityPoolId(String identityPoolId) { this.identityPoolId = identityPoolId; } public void setJwkUrl(String jwkUrl) { this.jwkUrl = jwkUrl; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region; } public String getUserNameField() { return userNameField; } public void setUserNameField(String userNameField) { this.userNameField = userNameField; } public int getConnectionTimeout() { return connectionTimeout; } public void setConnectionTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; } public int getReadTimeout() { return readTimeout; } public void setReadTimeout(int readTimeout) { this.readTimeout = readTimeout; } public String getHttpHeader() { return httpHeader; } public void setHttpHeader(String httpHeader) { this.httpHeader = httpHeader; } public String getGroups() { return groups; } public void setGroups(String groups) { this.groups = groups; } }
[ "kalpeshjethwa92@gmail.com" ]
kalpeshjethwa92@gmail.com
f0abf2c6ebd138dca641dcb4b2f3fb9bff9a8690
9d8f345fe2b3b5df745947a20fbd803722c02fb3
/src/fgbml/mofgbml/MOP1.java
b08044c9619d559cdfdec83df1456e815d0ae35e
[]
no_license
CI-labo-OPU/MoFGBML_classic
5a3a40c33aa691bb9d6392d929187701610e8a57
da613b627a3a19b62b1da6c0f5ba3f8ca4706ddd
refs/heads/master
2023-08-24T09:03:53.687485
2021-10-21T04:20:10
2021-10-21T04:20:10
419,576,290
0
1
null
null
null
null
UTF-8
Java
false
false
1,086
java
package fgbml.mofgbml; import data.SingleDataSetInfo; import fgbml.SinglePittsburgh; public class MOP1 extends Problem_MoFGBML { // ************************************************************ // ************************************************************ public MOP1(SingleDataSetInfo Dtra, SingleDataSetInfo Dtst) { super(Dtra, Dtst); this.objectiveNum = 2; this.optimizer = new int[] {MIN, MIN}; doMemorizeMissPatterns = new boolean[] {true, false}; setTrain(Dtra); setTest(Dtst); } // ************************************************************ @Override public void evaluate(SinglePittsburgh individual) { double f1 = getMissRate(traID, individual); double f2 = individual.getRuleSet().getRuleNum(); double[] fitness = new double[] {f1, f2}; individual.setFitness(fitness); } @Override public void evaluateParallel(SinglePittsburgh individual) { double f1 = getMissRateParallel(traID, individual); double f2 = individual.getRuleSet().getRuleNum(); double[] fitness = new double[] {f1, f2}; individual.setFitness(fitness); } }
[ "yuichi.omozaki@ci.cs.osakafu-u.ac.jp" ]
yuichi.omozaki@ci.cs.osakafu-u.ac.jp
bcedfaa6c054b5b49551937d3b33bb9ddd479552
88619ca1d6e1571b8e4d40ef7ac672bed901a55a
/강의/16년 1학기/Java 프로그래밍/과제/연습문제 정답/연습문제 실습 홀수 정답/11-1/src/CheckBoxPracticeFrame.java
85d8789e4aa15d00cbd50b49f4e43ffeba88736a
[]
no_license
dongb94/University-classes
3cad94ddf668fbf56e05f586ad6b346359b6f67e
87caaa8d022530c73a6d9d6c8a3ffd133e94d54f
refs/heads/master
2020-03-28T19:22:27.279418
2018-09-16T15:59:20
2018-09-16T15:59:20
148,969,161
0
0
null
null
null
null
UHC
Java
false
false
1,009
java
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class CheckBoxPracticeFrame extends JFrame { JButton btn = new JButton("test button"); public CheckBoxPracticeFrame() { super("CheckBox Practice Frame"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); JCheckBox a = new JCheckBox("버튼 비활성화"); JCheckBox b = new JCheckBox("버튼 감추기"); add(a); add(b); add(btn); a.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED) btn.setEnabled(false); else btn.setEnabled(true); } }); b.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED) btn.setVisible(false); else btn.setVisible(true); } }); setSize(250,150); setVisible(true); } public static void main(String[] args) { new CheckBoxPracticeFrame(); } }
[ "dongb94@gmail.com" ]
dongb94@gmail.com
fc1122cdf75f3a2e3441179b14f34cd5bebfab28
11b5aff64b2fd26c1c293565abff1e47475cfa5e
/autumn-modules/src/main/java/cn/org/autumn/modules/gen/service/GenMenu.java
36b1eb17a2fc853ed700a2313a7eec2a80ceadcf
[ "Apache-2.0" ]
permissive
henryxm/autumn
78464de595d021bf6116a862400e63200584f3bf
eca600a11610661f485731100f7bb2fcb8de12c6
refs/heads/master
2023-07-10T23:43:45.382097
2023-07-07T04:22:04
2023-07-07T04:22:04
152,073,937
37
20
Apache-2.0
2022-12-01T08:53:57
2018-10-08T12:12:12
JavaScript
UTF-8
Java
false
false
746
java
package cn.org.autumn.modules.gen.service; import cn.org.autumn.modules.gen.service.gen.GenMenuGen; import org.springframework.stereotype.Service; /** * 生成方案 * * @author Shaohua Xu * @email henryxm@163.com * @date 2021-01 */ @Service public class GenMenu extends GenMenuGen { @Override protected String order() { return super.order(); } @Override public String ico() { return super.ico(); } @Override public String getMenu() { return super.getMenu(); } @Override public String getParentMenu() { return super.getParentMenu(); } @Override public void init() { } public String[][] getLanguageItems() { return null; } }
[ "test" ]
test
187c4c3a063466aedb66480fd1d9f5960fe38229
86ab560dfead8ea43d89e085a045a8e6a93eeb1a
/src/main/model/DetailCardNum.java
e27ba4060055cf1a24571b9ba4a9865d737abc24
[]
no_license
fate-of-wind/HappyPrograming
02724401ef248aaee5b8c203677becaae065e4d8
fb127d15cf664f7500139e36bb9841caf2a89cd3
refs/heads/master
2023-04-09T00:59:11.321339
2021-04-04T18:30:49
2021-04-04T18:30:49
356,974,490
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package model; // detailed number of each kind of card a player's hand have public class DetailCardNum { private int cardNum; private Card card; //REQUIRES: number >= 0 //EFFECTS: build a compound about number of a kind of card //kind of card is set to kind, its number is set to number public DetailCardNum(Card kind, int number) { this.card = kind; this.cardNum = number; } public int getNumber() { return cardNum; } //MODIFIES:this //EFFECTS: remove one card of this kind, so number of this kind minus 1 public void removeOneCard() { this.cardNum--; } //MODIFIES:this //EFFECTS: add one card of this kind, so number of this kind plus 1 public void addOneCard() { this.cardNum++; } }
[ "yuhuan12@students.cs.ubc.ca" ]
yuhuan12@students.cs.ubc.ca
9eee9a69839cc22a7f4671dca2dd6196b9da4177
4d7cca335b778210219fc8639110113002ce5b39
/Exceptions/src/ru/ivmiit/MainCatchExceptions.java
5a4b7a3da22b2f5e0ab696990dc3636e85b6e34a
[]
no_license
MarselSidikov/09-622
bfd80a3a2f899f50679f01574f1c093c5aeca003
e948e7bf8cbeaf222d6fd922987797d7ba3f919e
refs/heads/master
2021-01-11T07:16:34.514399
2017-12-20T16:38:48
2017-12-20T16:38:48
72,521,724
0
0
null
null
null
null
UTF-8
Java
false
false
887
java
package ru.ivmiit; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Scanner; /** * 13.03.2017 * MainCatchExceptions * * @author Sidikov Marsel (First Software Engineering Platform) * @version v1.0 */ public class MainCatchExceptions { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); try { InputStream inputStream = new FileInputStream("hello.txt"); } catch (FileNotFoundException e) { System.out.println(e.getMessage()); } while(true) { int scannedNumber = scanner.nextInt(); try { System.out.println(10 / scannedNumber); } catch (ArithmeticException e) { System.out.println("Please, not null value enter"); } } } }
[ "admin" ]
admin
53730c2ef5d9fdabe8efd3f7ac7c7d5a1fc9349a
f6fb29debcadc2fa6cf58ffb2139629b63ba217b
/app/src/main/java/com/appinventor/ai_Robi_buet38/SMARTDRIVERBD/DriverDemand.java
e6dbe3f3f0df209eaa2a391b8be3ef1d9b7a178c
[]
no_license
Atikur-Rahman-Sabuj/SmartDriver
23da2c384bb5a637b599d1ef9c1c86e1d8b6a693
4a985fd7ca02fef1e35a8f5ac43830cac046355b
refs/heads/master
2023-03-28T01:45:47.325340
2021-03-26T18:39:47
2021-03-26T18:39:47
184,131,461
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package com.appinventor.ai_Robi_buet38.SMARTDRIVERBD; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class DriverDemand extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_driver_demand); } }
[ "sabuj.kucse@gmail.com" ]
sabuj.kucse@gmail.com
45a353a7724211f081c3c567292d799bad052fb3
78e19fa3988c14ea3d92916b50278a428bebe8c2
/Year 3/Mobile Applications Development/Semester 1/Lab3-UsingMQTT/MQTT Demo/src/subscriber/SubscribeCallback.java
caa1dd081499a4ddc580684cf36e8223723fa989
[]
no_license
PritamSangani/University-Degree-Work
83c38b5a7dbd911df079bb97507b9f8800143def
bc631a1923646be955a7cd04c1104e2d2c9a643c
refs/heads/master
2022-12-14T03:10:10.045698
2019-05-14T18:53:17
2019-05-14T18:53:17
181,069,917
2
0
null
2022-12-10T11:20:31
2019-04-12T19:17:00
Python
UTF-8
Java
false
false
772
java
package subscriber; import org.eclipse.paho.client.mqttv3.*; public class SubscribeCallback implements MqttCallback { public static final String userid = "16039231"; // change this to be your student-id @Override public void connectionLost(Throwable cause) { //This is called when the connection is lost. We could reconnect here. } @Override public void messageArrived(String topic, MqttMessage message) throws Exception { System.out.println("Message arrived. Topic: " + topic + " Message: " + message.toString()); if ((userid+"/LWT").equals(topic)) { System.err.println("Sensor gone!"); } } @Override public void deliveryComplete(IMqttDeliveryToken token) { //no-op } }
[ "pritam.sangani@gmail.com" ]
pritam.sangani@gmail.com
b6021cc0351a595b5f386bdf6d5a433123b2b225
9b78e05dd30f5f77b3e8e102aeba51342a763c1e
/app/src/main/java/com/micaiah/leaderboard/adapters/ViewPagerAdapter.java
9c25b5d0a954d224161a3d66d50449be51cd9bee
[]
no_license
mikewambua/leaderboard
bc914d376788ca14d4aa4876ece6ebc2520883db
e6d42974ef37d0aec345cfcced623f67a1d41af9
refs/heads/master
2022-12-15T00:44:59.348987
2020-09-11T18:59:05
2020-09-11T18:59:05
294,784,819
0
0
null
null
null
null
UTF-8
Java
false
false
1,070
java
package com.micaiah.leaderboard.adapters; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import java.util.ArrayList; import java.util.List; public class ViewPagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitle = new ArrayList<>(); public ViewPagerAdapter(@NonNull FragmentManager fm) { super(fm); } @NonNull @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentTitle.size(); } @Nullable @Override public CharSequence getPageTitle(int position) { return mFragmentTitle.get(position); } public void addFragment(Fragment fragment, String title){ mFragmentList.add(fragment); mFragmentTitle.add(title); } }
[ "mikewambua2@gmail.com" ]
mikewambua2@gmail.com
3c20d2c55eb2d45275079b49a3ea948f8d6ec945
5616d069c4603de2eebdc4af98a8218b8f62b543
/xiaobo/xiaobo-activity/src/main/java/org/xiaobo/activity/conf/SwaggerConfig.java
4581961a5b0215eafc2cb0671c89c5cf93112102
[]
no_license
xbobo/xiaobo-more-datasource
a8654b10dd4719f877b52c74a82864dfddab972b
8f7363b31ba4e8947fdbebae03f8e0f055ca82ad
refs/heads/master
2022-06-26T05:11:04.410403
2019-04-29T02:36:17
2019-04-29T02:36:17
183,986,483
0
0
null
2022-06-17T02:10:16
2019-04-29T02:30:40
Java
UTF-8
Java
false
false
2,988
java
package org.xiaobo.activity.conf; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiKey; import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.SecurityReference; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * 自动生成文档 * * @author chenjian@pxjy.com * @date 2019/1/10 15:52 */ @Configuration @EnableSwagger2 //@Profile({"dev","test"}) @ComponentScan(basePackages ={"org.xiaobo.activity.**.controller"}) public class SwaggerConfig { @Value("${swagger.enable}") private boolean enableSwagger; @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) // Flag to enable or disable possibly loaded using a property file .enable(enableSwagger) .select() .apis(RequestHandlerSelectors.basePackage("org.xiaobo.activity.controller")) .paths(PathSelectors.any()) .build() .securitySchemes(securitySchemes()) .securityContexts(securityContexts()); } private List<ApiKey> securitySchemes() { List<ApiKey> result = new ArrayList(); result.add(new ApiKey("authorization", "authorization", "header")); return result; } private List<SecurityContext> securityContexts() { List<SecurityContext> result = new ArrayList(); result.add(SecurityContext.builder() .securityReferences(defaultAuth()) .forPaths(PathSelectors.any()) .build()); return result; } List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; List<SecurityReference> result = new ArrayList(); result.add(new SecurityReference("authorization", authorizationScopes)); return result; } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("接口文档") .description("接口") .version("1.0") .build(); } }
[ "603786093@qq.com" ]
603786093@qq.com
c12a539c9351e990899fe38d8b13e9d0019404e2
005c0342efd9dd74a4e026e126243b500a4776e7
/app/src/test/java/com/cos/testinsta/ExampleUnitTest.java
78acb1ed32e339ef88ae4eeb88deecc2c8b00742
[]
no_license
sanghun1/android-test-UI
e9211e08809cc4e0dc63bdd2ba69d30ae598b201
0edadd8af82b0505e0fb6bc8566ebb38b85cf026
refs/heads/main
2023-03-09T10:04:12.771928
2021-02-26T02:09:49
2021-02-26T02:09:49
342,421,278
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.cos.testinsta; 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); } }
[ "pooij96@naver.com" ]
pooij96@naver.com
ca26af52d257d0e95ae09e0c90738bf585871344
0b3df1a454f617076f6a4cd055759c65216649bc
/TestApp/app/src/main/java/codes/nttuan/testapp/MainActivity.java
81c033a5e232db0a623e25b39f4fecdc22836821
[]
no_license
ngthotuan/Android-Basic-Project
f65704184e21151944d27d411313ed3ebed95bd2
624501addd94dd6667d5011ff17c5f4ae19d1d8c
refs/heads/master
2023-01-28T17:10:18.049041
2020-11-26T10:32:05
2020-11-26T10:32:05
284,652,020
0
0
null
null
null
null
UTF-8
Java
false
false
859
java
package codes.nttuan.testapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity { public static final String EXTRA_MESSAGE = "codes.nttuan.testapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void sendMessage(View view){ Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = findViewById(R.id.editTextTextPersonName); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } }
[ "ngthotuan@gmail.com" ]
ngthotuan@gmail.com
51fccd35c80405473c5158c1d0f7eba2f072c850
7ca2fe4d8355c804231d0dac23faf63b366bf4fe
/src/test/java/com/joy/kafka/simple/offsetviewer/old/ConsumerGroupHandler.java
1ae5db240b17893e2cbe1d86fbd7fa0bd6a68836
[ "Apache-2.0" ]
permissive
joyspapa/joy-kafka
77272b7c9240ce1630575e4ded16874236260056
d37cf7ffa2a19a784cad8ff38a1b60f098c45393
refs/heads/master
2021-07-11T06:20:17.533893
2020-08-19T07:05:09
2020-08-19T07:05:09
195,935,284
0
0
null
null
null
null
UTF-8
Java
false
false
8,253
java
package com.joy.kafka.simple.offsetviewer.old; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; import org.apache.kafka.clients.consumer.KafkaConsumer; import org.apache.kafka.clients.consumer.OffsetAndMetadata; import org.apache.kafka.common.Node; import org.apache.kafka.common.PartitionInfo; import org.apache.kafka.common.TopicPartition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.joy.kafka.simple.offsetviewer.old.vo.OffsetPerPartitonVO; import com.joy.kafka.simple.offsetviewer.old.vo.OffsetPerTopicVO; /** * Created by lixun on 2017/3/23. */ public class ConsumerGroupHandler { private static final Logger logger = LoggerFactory.getLogger(ConsumerGroupHandler.class); private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private List<PartitionInfo> pratitions; public static long getLogEndOffset(KafkaConsumer<String, String> consumer, String topic, int partition) { TopicPartition topicPartition = new TopicPartition(topic, partition); List<TopicPartition> partitions = new ArrayList<TopicPartition>(); partitions.add(topicPartition); consumer.assign(partitions); consumer.seekToEnd(partitions); long logEndOffset = consumer.position(topicPartition); return logEndOffset; } public List<OffsetPerTopicVO> describeGroupNew(String brokers, OffsetPerTopicVO offsetPerTopicVO) { List<OffsetPerTopicVO> offsetPerTopicResult = new ArrayList<OffsetPerTopicVO>(); try (KafkaConsumer<String, String> consumer = ConsumerFactory.getKafkaConsumer(brokers, offsetPerTopicVO.getGroupID()/*null*/)) { // if groupID is null, offset, lag is -1 //Map<String, List<PartitionInfo>> topics = consumer.listTopics(); //Map<String, OffsetPerTopicVO> topicPartitionMap = new HashMap<String, OffsetPerTopicVO>(); pratitions = consumer.listTopics().get(offsetPerTopicVO.getTopic()); logger.debug("pratitions 1 : " + pratitions); // 토픽이 없을 경우 생성을 시킨다. //List<PartitionInfo> pratitions = consumer.partitionsFor(offsetPerTopicVO.getTopic()); String createdDate = null; if (pratitions != null) { long logEndOffset = 0l; int partitionIdx = 0; if (pratitions.size() > 1) { sortAscendingPartitionNum(pratitions); } logger.debug("pratitions : " + pratitions); for (PartitionInfo partition : pratitions) { printPartitionInfo(consumer, partition); OffsetPerPartitonVO offsetPerPartitionVO = new OffsetPerPartitonVO(); offsetPerPartitionVO.setPartition(partition.partition()); String leader = (partition.leader() == null) ? "none" : (partition.leader().host().contains(".") ? partition.leader().host().split("\\.")[3] : partition.leader().host()); offsetPerPartitionVO.setLeader(leader); String replica = null; for (Node node : partition.replicas()) { replica = (node.host() == null) ? "none" : (node.host().contains(".") ? node.host().split("\\.")[3] : node.host()); offsetPerPartitionVO.addReplicas(replica); } //for (Node node : partition.inSyncReplicas()) { // logger.debug("inSyncReplicas : " + node.host()); //} logEndOffset = getLogEndOffset(consumer, offsetPerTopicVO.getTopic(), partition.partition()); offsetPerPartitionVO.setLogSize(logEndOffset); OffsetAndMetadata committed = consumer .committed(new TopicPartition(offsetPerTopicVO.getTopic(), partition.partition())); if (partitionIdx == 0) { createdDate = dateFormat.format(new Date(System.currentTimeMillis())); } if (committed != null) { offsetPerPartitionVO.setOffset(committed.offset()); offsetPerPartitionVO .setLag((committed.offset() == -1L) ? 0L : logEndOffset - committed.offset()); } else { //offsetPerPartitionVO.setOffset(-1); //offsetPerPartitionVO.setLag(-1); offsetPerPartitionVO.setOffset(0); offsetPerPartitionVO.setLag(0); } offsetPerTopicVO.addPartitions(offsetPerPartitionVO); partitionIdx++; } } else { offsetPerTopicVO.setOffsets(-1); offsetPerTopicVO.setLag(-1); logger.warn("[describeGroupNew] Topic is NOT Exist. Topic : " + offsetPerTopicVO.getTopic()); } offsetPerTopicVO.setCreated( (createdDate == null) ? dateFormat.format(new Date(System.currentTimeMillis())) : createdDate); offsetPerTopicResult.add(offsetPerTopicVO); } catch (Exception ex) { logger.warn("describeGroup error : ", ex); } return offsetPerTopicResult; } /* * https://stackoverflow.com/questions/50527319/kafka-consumer-list-api * public void getConsumerGroupList(String brokers) { String[] arg = new String[3]; arg[0] = "--bootstrap-server"; arg[1] = " localhost:9092"; arg[2] = "--list"; String[] resultArray = new String[3]; ConsumerGroupCommand.ConsumerGroupCommandOptions checkArgs = new ConsumerGroupCommand.ConsumerGroupCommandOptions( arg); checkArgs.checkArgs(); List<String> result = new ConsumerGroupCommand.KafkaConsumerGroupService(checkArgs).listGroups(); System.out.println(result); result.copyToArray(resultArray); java.util.List<String> names = java.util.Arrays.asList(resultArray); System.out.println("result" + names); } */ /* * https://github.com/rusonding/kafka-monitor/blob/master/common/src/main/java/com/kafka/monitor/common/ConsumerGroupCommand.java * public static List<String> getConsumers(String brokers) { List<String> list = new ArrayList<String>(); AdminClient adminClient = KafkaConsumerFactory.createAdminClient(brokers); scala.collection.immutable.Map<Node, scala.collection.immutable.List<GroupOverview>> nodeListMap = adminClient.listAllConsumerGroups(); Iterator<Tuple2<Node, scala.collection.immutable.List<GroupOverview>>> iterator = nodeListMap.iterator(); while (iterator.hasNext()) { Tuple2<Node, scala.collection.immutable.List<GroupOverview>> next = iterator.next(); scala.collection.immutable.List<GroupOverview> groupOverviewList = next._2(); List<Object> objects = JavaConversions.bufferAsJavaList(groupOverviewList.toBuffer()); for (Object obj : objects) { list.add(((GroupOverview) obj).groupId()); } } return list; } */ private static void printPartitionInfo(KafkaConsumer<String, String> consumer, PartitionInfo partitionInfo) { StringBuilder sb = new StringBuilder(); sb.append(partitionInfo.topic()).append("-").append(partitionInfo.partition()); sb.append(partitionInfo.topic()); logger.debug("========================================================"); logger.debug("topic : " + partitionInfo.topic()); logger.debug("partition : " + partitionInfo.partition()); logger.debug("leader : " + partitionInfo.leader().host()); logger.debug("replicas ["); for (Node node : partitionInfo.replicas()) { logger.debug(" " + node.host()); } logger.debug(" ]"); long logEndOffset = getLogEndOffset(consumer, partitionInfo.topic(), partitionInfo.partition()); logger.debug("logEndOffset : " + logEndOffset); OffsetAndMetadata committed = consumer .committed(new TopicPartition(partitionInfo.topic(), partitionInfo.partition())); logger.debug("처리건수 : " + committed.offset()); logger.debug("미처리건수 : " + (logEndOffset - committed.offset())); logger.debug(""); logger.debug(""); } private void sortAscendingPartitionNum(List<PartitionInfo> pratitionList) { pratitions = new ArrayList<PartitionInfo>(pratitionList); pratitions.sort(Comparator.comparing(PartitionInfo::partition)); } @Deprecated private void sortAscendingPartitionNum_old(List<PartitionInfo> pratitionList) { pratitions = new ArrayList<PartitionInfo>(pratitions); Collections.sort(pratitions, new Comparator<PartitionInfo>() { @Override public int compare(PartitionInfo before, PartitionInfo after) { // asc int r = ((Comparable<Integer>) before.partition()).compareTo(after.partition()); logger.debug("r : " + r); return r; } }); } }
[ "hanmin" ]
hanmin
ce2d8a0ea3200c4f7b8d1970e0d43cdc6d0413e3
0b1870db2bf4890de977e51c46798b66f54a6034
/src/main/java/com/ohorodnik/lab5db/model/Workers.java
4a6aaf5e515566bf1f129e67d3f75b43ab232757
[]
no_license
hunko1998/cursova
a1f686ccde6c83c8cbf3dedf8c50757e998c51de
7f5e4ae5d00969b8ec05cd863b98dba4eac2f4a2
refs/heads/master
2020-03-19T01:30:53.626888
2018-06-01T08:09:24
2018-06-01T08:09:24
135,551,118
0
0
null
null
null
null
UTF-8
Java
false
false
4,732
java
package com.ohorodnik.lab5db.model; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import javax.persistence.*; @Entity @Table(name = "workers") @EntityListeners(AuditingEntityListener.class) public class Workers { public Workers(String name, int year, String experience, String gender, int children, int salary, Professions professions, int profession_idProf, Roles roles, int role_idRole, Tourings tourings, int touring_idTouring, Ranks ranks, int rank_idRank) { this.name = name; this.year = year; this.experience = experience; this.gender = gender; this.children = children; this.salary = salary; this.professions = professions; this.profession_idProf = profession_idProf; this.roles = roles; this.role_idRole = role_idRole; this.tourings = tourings; this.touring_idTouring = touring_idTouring; this.ranks = ranks; this.rank_idRank = rank_idRank; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id_workers") private int idWorkers; @Column(name = "name") private String name; @Column(name = "year") private int year; @Column(name = "experience") private String experience; @Column(name = "gender") private String gender; @Column(name = "children") private int children; @Column(name = "salary") private int salary; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "profession_id_prof", insertable = false, updatable = false) private Professions professions; @Column(name = "profession_id_prof") private int profession_idProf; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "role_id_role", insertable = false, updatable = false) private Roles roles; @Column(name = "role_id_role") private int role_idRole; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "touring_id_touring", insertable = false, updatable = false) private Tourings tourings; @Column(name = "touring_id_touring") private int touring_idTouring; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "rank_id_rank", insertable = false, updatable = false) private Ranks ranks; @Column(name = "rank_id_rank") private int rank_idRank; public Workers() { } public int getIdWorkers() { return idWorkers; } public void setIdWorkers(int idWorkers) { this.idWorkers = idWorkers; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public String getExperience() { return experience; } public void setExperience(String experience) { this.experience = experience; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public int getChildren() { return children; } public void setChildren(int children) { this.children = children; } public int getSalary() { return salary; } public void setSalary(int salary) { this.salary = salary; } public Professions getProfessions() { return professions; } public void setProfessions(Professions professions) { this.professions = professions; } public int getProfession_idProf() { return profession_idProf; } public void setProfession_idProf(int profession_idProf) { this.profession_idProf = profession_idProf; } public Roles getRoles() { return roles; } public void setRoles(Roles roles) { this.roles = roles; } public int getRole_idRole() { return role_idRole; } public void setRole_idRole(int role_idRole) { this.role_idRole = role_idRole; } public Tourings getTourings() { return tourings; } public void setTourings(Tourings tourings) { this.tourings = tourings; } public int getTouring_idTouring() { return touring_idTouring; } public void setTouring_idTouring(int touring_idTouring) { this.touring_idTouring = touring_idTouring; } public Ranks getRanks() { return ranks; } public void setRanks(Ranks ranks) { this.ranks = ranks; } public int getRank_idRank() { return rank_idRank; } public void setRank_idRank(int rank_idRank) { this.rank_idRank = rank_idRank; } }
[ "vitalihunko251617@gmail.com" ]
vitalihunko251617@gmail.com
50602a3636c03aaefff3597324e45abefd2531df
c4b529b315ed71f351309e316c5c5fe12f3aba51
/app/src/main/java/com/example/harsh/computer_world/TwoFragment.java
065b2169805dbd7476abca27e2117f3c195644e7
[]
no_license
Techbro96/Comp-World
85f32ce7a8c74400649c7e8deb4cc934827a557c
55397c25a324daf333478d3404f801879a5d319e
refs/heads/master
2021-01-01T18:00:58.068027
2017-07-24T19:25:18
2017-07-24T19:25:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
828
java
package com.example.harsh.computer_world; import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * Created by Harsh on 24-07-2017. */ public class TwoFragment extends android.support.v4.app.Fragment { public TwoFragment() { //required public constructor } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_two,container,false); } }
[ "harsh.jhaveri108@gmail.com" ]
harsh.jhaveri108@gmail.com
81fe9b2e13c5f8969166bbb3ee68462a6cb4a97e
66ae0b907408ce387980ab53b9725e797e2efdcc
/out/test/test2/src/ExperienceOfferTest/MergeSortedLists.java
6d9e29dc1115c93bbd8f35997431c121d87dcf6a
[]
no_license
xugeiyangguang/test2
544df420e35293231100b7b0e7a3bc9af1c2aff1
babdb61b06abf1b15b8e53ff02db3d0a0253adf6
refs/heads/master
2021-01-05T05:10:57.558604
2020-02-16T13:03:23
2020-02-16T13:03:23
240,891,182
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package ExperienceOfferTest; public class MergeSortedLists { public static void main(String[] args){ ListNodeFunction a = new ListNodeFunction(); int[] array1 = {1,3,5,7}; int[] array2 = {2,4,6,8}; ListNode L1 = a.CreatLinkList(array1); ListNode L2 = a.CreatLinkList(array2); a.head = Merge(L1,L2); a.PrintLinkList(); } public static ListNode Merge(ListNode list1,ListNode list2) { if(list1 == null){ return list2; }else if(list2 == null) { return list1; } ListNode newHead; if(list1.val < list2.val){ newHead = list1; newHead.next = Merge(list1.next,list2); }else { newHead = list2; newHead.next = Merge(list1,list2.next); } return newHead; // System.out.println("mmm"); } }
[ "yixuyangguang_2017@163.com" ]
yixuyangguang_2017@163.com
7688eaf7834a701848bbc836d838a022043eb4ff
0c7ff54a9ebff538c952ecc7de54b06cd9b4187d
/Loppe/Septiembre Project 2017/Add-Multimedia-Library/multimedia/src/main/java/com/bsdenterprise/carlos/anguiano/multimedia/Multimedia/Utils/SquareImageView.java
a98426fa851274ad6f73de56eca735a8b6c2f3cf
[]
no_license
cjoseanguiano/Nueva-Alarma
3d04a4fe80264db7de39ec0ae565d233c194ac2f
2dd0deee875288abff83a9bcf5cf23d447a6c5b3
refs/heads/master
2021-08-30T05:13:37.014519
2017-12-16T04:51:37
2017-12-16T04:51:37
109,331,191
0
0
null
null
null
null
UTF-8
Java
false
false
833
java
package com.bsdenterprise.carlos.anguiano.multimedia.Multimedia.Utils; import android.content.Context; import android.util.AttributeSet; import android.widget.ImageView; /** * Created by Carlos Anguiano on 05/09/17. * For more info contact: c.joseanguiano@gmail.com */ public class SquareImageView extends ImageView { public SquareImageView(Context context) { super(context); } public SquareImageView(Context context, AttributeSet attrs) { super(context, attrs); } public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // Set a square layout. super.onMeasure(widthMeasureSpec, widthMeasureSpec); } }
[ "c.joseanguiano@gmail.com" ]
c.joseanguiano@gmail.com
4b56bace02e7b5e66f24733ba0e6eb799c86987b
028b20b1d465f61f3dc504d4ba74eb515ae38454
/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/conversion/TestConversionToGPML2021.java
f69a2330c6fad3215163119f1e1c147af2216359
[ "Apache-2.0" ]
permissive
PathVisio/libGPML
09610bc0a67ac8eb5ee482192a6012e81ffd6373
6330edc79de6f953d9e0d0a070f1c9fb798e08bd
refs/heads/main
2023-04-10T06:51:11.985947
2023-03-23T16:13:22
2023-03-23T16:13:22
336,210,372
2
4
Apache-2.0
2023-03-23T08:10:29
2021-02-05T08:30:24
Java
UTF-8
Java
false
false
2,541
java
/******************************************************************************* * PathVisio, a tool for data visualization and analysis using biological pathways * Copyright 2006-2022 BiGCaT Bioinformatics, WikiPathways * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. ******************************************************************************/ package org.pathvisio.libgpml.conversion; import java.io.File; import java.io.IOException; import java.net.URL; import org.junit.Before; import org.junit.Test; import org.pathvisio.libgpml.io.ConverterException; import org.pathvisio.libgpml.model.GPML2013aWriter; import org.pathvisio.libgpml.model.GPML2021Writer; import org.pathvisio.libgpml.model.PathwayModel; import junit.framework.TestCase; /** * Test for reading and writing of a single GPML2013a file, for * troubleshooting and resolving specific issues. * * @author finterly */ public class TestConversionToGPML2021 extends TestCase { private PathwayModel pathwayModel; private String inputFile = "example-v2013a.gpml"; private URL url = Thread.currentThread().getContextClassLoader().getResource(inputFile); /** * Reads a GPML2013a/GPML2021 file. * * @throws ConverterException * @throws IOException */ @Before public void setUp() throws IOException, ConverterException { File file = new File(url.getPath()); assertTrue(file.exists()); pathwayModel = new PathwayModel(); pathwayModel.readFromXml(file, true); } /** * Writes pathway mode to a GPML2013a and GPML2021 file. * * @throws ConverterException * @throws IOException */ @Test public void testWrite() throws IOException, ConverterException { File tmp = File.createTempFile(inputFile + "_testwriteGPML2013a_", ".gpml"); GPML2013aWriter.GPML2013aWRITER.writeToXml(pathwayModel, tmp, true); System.out.println(tmp); File tmp2 = File.createTempFile(inputFile + "_testwriteGPML2021_", ".gpml"); GPML2021Writer.GPML2021WRITER.writeToXml(pathwayModel, tmp2, false); System.out.println(tmp2); } }
[ "noreply@github.com" ]
noreply@github.com
c0543cbe0d1f8942975c1f3c882f29a3e216fb67
f2f233dc8ddcc6a5d5021e6b66d3690fde174a74
/app/src/main/java/com/myclothershopapp/adapter/GridProductLayoutAdapter.java
207acd426f7e0da553b03808ea92826aafd06787
[]
no_license
chanh12012001/Clothers-Shop-App
9d254d96c610f75ba92c4b1848365fcc9350fa62
90c4b42d4d6313b1e5d959b2bf073d8ae88a24ff
refs/heads/main
2023-06-13T06:42:01.594664
2021-07-11T20:09:48
2021-07-11T20:09:48
351,673,945
0
0
null
2021-07-11T20:09:49
2021-03-26T05:37:25
Java
UTF-8
Java
false
false
4,619
java
package com.myclothershopapp.adapter; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.Paint; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.myclothershopapp.PrefManager; import com.myclothershopapp.R; import com.myclothershopapp.activities.ProductDetailsActivity; import com.myclothershopapp.model.HorizontalProductScrollModel; import java.util.List; public class GridProductLayoutAdapter extends BaseAdapter { List<HorizontalProductScrollModel> horizontalProductScrollModelList; PrefManager prefManager; public GridProductLayoutAdapter(List<HorizontalProductScrollModel> horizontalProductScrollModelList, Context context) { this.horizontalProductScrollModelList = horizontalProductScrollModelList; prefManager = new PrefManager(context); } @Override public int getCount() { return horizontalProductScrollModelList.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @Override public View getView(final int position, View convertView, final ViewGroup parent) { View view = convertView; view = LayoutInflater.from(parent.getContext()).inflate(R.layout.grid_scroll_item_layout,null); view.setElevation(0); view.setBackgroundColor(Color.parseColor("#FFFFFF")); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent productDetailsIntent = new Intent(parent.getContext(), ProductDetailsActivity.class); productDetailsIntent.putExtra("PRODUCT_ID",horizontalProductScrollModelList.get(position).getProductID()); parent.getContext().startActivity(productDetailsIntent); } }); ImageView productImage = view.findViewById(R.id.h_s_product_image); TextView productTitle = view.findViewById(R.id.h_s_product_title); TextView productDescription = view.findViewById(R.id.h_s_product_description); TextView productPrice = view.findViewById(R.id.h_s_product_price); TextView cuttedprice = view.findViewById(R.id.cuttedprice); TextView discountedtextview = view.findViewById(R.id.discountTextView); Glide.with(parent.getContext()).load(horizontalProductScrollModelList.get(position).getProduceImage()).apply(new RequestOptions().placeholder(R.drawable.placeholder_image)).into(productImage); productTitle.setText(horizontalProductScrollModelList.get(position).getProductTitle()); productDescription.setText(horizontalProductScrollModelList.get(position).getProductDescription()); if (prefManager.getDiscountAvailable()){ cuttedprice.setVisibility(View.GONE); int percentage = Integer.parseInt(prefManager.getPercentageValue()); cuttedprice.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG); String price = horizontalProductScrollModelList.get(position).getProductPrice(); cuttedprice.setText(price+" đồng"); Double productpricecal = (double) percentage / (double) 100.00; if (!price.equals("")) { Double productrealprice = (Double) (productpricecal * Integer.parseInt(price)); int realpriceint = (int)Math.round(productrealprice); productPrice.setText(( Integer.parseInt(price) - realpriceint) + " đồng"); Double p = Integer.parseInt(price) - productrealprice; Double dif = Integer.parseInt(price) - p; Double div = (double) dif / (double) Integer.parseInt(price); int percentoff = (int) (div * 100); discountedtextview.setText(percentoff + "%"); discountedtextview.setVisibility(View.GONE); } }else { cuttedprice.setVisibility(View.GONE); discountedtextview.setVisibility(View.GONE); productPrice.setText(horizontalProductScrollModelList.get(position).getProductPrice()+" đồng"); } return view; } }
[ "19521274@gm.uit.edu.vn" ]
19521274@gm.uit.edu.vn
a5b63db907ed3ae48dc69c268183b20bcd630888
251e47c68c8388bd20485434485d7904f6f4d37b
/projeto/agenda-jsf/src/br/com/treinarminas/agenda/controller/EditorView.java
f84821060311bcc95545caaaf7e700ee791149cf
[]
no_license
ggmoura/bb
036f2cd5a3ac354773c7695816b2f0aec57163ae
7b4ace4a63c70900f54a96ee7b2b23e7e7832fba
refs/heads/master
2020-12-25T14:37:45.164420
2016-08-12T01:46:59
2016-08-12T01:46:59
63,454,740
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package br.com.treinarminas.agenda.controller; import javax.faces.bean.ManagedBean; @ManagedBean public class EditorView { private String text; public String getText() { return text; } public void setText(String text) { this.text = text; } }
[ "gleidson.gmoura@gmail.com" ]
gleidson.gmoura@gmail.com
f1121d001f3eac01aa223f1e33ebc4a470a915c0
48443248874195f9372036a3eeb504f6f85a1cb7
/data-structure-algorithm-LAB/src/factorypattern/CarType.java
818d60e0d385c80e7a89b2a7d53619b57545dbf4
[]
no_license
ShijunWangMTL/data-structure-algorithm
876af3a0899b9f4b39c2d8f243f27f2af487a5c8
063b890638b660df0778101d4fa0f6186cb503a7
refs/heads/main
2023-03-26T21:03:06.931097
2021-03-31T18:34:54
2021-03-31T18:34:54
352,835,260
0
0
null
null
null
null
UTF-8
Java
false
false
82
java
package factorypattern; public enum CarType { SUV, MiniSUV, Truck }
[ "junjun_key@hotmail.com" ]
junjun_key@hotmail.com
0e324dd64624a6578cd59aaaddf9c5daced5ec61
f3ffe3c8d3ca7d46451198fdcff7124ac9d27e51
/sdk/spring/azure-spring-data-gremlin/src/test/java/com/microsoft/spring/data/gremlin/common/domain/GroupOwner.java
24d938b2519ca1e4cb9bb896ab7614014a496b94
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-generic-cla" ]
permissive
pmakani/azure-sdk-for-java
7f0a0e3832a66f53eeb3ee09a4fe08a0033c9faf
6b259d1ea07342ceeccd89615348f8e0db02d4c6
refs/heads/master
2022-12-24T05:44:30.317176
2020-09-29T07:53:49
2020-09-29T07:53:49
299,564,055
1
0
MIT
2020-09-29T09:12:59
2020-09-29T09:12:58
null
UTF-8
Java
false
false
825
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.microsoft.spring.data.gremlin.common.domain; import com.microsoft.spring.data.gremlin.annotation.Vertex; import org.springframework.data.annotation.Id; @Vertex public class GroupOwner { @Id private String name; private Integer expireDays; public GroupOwner() { } public GroupOwner(String name, Integer expireDays) { this.name = name; this.expireDays = expireDays; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getExpireDays() { return expireDays; } public void setExpireDays(Integer expireDays) { this.expireDays = expireDays; } }
[ "noreply@github.com" ]
noreply@github.com
70386a0cb995b28b8dd00ea59305bfcf3f024be8
ef6508bf1523db9c4ce50529f0538e7e0997db73
/client/src/com/company/Main.java
206e9b55906d82f44044bfb5df2f83e30d2c4ac1
[]
no_license
Mathieu8/DockerTest
7c3b94a42037b9366e917c6fb7d6cd3dbcacb5af
8098adef1267e534e0b20ace5180112bd40b55ba
refs/heads/master
2023-04-20T23:47:02.363922
2021-05-06T09:09:37
2021-05-06T09:09:37
364,219,450
0
0
null
null
null
null
UTF-8
Java
false
false
2,247
java
package com.company; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.time.LocalDateTime; import java.util.Scanner; public class Main{ // IO streams static DataOutputStream toServer = null; static DataInputStream fromServer = null; public static void main(String[] args) { Main client = new Main(); Scanner scanner = new Scanner(System.in); double interestRate = client.askQuestion("What is the interest rate", scanner); double numberOfYears = client.askQuestion("Number of years", scanner); double loanAmount = client.askQuestion("Total amount loaned", scanner); try { // Create a socket to connect to the server Socket socket = new Socket("localhost", 9070); // Create an input stream to receive data from the server fromServer = new DataInputStream(socket.getInputStream()); // Create an output stream to send data to the server toServer = new DataOutputStream(socket.getOutputStream()); // Send the loan information to the server toServer.writeDouble(interestRate); toServer.writeDouble(numberOfYears); toServer.writeDouble(loanAmount); toServer.flush(); System.out.println("flushed " + LocalDateTime.now()); // Get monthly payment and total payment from the server double monthlyPayment = fromServer.readDouble(); double totalPayment = fromServer.readDouble(); // Display to teat area System.out.println("Annual Interest Rate: " + interestRate + '\n'); System.out.println("Number Of Years: " + numberOfYears + '\n'); System.out.println("Loan Amount: " + loanAmount + '\n'); System.out.println("monthlyPayment: " + monthlyPayment + '\n'); System.out.println("totalPayment: " + totalPayment + '\n'); } catch (IOException ex) { System.err.println(ex); } } public double askQuestion(String question, Scanner scanner) { System.out.println(question); return scanner.nextDouble(); } }
[ "mathieuvanommeren@gmail.com" ]
mathieuvanommeren@gmail.com
48dea6295c0ef7d7299f6ed367892970ca18919b
a1f40dd970885e90dc163509c3fcec53103e7f23
/spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java
0b891d38bfb5f8022d1cdf5d873d335be56b07df
[]
no_license
melodyshu/spring-framework
e36faf804ea72cf987f49310e1a1299a1a56bec6
b8d5821eb6981291f6097473a19c60cad2aa953d
refs/heads/master
2020-09-25T23:22:52.344917
2019-12-03T16:38:26
2019-12-03T16:38:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,271
java
/* * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.aop.framework.adapter; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.aopalliance.aop.Advice; import org.aopalliance.intercept.MethodInterceptor; import org.springframework.aop.Advisor; import org.springframework.aop.support.DefaultPointcutAdvisor; /** * Default implementation of the {@link AdvisorAdapterRegistry} interface. * Supports {@link org.aopalliance.intercept.MethodInterceptor}, * {@link org.springframework.aop.MethodBeforeAdvice}, * {@link org.springframework.aop.AfterReturningAdvice}, * {@link org.springframework.aop.ThrowsAdvice}. * * @author Rod Johnson * @author Rob Harrop * @author Juergen Hoeller */ @SuppressWarnings("serial") public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Serializable { private final List<AdvisorAdapter> adapters = new ArrayList<>(3); /**+ * Create a new DefaultAdvisorAdapterRegistry, registering well-known adapters. */ public DefaultAdvisorAdapterRegistry() { registerAdvisorAdapter(new MethodBeforeAdviceAdapter()); registerAdvisorAdapter(new AfterReturningAdviceAdapter()); registerAdvisorAdapter(new ThrowsAdviceAdapter()); } @Override public Advisor wrap(Object adviceObject) throws UnknownAdviceTypeException { if (adviceObject instanceof Advisor) { return (Advisor) adviceObject; } if (!(adviceObject instanceof Advice)) { throw new UnknownAdviceTypeException(adviceObject); } Advice advice = (Advice) adviceObject; if (advice instanceof MethodInterceptor) { // So well-known it doesn't even need an adapter. return new DefaultPointcutAdvisor(advice); } for (AdvisorAdapter adapter : this.adapters) { // Check that it is supported. if (adapter.supportsAdvice(advice)) { return new DefaultPointcutAdvisor(advice); } } throw new UnknownAdviceTypeException(advice); } @Override public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException { List<MethodInterceptor> interceptors = new ArrayList<>(3); Advice advice = advisor.getAdvice(); if (advice instanceof MethodInterceptor) { interceptors.add((MethodInterceptor) advice); } for (AdvisorAdapter adapter : this.adapters) { if (adapter.supportsAdvice(advice)) { interceptors.add(adapter.getInterceptor(advisor)); } } if (interceptors.isEmpty()) { throw new UnknownAdviceTypeException(advisor.getAdvice()); } return interceptors.toArray(new MethodInterceptor[interceptors.size()]); } @Override public void registerAdvisorAdapter(AdvisorAdapter adapter) { this.adapters.add(adapter); } }
[ "1913210361@qq.com" ]
1913210361@qq.com
053fc6ffee711d89f283f54ef7292f7143ff1e7e
2a3eb107e4adb6cc6008c03abf79e154982d8d35
/org.springframework.context/src/test/java/org/springframework/scheduling/annotation/AsyncExecutionTests.java
48317d6edaef6bbd807cc4dd3669458b7e8a07f3
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
aclement/spring-framework
c658958d7e1f4a8ff71c4e6039590b1a06663b78
a7e229743287d4b17b4778adc231fd92900aef94
refs/heads/3.1.x
2022-01-27T02:16:08.052706
2012-07-25T23:45:11
2012-07-25T23:45:11
3,270,047
2
0
null
2012-12-27T16:17:14
2012-01-26T00:23:34
Java
UTF-8
Java
false
false
11,191
java
/* * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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.springframework.scheduling.annotation; import java.util.concurrent.Future; import org.junit.Test; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.support.GenericApplicationContext; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import static org.junit.Assert.*; /** * @author Juergen Hoeller * @author Chris Beams */ public class AsyncExecutionTests { private static String originalThreadName; private static int listenerCalled = 0; private static int listenerConstructed = 0; @Test public void asyncMethods() throws Exception { originalThreadName = Thread.currentThread().getName(); GenericApplicationContext context = new GenericApplicationContext(); context.registerBeanDefinition("asyncTest", new RootBeanDefinition(AsyncMethodBean.class)); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.refresh(); AsyncMethodBean asyncTest = context.getBean("asyncTest", AsyncMethodBean.class); asyncTest.doNothing(5); asyncTest.doSomething(10); Future<String> future = asyncTest.returnSomething(20); assertEquals("20", future.get()); } @Test public void asyncMethodsWithQualifier() throws Exception { originalThreadName = Thread.currentThread().getName(); GenericApplicationContext context = new GenericApplicationContext(); context.registerBeanDefinition("asyncTest", new RootBeanDefinition(AsyncMethodWithQualifierBean.class)); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.registerBeanDefinition("e0", new RootBeanDefinition(ThreadPoolTaskExecutor.class)); context.registerBeanDefinition("e1", new RootBeanDefinition(ThreadPoolTaskExecutor.class)); context.registerBeanDefinition("e2", new RootBeanDefinition(ThreadPoolTaskExecutor.class)); context.refresh(); AsyncMethodWithQualifierBean asyncTest = context.getBean("asyncTest", AsyncMethodWithQualifierBean.class); asyncTest.doNothing(5); asyncTest.doSomething(10); Future<String> future = asyncTest.returnSomething(20); assertEquals("20", future.get()); Future<String> future2 = asyncTest.returnSomething2(30); assertEquals("30", future2.get()); } @Test public void asyncClass() throws Exception { originalThreadName = Thread.currentThread().getName(); GenericApplicationContext context = new GenericApplicationContext(); context.registerBeanDefinition("asyncTest", new RootBeanDefinition(AsyncClassBean.class)); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.refresh(); AsyncClassBean asyncTest = context.getBean("asyncTest", AsyncClassBean.class); asyncTest.doSomething(10); Future<String> future = asyncTest.returnSomething(20); assertEquals("20", future.get()); } @Test public void asyncInterface() throws Exception { originalThreadName = Thread.currentThread().getName(); GenericApplicationContext context = new GenericApplicationContext(); context.registerBeanDefinition("asyncTest", new RootBeanDefinition(AsyncInterfaceBean.class)); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.refresh(); AsyncInterface asyncTest = context.getBean("asyncTest", AsyncInterface.class); asyncTest.doSomething(10); Future<String> future = asyncTest.returnSomething(20); assertEquals("20", future.get()); } @Test public void asyncMethodsInInterface() throws Exception { originalThreadName = Thread.currentThread().getName(); GenericApplicationContext context = new GenericApplicationContext(); context.registerBeanDefinition("asyncTest", new RootBeanDefinition(AsyncMethodsInterfaceBean.class)); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.refresh(); AsyncMethodsInterface asyncTest = context.getBean("asyncTest", AsyncMethodsInterface.class); asyncTest.doNothing(5); asyncTest.doSomething(10); Future<String> future = asyncTest.returnSomething(20); assertEquals("20", future.get()); } @Test public void asyncMethodListener() throws Exception { originalThreadName = Thread.currentThread().getName(); listenerCalled = 0; GenericApplicationContext context = new GenericApplicationContext(); context.registerBeanDefinition("asyncTest", new RootBeanDefinition(AsyncMethodListener.class)); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.refresh(); Thread.sleep(1000); assertEquals(1, listenerCalled); } @Test public void asyncClassListener() throws Exception { originalThreadName = Thread.currentThread().getName(); listenerCalled = 0; listenerConstructed = 0; GenericApplicationContext context = new GenericApplicationContext(); context.registerBeanDefinition("asyncTest", new RootBeanDefinition(AsyncClassListener.class)); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.refresh(); context.close(); Thread.sleep(1000); assertEquals(2, listenerCalled); assertEquals(1, listenerConstructed); } @Test public void asyncPrototypeClassListener() throws Exception { originalThreadName = Thread.currentThread().getName(); listenerCalled = 0; listenerConstructed = 0; GenericApplicationContext context = new GenericApplicationContext(); RootBeanDefinition listenerDef = new RootBeanDefinition(AsyncClassListener.class); listenerDef.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); context.registerBeanDefinition("asyncTest", listenerDef); context.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); context.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); context.refresh(); context.close(); Thread.sleep(1000); assertEquals(2, listenerCalled); assertEquals(2, listenerConstructed); } public static class AsyncMethodBean { public void doNothing(int i) { assertTrue(Thread.currentThread().getName().equals(originalThreadName)); } @Async public void doSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); } @Async public Future<String> returnSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); return new AsyncResult<String>(Integer.toString(i)); } } @Async("e0") public static class AsyncMethodWithQualifierBean { public void doNothing(int i) { assertTrue(Thread.currentThread().getName().equals(originalThreadName)); } @Async("e1") public void doSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); assertTrue(Thread.currentThread().getName().startsWith("e1-")); } @Async("e2") public Future<String> returnSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); assertTrue(Thread.currentThread().getName().startsWith("e2-")); return new AsyncResult<String>(Integer.toString(i)); } public Future<String> returnSomething2(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); assertTrue(Thread.currentThread().getName().startsWith("e0-")); return new AsyncResult<String>(Integer.toString(i)); } } @Async public static class AsyncClassBean { public void doSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); } public Future<String> returnSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); return new AsyncResult<String>(Integer.toString(i)); } } @Async public interface AsyncInterface { void doSomething(int i); Future<String> returnSomething(int i); } public static class AsyncInterfaceBean implements AsyncInterface { public void doSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); } public Future<String> returnSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); return new AsyncResult<String>(Integer.toString(i)); } } public interface AsyncMethodsInterface { void doNothing(int i); @Async void doSomething(int i); @Async Future<String> returnSomething(int i); } public static class AsyncMethodsInterfaceBean implements AsyncMethodsInterface { public void doNothing(int i) { assertTrue(Thread.currentThread().getName().equals(originalThreadName)); } public void doSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); } public Future<String> returnSomething(int i) { assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); return new AsyncResult<String>(Integer.toString(i)); } } public static class AsyncMethodListener implements ApplicationListener<ApplicationEvent> { @Async public void onApplicationEvent(ApplicationEvent event) { listenerCalled++; assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); } } @Async public static class AsyncClassListener implements ApplicationListener<ApplicationEvent> { public AsyncClassListener() { listenerConstructed++; } public void onApplicationEvent(ApplicationEvent event) { listenerCalled++; assertTrue(!Thread.currentThread().getName().equals(originalThreadName)); } } }
[ "cbeams@vmware.com" ]
cbeams@vmware.com