blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
3071a027b9babd09d4105e0973b062e5973850f2
73525733c03ca712d201c0e123161ff3889c05c0
/rabbitmq/src/main/java/com/forezp/rabbitmq/test/Consumer1.java
a7121e9cc580f8683c1c2086f5c76829ff1de70f
[]
no_license
zhoumiaode/SpringCloudConfigTest
b986dc03e3bf1e2c9f37a25f93474e01c29b74ca
adf198f53c87da3f0c383b8911ed0ba81f26791c
refs/heads/master
2020-04-01T00:49:21.419134
2019-10-15T06:29:16
2019-10-15T06:29:16
152,714,869
0
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package com.forezp.rabbitmq.test; import com.forezp.rabbitmq.util.RabbitMqConnectionUtil; import com.rabbitmq.client.*; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeoutException; /** * @ProjectName: scfchapter6 * @Package: com.forezp.rabbitmq.test * @ClassName: Consumer * @Description: java类作用描述 * @Author: zhoumiaode * @CreateDate: 2018/11/21 13:04 * @UpdateUser: Neil.Zhou * @UpdateDate: 2018/11/21 13:04 * @UpdateRemark: The modified content * @Version: 1.0 */ public class Consumer1 { public static String Simple_Name="s2"; public static String Simple_Names="exchangess"; public static void main(String[] args) throws IOException, TimeoutException { Connection connection= RabbitMqConnectionUtil.getConnection("localhost",5672,"guest","guest"); Channel channel=connection.createChannel(); Map<String,Object> map=new HashMap<String, Object>(); map.put("x-message-ttl",20000); channel.queueDeclare(Simple_Name,false,false,false,map); channel.exchangeDeclare(Simple_Names,"direct"); channel.queueBind(Simple_Name,Simple_Names,"w"); channel.basicConsume(Simple_Name,false,new DefaultConsumer(channel){ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { channel.basicAck(envelope.getDeliveryTag(),false); System.out.println("第二个为:"+new String(body)); } }); } }
84e0d6cdf625464f6389c04d3e272ea0278b106a
6c87c8fbad2af5d46c4a0c26b6e2316c17abfb99
/TareaChat/app/src/main/java/com/example/estilos/tareachat/MainActivity.java
0ad68d2396ce4449226da415c95558e323316701
[]
no_license
harudes/Desarrollo-Basado-En-Plataformas
63a00d5b08be36c4a1735c98d3a07664ef753b17
d64142cb47dc011cb1acf359689273065d856a21
refs/heads/master
2021-01-20T01:12:10.702417
2017-07-13T13:58:51
2017-07-13T13:58:51
89,237,656
0
0
null
null
null
null
UTF-8
Java
false
false
2,505
java
package com.example.estilos.tareachat; import android.animation.Animator; import android.content.Intent; import android.database.Cursor; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DBHelper db = new DBHelper(this); List<ContactItems> contactos = new ArrayList<>(); final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setScaleX(0); fab.setScaleY(0); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { final Interpolator interpolador = AnimationUtils.loadInterpolator(getBaseContext(), android.R.interpolator.bounce); fab.animate() .scaleX(1) .scaleY(1) .setInterpolator(interpolador) .setDuration(600) .setStartDelay(1000); } fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(MainActivity.this,AddContact.class); startActivity(i); } }); Cursor c = db.getTodosContactos(); //db.insertarContacto("Stefanie","Muroya","[email protected]"); while (c.moveToNext()){ String nombre = c.getString(c.getColumnIndex("nombre")); String apellido = c.getString(c.getColumnIndex("apellido")); String fullname = nombre +" "+apellido; contactos.add(new ContactItems(Integer.parseInt(c.getString(c.getColumnIndex("id"))),fullname)); } /*contactos.add(new ItemsContactos(0,"Stefanie Muroya")); contactos.add(new ItemsContactos(1,"Paulo Rodriguez")); contactos.add(new ItemsContactos(2,"Diego Melendez")); contactos.add(new ItemsContactos(3,"Janet Rodriguez"));*/ } }
[ "Luis Rendon Zuniga" ]
Luis Rendon Zuniga
844fd0643e2c24bc6ff98aa149c93f4643c7f868
de101b04abfbd850e502756622c8e77fb1fcea97
/StudentProjects/2015/Individual/M3113116_Ramadhani_Bella_Husada/Praktikum_2/src/androidTest/java/com/example/bella/praktikum_2/ApplicationTest.java
784560487d5697e9fa72bcd194c9d492a9765d03
[]
no_license
ivankusuma07/UNS_D3TI_ANDROID_CLASS
be5babf16db533ac3af0b7286d36ed5ecd218809
297392ed03d7e5675104970a9035273eb0a0589c
refs/heads/master
2022-11-18T20:44:21.259809
2016-01-05T03:01:09
2016-01-05T03:01:09
41,787,680
0
0
null
2015-09-02T07:51:35
2015-09-02T07:51:35
null
UTF-8
Java
false
false
360
java
package com.example.bella.praktikum_2; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
589a9ab5dcd2edcc55edb78cfef939b66643e3a8
4b0ce6a0320c934bbb5606f23b21241c1d9a15d9
/Classes/src/App.java
1e0ce328dd2f9f6c8fbb816edadf5065db36e2b4
[]
no_license
elarsaks/Java-Fundamentals
e35af3a8cb7ae4d536bcfa36a127eba5cef3d979
05c9f48c900f34260062cf3e193353ddd7bca22d
refs/heads/master
2023-06-19T02:45:13.358263
2021-07-20T18:22:15
2021-07-20T18:22:15
380,316,016
0
0
null
null
null
null
UTF-8
Java
false
false
623
java
class Methods { String animal; int value; int month; void run() { System.out.println("Running!"); System.out.println("My " + animal + " is " + value + " years old."); } int calculateMonthsToBirthday() { int monthsLeft = 12 - month; return monthsLeft; } void talk(String text) { System.out.println(text); } } public class App { public static void main(String[] args) { Methods name = new Methods(); name.animal = "cat"; name.value = 1; name.month = 8; name.run(); int months = name.calculateMonthsToBirthday(); System.out.println(months); name.talk("Hi, I am Steven!"); } }
e82962bf806ea42b3ae04f0455283e89241b1e2f
29b6a856a81a47ebab7bfdba7fe8a7b845123c9e
/dingtalk/java/src/main/java/com/aliyun/dingtalkstorage_1_0/models/MoveDentryResponse.java
b9be107ff7da2c5425cac5316501a58ce2e47727
[ "Apache-2.0" ]
permissive
aliyun/dingtalk-sdk
f2362b6963c4dbacd82a83eeebc223c21f143beb
586874df48466d968adf0441b3086a2841892935
refs/heads/master
2023-08-31T08:21:14.042410
2023-08-30T08:18:22
2023-08-30T08:18:22
290,671,707
22
9
null
2021-08-12T09:55:44
2020-08-27T04:05:39
PHP
UTF-8
Java
false
false
1,325
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.dingtalkstorage_1_0.models; import com.aliyun.tea.*; public class MoveDentryResponse extends TeaModel { @NameInMap("headers") @Validation(required = true) public java.util.Map<String, String> headers; @NameInMap("statusCode") @Validation(required = true) public Integer statusCode; @NameInMap("body") @Validation(required = true) public MoveDentryResponseBody body; public static MoveDentryResponse build(java.util.Map<String, ?> map) throws Exception { MoveDentryResponse self = new MoveDentryResponse(); return TeaModel.build(map, self); } public MoveDentryResponse setHeaders(java.util.Map<String, String> headers) { this.headers = headers; return this; } public java.util.Map<String, String> getHeaders() { return this.headers; } public MoveDentryResponse setStatusCode(Integer statusCode) { this.statusCode = statusCode; return this; } public Integer getStatusCode() { return this.statusCode; } public MoveDentryResponse setBody(MoveDentryResponseBody body) { this.body = body; return this; } public MoveDentryResponseBody getBody() { return this.body; } }
d90686112876db3447e9128252c0b773365e0ccf
91aa08045d78b0aa1c855512b53ed481026e1173
/SearchRange.java
6386e03f18f85435f3f3bae850664e9c1fe3a9a0
[]
no_license
purlin07/leetcode
9a470b883b95ddb646c44361f8f486313bd24732
b99305641fd6df27f77aa4bc0c6e4353d8a11abe
refs/heads/master
2021-01-02T22:39:00.269520
2015-01-13T00:00:09
2015-01-13T00:00:09
28,541,639
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
class SearchRange { public static void main(String[] args){ int[] test1 = {5,7,7,8,8,9,9}; int[] test2 = {8,8,8,8}; int[] test3 = {5,7,7,7,7}; int[] test4 = {8}; int[] test5 = {7}; print(search(test1,8)); print(search(test2,8)); print(search(test3,8)); print(search(test4,8)); print(search(test5,8)); } public static int[] search(int[] A, int target){ int[] result = new int[2]; int s = -1; int e = -1; result[0] = s; result[1] = e; int start = 0; int end = A.length - 1; while(start <= end){ int mid = (start + end)/2; if(A[mid] == target){ s = mid; e = mid; while(s >= 0 && A[s] == target){ --s; } while(e <= A.length - 1 && A[e] == target){ ++e; } result[0] = s + 1; result[1] = e - 1; return result; }else if(A[mid] > target){ end = mid - 1; }else { start = mid + 1; } } return result; } public static void print(int[] arr){ for(int i : arr){ System.out.print(i + " "); } System.out.print("\n"); } }
b45b1d879fb75912392ca2b7a7642f067b136927
493a8065cf8ec4a4ccdf136170d505248ac03399
/org.mindswap.owls-api/src/test/java/impl/jena/OWLReaderTest.java
5ec50d8aeaf0095bf6cecfaebbc0b517b4146131
[]
no_license
ignasi-gomez/aliveclipse
593611b2d471ee313650faeefbed591c17beaa50
9dd2353c886f60012b4ee4fe8b678d56972dff97
refs/heads/master
2021-01-14T09:08:24.839952
2014-10-09T14:21:01
2014-10-09T14:21:01
null
0
0
null
null
null
null
IBM852
Java
false
false
13,485
java
/* * Created 26.03.2009 * * (c) 2009 Thorsten M÷ller - University of Basel Switzerland * * The MIT License * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ package impl.jena; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.junit.Assume.assumeNoException; import static org.junit.Assume.assumeNotNull; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.junit.BeforeClass; import org.junit.Test; import org.mindswap.owl.OWLFactory; import org.mindswap.owl.OWLKnowledgeBase; import org.mindswap.owl.OWLKnowledgeBaseManager; import org.mindswap.owl.OWLOntology; import org.mindswap.owl.OWLSyntax; import org.mindswap.owls.service.Service; import org.mindswap.owls.vocabulary.OWLS; import org.mindswap.utils.URIUtils; import org.mindswap.utils.Utils; import examples.ExampleURIs; /** * JUnit tests for class {@link OWLReaderImpl}. * * @author unascribed * @version $Rev: 2530 $; $Author: thorsten $; $Date: 2010-07-30 19:46:00 +0200 (Fr, 30 Jul 2010) $ */ public class OWLReaderTest { @BeforeClass public static void note() { System.out.println("Note that this test requires the local host to be connected to the Internet and " + "the availability of remote resources, which might change, move, or disappear. Consequently, " + "in case this test fails this does not necessarily mean that there is a problem with the code!"); } /** * Test method for {@link impl.jena.OWLReaderImpl#read(java.io.Reader, java.net.URI)}. */ @Test public final void testReadReaderURI() { String invalidXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; OWLKnowledgeBase kb = OWLFactory.createKB(); try { kb.read(new StringReader(invalidXML), null); fail(IOException.class + " expected."); } catch (IOException ignore) { // nice } } /** * Test method for {@link impl.jena.OWLReaderImpl#read(InputStream, java.net.URI)}. */ @Test public final void testReadInputStreamURI() throws IOException { // try to read ont that imports owls:Service, which is available InputStream availableImport = ClassLoader.getSystemResourceAsStream("owl/available_import.owl"); assumeNotNull(availableImport); OWLKnowledgeBase kb = OWLFactory.createKB(); try { OWLOntology ont = kb.read(availableImport, null); assertNotNull(ont); Set<OWLOntology> imports = ont.getImports(true); assertEquals(1, imports.size()); // the file exactly has one import OWLOntology serviceOnt = imports.iterator().next(); assertEquals(URIUtils.standardURI(OWLS.SERVICE_NS), serviceOnt.getURI()); } catch (IOException e) { fail("Unexpected exception " + e); } availableImport.close(); // try to read ont that imports another ont that does not exist and we ignore failure InputStream unavailableImport = ClassLoader.getSystemResourceAsStream("owl/unavailable_import.owl"); assumeNotNull(unavailableImport); kb = OWLFactory.createKB(); kb.getReader().setIgnoreFailedImport(true); try { OWLOntology ont = kb.read(unavailableImport, null); assertNotNull(ont); Set<OWLOntology> imports = ont.getImports(true); assertEquals(1, imports.size()); // imported ontology exists but should be empty OWLOntology unavailableOnt = imports.iterator().next(); assertEquals(0, ((OWLOntologyImpl) unavailableOnt).getImplementation().size()); } catch (IOException e) { fail("Unexpected exception " + e); } unavailableImport.close(); // try to read ont that imports another ont that does not exist and we do not ignore failure unavailableImport = ClassLoader.getSystemResourceAsStream("owl/unavailable_import.owl"); assumeNotNull(unavailableImport); kb = OWLFactory.createKB(); kb.getReader().setIgnoreFailedImport(false); try { kb.read(unavailableImport, null); fail("Exception expected."); } catch (IOException e) { // nice } unavailableImport.close(); // do the same again <-- must throw exception again even if caching is used unavailableImport = ClassLoader.getSystemResourceAsStream("owl/unavailable_import.owl"); assumeNotNull(unavailableImport); kb = OWLFactory.createKB(); kb.getReader().setIgnoreFailedImport(false); try { kb.read(unavailableImport, null); fail("Exception expected."); } catch (IOException e) { // nice } unavailableImport.close(); } @Test public final void testReadTurtleReader() { String ttl = "@prefix owl: <http://www.w3.org/2002/07/owl#> ." + Utils.LINE_SEPARATOR + "<http://on.cs.unibas.ch/available_import.ttl>" + Utils.LINE_SEPARATOR + " a owl:Ontology ;" + Utils.LINE_SEPARATOR + " owl:imports <http://www.daml.org/services/owl-s/1.2/Service.owl> ."; OWLKnowledgeBase kb = OWLFactory.createKB(); kb.getReader().setSyntax(OWLSyntax.TURTLE); try { OWLOntology ont = kb.read(new StringReader(ttl), null); assertNotNull(ont); ont.containsOntology(OWLS.Service.describedBy.getOntology().getURI()); } catch (IOException e) { fail("Unexpected exception " + e); } } @Test public final void testReadTurtleInputStream() throws IOException { InputStream availableImport = ClassLoader.getSystemResourceAsStream("owl/available_import.ttl"); assumeNotNull(availableImport); OWLKnowledgeBase kb = OWLFactory.createKB(); kb.getReader().setSyntax(OWLSyntax.TURTLE); try { OWLOntology ont = kb.read(availableImport, null); assertNotNull(ont); ont.containsOntology(OWLS.Service.describedBy.getOntology().getURI()); } catch (IOException e) { fail("Unexpected exception " + e); } availableImport.close(); // once again with wrong format specified --> should raise exception availableImport = ClassLoader.getSystemResourceAsStream("owl/available_import.ttl"); kb.getReader().setSyntax(OWLSyntax.RDFXML); try { kb.read(availableImport, null); fail("IOException expected."); } catch (IOException e) { // nice } availableImport.close(); } /** * Tests reading two example OWL-S services from a local file concurrently * by multiple threads. We only want to analyze if typical concurrent * modification exceptions occur. */ @Test public final void testReadUsingMultipleThreads() throws Exception { int numOfConcurrentTasks = 5; List<Callable<Exception>> tasks = new ArrayList<Callable<Exception>>(numOfConcurrentTasks); ExecutorService executor = Executors.newFixedThreadPool(numOfConcurrentTasks); for (int i = 0; i < numOfConcurrentTasks; i++) { tasks.add(new Callable<Exception>() { public Exception call() throws Exception { try { OWLKnowledgeBase kb = OWLFactory.createKB(); // kb.getReader().setIgnoreFailedImport(true); File f = new File("src/examples/owl-s/1.2/FrenchDictionary.owl"); FileInputStream fis = new FileInputStream(f); Service service = kb.readService(fis, ExampleURIs.FRENCH_DICTIONARY_OWLS12); if (service == null) return new Exception("Service null upon read."); fis.close(); return null; } catch (IOException ioe) { return ioe; } } }); tasks.add(new Callable<Exception>() { public Exception call() throws Exception { try { OWLKnowledgeBase kb = OWLFactory.createKB(); // kb.getReader().setIgnoreFailedImport(true); File f = new File("src/examples/owl-s/1.2/CurrencyConverter.owl"); FileInputStream fis = new FileInputStream(f); Service service = kb.readService(fis, ExampleURIs.CURRENCY_CONVERTER_OWLS12); if (service == null) return new Exception("Service null upon read."); fis.close(); return null; } catch (IOException ioe) { return ioe; } } }); } List<Future<Exception>> futures = executor.invokeAll(tasks); boolean fail = false; StringBuilder errors = new StringBuilder(); for (Future<Exception> future : futures) { Exception e = future.get(); if (e != null) { fail = true; errors.append(" ").append(e.toString()); } } if (fail) { fail("Callable threw exception. Details:" + errors); } } @Test public void testWithDedicatedOWLKBManager() { OWLKnowledgeBaseManager kbm = OWLFactory.createKBManager(); OWLKnowledgeBase kb1 = OWLFactory.createKB(kbm); URI processURI = ExampleURIs.FIND_CHEAPER_BOOK_OWLS12; try { // 1.) - from original location long time1 = System.nanoTime(); OWLOntology ont1 = kb1.read(processURI); time1 = System.nanoTime() - time1; System.out.printf("First read of %s from the Web took %4dms%n", processURI, TimeUnit.NANOSECONDS.toMillis(time1)); assertEquals(processURI, ont1.getURI()); // 2.) - just try again --> returns already loaded one in KB long time2 = System.nanoTime(); OWLOntology ont2 = kb1.read(processURI); time2 = System.nanoTime() - time2; System.out.printf("Second read of %s (same KB --> use existing one) took %4dÁs%n", processURI, TimeUnit.NANOSECONDS.toMicros(time2)); assertEquals(ont1, ont2); assertTrue(time2 < time1); // 3.) - use new KB but same KB manager --> load from cache OWLKnowledgeBase kb2 = OWLFactory.createKB(kbm); long time3 = System.nanoTime(); OWLOntology ont3 = kb2.read(processURI); time3 = System.nanoTime() - time3; System.out.printf("Third read of %s (new KB & existing KB manager cache) took %4dÁs%n", processURI, TimeUnit.NANOSECONDS.toMicros(time3)); assertEquals(ont2.getURI(), ont3.getURI()); assertEquals(ont2.size(), ont3.size()); assertTrue(time3 < time1); // 4.) - partially clear KB manager cache --> load Process ont but not imports from Web again kbm.clear(processURI); OWLKnowledgeBase kb3 = OWLFactory.createKB(kbm); long time4 = System.nanoTime(); OWLOntology ont4 = kb3.read(processURI); time4 = System.nanoTime() - time4; System.out.printf("Forth read of %s (partially cleared KB manager cache) took %4dms%n", processURI, TimeUnit.NANOSECONDS.toMillis(time4)); assertEquals(processURI, ont4.getURI()); assertEquals(ont3.size(), ont4.size()); assertTrue(time3 < time4); // 5.) entirely clear KB manager cache --> load process and imports from Web again kbm.clear(null); OWLKnowledgeBase kb4 = OWLFactory.createKB(kbm); long time5 = System.nanoTime(); OWLOntology ont5 = kb4.read(processURI); time5 = System.nanoTime() - time5; System.out.printf("Fifth read of %s (entirely cleared KB manager cache) took %4dms%n", processURI, TimeUnit.NANOSECONDS.toMillis(time5)); assertEquals(processURI, ont5.getURI()); assertEquals(ont3.size(), ont5.size()); assertTrue(time4 < time5); // 6.a) turn off caching for KB manager --> load process and imports from Web again kbm.setCaching(false); OWLKnowledgeBase kb5 = OWLFactory.createKB(kbm); long time6 = System.nanoTime(); OWLOntology ont6 = kb5.read(processURI); time6 = System.nanoTime() - time6; System.out.printf("Sixth read of %s (turn off KB manager caching) took %4dms%n", processURI, TimeUnit.NANOSECONDS.toMillis(time6)); assertEquals(processURI, ont6.getURI()); assertEquals(ont3.size(), ont6.size()); assertTrue(time4 < time6); // 6.b) try again --> times of a) and b) should not differ much OWLKnowledgeBase kb6 = OWLFactory.createKB(kbm); long time7 = System.nanoTime(); OWLOntology ont7 = kb6.read(processURI); time7 = System.nanoTime() - time7; System.out.printf("Seventh read of %s (no KB manager caching) took %4dms%n", processURI, TimeUnit.NANOSECONDS.toMillis(time7)); assertEquals(processURI, ont7.getURI()); assertEquals(ont3.size(), ont7.size()); // does not work perfectly: caching remains active in Jena for imported ontologies (ImportModelMaker) // assertEquals(time6, time7, time6 / 3); // allow ~33% difference } catch (IOException e) { assumeNoException(e); } } }
871c091a1e9b61885395ae96db62d3853a44cf1b
7e1511cdceeec0c0aad2b9b916431fc39bc71d9b
/flakiness-predicter/input_data/original_tests/doanduyhai-Achilles/nonFlakyMethods/info.archinnov.achilles.internal.proxy.wrapper.ListWrapperTest-should_mark_dirty_on_remove_all.java
2785e45434bff9bd7f8d4754cf51e6d1a6d437a8
[ "BSD-3-Clause" ]
permissive
Taher-Ghaleb/FlakeFlagger
6fd7c95d2710632fd093346ce787fd70923a1435
45f3d4bc5b790a80daeb4d28ec84f5e46433e060
refs/heads/main
2023-07-14T16:57:24.507743
2021-08-26T14:50:16
2021-08-26T14:50:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
816
java
@Test public void should_mark_dirty_on_remove_all() throws Exception { List<Object> target=Lists.<Object>newArrayList("a","b","c"); ListWrapper wrapper=prepareListWrapper(target); wrapper.setProxifier(proxifier); Collection<String> list=Arrays.asList("a","c"); when(proxifier.removeProxy(Mockito.<Collection<String>>any())).thenReturn(list); wrapper.removeAll(list); assertThat(target).containsExactly("b"); DirtyChecker dirtyChecker=dirtyMap.get(setter); assertThat(dirtyChecker.getPropertyMeta()).isEqualTo(propertyMeta); DirtyCheckChangeSet changeSet=dirtyChecker.getChangeSets().get(0); assertThat(changeSet.getChangeType()).isEqualTo(REMOVE_FROM_LIST); assertThat(changeSet.getPropertyMeta()).isEqualTo(propertyMeta); assertThat(changeSet.getRawListChanges()).containsOnly("a","c"); }
fb167f6cc12580801a8c36a5ff51d3f2e0c1e4b1
996ecef192a6798ed8a5c25640569a709cb44126
/LibAndroid/src/main/java/com/violet/lib/android/event/EventLinearLayout.java
f545be73e1b21b2f43f18294baaedcae48d8a7ed
[]
no_license
VioletGlobal/VioletAndroid
8032225901cf815c7528272c50d5125daeb9a4fd
bb723a5de6f8414b61e23c04017a56ec6c026462
refs/heads/master
2020-03-11T08:16:01.682750
2018-09-05T06:41:26
2018-09-05T06:41:26
129,879,235
0
0
null
null
null
null
UTF-8
Java
false
false
1,270
java
package com.violet.lib.android.event; import android.content.Context; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.LinearLayout; import com.violet.core.util.LogUtil; /** * Created by kan212 on 2018/6/5. */ public class EventLinearLayout extends LinearLayout{ public EventLinearLayout(Context context) { super(context); } public EventLinearLayout(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public EventLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { LogUtil.d("EventLinearLayout dispatchTouchEvent " + ev.getAction()); return super.dispatchTouchEvent(ev); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { LogUtil.d("EventLinearLayout onInterceptTouchEvent "+ ev.getAction()); return super.onInterceptTouchEvent(ev); } @Override public boolean onTouchEvent(MotionEvent event) { LogUtil.d("EventLinearLayout onTouchEvent"+ event.getAction()); return true; } }
8ac551d2896d417cf7fee2206784b40ecbb19612
1b72958ab7d8749594fd0dca20e3d9e793151b4e
/application-ocps/contentBridge-core/src/main/java/com/ctb/contentBridge/core/publish/hibernate/persist/ItemSetProductCompositeId.java
fd4da500c3fc3e2250eab570200153fc8c7033a0
[]
no_license
sumit-sardar/GitMigrationRepo01
d0a89e33d3c7d873fac2dd66a7a5e59fd2b1bc3a
a474889914ea0e9805547ac7f4659c49e1a6b712
refs/heads/master
2021-01-17T00:45:16.256869
2016-05-12T18:37:01
2016-05-12T18:37:01
61,346,131
1
0
null
null
null
null
UTF-8
Java
false
false
1,199
java
package com.ctb.contentBridge.core.publish.hibernate.persist; import java.io.Serializable; public class ItemSetProductCompositeId implements Serializable { private Long itemSetId; private Long productId; /** * @hibernate.property * column="ITEM_SET_ID" * not-null="true" */ public Long getItemSetId() { return itemSetId; } /** * @hibernate.property * column="PRODUCT_ID" * not-null="true" */ public Long getProductId() { return productId; } public void setItemSetId(Long itemSetId) { this.itemSetId = itemSetId; } public void setProductId(Long productId) { this.productId = productId; } public int hashCode() { // TODO: Generated by HibernateGen.rb return toString().hashCode(); } public boolean equals(Object object) { // TODO: Generated by HibernateGen.rb return toString().equals(object.toString()); } public String toString() { // TODO: Generated by HibernateGen.rb return "" + itemSetId.toString() + "|" + productId.toString(); } }
[ "" ]
78870e9fb8e7cacd4df3a2e76f6d85ed63af0edd
757d26ebd3e7e881f8bb0f935e442957030a52fe
/src/main/java/DFIT/fitness2d/controllers/ClientController.java
e20f62ed536e010569f9d17a656722cfd9ca3b7e
[]
no_license
leo4135/fitness2d_test
40e2fea8a553c1ff4ce7d521b08c344bf78e92c6
dccb0dd9b9dca96f58decf7faeaa067aca2f8447
refs/heads/master
2023-04-01T12:17:08.017090
2021-04-01T12:40:36
2021-04-01T12:40:36
353,695,999
0
0
null
null
null
null
UTF-8
Java
false
false
2,059
java
package DFIT.fitness2d.controllers; import DFIT.fitness2d.entity.Abonements; import DFIT.fitness2d.entity.Client; import DFIT.fitness2d.entity.ClientAbon; import DFIT.fitness2d.repository.AbonementsRepository; import DFIT.fitness2d.repository.ClientRepository; import DFIT.fitness2d.repository.RoleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/client") public class ClientController { @Autowired private ClientRepository clients; @Autowired private AbonementsRepository abonementsRepository; private RoleRepository roleRepository; // @GetMapping // public Iterable<Client> listClients(){ // return clients.findAll(); //} @PostMapping public Client addClient( @RequestParam(value = "name") String name, @RequestParam(value = "telephone") String telephone, @RequestParam(value = "surname") String surname, @RequestParam(value = "id") int id ){ Client newClient = new Client(); newClient.setName(name); newClient.setPhone(telephone); newClient.setPassword(telephone); newClient.setSurname(surname); Abonements abonement = abonementsRepository.findById(id).get(); ClientAbon clientAbon = new ClientAbon(); clientAbon.setClient(newClient); clientAbon.setAbonement(abonement); return newClient; } @GetMapping public Iterable<Client> getAll(){ return clients.findAll(); } @GetMapping public Page<Client> getByPage(@RequestParam int Page, @RequestParam int Size){ Pageable pageable = PageRequest.of(Page, Size); Page<Client> client = clients.findAll(pageable); return client; } }
2b8db922b6a6df4cf95744c76592574deabef330
62ec9da51d9dcd19c5c2bf07ac69c96902b17c5e
/src/main/java/comte/ui/model/event/TurnResultListener.java
ba5c55dce77c68c10f88b11e6bd7578273cc7a96
[]
no_license
comtef/rock-paper-scissors
09ef6285b14bd0ba4bed1cd428561d410cad88b2
dca90c7a338c89c071f21d865bbab4378ce4a87f
refs/heads/master
2021-01-19T07:03:16.443663
2016-07-21T13:39:35
2016-07-21T13:39:35
63,870,997
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package comte.ui.model.event; import java.util.EventListener; /** * Listener for turn results */ public interface TurnResultListener extends EventListener { /** * Notify of a new turn result * * @param event turn information */ void onTurnResult(TurnResultEvent event); }
afb093963d72acf70b2d85e6cf80e6b0639e7810
d2b2c559cb3c514346e7b3645f5f7a0036bd1b0f
/Kalkulator/app/src/main/java/com/example/mariolaroznaska/kalkulator/LogicService.java
22948448dff64115a9ae814f1c860083390472a2
[]
no_license
RozanskaMariola/Android_home
5dc19d3124dc7dd19f01597f0791eada15d92a2b
2f26a62697f618a37622213342d6c1c768964811
refs/heads/master
2020-04-16T08:45:18.674207
2019-01-12T21:18:32
2019-01-12T21:18:32
165,436,482
0
0
null
null
null
null
UTF-8
Java
false
false
418
java
package com.example.mariolaroznaska.kalkulator; import android.app.Service; import android.content.Intent; import android.os.IBinder; public class LogicService extends Service { public LogicService() { } @Override public IBinder onBind(Intent intent) { // TODO: Return the communication channel to the service. throw new UnsupportedOperationException("Not yet implemented"); } }
949f15c8d8626377e075991a0d14f0a7120c7658
4961f4c272e8f7470d486075408d9ff6e3180e9f
/jpdftweak/gui/PreviewPanel.java
87cfd2b295153e2875a0381fb8aaa910121b0677
[]
no_license
Tz3entch/jpdftweak
b38e981e76a60a510283e975196e92a2ce716a35
92778e79c801dc3ea8db034285d6fe8160da6819
refs/heads/master
2020-12-24T19:36:23.670638
2016-04-21T00:55:55
2016-04-21T00:55:55
58,152,142
0
1
null
null
null
null
UTF-8
Java
false
false
1,767
java
package jpdftweak.gui; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import javax.swing.JPanel; import jpdftweak.core.PageDimension; import jpdftweak.core.ShuffleRule; public class PreviewPanel extends JPanel { private float pwidth = 1, pheight = 1; private ShuffleRule[] rules = new ShuffleRule[0]; public void setConfig(ShuffleRule[] rules) { this.rules = rules; repaint(); } public void setPageFormat(PageDimension dimension) { pwidth = dimension.getWidth(); pheight = dimension.getHeight(); repaint(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setFont(new Font("Dialog", Font.PLAIN, 20)); Graphics2D gg = (Graphics2D) g; int pw = getWidth()-10; int ph = (int)(pw * pheight / pwidth); int y = -ph; for (ShuffleRule sr : rules) { if (sr.isNewPageBefore()) { y+=ph+5; g.setColor(Color.WHITE); g.fillRect(4, y-1, pw+2, ph+2); g.setColor(Color.BLACK); g.drawRect(4, y-1, pw+2, ph+2); } AffineTransform oldTransform = gg.getTransform(); g.translate(5, y+ph); // Begin transform gg.rotate(Math.toRadians(sr.getRotateAngle())); double ox = sr.getOffsetX(), oy = sr.getOffsetY(); if (sr.isOffsetXPercent()) ox = ox * pw / 100; else ox = ox * pw/pwidth; if (sr.isOffsetYPercent()) oy = oy * ph /100; else oy = oy * ph / pheight; gg.scale(sr.getScale(), sr.getScale()); gg.translate(ox, -oy); // End transform g.setColor(Color.YELLOW); g.fillRect(0, -ph, pw, ph); g.setColor(Color.BLUE); g.drawRect(0, -ph, pw, ph); g.drawString(sr.getPageString(), 5, -ph+20); gg.setTransform(oldTransform); } } }
f06f30aba25af7ea2d7d115380edf20474c27b66
10fa7f6e09c73a4c7734d36ce8849d944c1aa467
/app/src/main/java/com/yoshione/fingen/model/SimpleDebt.java
2af362ac43c1b507fe3d32c741a5df3c26554bbf
[ "Apache-2.0" ]
permissive
kasimms/fingen
5c486d4c4a88583c759acbb021708fe36ccf7b51
1ce78aa7f33411491d490cf4fc34662195193498
refs/heads/master
2022-11-29T16:08:49.844145
2020-08-13T16:29:42
2020-08-13T16:29:42
254,844,160
0
0
Apache-2.0
2020-04-11T10:31:48
2020-04-11T10:31:48
null
UTF-8
Java
false
false
4,383
java
package com.yoshione.fingen.model; import android.content.ContentValues; import android.os.Parcel; import com.yoshione.fingen.DBHelper; import com.yoshione.fingen.interfaces.IAbstractModel; import java.math.BigDecimal; /** * Created by slv on 13.08.2015. * */ public class SimpleDebt extends BaseModel implements IAbstractModel { public static final String TAG = "com.yoshione.fingen.Model.SimpleDebt"; // private long mId = -1; private String mName; private Boolean mIsActive; private BigDecimal mStartAmount;//- Я должен, + мне должны private long mCabbageID; private BigDecimal mAmount; private BigDecimal mOweMe; public BigDecimal getAmount() { return mAmount; } public void setAmount(BigDecimal amount) { mAmount = amount; } public BigDecimal getOweMe() { return mOweMe; } public void setOweMe(BigDecimal oweMe) { mOweMe = oweMe; } public BigDecimal getIOwe() { return mIOwe; } public void setIOwe(BigDecimal IOwe) { mIOwe = IOwe; } private BigDecimal mIOwe; public SimpleDebt(){ super(); this.mName = ""; this.mIsActive = true; mStartAmount = BigDecimal.ZERO; mCabbageID = -1; } public SimpleDebt(long id) { super(id); } public SimpleDebt(long id, String name, Boolean isActive, BigDecimal startAmount, long cabbageID) { super(); setID(id); mName = name; mIsActive = isActive; mStartAmount = startAmount; mCabbageID = cabbageID; } public String getName() { return mName; } public String getFullName() { return mName; } public void setName(String mName) { this.mName = mName; } public Boolean isActive() { return mIsActive; } public void setIsActive(Boolean mIsActive) { this.mIsActive = mIsActive; } public BigDecimal getStartAmount() { return mStartAmount; } public void setStartAmount(BigDecimal startAmount) { mStartAmount = startAmount; } public long getCabbageID() { return mCabbageID; } public void setCabbageID(long cabbageID) { mCabbageID = cabbageID; } @Override public String toString() { return mName; } @Override public String getSearchString() { return mName; } @Override public long getID() { return super.getID(); } @Override public ContentValues getCV() { ContentValues values = super.getCV(); values.put(DBHelper.C_REF_SIMPLEDEBTS_NAME, mName); values.put(DBHelper.C_REF_SIMPLEDEBTS_ISACTIVE, mIsActive ? 1 : 0); values.put(DBHelper.C_REF_SIMPLEDEBTS_START_AMOUNT, mStartAmount.doubleValue()); values.put(DBHelper.C_REF_SIMPLEDEBTS_CABBAGE, mCabbageID); return values; } @Override public String getLogTransactionsField() { return DBHelper.C_LOG_TRANSACTIONS_SIMPLEDEBT; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeString(this.mName); dest.writeValue(this.mIsActive); dest.writeSerializable(this.mStartAmount); dest.writeLong(this.mCabbageID); dest.writeSerializable(this.mAmount); dest.writeSerializable(this.mOweMe); dest.writeSerializable(this.mIOwe); } protected SimpleDebt(Parcel in) { super(in); this.mName = in.readString(); this.mIsActive = (Boolean) in.readValue(Boolean.class.getClassLoader()); this.mStartAmount = (BigDecimal) in.readSerializable(); this.mCabbageID = in.readLong(); this.mAmount = (BigDecimal) in.readSerializable(); this.mOweMe = (BigDecimal) in.readSerializable(); this.mIOwe = (BigDecimal) in.readSerializable(); } public static final Creator<SimpleDebt> CREATOR = new Creator<SimpleDebt>() { @Override public SimpleDebt createFromParcel(Parcel source) { return new SimpleDebt(source); } @Override public SimpleDebt[] newArray(int size) { return new SimpleDebt[size]; } }; }
1a9adc8a5a6aa209cb67519d3c884b51572a4aa9
5d83b528dba9b707cf73f3d5a102059da72f8419
/src/main/org/microsys/core/mapper/HwDao.java
1dbad582f398c229cc0ffe58a560fb56037952af
[]
no_license
hexianmin-mac/ERPSystem
43e380539910c552442c98042a70aea678d9d8c2
5ba4a64af3ba0cd2f38200898c5c158639f68348
refs/heads/master
2020-05-15T22:41:03.098591
2019-04-26T14:49:43
2019-04-26T14:49:43
182,534,109
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package main.org.microsys.core.mapper; import java.util.List; import main.org.microsys.core.entity.Hw; public interface HwDao { List<Hw> sp(Hw hw); int spxj(Hw hw); int xjrk(Hw hw); int jj(int id); Hw dy(int id); int ckkk(Hw hw); Hw dys(String name); int updateHw(Hw hw); }
f22bafdfae9ceb50624ab458bde86b6deb01e228
101d979ce7d950289345cd5d36635a890e8b2db5
/src/fmss/common/util/ColBean.java
e92a4fb2b2f8b3a599c218d96171429522ca4675
[]
no_license
byxfvmss/vmss
a3bcbe864c6f57079a8035c92d73d0ac082a1c66
0b54852b2feb79ea20b982d1728754917a82e3ca
refs/heads/master
2022-12-06T13:19:51.010451
2020-09-04T08:24:56
2020-09-04T08:24:56
292,790,355
0
0
null
null
null
null
GB18030
Java
false
false
2,608
java
package fmss.common.util; import java.util.ArrayList; import java.util.List; public class ColBean { private String name; private String nullable;//是否可为空 private String deft;//默认值 private String type;//类型 private String length;//长度 private String scale;//精度 private String constraint_type;//约束类型 private List diffType;//列不同信息 0为缺列, 1为type不同, 2为length不同, 3为nullable不同 private String err_nullable;//是否可为空 private String err_deft;//默认值 private String err_type;//类型 private String err_length;//长度 private String err_scale;//精度 private String err_constraint_type;//约束类型 public ColBean(){ diffType=new ArrayList(); } public List getDiffType() { return diffType; } public void setDiffType(List diffType) { this.diffType = diffType; } public String getConstraint_type() { return constraint_type; } public void setConstraint_type(String constraint_type) { this.constraint_type = constraint_type; } public String getDeft() { return deft; } public void setDeft(String deft) { this.deft = deft; } public String getLength() { return length; } public void setLength(String length) { this.length = length; } public String getScale() { return scale; } public void setScale(String scale) { this.scale = scale; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNullable() { return nullable; } public void setNullable(String nullable) { this.nullable = nullable; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getErr_constraint_type() { return err_constraint_type; } public void setErr_constraint_type(String err_constraint_type) { this.err_constraint_type = err_constraint_type; } public String getErr_deft() { return err_deft; } public void setErr_deft(String err_deft) { this.err_deft = err_deft; } public String getErr_length() { return err_length; } public void setErr_length(String err_length) { this.err_length = err_length; } public String getErr_nullable() { return err_nullable; } public void setErr_nullable(String err_nullable) { this.err_nullable = err_nullable; } public String getErr_scale() { return err_scale; } public void setErr_scale(String err_scale) { this.err_scale = err_scale; } public String getErr_type() { return err_type; } public void setErr_type(String err_type) { this.err_type = err_type; } }
6924b14a8edb68f5a5f7122aeb0d3ddae670133c
26e89fbd9e6423a927912b44daf8f9d6582ebae8
/src/main/java/com/dao/TestMapper.java
cf7221a801de19d499e4f5fc3e1741daad299a7f
[]
no_license
321gaojiaming/ssmdemo
9135cc980deb114dde18d10a48aac153b49a7035
c922e6bcc9e25f99e2de37cff9ec7efbf7fb946a
refs/heads/master
2020-03-28T20:33:52.184190
2018-09-18T01:23:05
2018-09-18T01:23:05
149,083,338
0
0
null
null
null
null
UTF-8
Java
false
false
1,243
java
package com.dao; import com.entity.Test; import org.springframework.stereotype.Component; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface TestMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_user * * @mbggenerated */ int deleteByPrimaryKey(Integer id); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_user * * @mbggenerated */ int insert(Test record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_user * * @mbggenerated */ Test selectByPrimaryKey(Integer id); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_user * * @mbggenerated */ List<Test> selectAll(); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_user * * @mbggenerated */ int updateByPrimaryKey(Test record); Test selectUserByUsernameAndPassword(Test record); }
01f4f7011709d7da44e8e4b1da886649b97330e7
1607da7867f483b3cdd6d097c61a35c285f24303
/src/main/java/com/ericsson/oss/dao/IOssProblemsDao.java
511cfe1882d93a7e1e6a85576279e69f9c5e35e9
[]
no_license
abidarlahcen/OLAI
c7b25c930dbaafbe262d6730e70b185ab553fbc0
cd091f753a9184513fe9fa70c01368d30bd364e0
refs/heads/master
2021-04-29T13:16:44.230906
2018-05-22T10:54:34
2018-05-22T10:54:34
121,747,194
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package com.ericsson.oss.dao; import com.ericsson.oss.entites.OssProblems; public interface IOssProblemsDao extends IGenericDao<OssProblems>{ }
445fec0d1361c2246876ce59774d3a590ccadba7
53b2483d5351f6b726bc17e9e812bc9ee63f7bd9
/src/main/ICollectionTest.java
df0796da3a4ad87cf71a700b350533b1e1fc9cd5
[ "Unlicense" ]
permissive
drapl-homework/java-homework5
20a4df56becfd07b74c85424deeb804ef90c3d3c
d8b5df4468157b93dd4cd2da44b000480bcecb8e
refs/heads/master
2021-01-10T12:18:41.762337
2016-04-11T15:23:55
2016-04-11T15:23:55
55,897,140
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
package main; import static org.junit.Assert.*; import org.junit.Test; public class ICollectionTest { @Test public void test() { fail("Not yet implemented"); } }
6b2f1ee512376ab37059bd1caf12a69a2fae8dbf
500a7f122972eb6a9f25c902121884836ca80ad4
/CodeTool/src/Complexity/ControlStructures/CodeIdentifer.java
4052ff8f218b7b939cb7aefb48c72f383a3f336a
[]
no_license
YasiruPriyadarshana/IT-Project-Management
ed507a05f787477512084fc0cd1a460c4d0c05d6
b73f414bf3b1a20c12e60fdb28b65091c6301534
refs/heads/master
2022-07-02T12:23:11.215650
2020-05-09T10:59:37
2020-05-09T10:59:37
258,094,889
0
0
null
null
null
null
UTF-8
Java
false
false
2,898
java
package Complexity.ControlStructures; import java.util.Collections; import java.util.HashSet; import java.util.Set; public class CodeIdentifer { private static Set<String> keywords; private static Set<String> operators; // for control structures and datatypes private static Set<String> dataTypes; private static Set<String> controlStructures; public static void setKeyword(){ Set<String> s = new HashSet<String>(); // keyword addition String[] kws = { // literals "import", "public","new","return","static","extends", "class","void","args" }; for (String kw : kws) s.add(kw); keywords = Collections.unmodifiableSet(s); } public static boolean isKeyword(String keyword){ setKeyword(); return (keywords.contains(keyword)); } // public static boolean isKeywordandDataType(String keyword){ // setKeyword(); // setDataTypes(); // return (keywords.contains()) // } public static void setOperators(){ Set<String> op = new HashSet<String>(); String[] ops = {"+", "-", "*", "/", "%", "++", "--", "==", "!=", ">", "<", ">=", "<=", "&&", "||", "!", "|", "^", "~" , "<<", ">>", ">>>", "<<<", ",", "->", ".", "::", "+=", "-=", "*=", "/=", "=", ">>>=", "|=", "&=", "%=", "<<=", ">>=", "^=" }; for (String o : ops) op.add(o); operators = Collections.unmodifiableSet(op); } public static boolean isOperator(String operator){ setOperators(); return operators.contains(operator); } public static void setDataTypes(){ Set<String> ns = new HashSet<String>(); String[] nkws = { "boolean", "char", "byte", "short", "int", "long", "float" , "double","String","Integer" }; for (String nkw : nkws) ns.add(nkw); dataTypes = Collections.unmodifiableSet(ns); } public static void setControlStructures(){ Set<String> s = new HashSet<String>(); String[] nkws = { "if","else","for","while","break","switch","case" }; for (String nkw : nkws) s.add(nkw); controlStructures = Collections.unmodifiableSet(s); } public static boolean isControlStructure(String keyword){ setControlStructures(); return controlStructures.contains(keyword); } public static boolean isDataType(String keyword) { setDataTypes(); return dataTypes.contains(keyword); } }
[ "Yasiru Priyadarshana@DESKTOP-V9RBE98" ]
Yasiru Priyadarshana@DESKTOP-V9RBE98
45e8c40e8fd9ae3ea7ad57f3928c4337475a0ca7
03757edf03027f2096113e0b2daab7a3c5894c50
/src/main/java/app19a/controller/BookController.java
c3dd16d80141be81fb42ea921b66e0772f9481e9
[]
no_license
AlexHu66/app19a
2e51485a21847b50d81f9aa81fabe650f4783013
3f96bd0f83bd1f7a35ad0f2859e1b8e9ce946713
refs/heads/master
2021-09-02T09:15:42.030641
2018-01-01T10:28:46
2018-01-01T10:28:46
115,912,450
0
0
null
null
null
null
UTF-8
Java
false
false
2,046
java
package app19a.controller; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import app19a.domain.Book; import app19a.domain.Category; import app19a.service.BookService; @Controller public class BookController { @Autowired private BookService bookService; private static final Log logger = LogFactory.getLog(BookController.class); @RequestMapping(value="/book_input") public String inputBook(Model model){ List<Category> categories = bookService.getAllcategories(); model.addAttribute("categories", categories); model.addAttribute("book", new Book()); return "BookAddForm"; } @RequestMapping(value="/book_edit/{id}") public String editBook(Model model, @PathVariable long id){ List<Category> categories = bookService.getAllcategories(); model.addAttribute("categories", categories); Book book = bookService.get(id); model.addAttribute("book", book); return "BookEditForm"; } @RequestMapping(value="/book_save") public String saveBook(@ModelAttribute Book book){ Category category = bookService.getCategory(book.getCategory().getId()); book.setCategory(category); bookService.save(book); return "redirect:/book_list"; } @RequestMapping(value="/book_update") public String updateBook(@ModelAttribute Book book){ Category category = bookService.getCategory(book.getCategory().getId()); book.setCategory(category); bookService.update(book); return "redirect:/book_list"; } @RequestMapping(value="/book_list") public String listBooks(Model model){ logger.info("book_list"); List<Book> books = bookService.getAllBooks(); model.addAttribute("books", books); return "BookList"; } }
223111195f98c43f04847b36cda1306bb861fed8
3bb932947a00b2f77deb1f9294340710f30ed2e0
/data/comp-changes-client/src/mainclient/classLessAccessible/ClassLessAccessiblePub2PrivExt.java
3b86ddcfa2bf71c80c8d748743a6c76a18683641
[ "MIT" ]
permissive
crossminer/maracas
17684657b29293d82abe50249798e10312d192d6
4cb6fa22d8186d09c3bba6f5da0c548a26d044e1
refs/heads/master
2023-03-05T20:34:36.083662
2023-02-22T12:21:47
2023-02-22T12:21:47
175,425,329
8
0
null
2021-02-25T13:19:15
2019-03-13T13:21:53
Java
UTF-8
Java
false
false
635
java
package mainclient.classLessAccessible; import main.classLessAccessible.ClassLessAccessiblePub2Priv; public class ClassLessAccessiblePub2PrivExt extends ClassLessAccessiblePub2Priv { public void instantiatePub2Priv() { ClassLessAccessiblePub2PrivInner c1 = new ClassLessAccessiblePub2PrivInner(); ClassLessAccessiblePub2PrivInner c2 = new ClassLessAccessiblePub2PrivExtInner(); } public class ClassLessAccessiblePub2PrivExtInner extends ClassLessAccessiblePub2PrivInner { public int accessPublicField() { return super.publicField; } public int invokePublicMethod() { return super.publicMethod(); } } }
491a42c0965a5afd6c3a54568a77cbfeb33481f3
5677a14f609cdc692329d1aeb35631ee4e4176d1
/myTPSD/src/Cliente.java
b0c88778030b35ef04b099505c2144e49ddb2e3e
[]
no_license
nelson31/SD
e35e2c1f6badf67276a3c83ac493d26546fcb891
e339b8b0fd3fc04eaf2cb30783f644d0c7e647ed
refs/heads/master
2022-03-27T03:30:13.028164
2020-01-13T17:15:25
2020-01-13T17:15:25
233,646,271
0
0
null
null
null
null
UTF-8
Java
false
false
6,001
java
import java.io.*; import java.net.Socket; /** * Classe cliente que serve para comunicar com o Servidor * * @author nelson */ public class Cliente { // Porto do socket private final static int PORTSOCKET = 12345; // Endereco do servidor(localhost) private final static String SERVER = "127.0.0.1"; // Local onde os ficheiros a enviar se encontram (posso mudar isto) private final static String PATH_FICH_ENVIAR = "/home/utilizador/Sistemas Distribuídos/myTPSD/Fich_Client/"; /** Tamanho do ficheiro max a transferir (escolhi 2Mb)*/ public final static int TAMANHO_MAX = 2097152; /** * Metodo auxiliar a realizacao de um upload por parte de um cliente * Coloqueio estatico simplesmente para dividir codigoo * @param campos * @param out * @param in * @return */ public static void upload(String[] campos,PrintWriter out,BufferedReader in, Socket socket){ String line = ""; // Ficheiro que se pretende enviar pelo socket num upload FileInputStream fis = null; // Usado para colocar os valores lidos do ficheiro num arrya de bytes BufferedInputStream bis = null; // Usado para o envio dos dados numa stream OutputStream os = null; try { // send file (Partindo do principio que o // ficheiro tem o nome do titulo) File fileEnviar = new File(PATH_FICH_ENVIAR + campos[1]); System.out.println("Conseguiu path"); // Diz somente se é possivel ou nao realizar o upload out.println("OK"); out.flush(); /** Envia ao servidor a quantidade de bytes que vai transmitir*/ line=in.readLine(); if(line.equals("Qual o tamanho do ficheiro?")) { line = Integer.toString(((int) fileEnviar.length())); out.println(line); out.flush(); } fis = new FileInputStream(fileEnviar); bis = new BufferedInputStream(fis); os = socket.getOutputStream(); byte[] arrBytesEnvio; // Serve para ver quantos bytes eu ja li do ficheiro int byteslidos=0; /** Caso tenha menos bytes do que o minimo em memoria*/ if(((int) fileEnviar.length())<TAMANHO_MAX){ arrBytesEnvio = new byte[(int) fileEnviar.length()]; bis.read(arrBytesEnvio, 0, arrBytesEnvio.length); System.out.println("Enviando " + PATH_FICH_ENVIAR + campos[1] + "(" + arrBytesEnvio.length + " bytes)"); os.write(arrBytesEnvio, 0, arrBytesEnvio.length); os.flush(); //System.out.println(arrBytesEnvio.length); } else{ /** Aqui tenho de ir enviando aos poucos*/ arrBytesEnvio=new byte[TAMANHO_MAX]; int quantEnviada = 0; while(byteslidos<((int) fileEnviar.length())){ quantEnviada = bis.read(arrBytesEnvio,0,TAMANHO_MAX); System.out.println("Enviando " + PATH_FICH_ENVIAR + campos[1] + "(" + quantEnviada + " bytes)"); os.write(arrBytesEnvio,0,quantEnviada); os.flush(); // atualizo o numero de bytes lidos ate ao momento byteslidos+=quantEnviada; } } System.out.println("Enviado!"); // Imprimir a resposta line=in.readLine(); System.out.println(line); bis.close(); fis.close(); } catch (Exception e){ System.out.println("Impossivel concluir upload!"); } } /** * Metodo queserve para a realizacao de um download */ public static void download(int id){ } /** * Daqui comeca a execucao dos clientes * @param args */ public static void main(String[] args) { try { // Criando o socket de comunicacao com o servidor System.out.println("Aguardando coneccao..."); Socket socket = new Socket(SERVER, PORTSOCKET); System.out.println("Conectado!!!"); BufferedReader in = new BufferedReader( new InputStreamReader(socket.getInputStream())); PrintWriter out = new PrintWriter( new OutputStreamWriter(socket.getOutputStream())); BufferedReader inTeclado = new BufferedReader( new InputStreamReader(System.in)); /* // Ficheiro que se pretende enviar pelo socket num upload FileInputStream fis = null; // Usado para BufferedInputStream bis = null; // Usado para o envio dos dados numa stream OutputStream os = null; */ String line; System.out.print("> "); while(!(line=inTeclado.readLine()).equals("quit")){ // Escrevo o que li do Stdin para o socket out.println(line); out.flush(); String[] campos = line.split(" "); /* REcebendo a resposta*/ line = in.readLine(); System.out.println(line); /** Envio do ficheiro que se pretende fazer upload*/ if(line.equals("Insira os dados do ficheiro!")){ upload(campos,out,in,socket); } System.out.print("> "); } // Nao esquecer de encerrar o output aberto para o socket do servidor socket.shutdownOutput(); // Nao esquecer de encerrar o input aberto para o socket do servidor socket.shutdownInput(); // Fechar o socket de acesso ao servidor socket.close(); } catch (IOException e){ System.out.println("Coneccao nao possivel"); e.printStackTrace(); } } }
91c84c4d9e081bd90ac14aa079455c39c888a71d
fcb7aa3d72ae4ec05aa8a27a75a2a22b2edaced3
/src/java/org/apache/cassandra/db/CompactionManager.java
50c1ff508575ce17e66cb08c6b126f73ba8f568b
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
HyczZhu/dtcassandra
0f2d7f63a5ccd9f0c3bea6659a686faa7c6e4a2c
abb8c73828ae94eaf8bd1be7f5c5bb7c9b6bec71
refs/heads/master
2021-01-17T16:51:18.873739
2012-12-16T17:13:27
2012-12-16T17:13:27
32,314,162
0
1
Apache-2.0
2023-03-20T11:52:23
2015-03-16T09:27:31
Java
UTF-8
Java
false
false
56,646
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.cassandra.db; import java.io.DataOutput; import java.io.File; import java.io.IOError; import java.io.IOException; import java.lang.management.ManagementFactory; import java.nio.ByteBuffer; import java.security.MessageDigest; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.*; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; import javax.management.MBeanServer; import javax.management.ObjectName; import org.apache.commons.collections.PredicateUtils; import org.apache.commons.collections.iterators.CollatingIterator; import org.apache.commons.collections.iterators.FilterIterator; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.cassandra.cache.AutoSavingCache; import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor; import org.apache.cassandra.concurrent.NamedThreadFactory; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.dht.Range; import org.apache.cassandra.io.*; import org.apache.cassandra.io.sstable.*; import org.apache.cassandra.io.util.BufferedRandomAccessFile; import org.apache.cassandra.io.util.FileUtils; import org.apache.cassandra.service.AntiEntropyService; import org.apache.cassandra.service.StorageService; import org.apache.cassandra.streaming.OperationType; import org.apache.cassandra.utils.ByteBufferUtil; import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.NodeId; import org.apache.cassandra.utils.Pair; import org.apache.cassandra.utils.WrappedRunnable; import org.cliffc.high_scale_lib.NonBlockingHashMap; /** * A singleton which manages a private executor of ongoing compactions. A readwrite lock * controls whether compactions can proceed: an external consumer can completely stop * compactions by acquiring the write half of the lock via getCompactionLock(). * * Scheduling for compaction is accomplished by swapping sstables to be compacted into * a set via DataTracker. New scheduling attempts will ignore currently compacting * sstables. */ public class CompactionManager implements CompactionManagerMBean { public static final String MBEAN_OBJECT_NAME = "org.apache.cassandra.db:type=CompactionManager"; private static final Logger logger = LoggerFactory.getLogger(CompactionManager.class); public static final CompactionManager instance; // acquire as read to perform a compaction, and as write to prevent compactions private final ReentrantReadWriteLock compactionLock = new ReentrantReadWriteLock(); static { instance = new CompactionManager(); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { mbs.registerMBean(instance, new ObjectName(MBEAN_OBJECT_NAME)); } catch (Exception e) { throw new RuntimeException(e); } } private CompactionExecutor executor = new CompactionExecutor(); private Map<ColumnFamilyStore, Integer> estimatedCompactions = new NonBlockingHashMap<ColumnFamilyStore, Integer>(); /** * @return A lock, for which acquisition means no compactions can run. */ public Lock getCompactionLock() { return compactionLock.writeLock(); } /** * Call this whenever a compaction might be needed on the given columnfamily. * It's okay to over-call (within reason) since the compactions are single-threaded, * and if a call is unnecessary, it will just be no-oped in the bucketing phase. */ public Future<Integer> submitMinorIfNeeded(final ColumnFamilyStore cfs) { Callable<Integer> callable = new Callable<Integer>() { public Integer call() throws IOException { compactionLock.readLock().lock(); try { if (cfs.isInvalid()) return 0; Integer minThreshold = cfs.getMinimumCompactionThreshold(); Integer maxThreshold = cfs.getMaximumCompactionThreshold(); if (minThreshold == 0 || maxThreshold == 0) { logger.debug("Compaction is currently disabled."); return 0; } logger.debug("Checking to see if compaction of " + cfs.columnFamily + " would be useful"); Set<List<SSTableReader>> buckets = getBuckets(convertSSTablesToPairs(cfs.getSSTables()), 50L * 1024L * 1024L); updateEstimateFor(cfs, buckets); int gcBefore = cfs.isIndex() ? Integer.MAX_VALUE : getDefaultGcBefore(cfs); for (List<SSTableReader> sstables : buckets) { if (sstables.size() < minThreshold) continue; // if we have too many to compact all at once, compact older ones first -- this avoids // re-compacting files we just created. Collections.sort(sstables); Collection<SSTableReader> tocompact = cfs.getDataTracker().markCompacting(sstables, minThreshold, maxThreshold); if (tocompact == null) // enough threads are busy in this bucket continue; try { return doCompaction(cfs, tocompact, gcBefore); } finally { cfs.getDataTracker().unmarkCompacting(tocompact); } } } finally { compactionLock.readLock().unlock(); } return 0; } }; return executor.submit(callable); } private void updateEstimateFor(ColumnFamilyStore cfs, Set<List<SSTableReader>> buckets) { Integer minThreshold = cfs.getMinimumCompactionThreshold(); Integer maxThreshold = cfs.getMaximumCompactionThreshold(); if (minThreshold > 0 && maxThreshold > 0) { int n = 0; for (List<SSTableReader> sstables : buckets) { if (sstables.size() >= minThreshold) { n += Math.ceil((double)sstables.size() / maxThreshold); } } estimatedCompactions.put(cfs, n); } else { logger.debug("Compaction is currently disabled."); } } public void performCleanup(final ColumnFamilyStore cfStore, final NodeId.OneShotRenewer renewer) throws InterruptedException, ExecutionException { Callable<Object> runnable = new Callable<Object>() { public Object call() throws IOException { // acquire the write lock to schedule all sstables compactionLock.writeLock().lock(); try { if (cfStore.isInvalid()) return this; Collection<SSTableReader> tocleanup = cfStore.getDataTracker().markCompacting(cfStore.getSSTables(), 1, Integer.MAX_VALUE); if (tocleanup == null || tocleanup.isEmpty()) return this; try { // downgrade the lock acquisition compactionLock.readLock().lock(); compactionLock.writeLock().unlock(); try { doCleanupCompaction(cfStore, tocleanup, renewer); } finally { compactionLock.readLock().unlock(); } } finally { cfStore.getDataTracker().unmarkCompacting(tocleanup); } return this; } finally { // we probably already downgraded if (compactionLock.writeLock().isHeldByCurrentThread()) compactionLock.writeLock().unlock(); } } }; executor.submit(runnable).get(); } public void performScrub(final ColumnFamilyStore cfStore) throws InterruptedException, ExecutionException { Callable<Object> runnable = new Callable<Object>() { public Object call() throws IOException { // acquire the write lock to schedule all sstables compactionLock.writeLock().lock(); try { if (cfStore.isInvalid()) return this; Collection<SSTableReader> toscrub = cfStore.getDataTracker().markCompacting(cfStore.getSSTables(), 1, Integer.MAX_VALUE); if (toscrub == null || toscrub.isEmpty()) return this; try { // downgrade the lock acquisition compactionLock.readLock().lock(); compactionLock.writeLock().unlock(); try { doScrub(cfStore, toscrub); } finally { compactionLock.readLock().unlock(); } } finally { cfStore.getDataTracker().unmarkCompacting(toscrub); } return this; } finally { // we probably already downgraded if (compactionLock.writeLock().isHeldByCurrentThread()) compactionLock.writeLock().unlock(); } } }; executor.submit(runnable).get(); } public void performMajor(final ColumnFamilyStore cfStore) throws InterruptedException, ExecutionException { submitMajor(cfStore, 0, getDefaultGcBefore(cfStore)).get(); } public Future<Object> submitMajor(final ColumnFamilyStore cfStore, final long skip, final int gcBefore) { Callable<Object> callable = new Callable<Object>() { public Object call() throws IOException { // acquire the write lock long enough to schedule all sstables compactionLock.writeLock().lock(); try { if (cfStore.isInvalid()) return this; Collection<SSTableReader> sstables; if (skip > 0) { sstables = new ArrayList<SSTableReader>(); for (SSTableReader sstable : cfStore.getSSTables()) { if (sstable.length() < skip * 1024L * 1024L * 1024L) { sstables.add(sstable); } } } else { sstables = cfStore.getSSTables(); } Collection<SSTableReader> tocompact = cfStore.getDataTracker().markCompacting(sstables, 0, Integer.MAX_VALUE); if (tocompact == null || tocompact.isEmpty()) return this; try { // downgrade the lock acquisition compactionLock.readLock().lock(); compactionLock.writeLock().unlock(); try { doCompaction(cfStore, tocompact, gcBefore); } finally { compactionLock.readLock().unlock(); } } finally { cfStore.getDataTracker().unmarkCompacting(tocompact); } return this; } finally { // we probably already downgraded if (compactionLock.writeLock().isHeldByCurrentThread()) compactionLock.writeLock().unlock(); } } }; return executor.submit(callable); } public void forceUserDefinedCompaction(String ksname, String dataFiles) { if (!DatabaseDescriptor.getTables().contains(ksname)) throw new IllegalArgumentException("Unknown keyspace " + ksname); File directory = new File(ksname); String[] filenames = dataFiles.split(","); Collection<Descriptor> descriptors = new ArrayList<Descriptor>(filenames.length); String cfname = null; for (String filename : filenames) { Pair<Descriptor, String> p = Descriptor.fromFilename(directory, filename.trim()); if (!p.right.equals(Component.DATA.name())) { throw new IllegalArgumentException(filename + " does not appear to be a data file"); } if (cfname == null) { cfname = p.left.cfname; } else if (!cfname.equals(p.left.cfname)) { throw new IllegalArgumentException("All provided sstables should be for the same column family"); } descriptors.add(p.left); } ColumnFamilyStore cfs = Table.open(ksname).getColumnFamilyStore(cfname); submitUserDefined(cfs, descriptors, getDefaultGcBefore(cfs)); } public Future<Object> submitUserDefined(final ColumnFamilyStore cfs, final Collection<Descriptor> dataFiles, final int gcBefore) { Callable<Object> callable = new Callable<Object>() { public Object call() throws IOException { compactionLock.readLock().lock(); try { if (cfs.isInvalid()) return this; // look up the sstables now that we're on the compaction executor, so we don't try to re-compact // something that was already being compacted earlier. Collection<SSTableReader> sstables = new ArrayList<SSTableReader>(); for (Descriptor desc : dataFiles) { // inefficient but not in a performance sensitive path SSTableReader sstable = lookupSSTable(cfs, desc); if (sstable == null) { logger.info("Will not compact {}: it is not an active sstable", desc); } else { sstables.add(sstable); } } if (sstables.isEmpty()) { logger.error("No file to compact for user defined compaction"); } // attempt to schedule the set else if ((sstables = cfs.getDataTracker().markCompacting(sstables, 1, Integer.MAX_VALUE)) != null) { String location = cfs.table.getDataFileLocation(1); // success: perform the compaction try { doCompactionWithoutSizeEstimation(cfs, sstables, gcBefore, location); } finally { cfs.getDataTracker().unmarkCompacting(sstables); } } else { logger.error("SSTables for user defined compaction are already being compacted."); } return this; } finally { compactionLock.readLock().unlock(); } } }; return executor.submit(callable); } private SSTableReader lookupSSTable(final ColumnFamilyStore cfs, Descriptor descriptor) { for (SSTableReader sstable : cfs.getSSTables()) { // .equals() with no other changes won't work because in sstable.descriptor, the directory is an absolute path. // We could construct descriptor with an absolute path too but I haven't found any satisfying way to do that // (DB.getDataFileLocationForTable() may not return the right path if you have multiple volumes). Hence the // endsWith. if (sstable.descriptor.toString().endsWith(descriptor.toString())) return sstable; } return null; } /** * Does not mutate data, so is not scheduled. */ public Future<Object> submitValidation(final ColumnFamilyStore cfStore, final AntiEntropyService.Validator validator) { Callable<Object> callable = new Callable<Object>() { public Object call() throws IOException { compactionLock.readLock().lock(); try { if (!cfStore.isInvalid()) doValidationCompaction(cfStore, validator); return this; } finally { compactionLock.readLock().unlock(); } } }; return executor.submit(callable); } /* Used in tests. */ public void disableAutoCompaction() { for (String ksname : DatabaseDescriptor.getNonSystemTables()) { for (ColumnFamilyStore cfs : Table.open(ksname).getColumnFamilyStores()) cfs.disableAutoCompaction(); } } int doCompaction(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, int gcBefore) throws IOException { Table table = cfs.table; // If the compaction file path is null that means we have no space left for this compaction. // try again w/o the largest one. Set<SSTableReader> smallerSSTables = new HashSet<SSTableReader>(sstables); while (smallerSSTables.size() > 1) { String compactionFileLocation = table.getDataFileLocation(cfs.getExpectedCompactedFileSize(smallerSSTables)); if (compactionFileLocation != null) return doCompactionWithoutSizeEstimation(cfs, smallerSSTables, gcBefore, compactionFileLocation); logger.warn("insufficient space to compact all requested files " + StringUtils.join(smallerSSTables, ", ")); smallerSSTables.remove(cfs.getMaxSizeFile(smallerSSTables)); } logger.error("insufficient space to compact even the two smallest files, aborting"); return 0; } /** * For internal use and testing only. The rest of the system should go through the submit* methods, * which are properly serialized. */ int doCompactionWithoutSizeEstimation(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, int gcBefore, String compactionFileLocation) throws IOException { // The collection of sstables passed may be empty (but not null); even if // it is not empty, it may compact down to nothing if all rows are deleted. assert sstables != null; Table table = cfs.table; if (DatabaseDescriptor.isSnapshotBeforeCompaction()) table.snapshot(System.currentTimeMillis() + "-" + "compact-" + cfs.columnFamily); // sanity check: all sstables must belong to the same cfs for (SSTableReader sstable : sstables) assert sstable.descriptor.cfname.equals(cfs.columnFamily); // new sstables from flush can be added during a compaction, but only the compaction can remove them, // so in our single-threaded compaction world this is a valid way of determining if we're compacting // all the sstables (that existed when we started) boolean major = cfs.isCompleteSSTables(sstables); CompactionType type = major ? CompactionType.MAJOR : CompactionType.MINOR; logger.info("Compacting {}: {}", type, sstables); long startTime = System.currentTimeMillis(); long totalkeysWritten = 0; // TODO the int cast here is potentially buggy int expectedBloomFilterSize = Math.max(DatabaseDescriptor.getIndexInterval(), (int)SSTableReader.getApproximateKeyCount(sstables)); if (logger.isDebugEnabled()) logger.debug("Expected bloom filter size : " + expectedBloomFilterSize); SSTableWriter writer; CompactionController controller = new CompactionController(cfs, sstables, major, gcBefore, false); CompactionIterator ci = new CompactionIterator(type, sstables, controller); // retain a handle so we can call close() Iterator<AbstractCompactedRow> nni = new FilterIterator(ci, PredicateUtils.notNullPredicate()); Map<DecoratedKey, Long> cachedKeys = new HashMap<DecoratedKey, Long>(); executor.beginCompaction(ci); try { if (!nni.hasNext()) { // don't mark compacted in the finally block, since if there _is_ nondeleted data, // we need to sync it (via closeAndOpen) first, so there is no period during which // a crash could cause data loss. cfs.markCompacted(sstables); return 0; } writer = cfs.createCompactionWriter(expectedBloomFilterSize, compactionFileLocation, sstables); while (nni.hasNext()) { AbstractCompactedRow row = nni.next(); long position = writer.append(row); totalkeysWritten++; if (DatabaseDescriptor.getPreheatKeyCache()) { for (SSTableReader sstable : sstables) { if (sstable.getCachedPosition(row.key) != null) { cachedKeys.put(row.key, position); break; } } } } } finally { ci.close(); executor.finishCompaction(ci); } SSTableReader ssTable = writer.closeAndOpenReader(getMaxDataAge(sstables)); cfs.replaceCompactedSSTables(sstables, Arrays.asList(ssTable)); for (Entry<DecoratedKey, Long> entry : cachedKeys.entrySet()) // empty if preheat is off ssTable.cacheKey(entry.getKey(), entry.getValue()); submitMinorIfNeeded(cfs); long dTime = System.currentTimeMillis() - startTime; long startsize = SSTable.getTotalBytes(sstables); long endsize = ssTable.length(); double ratio = (double)endsize / (double)startsize; logger.info(String.format("Compacted to %s. %,d to %,d (~%d%% of original) bytes for %,d keys. Time: %,dms.", writer.getFilename(), startsize, endsize, (int) (ratio * 100), totalkeysWritten, dTime)); return sstables.size(); } private static long getMaxDataAge(Collection<SSTableReader> sstables) { long max = 0; for (SSTableReader sstable : sstables) { if (sstable.maxDataAge > max) max = sstable.maxDataAge; } return max; } /** * Deserialize everything in the CFS and re-serialize w/ the newest version. Also attempts to recover * from bogus row keys / sizes using data from the index, and skips rows with garbage columns that resulted * from early ByteBuffer bugs. * * @throws IOException */ private void doScrub(ColumnFamilyStore cfs, Collection<SSTableReader> sstables) throws IOException { assert !cfs.isIndex(); for (final SSTableReader sstable : sstables) { logger.info("Scrubbing " + sstable); // Calculate the expected compacted filesize String compactionFileLocation = cfs.table.getDataFileLocation(sstable.length()); if (compactionFileLocation == null) throw new IOException("disk full"); int expectedBloomFilterSize = Math.max(DatabaseDescriptor.getIndexInterval(), (int)(SSTableReader.getApproximateKeyCount(Arrays.asList(sstable)))); // loop through each row, deserializing to check for damage. // we'll also loop through the index at the same time, using the position from the index to recover if the // row header (key or data size) is corrupt. (This means our position in the index file will be one row // "ahead" of the data file.) final BufferedRandomAccessFile dataFile = BufferedRandomAccessFile.getUncachingReader(sstable.getFilename()); String indexFilename = sstable.descriptor.filenameFor(Component.PRIMARY_INDEX); BufferedRandomAccessFile indexFile = BufferedRandomAccessFile.getUncachingReader(indexFilename); ByteBuffer nextIndexKey = ByteBufferUtil.readWithShortLength(indexFile); { // throw away variable so we don't have a side effect in the assert long firstRowPositionFromIndex = indexFile.readLong(); assert firstRowPositionFromIndex == 0 : firstRowPositionFromIndex; } SSTableWriter writer = maybeCreateWriter(cfs, compactionFileLocation, expectedBloomFilterSize, null, Collections.singletonList(sstable)); executor.beginCompaction(new ScrubInfo(dataFile, sstable)); int goodRows = 0, badRows = 0, emptyRows = 0; while (!dataFile.isEOF()) { long rowStart = dataFile.getFilePointer(); if (logger.isDebugEnabled()) logger.debug("Reading row at " + rowStart); DecoratedKey key = null; long dataSize = -1; try { key = SSTableReader.decodeKey(sstable.partitioner, sstable.descriptor, ByteBufferUtil.readWithShortLength(dataFile)); dataSize = sstable.descriptor.hasIntRowSize ? dataFile.readInt() : dataFile.readLong(); if (logger.isDebugEnabled()) logger.debug(String.format("row %s is %s bytes", ByteBufferUtil.bytesToHex(key.key), dataSize)); } catch (Throwable th) { throwIfFatal(th); // check for null key below } ByteBuffer currentIndexKey = nextIndexKey; long nextRowPositionFromIndex; try { nextIndexKey = indexFile.isEOF() ? null : ByteBufferUtil.readWithShortLength(indexFile); nextRowPositionFromIndex = indexFile.isEOF() ? dataFile.length() : indexFile.readLong(); } catch (Throwable th) { logger.warn("Error reading index file", th); nextIndexKey = null; nextRowPositionFromIndex = dataFile.length(); } long dataStart = dataFile.getFilePointer(); long dataStartFromIndex = currentIndexKey == null ? -1 : rowStart + 2 + currentIndexKey.remaining() + (sstable.descriptor.hasIntRowSize ? 4 : 8); long dataSizeFromIndex = nextRowPositionFromIndex - dataStartFromIndex; assert currentIndexKey != null || indexFile.isEOF(); if (logger.isDebugEnabled() && currentIndexKey != null) logger.debug(String.format("Index doublecheck: row %s is %s bytes", ByteBufferUtil.bytesToHex(currentIndexKey), dataSizeFromIndex)); writer.mark(); try { if (key == null) throw new IOError(new IOException("Unable to read row key from data file")); if (dataSize > dataFile.length()) throw new IOError(new IOException("Impossible row size " + dataSize)); SSTableIdentityIterator row = new SSTableIdentityIterator(sstable, dataFile, key, dataStart, dataSize, true); AbstractCompactedRow compactedRow = getCompactedRow(row, sstable.descriptor, true); if (compactedRow.isEmpty()) { emptyRows++; } else { writer.append(compactedRow); goodRows++; } if (!key.key.equals(currentIndexKey) || dataStart != dataStartFromIndex) logger.warn("Row scrubbed successfully but index file contains a different key or row size; consider rebuilding the index as described in http://www.mail-archive.com/[email protected]/msg03325.html"); } catch (Throwable th) { throwIfFatal(th); logger.warn("Non-fatal error reading row (stacktrace follows)", th); writer.reset(); if (currentIndexKey != null && (key == null || !key.key.equals(currentIndexKey) || dataStart != dataStartFromIndex || dataSize != dataSizeFromIndex)) { logger.info(String.format("Retrying from row index; data is %s bytes starting at %s", dataSizeFromIndex, dataStartFromIndex)); key = SSTableReader.decodeKey(sstable.partitioner, sstable.descriptor, currentIndexKey); try { SSTableIdentityIterator row = new SSTableIdentityIterator(sstable, dataFile, key, dataStartFromIndex, dataSizeFromIndex, true); AbstractCompactedRow compactedRow = getCompactedRow(row, sstable.descriptor, true); if (compactedRow.isEmpty()) { emptyRows++; } else { writer.append(compactedRow); goodRows++; } } catch (Throwable th2) { throwIfFatal(th2); logger.warn("Retry failed too. Skipping to next row (retry's stacktrace follows)", th2); writer.reset(); dataFile.seek(nextRowPositionFromIndex); badRows++; } } else { logger.warn("Row at " + dataStart + " is unreadable; skipping to next"); if (currentIndexKey != null) dataFile.seek(nextRowPositionFromIndex); badRows++; } } } if (writer.getFilePointer() > 0) { SSTableReader newSstable = writer.closeAndOpenReader(sstable.maxDataAge); cfs.replaceCompactedSSTables(Arrays.asList(sstable), Arrays.asList(newSstable)); logger.info("Scrub of " + sstable + " complete: " + goodRows + " rows in new sstable and " + emptyRows + " empty (tombstoned) rows dropped"); if (badRows > 0) logger.warn("Unable to recover " + badRows + " rows that were skipped. You can attempt manual recovery from the pre-scrub snapshot. You can also run nodetool repair to transfer the data from a healthy replica, if any"); } else { cfs.markCompacted(Arrays.asList(sstable)); if (badRows > 0) logger.warn("No valid rows found while scrubbing " + sstable + "; it is marked for deletion now. If you want to attempt manual recovery, you can find a copy in the pre-scrub snapshot"); else logger.info("Scrub of " + sstable + " complete; looks like all " + emptyRows + " rows were tombstoned"); } } } private void throwIfFatal(Throwable th) { if (th instanceof Error && !(th instanceof AssertionError || th instanceof IOError)) throw (Error) th; } /** * This function goes over each file and removes the keys that the node is not responsible for * and only keeps keys that this node is responsible for. * * @throws IOException */ private void doCleanupCompaction(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, NodeId.OneShotRenewer renewer) throws IOException { assert !cfs.isIndex(); Table table = cfs.table; Collection<Range> ranges = StorageService.instance.getLocalRanges(table.name); boolean isCommutative = cfs.metadata.getDefaultValidator().isCommutative(); if (ranges.isEmpty()) { logger.info("Cleanup cannot run before a node has joined the ring"); return; } for (SSTableReader sstable : sstables) { long startTime = System.currentTimeMillis(); long totalkeysWritten = 0; int expectedBloomFilterSize = Math.max(DatabaseDescriptor.getIndexInterval(), (int)(SSTableReader.getApproximateKeyCount(Arrays.asList(sstable)))); if (logger.isDebugEnabled()) logger.debug("Expected bloom filter size : " + expectedBloomFilterSize); SSTableWriter writer = null; try { logger.info("Cleaning up " + sstable); // Calculate the expected compacted filesize long expectedRangeFileSize = cfs.getExpectedCompactedFileSize(Arrays.asList(sstable)) / 2; String compactionFileLocation = table.getDataFileLocation(expectedRangeFileSize); if (compactionFileLocation == null) throw new IOException("disk full"); SSTableScanner scanner = sstable.getDirectScanner(CompactionIterator.FILE_BUFFER_SIZE); SortedSet<ByteBuffer> indexedColumns = cfs.getIndexedColumns(); CleanupInfo ci = new CleanupInfo(sstable, scanner); executor.beginCompaction(ci); try { while (scanner.hasNext()) { SSTableIdentityIterator row = (SSTableIdentityIterator) scanner.next(); if (Range.isTokenInRanges(row.getKey().token, ranges)) { writer = maybeCreateWriter(cfs, compactionFileLocation, expectedBloomFilterSize, writer, Collections.singletonList(sstable)); writer.append(getCompactedRow(row, sstable.descriptor, false)); totalkeysWritten++; } else { cfs.invalidateCachedRow(row.getKey()); if (!indexedColumns.isEmpty() || isCommutative) { while (row.hasNext()) { IColumn column = row.next(); if (column instanceof CounterColumn) renewer.maybeRenew((CounterColumn)column); if (indexedColumns.contains(column.name())) Table.cleanupIndexEntry(cfs, row.getKey().key, column); } } } } } finally { scanner.close(); executor.finishCompaction(ci); } } finally { cfs.getDataTracker().unmarkCompacting(Arrays.asList(sstable)); } List<SSTableReader> results = new ArrayList<SSTableReader>(); if (writer != null) { SSTableReader newSstable = writer.closeAndOpenReader(sstable.maxDataAge); results.add(newSstable); String format = "Cleaned up to %s. %,d to %,d (~%d%% of original) bytes for %,d keys. Time: %,dms."; long dTime = System.currentTimeMillis() - startTime; long startsize = sstable.length(); long endsize = newSstable.length(); double ratio = (double)endsize / (double)startsize; logger.info(String.format(format, writer.getFilename(), startsize, endsize, (int)(ratio*100), totalkeysWritten, dTime)); } // flush to ensure we don't lose the tombstones on a restart, since they are not commitlog'd for (ByteBuffer columnName : cfs.getIndexedColumns()) { try { cfs.getIndexedColumnFamilyStore(columnName).forceBlockingFlush(); } catch (ExecutionException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new AssertionError(e); } } cfs.replaceCompactedSSTables(Arrays.asList(sstable), results); } } /** * @return an AbstractCompactedRow implementation to write the row in question. * If the data is from a current-version sstable, write it unchanged. Otherwise, * re-serialize it in the latest version. The returned AbstractCompactedRow will not purge data. */ private AbstractCompactedRow getCompactedRow(SSTableIdentityIterator row, Descriptor descriptor, boolean forceDeserialize) { if (descriptor.isLatestVersion && !forceDeserialize) return new EchoedRow(row); return row.dataSize > DatabaseDescriptor.getInMemoryCompactionLimit() ? new LazilyCompactedRow(CompactionController.getBasicController(forceDeserialize), Arrays.asList(row)) : new PrecompactedRow(CompactionController.getBasicController(forceDeserialize), Arrays.asList(row)); } private SSTableWriter maybeCreateWriter(ColumnFamilyStore cfs, String compactionFileLocation, int expectedBloomFilterSize, SSTableWriter writer, Collection<SSTableReader> sstables) throws IOException { if (writer == null) { FileUtils.createDirectory(compactionFileLocation); writer = cfs.createCompactionWriter(expectedBloomFilterSize, compactionFileLocation, sstables); } return writer; } /** * Performs a readonly "compaction" of all sstables in order to validate complete rows, * but without writing the merge result */ private void doValidationCompaction(ColumnFamilyStore cfs, AntiEntropyService.Validator validator) throws IOException { // flush first so everyone is validating data that is as similar as possible try { StorageService.instance.forceTableFlush(cfs.table.name, cfs.getColumnFamilyName()); } catch (ExecutionException e) { throw new IOException(e); } catch (InterruptedException e) { throw new AssertionError(e); } CompactionIterator ci = new ValidationCompactionIterator(cfs, validator.request.range); executor.beginCompaction(ci); try { Iterator<AbstractCompactedRow> nni = new FilterIterator(ci, PredicateUtils.notNullPredicate()); // validate the CF as we iterate over it validator.prepare(cfs); while (nni.hasNext()) { AbstractCompactedRow row = nni.next(); validator.add(row); } validator.complete(); } finally { ci.close(); executor.finishCompaction(ci); } } /* * Group files of similar size into buckets. */ static <T> Set<List<T>> getBuckets(Collection<Pair<T, Long>> files, long min) { // Sort the list in order to get deterministic results during the grouping below List<Pair<T, Long>> sortedFiles = new ArrayList<Pair<T, Long>>(files); Collections.sort(sortedFiles, new Comparator<Pair<T, Long>>() { public int compare(Pair<T, Long> p1, Pair<T, Long> p2) { return p1.right.compareTo(p2.right); } }); Map<List<T>, Long> buckets = new HashMap<List<T>, Long>(); for (Pair<T, Long> pair: sortedFiles) { long size = pair.right; boolean bFound = false; // look for a bucket containing similar-sized files: // group in the same bucket if it's w/in 50% of the average for this bucket, // or this file and the bucket are all considered "small" (less than `min`) for (Entry<List<T>, Long> entry : buckets.entrySet()) { List<T> bucket = entry.getKey(); long averageSize = entry.getValue(); if ((size > (averageSize / 2) && size < (3 * averageSize) / 2) || (size < min && averageSize < min)) { // remove and re-add because adding changes the hash buckets.remove(bucket); long totalSize = bucket.size() * averageSize; averageSize = (totalSize + size) / (bucket.size() + 1); bucket.add(pair.left); buckets.put(bucket, averageSize); bFound = true; break; } } // no similar bucket found; put it in a new one if (!bFound) { ArrayList<T> bucket = new ArrayList<T>(); bucket.add(pair.left); buckets.put(bucket, size); } } return buckets.keySet(); } private static Collection<Pair<SSTableReader, Long>> convertSSTablesToPairs(Collection<SSTableReader> collection) { Collection<Pair<SSTableReader, Long>> tablePairs = new ArrayList<Pair<SSTableReader, Long>>(); for(SSTableReader table: collection) { tablePairs.add(new Pair<SSTableReader, Long>(table, table.length())); } return tablePairs; } /** * Is not scheduled, because it is performing disjoint work from sstable compaction. */ public Future submitIndexBuild(final ColumnFamilyStore cfs, final Table.IndexBuilder builder) { Runnable runnable = new Runnable() { public void run() { compactionLock.readLock().lock(); try { if (cfs.isInvalid()) return; executor.beginCompaction(builder); try { builder.build(); } finally { executor.finishCompaction(builder); } } finally { compactionLock.readLock().unlock(); } } }; // don't submit to the executor if the compaction lock is held by the current thread. Instead return a simple // future that will be immediately immediately get()ed and executed. Happens during a migration, which locks // the compaction thread and then reinitializes a ColumnFamilyStore. Under normal circumstances, CFS spawns // index jobs to the compaction manager (this) and blocks on them. if (compactionLock.isWriteLockedByCurrentThread()) return new SimpleFuture(runnable); else return executor.submit(runnable); } /** * Submits an sstable to be rebuilt: is not scheduled, since the sstable must not exist. */ public Future<SSTableReader> submitSSTableBuild(final Descriptor desc, OperationType type) { // invalid descriptions due to missing or dropped CFS are handled by SSTW and StreamInSession. final SSTableWriter.Builder builder = SSTableWriter.createBuilder(desc, type); Callable<SSTableReader> callable = new Callable<SSTableReader>() { public SSTableReader call() throws IOException { compactionLock.readLock().lock(); try { executor.beginCompaction(builder); try { return builder.build(); } finally { executor.finishCompaction(builder); } } finally { compactionLock.readLock().unlock(); } } }; return executor.submit(callable); } public Future<?> submitCacheWrite(final AutoSavingCache.Writer writer) { Runnable runnable = new WrappedRunnable() { public void runMayThrow() throws IOException { if (!AutoSavingCache.flushInProgress.compareAndSet(false, true)) { logger.debug("Cache flushing was already in progress: skipping {}", writer.getCompactionInfo()); return; } try { executor.beginCompaction(writer); try { writer.saveCache(); } finally { executor.finishCompaction(writer); } } finally { AutoSavingCache.flushInProgress.set(false); } } }; return executor.submit(runnable); } private static int getDefaultGcBefore(ColumnFamilyStore cfs) { return (int) (System.currentTimeMillis() / 1000) - cfs.metadata.getGcGraceSeconds(); } private static class ValidationCompactionIterator extends CompactionIterator { public ValidationCompactionIterator(ColumnFamilyStore cfs, Range range) throws IOException { super(CompactionType.VALIDATION, getCollatingIterator(cfs.getSSTables(), range), new CompactionController(cfs, cfs.getSSTables(), true, getDefaultGcBefore(cfs), false)); } protected static CollatingIterator getCollatingIterator(Iterable<SSTableReader> sstables, Range range) throws IOException { CollatingIterator iter = FBUtilities.getCollatingIterator(); for (SSTableReader sstable : sstables) { iter.addIterator(sstable.getDirectScanner(FILE_BUFFER_SIZE, range)); } return iter; } } public void checkAllColumnFamilies() throws IOException { // perform estimates for (final ColumnFamilyStore cfs : ColumnFamilyStore.all()) { Runnable runnable = new Runnable() { public void run () { logger.debug("Estimating compactions for " + cfs.columnFamily); final Set<List<SSTableReader>> buckets = getBuckets(convertSSTablesToPairs(cfs.getSSTables()), 50L * 1024L * 1024L); updateEstimateFor(cfs, buckets); } }; executor.submit(runnable); } // actually schedule compactions. done in a second pass so all the estimates occur before we // bog down the executor in actual compactions. for (ColumnFamilyStore cfs : ColumnFamilyStore.all()) { submitMinorIfNeeded(cfs); } } public int getActiveCompactions() { return executor.getActiveCount(); } private static class CompactionExecutor extends DebuggableThreadPoolExecutor { // a synchronized identity set of running tasks to their compaction info private final Set<CompactionInfo.Holder> compactions; public CompactionExecutor() { super(getThreadCount(), 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("CompactionExecutor", DatabaseDescriptor.getCompactionThreadPriority())); Map<CompactionInfo.Holder, Boolean> cmap = new IdentityHashMap<CompactionInfo.Holder, Boolean>(); compactions = Collections.synchronizedSet(Collections.newSetFromMap(cmap)); } private static int getThreadCount() { return Math.max(1, DatabaseDescriptor.getConcurrentCompactors()); } void beginCompaction(CompactionInfo.Holder ci) { compactions.add(ci); } void finishCompaction(CompactionInfo.Holder ci) { compactions.remove(ci); } public List<CompactionInfo.Holder> getCompactions() { return new ArrayList<CompactionInfo.Holder>(compactions); } } public List<CompactionInfo> getCompactions() { List<CompactionInfo> out = new ArrayList<CompactionInfo>(); for (CompactionInfo.Holder ci : executor.getCompactions()) out.add(ci.getCompactionInfo()); return out; } public List<String> getCompactionSummary() { List<String> out = new ArrayList<String>(); for (CompactionInfo.Holder ci : executor.getCompactions()) out.add(ci.getCompactionInfo().toString()); return out; } public int getPendingTasks() { int n = 0; for (Integer i : estimatedCompactions.values()) n += i; return (int) (executor.getTaskCount() - executor.getCompletedTaskCount()) + n; } public long getCompletedTasks() { return executor.getCompletedTaskCount(); } private static class SimpleFuture implements Future { private Runnable runnable; private SimpleFuture(Runnable r) { runnable = r; } public boolean cancel(boolean mayInterruptIfRunning) { throw new IllegalStateException("May not call SimpleFuture.cancel()"); } public boolean isCancelled() { return false; } public boolean isDone() { return runnable == null; } public Object get() throws InterruptedException, ExecutionException { runnable.run(); runnable = null; return runnable; } public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { throw new IllegalStateException("May not call SimpleFuture.get(long, TimeUnit)"); } } private static class EchoedRow extends AbstractCompactedRow { private final SSTableIdentityIterator row; public EchoedRow(SSTableIdentityIterator row) { super(row.getKey()); this.row = row; // Reset SSTableIdentityIterator because we have not guarantee the filePointer hasn't moved since the Iterator was built row.reset(); } public void write(DataOutput out) throws IOException { assert row.dataSize > 0; out.writeLong(row.dataSize); row.echoData(out); } public void update(MessageDigest digest) { // EchoedRow is not used in anti-entropy validation throw new UnsupportedOperationException(); } public boolean isEmpty() { return !row.hasNext(); } public int columnCount() { return row.columnCount; } } private static class CleanupInfo implements CompactionInfo.Holder { private final SSTableReader sstable; private final SSTableScanner scanner; public CleanupInfo(SSTableReader sstable, SSTableScanner scanner) { this.sstable = sstable; this.scanner = scanner; } public CompactionInfo getCompactionInfo() { try { return new CompactionInfo(sstable.descriptor.ksname, sstable.descriptor.cfname, CompactionType.CLEANUP, scanner.getFilePointer(), scanner.getFileLength()); } catch (Exception e) { throw new RuntimeException(); } } } private static class ScrubInfo implements CompactionInfo.Holder { private final BufferedRandomAccessFile dataFile; private final SSTableReader sstable; public ScrubInfo(BufferedRandomAccessFile dataFile, SSTableReader sstable) { this.dataFile = dataFile; this.sstable = sstable; } public CompactionInfo getCompactionInfo() { try { return new CompactionInfo(sstable.descriptor.ksname, sstable.descriptor.cfname, CompactionType.SCRUB, dataFile.getFilePointer(), dataFile.length()); } catch (Exception e) { throw new RuntimeException(); } } } }
[ "[email protected]@36054c91-6fe2-1485-663b-42a6e16799a3" ]
[email protected]@36054c91-6fe2-1485-663b-42a6e16799a3
bb219d772063e1933d640a1a150f25699666e97d
4479a44d222573148b2c37ca980bc0ccbc5c7e07
/src/Request_Message.java
ef442621cedcadb96138ad9622bff71e26a9404c
[]
no_license
BSJAIN92/IN4150_2
ffd9c8b1f586742c6b15883461275caf08678d61
38778fe15f1f38e2ddc1f5228c80c6009690de3a
refs/heads/master
2021-08-22T19:48:51.654857
2017-12-01T04:26:22
2017-12-01T04:26:22
112,664,869
0
0
null
null
null
null
UTF-8
Java
false
false
719
java
import java.io.Serializable; public class Request_Message implements Serializable { /* * source url */ private String sourceUrl; /* * index of source server */ private int sourceServerIndex; /* * clock of source server */ private int sourceClock; /* * Default Constructor */ public Request_Message(String sourceUrl, int sourceServerIndex, int sourceClock) { this.sourceUrl = sourceUrl; this.sourceServerIndex = sourceServerIndex; this.sourceClock = sourceClock; } public String getSourceUrl() { return this.sourceUrl; } public int getSourceServerIndex() { return this.sourceServerIndex; } public int getSourceClock() { return this.sourceClock; } }
8bedda8e630438f069fe220f59eec70c99124baf
de752b1dab1d9ed20c44e30ffa1ff887b868d2b0
/user/user-server/src/main/java/com/gapache/user/server/dao/repository/UserRepository.java
307f115afd3f9ea110e391bbc799224b56481ee9
[]
no_license
KeKeKuKi/IACAA30
33fc99ba3f1343240fe3fafe82bee01339273b80
6f3f6091b2ca6dd92f22b1697c0fbfc7b9b7d371
refs/heads/main
2023-04-07T21:18:49.105964
2021-04-08T08:41:57
2021-04-08T08:41:57
352,832,814
3
0
null
null
null
null
UTF-8
Java
false
false
491
java
package com.gapache.user.server.dao.repository; import com.gapache.jpa.BaseJpaRepository; import com.gapache.user.server.dao.entity.UserEntity; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; /** * @author HuSen * @since 2020/9/8 11:29 上午 */ public interface UserRepository extends BaseJpaRepository<UserEntity, Long>, JpaSpecificationExecutor<UserEntity> { boolean existsByUsername(String username); UserEntity findByUsername(String username); }
1b1392b06595e3b3b3223919a4581417eb602da7
c5eace7651044009fa1b74f362cab619a5b79027
/krusty-skeleton/src/main/java/krusty/ServerMain.java
404ae58f7d9ba663f47eb31f974ace410f2d85f7
[]
no_license
annamajken/krusty-kookies
4e2709aac7dc49a18710ae67d178f5283c576740
17141c088bd50d706d87accfaf264684d1b0f41b
refs/heads/main
2023-04-20T22:15:30.689483
2021-05-04T21:41:57
2021-05-04T21:41:57
342,835,864
0
1
null
null
null
null
UTF-8
Java
false
false
2,449
java
package krusty; import java.io.IOError; import java.io.IOException; import java.nio.charset.StandardCharsets; import static spark.Spark.*; public class ServerMain { public static int PORT = 8888; public static String API_ENTRYPOINT = "/api/v1"; private Database db; public void startServer() { staticFiles.location("/public"); db = new Database(); db.connect(); port(PORT); enableCORS(); initIndex(); initRoutes(); } private void initIndex() { try { byte[] indexData = getClass().getResource("/public/index.html").openStream().readAllBytes(); final String index = new String(indexData, StandardCharsets.UTF_8); get("/", (req, res) -> index); } catch (IOException e) { throw new IOError(e); } } private void initRoutes() { get(API_ENTRYPOINT + "/customers", (req, res) -> db.getCustomers(req, res)); get(API_ENTRYPOINT + "/raw-materials", (req, res) -> db.getRawMaterials(req, res)); get(API_ENTRYPOINT + "/cookies", (req, res) -> db.getCookies(req, res)); get(API_ENTRYPOINT + "/recipes", (req, res) -> db.getRecipes(req, res)); get(API_ENTRYPOINT + "/pallets", (req, res) -> db.getPallets(req, res)); post(API_ENTRYPOINT + "/reset", (req, res) -> db.reset(req, res)); post(API_ENTRYPOINT + "/pallets", (req, res) -> db.createPallet(req, res)); } public void stopServer() { stop(); } /** * Setup CORS, see: * - https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS * - http://sparkjava.com/tutorials/cors */ private void enableCORS() { options("/*", (request, response) -> { String accessControlRequestHeaders = request.headers("Access-Control-Request-Headers"); if (accessControlRequestHeaders != null) { response.header("Access-Control-Allow-Headers", accessControlRequestHeaders); } String accessControlRequestMethod = request.headers("Access-Control-Request-Method"); if (accessControlRequestMethod != null) { response.header("Access-Control-Allow-Methods", accessControlRequestMethod); } return "OK"; }); before((request, response) -> { response.header("Access-Control-Allow-Origin", "*"); response.header("Access-Control-Allow-Headers", "Content-Type, Accept"); response.type("application/json"); }); } public static void main(String[] args) throws InterruptedException { new ServerMain().startServer(); } }
0d072505cdbf25f2fbc46e2fbda1b0c11af61b41
6f7f0f022d0a696c25764f4f046e943dfeade7bc
/test_thread/src/com/fis/task/Task.java
36497fbfd8b94fbf8b868d7a4db2ead45aa9faf3
[]
no_license
yxzyh/firstIdeaProject
f6d1879c80dae6123c360a96ee9c850568798d15
74a5c21f75642cfbe255f4552319bdfec455bce4
refs/heads/master
2021-05-12T06:46:07.373217
2018-01-15T09:34:19
2018-01-15T09:34:19
117,225,220
0
0
null
null
null
null
UTF-8
Java
false
false
1,550
java
package com.fis.task; public class Task { /** * 1. (多线程)代码实现火车站4个卖票窗口同时买票的场景,输出示例: 窗口1卖票 窗口2卖票 窗口1卖票 ... 2. (线程同步)代码实现火车站4个窗口同时卖100张票的代码逻辑,同一个窗口不能卖同一 张张票。 3. (线程通信)小明打算去提款机上取钱,发现卡上没钱,这时候他告知妈妈去存钱,妈妈 存了钱了,告知小明存好了可以取钱了。(PS:小明分多次取钱,每次取100,当发现钱不够 100,就等待妈妈存钱,小明他妈每次存2000,当发现钱小于100就存钱,就存钱,并且 通知小明去取钱,当大于100就等待小明钱不够是再存) 4. (线程同步)设计四个线程对象对同一个数据进行操作,两个线程执行减操作,两个线程执行 加操作。 5. (线程通信)制作两个线程对象,要求用同步块的方式使第一个线程运行2次,然后将自己 阻塞起来,唤醒第二个线程,第二个线程再运行2次,然后将自己阻塞起来,唤醒第一个线 程……两个线程交替执行。 6. (线程同步)设计4个线程,其中两个线程每次对j增加1,另外两个线程对j每次减少1。 7. (线程通信)子线程循环10次,接着主线程循环100,接着又回到子线程循环10次,接着 再回到主线程又循环100,如此循环50次。 */ }
ebbd254b666d9379804d49e03ea3b8f3b1144fee
8cb1752acec0400400c0b33737e982f980a4eb9e
/aosp/android-4.0.1_r1/frameworks/base/core/tests/coretests/src/android/os/storage/AsecTests.java
5efbd88530609ff87430960163f655e4184728ec
[]
no_license
jollen/android-framework-mokoid
80c1698743dac66df0ba6ba9db480731386d92c0
1075260ce25d320a73a3519af686e615c044d9fe
refs/heads/master
2023-04-02T12:58:40.057364
2021-04-15T01:24:15
2021-04-15T01:24:34
6,413,284
29
16
null
null
null
null
UTF-8
Java
false
false
20,773
java
/* * Copyright (C) 2006 The Android Open Source Project * * 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 android.os.storage; import android.content.Context; import android.os.Environment; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.test.AndroidTestCase; import android.util.Log; import java.io.File; import java.io.FileOutputStream; import junit.framework.Assert; public class AsecTests extends AndroidTestCase { private static final boolean localLOGV = true; public static final String TAG="AsecTests"; void failStr(String errMsg) { Log.w(TAG, "errMsg="+errMsg); } void failStr(Exception e) { Log.w(TAG, "e.getMessage="+e.getMessage()); Log.w(TAG, "e="+e); } @Override protected void setUp() throws Exception { super.setUp(); if (localLOGV) Log.i(TAG, "Cleaning out old test containers"); cleanupContainers(); } @Override protected void tearDown() throws Exception { super.tearDown(); if (localLOGV) Log.i(TAG, "Cleaning out old test containers"); cleanupContainers(); } private void cleanupContainers() throws RemoteException { IMountService ms = getMs(); String[] containers = ms.getSecureContainerList(); for (int i = 0; i < containers.length; i++) { if (containers[i].startsWith("com.android.unittests.AsecTests.")) { ms.destroySecureContainer(containers[i], true); } } } private boolean containerExists(String localId) throws RemoteException { IMountService ms = getMs(); String[] containers = ms.getSecureContainerList(); String fullId = "com.android.unittests.AsecTests." + localId; for (int i = 0; i < containers.length; i++) { if (containers[i].equals(fullId)) { return true; } } return false; } private int createContainer(String localId, int size, String key) throws RemoteException { Assert.assertTrue(isMediaMounted()); String fullId = "com.android.unittests.AsecTests." + localId; IMountService ms = getMs(); return ms.createSecureContainer(fullId, size, "fat", key, android.os.Process.myUid()); } private int mountContainer(String localId, String key) throws RemoteException { Assert.assertTrue(isMediaMounted()); String fullId = "com.android.unittests.AsecTests." + localId; IMountService ms = getMs(); return ms.mountSecureContainer(fullId, key, android.os.Process.myUid()); } private int renameContainer(String localId1, String localId2) throws RemoteException { Assert.assertTrue(isMediaMounted()); String fullId1 = "com.android.unittests.AsecTests." + localId1; String fullId2 = "com.android.unittests.AsecTests." + localId2; IMountService ms = getMs(); return ms.renameSecureContainer(fullId1, fullId2); } private int unmountContainer(String localId, boolean force) throws RemoteException { Assert.assertTrue(isMediaMounted()); String fullId = "com.android.unittests.AsecTests." + localId; IMountService ms = getMs(); return ms.unmountSecureContainer(fullId, force); } private int destroyContainer(String localId, boolean force) throws RemoteException { Assert.assertTrue(isMediaMounted()); String fullId = "com.android.unittests.AsecTests." + localId; IMountService ms = getMs(); return ms.destroySecureContainer(fullId, force); } private boolean isContainerMounted(String localId) throws RemoteException { Assert.assertTrue(isMediaMounted()); String fullId = "com.android.unittests.AsecTests." + localId; IMountService ms = getMs(); return ms.isSecureContainerMounted(fullId); } private IMountService getMs() { IBinder service = ServiceManager.getService("mount"); if (service != null) { return IMountService.Stub.asInterface(service); } else { Log.e(TAG, "Can't get mount service"); } return null; } private boolean isMediaMounted() { try { String mPath = Environment.getExternalStorageDirectory().toString(); String state = getMs().getVolumeState(mPath); return Environment.MEDIA_MOUNTED.equals(state); } catch (RemoteException e) { failStr(e); return false; } } public void testCreateContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testCreateContainer", 4, "none")); Assert.assertEquals(true, containerExists("testCreateContainer")); } catch (Exception e) { failStr(e); } } public void testCreateMinSizeContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testCreateContainer", 1, "none")); Assert.assertEquals(true, containerExists("testCreateContainer")); } catch (Exception e) { failStr(e); } } public void testCreateZeroSizeContainer() { try { Assert.assertEquals(StorageResultCode.OperationFailedInternalError, createContainer("testCreateZeroContainer", 0, "none")); } catch (Exception e) { failStr(e); } } public void testCreateDuplicateContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testCreateDupContainer", 4, "none")); Assert.assertEquals(StorageResultCode.OperationFailedInternalError, createContainer("testCreateDupContainer", 4, "none")); } catch (Exception e) { failStr(e); } } public void testDestroyContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testDestroyContainer", 4, "none")); Assert.assertEquals(StorageResultCode.OperationSucceeded, destroyContainer("testDestroyContainer", false)); } catch (Exception e) { failStr(e); } } public void testMountContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testMountContainer", 4, "none")); Assert.assertEquals(StorageResultCode.OperationSucceeded, unmountContainer("testMountContainer", false)); Assert.assertEquals(StorageResultCode.OperationSucceeded, mountContainer("testMountContainer", "none")); } catch (Exception e) { failStr(e); } } public void testMountBadKey() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testMountBadKey", 4, "00000000000000000000000000000000")); Assert.assertEquals(StorageResultCode.OperationSucceeded, unmountContainer("testMountBadKey", false)); Assert.assertEquals(StorageResultCode.OperationFailedInternalError, mountContainer("testMountContainer", "000000000000000000000000000000001")); Assert.assertEquals(StorageResultCode.OperationFailedInternalError, mountContainer("testMountContainer", "none")); } catch (Exception e) { failStr(e); } } public void testNonExistPath() { IMountService ms = getMs(); try { String path = ms.getSecureContainerPath("jparks.broke.it"); failStr(path); } catch (IllegalArgumentException e) { } catch (Exception e) { failStr(e); } } public void testUnmountBusyContainer() { IMountService ms = getMs(); try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testUnmountBusyContainer", 4, "none")); String path = ms.getSecureContainerPath("com.android.unittests.AsecTests.testUnmountBusyContainer"); File f = new File(path, "reference"); FileOutputStream fos = new FileOutputStream(f); Assert.assertEquals(StorageResultCode.OperationFailedStorageBusy, unmountContainer("testUnmountBusyContainer", false)); fos.close(); Assert.assertEquals(StorageResultCode.OperationSucceeded, unmountContainer("testUnmountBusyContainer", false)); } catch (Exception e) { failStr(e); } } public void testDestroyBusyContainer() { IMountService ms = getMs(); try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testDestroyBusyContainer", 4, "none")); String path = ms.getSecureContainerPath("com.android.unittests.AsecTests.testDestroyBusyContainer"); File f = new File(path, "reference"); FileOutputStream fos = new FileOutputStream(f); Assert.assertEquals(StorageResultCode.OperationFailedStorageBusy, destroyContainer("testDestroyBusyContainer", false)); fos.close(); Assert.assertEquals(StorageResultCode.OperationSucceeded, destroyContainer("testDestroyBusyContainer", false)); } catch (Exception e) { failStr(e); } } public void testRenameContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testRenameContainer.1", 4, "none")); Assert.assertEquals(StorageResultCode.OperationSucceeded, unmountContainer("testRenameContainer.1", false)); Assert.assertEquals(StorageResultCode.OperationSucceeded, renameContainer("testRenameContainer.1", "testRenameContainer.2")); Assert.assertEquals(false, containerExists("testRenameContainer.1")); Assert.assertEquals(true, containerExists("testRenameContainer.2")); } catch (Exception e) { failStr(e); } } public void testRenameSrcMountedContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testRenameContainer.1", 4, "none")); Assert.assertEquals(StorageResultCode.OperationFailedStorageMounted, renameContainer("testRenameContainer.1", "testRenameContainer.2")); } catch (Exception e) { failStr(e); } } public void testRenameDstMountedContainer() { try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testRenameContainer.1", 4, "none")); Assert.assertEquals(StorageResultCode.OperationSucceeded, unmountContainer("testRenameContainer.1", false)); Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testRenameContainer.2", 4, "none")); Assert.assertEquals(StorageResultCode.OperationFailedStorageMounted, renameContainer("testRenameContainer.1", "testRenameContainer.2")); } catch (Exception e) { failStr(e); } } public void testContainerSize() { IMountService ms = getMs(); try { Assert.assertEquals(StorageResultCode.OperationSucceeded, createContainer("testContainerSize", 1, "none")); String path = ms.getSecureContainerPath("com.android.unittests.AsecTests.testUnmountBusyContainer"); byte[] buf = new byte[4096]; File f = new File(path, "reference"); FileOutputStream fos = new FileOutputStream(f); for (int i = 0; i < (1024 * 1024); i+= buf.length) { fos.write(buf); } fos.close(); } catch (Exception e) { failStr(e); } } /*------------ Tests for unmounting volume ---*/ public final long MAX_WAIT_TIME=120*1000; public final long WAIT_TIME_INCR=20*1000; boolean getMediaState() { try { String mPath = Environment.getExternalStorageDirectory().toString(); String state = getMs().getVolumeState(mPath); return Environment.MEDIA_MOUNTED.equals(state); } catch (RemoteException e) { return false; } } boolean mountMedia() { if (getMediaState()) { return true; } try { String mPath = Environment.getExternalStorageDirectory().toString(); int ret = getMs().mountVolume(mPath); return ret == StorageResultCode.OperationSucceeded; } catch (RemoteException e) { return false; } } class StorageListener extends StorageEventListener { String oldState; String newState; String path; private boolean doneFlag = false; public void action() { synchronized (this) { doneFlag = true; notifyAll(); } } public boolean isDone() { return doneFlag; } @Override public void onStorageStateChanged(String path, String oldState, String newState) { if (localLOGV) Log.i(TAG, "Storage state changed from " + oldState + " to " + newState); this.oldState = oldState; this.newState = newState; this.path = path; action(); } } private boolean unmountMedia() { if (!getMediaState()) { return true; } String path = Environment.getExternalStorageDirectory().toString(); StorageListener observer = new StorageListener(); StorageManager sm = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE); sm.registerListener(observer); try { // Wait on observer synchronized(observer) { getMs().unmountVolume(path, false, false); long waitTime = 0; while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) { observer.wait(WAIT_TIME_INCR); waitTime += WAIT_TIME_INCR; } if(!observer.isDone()) { throw new Exception("Timed out waiting for packageInstalled callback"); } return true; } } catch (Exception e) { return false; } finally { sm.unregisterListener(observer); } } public void testUnmount() { boolean oldStatus = getMediaState(); Log.i(TAG, "oldStatus="+oldStatus); try { // Mount media firsts if (!getMediaState()) { mountMedia(); } assertTrue(unmountMedia()); } finally { // Restore old status boolean currStatus = getMediaState(); if (oldStatus != currStatus) { if (oldStatus) { // Mount media mountMedia(); } else { unmountMedia(); } } } } class MultipleStorageLis extends StorageListener { int count = 0; public void onStorageStateChanged(String path, String oldState, String newState) { count++; super.action(); } } /* * This test invokes unmount multiple time and expects the call back * to be invoked just once. */ public void testUnmountMultiple() { boolean oldStatus = getMediaState(); StorageManager sm = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE); MultipleStorageLis observer = new MultipleStorageLis(); try { // Mount media firsts if (!getMediaState()) { mountMedia(); } String path = Environment.getExternalStorageDirectory().toString(); sm.registerListener(observer); // Wait on observer synchronized(observer) { for (int i = 0; i < 5; i++) { getMs().unmountVolume(path, false, false); } long waitTime = 0; while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) { observer.wait(WAIT_TIME_INCR); waitTime += WAIT_TIME_INCR; } if(!observer.isDone()) { failStr("Timed out waiting for packageInstalled callback"); } } assertEquals(observer.count, 1); } catch (Exception e) { failStr(e); } finally { sm.unregisterListener(observer); // Restore old status boolean currStatus = getMediaState(); if (oldStatus != currStatus) { if (oldStatus) { // Mount media mountMedia(); } else { unmountMedia(); } } } } class ShutdownObserver extends IMountShutdownObserver.Stub{ private boolean doneFlag = false; int statusCode; public void action() { synchronized (this) { doneFlag = true; notifyAll(); } } public boolean isDone() { return doneFlag; } public void onShutDownComplete(int statusCode) throws RemoteException { this.statusCode = statusCode; action(); } } boolean invokeShutdown() { IMountService ms = getMs(); ShutdownObserver observer = new ShutdownObserver(); synchronized (observer) { try { ms.shutdown(observer); return true; } catch (RemoteException e) { failStr(e); } } return false; } public void testShutdown() { boolean oldStatus = getMediaState(); try { // Mount media firsts if (!getMediaState()) { mountMedia(); } assertTrue(invokeShutdown()); } finally { // Restore old status boolean currStatus = getMediaState(); if (oldStatus != currStatus) { if (oldStatus) { // Mount media mountMedia(); } else { unmountMedia(); } } } } /* * This test invokes unmount multiple time and expects the call back * to be invoked just once. */ public void testShutdownMultiple() { boolean oldStatus = getMediaState(); try { // Mount media firsts if (!getMediaState()) { mountMedia(); } IMountService ms = getMs(); ShutdownObserver observer = new ShutdownObserver(); synchronized (observer) { try { ms.shutdown(observer); for (int i = 0; i < 4; i++) { ms.shutdown(null); } } catch (RemoteException e) { failStr(e); } } } finally { // Restore old status boolean currStatus = getMediaState(); if (oldStatus != currStatus) { if (oldStatus) { // Mount media mountMedia(); } else { unmountMedia(); } } } } }
f1968bcd6f09b363317d62d796b350de2ef38b1d
8609976e42491c0f6efbb9b3bf082a9b204b2f73
/src/cn/itcast/shop/categorysecond/dao/CategorySecondDao.java
2ebb6abce33a3ecf497b45a70cf52d624563d8da
[]
no_license
liyongchang/shop
c4e206fdd77c08d90ec5952e299fc1ed456466bf
d785a5f3bdfcb76ae53000bb3ea3d25b017d4801
refs/heads/master
2021-01-19T04:34:39.512576
2016-07-11T07:34:21
2016-07-11T07:34:21
63,044,881
0
0
null
null
null
null
UTF-8
Java
false
false
1,785
java
package cn.itcast.shop.categorysecond.dao; import cn.itcast.shop.categorysecond.vo.CategorySecond; import cn.itcast.shop.utils.PageHibernateCallback; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import java.util.List; /** * 二级分类的Dao层的代码 * * @author 传智.郭嘉 * */ public class CategorySecondDao extends HibernateDaoSupport { // DAO中的统计二级分类个数的方法 public int findCount() { String hql = "select count(*) from CategorySecond"; List<Long> list = this.getHibernateTemplate().find(hql); if (list != null && list.size() > 0) { return list.get(0).intValue(); } return 0; } // DAO中分页查询的方法 public List<CategorySecond> findByPage(int begin, int limit) { String hql = "from CategorySecond order by csid desc"; List<CategorySecond> list = this.getHibernateTemplate().execute( new PageHibernateCallback<CategorySecond>(hql, null, begin, limit)); return list; } // DAO中的保存二级分类的方法 public void save(CategorySecond categorySecond) { this.getHibernateTemplate().save(categorySecond); } // DAO中的删除二级分类的方法 public void delete(CategorySecond categorySecond) { this.getHibernateTemplate().delete(categorySecond); } // DAO中根据id查询二级分类的方法 public CategorySecond findByCsid(Integer csid) { return this.getHibernateTemplate().get(CategorySecond.class, csid); } // DAO中的修改二级分类的方法 public void update(CategorySecond categorySecond) { this.getHibernateTemplate().update(categorySecond); } // DAO中的查询所有二级分类的方法 public List<CategorySecond> findAll() { String hql = "from CategorySecond"; return this.getHibernateTemplate().find(hql); } }
8746829bd96459f8e94c41f26d7191ceca678e88
16f89faf08d59270e57ec83c390def525d081b39
/SampleAPIPrj/src/test/java/services/wsdlversion/SingleRunnerGetWSDL.java
da03a625a32ff829666e0a1eacfd5e8854ae3368
[]
no_license
pranesh517/karateAPI
d148270cdfc1dd292be46cd12e716afd9be975f6
7dd156f48815c33c432a040a5b831f269bd778ee
refs/heads/main
2023-01-06T12:36:35.422148
2020-10-29T11:32:48
2020-10-29T11:32:48
308,299,889
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package services.wsdlversion; import org.junit.runner.RunWith; import com.intuit.karate.KarateOptions; import com.intuit.karate.junit4.Karate; @RunWith(Karate.class) @KarateOptions(features = "classpath:services/wsdlversion/API_GetWsdlVersion.feature") public class SingleRunnerGetWSDL { }
a1d6dfed9a4575c59a105fe84b286db16594b9c6
4fe106927ff1bf6274b61c1a1ec00671514c5ce3
/src/com/chinasofti/util/jdbc/template/specialsqloperation/OracleSpecialOperation.java
3f5d654436aecdb2dd4a0e9f6f1e44b407c34791
[]
no_license
Cass-D/OrderSys
e96438a91ff600a15413b6613c91880e171e3ffa
ce95719a4d1366cb3beb35402beb6c312dd04195
refs/heads/master
2021-01-20T15:50:50.274821
2016-08-06T14:17:04
2016-08-06T14:17:04
65,085,832
1
0
null
null
null
null
GB18030
Java
false
false
3,413
java
/** * Copyright 2015 ChinaSoft International Ltd. All rights reserved. */ package com.chinasofti.util.jdbc.template.specialsqloperation; import java.sql.PreparedStatement; /** * <p> * Title: OracleSpecialOperation * </p> * <p> * Description:Oracle数据库特定操作抽象 * </p> * <p> * Copyright: Copyright (c) 2015 * </p> * <p> * Company: ChinaSoft International Ltd. * </p> * * @author etc * @version 1.0 */ public class OracleSpecialOperation extends SpecialSQLOperation { /** * 获取特定TopN操作SQL语句的方法 * * @param initialSQL * 初始化SQL语句 * @param hasOffset * 是否支持offSet操作 * @return 获取到的特定TopN操作语句 * */ @Override public String getTopNSQL(String initialSQL, boolean hasOffset) { // TODO Auto-generated method stub // 移出初始化SQL语句前后的无用空白 initialSQL = initialSQL.trim(); // 初始化SQL语句中是否有for update子句 boolean isForUpdate = false; // 判定初始化SQL语句中是否有for update子句 if (initialSQL.toLowerCase().endsWith(" for update")) { // 删除for update子句 initialSQL = initialSQL.substring(0, initialSQL.length() - 11); // 保存for update子句状态 isForUpdate = true; } // 创建目标SQL语句字符串缓冲区 StringBuffer pagingSelect = new StringBuffer(initialSQL.length() + 200); // 如果有offSet信息 if (hasOffset) { // 添加rownum伪列信息 pagingSelect .append("select * from ( select row_.*, rownum rownum_ from ( "); // 如果没有offset信息 } else { // 直接查询目标表格 pagingSelect.append("select * from ( "); } // 将初始化查询作为临时视图查询目标 pagingSelect.append(initialSQL); // 如果有offset if (hasOffset) { // 添加offset条件 pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?"); // 如果没有offset } else { // 只规定查询的最大条目数 pagingSelect.append(" ) where rownum <= ?"); } // 如果存在for update子句 if (isForUpdate) { // 补全for update子句 pagingSelect.append(" for update"); } // 返回结果SQL语句 return pagingSelect.toString(); } /** * 设置TopN查询操作特殊参数信息 * * @param topNStatement * 预编译语句对象 * @param args * 查询语句对应的参数 * @param offset * 查询的offset值 * @param size * 单次查询返回的最大条目值 * @return 设置参数后的预编译语句对象 * */ @Override public PreparedStatement setTopNQueryParameter( PreparedStatement topNStatement, Object[] args, int offset, int size) { // TODO Auto-generated method stub // 尝试设置参数 try { // 遍历参数值 for (int i = 0; i < args.length; i++) { // 为相应的占位符设置对应的值 topNStatement.setObject(i + 1, args[i]); } // 设置每页最大条目数参数 topNStatement.setObject(args.length + 1, size + size); // 设置offset参数 topNStatement.setObject(args.length + 2, offset); // TODO Auto-generated method stub // 返回设置参数后的预编译语句对象 return topNStatement; // 捕获异常 } catch (Exception e) { // 输出异常信息 e.printStackTrace(); // 返回null return null; // TODO: handle exception } } }
c8becc44d6454ca96b9c095bca67aab5d535d4f1
af50c50851d5027fafaf084c105397cf8cc3d07f
/src/SimpleFactory/Fruit.java
c855546ada46551abaadd18c79a5f51b1d557fea
[]
no_license
LYQkeke/DesignPatternsInJava
cf63a51c06d4b3334996e08780fb7df7ad8c8b05
bc620c773613cde8426375be0ca895866eb7180d
refs/heads/master
2020-05-20T20:13:19.256978
2019-05-15T09:23:28
2019-05-15T09:23:28
185,739,466
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package SimpleFactory; /** * Created by KEKE on 2019/5/9 */ public interface Fruit { /** * 采集 */ void get(); }
c3af9313e3074442f8a02f9ee0611d020700c41e
818fc566816ea6ff7a3c3ef756d08095037eccc3
/banner/src/main/java/com/marsthink/banner/transformer/ZoomOutTranformer.java
10e91146f791cb9e8de9133b3e39d193380337aa
[]
no_license
woshizmxin/banner
b93b624f89cf7ef7cbf025c5855ffda1d6b03d8b
0a6dc49bdaecc6a4b1047b0344e88b3d2684e79d
refs/heads/master
2021-01-22T02:25:12.459018
2017-05-26T09:22:11
2017-05-26T09:22:11
92,360,857
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
/* * Copyright (c) 2016 Meituan Inc. * * The right to copy, distribute, modify, or otherwise make use * of this software may be licensed only pursuant to the terms * of an applicable Meituan license agreement. * */ package com.marsthink.banner.transformer; import android.view.View; public class ZoomOutTranformer extends ABaseTransformer { @Override protected void onTransform(View view, float position) { final float scale = 1f + Math.abs(position); view.setScaleX(scale); view.setScaleY(scale); view.setPivotX(view.getWidth() * 0.5f); view.setPivotY(view.getHeight() * 0.5f); view.setAlpha(position < -1f || position > 1f ? 0f : 1f - (scale - 1f)); if(position == -1){ view.setTranslationX(view.getWidth() * -1); } } }
3ce38256238917f31058e9701eab76d87482c32b
41848f87199b44077424597315e1d67a6dd5ff80
/app/src/main/java/com/anshi/hjsign/PlaybackVideoFragment.java
30f73bb063982bc0152a6ae99bb4bc56fe22acd2
[]
no_license
yulu1121/HJSign
0b433adb15b3e18fe46df9c4588e24b2e3e3bb67
635915217f2feeec50208bae0c5520ffc3749c1c
refs/heads/master
2020-03-25T19:37:32.877364
2018-08-17T01:07:04
2018-08-17T01:07:04
144,092,090
0
0
null
null
null
null
UTF-8
Java
false
false
2,326
java
/* * Copyright (C) 2017 The Android Open Source Project * * 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.anshi.hjsign; import android.net.Uri; import android.os.Bundle; import android.support.v17.leanback.app.VideoSupportFragment; import android.support.v17.leanback.app.VideoSupportFragmentGlueHost; import android.support.v17.leanback.media.MediaPlayerAdapter; import android.support.v17.leanback.media.PlaybackTransportControlGlue; import android.support.v17.leanback.widget.PlaybackControlsRow; /** * Handles video playback with media controls. */ public class PlaybackVideoFragment extends VideoSupportFragment { private PlaybackTransportControlGlue<MediaPlayerAdapter> mTransportControlGlue; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Movie movie = (Movie) getActivity().getIntent().getSerializableExtra(DetailsActivity.MOVIE); VideoSupportFragmentGlueHost glueHost = new VideoSupportFragmentGlueHost(PlaybackVideoFragment.this); MediaPlayerAdapter playerAdapter = new MediaPlayerAdapter(getActivity()); playerAdapter.setRepeatAction(PlaybackControlsRow.RepeatAction.INDEX_NONE); mTransportControlGlue = new PlaybackTransportControlGlue<>(getActivity(), playerAdapter); mTransportControlGlue.setHost(glueHost); mTransportControlGlue.setTitle(movie.getTitle()); mTransportControlGlue.setSubtitle(movie.getDescription()); mTransportControlGlue.playWhenPrepared(); playerAdapter.setDataSource(Uri.parse(movie.getVideoUrl())); } @Override public void onPause() { super.onPause(); if (mTransportControlGlue != null) { mTransportControlGlue.pause(); } } }
f356c68bd296fed60185327c75d5e3a11737a6a2
a2afeb121e60dd889621d4ab6d719fd613f2a56a
/src/zadatak13/Zadatak13.java
e353d58a41fbd1034aef8852f7235f138349d753
[]
no_license
erazmojava/JavaPrograming
117686ee5ec7f382a20713f75b9cc51b6f80ddb8
c16c52a5e3999eabf95fbb3dcc8ffa9e60be5f7e
refs/heads/master
2020-12-30T12:54:39.262463
2017-06-21T17:30:03
2017-06-21T17:30:03
91,361,361
0
0
null
null
null
null
UTF-8
Java
false
false
86
java
package zadatak13; /** * Created by osman on 6/5/17. */ public class Zadatak13 { }
4fc14ebaa0fbf1ac447995a1c28a80887dc78838
896797a503200c39cdd67bc93474d34bfac2a2cc
/.history/src/main/java/fr/romgrm/Game_20201106173009.java
0a54202a4e2f86197b14d9dcce989ba5c0c10062
[]
no_license
romgrm/jeuDuMorpion
35c289c8bb2720925512c05db76cea55d9ffd710
290f555627989d7223aaa6df8f55adc728d88182
refs/heads/master
2023-01-11T00:56:58.678606
2020-11-11T11:32:23
2020-11-11T11:32:23
310,265,753
0
0
null
null
null
null
UTF-8
Java
false
false
3,576
java
package fr.romgrm; import java.util.Scanner; public class Game { Planche planche; // J'apelle ma class Planche pour avoir une vue dessus Player joueur_1 = new Player("Joueur 1", 'X'); // je créer l'instance de mon joueur 1 Player joueur_2 = new Player("Joueur 2", 'O'); // je créer l'instance de mon joueur 2 Planche plancheDeJeu = new Planche(); // je créer l'instance de ma grille de morpion /****************************************************** CREATION DE LA PARTIE ***************************************************************/ public void newGame(){ System.out.println("Commençons une partie de Morpion !"); // je veux afficher la planche de morpion // je dois donc créer une class planche de jeu et l'afficher ici System.out.println("\n" + "Voici la planche de jeu"); plancheDeJeu.display(); System.out.println("\n" + this.joueur_1.getNomDuJoueur() + " tu auras le symbole : " + this.joueur_1.getSymbolJoueur() + "\n" + "Quant à toi " + this.joueur_2.getNomDuJoueur() + " tu auras le symbole : " + this.joueur_2.getSymbolJoueur()); } /**************************************************************************************************************************************************/ /*************************************** LANCEMENT DE LA PARTIE ************************************************/ public void play(){ /* Boucle pour continuer de joueur tant que la partie n'est pas gagnée */ while (joueur_1.win(this.plancheDeJeu.grilleDeMorpion) != true) { /* Condition a chq tour pour voir si un joueur a gagné */ if(joueur_1.win(this.plancheDeJeu.grilleDeMorpion) == true){ System.out.println(this.joueur_1.getNomDuJoueur() + " a gagné la partie !"); }else if(joueur_2.win(this.plancheDeJeu.grilleDeMorpion) == true){ System.out.println(this.joueur_2.getNomDuJoueur() + " a gagné la partie !"); }else{ System.out.println("Egalité parfaite !"); } } /* Tour du Joueur_1 */ System.out.println("C'est à ton tour" + this.joueur_1.getNomDuJoueur() + " , entre un nombre pour choisir une ligne : "); Scanner scan = new Scanner(System.in); int entreeRow = scan.nextInt(); System.out.println("Maintenant, entre un nombre pour choisir la colonne : "); int entreeColumn = scan.nextInt(); /***************************************/ /* Envoie des données à notre instance de grille de morpion */ this.plancheDeJeu.fill(this.joueur_1.symbolJoueur , entreeRow, entreeColumn); this.plancheDeJeu.display(); /***************************************/ /* Tour du Joueur_2 */ System.out.println("C'est à ton tour joueur 2, entre un nombre pour choisir une ligne : "); Scanner scan2 = new Scanner(System.in); int entreeRow2 = scan.nextInt(); System.out.println("Maintenant, entre un nombre pour choisir la colonne : "); int entreeColumn2 = scan.nextInt(); this.plancheDeJeu.fill(this.joueur_2.symbolJoueur , entreeRow2, entreeColumn2); this.plancheDeJeu.display(); /***************************************/ //joueur_1.win(this.plancheDeJeu.grilleDeMorpion); } /*****************************************************************************************************************/ }
fbcfcb73e4f13e700015c707e35cfe770c7d2f41
e7c75550524f50a404cc6fa30fa72d67f71af420
/ConcesionarioCoches/ConcesionarioCoches/utiles/Teclado.java
3cf1266025e6a0c40fbbf6d2b7c35fecca7e3e1e
[]
no_license
DavidPeralvo/Concesionario-de-Coches
98a352f60e31de65484a6d8246ca0fd4c1605977
29fecfbc873a8ea82afbfed4465b768a4728315a
refs/heads/master
2020-06-01T13:38:11.990692
2015-05-17T17:45:08
2015-05-17T17:45:08
35,773,001
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
2,290
java
package utiles; import java.io.BufferedReader; import java.io.InputStreamReader; /** * Permite lectura desde teclado */ public class Teclado { /** * Lee un carácter del teclado * * @return carácter introducido por el usuario */ public static char leerCaracter() { char caracter; try { caracter = leerCadena().charAt(0); } catch (Exception e) { caracter = 0; } return caracter; } /** * Lee un carácter del teclado * * @param msj * mensaje mostrado al usuario * @return carácter introducido por el usuario */ public static char leerCaracter(String msj) { System.out.println(msj); return leerCaracter(); } /** * Lee una cadena del teclado * * @param msj * mensaje mostrado al usuario * @return cadena introducida por el usuario */ public static String leerCadena(String msj) { System.out.println(msj); return leerCadena(); } /** * Lee una cadena del teclado * * @return cadena introducida por el usuario */ public static String leerCadena() { BufferedReader bReader = new BufferedReader(new InputStreamReader( System.in)); String cadena; try { cadena = bReader.readLine(); } catch (Exception e) { cadena = ""; } return cadena; } /** * Lee un entero del teclado * * * @return entero introducido por el usuario */ public static int leerEntero() { int x; try { x = Integer.parseInt(leerCadena().trim()); } catch (Exception e) { x = 0; } return x; } /** * Lee una entero del teclado * * @param msj * mensaje mostrado al usuario * @return entero introducida por el usuario */ public static int leerEntero(String msj) { System.out.println(msj); return leerEntero(); } /** * Lee un decimal del teclado * * @return decimal introducido por el usuario */ public static double leerDecimal() { double x; try { x = Double.parseDouble(leerCadena().trim()); } catch (Exception e) { x = 0; } return x; } /** * Lee una decimal del teclado * * @param msj * mensaje mostrado al usuario * @return decimal introducida por el usuario */ public static double leerDecimal(String msj) { System.out.println(msj); return leerDecimal(); } }
9bd0277ae94b84246ba64b03f33041e4b1f94136
280fcf363fd1e56da910a676835fdc5d1d17ecac
/SpringSecurity01/src/main/java/com/springsecurity01/dto/NoteDTO.java
a7ed6f08223058a26ed5222106344d0ef1645455
[]
no_license
MyNameIsToan/Repository12102021
7af23ac490f221252ffcbcf24a6e10b92cad5f79
8e35fcb00ab6d128735bdc3303bbe1ff781d7df5
refs/heads/main
2023-08-10T15:59:08.468450
2021-10-12T09:45:30
2021-10-12T09:45:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package com.springsecurity01.dto; import lombok.Data; @Data public class NoteDTO { private Long id; private Long parentid; private String content; private String username; private int haschild; private int isfinish; }
8df3da9e37045928d7e398cab89cfc4579384fd8
8f92ea8f594a2f7624ff09d392fe0cea13878dcd
/src/TestNG/Sample.java
78f7716eb14e354fa4ac917aebbe383f4eb03918
[]
no_license
vasanreddy/Selenium
d33585ddfbd6d6a9cb8c00c86aebc7eb06e0094e
d1540c966643661662dbe27a8d94d660bc57a6f1
refs/heads/master
2021-08-14T08:45:35.984917
2017-11-15T05:18:33
2017-11-15T05:18:33
110,787,722
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package TestNG; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; public class Sample { public static void main(String[] args) { // TODO Auto-generated method stub FirefoxProfile profile=new FirefoxProfile(); profile.setAcceptUntrustedCertificates(false); WebDriver driver=new FirefoxDriver(profile); } }
a59db9997a76f8ac695d451ff8af8eace4f1d5ec
68d0db8809f41f2258418ab1051b51298ab1f4f0
/components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewPlayerTest.java
654f1237774bfd5b578b77714a12a1964f6bc7fb
[ "BSD-3-Clause" ]
permissive
nemux000/chromium
28d7688138c7b6a41210f6def0bde7791710723f
9b62934f4c7b14c8680fd788c19c80c4ec67717d
refs/heads/master
2022-11-25T02:25:32.920431
2020-07-30T14:47:51
2020-07-30T14:47:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,892
java
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.components.paintpreview.player; import android.graphics.Rect; import android.os.Build.VERSION_CODES; import android.support.test.InstrumentationRegistry; import android.support.test.uiautomator.By; import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.UiObject2; import android.util.Size; import android.view.View; import android.view.ViewGroup; import androidx.test.filters.MediumTest; import org.hamcrest.Matchers; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.chromium.base.task.PostTask; import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.ScalableTimeout; import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.ui.test.util.DummyUiActivityTestCase; import org.chromium.url.GURL; import java.util.List; /** * Instrumentation tests for the Paint Preview player. */ @RunWith(BaseJUnit4ClassRunner.class) public class PaintPreviewPlayerTest extends DummyUiActivityTestCase { private static final long TIMEOUT_MS = ScalableTimeout.scaleTimeout(5000); private static final String TEST_DIRECTORY_KEY = "test_dir"; private static final String TEST_URL = "https://www.chromium.org"; private static final String TEST_IN_VIEWPORT_LINK_URL = "http://www.google.com/"; private static final String TEST_OUT_OF_VIEWPORT_LINK_URL = "http://example.com/"; private final Rect mInViewportLinkRect = new Rect(700, 650, 900, 700); private final Rect mOutOfViewportLinkRect = new Rect(300, 4900, 450, 5000); private static final int TEST_PAGE_WIDTH = 1082; private static final int TEST_PAGE_HEIGHT = 5019; @Rule public PaintPreviewTestRule mPaintPreviewTestRule = new PaintPreviewTestRule(); @Rule public TemporaryFolder mTempFolder = new TemporaryFolder(); private PlayerManager mPlayerManager; private TestLinkClickHandler mLinkClickHandler; private CallbackHelper mRefreshedCallback; private boolean mInitializationFailed; /** * LinkClickHandler implementation for caching the last URL that was clicked. */ public class TestLinkClickHandler implements LinkClickHandler { GURL mUrl; @Override public void onLinkClicked(GURL url) { mUrl = url; } } @Override public void tearDownTest() throws Exception { super.tearDownTest(); CallbackHelper destroyed = new CallbackHelper(); PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { mPlayerManager.destroy(); destroyed.notifyCalled(); }); destroyed.waitForFirst(); } private void displayTest(boolean multipleFrames) { initPlayerManager(multipleFrames); final View playerHostView = mPlayerManager.getView(); final View activityContentView = getActivity().findViewById(android.R.id.content); // Assert that the player view has the same dimensions as the content view. CriteriaHelper.pollUiThread(() -> { Criteria.checkThat(activityContentView.getWidth(), Matchers.greaterThan(0)); Criteria.checkThat(activityContentView.getHeight(), Matchers.greaterThan(0)); Criteria.checkThat( activityContentView.getWidth(), Matchers.is(playerHostView.getWidth())); Criteria.checkThat( activityContentView.getHeight(), Matchers.is(playerHostView.getHeight())); }, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL); } /** * Tests the the player correctly initializes and displays a sample paint preview with 1 frame. */ @Test @MediumTest public void singleFrameDisplayTest() { displayTest(false); } /** * Tests the player correctly initializes and displays a sample paint preview with multiple * frames. */ @Test @MediumTest public void multiFrameDisplayTest() { displayTest(true); } /** * Tests that link clicks in the player work correctly. */ @Test @MediumTest @DisableIf.Build(message = "Test is failing on Android P, see crbug.com/1110939.", sdk_is_greater_than = VERSION_CODES.O_MR1, sdk_is_less_than = VERSION_CODES.Q) public void linkClickTest() { initPlayerManager(false); final View playerHostView = mPlayerManager.getView(); // Click on a link that is visible in the default viewport. assertLinkUrl(playerHostView, 720, 670, TEST_IN_VIEWPORT_LINK_URL); assertLinkUrl(playerHostView, 880, 675, TEST_IN_VIEWPORT_LINK_URL); assertLinkUrl(playerHostView, 800, 680, TEST_IN_VIEWPORT_LINK_URL); // Scroll to the bottom, and click on a link. scrollToBottom(); assertLinkUrl(playerHostView, 320, 4920, TEST_OUT_OF_VIEWPORT_LINK_URL); assertLinkUrl(playerHostView, 375, 4950, TEST_OUT_OF_VIEWPORT_LINK_URL); assertLinkUrl(playerHostView, 430, 4980, TEST_OUT_OF_VIEWPORT_LINK_URL); } @Test @MediumTest public void nestedLinkClickTest() throws Exception { initPlayerManager(true); final View playerHostView = mPlayerManager.getView(); assertLinkUrl(playerHostView, 220, 220, TEST_IN_VIEWPORT_LINK_URL); assertLinkUrl(playerHostView, 300, 270, TEST_IN_VIEWPORT_LINK_URL); UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); int deviceHeight = device.getDisplayHeight(); int statusBarHeight = statusBarHeight(); int navigationBarHeight = navigationBarHeight(); int padding = 20; int fromY = deviceHeight - navigationBarHeight - padding; int toY = statusBarHeight + padding; mLinkClickHandler.mUrl = null; device.swipe(300, fromY, 300, toY, 10); // Manually click as assertLinkUrl() doesn't handle subframe scrolls well. assertLinkUrl(playerHostView, 200, 1500, TEST_OUT_OF_VIEWPORT_LINK_URL); } @Test @MediumTest public void overscrollRefreshTest() throws Exception { initPlayerManager(true); UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); int deviceHeight = uiDevice.getDisplayHeight(); int statusBarHeight = statusBarHeight(); int navigationBarHeight = navigationBarHeight(); int padding = 20; int toY = deviceHeight - navigationBarHeight - padding; int fromY = statusBarHeight + padding; uiDevice.swipe(50, fromY, 50, toY, 5); mRefreshedCallback.waitForFirst(); } /** * Tests that an initialization failure is reported properly. */ @Test @MediumTest public void initializationCallbackErrorReported() throws Exception { CallbackHelper compositorErrorCallback = new CallbackHelper(); mLinkClickHandler = new TestLinkClickHandler(); PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { PaintPreviewTestService service = new PaintPreviewTestService(mTempFolder.getRoot().getPath()); // Use the wrong URL to simulate a failure. mPlayerManager = new PlayerManager(new GURL("about:blank"), getActivity(), service, TEST_DIRECTORY_KEY, mLinkClickHandler, () -> { Assert.fail("Unexpected overscroll refresh attempted."); }, () -> { Assert.fail("View Ready callback occurred, but expected a failure."); }, null, 0xffffffff, () -> { compositorErrorCallback.notifyCalled(); }, false); mPlayerManager.setCompressOnClose(false); }); compositorErrorCallback.waitForFirst(); } private void scaleSmokeTest(boolean multiFrame) throws Exception { initPlayerManager(multiFrame); UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); // Query all FrameLayout objects as the PlayerFrameView isn't recognized. List<UiObject2> objects = device.findObjects(By.clazz("android.widget.FrameLayout")); int viewAxHashCode = mPlayerManager.getView().createAccessibilityNodeInfo().hashCode(); boolean didPinch = false; for (UiObject2 object : objects) { // To ensure we only apply the gesture to the right FrameLayout we compare the hash // codes of the underlying accessibility nodes which are equivalent for the same // view. Hence we can avoid the lack of direct access to View objects from UiAutomator. if (object.hashCode() != viewAxHashCode) continue; // Just zoom in and out. The goal here is to just exercise the zoom pathway and ensure // it doesn't smoke when driven by gestures. There are more comprehensive tests for this // in PlayerFrameMediatorTest and PlayerFrameScaleController. object.pinchOpen(0.3f); object.pinchClose(0.2f); object.pinchClose(0.1f); didPinch = true; } Assert.assertTrue("Failed to pinch player view.", didPinch); } /** * Tests that scaling works and doesn't crash. */ @Test @MediumTest public void singleFrameScaleSmokeTest() throws Exception { scaleSmokeTest(false); } /** * Tests that scaling works and doesn't crash with multiple frames. */ @Test @MediumTest public void multiFrameScaleSmokeTest() throws Exception { scaleSmokeTest(true); } private int statusBarHeight() { Rect visibleContentRect = new Rect(); getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleContentRect); return visibleContentRect.top; } private int navigationBarHeight() { int navigationBarHeight = 100; int resourceId = getActivity().getResources().getIdentifier( "navigation_bar_height", "dimen", "android"); if (resourceId > 0) { navigationBarHeight = getActivity().getResources().getDimensionPixelSize(resourceId); } return navigationBarHeight; } /** * Scrolls to the bottom fo the paint preview. */ private void scrollToBottom() { UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); int deviceHeight = uiDevice.getDisplayHeight(); int statusBarHeight = statusBarHeight(); int navigationBarHeight = navigationBarHeight(); int padding = 20; int swipeSteps = 5; int viewPortBottom = deviceHeight - statusBarHeight - navigationBarHeight; int fromY = deviceHeight - navigationBarHeight - padding; int toY = statusBarHeight + padding; int delta = fromY - toY; while (viewPortBottom < scaleAbsoluteCoordinateToViewCoordinate(TEST_PAGE_HEIGHT)) { uiDevice.swipe(50, fromY, 50, toY, swipeSteps); viewPortBottom += delta; } // Repeat an addition time to avoid flakiness. uiDevice.swipe(50, fromY, 50, toY, swipeSteps); } private void initSingleSkp(PaintPreviewTestService service) { FrameData singleFrame = new FrameData(new Size(TEST_PAGE_WIDTH, TEST_PAGE_HEIGHT), new Rect[] {mInViewportLinkRect, mOutOfViewportLinkRect}, new String[] {TEST_IN_VIEWPORT_LINK_URL, TEST_OUT_OF_VIEWPORT_LINK_URL}, new Rect[] {}, new FrameData[] {}); Assert.assertTrue(service.createFramesForKey(TEST_DIRECTORY_KEY, TEST_URL, singleFrame)); } private void initMultiSkp(PaintPreviewTestService service) { // This creates a frame tree of the form // // Main // / \ // A B // | | // C D // // A: Doesn't scroll contains a nested c // B: Scrolls contains a nested d out of frame // C: Doesn't scroll // D: Scrolls FrameData childD = new FrameData(new Size(300, 500), new Rect[] {}, new String[] {}, new Rect[] {}, new FrameData[] {}); FrameData childB = new FrameData(new Size(900, 3000), new Rect[] {new Rect(50, 2300, 250, 2800)}, new String[] {TEST_OUT_OF_VIEWPORT_LINK_URL}, new Rect[] {new Rect(50, 2000, 150, 2100)}, new FrameData[] {childD}); // Link is located at 200, 200. FrameData childC = new FrameData(new Size(400, 200), new Rect[] {new Rect(50, 50, 300, 200)}, new String[] {TEST_IN_VIEWPORT_LINK_URL}, new Rect[] {}, new FrameData[] {}); FrameData childA = new FrameData(new Size(500, 300), new Rect[] {}, new String[] {}, new Rect[] {new Rect(50, 50, 450, 250)}, new FrameData[] {childC}); FrameData rootFrame = new FrameData(new Size(TEST_PAGE_WIDTH, TEST_PAGE_HEIGHT), new Rect[] {mInViewportLinkRect, mOutOfViewportLinkRect}, new String[] {TEST_IN_VIEWPORT_LINK_URL, TEST_OUT_OF_VIEWPORT_LINK_URL}, new Rect[] {new Rect(100, 100, 600, 400), new Rect(50, 1000, 900, 2000)}, new FrameData[] {childA, childB}); Assert.assertTrue(service.createFramesForKey(TEST_DIRECTORY_KEY, TEST_URL, rootFrame)); } private void initPlayerManager(boolean multiSkp) { mLinkClickHandler = new TestLinkClickHandler(); mRefreshedCallback = new CallbackHelper(); CallbackHelper viewReady = new CallbackHelper(); mInitializationFailed = false; PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { PaintPreviewTestService service = new PaintPreviewTestService(mTempFolder.getRoot().getPath()); if (multiSkp) { initMultiSkp(service); } else { initSingleSkp(service); } mPlayerManager = new PlayerManager(new GURL(TEST_URL), getActivity(), service, TEST_DIRECTORY_KEY, mLinkClickHandler, mRefreshedCallback::notifyCalled, viewReady::notifyCalled, null, 0xffffffff, () -> { mInitializationFailed = true; }, false); mPlayerManager.setCompressOnClose(false); getActivity().setContentView(mPlayerManager.getView()); }); // Wait until PlayerManager is initialized. CriteriaHelper.pollUiThread(() -> { Criteria.checkThat( "PlayerManager was not initialized.", mPlayerManager, Matchers.notNullValue()); }, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL); try { viewReady.waitForFirst(); } catch (Exception e) { if (mInitializationFailed) { Assert.fail("Compositor intialization failed."); } else { Assert.fail("View ready was not called."); } } // Assert that the player view is added to the player host view. CriteriaHelper.pollUiThread(() -> { Criteria.checkThat("Player view is not added to the host view.", ((ViewGroup) mPlayerManager.getView()).getChildCount(), Matchers.greaterThan(0)); }, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL); CriteriaHelper.pollUiThread(() -> { Criteria.checkThat("Required bitmaps were not loaded.", mPlayerManager.checkRequiredBitmapsLoadedForTest(), Matchers.is(true)); }, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL); if (mInitializationFailed) { Assert.fail("Compositor may have crashed."); } } /* * Scales the provided coordinate to be view relative */ private int scaleAbsoluteCoordinateToViewCoordinate(int coordinate) { float scaleFactor = (float) mPlayerManager.getView().getWidth() / (float) TEST_PAGE_WIDTH; return Math.round((float) coordinate * scaleFactor); } /* * Asserts that the expectedUrl is found in the view at absolute coordinates x and y. */ private void assertLinkUrl(View view, int x, int y, String expectedUrl) { int scaledX = scaleAbsoluteCoordinateToViewCoordinate(x); int scaledY = scaleAbsoluteCoordinateToViewCoordinate(y); // In this test scaledY will only exceed the view height if scrolled to the bottom of a // page. if (scaledY > view.getHeight()) { scaledY = view.getHeight() - (scaleAbsoluteCoordinateToViewCoordinate(TEST_PAGE_HEIGHT) - scaledY); } mLinkClickHandler.mUrl = null; int[] locationXY = new int[2]; view.getLocationOnScreen(locationXY); UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); device.click(scaledX + locationXY[0], scaledY + locationXY[1]); CriteriaHelper.pollUiThread(() -> { GURL url = mLinkClickHandler.mUrl; String msg = "Link press on abs (" + x + ", " + y + ") failed."; Criteria.checkThat(msg, url, Matchers.notNullValue()); Criteria.checkThat(msg, url.getSpec(), Matchers.is(expectedUrl)); }, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL); } }
1af21338c3e3eb7a33e8fb03af3a7991568a637c
c7061fd9015065d556ab1dc65e65a9460159a14c
/src/main/java/com/yifan/controller/TestController.java
4e4cfa691ea6050010973b72cfbba66d6127a538
[]
no_license
yifan2333/yifan-security
8cc46a3c6a44f4a6babfd4b84af3db3a2c7499c2
33d7a0e8832829df272e68f956ad3320a709f0a3
refs/heads/master
2022-06-27T13:03:42.812402
2019-12-06T07:25:38
2019-12-06T07:25:38
226,270,182
0
0
null
2022-06-17T02:41:54
2019-12-06T07:22:43
Java
UTF-8
Java
false
false
445
java
package com.yifan.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; /**   *   *  * @author: wuyifan  * @since: 2019年11月18日 下午2:34  * @version 1.0  */ @Controller public class TestController { @GetMapping("test") @ResponseBody public String test() { return "test"; } }
16ea80b9d1caae30bdfd6731e2d767220491bd86
d31081ee2af56a4245d639ec71cb6d6b62968318
/src/main/command/ExtendSubscriptionCommand.java
4531fa90b77b5e305f3fe91082eb32a8d23ef6db
[]
no_license
antoxafreezen/periodical_publications
3c32511392a23de865d8e55d944321e7e5fc8e66
3c87a4d9cdefeb6e4f27eb8704d9944600755088
refs/heads/master
2021-01-10T13:52:27.306442
2016-01-25T22:13:59
2016-01-25T22:13:59
50,381,274
0
0
null
null
null
null
UTF-8
Java
false
false
2,473
java
package main.command; import main.dao.PersistException; import main.entities.Subscription; import main.entities.SubscriptionPart; import main.entities.User; import main.helper.Page; import main.helper.RequestHelper; import main.manager.SubscriptionManager; import org.apache.log4j.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Calendar; import java.util.Date; import java.util.ResourceBundle; /** * Class that encapsulates business logic. * Class implements functionality of extending duration of user's subscription. */ public class ExtendSubscriptionCommand implements Command { /** * Names of request parameters. */ private final static String SUBSCRIPTION_ID = "id"; private final static String DURATION = "duration"; /** * Manager to work with subscriptions in persistent context. */ SubscriptionManager subscriptionManager = new SubscriptionManager(); /** * Supports and provides internationalization of the system. */ ResourceBundle bundle; @Override public Page execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String page = "profile.jsp"; boolean redirect = true; bundle = RequestHelper.getResourceBundle(request); int duration = Integer.valueOf(request.getParameter(DURATION)); int current = Integer.valueOf(request.getParameter(SUBSCRIPTION_ID)); Date currentDate = new Date(); try { User currentUser = (User) request.getSession().getAttribute("currentUser"); Subscription subscription = currentUser.getSubscriptions().get(current); subscription.setStartDate(currentDate); Calendar cal = Calendar.getInstance(); cal.setTime(currentDate); cal.set(Calendar.MONTH, (cal.get(Calendar.MONTH) + duration)); subscription.setEndDate(cal.getTime()); subscriptionManager.update(subscription); subscription.setUser(currentUser); } catch (PersistException e) { Logger.getLogger(getClass()).error(e); page = "index.jsp"; redirect = false; request.setAttribute("message", bundle.getString("command.extend_subscription.error")); } return new Page(page, redirect); } }
9bf62194220ae0fd8f9150f60a37062c308d6a71
8ed5583d1af3dbc84b9be7aea6092c4b853ca94e
/src/test/java/com/rahul/demo/TestJustificationTest.java
5221be4116e944e7d2c2266d0b1bb4a4941fc5a8
[]
no_license
thatrahul/legendary-eureka
e69458c25d41a1a2785789ee7d5b596679245128
544146f4e428f158480b34194104c1b4a49ba105
refs/heads/master
2021-07-05T02:25:49.351857
2017-09-27T05:11:23
2017-09-27T05:19:49
104,973,556
0
0
null
null
null
null
UTF-8
Java
false
false
507
java
package com.rahul.demo; import org.junit.Test; /** * Created by xbbl129 on 5/30/17. */ @Ignore public class TestJustificationTest { @Test public void textJustification() throws Exception { String[] words = {"This", "is", "an", "example", "of", "text", "justification."}; int length = 16; String[] lines = new TextJustification().textJustification(words, length); for (int i =0; i<lines.length; i++) { System.out.println(lines[i]); } } }
b0fb95137dc794503a6cb611ab1b4ba22712dcd3
4d38472b3e597ed61c6c9278e4b47012bb12c862
/lineagehw/org/lineageos/hardware/HighTouchSensitivity.java
17dda5a26410978bdb784273e34f6408486d5e2a
[ "Apache-2.0" ]
permissive
cm-3470/android_device_samsung_kminilte
0cf58a9ad519d9c759557f15c2cc87c85940db32
2ce5a9d80c83f14e8faa6bd7348568251e8dd6fa
refs/heads/lineage-15.1
2020-05-21T13:53:24.385991
2018-03-10T13:30:37
2018-03-10T13:30:37
31,184,980
35
56
null
2018-07-28T12:59:16
2015-02-22T22:58:20
C++
UTF-8
Java
false
false
3,471
java
/* * Copyright (C) 2014 The CyanogenMod Project * Copyright (C) 2017 The LineageOS Project * * 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.lineageos.hardware; import org.lineageos.internal.util.FileUtils; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import android.util.Log; /** * Glove mode / high touch sensitivity */ public class HighTouchSensitivity { private static String TAG = "HighTouchSensitivity"; private static String COMMAND_PATH = "/sys/class/sec/tsp/cmd"; /* FIXME: cyttsp5 driver does not have cmd_list entry */ //private static String COMMAND_LIST_PATH = "/sys/class/sec/tsp/cmd_list"; private static String COMMAND_RESULT_PATH = "/sys/class/sec/tsp/cmd_result"; private static String GLOVE_MODE = "glove_mode"; private static String GLOVE_MODE_ENABLE = "glove_mode,1"; private static String GLOVE_MODE_DISABLE = "glove_mode,0"; private static String STATUS_OK = ":OK"; /** * Whether device supports high touch sensitivity. * * @return boolean Supported devices must return always true */ public static boolean isSupported() { /* File f = new File(COMMAND_PATH); if (f.exists()) { BufferedReader reader = null; try { String currentLine; reader = new BufferedReader(new FileReader(COMMAND_LIST_PATH)); while ((currentLine = reader.readLine()) != null) { if (GLOVE_MODE.equals(currentLine)) return true; } } catch (IOException e) { // Ignore exception, will be false anyway } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // Ignore exception, no recovery possible } } } } return false; */ return true; } /** This method returns the current activation status of high touch sensitivity * * @return boolean Must be false if high touch sensitivity is not supported or not activated, * or the operation failed while reading the status; true in any other case. */ public static boolean isEnabled() { return FileUtils.readOneLine(COMMAND_RESULT_PATH).equals(GLOVE_MODE_ENABLE + STATUS_OK); } /** * This method allows to setup high touch sensitivity status. * * @param status The new high touch sensitivity status * @return boolean Must be false if high touch sensitivity is not supported or the operation * failed; true in any other case. */ public static boolean setEnabled(boolean status) { return FileUtils.writeLine(COMMAND_PATH, status ? GLOVE_MODE_ENABLE : GLOVE_MODE_DISABLE); } }
ee5c0ced1706aba8d4b33f4ef074eb92927fcd47
de7b67d4f8aa124f09fc133be5295a0c18d80171
/workspace_xfire/xfire-autoGeneration/chi/cn/chimelong/agent/ws/QueryAllEspecialTicketResponse.java
307e68bc673bdd02b52c596a511386922daeef10
[]
no_license
lin-lee/eclipse_workspace_test
adce936e4ae8df97f7f28965a6728540d63224c7
37507f78bc942afb11490c49942cdfc6ef3dfef8
refs/heads/master
2021-05-09T10:02:55.854906
2018-01-31T07:19:02
2018-01-31T07:19:02
119,460,523
0
1
null
null
null
null
UTF-8
Java
false
false
1,632
java
package cn.chimelong.agent.ws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import cn.grgbanking.apt.pojos.ticket.ArrayOfEspecialTicket; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="out" type="{http://ticket.pojos.apt.grgbanking.cn}ArrayOfEspecialTicket"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "out" }) @XmlRootElement(name = "QueryAllEspecialTicketResponse") public class QueryAllEspecialTicketResponse { @XmlElement(required = true, nillable = true) protected ArrayOfEspecialTicket out; /** * Gets the value of the out property. * * @return * possible object is * {@link ArrayOfEspecialTicket } * */ public ArrayOfEspecialTicket getOut() { return out; } /** * Sets the value of the out property. * * @param value * allowed object is * {@link ArrayOfEspecialTicket } * */ public void setOut(ArrayOfEspecialTicket value) { this.out = value; } }
ea24b6e49a60dc49bbb25f315f35e18649ffa379
50a606165ab25f79fb7f2070517fd5b17cd0fb29
/_03_form_databinding/practice/form_and_databinding/src/main/java/model/Employee.java
4d74029d86c5cf713e826440e1403facfaaa79ab
[]
no_license
thangdinh1607/C1220G2_NguyenThanhCong_Module4
e6fccd7106f0d1e490565b51d01ff56f6c1e29ea
34496df56e77fbd1379f1f10416570e83afc5820
refs/heads/main
2023-05-04T17:17:57.465757
2021-05-27T01:07:59
2021-05-27T01:07:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package model; public class Employee { private String id; private String name; private String contactNumber; public Employee() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getContactNumber() { return contactNumber; } public void setContactNumber(String contactNumber) { this.contactNumber = contactNumber; } }
16b08645962aa97462db04e448e24598871aaaaa
98f3b57549676445f233cdc3f0bfee1db3bf009a
/tyyh/src/cn/tyyhoa/service/OaRlzybEmployeeService.java
5f1130807792e653fa3919d93a2a7c4a0adb5002
[]
no_license
wangadmin123/httpApp
015fba335042bacfce963445496389aba38a1f52
0babecddd587743a2aba04dd775ff1289f9485ac
refs/heads/master
2021-08-30T19:59:21.731037
2017-12-19T07:35:05
2017-12-19T07:43:46
114,734,553
1
0
null
null
null
null
UTF-8
Java
false
false
5,224
java
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://kpdus.tripod.com/jad.html // Decompiler options: packimports(3) fieldsfirst ansi space // Source File Name: OaRlzybEmployeeService.java package cn.tyyhoa.service; import cn.tyyhoa.pojo.OaRlzybEmployee; import java.util.Date; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; import cn.tyyhoa.pojo.OaRlzybContract; import cn.tyyhoa.pojo.OaRlzybDepartment; import cn.tyyhoa.pojo.OaRlzybEmployee; import cn.tyyhoa.pojo.OaRlzybGrade; import cn.tyyhoa.pojo.OaRlzybHatArea; import cn.tyyhoa.pojo.OaRlzybHatCity; import cn.tyyhoa.pojo.OaRlzybHatProvince; import cn.tyyhoa.pojo.OaRlzybNative; import cn.tyyhoa.pojo.OaRlzybNotice; import cn.tyyhoa.pojo.OaRlzybNotifiedParty; import cn.tyyhoa.pojo.OaRlzybPosition; import cn.tyyhoa.pojo.OaRlzybTechnicalTitle; import cn.tyyhoa.pojo.OaRlzybUser; public interface OaRlzybEmployeeService { public abstract OaRlzybEmployee selectByPrimaryKey(Integer integer); List<OaRlzybEmployee> selectByDepart(Integer depart_id); /*List<OaRlzybEmployee> selectByDepart2(Integer depart_id);*/ List<OaRlzybEmployee> selectByEmpId(Integer emp_id); List<OaRlzybEmployee> selectAllContract(String emp_name,Integer contract_id,String contract_startDate,String contract_endDate,String contract_status,Integer startPos,Integer PageSize); OaRlzybEmployee showInfo(Integer emp_id); Boolean updateByContractEndDate(OaRlzybEmployee record); int selectCount(String emp_name,Integer contract_id,String contract_startDate,String contract_endDate,String contract_status); boolean updateByEmpId(OaRlzybEmployee record); List<OaRlzybEmployee> selectAll(String emp_name); boolean updateStatus(OaRlzybEmployee record); List<OaRlzybEmployee> selectEmpNameByDepartId(Integer emp_department); OaRlzybEmployee selectPositionByEmpName(Integer emp_id); public List<OaRlzybNative> getAllNations(); public List<OaRlzybHatProvince> getAllProvinces(); public List<OaRlzybHatCity> getAllCitys(String ProvinceId); public List<OaRlzybHatArea> getAllAreas(String CityId); public List<OaRlzybDepartment> getAllDepartments(); public List<OaRlzybPosition> getAllPositions(Integer DepartmentId); public List<OaRlzybGrade> getAllGrades(); public List<OaRlzybEmployee> getHumanAffairsOaRlzybEmployees();//获得人力资源部人事的雇员名单 public int addEmpTechnicalTitlePath(OaRlzybTechnicalTitle oaRlzybTechnicalTitle); public int addEmployee(OaRlzybEmployee oaRlzybEmployee); public int modifyEmployee(OaRlzybEmployee oaRlzybEmployee); public Integer getMaxEmpId(); public int modifyEmployeeByEmpIdCard(OaRlzybEmployee oaRlzybEmployee); public int getEmpIdByEmpIdCard(OaRlzybEmployee oaRlzybEmployee); public int addUser(OaRlzybUser OaRlzybUser); public int getEmployeeCountByCondition(Map<String,Object> condition); public List<OaRlzybEmployee> getOaRlzybEmployeeByPage(Map<String,Object> condition); public OaRlzybEmployee getOaRlzybEmployeeById(int emp_id); public int getOaRlzybUserCountByOaRlzybUser(OaRlzybUser oaRlzybUser); public int getOaRlzybEmployeeCountByEmpIdCard(String empIdCard ); public List<OaRlzybTechnicalTitle> getOaRlzybTechnicalTitleByEmpId(int emp_id); public int modifyOaRlzybEmployeePhotoPathByEmpId(OaRlzybEmployee oaRlzybEmployee); public int deleteOaRlzybEmployeeByEmpId(Integer emp_id); public int getOaRlzybEmployeeCountByPhoneNumber(String emp_phone); public int getOaRlzybEmployeeCountByEmailAddress(String emp_Email); public int realDeleteInformationBugOaRlzybEmployee(); public int modifyUserPositionIdByUserName(OaRlzybUser oaRlzybUser); /*查询除自己外其他用户名*/ public List<OaRlzybUser> selectUserByUid(Integer user_id); /*查询自己用户名*/ public OaRlzybUser selectUserNameByUid(@Param("user_id") Integer user_id); /*插入通知信息*/ public boolean addNotice(OaRlzybNotice record); /*收件人添加通知信息*/ public boolean addNotified_party(OaRlzybNotifiedParty record); /* 根据用户id查询已读通知信息 */ public List<OaRlzybNotice> selectYdNoticeByUid( Integer user_id); /* 根据用户id查询未读通知信息 */ public List<OaRlzybNotice> selectWdNoticeByUid( Integer user_id); /* 根据用户id查询通知信息 */ public List<OaRlzybNotice> selectnotice(Integer status, Integer user_id); /*根据通知id查询通知详情*/ public OaRlzybNotice selectXqNotice( Integer id,Integer user_id); /*根据通知id修改通知状态*/ public int updateNoticeById(Integer npid); /*根据用户id查询未读通知记录数*/ public int selectWdCountByUid(Integer user_id); public abstract List<OaRlzybEmployee> getEmpByDept(Integer deptid); }
f4062c9dd0456ca5eacc736750f974005f2c1050
31f77df547a63f320df8aaee43d7ef621fc6461c
/src/main/java/persistence/TipoDispositivoManager.java
5cc2cd66cd2ffa410a96696c219899ca08525555
[]
no_license
derekfernandez/tpdds2018
09e0a80882ad5cbb2711f6188e62fdf7bb7604d7
9b43693091dcfb97ef7dc4aebde4c02aa8fabcdf
refs/heads/master
2020-04-30T11:18:33.586582
2019-03-20T18:57:22
2019-03-20T18:57:22
176,798,198
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
package persistence; import dominio.dispositivo.TipoDispositivo; import org.uqbarproject.jpa.java8.extras.WithGlobalEntityManager; import org.uqbarproject.jpa.java8.extras.transaction.TransactionalOps; public class TipoDispositivoManager implements WithGlobalEntityManager, TransactionalOps { private static TipoDispositivoManager instance = new TipoDispositivoManager(); public TipoDispositivo getTipoDispositivoDeLaBDPorID(Long id) { return entityManager().find(TipoDispositivo.class, id); } public TipoDispositivo getTipoPorNombre(String nombre) { return entityManager().createQuery("from TipoDispositivo where nombre = :nombre", TipoDispositivo.class) .setParameter("nombre", nombre).getSingleResult(); } public static TipoDispositivoManager getInstance() { return instance; } }
6902ae05756247a7dfad11c74c16eeb3d0e91c4a
9aaaffbddb205dba973ece59da34ae43cc4112c6
/src/main/java/org/uniworks/groupware/admin/domain/UserInfo.java
9fc41900ae9765bbee51d500bf0367db30e9be0e
[]
no_license
linuxwan/uniworks-admin
d4c1ba51593e3bc712634ce3c54fd2d85e2f56c4
227ca3bb97c31f1e560b9e147d373ff5474300d0
refs/heads/master
2023-07-09T05:18:28.208162
2021-07-30T09:04:32
2021-07-30T09:04:32
115,481,663
0
0
null
null
null
null
UTF-8
Java
false
false
2,718
java
/** * 박충완(Park Chungwan)이 작성한 코드 입니다. * Uniworks라는 개인적 프로젝트를 완성하기 위해서 작성 중 입니다. * 이 소스의 코드를 사용하실 경우에는 꼭 출처를 명시해 주시기 바랍니다. */ package org.uniworks.groupware.admin.domain; import java.io.Serializable; import java.util.Collection; import java.util.List; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.uniworks.groupware.admin.domain.security.Role; /** * @author Park Chungwan * */ @SuppressWarnings("serial") public class UserInfo implements UserDetails, Serializable { private String coId; private String username; private String password; private String role; private List<Role> authorities; //계정이 가지고 있는 권한 목록 private boolean accountNonExpired = true; private boolean accountNonLocked = true; private boolean credentialsNonExpired = true; private boolean enabled = true; public String getCoId() { return coId; } public void setCoId(String coId) { this.coId = coId; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public void setAuthorities(List<Role> authorities) { this.authorities = authorities; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { // TODO Auto-generated method stub return authorities; } @Override public boolean isAccountNonExpired() { // TODO Auto-generated method stub return accountNonExpired; } public void setAccountNonExpired(boolean accountNonExpired) { this.accountNonExpired = accountNonExpired; } @Override public boolean isAccountNonLocked() { // TODO Auto-generated method stub return accountNonLocked; } public void setAccountNonLocked(boolean accountNonLocked) { this.accountNonLocked = accountNonLocked; } @Override public boolean isCredentialsNonExpired() { // TODO Auto-generated method stub return credentialsNonExpired; } public void setCredentialsNonExpired(boolean credentialsNonExpired) { this.credentialsNonExpired = credentialsNonExpired; } @Override public boolean isEnabled() { // TODO Auto-generated method stub return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } }
93e3ec721d733d449199450ff959dcc4931b54cd
3b8215663b541f7487b5f20cef1c3d24ad7ded00
/app/src/main/java/com/muhaiminur/videocall_voximplant_android/MainActivity.java
c27d6a7ae7a0f96dc493d6e6d1270b82812e1178
[]
no_license
Muhaiminur/VIDEOCALL_VOXIMPLANT_ANDROID
10e28331cfe7e93b3c2cb4a6714a576499f17e3b
bde889d1a20400d4b941de00cfcad1de681e1c1a
refs/heads/master
2020-04-07T19:35:26.175902
2018-11-22T06:47:40
2018-11-22T06:47:40
158,654,651
0
1
null
null
null
null
UTF-8
Java
false
false
1,179
java
package com.muhaiminur.videocall_voximplant_android; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.Button; import com.karan.churi.PermissionManager.PermissionManager; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class MainActivity extends AppCompatActivity { PermissionManager permissionManager; @BindView(R.id.video_call) Button videoCall; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); permissionManager = new PermissionManager() { }; permissionManager.checkAndRequestPermissions(MainActivity.this); } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { permissionManager.checkResult(requestCode, permissions, grantResults); } @OnClick(R.id.video_call) public void onViewClicked() { startActivity(new Intent(MainActivity.this,Video_Call.class)); } }
02be18d429eb65d2e2d616c88a914f5b2e8db464
462117f8f15d4032c64e812296f983a14495f8e4
/app/src/test/java/org/difly/testandroidapp1/ExampleUnitTest.java
82dc7d5308755d353662061a5f381843f750fbfa
[]
no_license
DiFly/TestAndroidApp1
2a15191ee28f4058d7c257baa857c20c607a9214
7751c6de41c1233d4cc49149376db4eb3ea11b36
refs/heads/master
2020-11-30T05:13:33.425014
2019-12-26T19:15:17
2019-12-26T19:15:17
230,313,263
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package org.difly.testandroidapp1; 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); } }
615b8a153aa1f7a29c173538368666858c27041d
7f53ff59587c1feea58fb71f7eff5608a5846798
/temp/ffout/client/net/minecraft/src/BlockPortal.java
98d76bb3c1642725e67be25022a32f8a94d0a22a
[]
no_license
Orazur66/Minecraft-Client
45c918d488f2f9fca7d2df3b1a27733813d957a5
70a0b63a6a347fd87a7dbe28c7de588f87df97d3
refs/heads/master
2021-01-15T17:08:18.072298
2012-02-14T21:29:14
2012-02-14T21:29:14
3,423,624
3
0
null
null
null
null
UTF-8
Java
false
false
7,386
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) braces deadcode fieldsfirst package net.minecraft.src; import java.util.Random; // Referenced classes of package net.minecraft.src: // BlockBreakable, Material, IBlockAccess, World, // Block, BlockFire, Entity, AxisAlignedBB public class BlockPortal extends BlockBreakable { public BlockPortal(int i, int j) { super(i, j, Material.field_4260_x, false); } public AxisAlignedBB func_221_d(World world, int i, int j, int k) { return null; } public void func_238_a(IBlockAccess iblockaccess, int i, int j, int k) { if(iblockaccess.func_600_a(i - 1, j, k) == field_376_bc || iblockaccess.func_600_a(i + 1, j, k) == field_376_bc) { float f = 0.5F; float f2 = 0.125F; func_213_a(0.5F - f, 0.0F, 0.5F - f2, 0.5F + f, 1.0F, 0.5F + f2); } else { float f1 = 0.125F; float f3 = 0.5F; func_213_a(0.5F - f1, 0.0F, 0.5F - f3, 0.5F + f1, 1.0F, 0.5F + f3); } } public boolean func_217_b() { return false; } public boolean func_242_c() { return false; } public boolean func_4032_a_(World world, int i, int j, int k) { int l = 0; int i1 = 0; if(world.func_600_a(i - 1, j, k) == Block.field_405_aq.field_376_bc || world.func_600_a(i + 1, j, k) == Block.field_405_aq.field_376_bc) { l = 1; } if(world.func_600_a(i, j, k - 1) == Block.field_405_aq.field_376_bc || world.func_600_a(i, j, k + 1) == Block.field_405_aq.field_376_bc) { i1 = 1; } if(l == i1) { return false; } if(world.func_600_a(i - l, j, k - i1) == 0) { i -= l; k -= i1; } for(int j1 = -1; j1 <= 2; j1++) { for(int l1 = -1; l1 <= 3; l1++) { boolean flag = j1 == -1 || j1 == 2 || l1 == -1 || l1 == 3; if((j1 == -1 || j1 == 2) && (l1 == -1 || l1 == 3)) { continue; } int j2 = world.func_600_a(i + l * j1, j + l1, k + i1 * j1); if(flag) { if(j2 != Block.field_405_aq.field_376_bc) { return false; } continue; } if(j2 != 0 && j2 != Block.field_402_as.field_376_bc) { return false; } } } world.field_1043_h = true; for(int k1 = 0; k1 < 2; k1++) { for(int i2 = 0; i2 < 3; i2++) { world.func_690_d(i + l * k1, j + i2, k + i1 * k1, Block.field_4047_bf.field_376_bc); } } world.field_1043_h = false; return true; } public void func_226_a(World world, int i, int j, int k, int l) { int i1 = 0; int j1 = 1; if(world.func_600_a(i - 1, j, k) == field_376_bc || world.func_600_a(i + 1, j, k) == field_376_bc) { i1 = 1; j1 = 0; } int k1; for(k1 = j; world.func_600_a(i, k1 - 1, k) == field_376_bc; k1--) { } if(world.func_600_a(i, k1 - 1, k) != Block.field_405_aq.field_376_bc) { world.func_690_d(i, j, k, 0); return; } int l1; for(l1 = 1; l1 < 4 && world.func_600_a(i, k1 + l1, k) == field_376_bc; l1++) { } if(l1 != 3 || world.func_600_a(i, k1 + l1, k) != Block.field_405_aq.field_376_bc) { world.func_690_d(i, j, k, 0); return; } boolean flag = world.func_600_a(i - 1, j, k) == field_376_bc || world.func_600_a(i + 1, j, k) == field_376_bc; boolean flag1 = world.func_600_a(i, j, k - 1) == field_376_bc || world.func_600_a(i, j, k + 1) == field_376_bc; if(flag && flag1) { world.func_690_d(i, j, k, 0); return; } if((world.func_600_a(i + i1, j, k + j1) != Block.field_405_aq.field_376_bc || world.func_600_a(i - i1, j, k - j1) != field_376_bc) && (world.func_600_a(i - i1, j, k - j1) != Block.field_405_aq.field_376_bc || world.func_600_a(i + i1, j, k + j1) != field_376_bc)) { world.func_690_d(i, j, k, 0); return; } else { return; } } public boolean func_260_c(IBlockAccess iblockaccess, int i, int j, int k, int l) { if(iblockaccess.func_600_a(i, j, k) == field_376_bc) { return false; } boolean flag = iblockaccess.func_600_a(i - 1, j, k) == field_376_bc && iblockaccess.func_600_a(i - 2, j, k) != field_376_bc; boolean flag1 = iblockaccess.func_600_a(i + 1, j, k) == field_376_bc && iblockaccess.func_600_a(i + 2, j, k) != field_376_bc; boolean flag2 = iblockaccess.func_600_a(i, j, k - 1) == field_376_bc && iblockaccess.func_600_a(i, j, k - 2) != field_376_bc; boolean flag3 = iblockaccess.func_600_a(i, j, k + 1) == field_376_bc && iblockaccess.func_600_a(i, j, k + 2) != field_376_bc; boolean flag4 = flag || flag1; boolean flag5 = flag2 || flag3; if(flag4 && l == 4) { return true; } if(flag4 && l == 5) { return true; } if(flag5 && l == 2) { return true; } return flag5 && l == 3; } public int func_229_a(Random random) { return 0; } public int func_234_g() { return 1; } public void func_236_b(World world, int i, int j, int k, Entity entity) { if(entity.field_616_af == null && entity.field_617_ae == null) { entity.func_4039_q(); } } public void func_247_b(World world, int i, int j, int k, Random random) { if(random.nextInt(100) == 0) { world.func_684_a((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "portal.portal", 0.5F, random.nextFloat() * 0.4F + 0.8F); } for(int l = 0; l < 4; l++) { double d = (float)i + random.nextFloat(); double d1 = (float)j + random.nextFloat(); double d2 = (float)k + random.nextFloat(); double d3 = 0.0D; double d4 = 0.0D; double d5 = 0.0D; int i1 = random.nextInt(2) * 2 - 1; d3 = ((double)random.nextFloat() - 0.5D) * 0.5D; d4 = ((double)random.nextFloat() - 0.5D) * 0.5D; d5 = ((double)random.nextFloat() - 0.5D) * 0.5D; if(world.func_600_a(i - 1, j, k) == field_376_bc || world.func_600_a(i + 1, j, k) == field_376_bc) { d2 = (double)k + 0.5D + 0.25D * (double)i1; d5 = random.nextFloat() * 2.0F * (float)i1; } else { d = (double)i + 0.5D + 0.25D * (double)i1; d3 = random.nextFloat() * 2.0F * (float)i1; } world.func_694_a("portal", d, d1, d2, d3, d4, d5); } } }
f140de6728e52de1de86bcbe3bf92f233b485908
524486c65d7ed1481f9b0f8294674a0327a698c9
/trunk/Fair_Helper/src/fairhelper/panels/UpdateUserPanel.java
bacda9acb951ea4462705972c1870d25c94553d5
[]
no_license
BGCX067/fairhelper-svn-to-git
4c5013a863b4f1eaac79ce68fc2dc640f5895965
84d8fd84bd1aba595c95dceaa31e0fb698d96495
refs/heads/master
2016-09-01T08:56:50.641241
2015-12-28T14:38:27
2015-12-28T14:38:27
48,836,240
0
0
null
null
null
null
UTF-8
Java
false
false
16,797
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * UpdateUserPanel.java * * Created on 18.Kas.2009, 20:47:44 */ package fairhelper.panels; import fairhelper.User; import fairhelper.UserManager; import fairhelper.language.Language; import fairhelper.theme.Theme; import javax.swing.JButton; import javax.swing.JOptionPane; /** * * @author Feoran */ public class UpdateUserPanel extends javax.swing.JPanel { private User user; /** Creates new form UpdateUserPanel */ public UpdateUserPanel(User user) { this.user = user; initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); updatePanelFirstNameField = new javax.swing.JTextField(); updatePanelSurnameField = new javax.swing.JTextField(); updatePanelUserRoleField = new javax.swing.JComboBox(); updatePanelOldPasswordField = new javax.swing.JPasswordField(); updatePanelNewPasswordField = new javax.swing.JPasswordField(); updatePanelNewPasswordAgainField = new javax.swing.JPasswordField(); saveChangesButton = new javax.swing.JButton(); cleanButton = new javax.swing.JButton(); backButton = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); setBackground(Theme.getColor("backgroundColor2")); setPreferredSize(new java.awt.Dimension(620, 480)); jLabel1.setForeground(Theme.getColor("labelColor1")); jLabel1.setText(Language.getText("userNameLabel")); jLabel2.setForeground(Theme.getColor("labelColor1")); jLabel2.setText(Language.getText("firstNameField")); jLabel3.setForeground(Theme.getColor("labelColor1")); jLabel3.setText(Language.getText("surnameField")); jLabel4.setForeground(Theme.getColor("labelColor1")); jLabel4.setText(Language.getText("oldPasswordLabel")); jLabel5.setForeground(Theme.getColor("labelColor1")); jLabel5.setText(Language.getText("newPasswordLabel")); jLabel6.setForeground(Theme.getColor("labelColor1")); jLabel6.setText(Language.getText("newPasswordAgainLabel")); jLabel7.setForeground(Theme.getColor("labelColor1")); jLabel7.setText(Language.getText("roleLabel")); updatePanelFirstNameField.setBackground(Theme.getColor("fieldBackgroundColor1")); updatePanelFirstNameField.setForeground(Theme.getColor("fieldForegroundColor1")); updatePanelFirstNameField.setText(user.getFirstName()); updatePanelSurnameField.setBackground(Theme.getColor("fieldBackgroundColor1")); updatePanelSurnameField.setForeground(Theme.getColor("fieldForegroundColor1")); updatePanelSurnameField.setText(user.getSurname()); updatePanelUserRoleField.setBackground(Theme.getColor("fieldBackgroundColor1")); updatePanelUserRoleField.setForeground(Theme.getColor("fieldForegroundColor1")); updatePanelUserRoleField.setModel(new javax.swing.DefaultComboBoxModel(getUserPriviledgesNameArray())); updatePanelUserRoleField.setSelectedIndex(getUserPriviledgeIndex()); updatePanelOldPasswordField.setBackground(Theme.getColor("fieldBackgroundColor1")); updatePanelOldPasswordField.setForeground(Theme.getColor("fieldForegroundColor1")); updatePanelNewPasswordField.setBackground(Theme.getColor("fieldBackgroundColor1")); updatePanelNewPasswordField.setForeground(Theme.getColor("fieldForegroundColor1")); updatePanelNewPasswordAgainField.setBackground(Theme.getColor("fieldBackgroundColor1")); updatePanelNewPasswordAgainField.setForeground(Theme.getColor("fieldForegroundColor1")); saveChangesButton.setBackground(Theme.getColor("buttonBackgroundColor1")); saveChangesButton.setForeground(Theme.getColor("buttonForegroundColor1")); saveChangesButton.setText(Language.getText("saveChangesButton")); saveChangesButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveChangesButtonActionPerformed(evt); } }); cleanButton.setBackground(Theme.getColor("buttonBackgroundColor1")); cleanButton.setForeground(Theme.getColor("buttonForegroundColor1")); cleanButton.setText(Language.getText("returnToDefaultButton")); cleanButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cleanButtonActionPerformed(evt); } }); backButton.setBackground(Theme.getColor("buttonBackgroundColor1")); backButton.setForeground(Theme.getColor("buttonForegroundColor1")); backButton.setText(Language.getText("backButton")); jLabel8.setForeground(Theme.getColor("labelColor1")); jLabel8.setText(user.getUserName()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(148, 148, 148) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2) .addComponent(jLabel3) .addComponent(jLabel7) .addComponent(jLabel4) .addComponent(jLabel5) .addComponent(jLabel6) .addComponent(saveChangesButton)) .addGap(26, 26, 26) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(cleanButton) .addGap(18, 18, 18) .addComponent(backButton)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(updatePanelNewPasswordAgainField, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(updatePanelNewPasswordField, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(updatePanelOldPasswordField, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(updatePanelUserRoleField, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(updatePanelSurnameField, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(updatePanelFirstNameField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE))) .addContainerGap(188, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(71, 71, 71) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jLabel8)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(updatePanelFirstNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(updatePanelSurnameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(updatePanelUserRoleField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(updatePanelOldPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(updatePanelNewPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(updatePanelNewPasswordAgainField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(54, 54, 54) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(saveChangesButton) .addComponent(cleanButton) .addComponent(backButton)) .addContainerGap(88, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private String[] getUserPriviledgesNameArray() { String[] privilegesNameArray = UserManager.getPrivilegesNameArray(true); for (int i=0; i<privilegesNameArray.length; i++) { privilegesNameArray[i] = Language.getText("roleName" + privilegesNameArray[i]); } return privilegesNameArray; } public int getUserPriviledgeIndex() { String[] privilegesNameArray = UserManager.getPrivilegesNameArray(true); for (int i=0; i<privilegesNameArray.length; i++) { if(privilegesNameArray[i].equals(UserManager.getPrivileges(user.getPrivilegesId()).getPrivilegeName())) return i; } return -1; } private void cleanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cleanButtonActionPerformed updatePanelFirstNameField.setText(user.getFirstName()); updatePanelSurnameField.setText(user.getSurname()); updatePanelUserRoleField.setSelectedIndex(getUserPriviledgeIndex()); updatePanelOldPasswordField.setText(""); updatePanelNewPasswordField.setText(""); updatePanelNewPasswordAgainField.setText(""); }//GEN-LAST:event_cleanButtonActionPerformed private String oldUserName; private String newUserName; private String newFirstName; private String newLastName; private int role; private String oldPassword; private String newPassword; private String newPasswordAgain; private String message; private void saveChangesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveChangesButtonActionPerformed oldUserName = user.getUserName(); newUserName = oldUserName; newFirstName = updatePanelFirstNameField.getText(); newLastName = updatePanelSurnameField.getText(); role = UserManager.getPrivileges(UserManager.getPrivilegesNameArray(true)[updatePanelUserRoleField.getSelectedIndex()]).getId(); oldPassword = new String(updatePanelOldPasswordField.getPassword()); newPassword = new String(updatePanelNewPasswordField.getPassword()); newPasswordAgain = new String(updatePanelNewPasswordAgainField.getPassword()); if (newUserName.equals("")) message = Language.getText("enterUserNameMessage"); else if (!UserManager.userNameLegal(newUserName)) message = Language.getText("usernameWrongCharsMessage"); else if (!UserManager.userNameUnique(newUserName) && !newUserName.equals(user.getUserName())) message = newUserName + " " + Language.getText("userAlreadyExistsMessage"); else { if (oldPassword.equals("") && newPassword.equals("") && newPasswordAgain.equals("")) { updateExceptPassword(); message = Language.getText("userUpdatedMessage"); } else { if (oldPassword.equals("")) message = Language.getText("enterOldPasswordMessage"); else if (newPassword.equals("")) message = Language.getText("enterNewPasswordMessage"); else if (newPasswordAgain.equals("")) message = Language.getText("enterNewPasswordAgainMessage"); else if (!newPassword.equals(newPasswordAgain)) message = Language.getText("newPasswordsNotSameMessage"); else if (!UserManager.passwordLegal(newPassword)) message = Language.getText("passwordWrongCharsMessage"); else if (!oldPassword.equals(UserManager.decodePassword(user.getPassword(), user.getUserName()))) message = Language.getText("oldPasswordWrondMeaage"); else { updateWithPassword(); message = Language.getText("userUpdatedMessage"); } } } JOptionPane.showMessageDialog(null, message); updatePanelOldPasswordField.setText(""); updatePanelNewPasswordField.setText(""); updatePanelNewPasswordAgainField.setText(""); }//GEN-LAST:event_saveChangesButtonActionPerformed /** Şifre değiştirilmediyse eski şifre aynen kaydedilir. */ private void updateExceptPassword() { String password = UserManager.decodePassword(user.getPassword(), user.getUserName()); User updatedUser = new User(newUserName, password, newFirstName, newLastName, role); UserManager.updateUser(oldUserName, updatedUser); } /** Şifre değiştirildiyse yeni şifre dahil edilerek kaydedilir. */ private void updateWithPassword() { User updatedUser = new User(newUserName, newPassword, newFirstName, newLastName, role); UserManager.updateUser(oldUserName, updatedUser); } public JButton getBackButton() { return backButton; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton backButton; private javax.swing.JButton cleanButton; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JButton saveChangesButton; private javax.swing.JTextField updatePanelFirstNameField; private javax.swing.JPasswordField updatePanelNewPasswordAgainField; private javax.swing.JPasswordField updatePanelNewPasswordField; private javax.swing.JPasswordField updatePanelOldPasswordField; private javax.swing.JTextField updatePanelSurnameField; private javax.swing.JComboBox updatePanelUserRoleField; // End of variables declaration//GEN-END:variables }
4773f77028d91ea038171aace30e8acaa74dd092
f0094829f498afba8f79d3b08ebe290f06d23350
/src/main/java/com/microwise/api/blackhole/UserAction.java
7e5e8f1378c67116d3deccdf32ba0033e8ecbe3a
[]
no_license
algsun/galaxy
0c3c0bb6302c37aacb5a184343bc8c016a52631d
c5f40f2ed4835c803e7c2ed8ba16f84ad54f623e
refs/heads/master
2020-03-15T20:05:07.418862
2018-05-06T09:45:29
2018-05-06T09:45:29
132,314,724
0
0
null
null
null
null
UTF-8
Java
false
false
2,143
java
package com.microwise.api.blackhole; import com.microwise.api.bean.ApiResult; import com.microwise.api.bean.UserVo; import com.microwise.blackhole.bean.User; import com.microwise.blackhole.service.UserService; import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; import java.util.List; /** * @author xiedeng * @date 13-12-6 */ @Controller public class UserAction { @Autowired private UserService userService; @RequestMapping(value = "/blackhole/getUsers", method = RequestMethod.GET) @ApiOperation(value = "获取所有用户信息", position = 2, httpMethod = "GET", notes = "获取所有用户信息" ) @ApiResponses({ @ApiResponse(code = 200, message = "成功", response = Void.class), @ApiResponse(code = 500, message = "服务端异常") }) @ResponseBody public ApiResult<Object> getUsers() { List<User> users = userService.findUserList(); List<UserVo> userVos = new ArrayList<>(); for (User user : users) { userVos.add(new UserVo(user.getId(), user.getUserName(), user.getEmail())); } return getResult(true, "获取所有用户信息成功", userVos); } /** * 获取返回的json 数据 * * @param success 是否成功 true 成功, false 失败 * @param msg 返回的信息 * @param data 返回的数据 * @return json数据 */ private ApiResult<Object> getResult(boolean success, String msg, Object data) { ApiResult<Object> apiResult = new ApiResult<Object>(); apiResult.setSuccess(success); apiResult.setMessage(msg); apiResult.setData(data); return apiResult; } }
f6435154836310483c38c818274fedacb33688c7
f630dfac1b7235d22ee4ff672584b104ef400e4f
/src/main/java/com/oem/util/StringUtil.java
d188036506d733130e5b710bd6a14e34db92959c
[]
no_license
MaYunGuo/oem-test
fcb8c77a18fd311bdb3d1792ef3b27dbe134ef95
60d5ee55bd84c692710c9d217343fafb05225212
refs/heads/master
2022-07-28T11:27:22.345740
2019-06-21T10:14:16
2019-06-21T10:14:16
197,700,743
0
0
null
2022-06-21T01:28:24
2019-07-19T04:16:26
JavaScript
UTF-8
Java
false
false
1,811
java
package com.oem.util; import java.io.PrintWriter; import java.io.StringWriter; public class StringUtil { public static boolean isSpaceCheck(String str) { if (null == str || str.length() <= 0 || ("").equals(str)) { return true; } return false; } public static String stackTraceToString(Exception excp) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); excp.printStackTrace(pw); pw.flush(); sw.flush(); return sw.toString(); } public static String comInt2String(int value, int length) { String s = String.valueOf(value); if (s.length() > length) { throw new RuntimeException("length is too short."); } else if (s.length() == length) { return s; } else { char[] cc = new char[length]; int i = 0; for (; i < length - s.length(); i++) { cc[i] = '0'; } for (int j=0; j < s.length();i++,j++) { // System.out.println(i); cc[i] = s.charAt(j); } return new String(cc); } } public static String comString2String(String s, int length) { if (s.length() > length) { throw new RuntimeException("length is too short."); } else if (s.length() == length) { return s; } else { char[] cc = new char[length]; int i = 0; for (; i < length - s.length(); i++) { cc[i] = '0'; } for (int j=0; j < s.length();i++,j++) { // System.out.println(i); cc[i] = s.charAt(j); } return new String(cc); } } }
cc26aa646d5b424bf78e8436866123f9ace2d4ea
b8f487de1c3071351739887291db153c3199ec0e
/src/main/java/com/broadcom/apdk/objects/Workflow.java
8672ae780b60167ee5dba2f925630dc69e45c809
[ "MIT" ]
permissive
wody/action-pack-sdk
eaed5aa95eab9230f6713594eaec5fea6908849f
5f4984f826f1a92bc95891ea8f5f6285144cc7ef
refs/heads/master
2022-07-17T06:09:15.764506
2020-05-15T13:42:36
2020-05-15T13:42:36
264,159,859
0
0
MIT
2020-05-15T10:03:51
2020-05-15T10:03:50
null
UTF-8
Java
false
false
14,348
java
package com.broadcom.apdk.objects; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.eclipse.persistence.oxm.annotations.XmlMarshalNullRepresentation; import org.eclipse.persistence.oxm.annotations.XmlNullPolicy; import org.eclipse.persistence.oxm.annotations.XmlPath; @XmlRootElement(name = "JOBP") @XmlType (propOrder={"title", "archiveKey1", "archiveKey2", "active", "type", "OHSubType", "syncs", "queue", "childQueue", "jobGroup", "extReportDefault", "extReportAll", "extReportNone", "internalAccount", "autoDeactNo", "autoDeactErrorFreeAfterExec", "autoDeactErrorFreeAfterRestart", "errorFreeStatus", "autoDeactAlways", "deactivationDelay", "generateAtRuntime", "priority", "passPriority", "maxSimultaneousExec", "reuseHG", "waitForTasks", "abortTasks", "timezone", "resultEvalOkStatus", "resultEvalExecIfNotOk", "JPASubType", "tasks", "options", "maxReturnCode", "executeObjectIfAboveMaxReturnCode", "executeObjectIfAboveMaxReturnCodeFlag", "forecastEndStatus", "ERT", "ertMethodDefault", "ertMethodFixed", "fixedERT", "ERTDynamicMethod", "mrtMethodDynamic", "ERTNumberOfPastRuns", "ERTCorrection", "ERTDeviationExtent", "ERTIgnoreDeviations", "ERTMinimumRuns", "mrtMethodNone", "mrtMethodFixed", "fixedDuration", "mrtMethodERT", "additionalDuration", "mrtMethodDate", "additionalDurationDays", "finishTime", "finishTimeTZ", "srtMethodNone", "srtMethodFixed", "fixedSRT", "srtMethodERT", "SRTERT", "cancelIfRuntimDeviation", "executeObjectIfRuntimeDevitationFlag", "executeObjectIfRuntimDeviation", "variablesAndPrompts", "deploymentFlag", "workflowTypeA", "workflowTypeC", "applicationName", "workflowName", "componentName", "rollbackFlag", "backupObject", "rollbackObject", "backupPath", "deleteBefore", "includeSubDirectories", "script", "documentation"}) public class Workflow extends ExecutableAutomicObject implements IWorkflow { private String internalAccount; private ExtendedReport extendedReport; private String queue; private DeactivationOnFinish deactivateOnFinish; private String errorFreeStatus; private Integer deactivationDelay; private String resultEvalOkStatus; private String resultEvalExec; private Integer maxSimultaneousExec; private Integer priority; private String timezone; private Boolean passPriority; private Boolean waitForRemainingTasks; private Boolean generateAtRuntime; private String jobGroup; private String childQueue; private List<IWorkflowTask> tasks; public Workflow() { super(); initWorkflow(); } public Workflow(String name) { super(name); initWorkflow(); } private void initWorkflow() { this.tasks = new ArrayList<IWorkflowTask>(); this.extendedReport = ExtendedReport.DEFAULT; this.deactivateOnFinish = DeactivationOnFinish.AFTER_ERRORFREE_RESTART; this.setQueue("CLIENT_QUEUE"); this.setErrorFreeStatus(null); this.setDeactivationDelay(0); this.setMaxSimultaneousExec(0); this.setPriority(0); this.setPassPriority(false); this.setGenerateAtRuntime(false); this.setWaitForRemainingTasks(true); List<IWorkflowTask> initalTasks = new ArrayList<IWorkflowTask>(); initalTasks.add(new WorkflowStartTask()); initalTasks.add(new WorkflowEndTask()); setTasks(initalTasks); } public void setInternalAccount(String internalAccount) { this.internalAccount = internalAccount; } @XmlPath("ATTR_JOBP[@state='1']/IntAccount/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getInternalAccount() { return internalAccount; } public void setQueue(String queue) { this.queue = queue; } @XmlPath("ATTR_JOBP[@state='1']/Queue/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getQueue() { return queue; } public void setErrorFreeStatus(String status) { this.errorFreeStatus = status; } @XmlPath("ATTR_JOBP[@state='1']/DeactWhen/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getErrorFreeStatus() { return errorFreeStatus; } public void setDeactivationDelay(Integer minutes) { this.deactivationDelay = minutes; } @XmlPath("ATTR_JOBP[@state='1']/DeactDelay/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public Integer getDeactivationDelay() { return deactivationDelay; } public void setDeactivateOnFinish(DeactivationOnFinish deactivationOnFinish) { this.deactivateOnFinish = deactivationOnFinish; } @XmlTransient public DeactivationOnFinish getDeactivateOnFinish() { return deactivateOnFinish; } public void setExtendedReport(ExtendedReport extendedReport) { this.extendedReport = extendedReport; } @XmlTransient public ExtendedReport getExtendedReport() { return extendedReport; } public void setResultEvalOkStatus(String okStatus) { this.resultEvalOkStatus = okStatus; } @XmlPath("ATTR_JOBP[@state='1']/RWhen/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getResultEvalOkStatus() { return resultEvalOkStatus; } public void setResultEvalExecIfNotOk(String executableObjectName) { this.resultEvalExec = executableObjectName; } @XmlPath("ATTR_JOBP[@state='1']/RExecute/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getResultEvalExecIfNotOk() { return resultEvalExec; } public void setMaxSimultaneousExec(Integer maxExecutions) { this.maxSimultaneousExec = maxExecutions; } @XmlPath("ATTR_JOBP[@state='1']/MaxParallel2/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public Integer getMaxSimultaneousExec() { return maxSimultaneousExec; } public void setPriority(Integer priority) { this.priority = priority; } @XmlPath("ATTR_JOBP[@state='1']/UC4Priority/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public Integer getPriority() { return priority; } public void setTimezone(String timezoneObjectName) { this.timezone = timezoneObjectName; } @XmlPath("ATTR_JOBP[@state='1']/TZ/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getTimezone() { return timezone; } public void setPassPriority(Boolean passPriority) { this.passPriority = passPriority; } @XmlPath("ATTR_JOBP[@state='1']/PassPriority/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) public Boolean isPassPriority() { return passPriority; } public void setGenerateAtRuntime(Boolean generateAtRuntime) { this.generateAtRuntime = generateAtRuntime; } @XmlPath("ATTR_JOBP[@state='1']/ActAtRun/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) public Boolean getGenerateAtRuntime() { return generateAtRuntime; } public void setWaitForRemainingTasks(Boolean waitForRemainingTasks) { this.waitForRemainingTasks = waitForRemainingTasks; } @XmlTransient public Boolean isWaitForRemainingTasks() { return waitForRemainingTasks; } public void setJobGroup(String jobGroup) { this.jobGroup = jobGroup; } @XmlPath("ATTR_JOBP[@state='1']/StartType/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getJobGroup() { return jobGroup; } public void setChildQueue(String childQueue) { this.childQueue = childQueue; } @XmlPath("ATTR_JOBP[@state='1']/ChildQueue/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public String getChildQueue() { return childQueue; } public void setTasks(List<IWorkflowTask> tasks) { this.tasks = addWorkflowToTasks(tasks); } @XmlAnyElement(lax = true) @XmlElementWrapper @XmlPath("JOBP[@state='1']/JobpStruct[@mode='design']") @XmlJavaTypeAdapter(WorkflowTaskAdapter.class) @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) public List<IWorkflowTask> getTasks() { List<IPromptSet> promptSets = getPromptSets(); // Add PromptSets defined in JOBP to the list of promptSets in each tasks if (promptSets != null && !promptSets.isEmpty()) { if (tasks != null && !tasks.isEmpty()) { List<IWorkflowTask> newTaskList = new ArrayList<IWorkflowTask>(); for (IWorkflowTask task : tasks) { List<IPromptSet> taskPromptSets = task.getPromptSets(); if (taskPromptSets == null) { taskPromptSets = new ArrayList<IPromptSet>(); } // Add PromptSet only if no PromptSet with the same name already exists for (IPromptSet wfPromptSet : promptSets) { boolean foundInTask = false; for (IPromptSet taskPromptSet : taskPromptSets) { if (taskPromptSet.getName().equals(wfPromptSet.getName())) { foundInTask = true; } } if (!foundInTask) { taskPromptSets.add(wfPromptSet); } } task.setPromptSets(taskPromptSets); newTaskList.add(task); } return addWorkflowToTasks(newTaskList); } } return tasks; } // Non-Public API @XmlPath("JOBP[@state='1']/JobpStruct[@mode='design']/OPTIONS/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) String getOptions() { return null; } @XmlPath("DEPLOYMENT[@state='1']/DeploymentFlag/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isDeploymentFlag() { return false; } @XmlPath("DEPLOYMENT[@state='1']/WFTypeA/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isWorkflowTypeA() { return true; } @XmlPath("DEPLOYMENT[@state='1']/WFTypeC/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isWorkflowTypeC() { return false; } @XmlPath("DEPLOYMENT[@state='1']/AppName/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) String getApplicationName() { return null; } @XmlPath("DEPLOYMENT[@state='1']/WFName/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) String getWorkflowName() { return null; } @XmlPath("DEPLOYMENT[@state='1']/ComponentName/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) String getComponentName() { return null; } @XmlPath("ATTR_JOBP[@state='1']/MpElse1/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) Boolean isWaitForTasks() { if (this.waitForRemainingTasks != null) { return this.waitForRemainingTasks ? true : false; } return null; } @XmlPath("ATTR_JOBP[@state='1']/MpElse2/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) Boolean isAbortTasks() { if (this.waitForRemainingTasks != null) { return this.waitForRemainingTasks ? false: true; } return null; } @XmlPath("ATTR_JOBP[@state='1']/ExtRepDef/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isExtReportDefault() { if (ExtendedReport.DEFAULT.equals(this.extendedReport)) { return true; } return false; } @XmlPath("ATTR_JOBP[@state='1']/ReuseHG/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isReuseHG() { return true; } @XmlPath("ATTR_JOBP[@state='1']/ExtRepAll/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isExtReportAll() { if (ExtendedReport.ALL.equals(this.extendedReport)) { return true; } return false; } @XmlPath("ATTR_JOBP[@state='1']/ExtRepNone/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isExtReportNone() { if (ExtendedReport.NONE.equals(this.extendedReport)) { return true; } return false; } @XmlPath("ATTR_JOBP[@state='1']/AutoDeactNo/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isAutoDeactNo() { if (DeactivationOnFinish.NEVER.equals(this.deactivateOnFinish)) { return true; } return false; } @XmlPath("ATTR_JOBP[@state='1']/AutoDeactAlways/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isAutoDeactAlways() { if (DeactivationOnFinish.ALWAYS.equals(this.deactivateOnFinish)) { return true; } return false; } @XmlPath("ATTR_JOBP[@state='1']/AutoDeactErrorFree/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isAutoDeactErrorFreeAfterRestart() { if (DeactivationOnFinish.AFTER_ERRORFREE_RESTART.equals(this.deactivateOnFinish)) { return true; } return false; } @XmlPath("ATTR_JOBP[@state='1']/AutoDeact1ErrorFree/text()") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isAutoDeactErrorFreeAfterExec() { if (DeactivationOnFinish.AFTER_ERRORFREE_EXEC.equals(this.deactivateOnFinish)) { return true; } return false; } @XmlPath("ATTR_JOBP[@state='1']/JPA_SubType/text()") @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) String getJPASubType() { return null; } @XmlAttribute(name = "AllowExternal") @XmlJavaTypeAdapter(BooleanAdapter.class) Boolean isAllowExternal() { return true; } private List<IWorkflowTask> addWorkflowToTasks(List<IWorkflowTask> tasks) { if (tasks != null) { List<IWorkflowTask> newTasks = new ArrayList<IWorkflowTask>(); for (IWorkflowTask task : tasks) { task.setWorkflow(this); newTasks.add(task); } return newTasks; } return null; } }
1e0c67e308b26c0d3c0f8d9e7ca411e99db21550
b284cfdc28d651a7c5f41c9708d7cde8f72df36e
/src/main/java/de/intarsys/pdf/pd/PDAnyAnnotation.java
a96e218edead2248397f472eb1a91e6a0810eec0
[ "BSD-3-Clause" ]
permissive
scireum/jpod
0fd36b8792b041354c862f2a460dbde4fe05a805
59cf81c768948308b42852e483d85d9d49f9c67c
refs/heads/master
2023-08-31T15:57:59.417443
2023-07-28T15:35:36
2023-07-28T15:35:36
45,109,359
8
0
BSD-3-Clause
2021-03-25T12:30:54
2015-10-28T12:00:16
Java
UTF-8
Java
false
false
2,447
java
/* * Copyright (c) 2007, intarsys consulting GmbH * * 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 intarsys 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 de.intarsys.pdf.pd; import de.intarsys.pdf.cos.COSBasedObject; import de.intarsys.pdf.cos.COSObject; /** * A generic annotation implementation. */ public class PDAnyAnnotation extends PDAnnotation { /** * The meta class implementation */ public static class MetaClass extends PDAnnotation.MetaClass { protected MetaClass(Class instanceClass) { super(instanceClass); } @Override protected COSBasedObject doCreateCOSBasedObject(COSObject object) { return new PDAnyAnnotation(object); } } /** * The meta class instance */ public static final MetaClass META = new MetaClass(MetaClass.class.getDeclaringClass()); protected PDAnyAnnotation(COSObject object) { super(object); } @Override public String getSubtypeLabel() { return "Annotation"; } }
136bec60d39d91bb4b8cb6dbdf2943387f31a961
2b6941b92c50f4249cae69ba78da255f533addda
/src/main/java/cooptool/utils/MapResourceBundle.java
5a2d9bc62641993abf22bf6f66b6bbd2bcfed827
[]
no_license
LBiasibetti/coopToolProject
25c4d476c0a5f98e247078bfc47d80c21d56b163
271604fbefa294b0f3f1da26b5122c9252e4013d
refs/heads/master
2023-02-12T03:59:20.248862
2021-01-12T17:58:39
2021-01-12T17:58:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
726
java
package cooptool.utils; import java.util.*; /** * MapResourceBundle class */ public class MapResourceBundle extends ResourceBundle { /** * Map that stores the resources */ private final Map<String, Object> map; /** * Constructor * @param objects Resources */ public MapResourceBundle(Object[] objects) { map = new HashMap<>(); for (int i = 0; i < objects.length; i++) { map.put(String.valueOf(i+1), objects[i]); } } @Override protected Object handleGetObject(String key) { return map.get(key); } @Override public Enumeration<String> getKeys() { return Collections.enumeration(map.keySet()); } }
323187d67a2ebb62aabd615d42478e1f3c5bd3e3
df026e70b4fe4a10bb3da9d8096803808e076958
/bak_001/jszx-spider/jszx-spider-platform/src/main/java/com/jszx/spider/platform/module/service/impl/ExampleServiceImpl.java
5261e2166af02bc6d9ba07819efa14324965db25
[]
no_license
ljt821226/spider
d0b1764d4219b096506bc19d99e5709932bdd19d
00fe33fdcc9bcdbf2a412ae9b9960c6fa1b06cc6
refs/heads/master
2020-03-23T14:15:52.377235
2018-07-20T05:51:12
2018-07-24T08:41:13
141,666,184
0
0
null
null
null
null
UTF-8
Java
false
false
3,385
java
package com.jszx.spider.platform.module.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jszx.spider.platform.code.ReturnCode; import com.jszx.spider.platform.exception.ServiceException; import com.jszx.spider.platform.module.dao.ExampleDao; import com.jszx.spider.platform.module.entity.ExampleEntity; import com.jszx.spider.platform.module.entity.PageEntity; import com.jszx.spider.platform.module.service.ExampleService; /** * [程序名称]:[程序功能描述] * * @version 1.0 * @author [email protected] * @date 2018年4月18日 下午2:35:16 * */ @Service("com.jszx.spider.platform.service.example") public class ExampleServiceImpl implements ExampleService { @Autowired private ExampleDao exampleDao; @Override public ExampleEntity select(ExampleEntity entity) throws ServiceException { try { return entity; } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public ExampleEntity[] selectBatch(ExampleEntity entity) throws ServiceException { try { return exampleDao.selectBatch(entity); } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public ExampleEntity[] selectPage(ExampleEntity entity, PageEntity page) throws ServiceException { try { return exampleDao.selectPage(entity, page); } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public int insert(ExampleEntity entity) throws ServiceException { try { return exampleDao.insert(entity); } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public int insertBatch(ExampleEntity[] entities) throws ServiceException { try { // return exampleDao.insertBatch(entities); return 1; } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public int update(ExampleEntity entity) throws ServiceException { try { return exampleDao.update(entity); } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public int updateBatch(ExampleEntity[] entities) throws ServiceException { try { return exampleDao.updateBatch(entities); } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public int delete(ExampleEntity entity) throws ServiceException { try { return exampleDao.delete(entity); } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } @Override public int deleteBatch(ExampleEntity[] entities) throws ServiceException { try { return exampleDao.deleteBatch(entities); } catch (Exception e) { throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e); } } }
063e9e0b7e5bccc179517c0cab7f6e72facb202b
2b806805edffc32ec7ec783d0f45c6a9825fb12c
/app/src/main/java/com/example/administrator/helloworld/HelloWorldActivity.java
2839cf665f70d65c94ceeccb1219767cd9eda111
[]
no_license
EvaMmw/HelloWorld
b6c47f8f8ebbf23c6dadc925e3af1c696928ff0c
b45f3bc5b17d599cf1e310202253c15c1d2c66e3
refs/heads/master
2021-04-09T15:10:03.117151
2018-03-18T14:44:11
2018-03-18T14:44:11
125,733,489
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.example.administrator.helloworld; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class HelloWorldActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hello_world); } }
f015470dafa90046d2d85f68738baf57e8671063
6c887ace72a567f4344b8f1b1073b2be507ac949
/app/src/main/java/com/rakshit/COPS/enums/ItemType.java
893f5860a1d0e0585181f8925401d10033a04606
[]
no_license
mighty-phoenix/COPS-app
69df980c17cb0bb93d8b161248398143a0f8ed12
60b461012407286eaa382bc50b15f9f92ae8b7f4
refs/heads/master
2020-03-20T03:15:40.445046
2018-06-13T00:14:16
2018-06-13T00:14:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
287
java
package com.rakshit.COPS.enums; /** * Created by Alex on 21.07.16. */ public enum ItemType {LOAD(10), ITEM(11); private final int typeCode; ItemType(int typeCode) { this.typeCode = typeCode; } public int getTypeCode() { return this.typeCode; } }
cacc2b2a66d5c31ee2b2f8f21c9ce4f25429fe07
319f4da54086cec5bbea530c6a3dcb6db89fc105
/yangdi-base-search/src/main/java/com/ewandian/b2b2c/search/domain/document/AdsEntity.java
bf8741e96b41bca9b1a3098b1e060f99b8c92fe2
[]
no_license
YangDiA/yangdi-elasticsearch
b6a75fa99607d241a93d0b8b57c44662a99bc498
e0e40c15a26cc09fb344d6a594aba1ac37866a95
refs/heads/master
2021-01-19T17:05:07.612032
2017-08-22T09:42:30
2017-08-22T09:42:30
101,045,836
0
1
null
null
null
null
UTF-8
Java
false
false
4,636
java
package com.ewandian.b2b2c.search.domain.document; import com.ewandian.b2b2c.search.app.constant.MmsegAnalyzerConstant; import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.FieldIndex; import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.Date; //import java.sql.Date; /** * Created by Administrator on 2016/12/6. */ @Document(indexName = "adindex",type = "ad") public class AdsEntity { @Id @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String id; @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String adId; @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String columnId; @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String columnIdentify; @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String isDeleted; @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String shopId; @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String status; @Field( type = FieldType.String, index = FieldIndex.analyzed, analyzer = MmsegAnalyzerConstant.mmseg_maxword, searchAnalyzer = MmsegAnalyzerConstant.mmseg_maxword ) private String title; @Field( type = FieldType.String, index = FieldIndex.analyzed, analyzer = MmsegAnalyzerConstant.mmseg_maxword, searchAnalyzer = MmsegAnalyzerConstant.mmseg_maxword ) private String paperWork; @Field( type = FieldType.Date, index = FieldIndex.not_analyzed ) private Date deliveryStartDate; @Field( type = FieldType.Date, index = FieldIndex.not_analyzed ) private Date deliveryEndDate; @Field( type = FieldType.String, index = FieldIndex.not_analyzed ) private String seqNo; private String adImage; private String linkHref; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAdId() { return adId; } public void setAdId(String adId) { this.adId = adId; } public String getColumnId() { return columnId; } public void setColumnId(String columnId) { this.columnId = columnId; } public String getColumnIdentify() { return columnIdentify; } public void setColumnIdentify(String columnIdentify) { this.columnIdentify = columnIdentify; } public String getIsDeleted() { return isDeleted; } public void setIsDeleted(String isDeleted) { this.isDeleted = isDeleted; } public String getShopId() { return shopId; } public void setShopId(String shopId) { this.shopId = shopId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getPaperWork() { return paperWork; } public void setPaperWork(String paperWork) { this.paperWork = paperWork; } public String getAdImage() { return adImage; } public void setAdImage(String adImage) { this.adImage = adImage; } public String getLinkHref() { return linkHref; } public void setLinkHref(String linkHref) { this.linkHref = linkHref; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Date getDeliveryStartDate() { return deliveryStartDate; } public void setDeliveryStartDate(Date deliveryStartDate) { this.deliveryStartDate = deliveryStartDate; } public Date getDeliveryEndDate() { return deliveryEndDate; } public void setDeliveryEndDate(Date deliveryEndDate) { this.deliveryEndDate = deliveryEndDate; } public String getSeqNo() { return seqNo; } public void setSeqNo(String seqNo) { this.seqNo = seqNo; } }
3d17cfb4c9e4fb488521a7ea114327de337a1925
7f4ac22c6a06c99f13b08731d92f3b477ab72b5d
/dao/src/main/java/com/hotpot/searcher/OrderSearcher.java
254e6e52654b1195f6ee70bd903721cef75da8f0
[]
no_license
marstianna/serial-manage
7181ef8adb72a381ec0488ba7ccda3fa0b88c9be
bc76f1342e33c0a0de818cd02d6c61b6743cb402
refs/heads/master
2021-01-10T07:18:01.851178
2016-02-16T10:00:23
2016-02-16T10:00:23
48,519,329
1
2
null
null
null
null
UTF-8
Java
false
false
1,632
java
package com.hotpot.searcher; /** * Created by zoupeng on 15/12/26. */ public class OrderSearcher { private Integer id; //订单号 private Integer vipId; //会员 ID private Integer payType;//支付方式 private Integer storeId;//店铺 ID private String cardId; //储值卡编号 private String startTime; //查询起始时间 private String endTime; //查询结束时间 public Integer getId() { return id; } public OrderSearcher setId(Integer id) { this.id = id; return this; } public Integer getVipId() { return vipId; } public OrderSearcher setVipId(Integer vipId) { this.vipId = vipId; return this; } public Integer getPayType() { return payType; } public OrderSearcher setPayType(Integer payType) { this.payType = payType; return this; } public Integer getStoreId() { return storeId; } public OrderSearcher setStoreId(Integer storeId) { this.storeId = storeId; return this; } public String getCardId() { return cardId; } public OrderSearcher setCardId(String cardId) { this.cardId = cardId; return this; } public String getStartTime() { return startTime; } public OrderSearcher setStartTime(String startTime) { this.startTime = startTime; return this; } public String getEndTime() { return endTime; } public OrderSearcher setEndTime(String endTime) { this.endTime = endTime; return this; } }
6a2b6d4a86841110a2700685acc9ffaa2eed03c9
f1cd06451147cfec88909e2648736dc3b3911f1c
/src/main/java/com/projects/ApplicationSpringConfig.java
52dc9e18b06c958d24686339080e42e8fc4e6179
[]
no_license
IdoAlon/webserver1
6153f7e803de56c743758a5e0eee89d787702761
385d768fdeaffad9c6d8a8ed6343a25275e5b193
refs/heads/master
2020-07-12T22:42:56.817807
2016-11-16T08:06:26
2016-11-16T08:06:26
73,897,738
0
0
null
null
null
null
UTF-8
Java
false
false
758
java
package com.projects; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class ApplicationSpringConfig { private static String DB_FILE_NAME = "/tmp/students.db"; @Bean public StudentsController studentsController() { return new StudentsController(); } @Bean public StudentsRepository studentsRepository() { return new AnotherStudentsRepository(DB_FILE_NAME); } // @Bean // public StudentsRepository studentsRepository() { // return new FilesStudentsRepository(DB_FILE_NAME); // } // @Bean // public StudentsRepository studentsRepository() { // return new InMemoryStudentsRepository(); // } }
5db240ac43582c9aa7519cc6237511907ac77f45
12bb49769a72df1826a9dbc83f7f85254c581acb
/IIMJOBSTest/src/test/java/com/iimjobs/qa/testcases/JobFeedTest.java
6521becda5648f8f58f88d99d053c8518929447e
[]
no_license
Yatendra21/IIMJOBS
b74da89cf98ce958f676b082cc575f317d833cff
8746153b91d252025a298d2afc80ca95569afb20
refs/heads/master
2022-07-22T11:59:17.179657
2019-09-02T08:47:05
2019-09-02T08:47:05
167,133,172
0
0
null
2022-06-29T17:10:47
2019-01-23T06:53:25
HTML
UTF-8
Java
false
false
1,262
java
package com.iimjobs.qa.testcases; import java.io.IOException; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.iimjobs.qa.base.Testbase; import com.iimjobs.qa.pages.Createyourjobfeed; import com.iimjobs.qa.pages.JobFeed; import com.iimjobs.qa.pages.LoginPage; public class JobFeedTest extends Testbase{ LoginPage loginpage; JobFeed jobfeed; Createyourjobfeed createyourjobfeed; public JobFeedTest() throws IOException { super(); } @BeforeMethod public void setuphomepage() throws IOException { initilization(); loginpage = new LoginPage(); jobfeed=new JobFeed(); loginpage.login(prop.getProperty("EmailID"), prop.getProperty("Password")); } @Test(priority=1) public void verifyjobfeedpage() { String title=jobfeed.validatejobfeedpage(); Assert.assertEquals(title, "My Jobfeed"); } @Test(priority=2) public void verifyjobfeedpagetext() { boolean flag=jobfeed.validatejobfeedpagetext(); Assert.assertTrue(flag); } @Test(priority=3) public void createyourjobfeed() throws IOException { createyourjobfeed=jobfeed.createownjobfeed(); } @AfterMethod public void teardown() { driver.quit(); } }
716aa8105916406d36abd44031ade6086eca6715
80403ec5838e300c53fcb96aeb84d409bdce1c0c
/server/modules/study/src/org/labkey/study/query/SpecimenPivotByDerivativeType.java
8449817ddf0a2196e87b4df8d18cb7800aa5442a
[]
no_license
scchess/LabKey
7e073656ea494026b0020ad7f9d9179f03d87b41
ce5f7a903c78c0d480002f738bccdbef97d6aeb9
refs/heads/master
2021-09-17T10:49:48.147439
2018-03-22T13:01:41
2018-03-22T13:01:41
126,447,224
0
1
null
null
null
null
UTF-8
Java
false
false
3,012
java
/* * Copyright (c) 2012-2015 LabKey Corporation * * 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.labkey.study.query; import org.apache.commons.lang3.math.NumberUtils; import org.labkey.api.data.ColumnInfo; import org.labkey.api.data.Container; import org.labkey.api.study.StudyService; import java.util.Map; /** * User: klum * Date: Mar 9, 2012 */ public class SpecimenPivotByDerivativeType extends BaseSpecimenPivotTable { public static final String PIVOT_BY_DERIVATIVE_TYPE = "Primary/Derivative Type Vial Counts"; private static final String COLUMN_DESCRIPTION_FORMAT = "Number of vials of primary & derivative type %s/%s"; public SpecimenPivotByDerivativeType(final StudyQuerySchema schema) { super(SpecimenReportQuery.getPivotByDerivativeType(schema.getContainer(), schema.getUser()), schema); setDescription("Contains up to one row of Specimen Primary/Derivative Type totals for each " + StudyService.get().getSubjectNounSingular(getContainer()) + "/visit combination."); Container container = getContainer(); Map<Integer, NameLabelPair> primaryTypeMap = getPrimaryTypeMap(container); Map<Integer, NameLabelPair> derivativeTypeMap = getDerivativeTypeMap(container); for (ColumnInfo col : getRealTable().getColumns()) { // look for the primary/derivative pivot encoding String parts[] = col.getName().split(AGGREGATE_DELIM); if (parts != null && parts.length == 2) { String types[] = parts[0].split(TYPE_DELIM); if (types != null && types.length == 2) { int primaryId = NumberUtils.toInt(types[0]); int derivativeId = NumberUtils.toInt(types[1]); if (primaryTypeMap.containsKey(primaryId) && derivativeTypeMap.containsKey(derivativeId)) { wrapPivotColumn(col, COLUMN_DESCRIPTION_FORMAT, primaryTypeMap.get(primaryId), derivativeTypeMap.get(derivativeId), new NameLabelPair(parts[1], parts[1])); } } } } setDefaultVisibleColumns(getDefaultVisibleColumns()); addWrapColumn(_rootTable.getColumn("Container")); } }
817d8870141ba2889021eccb179ef41ff4eb371f
73308ecf567af9e5f4ef8d5ff10f5e9a71e81709
/jaso78256/server/src/main/java/com/example/jaso78113/MyController.java
60ca37ba4aa68ef0cc0f81bab96f079e8f2ef4b6
[]
no_license
yukihane/stackoverflow-qa
bfaf371e3c61919492e2084ed4c65f33323d7231
ba5e6a0d51f5ecfa80bb149456adea49de1bf6fb
refs/heads/main
2023-08-03T06:54:32.086724
2023-07-26T20:02:07
2023-07-26T20:02:07
194,699,870
3
3
null
2023-03-02T23:37:45
2019-07-01T15:34:08
Java
UTF-8
Java
false
false
461
java
package com.example.jaso78113; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("") public class MyController { @RequestMapping(value = "/", consumes = "text/plain") public String index(@RequestBody final String body) { System.out.print(body); return body; } }
6de78ef5f9ad9073919e2a1808674a220fe0e7d2
417794e62c9edeeb509e4d931ad5b52ca5e54674
/back/src/test/java/fr/certification/tp2/acceptance/jbehave/stories/send_substract_operation/SubstractStory.java
84150c37a731cdebd60916f678370e98daf27db2
[]
no_license
Reynault/TP_Certif_Spring
2df4703ee8479a6d7b6d8830bbbe1735ae35dc06
53f285bd8cd9c29b79dee772757f08a1fe08ab8b
refs/heads/master
2023-01-22T10:30:47.324919
2020-12-10T12:24:45
2020-12-10T12:24:45
312,567,879
0
0
null
null
null
null
UTF-8
Java
false
false
826
java
package fr.certification.tp2.acceptance.jbehave.stories.send_substract_operation; import fr.certification.tp2.acceptance.steps.OperationsControllerSteps; import org.jbehave.core.annotations.Given; import org.jbehave.core.annotations.Then; import org.jbehave.core.annotations.When; import net.thucydides.core.annotations.Steps; public class SubstractStory { @Steps private OperationsControllerSteps operationsControllerSteps; @Given("the user is on the form page") public void givenTheUserIsOnTheFormPage(){ } @When("I substract two numbers $a and $b") public void whenAddingTwoNumbers(int a, int b){ operationsControllerSteps.whenSubstract(a, b); } @Then("I get a substraction result") public void thenIGetTheSum(){ operationsControllerSteps.substractUp(); } }
a1236930b895f2ae1406db776b44a48ac25cab24
bbca5701b310ebf07a8def09156acf4f70381fa9
/security/security.core/src/main/java/com/gwtjs/icustom/springsecurity/support/CustomUserDetailsService.java
25b9a1bb1d280c24e584091ab2ad5ac7ad8cd4cc
[ "Apache-2.0" ]
permissive
flash8627/icustom-boot
4ed6f4393e7a384658a5d29c10f992c379ec5195
ec68cadf54ae7a2b2f8b1c5c61be8e7feaf8e695
refs/heads/master
2021-01-19T00:49:51.423273
2017-11-10T13:52:12
2017-11-10T13:52:12
87,210,825
0
0
null
null
null
null
UTF-8
Java
false
false
1,918
java
package com.gwtjs.icustom.springsecurity.support; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.inject.Inject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Component; import com.gwtjs.icustom.springsecurity.dao.ISysRoleDao; import com.gwtjs.icustom.springsecurity.dao.ISysUserDao; import com.gwtjs.icustom.springsecurity.entity.SysRoleVO; import com.gwtjs.icustom.springsecurity.entity.SysUserVO; /** * 认证管理器,实现用户认证的入口 * <p> * 以从数据库中读入用户的密码,角色信息,是否锁定,账号是否过期等 * </p> */ @Component public class CustomUserDetailsService implements UserDetailsService { @Autowired private ISysUserDao userDao; @Inject private ISysRoleDao isysRoleDao; /** * 用户登陆在这里 */ @Override public UserDetails loadUserByUsername(String account) throws UsernameNotFoundException { // SysUser对应数据库中的用户表,是最终存储用户和密码的表,可自定义 SysUserVO user = userDao.findByAccount(account); if (user == null) { throw new UsernameNotFoundException("account " + account + " not found"); }else{ Set<SysRoleVO> sysRoles = this.getUserRoles(isysRoleDao.findByUserRoles(user.getId())); user.setSysRoles(sysRoles); } // SecurityUser实现UserDetails并将SysUser的name映射为username SecurityUser seu = new SecurityUser(user); return seu; } /** * */ private Set<SysRoleVO> getUserRoles(List<SysRoleVO> list){ Set<SysRoleVO> set = new HashSet<SysRoleVO>(); for (SysRoleVO sysRole : list) { set.add(sysRole); } return set; } }
7337706ad0d41db70693e72ac13b8155a907a0b9
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project39/src/test/java/org/gradle/test/performance/largejavamultiproject/project39/p197/Test3943.java
383e8976f4b24de2d8dd274295c76e6972c0fbb9
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,171
java
package org.gradle.test.performance.largejavamultiproject.project39.p197; import org.junit.Test; import static org.junit.Assert.*; public class Test3943 { Production3943 objectUnderTest = new Production3943(); @Test public void testProperty0() { Production3940 value = new Production3940(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production3941 value = new Production3941(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production3942 value = new Production3942(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { String value = "value"; objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { String value = "value"; objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { String value = "value"; objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
add731c4ca245ab601d7b6aa326017c02c9361c5
d6a6fcd59778cd2bdf3de8a11b6995405edf7715
/pris/src/main/java/br/com/pris/pris/controllers/FuncionarioController.java
0bdee4bcae10ae81bc06306e65670b1d8f4bfa57
[]
no_license
pi-gestao-pedidos/BackEnd
ac0821993ce5de89728e1dbdd278da0ad0a2217f
110989676cc3f699a9ec4a1c6638abd46c9bd1bb
refs/heads/master
2023-01-21T13:34:32.989679
2020-11-21T14:20:04
2020-11-21T14:20:04
308,710,137
0
0
null
2020-11-21T16:34:26
2020-10-30T18:15:31
Java
UTF-8
Java
false
false
1,901
java
package br.com.pris.pris.controllers; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import br.com.pris.pris.model.entities.Funcionario; import br.com.pris.pris.model.services.FuncionarioService; @RestController @RequestMapping("/funcionarios") @CrossOrigin public class FuncionarioController { @Autowired private FuncionarioService service; @PostMapping public ResponseEntity<Funcionario> insertFuncionario(@Valid @RequestBody Funcionario funcionario) { return ResponseEntity.ok(service.addFuncionario(funcionario)); } @GetMapping public ResponseEntity<Iterable<Funcionario>> showAllFuncionarios() { return ResponseEntity.ok(service.findAllFuncionarios()); } @GetMapping("/{id}") public ResponseEntity<Funcionario> showFuncionarioById(@PathVariable Integer id) { return ResponseEntity.ok(service.findFuncionarioById(id)); } @PutMapping("/{id}") public ResponseEntity<Funcionario> updateFuncionario(@Valid @RequestBody Funcionario funcionario, @PathVariable Integer id) { return ResponseEntity.ok(service.changeFuncionario(funcionario, id)); } @DeleteMapping("/{id}") public ResponseEntity<?> deleteFuncionario(@PathVariable Integer id) { service.deleteFuncionario(id); return ResponseEntity.noContent().build(); } }
4be25f57d69eb9d530d7c0af62728c2d513c0f08
33a895621939aaf90bcd258295edfa7e3794cd37
/SLEUTH-rest/src/main/java/be/moac/sleuth/person/web/PersonRestController.java
dc9c904c1c3fb79f3c70337f42bf6d276b359244
[]
no_license
janvanrensbergen/sleuth-demo
04709dcceb688060a855ae084c4a9774c89a012d
78521cbf1af29c33bf419c1ebd0035e0962cb73f
refs/heads/master
2021-01-17T19:08:50.760283
2016-06-24T05:38:43
2016-06-24T05:38:43
61,319,065
0
0
null
null
null
null
UTF-8
Java
false
false
1,538
java
package be.moac.sleuth.person.web; import be.moac.sleuth.person.PersonForm; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import javax.validation.Valid; /** * @author Jan Van Rensbergen. */ @RestController @RequestMapping(path = "/person") public class PersonRestController { private static final Logger logger = LoggerFactory.getLogger(PersonRestController.class); private final RestTemplate restTemplate; @Autowired public PersonRestController(RestTemplate restTemplate) { this.restTemplate = restTemplate; } @RequestMapping(method = RequestMethod.POST) public String register(@RequestBody @Valid PersonForm person) { logger.info("Received some person [{} {}] through rest. Sending to some service.", person.getFirstName(), person.getName()); final ResponseEntity<String> response = this.restTemplate .postForEntity("http://localhost:8282/api/person", person, String.class); logger.info("Some service responded with code [{}] and body [{}]", response.getStatusCode(), response.getBody()); return "OK"; } }
4665dcc9a37c8e88a4cb469197feec497473c0bc
d0b84a7fbcea5a4903bc1369e86716c4af1fafde
/DesignPatterns/src/designpattern/creational/singleton/BillPughSingleton.java
3cdbafc535ec74d0c8c27301b1d5d0dfbc78aaae
[]
no_license
TheAbhishekKumarSinha/CodingDevelopment
1a3ed3ae8e6afeb1141fe3c3392bbcf1a88a171e
4b543f37198547984d98035b20de4a80bac6fd2e
refs/heads/master
2022-07-28T00:34:13.717371
2022-07-16T15:49:37
2022-07-16T15:49:37
126,588,512
0
0
null
2018-10-14T10:54:39
2018-03-24T10:25:28
Java
UTF-8
Java
false
false
399
java
package designpattern.creational.singleton; /** * @author Abhishek Kumar Sinha * */ public class BillPughSingleton { private BillPughSingleton() { } private static class SingletonHelper { private static final BillPughSingleton INSTANCE = new BillPughSingleton(); } public static BillPughSingleton getInstance() { return SingletonHelper.INSTANCE; } }
84634eb4bda5792f303ef99defb25adac026a6fd
b90382aea9fd27a7ee8c9d3198c7f6e57ecdad8c
/gmall-mbg/src/main/java/com/topjia/gmall/sms/service/FlashPromotionSessionService.java
3a3dfd08d0ab13c1067f8ff4ffee8e08a65c3b12
[]
no_license
topjia-vip/gmall
7a26a78dbd33beb99ce836a5e6b50336dd78827a
29b1cc2eda939a34dafd3c4a5e887730fcbb5929
refs/heads/master
2022-06-22T17:44:54.470948
2019-11-24T07:46:15
2019-11-24T07:46:15
223,708,602
0
0
null
2022-06-21T02:18:06
2019-11-24T07:34:43
Java
UTF-8
Java
false
false
343
java
package com.topjia.gmall.sms.service; import com.topjia.gmall.sms.entity.FlashPromotionSession; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 限时购场次表 服务类 * </p> * * @author wjh * @since 2019-11-24 */ public interface FlashPromotionSessionService extends IService<FlashPromotionSession> { }
d8fc5957ab63fdf2ccb818284cb75fa45859e7b4
6377e2dc472eeb5ccfb985cde037be45209dfdd4
/Final Project/Server/src/gvsu457/ServerClientThreadOperations.java
ef99a4ea763ed8d36ab031d0d2dff49be85289f2
[]
no_license
ThunderKick/CIS457
1a5c85bf2ab6b8c7072e894717f57600287acca5
87c3982fc71be19968c2c8bb6832b95cb22536c5
refs/heads/master
2021-04-29T23:05:04.745103
2016-12-05T14:15:40
2016-12-05T14:15:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,213
java
package gvsu457; import java.io.File; import java.io.IOException; import java.net.ServerSocket; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * ServerClientThreadOperations * * @author Taylor Coleman, David Fletcher */ public class ServerClientThreadOperations extends Thread { /** * Port Number */ private static final int PORT = 33333; /** * Listening socket */ private ServerSocket clientListener; /** * Max number of connections */ private static final int MAX_CONNECTIONS = 100; /** * Instance of Thread Pool */ private ExecutorService executorService = Executors.newCachedThreadPool(); public static String DBXML_DIR_SHORTCUT = (new File(".").getAbsolutePath()) + File.separator + "DBXML"; /** * Main method */ public static void main(String[] args) { ServerClientThreadOperations serverClientThreadPool = new ServerClientThreadOperations(); serverClientThreadPool.startServer(); } /** * Constructor for ServerClientThreadOperations. */ ServerClientThreadOperations() { try { clientListener = new ServerSocket(PORT); } catch (IOException e) { throw new RuntimeException(); } } /** * Starts the server. */ public void startServer() { //Delete all old xml data on startup. File curDir = new File(DBXML_DIR_SHORTCUT); File[] FileList = curDir.listFiles(); for (File f : FileList) { if (f.getName().contains(".xml")) { f.delete(); System.out.println("Removing old file: " + f.getName() + " from the DB directory"); } } for (int i = 0; i < MAX_CONNECTIONS; i++) { try { System.out.println("Waiting for a connection..."); ServerThread serverThread = new ServerThread(clientListener.accept()); //serverThread.run(); executorService.submit(serverThread); } catch (IOException e) { throw new RuntimeException(); } } } }
59f3d76c447aab75a8eefdcac900d2a73d7c0625
f2eb081b15b21d801927cab1c734dfb18a230dd8
/changgou-parent/changgou-service/changgou-service-goods/src/main/java/com/wk/goods/service/ParaService.java
b83125121c95037f89e0227b4877af05ad690a44
[]
no_license
wk-001/changgou
e7be9524a075e774e7e157c99ada3d0e9c4a4050
2f9ea55775f56482e4b2a6a345a2c9a6641bdb81
refs/heads/master
2022-07-06T01:30:21.177309
2020-03-14T07:55:19
2020-03-14T07:55:19
239,932,807
1
2
null
2022-06-21T02:47:16
2020-02-12T05:15:04
JavaScript
UTF-8
Java
false
false
1,326
java
package com.wk.goods.service; import com.github.pagehelper.PageInfo; import com.wk.goods.pojo.Para; import java.util.List; /**** * @Author:admin * @Description:Para业务层接口 * @Date 2019/6/14 0:16 *****/ public interface ParaService { /** * 根据分类ID查询template_id,再用template_id查询参数集合 * @param categoryId * @return */ List<Para> findByCategoryId(Integer categoryId); /*** * Para多条件分页查询 * @param para * @param page * @param size * @return */ PageInfo<Para> findPage(Para para, int page, int size); /*** * Para分页查询 * @param page * @param size * @return */ PageInfo<Para> findPage(int page, int size); /*** * Para多条件搜索方法 * @param para * @return */ List<Para> findList(Para para); /*** * 删除Para * @param id */ void delete(Integer id); /*** * 修改Para数据 * @param para */ void update(Para para); /*** * 新增Para * @param para */ void add(Para para); /** * 根据ID查询Para * @param id * @return */ Para findById(Integer id); /*** * 查询所有Para * @return */ List<Para> findAll(); }
089a635e9e991a182f3f9abe611a78a2797d0ec6
28c444100fd19fb9fd58bad46542f5bcf3892cbd
/tron-math/src/main/java/com/migtron/tron/math/color/ColorSimilarity.java
159f46804d4e6b86d8fbfaa62a5aef8d5226e9a9
[]
no_license
albarral/migtron3
bf6213ca54c3f238a867cde82fd592e83a1aea87
ed39a84499b49326f21d76a23ab69b33bf8931ac
refs/heads/master
2021-07-06T04:29:29.557680
2019-06-13T17:45:10
2019-06-13T17:45:10
191,623,462
0
0
null
2020-10-13T13:51:19
2019-06-12T18:20:42
Java
UTF-8
Java
false
false
1,202
java
/* * Copyright (C) 2019 by Migtron Robotics * [email protected] */ package com.migtron.tron.math.color; import com.migtron.tron.math.Vec3f; import com.migtron.tron.math.Vec3s; /** * Utility class to perform color similarity computations using local RGB color and global hsv essence. * @author albarral */ public class ColorSimilarity { private float SAME_RGB_LOCAL; // required RGB similarity vs local color private float SAME_HSV_GLOBAL; // required HSV similarity vs global color public static final float HUE_SECTOR = 60.0f; public ColorSimilarity(float sameLocalRGB, float sameGlobalHSV) { this.SAME_RGB_LOCAL = sameLocalRGB; this.SAME_HSV_GLOBAL = sameGlobalHSV; } public ColorSimilarity() { this(1.0f, 1.0f); } public float getRGBSimilarity() {return SAME_RGB_LOCAL;}; public float getHSVSimilarity() {return SAME_HSV_GLOBAL;}; public boolean checkSameColor(Vec3f rgb1, Vec3s rgb2, HSVEssence hsvEssence, Vec3f hsv2) { return ((rgb1.getEuclideanDistance(rgb2) < SAME_RGB_LOCAL) && hsvEssence.getDistance(hsv2) < SAME_HSV_GLOBAL); } }
f3646a57cf45dbcd8e04fc9505cb8dd94e0346b8
6da98bd81e0133ee13f6b4574ce87012f3a867ef
/libserialhelper/src/main/java/com/ewedo/libserialhelper/util/CmdBuilder.java
c7e341108d5c4ca3f08eb54cd077650dc5a39f43
[]
no_license
Fozei/CommonLib
4d78b5b435b65e2f16af2215778ea82ce98a7dc3
37324281fe2ed18e8a5dcc8e14b4f7e84dd7270a
refs/heads/master
2020-03-19T23:25:34.604243
2018-06-12T02:19:18
2018-06-12T02:19:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,003
java
package com.ewedo.libserialhelper.util; import com.ewedo.libserialhelper.Constants; /** * Created by fozei on 17-11-16. */ class CmdBuilder { /** * 拼接没有数据包的简单命令 * * @param cmd 要发送的指令 * @return 拼接结果 */ public static byte[] buildSimpleCmd(byte[] cmd) { //STX + Length + Length + cmd.length + ETX + BCC byte[] result = new byte[cmd.length + 5]; int index = 0; result[index++] = Constants.STX; result[index++] = (byte) (cmd.length >> 8); result[index++] = (byte) cmd.length; for (byte aCmd : cmd) { result[index++] = aCmd; } result[index++] = Constants.ETX; result[index] = generateBcc(result); return result; } public static byte[] buildCmdWithData(byte[] cmd, byte segment, byte[] pwd) { //0x02 0x00 0x09 0x35 0x32 扇区号 6 byte hex 密码 0x03 byte[] result = new byte[cmd.length + 6 + pwd.length]; int index = 0; result[index++] = Constants.STX; result[index++] = (byte) (cmd.length >> 8); result[index++] = (byte) (cmd.length + pwd.length + 1); for (byte aCmd : cmd) { result[index++] = aCmd; } result[index++] = segment; for (byte aPwd : pwd) { result[index++] = aPwd; } result[index++] = Constants.ETX; result[index] = generateBcc(result); return result; } public static byte[] buildReadDataCmd(byte[] cmd, byte segment, byte bound) { //0x02 0x00 0x04 0x35 0x33 扇区号 块号 0x03 BCC byte[] result = new byte[9]; int index = 0; result[index++] = Constants.STX; result[index++] = (byte) (0x00); result[index++] = (byte) (0x04); for (byte aCmd : cmd) { result[index++] = aCmd; } result[index++] = segment; result[index++] = bound; result[index++] = Constants.ETX; result[index] = generateBcc(result); return result; } private static byte generateBcc(byte[] result) { byte bcc = result[0]; for (int i = 1; i < result.length; i++) { bcc ^= result[i]; } return bcc; } public static byte[] buildWriteDataCmd(byte[] cmd, byte segment, byte area, byte[] data) { byte[] result = new byte[26]; int index = 0; result[index++] = Constants.STX; result[index++] = (byte) (0x00); result[index++] = (byte) (cmd.length + 2 + data.length); for (byte aCmd : cmd) { result[index++] = aCmd; } result[index++] = segment; result[index++] = area; for (byte aData : data) { result[index++] = aData; } result[index++] = Constants.ETX; result[index] = generateBcc(result); return result; } }
697e8783822859b03de9bcaa5c94ce89377359fa
82cc2675fdc5db614416b73307d6c9580ecbfa0c
/eb-service/quartz-service/src/main/java/cn/comtom/quartz/job/EBRSTInfoReportJob.java
d0cf36ea7bac4a23a72a08d3aae99bc2670de37e
[]
no_license
hoafer/ct-ewbsv2.0
2206000c4d7c3aaa2225f9afae84a092a31ab447
bb94522619a51c88ebedc0dad08e1fd7b8644a8c
refs/heads/master
2022-11-12T08:41:26.050044
2020-03-20T09:05:36
2020-03-20T09:05:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
package cn.comtom.quartz.job; import cn.comtom.quartz.service.ILinkageService; import cn.comtom.quartz.utils.SpringContextUtils; import cn.comtom.tools.response.ApiResponse; import lombok.extern.slf4j.Slf4j; import org.quartz.DisallowConcurrentExecution; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import java.util.Date; /** * 台站信息上报 * @author:liuhy * @date: 2019/5/9 * @time: 下午 2:15 */ @Slf4j @DisallowConcurrentExecution public class EBRSTInfoReportJob implements Job { private ILinkageService linkageService = (ILinkageService) SpringContextUtils.getBean("linkageServiceImpl"); @Override public void execute(JobExecutionContext context) throws JobExecutionException { log.info("=====台站信息资源上报开始====[{}]",new Date()); ApiResponse response = linkageService.ebrstInfoReport(); log.info("=====台站信息资源上报上报结束====[{}],result=[{}]",new Date(),response.getSuccessful()); } }
2057d8406c180f66a8bc23384b54875f99ad7d7e
158ed2906743f3f8e3bf27e6adcb4c0a6d5fbef9
/src/test/java/com/ltanner/inventoryManagement/AppTest.java
27c65e524cacec13860023d655b4f6a22e8118c1
[]
no_license
AstroEL/InventoryManagementAPI
a86bfeddf156837256855f9951e2d76e7c76901d
fccff5cdd526cd3ea17b6e6a72c9c638478babed
refs/heads/master
2022-07-23T22:58:20.192747
2019-11-08T00:15:42
2019-11-08T00:15:42
220,352,730
1
0
null
2022-06-21T02:11:39
2019-11-08T00:13:34
Java
UTF-8
Java
false
false
659
java
package com.ltanner.inventoryManagement; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
b40b99c64269dae954c82af4827d552c453b06a7
3140584b31299bcf49c88563d847ece40d77d1b9
/user-service/src/main/java/com/yzhao66/cloud/service/UserService.java
943514fecd667b76036df39cffaed28906f21802
[]
no_license
yzhao66/springcloud-demo
5ece44863ccdb7ca29a4ab3f83a5ee7b4298a2f0
35d83cb068b63693eb27590e8d3f5e5beab69e98
refs/heads/master
2023-03-25T04:43:15.392543
2021-03-26T03:23:00
2021-03-26T03:23:00
264,128,748
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package com.yzhao66.cloud.service; import com.yzhao66.cloud.domain.User; import java.util.List; /** * Created by macro on 2019/8/29. */ public interface UserService { void create(User user); User getUser(Long id); void update(User user); void delete(Long id); User getByUsername(String username); List<User> getUserByIds(List<Long> ids); }
193ed9fa0d9b1c1aa0dd7797e40cf089a11908f2
3be06fef3717172e972021a617e2e6396090df40
/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
00b5a15bdb14a8fec88e4b94fa6575311c955317
[ "Apache-2.0" ]
permissive
fengabe/isis
a7479344776a039e141ac7a74be072f321f73193
e5e5a72867c5a6fb20f6eb008fcf4423afeca68a
refs/heads/master
2020-04-08T07:19:10.689819
2013-05-06T15:28:35
2013-05-06T15:28:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke; public class Get_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO { }
d2034ca2344da1147a58a1276a861764cd17a640
b35e42618890b01f01f5408c05741dc895db50a2
/opentsp-dongfeng-modules/opentsp-dongfeng-openapi/dongfeng-openapi-core/src/main/java/com/navinfo/opentsp/dongfeng/openapi/core/service/impl/PositionReportService.java
a819d1d2b06731273a2923d2f33d3b1e838dc49a
[]
no_license
shanghaif/dongfeng-huanyou-platform
28eb5572a1f15452427456ceb3c7f3b3cf72dc84
67bcc02baab4ec883648b167717f356df9dded8d
refs/heads/master
2023-05-13T01:51:37.463721
2018-03-07T14:24:03
2018-03-07T14:26:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,836
java
package com.navinfo.opentsp.dongfeng.openapi.core.service.impl; import com.navinfo.opentsp.dongfeng.common.result.HttpCommandResultWithData; import com.navinfo.opentsp.dongfeng.common.service.BaseService; import com.navinfo.opentsp.dongfeng.common.util.StringUtil; import com.navinfo.opentsp.dongfeng.openapi.core.pojo.AuditStationPojo; import com.navinfo.opentsp.dongfeng.openapi.core.service.IPositionReportService; import com.navinfo.opentsp.dongfeng.openapi.dto.station.StationPositionReportInfo; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** * @author tushenghong * @version 1.0 * @date 2017-07-17 * @modify * @copyright Navi Tsp */ @Service public class PositionReportService extends BaseService implements IPositionReportService { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @Transactional public HttpCommandResultWithData stationLocationReport(StationPositionReportInfo info) { HttpCommandResultWithData result = new HttpCommandResultWithData(); AuditStationPojo pojo = toAuditStationPojo(info); dao.executeUpdate("addStationAudit", pojo); return result; } private AuditStationPojo toAuditStationPojo(StationPositionReportInfo info) { AuditStationPojo pojo = new AuditStationPojo(); pojo.setStationId(StringUtil.toBigInteger(info.getId())); pojo.setAddress(info.getAddress()); pojo.setStationType(Integer.valueOf(info.getLv())); pojo.setLongitude(StringUtil.toBigInteger(info.getLon())); pojo.setLatitude(StringUtil.toBigInteger(info.getLat())); pojo.setAccountId(StringUtil.toBigInteger(info.getUserId())); pojo.setCreateTime(StringUtil.toBigInteger(StringUtil.getCurrentTimeSeconds())); return pojo; } }
a614e5856d731f9bd741e2e0531700b112c0d8b7
bbce4f9ec2de93f540809ff09c7e6b25f76a564e
/app/src/main/java/com/amin/fastandroidnetworkingdemo/model/MovieGenre.java
e93afc56170ab3dab0fe686e707997b9a12593d8
[]
no_license
amin200x/MovieBuff
ae2eb2be5b849ee7dc5912020b60ec401a10506f
441288a8de93f579e4f4118206d890908821ebcd
refs/heads/main
2023-02-01T17:14:53.530533
2020-12-15T10:11:16
2020-12-15T10:11:16
321,589,811
0
0
null
null
null
null
UTF-8
Java
false
false
1,420
java
package com.amin.fastandroidnetworkingdemo.model; import android.os.Parcel; import android.os.Parcelable; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class MovieGenre implements Parcelable { @SerializedName("id") @Expose private Integer id; @SerializedName("name") @Expose private String name; public final static Creator<MovieGenre> CREATOR = new Creator<MovieGenre>() { @SuppressWarnings({ "unchecked" }) public MovieGenre createFromParcel(Parcel in) { return new MovieGenre(in); } public MovieGenre[] newArray(int size) { return (new MovieGenre[size]); } } ; protected MovieGenre(Parcel in) { this.id = ((Integer) in.readValue((Integer.class.getClassLoader()))); this.name = ((String) in.readValue((String.class.getClassLoader()))); } public MovieGenre() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void writeToParcel(Parcel dest, int flags) { dest.writeValue(id); dest.writeValue(name); } public int describeContents() { return 0; } }
32f7d616f7a0f4bda086c144f770834d0abfdaa3
2b71fc9dee9d0d55a451ad9e26f29d1d91ee4c4e
/core/src/test/java/org/goldian/ccfin_core/ExampleUnitTest.java
7da8fd3cf1f17c7db2b08c4b8e707fede469065c
[]
no_license
ruokwangpawn/Latte
0c7748383f749951d75903e70e64568189a2e8ce
d1c3fe0e81eb04be4216ad627f0e6beed6fc4597
refs/heads/master
2022-02-21T02:49:11.062756
2022-02-09T08:14:34
2022-02-09T08:14:34
110,524,875
1
1
null
null
null
null
UTF-8
Java
false
false
400
java
package org.goldian.ccfin_core; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
261b754ce407edf3cd6cd78f3f3e278ba60e2f12
4780edea7365473879760459fb5a4dea3c93ca94
/src/bd2/controllers/LoginController.java
41aea1ac4531cf4eafd53cbfccfa07795357402c
[]
no_license
KPucilowski/pwr_bd2
28e1090826025aeeb3acd502cb2f705a6f99ae1e
a0669cedbf67845ad16bc06c05e9a9ebdc23dbca
refs/heads/main
2023-02-20T03:30:59.429692
2021-01-19T14:48:26
2021-01-19T14:48:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,326
java
package bd2.controllers; import bd2.App; import bd2.models.LoginModel; import bd2.tools.LoginTools; import bd2.views.LoginView; import javax.swing.*; import java.security.NoSuchAlgorithmException; import java.sql.SQLException; public class LoginController implements IController { private final LoginView view; private final LoginModel model; public LoginController() { this.view = new LoginView(); this.model = new LoginModel(null); init(); } @Override public void init() { view.getLoginButton().addActionListener(e -> login()); } @Override public void dispose() { view.dispose(); } private void login() { try { var login = view.getLoginField().getText(); var pass = LoginTools.charToSha256(view.getPasswordField().getPassword()); model.login(login, pass); if (model.getType() != null) { App.reconnect(model, "pass"); dispose(); } } catch (SQLException | NoSuchAlgorithmException e) { JOptionPane.showMessageDialog(null, "Wrong login and/or password. Try again.", "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } }
b81907d013b40ec382c5f7c3c6647ea42c9468f5
8acff4c2a4817b9de82f95db92a77a1382b96d27
/src/main/java/br/com/zupacademy/neto/casadocodigo/erros/ResourceNotFoundException.java
3c03d6a6c88b117931067d832f49f37dd88d3bb9
[ "Apache-2.0" ]
permissive
netomantonio/orange-talents-05-template-casa-do-codigo
b9da0a7632d2bf314a5370e789b6382d1b070923
4387bb2f3402bf1aa67670f71f385e7652eb5f62
refs/heads/main
2023-05-04T16:50:37.741974
2021-05-23T00:44:04
2021-05-23T00:44:04
368,201,313
0
0
Apache-2.0
2021-05-17T13:45:54
2021-05-17T13:45:54
null
UTF-8
Java
false
false
338
java
package br.com.zupacademy.neto.casadocodigo.erros; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class ResourceNotFoundException extends RuntimeException{ public ResourceNotFoundException(String message) { super(message); } }
7761233ec83a6c771efa81d3d06933f3eab7769f
d4cb139d0a72eaf9511baf8f2435f1024ee29023
/src/android/com/missiveapp/openwith/Serializer.java
0a6c2f981e418517e9342fec569d5268c1bef0a5
[ "MIT" ]
permissive
yosuke/cordova-plugin-openwith
c5d2c9badbf67ac55553cf7dc2dfd91455ad63c6
0c135085d1c55b151531412b25a1e3092857631e
refs/heads/master
2020-03-26T08:27:08.472113
2019-10-19T22:11:41
2019-10-19T22:11:41
144,703,008
0
0
null
2018-08-14T10:06:54
2018-08-14T10:06:54
null
UTF-8
Java
false
false
5,572
java
package com.missiveapp.openwith; import android.content.ClipData; import android.content.ContentResolver; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.util.Base64; import java.io.IOException; import java.io.InputStream; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * Handle serialization of Android objects ready to be sent to javascript. */ class Serializer { /** Convert an intent to JSON. * * This actually only exports stuff necessary to see file content * (streams or clip data) sent with the intent. * If none are specified, null is return. */ public static JSONObject toJSONObject( final ContentResolver contentResolver, final Intent intent) throws JSONException { JSONArray items = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { items = itemsFromClipData(contentResolver, intent.getClipData()); } if (items == null || items.length() == 0) { items = itemsFromExtras(contentResolver, intent.getExtras()); } if (items == null) { return null; } final JSONObject action = new JSONObject(); action.put("action", translateAction(intent.getAction())); action.put("exit", readExitOnSent(intent.getExtras())); action.put("items", items); return action; } public static String translateAction(final String action) { if ("android.intent.action.SEND".equals(action) || "android.intent.action.SEND_MULTIPLE".equals(action)) { return "SEND"; } else if ("android.intent.action.VIEW".equals(action)) { return "VIEW"; } return action; } /** Read the value of "exit_on_sent" in the intent's extra. * * Defaults to false. */ public static boolean readExitOnSent(final Bundle extras) { if (extras == null) { return false; } return extras.getBoolean("exit_on_sent", false); } /** Extract the list of items from clip data (if available). * * Defaults to null. */ public static JSONArray itemsFromClipData( final ContentResolver contentResolver, final ClipData clipData) throws JSONException { if (clipData != null) { final int clipItemCount = clipData.getItemCount(); JSONObject[] items = new JSONObject[clipItemCount]; for (int i = 0; i < clipItemCount; i++) { items[i] = toJSONObject(contentResolver, clipData.getItemAt(i).getUri()); } return new JSONArray(items); } return null; } /** Extract the list of items from the intent's extra stream. * * See Intent.EXTRA_STREAM for details. */ public static JSONArray itemsFromExtras( final ContentResolver contentResolver, final Bundle extras) throws JSONException { if (extras == null) { return null; } final JSONObject item = toJSONObject( contentResolver, (Uri) extras.get(Intent.EXTRA_STREAM)); if (item == null) { return null; } final JSONObject[] items = new JSONObject[1]; items[0] = item; return new JSONArray(items); } /** Convert an Uri to JSON object. * * Object will include: * "type" of data; * "uri" itself; * "path" to the file, if applicable. * "data" for the file. */ public static JSONObject toJSONObject( final ContentResolver contentResolver, final Uri uri) throws JSONException { if (uri == null) { return null; } final JSONObject json = new JSONObject(); final String type = contentResolver.getType(uri); json.put("type", type); json.put("uri", uri); json.put("path", getRealPathFromURI(contentResolver, uri)); return json; } /** Return data contained at a given Uri as Base64. Defaults to null. */ public static String getDataFromURI( final ContentResolver contentResolver, final Uri uri) { try { final InputStream inputStream = contentResolver.openInputStream(uri); final byte[] bytes = ByteStreams.toByteArray(inputStream); return Base64.encodeToString(bytes, Base64.DEFAULT); } catch (IOException e) { return ""; } } /** Convert the Uri to the direct file system path of the image file. * * source: https://stackoverflow.com/questions/20067508/get-real-path-from-uri-android-kitkat-new-storage-access-framework/20402190?noredirect=1#comment30507493_20402190 */ public static String getRealPathFromURI( final ContentResolver contentResolver, final Uri uri) { final String[] proj = { MediaStore.Images.Media.DATA }; final Cursor cursor = contentResolver.query(uri, proj, null, null, null); if (cursor == null) { return ""; } final int column_index = cursor.getColumnIndex(MediaStore.Images.Media.DATA); if (column_index < 0) { cursor.close(); return ""; } cursor.moveToFirst(); final String result = cursor.getString(column_index); cursor.close(); return result; } }
61bd324b66450e3b7b957495cc356277d2340eee
bfcf51666d966dddf0429d988ca2ffe10f2f92a4
/dubbo-mvc-web/src/main/java/com/vcooline/demo/dubbo/web/DemoController.java
52b7ce7941612a0461e1e0bccf06749ec7386ef9
[]
no_license
emac/dubbo-demo-mvc
a5b60fd68d692bd36676754433af53bfd85ec5ea
11d70a070e859a82cfc6cd444361f676673d26d6
refs/heads/master
2021-03-12T20:28:10.546651
2015-07-24T15:39:58
2015-07-24T15:39:58
41,414,811
3
1
null
null
null
null
UTF-8
Java
false
false
652
java
package com.vcooline.demo.dubbo.web; import com.vcooline.demo.dubbo.api.DemoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @author Emac */ @Controller public class DemoController { @Autowired private DemoService demoService; @RequestMapping("/") public String index() { return "index"; } @RequestMapping("/demo") public @ResponseBody String demo() { return demoService.sayHello("world"); } }
44f17b4da8b86bfb42c9dff2afae142be2952359
5e24dc1aa3f71f38bdc6b0f31cea2cff4fd6355a
/src/main/java/com/mcakir/core/base/repository/BaseRepository.java
4d68cb9b86fbaac318ec8fea5de37b55b09b809b
[]
no_license
ByKIRTAN/SpringMVC
7b5fabff64a00fd124697927c003a86ac61152b5
dd9fbe2cd1c047f691db9395ff147a43a5d1d79e
refs/heads/master
2020-04-06T06:49:17.389243
2015-11-06T13:48:41
2015-11-06T13:48:41
46,125,566
1
0
null
2015-11-13T14:10:53
2015-11-13T14:10:52
null
UTF-8
Java
false
false
176
java
package com.mcakir.core.base.repository; import org.springframework.data.jpa.repository.JpaRepository; public interface BaseRepository<T> extends JpaRepository<T, Long> { }
7a7eb438b33d4a9991390766ed52e98361532850
b53d98c4ac7227dd93d4b7408907bc1296d04ad0
/com/media/common/model/video/BoxOfficeTotal.java
0cffd69ea09b3cf2706bbae14ac713a00e07f433
[]
no_license
yangmeichenlei/demo
0f5dd02a4e4016d022a98662e0e6dcd8d58b1d41
3804ef064245d6d4efe4672b2fa4a22512ea121c
refs/heads/master
2020-04-13T07:52:02.599651
2018-12-25T08:50:05
2018-12-25T08:50:05
163,064,318
0
0
null
null
null
null
UTF-8
Java
false
false
1,414
java
package com.media.common.model.video; import com.media.common.base.BaseModel; import java.math.BigDecimal; import java.util.Date; /** * @author zhaoRong * */ public class BoxOfficeTotal extends BaseModel { private static final long serialVersionUID = 1L; private String pkBoxOfficeTotalId; private String videoId; private BigDecimal boxOfficeTotal; private Date lastUpdateTime; private String memo; public String getPkBoxOfficeTotalId() { return pkBoxOfficeTotalId; } public void setPkBoxOfficeTotalId(String pkBoxOfficeTotalId) { this.pkBoxOfficeTotalId = pkBoxOfficeTotalId == null ? null : pkBoxOfficeTotalId.trim(); } public String getVideoId() { return videoId; } public void setVideoId(String videoId) { this.videoId = videoId == null ? null : videoId.trim(); } public BigDecimal getBoxOfficeTotal() { return boxOfficeTotal; } public void setBoxOfficeTotal(BigDecimal boxOfficeTotal) { this.boxOfficeTotal = boxOfficeTotal; } public Date getLastUpdateTime() { return lastUpdateTime; } public void setLastUpdateTime(Date lastUpdateTime) { this.lastUpdateTime = lastUpdateTime; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo == null ? null : memo.trim(); } }
6a0df8d40cb476da3a96977abff53ef2faa35f60
94e5880912d9d9f90dee123277261fd95156e387
/src/local/JPL/ch22/ex22_03/Luncher.java
abdc1eda719e24aaf5b037dd5b23485b301782df
[]
no_license
mikan/java-training-course
5135bc940061e2832ba8a743d41629e73db6bc74
c4a3528bfdc6308f548f069cfdd5966d0105b061
refs/heads/master
2021-01-09T20:52:08.314015
2014-08-02T16:12:28
2014-08-02T16:12:28
13,364,128
1
0
null
2020-01-28T19:11:53
2013-10-06T15:21:40
Java
UTF-8
Java
false
false
226
java
/* * Copyright(C) 2014 Yutaka Kato */ package local.JPL.ch22.ex22_03; public class Luncher { public static void main(String[] args) { System.out.println(new WhichChars("Testing 1 2 3").toString()); } }
d4fd1b4319c19fb9d7d8026bd55811f0d4366cea
8a428922c320d214518e52f59c2a84fed9999928
/src/main/java/com/sda/pizzeria/service/UserRoleService.java
2b9925f4ba8b83d4da3e038957d939413668bbf2
[]
no_license
SaintAmeN/java_12_pizzeria
82e49ef77fa247ea7513da4f61953318ea123fe5
0684837b5a251b7fa199ec87e59863d0475194ec
refs/heads/master
2020-04-09T02:08:09.423966
2018-12-02T14:48:26
2018-12-02T14:48:26
159,929,755
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package com.sda.pizzeria.service; import com.sda.pizzeria.model.UserRole; import com.sda.pizzeria.repository.UserRoleRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; @Service public class UserRoleService { @Value("${pizzeria.user.defaultRoles}") private String[] defaultRoles; @Autowired private UserRoleRepository userRoleRepository; public Set<UserRole> getDefaultUserRoles(){ Set<UserRole> userRoles = new HashSet<>(); for (String role : defaultRoles) { Optional<UserRole> singleRole = userRoleRepository.findByName(role); if (singleRole.isPresent()) { userRoles.add(singleRole.get()); } } return userRoles; } }
41f3c0c4e05e7d04aa3c701268ee7e26f3ee2191
905e2896a76fa634f0684ad07b641b4e76778c94
/hibernatetutorial/src/main/java/com/vivek/myhibernate/UserApp1.java
52f4da7923f663c7ceb7c9d737b3039a81a5fcd7
[]
no_license
vivekdubeydeveloper/hibernate
8556692b66ffbf616b74e9c35c86644e2af36ff4
3d9cdb492c209d92ec87976c7df3c5bb8efc03f6
refs/heads/master
2022-06-24T19:49:32.007308
2019-12-03T17:30:55
2019-12-03T17:30:55
225,419,662
0
0
null
2022-06-21T02:22:12
2019-12-02T16:27:02
Java
UTF-8
Java
false
false
1,152
java
package com.vivek.myhibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.vivek.myhibernate.entity.UserDetails; /** * Hello world! * */ public class UserApp1 { public static void main( String[] args ) { //create entity this is transient object not associated with session UserDetails user=new UserDetails(); user.setId(6); user.setUserName("Mohan"); user.setDept("IT"); //read configuration and build session factory SessionFactory sf=new Configuration().configure().buildSessionFactory(); //Read configuration File Explicitly //SessionFactory sf=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory(); //open session Session session=sf.openSession(); //begin transaction session.beginTransaction(); //save user session.save(user); //user is persistent object associate with session session.getTransaction().commit(); session.close(); //after session closed object is detached //close session factory sf.close(); } }
ec78189c25a9f3ed91591abc7e3c544018851d75
ad597acefb5ee65c39731a1035f4f1a642514891
/Expeciall_2016_12_11/LikeException.java
234527206c205cf4db4e1f593dc2c058aefd2d97
[]
no_license
congrobot123/Huangss
2b4a6f4828091a53c4add497d2d2ac94cb280fa7
e59418ffdd8efc6aa765479a5d55bc366e5df67a
refs/heads/master
2020-08-03T14:59:36.025164
2016-12-13T14:16:36
2016-12-13T14:16:36
73,545,219
0
0
null
null
null
null
GB18030
Java
false
false
531
java
import java.util.Scanner; public class LikeException { public static void main(String[] args) throws Exception { Scanner scan =new Scanner(System.in); System.out.println("请输入一个字符串:"); String[] st = new String[3]; for(int i =0; i < st.length; i++) { st[i] = scan.next(); } if(st[0].equalsIgnoreCase("I") && st[1].equalsIgnoreCase("am") && st[2].equalsIgnoreCase("007")) { System.out.println("亲爱的007"); } else { throw new Exception("对不起,请下次进入"); } } }
170fb2879600ddd41345a85a82fec761d850c323
59359f96e193b5801a4f4679db6629e60b1b19aa
/1902SE/src/io/Person.java
fee03dcadc17db4cf07172d042f03e075a2716ed
[]
no_license
Conwie/Study
90af41fec60b9683a18680363c3a5dd885652ab6
06ce79ec7d3b5dfa4f90194f53ab163a05236fd0
refs/heads/master
2020-06-18T11:52:42.468411
2019-08-10T07:32:27
2019-08-10T07:32:27
196,295,253
0
0
null
null
null
null
UTF-8
Java
false
false
1,382
java
package io; import java.io.Serializable; import java.util.Arrays; /** * 使用当前类测试对象流的对象读写操作 * * 一个类若希望被对象流读写,那么这个类必须要 * 实现接口:Serializable * @author soft01 * */ public class Person implements Serializable{ private static final long serialVersionUID = 1L; private String name; private int age; private String gender; /* * 当一个属性使用transient修饰后,那么进行序列化 * 时这个值会被忽略,忽略不必要的属性可以达到对象 * 序列化瘦身操作,减少不必要的资源开销。 */ private transient String[] otherInfo; public Person(String name, int age, String gender, String[] otherInfo) { this.name = name; this.age = age; this.gender = gender; this.otherInfo = otherInfo; } public String getName() { return name; } public int getAge() { return age; } public String getGender() { return gender; } public String[] getOtherInfo() { return otherInfo; } public void setName(String name) { this.name = name; } public void setAge(int age) { this.age = age; } public void setGender(String gender) { this.gender = gender; } public void setOtherInfo(String[] otherInfo) { this.otherInfo = otherInfo; } public String toString() { return name+","+age+","+gender+","+Arrays.toString(otherInfo); } }
5bc268c5132900e83e839bcf7e2218be87c6221a
5a555ceb202f0b96191b539099de0b80315268bb
/app/build/generated/source/buildConfig/androidTest/debug/com/virupawadegmail/sdhmancharpune/test/BuildConfig.java
321ba565eb7fd64118e1963a3811cc9c8243378f
[]
no_license
amitiwary999/Blogerlove
60eea9872d92bf136ad78bc17c4e43f9450bd1c9
c06e4fc93d6bb66a9de20b1953c9622bcbd05936
refs/heads/master
2021-06-09T03:49:25.555075
2016-12-08T20:59:58
2016-12-08T20:59:58
68,702,485
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
/** * Automatically generated file. DO NOT MODIFY */ package com.virupawadegmail.sdhmancharpune.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.virupawadegmail.sdhmancharpune.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
2462db5387b3e112df5c215a60ef2db2c47cf468
2b236a8a50d4b3fc8144f9c0ad57d7691a505b16
/MultiDataSource-portlet/docroot/WEB-INF/src/com/meera/multidatasource/service/impl/TableFromDefaultDataSourceLocalServiceImpl.java
50af92df45f1bb17bcdc1aaa49bd9f13c04bdd06
[]
no_license
LiferaySavvy/Liferay-Plugin-Portlet-Connecting-Multiple-Datasources
d972b7f6280db645f4978a0267cfd3137e711043
d044ef3faf71ec0871b4d088a693f51aef6885d9
refs/heads/master
2021-01-10T16:55:44.279116
2015-11-23T13:09:59
2015-11-23T13:09:59
46,720,880
0
0
null
null
null
null
UTF-8
Java
false
false
1,823
java
/** * Copyright (c) 2000-2012 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 com.meera.multidatasource.service.impl; import com.meera.multidatasource.service.base.TableFromDefaultDataSourceLocalServiceBaseImpl; /** * The implementation of the table from default data source local service. * * <p> * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link com.meera.multidatasource.service.TableFromDefaultDataSourceLocalService} interface. * * <p> * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM. * </p> * * @author E5410 * @see com.meera.multidatasource.service.base.TableFromDefaultDataSourceLocalServiceBaseImpl * @see com.meera.multidatasource.service.TableFromDefaultDataSourceLocalServiceUtil */ public class TableFromDefaultDataSourceLocalServiceImpl extends TableFromDefaultDataSourceLocalServiceBaseImpl { /* * NOTE FOR DEVELOPERS: * * Never reference this interface directly. Always use {@link com.meera.multidatasource.service.TableFromDefaultDataSourceLocalServiceUtil} to access the table from default data source local service. */ }