blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c415a8e83a7bef58f4d7e2559a777cea17a61281 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_caacd0458801af9dbb61b493af9bf2eac8420b6e/FedoraAdministrationTest/1_caacd0458801af9dbb61b493af9bf2eac8420b6e_FedoraAdministrationTest_t.java | fdbddf16f766e8abe855437fc40584cf0f18cbd8 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 41,427 | java | /**
This file is part of opensearch.
Copyright © 2009, Dansk Bibliotekscenter a/s,
Tempovej 7-11, DK-2750 Ballerup, Denmark. CVR: 15149043
opensearch is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
opensearch is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with opensearch. If not, see <http://www.gnu.org/licenses/>.
*/
package dk.dbc.opensearch.common.fedora;
import dk.dbc.opensearch.common.types.CargoContainer;
import dk.dbc.opensearch.common.types.CargoObject;
import dk.dbc.opensearch.common.types.DataStreamType;
import dk.dbc.opensearch.common.os.FileHandler;
import dk.dbc.opensearch.common.xml.XMLUtils;
import fedora.client.FedoraClient;
import fedora.common.Constants;
import fedora.server.access.FedoraAPIA;
import fedora.server.management.FedoraAPIM;
import fedora.server.types.gen.MIMETypedStream;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.rmi.RemoteException;
import java.text.ParseException;
import java.sql.SQLException;
import java.net.MalformedURLException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.Result;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.rpc.ServiceException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.stream.StreamResult;
import mockit.Mock;
import mockit.Mockit;
import mockit.MockClass;
import org.apache.commons.configuration.ConfigurationException;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import static org.easymock.classextension.EasyMock.*;
import static org.junit.Assert.*;
import org.junit.*;
/**
* This class tests the FedoraAdministration class
* It starts out with testing the private methods used by the
* public once, so that they can be mocked and not tested everytime
* a public method uses them
*/
public class FedoraAdministrationTest
{
FedoraAdministration fa;
CargoContainer mockCC;
MIMETypedStream mockMTStream;
CargoObject mockCargoObject;
static FedoraAPIA mockFea = createMock( FedoraAPIA.class );
static FedoraAPIM mockFem = createMock( FedoraAPIM.class );
static Element mockElement = createMock( Element.class );
static Node mockNode = createMock( Node.class );
static FedoraClient mockFedoraClient = createMock( FedoraClient.class);
static NodeList mockNodeList = createMock( NodeList.class );
static Document mockDocument = createMock( Document.class );
//needed global variables
static byte[] bytes = "bytes".getBytes();
static String[] empty = new String[] {};
static File admStreamFile = new File( "admFile" );
static String timeNow = "mockTime";
/**
* MockClasses
*/
@MockClass( realClass = PIDManager.class )
public static class MockPIDManager
{
@Mock public static String getNextPID( String prefix )
{
return "test:1";
}
}
@MockClass( realClass = FedoraHandle.class )
public static class MockFedoraHandle
{
@Mock public void $init()
{
}
@Mock public static FedoraAPIA getAPIA()
{
return mockFea;
}
@Mock public static FedoraAPIM getAPIM()
{
return mockFem;
}
@Mock public static FedoraClient getFC()
{
return mockFedoraClient;
}
}
// @MockClass( realClass = FedoraTools.class )
// public static class MockFedoraTools
// {
// @Mock public byte[] constructFoxml( CargoContainer cargo, String nextPid, String label )
// {
// return bytes;
// }
// }
@MockClass( realClass = FedoraUtils.class )
public static class MockFedoraUtils
{
@Mock public byte[] CargoContainerToFoxml( CargoContainer cargo )
{
return bytes;
}
}
@MockClass( realClass = XMLUtils.class )
public static class MockXMLUtils
{
@Mock public static Element getDocumentElement( InputSource is)
{
return mockElement;
}
}
@MockClass( realClass = FedoraAdministration.class )
public static class MockFedoraAdministration
{
@Mock public static Element getAdminStream( String pid )
{
return mockElement;
}
@Mock public static String getIndexingAlias( Element adminStream )
{
return "article";
}
@Mock public static NodeList getStreamNodes( Element adminStream )
{
return mockNodeList;
}
@Mock public static String createFedoraResource( CargoObject cargo )
{
return "dsLocation";
}
@Mock public static String[] getEmptyStringArray()
{
return empty;
}
@Mock public static String getTimeNow()
{
return timeNow;
}
}
@MockClass( realClass = DocumentBuilder.class )
public static class MockDocumentBuilder
{
@Mock public static Document newDocument()
{
return mockDocument;
}
}
private byte[] createAdminStreamBytes() throws ParserConfigurationException, TransformerConfigurationException, TransformerException
{
byte[] bytes;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document admStream = builder.newDocument();
Element root = admStream.createElement( "admin-stream" );
Element indexingaliasElem = admStream.createElement( "indexingalias" );
indexingaliasElem.setAttribute( "name", "article");
root.appendChild( (Node)indexingaliasElem );
Node streams = admStream.createElement( "streams" );
Element stream = admStream.createElement( "stream" );
stream.setAttribute( "id", "relsExt.0" );
stream.setAttribute( "lang", "eng" );
stream.setAttribute( "format", "test" );
stream.setAttribute( "mimetype", "text/xml" );
stream.setAttribute( "submitter", "dbc" );
stream.setAttribute( "index", "0" );
stream.setAttribute( "streamNameType" , "relsExt" );
streams.appendChild( (Node) stream );
Element stream2 = admStream.createElement( "stream" );
stream2.setAttribute( "id", "originalData.0");
stream2.setAttribute( "lang", "eng" );
stream2.setAttribute( "format", "test" );
stream2.setAttribute( "mimetype", "text/xml" );
stream2.setAttribute( "submitter", "dbc" );
stream2.setAttribute( "index", "0" );
stream2.setAttribute( "streamNameType" , "originalData" );
streams.appendChild( (Node) stream2 );
root.appendChild( (Node) streams );
Source source = new DOMSource( (Node) root );
StringWriter stringWriter = new StringWriter();
Result stringResult = new StreamResult( stringWriter );
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.transform( source, stringResult );
String admString = stringWriter.getBuffer().toString();
//System.out.println( admString );
bytes = admString.getBytes();
return bytes;
}
private static Element createAdminStreamElement()throws ParserConfigurationException, TransformerConfigurationException, TransformerException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document admStream = builder.newDocument();
Element root = admStream.createElement( "admin-stream" );
Element indexingaliasElem = admStream.createElement( "indexingalias" );
indexingaliasElem.setAttribute( "name", "article");
root.appendChild( (Node)indexingaliasElem );
Node streams = admStream.createElement( "streams" );
Element stream = admStream.createElement( "stream" );
stream.setAttribute( "id", "relsExt.0" );
stream.setAttribute( "lang", "eng" );
stream.setAttribute( "format", "test" );
stream.setAttribute( "mimetype", "text/xml" );
stream.setAttribute( "submitter", "dbc" );
stream.setAttribute( "index", "0" );
stream.setAttribute( "streamNameType" , "relsExt" );
streams.appendChild( (Node) stream );
Element stream2 = admStream.createElement( "stream" );
stream2.setAttribute( "id", "originalData.0");
stream2.setAttribute( "lang", "eng" );
stream2.setAttribute( "format", "test" );
stream2.setAttribute( "mimetype", "text/xml" );
stream2.setAttribute( "submitter", "dbc" );
stream2.setAttribute( "index", "0" );
stream2.setAttribute( "streamNameType" , "originalData" );
streams.appendChild( (Node) stream2 );
Element stream3 = admStream.createElement( "stream" );
stream3.setAttribute( "id", "relsExt.1");
stream3.setAttribute( "lang", "eng" );
stream3.setAttribute( "format", "test" );
stream3.setAttribute( "mimetype", "text/xml" );
stream3.setAttribute( "submitter", "dbc" );
stream3.setAttribute( "index", "1" );
stream3.setAttribute( "streamNameType" , "relsExt" );
streams.appendChild( (Node) stream3 );
root.appendChild( (Node) streams );
return root;
}
@MockClass( realClass = FedoraAdministration.class )
public static class MockFedoraAdministration2
{
@Mock public static Element getAdminStream( String pid ) throws ParserConfigurationException, TransformerConfigurationException, TransformerException
{
return createAdminStreamElement();
}
@Mock public static String getIndexingAlias( Element adminStream )
{
return "article";
}
@Mock public static NodeList getStreamNodes( Element adminStream )
{
return mockNodeList;
}
@Mock public static String createFedoraResource( CargoObject cargo )
{
return "dsLocation";
}
@Mock public static String[] getEmptyStringArray()
{
return empty;
}
@Mock public static String getTimeNow()
{
return timeNow;
}
}
@MockClass( realClass = FileHandler.class )
public static class MockFileHandler
{
@Mock public static File getFile( String path )
{
return admStreamFile;
}
}
/**
*setup
*/
@Before public void SetUp()
{
mockCC = createMock( CargoContainer.class );
mockMTStream = createMock( MIMETypedStream.class );
mockCargoObject = createMock( CargoObject.class );
}
/**
*teardown
*/
@After public void TearDown()
{
Mockit.tearDownMocks();
reset( mockCC );
reset( mockFem );
reset( mockFea );
reset( mockElement );
reset( mockNodeList );
reset( mockMTStream );
reset( mockCargoObject );
reset( mockDocument );
reset( mockFedoraClient );
fa = null;
}
/**
* Testing private helper methods so that they wont have to be tested again
* and again
*/
/**
* Testing the happy path of the getAdminStream method
*/
@Test public void testGetAdminStreamHappy() throws IOException, ParserConfigurationException, RemoteException, ServiceException, SAXException, ConfigurationException, NoSuchMethodException, IllegalAccessException
{
//setup
Mockit.setUpMocks( MockFedoraHandle.class );
Mockit.setUpMocks( MockXMLUtils.class );
String byteString = "admindata";
byte[] bytearraystring = byteString.getBytes();
String pid = "pid";
Method method;
Class[] argClasses = new Class[]{ String.class };
Object[] args = new Object[]{ pid };
Element result;
//expectations
expect( mockFea.getDatastreamDissemination( "pid", "adminData" , null ) ).andReturn( mockMTStream );
expect( mockMTStream.getStream() ).andReturn( bytearraystring );
//replay
replay( mockElement );
replay( mockMTStream );
replay( mockFea );
//do stuff
fa = new FedoraAdministration();
try
{
method = fa.getClass().getDeclaredMethod( "getAdminStream", argClasses );
method.setAccessible( true );
result = (Element)method.invoke( fa, args );
}
catch( InvocationTargetException ite )
{
Assert.fail();
}
//verify
verify( mockElement );
verify( mockMTStream );
verify( mockFea );
}
/**
* Testing the throwing of the IllegalStateException
*/
@Test (expected=IllegalStateException.class)
public void testGetAdminStreamIllegalState() throws Exception
{
//setup
Mockit.setUpMocks( MockFedoraHandle.class );
//Mockit.setUpMocks( MockFedoraConfig.class );
Mockit.setUpMocks( MockXMLUtils.class );
String byteString = "admindata";
byte[] bytearraystring = byteString.getBytes();
String pid = "pid";
Method method;
Class[] argClasses = new Class[]{ String.class };
Object[] args = new Object[]{ pid };
Element result;
//expectations
expect( mockFea.getDatastreamDissemination( "pid", "adminData" , null ) ).andReturn( mockMTStream );
expect( mockMTStream.getStream() ).andReturn( null );
//replay
replay( mockElement );
replay( mockMTStream );
replay( mockFea );
//do stuff
fa = new FedoraAdministration();
try
{
method = fa.getClass().getDeclaredMethod( "getAdminStream", argClasses );
method.setAccessible( true );
result = (Element)method.invoke( fa, args );
}
catch( InvocationTargetException ite )
{
//check the class of the exception...
if( ite.getCause().getClass().equals( IllegalStateException.class ) )
{
//rethrow to conform with the test specification
throw new IllegalStateException( ite.getCause() );
}
}
}
/**
* Testing the throwing of the IOException in getAdminStreamMethod
*/
@Test
public void testGetAdminStreamIOExp() throws IOException, ParserConfigurationException, RemoteException, ServiceException, SAXException, ConfigurationException, NoSuchMethodException, IllegalAccessException
{
//setup
boolean illegalCaught = false;
Mockit.setUpMocks( MockFedoraHandle.class );
Mockit.setUpMocks( MockXMLUtils.class );
String byteString = "admindata";
byte[] bytearraystring = byteString.getBytes();
String pid = "pid";
Method method;
Class[] argClasses = new Class[]{ String.class };
Object[] args = new Object[]{ pid };
Element result;
//expectations
expect( mockFea.getDatastreamDissemination( "pid", "adminData" , null ) ).andThrow( new RemoteException( "test" ) );
//replay
replay( mockElement );
replay( mockMTStream );
replay( mockFea );
//do stuff
fa = new FedoraAdministration();
try
{
method = fa.getClass().getDeclaredMethod( "getAdminStream", argClasses );
method.setAccessible( true );
result = (Element)method.invoke( fa, args );
}
catch( InvocationTargetException ite )
{
//check the class of the exception...
if( ite.getCause().getClass().equals( IOException.class ) )
{
illegalCaught = true;
}
}
assertTrue( illegalCaught );
//verify
verify( mockElement );
verify( mockMTStream );
verify( mockFea );
}
/**
* Testing the getIndexingAlias methods happypath
*/
@Test public void testGetIndexingAlias() throws NoSuchMethodException, IllegalAccessException
{
//setup
String testString = "test";
String result = "not equal to test";
Method method;
Class[] argClasses = new Class[]{ Element.class };
Object[] args = new Object[]{ mockElement };
//expectations
expect( mockElement.getElementsByTagName( "indexingalias" ) ).andReturn( mockNodeList );
expect( mockNodeList.item( 0 ) ).andReturn( mockElement );
expect( mockElement.getAttribute( "name" ) ).andReturn( testString );
//replay
replay( mockElement );
replay( mockNodeList );
//do stuff
fa = new FedoraAdministration();
try
{
method = fa.getClass().getDeclaredMethod( "getIndexingAlias", argClasses );
method.setAccessible( true );
result = (String)method.invoke( fa, args );
}
catch( InvocationTargetException ite )
{
//ite.getCause().printStackTrace();
Assert.fail();
}
assertTrue( result.equals( testString ));
//verify
verify( mockElement );
verify( mockNodeList );
}
/**
* Testing the getIndexingAlias with indexingAliasElem == null
*/
@Test public void testGetIndexingAliasNull() throws NoSuchMethodException, IllegalAccessException
{
//setup
boolean correctException = false;
String result = "not equal to test";
Method method;
Class[] argClasses = new Class[]{ Element.class };
Object[] args = new Object[]{ mockElement };
//expectations
expect( mockElement.getElementsByTagName( "indexingalias" ) ).andReturn( null );
//replay
replay( mockElement );
//do stuff
fa = new FedoraAdministration();
try
{
method = fa.getClass().getDeclaredMethod( "getIndexingAlias", argClasses );
method.setAccessible( true );
result = (String)method.invoke( fa, args );
}
catch( InvocationTargetException ite )
{
if( ite.getCause().getClass().equals( NullPointerException.class ) )
{
correctException = true;
}
else
{
Assert.fail();
}
}
assertTrue( correctException );
//verify
verify( mockElement );
}
/**
* Testing getStreamNodes method, so that it can be mocked for
* other testcases using it
*/
@Test public void testGetStreamNodes() throws NoSuchMethodException, IllegalAccessException
{
//setup
NodeList result = null;
Method method;
Class[] argClasses = new Class[]{ Element.class };
Object[] args = new Object[]{ mockElement };
//expectations
expect( mockElement.getElementsByTagName( "streams" ) ).andReturn( mockNodeList );
expect( mockNodeList.item( 0) ).andReturn( mockElement );
expect( mockElement.getElementsByTagName( "stream" ) ).andReturn( mockNodeList );
//replay
replay( mockElement );
replay( mockNodeList );
//do stuff
fa = new FedoraAdministration();
try
{
method = fa.getClass().getDeclaredMethod( "getStreamNodes", argClasses );
method.setAccessible( true );
result = (NodeList)method.invoke( fa, args );
}
catch( InvocationTargetException ite )
{
Assert.fail();
}
assertTrue( result == mockNodeList );
//verify
verify( mockElement );
verify( mockNodeList );
}
/**
* Testing createFedoraResource method, so that it can be mocked
* for testcases that calls it
*/
@Test public void testCreateFedoraResource() throws NoSuchMethodException, IllegalAccessException, IOException
{
//setup
Mockit.setUpMocks( MockFedoraHandle.class);
String byteString = "bytes";
String returnString = "result";
byte[] bytes = byteString.getBytes();
String result = null;
Method method;
Class[] argClasses = new Class[]{ CargoObject.class };
Object[] args = new Object[]{ mockCargoObject };
//expectations
expect( mockCargoObject.getId() ).andReturn( 2l );
//2nd method called
expect( mockCargoObject.getBytes() ).andReturn( bytes );
expect( mockFedoraClient.uploadFile( isA( File.class ) ) ).andReturn( returnString );
//replay
replay( mockCargoObject );
replay( mockFedoraClient );
//do stuff
fa = new FedoraAdministration();
try
{
method = fa.getClass().getDeclaredMethod( "createFedoraResource", argClasses );
method.setAccessible( true );
result = (String)method.invoke( fa, args );
}
catch( InvocationTargetException ite )
{
Assert.fail();
}
assertTrue( result.equals( returnString ) );
//verify
verify( mockCargoObject );
verify( mockFedoraClient );
}
/**
* Testing the constructor
*/
/**
* Testing the happy path of the constructor, the only path.
*/
@Test public void testConstructor()
{
fa = new FedoraAdministration();
}
/**
* Testing public methods and mocking the private once.
*/
/**
* Testing the deleteObject method
*/
@Test public void testDeleteObject()throws ConfigurationException, MalformedURLException, ServiceException, IOException
{
//nothing to test yet
}
/**
* Testing the markObjectAsDeleted method
*/
@Test public void testMarkObjectAsDeleted()
{
//nothing to test yet
}
/**
* Tests the happy path of the retrieveCargoContainer method
*/
@Test
public void testRetrieveContainer() throws IOException, ParserConfigurationException, RemoteException, SAXException, ConfigurationException, MalformedURLException, ServiceException
{
Mockit.setUpMocks( MockFedoraHandle.class );
Mockit.setUpMocks( MockFedoraAdministration.class );
Mockit.setUpMocks( MockXMLUtils.class );
String byteString = "admindata";
byte[] bytes = byteString.getBytes();
//expectations
expect( mockNodeList.getLength()).andReturn( 1 );
//loop
expect( mockNodeList.item( 0 ) ).andReturn( mockElement );
expect( mockElement.getAttribute( "id" ) ).andReturn( "streamID" );
expect( mockFea.getDatastreamDissemination( "pid", "streamID", null) ).andReturn( mockMTStream );
//construnting the CargoContainer
expect( mockElement.getAttribute( "streamNameType" ) ).andReturn( "originalData" );
expect( mockElement.getAttribute( isA( String.class ) ) ).andReturn( "test" ).times( 3 );
expect( mockElement.getAttribute( isA( String.class ) ) ).andReturn( "text/xml" );
expect( mockMTStream.getStream() ).andReturn( bytes );
//out of loop
//replay
replay( mockElement );
replay( mockNodeList );
replay( mockMTStream );
replay( mockFea );
//do stuff
fa = new FedoraAdministration();
CargoContainer cc = fa.retrieveCargoContainer( "pid" );
assertTrue( cc.getCargoObjectCount() == 1 );
//verify
verify( mockElement );
verify( mockNodeList );
verify( mockMTStream );
verify( mockFea );
}
/**
* Testing the happy path of the storeContainer method
*/
@Test public void testStoreCargoContainer() throws ConfigurationException, java.io.IOException, java.net.MalformedURLException, ServiceException, ClassNotFoundException, MarshalException, ParseException, ParserConfigurationException, RemoteException, SAXException, SQLException, TransformerException, ValidationException, XPathExpressionException, InstantiationException, IllegalAccessException
{
//setup
Mockit.setUpMocks( MockFedoraHandle.class );
//Mockit.setUpMocks( MockFedoraTools.class );
Mockit.setUpMocks( MockFedoraUtils.class );
Mockit.setUpMocks( MockPIDManager.class );
// String byteString = "bytes";
String format = "test";
String logm = String.format( "%s inserted", format);
String fedMessage = Constants.FOXML1_1.toString();//"info:fedora/fedora-system:FOXML-1.1";
//byte[] bytes = byteString.getBytes();
//expectations
expect( mockCC.getCargoObjectCount() ).andReturn( 2 );
expect( mockCC.getDCIdentifier() ).andReturn( null );
mockCC.setDCIdentifier( "test:1" );
expect( mockCC.getCargoObject( DataStreamType.OriginalData ) ).andReturn( mockCargoObject );
expect( mockCargoObject.getFormat() ).andReturn( format );
expect( mockFem.ingest( bytes, fedMessage, logm ) ).andReturn( "test:1" );
//replay
replay( mockCC );
replay( mockCargoObject );
replay( mockFem );
//do stuff
fa = new FedoraAdministration();
String result = fa.storeCargoContainer( mockCC, "test");
assertTrue( result.equals( "test:1" ) );
//verify
verify( mockCC );
verify( mockFem );
}
/**
* Testing the storeCa the IllegalStateException when there are no
* CargoObjects in the CargoContainer
*/
@Test (expected = IllegalStateException.class)
public void testEmptyCargoContainerShouldNotBeStored() throws ConfigurationException, IOException, ServiceException, ClassNotFoundException, MarshalException, ParseException, ParserConfigurationException, SAXException, SQLException, TransformerException, ValidationException, XPathExpressionException
{
//expectations
expect( mockCC.getCargoObjectCount() ).andReturn( 0 );
//replay
replay( mockCC );
//do stuff
fa = new FedoraAdministration();
String result = fa.storeCargoContainer( mockCC, "test");
//verify
verify( mockCC );
}
/**
* Testing the getDataStreamsOfType method
*/
@Test
public void testGetDataStreamsOfType() throws MalformedURLException, IOException, RemoteException, ParserConfigurationException, SAXException, ServiceException, ConfigurationException
{
//setup
Mockit.setUpMocks( MockFedoraAdministration.class );
Mockit.setUpMocks( MockFedoraHandle.class );
String pid = "test:1";
String streamID = "streamID";
DataStreamType typeOfStream = DataStreamType.OriginalData;
String typeOfStreamString = typeOfStream.getName();
CargoContainer cc;
//expectations
expect( mockNodeList.getLength() ).andReturn( 2 );
expect( mockNodeList.item( 0 ) ).andReturn( mockElement );
expect( mockElement.getAttribute( "streamNameType" ) ).andReturn( typeOfStreamString );
expect( mockElement.getAttribute( "id" ) ).andReturn( streamID );
expect( mockFea.getDatastreamDissemination( pid, streamID, null ) ).andReturn( mockMTStream );
expect( mockMTStream.getStream() ).andReturn( bytes );
expect( mockElement.getAttribute( isA(String.class ) ) ).andReturn( "string" ).times( 3 );
expect( mockElement.getAttribute( "mimetype" ) ).andReturn( "text/xml" );
//2nd time in loop
expect( mockNodeList.item( 1 ) ).andReturn( mockElement );
expect( mockElement.getAttribute( "streamNameType" ) ).andReturn( "hat" );
//replay
replay( mockElement );
replay( mockNodeList );
replay( mockMTStream );
replay( mockFea );
//do stuff
fa = new FedoraAdministration();
cc = fa.getDataStreamsOfType( pid, typeOfStream );
assertTrue( cc.getCargoObjectCount() == 1 );
//verify
verify( mockElement );
verify( mockNodeList );
verify( mockMTStream );
verify( mockFea );
}
/**
* Testing the getDataStream method
*/
@Test
public void testGetDataStream() throws MalformedURLException, IOException, RemoteException, ServiceException, ParserConfigurationException, SAXException, ConfigurationException
{
//setup
Mockit.setUpMocks( MockFedoraAdministration.class );
Mockit.setUpMocks( MockFedoraHandle.class );
String streamID = "streamID";
String pid = "test:1";
CargoContainer cc;
//expectations
expect( mockNodeList.getLength() ).andReturn( 2 );
expect( mockNodeList.item( 0 ) ).andReturn( mockElement );
expect( mockElement.getAttribute( "id" ) ).andReturn( streamID );
expect( mockFea.getDatastreamDissemination( pid, streamID, null ) ).andReturn( mockMTStream );
expect( mockMTStream.getStream() ).andReturn( bytes );
expect( mockElement.getAttribute( "streamNameType" ) ).andReturn( "originalData" );
expect( mockElement.getAttribute( isA(String.class ) ) ).andReturn( "string" ).times( 3 );
expect( mockElement.getAttribute( "mimetype" ) ).andReturn( "text/xml" );
//2nd time in loop
expect( mockNodeList.item( 1 ) ).andReturn( mockElement );
expect( mockElement.getAttribute( "id" ) ).andReturn( "hat" );
//replay
replay( mockElement );
replay( mockNodeList );
replay( mockMTStream );
replay( mockFea );
//do stuff
fa = new FedoraAdministration();
cc = fa.getDataStream( pid, streamID );
assertTrue( cc.getCargoObjectCount() == 1 );
//verify
verify( mockElement );
verify( mockNodeList );
verify( mockMTStream );
verify( mockFea );
}
/**
* Testing the addDataStreamToObject method
*/
@Test
public void testAddDataStreamToObject() throws RemoteException, MalformedURLException, ParserConfigurationException, TransformerConfigurationException, TransformerException, SAXException, IOException, ConfigurationException, ServiceException, DOMException, TransformerFactoryConfigurationError
{
//setup
Mockit.setUpMocks( MockFedoraAdministration2.class );
Mockit.setUpMocks( MockFedoraHandle.class );
//byte[] adminStreamBytes = createAdminStreamBytes();
DataStreamType testDST = DataStreamType.RelsExt;
String testPid = "test:1";
String returnString = "admLoc";
String adminLogm = "admin stream updated with added stream data"+timeNow;
String logm = String.format( "added %s to the object with pid: %s", "dsLocation", testPid );
//expectations
expect( mockCargoObject.getDataStreamType() ).andReturn( testDST );
//expect( mockFea.getDatastreamDissemination( testPid, "adminData", null ) ).andReturn( mockMTStream );
//expect( mockMTStream.getStream() ).andReturn( adminStreamBytes );
expect( mockCargoObject.getLang() ).andReturn( "testLang" );
expect( mockCargoObject.getFormat() ).andReturn( "testFormat" );
expect( mockCargoObject.getMimeType() ).andReturn( "text/xml" );
expect( mockCargoObject.getSubmitter() ).andReturn( "test" );
expect( mockFedoraClient.uploadFile( isA( File.class ) ) ).andReturn( returnString );
expect( mockFem.modifyDatastreamByReference( testPid, "adminData", empty, "admin [text/xml]", "text/xml", null, returnString, null , null, adminLogm, true ) ).andReturn( "hat" );
//expect( mockFem.modifyDatastreamByReference( isA( String.class), isA( String.class), isA( String[].class), isA(String.class), isA(String.class),isA(String.class), isA(String.class), isA(String.class) , isA(String.class), isA(String.class), isA(Boolean.class) ) ).andReturn( "hat" );
expect( mockCargoObject.getFormat() ).andReturn( "testFormat" );
expect( mockCargoObject.getMimeType() ).andReturn( "text/xml" );
expect( mockFem.addDatastream( testPid, "relsExt.2", empty, "testFormat", false, "text/xml", null, "dsLocation", "M", "A", null, null, logm ) ).andReturn( "testSID" );
//replay
replay( mockCargoObject );
replay( mockFea );
replay( mockMTStream );
replay( mockFem );
replay( mockFedoraClient );
//do stuff
fa = new FedoraAdministration();
String result = fa.addDataStreamToObject( mockCargoObject, testPid, false, false );
assertEquals( result, "testSID");
//verify
verify( mockCargoObject );
verify( mockFea );
verify( mockMTStream );
verify( mockFem );
verify( mockFedoraClient );
}
/**
* Testing the modifyDataStream method
*/
@Test
public void testModifyDataStream()throws RemoteException, MalformedURLException, IOException, ConfigurationException, ServiceException
{
//setup
Mockit.setUpMocks( MockFedoraAdministration.class);
Mockit.setUpMocks( MockFedoraHandle.class);
String sID = "streamID";
String pid = "test:1";
String format = "format";
String mimeType = "mimeType";
String logm = String.format( "modified the object with pid: %s", pid );
//expectations
expect( mockCargoObject.getFormat() ).andReturn( format );
expect( mockCargoObject.getMimeType() ).andReturn( mimeType );
expect( mockFem.modifyDatastreamByReference( pid, sID, empty, format, mimeType, null, "dsLocation", null, null, logm, true ) ).andReturn( sID );
//expect().andReturn();
//replay
replay( mockCargoObject );
replay( mockFem );
//do stuff
fa = new FedoraAdministration();
String result = fa.modifyDataStream( mockCargoObject, sID, pid, false, true );
assertEquals( sID, result );
//verify
verify( mockCargoObject );
verify( mockFem );
}
/**
* Testing the removeDataStream method
*/
@Test
public void testRemoveDataStream() throws RemoteException, ParserConfigurationException, TransformerConfigurationException, TransformerException, IOException, SAXException, ConfigurationException, ServiceException
{
//setup
Mockit.setUpMocks( MockFedoraAdministration2.class );
Mockit.setUpMocks( MockFedoraHandle.class );
Mockit.setUpMocks( MockFileHandler.class );
String admLocation = "location";
String pid = "test:1";
String sID = "relsExt.1";
String startDate = "start";
String endDate = "end";
String adminLabel = "admin [text/xml]";
String mimeType = "text/xml";
String adminLogm = "admin stream updated with added stream data"+ timeNow;
String logm = String.format( "removed stream %s from object %s", sID, pid );
//expectations
expect( mockFem.purgeDatastream( pid, sID, startDate, endDate, logm, true ) ).andReturn( new String[] { "not", "used" });
expect( mockFedoraClient.uploadFile( isA( File.class ) ) ).andReturn( admLocation );
expect( mockFem.modifyDatastreamByReference( pid, "adminData", empty, adminLabel, mimeType, null, admLocation, null, null, adminLogm, true ) ).andReturn( "not used" );
//replay
replay( mockFem );
replay( mockFedoraClient );
//do stuff
fa = new FedoraAdministration();
boolean result = fa.removeDataStream( pid, sID, startDate, endDate, true );
//verify
assertTrue( result );
//check the modified adminstream
NodeList streamsNL = XMLUtils.getNodeList( admStreamFile, "streams" );
assertTrue( streamsNL.getLength() == 1 );
Element streams = (Element)streamsNL.item( 0 );
NodeList streamNL = streams.getElementsByTagName( "stream" );
assertTrue( streamNL.getLength() == 2 );
Element stream = (Element)streamNL.item( 0 );
assertEquals( stream.getAttribute( "id" ) , "relsExt.0" );
verify( mockFem );
verify( mockFedoraClient );
}
/**
* Testing the returning of false by the removeDataStream method when not
* able to remove the desired stream. The adminstream should not be modified
*/
@Test
public void testFailureRemoveDataStream() throws RemoteException, ParserConfigurationException, TransformerConfigurationException, TransformerException, IOException, SAXException, ConfigurationException, ServiceException
{
//setup
Mockit.setUpMocks( MockFedoraAdministration2.class );
Mockit.setUpMocks( MockFedoraHandle.class );
Mockit.setUpMocks( MockFileHandler.class );
String admLocation = "location";
String pid = "test:1";
String sID = "relsExt.1";
String startDate = "start";
String endDate = "end";
String adminLabel = "admin [text/xml]";
String mimeType = "text/xml";
String adminLogm = "admin stream updated with added stream data"+ timeNow;
String logm = String.format( "removed stream %s from object %s", sID, pid );
//expectations
expect( mockFem.purgeDatastream( pid, sID, startDate, endDate, logm, true ) ).andReturn( null );
//replay
replay( mockFem );
replay( mockFedoraClient );
//do stuff
fa = new FedoraAdministration();
boolean result = fa.removeDataStream( pid, sID, startDate, endDate, true );
//verify
assertFalse( result );
verify( mockFem );
verify( mockFedoraClient );
}
/**
* Testing the addRelation method, happy path
*/
@Test
public void testAddRelation() throws RemoteException, ConfigurationException, MalformedURLException, ServiceException, IOException
{
//setup
Mockit.setUpMocks( MockFedoraHandle.class);
String pid = "test:1";
String predicate = "predicate";
String isMemberOfCollectionPredicate = "info:fedora/fedora-system:def/relations-external#isMemberOfCollection";
String targetDCIdentifier = "DCid";
boolean literal = false;
String datatype = "unknown";
//expectations
expect( mockFem.addRelationship( pid, isMemberOfCollectionPredicate, targetDCIdentifier, literal, datatype) ).andReturn( true );
//replay
replay( mockFem );
//do stuff
fa = new FedoraAdministration();
assertTrue( fa.addRelation( pid, predicate, targetDCIdentifier, literal, datatype ) );
//verify
verify( mockFem );
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d8e7fa11186c6b654b4008d0b10aabdca08b77e2 | 4392a71def3cfbe805dba94d81df0ffba6d52357 | /jinterviewback/src/main/java/io/cjf/jinterviewback/util/ImgUtil.java | c82c64da857600d8c10a2f622fe910ef9aec32bd | [] | no_license | nlpxdc/jinterview1702c | 64b8fc61dccfaf59ade14a74cf4592b987347068 | f22b7f02aa34db4bc065f5f1ea31aaab6e89651b | refs/heads/develop | 2022-07-14T14:46:20.183897 | 2020-01-02T07:40:43 | 2020-01-02T07:40:43 | 224,953,724 | 0 | 0 | null | 2022-06-29T17:50:37 | 2019-11-30T03:25:03 | JavaScript | UTF-8 | Java | false | false | 1,798 | java | package io.cjf.jinterviewback.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class ImgUtil {
private static Logger logger = LoggerFactory.getLogger(ImgUtil.class);
public static byte[] redraw(InputStream originImgInputStream, int pixel) throws IOException {
final BufferedImage originImage = ImageIO.read(originImgInputStream);
final int width = originImage.getWidth();
final int height = originImage.getHeight();
BufferedImage newImage = originImage;
if (width < height) {
if (width > pixel) {
double newHeight = 1.0 * pixel * height / width;
newImage = new BufferedImage(pixel, (int) newHeight, originImage.getType());
final Graphics2D graphics = newImage.createGraphics();
graphics.drawImage(originImage, 0, 0, pixel, (int) newHeight, null);
graphics.dispose();
}
} else {
if (height > pixel) {
double newWidth = 1.0 * pixel * width / height;
newImage = new BufferedImage((int) newWidth, pixel, originImage.getType());
final Graphics2D graphics = newImage.createGraphics();
graphics.drawImage(originImage, 0, 0, (int) newWidth, pixel, null);
graphics.dispose();
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(newImage, "jpg", baos);
byte[] data = baos.toByteArray();
logger.info("image after redraw size: {}", data.length);
return data;
}
}
| [
"nlpx_dc@hotmail.com"
] | nlpx_dc@hotmail.com |
e7632f27e6c210789db03bdc6c1f0fc5eb3132dc | 6f31bf4c59dd7f9ab798cc1bf4593291e74e20be | /src/main/java/com/epam/hw3/behavior/QuackBehavior.java | b008942a7d754ac4b6150c223579f069ca4fb984 | [] | no_license | annaegorovaa/EJC02 | 7748b994a8f9ea757a763cec34a664a5019f4b5f | c86ecb892476f63a1eb2e691ead88383513052b7 | refs/heads/master | 2021-08-24T01:14:58.210121 | 2017-12-07T11:49:16 | 2017-12-07T11:49:16 | 106,321,483 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package com.epam.hw3.behavior;
public interface QuackBehavior {
String quack();
}
| [
"anju.egorova@gmail.com"
] | anju.egorova@gmail.com |
0aeec414a72aad50c4a80269e800ec1c50bd0479 | 95c708264a661819f12c90898835c95e8ba3aeb0 | /LeitorDados/src/br/com/involves/menu/MenuConsole.java | a54e5ffe85d7c7a72e8372791bad17a048784f1a | [] | no_license | geancp/testeInvolves | 434d7babdb593af605852f1fab5ebab27b14a67d | 4c022d70669b5b990325941e9fac2a923bc8019a | refs/heads/master | 2021-01-11T21:31:40.881001 | 2017-01-13T01:01:47 | 2017-01-13T01:03:51 | 78,797,975 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,226 | java | package br.com.involves.menu;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import br.com.involves.Exceptions.ConsoleException;
import br.com.involves.operacoes.ManagerOperadores;
public class MenuConsole {
public static String solicitarEntradaUsuario(String msg) {
System.out.print(msg);
return MenuConsole.leEntradaUsuario();
}
public static String leEntradaUsuario() {
String comando = null;
try {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(isr);
comando = in.readLine();
} catch (IOException e) {
MenuConsole.exibeErro(new ConsoleException("Erro ao obter informações do usuário.", e));
}
return comando;
}
public static void exibeComandosValidos() {
System.out.println("As operações permitidas são:");
ManagerOperadores.getInstance().getOperadores().stream()
.forEach(operador -> {
System.out.println(operador.getDescricaoDeUso());
});
}
public static void exibeErro(Exception e) {
System.out.println(e.getMessage());
}
public static void exibeSolicitacaoDeComando() {
System.out.print("Comando: ");
}
}
| [
"Gean@192.168.25.6"
] | Gean@192.168.25.6 |
cb6cc45d41555dda596967ca07b8049e23952119 | 3dc7a58614c271d3795497ed876f05ea8400af46 | /src/main/java/com/sv/score/service/ComputeScoreService.java | 248b682d79de68d61735327dc9b597d026722b77 | [] | no_license | medbs/search-volume | 13fe8fc9e6ad1246dc1806fc80a0e588bd19c615 | dcc02218b17427fff1d3e691db35a57a1be00e50 | refs/heads/master | 2021-06-30T18:34:45.601922 | 2020-02-25T22:37:54 | 2020-02-25T22:37:54 | 236,338,492 | 1 | 0 | null | 2021-06-04T02:26:38 | 2020-01-26T16:17:40 | Java | UTF-8 | Java | false | false | 4,646 | java | package com.sv.score.service;
import com.sv.score.dto.ResponseDto;
import com.sv.score.dto.WordScoreDto;
import com.sv.score.dto.WordSuggestionsDto;
import com.sv.score.interfaces.IScoreServiceV2;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.*;
@Service
public class ComputeScoreService implements IScoreServiceV2 {
private Logger logger = LoggerFactory.getLogger(ComputeScoreService.class);
@Value("${amazon.api.url}")
private String apiUrl;
/**
* compute score
*
* @param keyWord string
* @return ResponseDto
*/
@Override
public ResponseDto<WordScoreDto> computeScore(String keyWord) {
HashMap<String, Integer> commonPrefixWords = new HashMap<>();
List<String> suggestions = getWordSuggestions(keyWord).getData().getSuggestions();
Integer removedLetters = 0;
for (String suggestion : suggestions) {
commonPrefixWords.put(suggestion, removedLetters);
}
//used to keep the original value of keyword,without removing chars, to be returned in method response
String unModifiedKeyword = keyWord;
//remove one letter for keyword
keyWord = removeLetterFromKeyWord(keyWord);
removedLetters++;
while (keyWord.length() != 0) {
List<String> newSuggestions = getWordSuggestions(keyWord).getData().getSuggestions();
for (String suggestion : newSuggestions) {
if (commonPrefixWords.containsKey(suggestion)) {
commonPrefixWords.put(suggestion, removedLetters);
}
}
logger.info("sSearched keyword after removal of 1 letter: " + keyWord);
keyWord = removeLetterFromKeyWord(keyWord);
removedLetters++;
}
logger.info("number of iterations " + removedLetters);
return new ResponseDto<>(new WordScoreDto(unModifiedKeyword, calculateScore(commonPrefixWords, unModifiedKeyword)));
}
/**
* This method gets the suggestions (words) of a given keyWord ,
*
* @param keyWord string
* @return wordSuggestionsDto: structure holding the keyword and its suggestions
*/
private ResponseDto<WordSuggestionsDto> getWordSuggestions(String keyWord) {
keyWord = keyWord.replaceAll(" ", "+");
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(apiUrl + keyWord);
WordSuggestionsDto wordSuggestionsDto = new WordSuggestionsDto();
try {
String responseJson = EntityUtils.toString(client.execute(httpPost).getEntity());
JSONArray responseArray = new JSONArray(responseJson);
wordSuggestionsDto.setKeyWord(responseArray.get(0).toString());
JSONArray suggestions = new JSONArray(responseArray.get(1).toString());
suggestions.forEach(suggestion -> {
wordSuggestionsDto.getSuggestions().add(suggestion.toString());
});
return new ResponseDto<>(true, "", wordSuggestionsDto, HttpStatus.OK);
} catch (IOException e) {
return new ResponseDto<>(false, e.getMessage(), null, HttpStatus.BAD_REQUEST);
}
}
/**
* @param words, Map<String, Integer>
* @param keyWord string
* @return score float
*/
private float calculateScore(Map<String, Integer> words, String keyWord) {
Integer keywordScore = words.get(keyWord);
Integer lowestScore = Collections.min(words.values());
Integer highestScore = Collections.max(words.values());
if (keywordScore == null) {
return Math.round(((float) lowestScore / highestScore) * 100);
}
return Math.round(((float) keywordScore / highestScore) * 100);
}
/**
* Remove last char from a string (keyword)
*
* @param keyWord string
* @return string
*/
private String removeLetterFromKeyWord(String keyWord) {
String polishedKeyWord = null;
if ((keyWord != null) && (keyWord.length() > 0)) {
polishedKeyWord = keyWord.substring(0, keyWord.length() - 1);
}
return polishedKeyWord;
}
}
| [
"med.boulaares@gmail.com"
] | med.boulaares@gmail.com |
97f1dfa792b062681c971018520ee380ac8802fd | 7c73da0b531bb380cc6efe546afcd048221b207c | /spring-core/src/test/java/org/springframework/util/FastByteArrayOutputStreamTests.java | 9eedeca8ee6d46a24c2520310aa336a2adf509e6 | [
"Apache-2.0"
] | permissive | langtianya/spring4-understanding | e8d793b9fe6ef9c39e9aeaf8a4101c0adb6b7bc9 | 0b82365530b106a935575245e1fc728ea4625557 | refs/heads/master | 2021-01-19T04:01:04.034096 | 2016-08-07T06:16:34 | 2016-08-07T06:16:34 | 63,202,955 | 46 | 27 | null | null | null | null | UTF-8 | Java | false | false | 5,657 | java | /*
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.util;
import static org.junit.Assert.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Before;
import org.junit.Test;
/**
* Test suite for {@link FastByteArrayOutputStream}
* @author Craig Andrews
*/
public class FastByteArrayOutputStreamTests {
private static final int INITIAL_CAPACITY = 256;
private FastByteArrayOutputStream os;
private byte[] helloBytes;
@Before
public void setUp() throws Exception {
this.os = new FastByteArrayOutputStream(INITIAL_CAPACITY);
this.helloBytes = "Hello World".getBytes("UTF-8");
}
@Test
public void size() throws Exception {
this.os.write(helloBytes);
assertEquals(this.os.size(), helloBytes.length);
}
@Test
public void resize() throws Exception {
this.os.write(helloBytes);
int sizeBefore = this.os.size();
this.os.resize(64);
assertByteArrayEqualsString(this.os);
assertEquals(sizeBefore, this.os.size());
}
@Test
public void autoGrow() throws IOException {
this.os.resize(1);
for (int i = 0; i < 10; i++) {
this.os.write(1);
}
assertEquals(10, this.os.size());
assertArrayEquals(this.os.toByteArray(), new byte[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
}
@Test
public void write() throws Exception {
this.os.write(helloBytes);
assertByteArrayEqualsString(this.os);
}
@Test
public void reset() throws Exception {
this.os.write(helloBytes);
assertByteArrayEqualsString(this.os);
this.os.reset();
assertEquals(0, this.os.size());
this.os.write(helloBytes);
assertByteArrayEqualsString(this.os);
}
@Test(expected = IOException.class)
public void close() throws Exception {
this.os.close();
this.os.write(helloBytes);
}
@Test
public void toByteArrayUnsafe() throws Exception {
this.os.write(helloBytes);
assertByteArrayEqualsString(this.os);
assertSame(this.os.toByteArrayUnsafe(), this.os.toByteArrayUnsafe());
assertArrayEquals(this.os.toByteArray(), helloBytes);
}
@Test
public void writeTo() throws Exception {
this.os.write(helloBytes);
assertByteArrayEqualsString(this.os);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
this.os.writeTo(baos);
assertArrayEquals(baos.toByteArray(), helloBytes);
}
@Test(expected = IllegalArgumentException.class)
public void failResize() throws Exception {
this.os.write(helloBytes);
this.os.resize(5);
}
@Test
public void getInputStream() throws Exception {
this.os.write(helloBytes);
assertNotNull(this.os.getInputStream());
}
@Test
public void getInputStreamAvailable() throws Exception {
this.os.write(helloBytes);
assertEquals(this.os.getInputStream().available(), helloBytes.length);
}
@Test
public void getInputStreamRead() throws Exception {
this.os.write(helloBytes);
InputStream inputStream = this.os.getInputStream();
assertEquals(inputStream.read(), helloBytes[0]);
assertEquals(inputStream.read(), helloBytes[1]);
assertEquals(inputStream.read(), helloBytes[2]);
assertEquals(inputStream.read(), helloBytes[3]);
}
@Test
public void getInputStreamReadAll() throws Exception {
this.os.write(helloBytes);
InputStream inputStream = this.os.getInputStream();
byte[] actual = new byte[inputStream.available()];
int bytesRead = inputStream.read(actual);
assertEquals(bytesRead, helloBytes.length);
assertArrayEquals(actual, helloBytes);
assertEquals(0, inputStream.available());
}
@Test
public void getInputStreamSkip() throws Exception {
this.os.write(helloBytes);
InputStream inputStream = this.os.getInputStream();
assertEquals(inputStream.read(), helloBytes[0]);
assertEquals(inputStream.skip(1), 1);
assertEquals(inputStream.read(), helloBytes[2]);
assertEquals(helloBytes.length - 3, inputStream.available());
}
@Test
public void getInputStreamSkipAll() throws Exception {
this.os.write(helloBytes);
InputStream inputStream = this.os.getInputStream();
assertEquals(inputStream.skip(1000), helloBytes.length);
assertEquals(0, inputStream.available());
}
@Test
public void updateMessageDigest() throws Exception {
StringBuilder builder = new StringBuilder("\"0");
this.os.write(helloBytes);
InputStream inputStream = this.os.getInputStream();
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
builder.append("\"");
String actual = builder.toString();
assertEquals("\"0b10a8db164e0754105b7a99be72e3fe5\"", actual);
}
@Test
public void updateMessageDigestManyBuffers() throws Exception {
StringBuilder builder = new StringBuilder("\"0");
// filling at least one 256 buffer
for( int i=0; i < 30; i++) {
this.os.write(helloBytes);
}
InputStream inputStream = this.os.getInputStream();
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
builder.append("\"");
String actual = builder.toString();
assertEquals("\"06225ca1e4533354c516e74512065331d\"", actual);
}
private void assertByteArrayEqualsString(FastByteArrayOutputStream actual) {
assertArrayEquals(helloBytes, actual.toByteArray());
}
}
| [
"hansongjy@gmail.com"
] | hansongjy@gmail.com |
98a3ba7b8e9e7e11a73213c7e708f26e270d529d | 8d529e1e5a7da146c128845b4ff73d7acabdb007 | /src/main/java/com/gnaderi/interview/cro/CroApplication.java | 9430596b7a4d2e703c65e30b3ef95e6677183020 | [] | no_license | gnaderi/CRO | 78cf654216b72f3a5211cce09ddb5bc38af9b6ae | 7a653e03446abbcfd41ab67fcba9fe5715508b67 | refs/heads/master | 2020-03-20T16:04:22.076275 | 2018-06-20T09:30:42 | 2018-06-20T09:30:42 | 137,528,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package com.gnaderi.interview.cro;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CroApplication {
@Autowired
public static void main(String[] args) {
SpringApplication.run(CroApplication.class, args);
}
}
| [
"gnaderi@Ghodrats-MacBook-Pro.local"
] | gnaderi@Ghodrats-MacBook-Pro.local |
25a1ae1a4256fc99e3d1d51c5d0401eaba1af859 | 767c8648856572557d301df7c71f9f3b7d7123fe | /Die.java | 7a8acdc57419a9942b56a5b305c8398bab46cd06 | [] | no_license | dboyer03/Craps | 053beb2b52999d5dd5ba3bd7c2c5ca07984b888d | f52068b03e874926c0cc478386801537f654c532 | refs/heads/master | 2020-12-23T05:16:33.994405 | 2020-02-13T04:37:37 | 2020-02-13T04:37:37 | 237,046,969 | 0 | 1 | null | 2020-02-13T04:37:38 | 2020-01-29T17:52:52 | Java | UTF-8 | Java | false | false | 314 | java |
/**
* Rolls 2 6-sided die and prints them out!
*
* @author Dylan Boyer
* @version 2020-1-16
*/
public class Die
{
private int roll;
public int roll()
{
roll = ((int) (Math.random() * 6) + 1);
return roll;
}
public int getResult()
{
return roll;
}
}
| [
"dylanjboyer@gmail.com"
] | dylanjboyer@gmail.com |
d6fdec119dab56a058eb61eb16a1e9dae8887709 | 511eb91ff41d9bc2096753260c6853e299faf44c | /src/main/java/com/mlf/creational/prototype/clone/Test.java | 4a06a4f930801ff621bdc6e5e8d8c8fc21ad8ba5 | [] | no_license | malifeng/design_pattern | ec46c97397b79925b32adc37651cc1734248cb31 | e4680267856a65430508b55e8dcc059f06bd8309 | refs/heads/master | 2021-05-24T19:02:04.245149 | 2020-07-09T08:44:31 | 2020-07-09T08:44:31 | 253,708,955 | 0 | 0 | null | 2020-10-13T23:11:25 | 2020-04-07T06:40:37 | Java | UTF-8 | Java | false | false | 1,081 | java | package com.mlf.creational.prototype.clone;
import com.mlf.creational.singleton.HungrySingleton;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Date;
public class Test {
public static void main(String[] args) throws CloneNotSupportedException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
// Date birthday = new Date(0L);
// Pig pig1 = new Pig("佩奇", birthday);
// Pig pig2 = (Pig)pig1.clone();
//
// System.out.println(pig1);
// System.out.println(pig2);
//
// pig1.getBirthday().setTime(66666666666L);
//
// System.out.println(pig1);
// System.out.println(pig2);
HungrySingleton singleton = HungrySingleton.getInstance();
Method method = singleton.getClass(
).getDeclaredMethod("clone");
method.setAccessible(true);
HungrySingleton cloneSingleton = (HungrySingleton) method.invoke(singleton);
System.out.println(cloneSingleton);
System.out.println(singleton);
}
}
| [
"lifeng.ma@unicareer.com"
] | lifeng.ma@unicareer.com |
f1bf2c6050fb2c5422a1fa3e063c663043282ed5 | 8cc3b33b96715365e71f8a8d61aad663ce56d3ee | /src/test/java/com/tieto/export/controller/MediaReplacedElementFactoryTest.java | 14d0c4a2aea48906494b2787e1e15accc6642ad8 | [] | no_license | Veranicus/export5 | 2511a660d69cfb7c1a1bade6bef2f9bc36d514c2 | 26ef9bd848fb272d6d4f11765a83d57b9cd2de4e | refs/heads/master | 2023-05-10T16:49:52.000105 | 2018-04-19T10:22:48 | 2018-04-19T10:22:48 | 130,198,621 | 0 | 0 | null | 2023-09-05T22:14:47 | 2018-04-19T10:22:38 | Java | UTF-8 | Java | false | false | 567 | java | package com.tieto.export.controller;
import org.junit.Test;
import static org.junit.Assert.*;
public class MediaReplacedElementFactoryTest {
@Test
public void createReplacedElement() {
}
@Test
public void reset() {
}
@Test
public void remove() {
}
@Test
public void setFormSubmissionListener() {
}
@Test
public void createReplacedElement1() {
}
@Test
public void reset1() {
}
@Test
public void remove1() {
}
@Test
public void setFormSubmissionListener1() {
}
} | [
"patrik.polacek@tieto.com"
] | patrik.polacek@tieto.com |
5fae4a3e2bd11b964ffbd5565dd1d22cfb257532 | 4208a2f35a099ba399914b54577e714eba64846f | /src/main/java/com/cal/base/system/entity/po/DataCodePO.java | 9a73a169f6bcde4d57220f9170c89f2a506e4b37 | [] | no_license | caoql/base | a616f6cbe63495374904fb19b1c065e1de90a9c9 | 1ab2fa86eddd03f9837a3661c8c1bf68c11a8439 | refs/heads/master | 2021-05-05T21:59:29.669237 | 2018-04-10T09:52:08 | 2018-04-10T09:52:08 | 116,122,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,559 | java | package com.cal.base.system.entity.po;
import java.io.Serializable;
import java.util.Date;
/**
* system_data_code表对应的PO
* @author andyc
* 2018-3-15
*/
public class DataCodePO implements Serializable {
/**
* 序列号
*/
private static final long serialVersionUID = 2676671156353876689L;
private String id;
private String domainId;
private String dataCode;
private String dataName;
private String remark;
private Date createTime;
private String creator;
private Date updateTime;
private String updator;
@Override
public String toString() {
return "DataCodePO [id=" + id + ", domainId=" + domainId
+ ", dataCode=" + dataCode + ", dataName=" + dataName
+ ", remark=" + remark + ", createTime=" + createTime
+ ", creator=" + creator + ", updateTime=" + updateTime
+ ", updator=" + updator + "]";
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getDomainId() {
return domainId;
}
public void setDomainId(String domainId) {
this.domainId = domainId == null ? null : domainId.trim();
}
public String getDataCode() {
return dataCode;
}
public void setDataCode(String dataCode) {
this.dataCode = dataCode == null ? null : dataCode.trim();
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName == null ? null : dataName.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator == null ? null : creator.trim();
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdator() {
return updator;
}
public void setUpdator(String updator) {
this.updator = updator == null ? null : updator.trim();
}
} | [
"2397776038@qq.com"
] | 2397776038@qq.com |
6faf37732de8acc37cfc761da308296487e84173 | a68f3c780ec70d8977595a9135270f501047c224 | /mylibrary/src/main/java/cn/david/zhumingwei/mylibrary/renderer/PreviewColumnChartRenderer.java | bbc0967b8012ffcec63c43f89daca5b993757816 | [] | no_license | zhumingwei/chartsDemo | 82d67be37bda7462638a141aae0421346bde196a | f449a96b995935abc53470038d8200b6a4d2c757 | refs/heads/master | 2021-01-20T22:23:52.433627 | 2016-07-04T07:41:58 | 2016-07-04T07:41:58 | 62,482,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,170 | java | package cn.david.zhumingwei.mylibrary.renderer;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import cn.david.zhumingwei.mylibrary.model.Viewport;
import cn.david.zhumingwei.mylibrary.provider.ColumnChartDataProvider;
import cn.david.zhumingwei.mylibrary.util.ChartUtils;
import cn.david.zhumingwei.mylibrary.view.Chart;
/**
* Renderer for preview chart based on ColumnChart. In addition to drawing chart data it also draw current viewport as
* preview area.
*/
public class PreviewColumnChartRenderer extends ColumnChartRenderer {
private static final int DEFAULT_PREVIEW_TRANSPARENCY = 64;
private static final int FULL_ALPHA = 255;
private static final int DEFAULT_PREVIEW_STROKE_WIDTH_DP = 2;
private Paint previewPaint = new Paint();
public PreviewColumnChartRenderer(Context context, Chart chart, ColumnChartDataProvider dataProvider) {
super(context, chart, dataProvider);
previewPaint.setAntiAlias(true);
previewPaint.setColor(Color.LTGRAY);
previewPaint.setStrokeWidth(ChartUtils.dp2px(density, DEFAULT_PREVIEW_STROKE_WIDTH_DP));
}
@Override
public void drawUnclipped(Canvas canvas) {
super.drawUnclipped(canvas);
final Viewport currentViewport = computator.getCurrentViewport();
final float left = computator.computeRawX(currentViewport.left);
final float top = computator.computeRawY(currentViewport.top);
final float right = computator.computeRawX(currentViewport.right);
final float bottom = computator.computeRawY(currentViewport.bottom);
previewPaint.setAlpha(DEFAULT_PREVIEW_TRANSPARENCY);
previewPaint.setStyle(Paint.Style.FILL);
canvas.drawRect(left, top, right, bottom, previewPaint);
previewPaint.setStyle(Paint.Style.STROKE);
previewPaint.setAlpha(FULL_ALPHA);
canvas.drawRect(left, top, right, bottom, previewPaint);
}
public int getPreviewColor() {
return previewPaint.getColor();
}
public void setPreviewColor(int color) {
previewPaint.setColor(color);
}
}
| [
"312192599@qq.com"
] | 312192599@qq.com |
b14215cd057bd98eb14eb6ac011f03fdc8ffa75d | a77cbaeb8b20e03bd0759cc95af22346a72992c6 | /src/java/com/mangium/SliderBean.java | 29729ae9d91f38834ace025b2a1b4291c0f627f8 | [] | no_license | swetha2104/Website | e0d038fc050cd7137d8f20463fb9376791947165 | 530eed988513b4a249bb9ac9d20b67884f1bc955 | refs/heads/master | 2021-01-19T15:46:23.573740 | 2014-02-05T10:54:56 | 2014-02-05T10:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,848 | java |
package com.mangium;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import org.primefaces.event.SlideEndEvent;
@ManagedBean
@RequestScoped
public class SliderBean {
private int number1;
private int number2;
private int number3;
private int number4;
private int number5;
private int number6 = 300000;
private int number7 = 500000;
public int getNumber1() {
return number1;
}
public void setNumber1(int number1) {
this.number1 = number1;
}
public int getNumber2() {
return number2;
}
public void setNumber2(int number2) {
this.number2 = number2;
}
public int getNumber3() {
return number3;
}
public void setNumber3(int number3) {
this.number3 = number3;
}
public int getNumber4() {
return number4;
}
public void setNumber4(int number4) {
this.number4 = number4;
}
public int getNumber5() {
return number5;
}
public void setNumber5(int number5) {
this.number5 = number5;
}
public int getNumber6() {
return number6;
}
public void setNumber6(int number6) {
this.number6 = number6;
}
public int getNumber7() {
return number7;
}
public void setNumber7(int number7) {
this.number7 = number7;
}
public void onSlideEnd(SlideEndEvent event) {
FacesMessage msg = new FacesMessage("Slide Ended", "Value: " + event.getValue());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
| [
"Acer@Acer-PC"
] | Acer@Acer-PC |
d73ee5d12b1d5c3df36989c7b8b8a9b2ad115da0 | 45c494103360091d77eed65dcc725c05f87eca6e | /Fundamentals of Programming Using JAVA/src/Decisionmaking/Ifstmnt.java | ad9340d78bef0db42c45e75c212083a428ecce71 | [] | no_license | Adhithya-PGK331/Fundamentals_of_programming | 8a849fade0b9427204e6bc6438b659b431f9019c | 0646175854d2dfa26effbb489066c8b4ec864b2e | refs/heads/master | 2020-09-20T09:46:28.593331 | 2019-11-27T13:50:57 | 2019-11-27T13:50:57 | 224,441,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package Decisionmaking;
import java.util.Scanner;
public class Ifstmnt {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
System.out.println("Enter the age :");
int personage=s.nextInt();
if (personage>=18)
{
System.out.println("The person is eligible for voting");
}s.close();
}
}
| [
"USER@FACE-71"
] | USER@FACE-71 |
f078b0174a7291fbc5615009c8930b9056f51ae1 | c80f25f9c8faa1ea9db5bb1b8e36c3903a80a58b | /laosiji-sources/feng/android/sources/com/tencent/liteav/g.java | 5eaf62bca47f72d68b75632db37b89d6b1ba041f | [] | no_license | wenzhaot/luobo_tool | 05c2e009039178c50fd878af91f0347632b0c26d | e9798e5251d3d6ba859bb15a00d13f085bc690a8 | refs/heads/master | 2020-03-25T23:23:48.171352 | 2019-09-21T07:09:48 | 2019-09-21T07:09:48 | 144,272,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,520 | java | package com.tencent.liteav;
import android.content.Context;
import android.os.Bundle;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import com.feng.car.utils.HttpConstant;
import com.tencent.ijk.media.player.IjkBitrateItem;
import com.tencent.ijk.media.player.MediaInfo;
import com.tencent.liteav.basic.b.a;
import com.tencent.liteav.basic.datareport.TXCDRApi;
import com.tencent.liteav.basic.log.TXCLog;
import com.tencent.liteav.basic.util.TXCTimeUtil;
import com.tencent.liteav.txcvodplayer.TextureRenderView;
import com.tencent.liteav.txcvodplayer.d;
import com.tencent.liteav.txcvodplayer.e;
import com.tencent.liteav.txcvodplayer.f;
import com.tencent.rtmp.TXBitrateItem;
import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.TXVodPlayer;
import com.tencent.rtmp.ui.TXCloudVideoView;
import java.util.ArrayList;
import java.util.Iterator;
/* compiled from: TXCVodPlayer */
public class g extends h {
protected boolean a;
private e f;
private d g;
private f h = null;
private boolean i;
private boolean j = true;
private boolean k = true;
private float l = 1.0f;
private Surface m;
private f n = new f() {
public void a(int i, Bundle bundle) {
int i2 = 1;
int i3 = 0;
Bundle bundle2 = new Bundle(bundle);
switch (i) {
case -3005:
i2 = TXLiveConstants.PLAY_ERR_HEVC_DECODE_FAIL;
if (!g.this.i) {
g.this.g.a(false);
break;
}
break;
case -3004:
i2 = TXLiveConstants.PLAY_ERR_HLS_KEY;
break;
case -3003:
i2 = TXLiveConstants.PLAY_ERR_FILE_NOT_FOUND;
break;
case -3002:
i2 = TXLiveConstants.PLAY_ERR_NET_DISCONNECT;
break;
case -3001:
i2 = TXLiveConstants.PLAY_ERR_NET_DISCONNECT;
break;
case TXLiveConstants.PLAY_EVT_START_VIDEO_DECODER /*2008*/:
i2 = TXLiveConstants.PLAY_EVT_START_VIDEO_DECODER;
break;
case 3000:
g.this.h.d();
i2 = TXLiveConstants.PLAY_EVT_VOD_PLAY_PREPARED;
break;
case 3001:
g.this.h.d();
i2 = 2004;
break;
case 3002:
i2 = 2006;
break;
case 3003:
g.this.h.i();
i2 = TXLiveConstants.PLAY_EVT_PLAY_LOADING;
break;
case TXLiveConstants.PUSH_WARNING_SERVER_DISCONNECT /*3004*/:
g.this.h.c();
if (!g.this.a) {
i2 = 2006;
break;
}
g.this.f.b();
TXCLog.d(TXVodPlayer.TAG, "loop play");
return;
case 3005:
i2 = TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION;
break;
case 3006:
i2 = TXLiveConstants.PLAY_WARNING_RECONNECT;
break;
case 3007:
i2 = 2005;
g.this.h.a(bundle.getInt(TXLiveConstants.EVT_PLAY_DURATION, 0));
break;
case 3008:
if (!g.this.i) {
g.this.i = true;
g.this.h.e();
Bundle bundle3 = new Bundle();
bundle3.putInt("EVT_ID", TXLiveConstants.PLAY_EVT_START_VIDEO_DECODER);
bundle3.putLong("EVT_TIME", TXCTimeUtil.getTimeTick());
MediaInfo mediaInfo = g.this.f.getMediaInfo();
if (!(mediaInfo == null || mediaInfo.mVideoDecoderImpl == null || !mediaInfo.mVideoDecoderImpl.contains("hevc"))) {
i3 = 1;
}
if (g.this.f.getPlayerType() == 0) {
if (i3 == 0) {
bundle3.putCharSequence(HttpConstant.DESCRIPTION, g.this.g.a() ? "启动硬解" : "启动软解");
} else {
bundle3.putCharSequence(HttpConstant.DESCRIPTION, g.this.g.a() ? "启动硬解265" : "启动软解265");
}
String str = "EVT_PARAM1";
if (!g.this.g.a()) {
i2 = 2;
}
bundle3.putInt(str, i2);
bundle3.putInt("hevc", i3);
} else {
bundle3.putCharSequence(HttpConstant.DESCRIPTION, "启动硬解");
bundle3.putInt("EVT_PARAM1", 2);
}
a(TXLiveConstants.PLAY_EVT_START_VIDEO_DECODER, bundle3);
i2 = 2003;
break;
}
return;
case 3009:
bundle2.putInt("EVT_PARAM1", g.this.f.getMetaRotationDegree());
i2 = TXLiveConstants.PLAY_EVT_CHANGE_ROTATION;
break;
case 3010:
i2 = TXLiveConstants.PLAY_WARNING_HW_ACCELERATION_FAIL;
if (!g.this.i) {
g.this.g.a(false);
break;
}
break;
case 3012:
g.this.h.f();
return;
case 3013:
g.this.h.h();
return;
case 3014:
g.this.h.g();
return;
case 3015:
return;
case 3016:
i2 = TXLiveConstants.PLAY_EVT_VOD_LOADING_END;
break;
default:
TXCLog.d(TXVodPlayer.TAG, "miss match event " + i);
return;
}
bundle2.putString(TXLiveConstants.EVT_DESCRIPTION, bundle.getString(HttpConstant.DESCRIPTION, ""));
if (g.this.e != null) {
a aVar = (a) g.this.e.get();
if (aVar != null) {
aVar.onNotifyEvent(i2, bundle2);
}
}
}
public void a(Bundle bundle) {
Bundle bundle2 = new Bundle();
int[] a = com.tencent.liteav.basic.util.a.a();
int intValue = Integer.valueOf(a[0]).intValue() / 10;
bundle2.putCharSequence(TXLiveConstants.NET_STATUS_CPU_USAGE, intValue + "/" + (Integer.valueOf(a[1]).intValue() / 10) + "%");
bundle2.putInt(TXLiveConstants.NET_STATUS_VIDEO_FPS, (int) bundle.getFloat("fps"));
bundle2.putInt(TXLiveConstants.NET_STATUS_NET_SPEED, ((int) bundle.getLong("tcpSpeed")) / 1000);
bundle2.putInt(TXLiveConstants.NET_STATUS_CODEC_CACHE, ((int) bundle.getLong("cachedBytes")) / 1000);
bundle2.putInt(TXLiveConstants.NET_STATUS_VIDEO_WIDTH, g.this.f.getVideoWidth());
bundle2.putInt(TXLiveConstants.NET_STATUS_VIDEO_HEIGHT, g.this.f.getVideoHeight());
bundle2.putString(TXLiveConstants.NET_STATUS_SERVER_IP, g.this.f.getServerIp());
if (g.this.e != null) {
a aVar = (a) g.this.e.get();
if (aVar != null) {
aVar.onNotifyEvent(15001, bundle2);
}
}
}
};
public g(Context context) {
super(context);
this.f = new e(context);
this.f.setListener(this.n);
}
public void a(c cVar) {
super.a(cVar);
if (this.g == null) {
this.g = new d();
}
this.g.a((float) this.b.e);
this.g.b((float) this.b.f);
this.g.c((float) this.b.q);
this.g.a(this.b.i);
this.g.a(this.b.m);
this.g.a(this.b.n);
this.g.b(this.b.o);
this.g.a(this.b.p);
this.g.b(this.b.r);
this.g.c(this.b.t);
this.g.b(this.b.u);
this.g.c(this.b.v);
this.f.setConfig(this.g);
this.k = cVar.s;
}
public int a(String str, int i) {
if (this.d != null) {
this.d.setVisibility(0);
TextureView textureRenderView = new TextureRenderView(this.d.getContext());
this.d.addVideoView(textureRenderView);
this.f.setTextureRenderView(textureRenderView);
} else if (this.m != null) {
this.f.setRenderSurface(this.m);
}
this.h = new f(this.c);
this.h.a(str);
this.h.b();
this.i = false;
this.f.setPlayerType(this.g.b());
this.f.setVideoPath(str);
this.f.setAutoPlay(this.j);
this.f.setRate(this.l);
this.f.setAutoRotate(this.k);
if (this.g != null) {
this.f.b();
if (this.g.b() == 1) {
this.h.b(3);
} else {
this.h.b(1);
}
} else {
this.f.b();
this.h.b(1);
}
TXCLog.d(TXVodPlayer.TAG, "startPlay " + str);
TXCDRApi.txReportDAU(this.c, com.tencent.liteav.basic.datareport.a.bo);
return 0;
}
public int a(boolean z) {
this.f.c();
if (!(this.d == null || this.d.getVideoView() == null || !z)) {
this.d.getVideoView().setVisibility(8);
}
if (this.h != null) {
this.h.c();
}
return 0;
}
public void a(Surface surface) {
this.m = surface;
if (this.f != null) {
this.f.setRenderSurface(this.m);
}
}
public void a() {
this.f.d();
}
public void b() {
this.f.b();
}
public void a(int i) {
this.f.a(i * 1000);
if (this.i && this.h != null) {
this.h.j();
}
}
public void a(float f) {
this.f.a((int) (1000.0f * f));
if (this.i && this.h != null) {
this.h.j();
}
}
public float c() {
if (this.f != null) {
return ((float) this.f.getCurrentPosition()) / 1000.0f;
}
return 0.0f;
}
public float d() {
if (this.f != null) {
return ((float) this.f.getBufferDuration()) / 1000.0f;
}
return 0.0f;
}
public float e() {
if (this.f != null) {
return ((float) this.f.getDuration()) / 1000.0f;
}
return 0.0f;
}
public float f() {
if (this.f != null) {
return ((float) this.f.getBufferDuration()) / 1000.0f;
}
return 0.0f;
}
public int g() {
if (this.f != null) {
return this.f.getVideoWidth();
}
return 0;
}
public int h() {
if (this.f != null) {
return this.f.getVideoHeight();
}
return 0;
}
public void b(boolean z) {
this.f.setMute(z);
}
public void b(int i) {
if (i == 1) {
this.f.setRenderMode(0);
} else {
this.f.setRenderMode(1);
}
}
public void c(int i) {
this.f.setVideoRotationDegree(360 - i);
}
public void a(TXCloudVideoView tXCloudVideoView) {
if (!(this.d == null || this.d == tXCloudVideoView)) {
View videoView = this.d.getVideoView();
if (videoView != null) {
this.d.removeView(videoView);
}
}
super.a(tXCloudVideoView);
if (this.d != null) {
this.d.setVisibility(0);
TextureView textureRenderView = new TextureRenderView(this.d.getContext());
this.d.addVideoView(textureRenderView);
this.f.setRenderView(textureRenderView);
}
}
public void a(TextureRenderView textureRenderView) {
if (this.f != null) {
this.f.setRenderView(textureRenderView);
}
}
public int d(int i) {
return 0;
}
public int i() {
return 0;
}
public TextureView j() {
if (this.d != null) {
return this.d.getVideoView();
}
return null;
}
public boolean k() {
return this.f.e();
}
public void c(boolean z) {
this.j = z;
if (this.f != null) {
this.f.setAutoPlay(z);
}
}
public void b(float f) {
this.l = f;
if (this.f != null) {
this.f.setRate(f);
}
if (this.i && this.h != null) {
this.h.l();
}
}
public int l() {
if (this.f != null) {
return this.f.getBitrateIndex();
}
return 0;
}
public void e(int i) {
if (this.f != null) {
this.f.setBitrateIndex(i);
}
if (this.i && this.h != null) {
this.h.k();
}
}
public ArrayList<TXBitrateItem> m() {
ArrayList<TXBitrateItem> arrayList = new ArrayList();
if (this.f != null) {
ArrayList supportedBitrates = this.f.getSupportedBitrates();
if (supportedBitrates != null) {
Iterator it = supportedBitrates.iterator();
while (it.hasNext()) {
IjkBitrateItem ijkBitrateItem = (IjkBitrateItem) it.next();
TXBitrateItem tXBitrateItem = new TXBitrateItem();
tXBitrateItem.index = ijkBitrateItem.index;
tXBitrateItem.width = ijkBitrateItem.width;
tXBitrateItem.height = ijkBitrateItem.height;
tXBitrateItem.bitrate = ijkBitrateItem.bitrate;
arrayList.add(tXBitrateItem);
}
}
}
return arrayList;
}
public void d(boolean z) {
this.a = z;
}
public void e(boolean z) {
TextureView j = j();
if (j != null) {
j.setScaleX(z ? -1.0f : 1.0f);
}
if (this.h != null) {
this.h.a(z);
}
}
}
| [
"tanwenzhao@vipkid.com.cn"
] | tanwenzhao@vipkid.com.cn |
4835c6bf2e4b3d98bf232b7fc7715c8521469636 | dbeed91de45c5beddad0fb48e9bd77516b9c605d | /app/src/main/java/com/tylerjette/growmindv05/upcomingNotificationsAdapter.java | 8fb1e30be1531660ad24551fa662c60c4bf467ee | [] | no_license | tnjette/Growminder | 3ce59787843f772c281e20326e9f0b6f5917b778 | dafe74a7c82f43d6db1e223799cb2d342a64b51d | refs/heads/main | 2023-01-24T22:04:19.216524 | 2020-12-06T21:30:22 | 2020-12-06T21:30:22 | 316,308,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,273 | java | package com.tylerjette.growmindv05;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.List;
/**
* Created by tylerjette on 12/23/17.
*/
public class upcomingNotificationsAdapter extends RecyclerView.Adapter<upcomingNotificationsAdapter.ViewHolder> {
//private static final String TAG = upcomingNotificationsAdapter.class.getSimpleName();
private Context context;
List<varietyCal> varietyCalList; //haven't made any varietyCal class yet...
//HashMap<String, String> varietyCalList;
public upcomingNotificationsAdapter(Context context, List<varietyCal> varietyCalList){
this.varietyCalList = varietyCalList;
this.context = context;
}
public static class ViewHolder extends RecyclerView.ViewHolder //implements View.OnClickListener
{
ImageView upcomingNotificationVarietyImage;
TextView upcomingNotificationVarietyName;
TextView upcomingNotificationVarietyEventTitle;
TextView varietyCycleSubtitle;
public ViewHolder (View v)
{
super( v );
upcomingNotificationVarietyImage = (ImageView) v.findViewById(R.id.dashboard_variety_image);
upcomingNotificationVarietyName = (TextView) v.findViewById(R.id.dashboard_variety_name);
upcomingNotificationVarietyEventTitle = (TextView) v.findViewById(R.id.dashboard_variety_event_title);
varietyCycleSubtitle = (TextView) v.findViewById(R.id.variety_cycle_subtitle);
}
}
@Override
public ViewHolder onCreateViewHolder (ViewGroup parent, int viewType)
{
View dashboardVarietyView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.upcoming_notification_item_row, parent, false);
return new ViewHolder(dashboardVarietyView);
}
@Override
public void onBindViewHolder (final ViewHolder holder, int position)
{
final varietyCal varietyCal = varietyCalList.get( position );
holder.upcomingNotificationVarietyName.setText(varietyCal.getName());
final Boolean eventCycle = varietyCal.getIsFallCycle();
//Log.d(TAG, "is Fall Cycle for " + varietyCal.getName() + "? : " + String.valueOf(eventCycle));
/**set the subtitle (cycle title)*/
String eventTitleStr = varietyCal.getEventTitle();
String fallCycle = "Fall cycle";
Boolean isFallCycle = varietyCal.getIsFallCycle();
if (isFallCycle){
String reset = context.getString(R.string.fall_cycle);
holder.varietyCycleSubtitle.setText(reset);
holder.upcomingNotificationVarietyEventTitle.setText(varietyCal.getEventTitle());
}else {
holder.varietyCycleSubtitle.setVisibility(View.GONE);
holder.upcomingNotificationVarietyEventTitle.setText(varietyCal.getEventTitle());
}
final int[] img_width = new int[1];
ViewTreeObserver vto = holder.upcomingNotificationVarietyImage.getViewTreeObserver();
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
holder.upcomingNotificationVarietyImage.getViewTreeObserver().removeOnPreDrawListener(this);
img_width[0] = holder.upcomingNotificationVarietyImage.getMeasuredWidth();
return true; //return false?
}
});
holder.itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
String baselineID = varietyCal.getbaselineID();
String varietyName = varietyCal.getName();
String eventTitle = varietyCal.getEventTitle();
String eventDetail = varietyCal.getCalendarEvent();
Intent goToVarietyCalendarIntent = new Intent(context, eventsCalendarActivity.class);
goToVarietyCalendarIntent.putExtra("varietySpec", baselineID);
goToVarietyCalendarIntent.putExtra("varietyName", varietyName);
goToVarietyCalendarIntent.putExtra("upcomingEventTitle", eventTitle);
goToVarietyCalendarIntent.putExtra("eventDetail", eventDetail); //this is kind of obsolete, other than if you intend to
goToVarietyCalendarIntent.putExtra("eventCycle",eventCycle);
goToVarietyCalendarIntent.putExtra("previousActivity", "upcomingNotifications");
context.startActivity(goToVarietyCalendarIntent);
}
});
Picasso.get()
.load(varietyCal.getVarietyImage())
.fit().centerCrop()
.into(holder.upcomingNotificationVarietyImage);
}
@Override
public int getItemCount ()
{
return varietyCalList.size();
}
@Override
public void onAttachedToRecyclerView(RecyclerView rv){
super.onAttachedToRecyclerView(rv);
}
}
| [
"tylerjette@gmail.com"
] | tylerjette@gmail.com |
2b2cf9b11c31da686c2007f30751929f23ff7d9a | b47241d18f0c3d67e40802ffb73d097789444175 | /app/src/main/java/com/example/arek/movies/repository/ReviewsRepository.java | e89f36f4c3845f4bb64d6b7320a5bd98f4a0789b | [] | no_license | arwi74/Movies | 2a2528414f9d1f9d582d3728aa57b4aefd1d4d5d | 23ab4faf384e0a55b23db182b65b348aea09802c | refs/heads/master | 2021-04-29T15:28:55.300925 | 2018-03-19T15:29:51 | 2018-03-19T15:29:51 | 121,798,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | package com.example.arek.movies.repository;
import android.support.annotation.NonNull;
import com.example.arek.movies.api.MovieDbApi;
import com.example.arek.movies.model.Review;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;
/**
* Created by Arkadiusz Wilczek on 07.03.18.
* ReviewsRepository
*/
public class ReviewsRepository {
MovieDbApi mMovieDbApi;
long mMovieId;
int mPage;
int mTotalPages;
public ReviewsRepository(@NonNull MovieDbApi movieDbApi){
mMovieDbApi = movieDbApi;
}
public Observable<List<Review>> getReviews(long movieId, boolean start){
if ( start ){
mPage = 1;
mMovieId = movieId;
} else if ( movieId == mMovieId && mPage<mTotalPages ){
mPage++;
}
return getReviews(movieId, mPage);
}
private Observable<List<Review>> getReviews(long movieId, int page){
return mMovieDbApi.getReviews(movieId, page, "")
.subscribeOn(Schedulers.io())
.map(result -> {
mTotalPages=result.getTotalPages();
return result.getResults();
});
}
public boolean isMoreReviews(){
if ( mMovieId != 0 && mPage < mTotalPages ) return true;
return false;
}
}
| [
"arekwil@gmail.com"
] | arekwil@gmail.com |
a466e7ec940fd6d222fad05090a0d844704e8a6f | 84673f3ab5d8d50e30ba2c945c9108dbd4243f52 | /dmall-service-impl/dmall-service-impl-product/dmall-service-impl-product-business/src/main/java/com/dmall/pms/service/impl/category/handler/SaveCategoryHandler.java | 2924f517b0106c5287d6da40b0a9fb3f0b554d8a | [
"Apache-2.0"
] | permissive | yuhangtdm/dmall | 6d19395db0917d8dcfb09452ff34d82c03e5b774 | e77794a0dff75f56b6a70d9ffeb3d2482b2cfeb8 | refs/heads/master | 2022-12-09T00:02:47.231794 | 2020-06-13T14:20:20 | 2020-06-13T14:20:20 | 214,462,902 | 8 | 4 | Apache-2.0 | 2022-11-21T22:39:42 | 2019-10-11T14:55:13 | JavaScript | UTF-8 | Java | false | false | 3,040 | java | package com.dmall.pms.service.impl.category.handler;
import cn.hutool.core.util.StrUtil;
import com.dmall.common.dto.BaseResult;
import com.dmall.common.util.ResultUtil;
import com.dmall.component.web.handler.AbstractCommonHandler;
import com.dmall.pms.api.dto.category.request.SaveCategoryRequestDTO;
import com.dmall.pms.api.enums.LevelEnum;
import com.dmall.pms.api.enums.PmsErrorEnum;
import com.dmall.pms.generator.dataobject.CategoryDO;
import com.dmall.pms.generator.mapper.CategoryMapper;
import com.dmall.pms.service.impl.category.cache.CategoryCacheService;
import com.dmall.pms.service.validate.PmsValidate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @description: 新增商品分类处理器
* @author: created by hang.yu on 2019-12-02 23:18:00
*/
@Component
public class SaveCategoryHandler extends AbstractCommonHandler<SaveCategoryRequestDTO, CategoryDO, Long> {
@Autowired
private CategoryMapper categoryMapper;
@Autowired
private CategoryCacheService categoryCacheService;
@Autowired
private PmsValidate pmsValidate;
@Override
public BaseResult<Long> validate(SaveCategoryRequestDTO requestDTO) {
if (requestDTO.getParentId() != 0) {
CategoryDO parentCategoryDO = pmsValidate.validateCategory(requestDTO.getParentId());
// 上级id是否存在
if (parentCategoryDO == null) {
return ResultUtil.fail(PmsErrorEnum.PARENT_CATEGORY_NOT_EXIST);
}
// 分类级别要小于上级
if (requestDTO.getLevel() <= parentCategoryDO.getLevel()) {
return ResultUtil.fail(PmsErrorEnum.PARENT_LEVEL_ERROR);
}
}
// 当ParentId=0时 level必须为1
if (requestDTO.getParentId() == 0 && !LevelEnum.ONE.getCode().equals(requestDTO.getLevel())) {
return ResultUtil.fail(PmsErrorEnum.PARENT_LEVEL_ERROR);
}
return ResultUtil.success();
}
@Override
public BaseResult<Long> processor(SaveCategoryRequestDTO requestDTO) {
CategoryDO categoryDO = dtoConvertDo(requestDTO, CategoryDO.class);
categoryCacheService.insert(categoryDO);
categoryCacheService.updateById(setPath(categoryDO));
return ResultUtil.success(categoryDO.getId());
}
/**
* 设置path
*/
private CategoryDO setPath(CategoryDO result) {
CategoryDO categoryDO = new CategoryDO();
StringBuilder path = new StringBuilder();
if (result.getLevel() == 1) {
path.append(StrUtil.DOT).append(result.getId()).append(StrUtil.DOT);
// 2,3级别一致
} else {
CategoryDO parentCategoryDO = categoryMapper.selectById(result.getParentId());
path.append(parentCategoryDO.getPath()).append(result.getId()).append(StrUtil.DOT);
}
categoryDO.setPath(path.toString());
categoryDO.setId(result.getId());
return categoryDO;
}
}
| [
"649411629@qq.com"
] | 649411629@qq.com |
62d6ee833975f2d2a67f5f1aa5094ef7023c6d2d | 43c4b1a2aec1f2e55e72c951843b24d614de2168 | /src/com/hrm/scripts/ForGitHub.java | 1d31265a0a45e028c242fb9c3f28da2b48fc263f | [] | no_license | reddyramana/HRMA | 415a40c9b54bdd8d00c93a18c986caca6dd10f4f | fa4104023e8c2ec26d98616fdefd264f769a16b1 | refs/heads/master | 2021-01-22T19:59:50.671819 | 2017-03-17T05:13:57 | 2017-03-17T05:13:57 | 85,272,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59 | java | package com.hrm.scripts;
public class ForGitHub {
}
| [
"ramanadkpm@gmail.com"
] | ramanadkpm@gmail.com |
17375add1a66ef00e88382f73f02e2be04eba092 | d9d6fc4059918487679f4efc9677b7eb3532959c | /src/main/java/com/victorino/curso1/Curso1Application.java | 785a3abf796c9cedc5706236faa133b7eb96510d | [] | no_license | douglasvscs/curso1 | 0f9e817b0d983d0e2b33aad762a135c5e3c247bf | 9f8e77df4fbdc7770f75a53d4c67628355b2d7e4 | refs/heads/master | 2020-09-04T16:42:10.037983 | 2019-11-05T18:43:07 | 2019-11-05T18:43:07 | 219,806,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.victorino.curso1;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Curso1Application {
public static void main(String[] args) {
SpringApplication.run(Curso1Application.class, args);
}
}
| [
"douglasvictorino@brq.com"
] | douglasvictorino@brq.com |
f574e8e893237fb4f2e1c19361afe108be5de3b6 | 3b41632605f7515b175397ba923f2436670c04c5 | /HackerRank/Data Structures/Trees/Postorder Traversal.java | 0746a33daa0a198473b4fbc4612936840924e9e9 | [
"MIT"
] | permissive | SidGoyal2014/OJ-Solutions | 10ef8a1a85f2698b947643a447c0ac1b86d356d8 | ab797610250ccece96b05770585f611b03b6d3af | refs/heads/master | 2023-05-06T21:01:51.842071 | 2021-05-23T18:27:10 | 2021-05-23T18:27:10 | 266,692,274 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | // Question Link: https://www.hackerrank.com/challenges/tree-postorder-traversal/problem
/* you only have to complete the function given below.
Node is defined as
class Node {
int data;
Node left;
Node right;
}
*/
public static void postOrder(Node root) {
if(root.left != null){
postOrder(root.left);
}
if(root.right != null){
postOrder(root.right);
}
System.out.print(root.data + " ");
}
| [
"noreply@github.com"
] | SidGoyal2014.noreply@github.com |
dda92112cb233673a7e48a2fe73d0a860b158191 | d5bf563a597b7bdbda48c09d42b3b6df421d06f4 | /src/by/it/malyshev/jd01_12/TaskC3.java | 6fb3e42d5365a9dc4def84177b1fc835ff3877d0 | [] | no_license | malyshev-sergey/JD2017-09-20 | 1cc05d384a511d4148c3640125cc8b0c8fda83c9 | 29b07bb611370312ff90d842300941e5f0616ea1 | refs/heads/master | 2021-05-16T03:32:57.312614 | 2019-02-07T08:42:42 | 2019-02-07T08:42:42 | 105,512,982 | 0 | 0 | null | 2017-10-02T08:29:07 | 2017-10-02T08:29:07 | null | UTF-8 | Java | false | false | 1,972 | java | package by.it.malyshev.jd01_12;
import java.util.LinkedList;
import java.util.NoSuchElementException;
/**
* @author Sergey Malyshev
*/
public class TaskC3 {
public static void main(String[] args) {
System.out.println();
printBracketsCheck("{[{(-1),2}],{8,-3}}*{{-1,2},{8,-3}}");
printBracketsCheck("[{(-1),2}],{8,-3}}*{{-1,2},{8,-3}}");
printBracketsCheck("{[{(-1),2}],{8,-3}}*{{-1,2},{8,-3}");
printBracketsCheck("{[{(-1),2}],{8,-3}}*{{-1,2),{8,-3}}");
printBracketsCheck("{[{(-1,2)}],{8,-3}}*{-1,2,8,-3}()");
}
private static boolean bracketsCheck(String str) {
try {
char[] strToChar = str.toCharArray();
LinkedList<Character> a = new LinkedList<>();
for (char s : strToChar) {
switch (s) {
case '{':
a.push('{');
break;
case '[':
a.push('[');
break;
case '(':
a.push('(');
break;
case '}':
if (a.pop() != '{') return false;
break;
case ']':
if (a.pop() != '[') return false;
break;
case ')':
if (a.pop() != '(') return false;
break;
}
}
return a.isEmpty();
} catch (NoSuchElementException e) { return false; }
}
private static void printBracketsCheck(String s){
if (bracketsCheck(s)) {
System.out.println("Скобки в выражении "+s+" расставлены корректно");
} else {
System.out.println("Скобки в выражении "+s+" расставлены некорректно");
}
}
}
| [
"malyshev.serge@gmail.com"
] | malyshev.serge@gmail.com |
47cdd12fdd67aeb0e3ae61f8ea325a33c983c453 | 1f3bb6fb7f010e0fc71a9a989be4d294503dd27f | /src/main/java/io/lubricant/consensus/raft/transport/event/PingEvent.java | f98325f65e5c18cf54540034ec6838bdd91efbdb | [] | no_license | zsyubo/rafting | 92babea3e1e005f353d11af92b2dad385b945fec | d8f35ae1ff83399eea88d99141da83b4620122d1 | refs/heads/master | 2023-01-19T17:16:28.594619 | 2020-11-15T10:43:44 | 2020-11-15T10:43:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package io.lubricant.consensus.raft.transport.event;
public class PingEvent extends Event.SeqEvent {
public PingEvent(EventID source, Object message, int sequence) {
super(source, message, sequence);
}
}
| [
"redseed@126.com"
] | redseed@126.com |
c850e453c4e52c1cf42ff4f018fa6bad8d67777e | 96a7d93cb61cef2719fab90742e2fe1b56356d29 | /selected projects/mobile/Signal-Android-4.60.5/app/src/main/java/org/thoughtcrime/securesms/database/loaders/RecipientMediaLoader.java | 3e3e85c008be1dcdf3e54db9b9ed438217608307 | [
"MIT"
] | permissive | danielogen/msc_research | cb1c0d271bd92369f56160790ee0d4f355f273be | 0b6644c11c6152510707d5d6eaf3fab640b3ce7a | refs/heads/main | 2023-03-22T03:59:14.408318 | 2021-03-04T11:54:49 | 2021-03-04T11:54:49 | 307,107,229 | 0 | 1 | MIT | 2021-03-04T11:54:49 | 2020-10-25T13:39:50 | Java | UTF-8 | Java | false | false | 1,519 | java | package org.thoughtcrime.securesms.database.loaders;
import android.content.Context;
import android.database.Cursor;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.MediaDatabase;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
/**
* It is more efficient to use the {@link ThreadMediaLoader} if you know the thread id already.
*/
public final class RecipientMediaLoader extends MediaLoader {
@Nullable private final RecipientId recipientId;
@NonNull private final MediaType mediaType;
@NonNull private final MediaDatabase.Sorting sorting;
public RecipientMediaLoader(@NonNull Context context,
@Nullable RecipientId recipientId,
@NonNull MediaType mediaType,
@NonNull MediaDatabase.Sorting sorting)
{
super(context);
this.recipientId = recipientId;
this.mediaType = mediaType;
this.sorting = sorting;
}
@Override
public Cursor getCursor() {
if (recipientId == null || recipientId.isUnknown()) return null;
long threadId = DatabaseFactory.getThreadDatabase(getContext())
.getThreadIdFor(Recipient.resolved(recipientId));
return ThreadMediaLoader.createThreadMediaCursor(context, threadId, mediaType, sorting);
}
}
| [
"danielogen@gmail.com"
] | danielogen@gmail.com |
4ec9ce2402c5f797a01c3c70762c2984f6e686a3 | 6e79ba2a38914b0c1676e39831e650bfe742a77c | /research_project/code/asm-re/src/main/java/gov/nih/bnst/preprocessing/combine/training/ReadSingleSentenceOutput.java | 552deca6938e10f8eaeb477885781b92aeebe9cc | [] | no_license | kirsinger/uni | 5270d03a8b989eb66f9c15539ebac28e5233a3ba | e96be45aeef8720cef6c47c9ac646e0bd4eca9ec | refs/heads/master | 2020-06-19T04:47:48.121227 | 2016-12-05T08:35:54 | 2016-12-05T08:35:54 | 74,918,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,158 | java | package gov.nih.bnst.preprocessing.combine.training;
import gov.nih.bnst.patternlearning.EventRule;
import gov.nih.bnst.patternlearning.RelationRule;
import gov.nih.bnst.preprocessing.annotation.Argument;
import gov.nih.bnst.preprocessing.annotation.Event;
import gov.nih.bnst.preprocessing.annotation.Protein;
import gov.nih.bnst.preprocessing.annotation.Relation;
import gov.nih.bnst.preprocessing.annotation.Trigger;
import gov.nih.bnst.preprocessing.dp.DependencyGraph;
import gov.nih.bnst.preprocessing.dp.PTBLinkedDepGraph;
import gov.nih.bnst.preprocessing.pt.PennTree;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>Read Dstore output of each sentence and transform it into Dependency Graph object and PennTree Bank style tree object </p>
*
*/
public class ReadSingleSentenceOutput implements AnnotatedSentence {
/** sentence ID */
private int sentenceID;
/** McClosky/Stanford/whatever dependency graph */
private DependencyGraph graph = null;
/** penntree bank tree */
private PennTree tree = null;
/** the start index of the sentence */
private final int startIndex;
/**
* endIndex is the starting index of the next sentence,
* so this upper bound shoud not be reached in this sentence
*/
private final int endIndex;
/** arguments that belong to the sentence */
private Map<String, Argument> arguments = null;
/** proteins that belong to the sentence */
private Map<String, Protein> proteins = null;
/** triggers that belong to the sentence */
private Map<String, Trigger> triggers = null;
/** events that belong to the sentence */
private Map<String, Event> events = null;
/** relations that belong to the sentence */
private Map<String, Relation> relations = null;
/** event rules of the sentence */
private List<EventRule> eventRulesOfSentence;
/** relation rules of the sentence */
private List<RelationRule> relationRulesOfSentence;
/**
* Constructor to initialize the class fields of graph and tree
* @param graph : dependency parses dstore input
* @param tree : penntree bank tree dstore input
*/
public ReadSingleSentenceOutput (int sentenceID, int endIndex, String tree, List<Integer> offset, String graph) {
this.sentenceID = sentenceID;
this.tree = new PennTree(tree, offset);
//dependency graph needs tree to get the POS tagging info
//as original dependency graph doesn't have POS info
//dependency parses are delimited using "tab"
this.graph = new PTBLinkedDepGraph(graph, this.tree);
startIndex = offset.get(0);
this.endIndex = endIndex;
if(endIndex != -1 && startIndex >= endIndex)
throw new RuntimeException("start index " + startIndex + " cannot be bigger than end index " + endIndex);
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getDependencyGraph(java.lang.String)
*/
@Override
public DependencyGraph getDependencyGraph() {
return graph;
}
/**
* retrieve the penntree bank tree
* @return penntree bank tree
*/
public PennTree getPennTree() {
return tree;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getSentenceID()
*/
@Override
public int getSentenceID() {
return sentenceID;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getStartIndex()
*/
@Override
public int getStartIndex() {
return startIndex;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getEndIndex()
*/
@Override
public int getEndIndex() {
return endIndex;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getEventRulesOfSentence()
*/
@Override
public List<EventRule> getEventRulesOfSentence() {
return eventRulesOfSentence;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#setEventRulesOfSentence(java.util.List)
*/
@Override
public void setEventRulesOfSentence(List<EventRule> eventRulesOfSentence) {
this.eventRulesOfSentence = eventRulesOfSentence;
}
@Override
public List<RelationRule> getRelationRulesOfSentence() {
return relationRulesOfSentence;
}
@Override
public void setRelationRulesOfSentence(List<RelationRule> relationRulesOfSentence) {
this.relationRulesOfSentence = relationRulesOfSentence;
}
/*
* Set the arguments of the sentence
*/
@Override
public void setArguments(Map<String, Argument> arguments) {
this.arguments = arguments;
}
/*
* Read the arguments of the sentence
*/
@Override
public Map<String, Argument> getArguments() {
return arguments;
}
/*
* Set the relations of the sentence
*/
@Override
public void setRelations(Map<String, Relation> relations) {
this.relations = relations;
}
/*
* Read the relations of the sentence
*/
@Override
public Map<String, Relation> getRelations() {
return relations;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#setProteins(java.util.Map)
*/
@Override
public void setProteins(Map<String, Protein> proteins) {
this.proteins = proteins;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getProteins()
*/
@Override
public Map<String, Protein> getProteins() {
return proteins;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#setTriggers(java.util.Map)
*/
@Override
public void setTriggers(Map<String, Trigger> triggers) {
this.triggers = triggers;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getTriggers()
*/
@Override
public Map<String, Trigger> getTriggers() {
return triggers;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#setEvents(java.util.Map)
*/
@Override
public void setEvents(Map<String, Event> events) {
this.events = events;
}
/* (non-Javadoc)
* @see gov.nih.bnst.preprocessing.combine.training.AnnotatedSentence#getEvents()
*/
@Override
public Map<String, Event> getEvents() {
return events;
}
}
| [
"kai.hirsinger@gmail.com"
] | kai.hirsinger@gmail.com |
af165059245da8c5c533477e64af7bfaab584240 | 84e54d6a3a047ae75ebcab64b706426607622144 | /src/test/java/caesar_cipher/CaesarCipherTest.java | fc42ab847b9cdc4c208161abe63b88f53906288e | [] | no_license | gbs149/DesafiosAceleraDevJava | 3ff8f853143c2b750d052681ff3d2eb28c1d3507 | 87b3b8009808135dfc6c4aae87c818acdb869dac | refs/heads/master | 2020-06-26T17:19:50.476530 | 2019-08-28T20:03:19 | 2019-08-28T20:03:19 | 199,697,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | package caesar_cipher;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
@DisplayName("Caesar Cipher Tests")
class CaesarCipherTest {
@ParameterizedTest
@CsvSource({
"3, a, d",
"3, abcxyz, defabc",
"29, abcxyz, defabc",
"3, aBcXyZ, defabc",
"3, '', ''",
"3, a b, d e",
"3, a.b, d.e",
"3, a-b, d-e",
"3, a1b, d1e"
})
@DisplayName("Tests encoding strings")
void itShouldEncodeStrings(int offset, String message, String expected) {
assertEquals(expected, CaesarCipher.encode(offset, message));
}
@ParameterizedTest
@CsvSource({
"3, defabc, abcxyz",
"29, defabc, abcxyz",
"3, dEfAbC, abcxyz",
"3, '', ''",
"3, d e, a b",
"3, d.e, a.b",
"3, d-e, a-b",
"3, d1e, a1b"
})
@DisplayName("Tests decoding strings")
void itShouldDecodeStrings(int offset, String secret, String expected) {
assertEquals(expected, CaesarCipher.decode(offset, secret));
}
}
| [
"gabrielbs@dbserver.com.br"
] | gabrielbs@dbserver.com.br |
f62788fdae99a86e7fcecbce2b8a1567e08383ef | 07d6876356cd4bc0e96f5e24dbd7b3a41d10f314 | /driver-core/src/main/java/com/datastax/driver/core/schemabuilder/ColumnType.java | 862fa40ee1f893af03446b154fa1479ed279e212 | [
"Apache-2.0"
] | permissive | taboola/java-driver | 21dea3c1a1d880beb7b7ebf5243ebf544f9e4b41 | 4106cdc51127c8d742ef83d3ba8b0d14d648d0d3 | refs/heads/2.1 | 2023-03-16T05:33:34.582924 | 2015-03-27T10:12:44 | 2015-03-27T10:42:13 | 33,109,519 | 0 | 2 | Apache-2.0 | 2023-03-09T17:35:12 | 2015-03-30T07:42:43 | Java | UTF-8 | Java | false | false | 1,440 | java | /*
* Copyright (C) 2012-2014 DataStax Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.datastax.driver.core.schemabuilder;
import com.datastax.driver.core.DataType;
/**
* Wrapper around UDT and non-UDT types.
* <p>
* The reason for this interface is that the core API doesn't let us build {@link com.datastax.driver.core.DataType}s representing UDTs, we have to obtain
* them from the cluster metadata. Since we want to use SchemaBuilder without a Cluster instance, UDT types will be provided via
* {@link UDTType} instances.
*/
interface ColumnType {
String asCQLString();
class NativeColumnType implements ColumnType {
private final String asCQLString;
NativeColumnType(DataType nativeType) {
asCQLString = nativeType.toString();
}
@Override public String asCQLString() {
return asCQLString;
}
}
}
| [
"omichallat+github@gmail.com"
] | omichallat+github@gmail.com |
e7215bc32218bfd5b58192e9d4b9bfafc9eb0dd8 | 632ab9181ce77d9cd113acffed5c8581d232d54d | /eProjectNTB/eProjectNTB-ejb/src/java/BeanInfo/Roles.java | ec38a184508b19a8a0ac8a4a9848ccd2d1afff1d | [] | no_license | HolySonOfGod/projectntbstamp | 809d93fc6b58f0fd8126f9e50efd6fd51d7fae6e | dbe76dc3af24dc6f6c58db204ad7058edc4653bb | refs/heads/master | 2021-01-01T18:29:26.521031 | 2012-03-19T05:26:40 | 2012-03-19T05:26:40 | 39,006,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,397 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package BeanInfo;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
/**
*
* @author Nhat Nguyen
*/
@Entity
@Table(name = "Roles")
@NamedQueries({
@NamedQuery(name = "Roles.findAll", query = "SELECT r FROM Roles r"),
@NamedQuery(name = "Roles.findByRoleID", query = "SELECT r FROM Roles r WHERE r.roleID = :roleID"),
@NamedQuery(name = "Roles.findByRoleName", query = "SELECT r FROM Roles r WHERE r.roleName = :roleName"),
@NamedQuery(name = "Roles.findByDescription", query = "SELECT r FROM Roles r WHERE r.description = :description")})
public class Roles implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "RoleID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer roleID;
@Basic(optional = false)
@Column(name = "RoleName")
@NotEmpty(message = "Role name can't be empty")
@Length(max = 100, message = "Role name has maximum 100 characters")
private String roleName;
@Column(name = "Description")
@Length(max = 200, message = "Description has maximum 200 characters")
private String description;
@OneToMany(mappedBy = "roles")
private List<Accounts> accountsList;
public Roles() {
}
public Roles(Integer roleID) {
this.roleID = roleID;
}
public Roles(Integer roleID, String roleName) {
this.roleID = roleID;
this.roleName = roleName;
}
public Integer getRoleID() {
return roleID;
}
public void setRoleID(Integer roleID) {
this.roleID = roleID;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<Accounts> getAccountsList() {
return accountsList;
}
public void setAccountsList(List<Accounts> accountsList) {
this.accountsList = accountsList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (roleID != null ? roleID.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Roles)) {
return false;
}
Roles other = (Roles) object;
if ((this.roleID == null && other.roleID != null) || (this.roleID != null && !this.roleID.equals(other.roleID))) {
return false;
}
return true;
}
@Override
public String toString() {
return "BeanInfo.Roles[roleID=" + roleID + "]";
}
}
| [
"phamvandoan.doan@gmail.com"
] | phamvandoan.doan@gmail.com |
12227ca0069e73ea79cdba3e625ddd4b8a377e1d | c0bccd8d9ffa84fafac9e1e4144f0fe2c4ea288a | /integration/src/test/java/com/github/jlgrock/snp/web/controllers/PatientControllerTest.java | 1a542a67e3d02d47121e2763f47e86977608ec47 | [] | no_license | Kun-Yue/snp-prototype | 259f08aada4cefd5b7f30c514e9c00afdc58b2b2 | 17e78b8e6549d9dda689dbed06a96491a5a551a4 | refs/heads/master | 2021-01-15T09:23:33.728355 | 2015-06-23T13:52:57 | 2015-06-23T13:52:57 | 36,587,416 | 0 | 0 | null | 2015-05-31T04:11:55 | 2015-05-31T04:11:55 | null | UTF-8 | Java | false | false | 2,142 | java | package com.github.jlgrock.snp.web.controllers;
import com.github.jlgrock.snp.core.converters.PatientWriteConverter;
import com.github.jlgrock.snp.core.domain.Gender;
import com.github.jlgrock.snp.core.domain.Patient;
import com.github.jlgrock.snp.core.domain.Race;
import com.github.jlgrock.snp.web.ApplicationConfig;
import com.github.jlgrock.snp.web.ApplicationObjectMapper;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.test.JerseyTestNg;
import org.glassfish.jersey.test.TestProperties;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import javax.ws.rs.core.Application;
import static org.testng.Assert.assertEquals;
/**
*
*/
public class PatientControllerTest extends JerseyTestNg.ContainerPerClassTest {
@BeforeMethod
public void setUpTests() throws Exception {
// Required to make this work on TestNG
MockitoAnnotations.initMocks(this);
}
@Override
protected void configureClient(ClientConfig config) {
config.register(new JacksonFeature()).register(ApplicationObjectMapper.class);
}
@Override
protected Application configure() {
enable(TestProperties.LOG_TRAFFIC);
enable(TestProperties.DUMP_ENTITY);
//return all of the rest endpoints
return ApplicationConfig.createApp();
}
@Test
public void testFindById() {
final Long id = 1L;
// final Patient p = new Patient();
// p.setId(id);
// p.setFirstName("abc");
// p.setMiddleName("def");
// p.setLastName("ghi");
// p.setGender(Gender.FEMALE);
// p.setRace(Race.AMERICAN_INDIAN);
final String response = target("patient/" + id).request().get(String.class);
final String converted = "{\r\n \"id\" : 1,\r\n \"firstName\" : \"abc\",\r\n \"middleName\" : \"def\",\r\n \"lastName\" : \"ghi\",\r\n \"dateOfBirth\" : null,\r\n \"gender\" : \"FEMALE\",\r\n \"race\" : \"AMERICAN_INDIAN\"\r\n}";
assertEquals(response, converted);
}
}
| [
"shalewis@deloitte.com"
] | shalewis@deloitte.com |
c9e8b30f280ad3744e41b15adf167fb4fa6302ce | 9f927299cd1a80b2ec8d4b34c26fcd7f72aa0a93 | /src/main/java/test/generated/tables/LicensePlateView.java | f78ad2c85e6a88ef785be53c2d5dcff834abb36b | [] | no_license | alhimik45/bd-lab | 2589d42beee62fd883d5a0f8d32ce27b11c61136 | 4e9befe920c40ab5b3099f191a95e89906ce9115 | refs/heads/master | 2021-01-23T06:10:01.347795 | 2017-12-18T08:27:24 | 2017-12-18T08:27:24 | 102,492,306 | 2 | 0 | null | 2017-12-15T03:17:42 | 2017-09-05T14:34:08 | Java | UTF-8 | Java | false | true | 3,454 | java | /*
* This file is generated by jOOQ.
*/
package test.generated.tables;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.impl.DSL;
import org.jooq.impl.TableImpl;
import test.generated.Public;
import test.generated.tables.records.LicensePlateViewRecord;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class LicensePlateView extends TableImpl<LicensePlateViewRecord> {
private static final long serialVersionUID = -361958255;
/**
* The reference instance of <code>public.license_plate_view</code>
*/
public static final LicensePlateView LICENSE_PLATE_VIEW = new LicensePlateView();
/**
* The class holding records for this type
*/
@Override
public Class<LicensePlateViewRecord> getRecordType() {
return LicensePlateViewRecord.class;
}
/**
* The column <code>public.license_plate_view.license_plate</code>.
*/
public final TableField<LicensePlateViewRecord, String> LICENSE_PLATE = createField("license_plate", org.jooq.impl.SQLDataType.CLOB, this, "");
/**
* The column <code>public.license_plate_view.LicensePlate_PK</code>.
*/
public final TableField<LicensePlateViewRecord, Long> LICENSEPLATE_PK = createField("LicensePlate_PK", org.jooq.impl.SQLDataType.BIGINT, this, "");
/**
* The column <code>public.license_plate_view.Vehicle_PK</code>.
*/
public final TableField<LicensePlateViewRecord, Long> VEHICLE_PK = createField("Vehicle_PK", org.jooq.impl.SQLDataType.BIGINT, this, "");
/**
* Create a <code>public.license_plate_view</code> table reference
*/
public LicensePlateView() {
this(DSL.name("license_plate_view"), null);
}
/**
* Create an aliased <code>public.license_plate_view</code> table reference
*/
public LicensePlateView(String alias) {
this(DSL.name(alias), LICENSE_PLATE_VIEW);
}
/**
* Create an aliased <code>public.license_plate_view</code> table reference
*/
public LicensePlateView(Name alias) {
this(alias, LICENSE_PLATE_VIEW);
}
private LicensePlateView(Name alias, Table<LicensePlateViewRecord> aliased) {
this(alias, aliased, null);
}
private LicensePlateView(Name alias, Table<LicensePlateViewRecord> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, "");
}
/**
* {@inheritDoc}
*/
@Override
public Schema getSchema() {
return Public.PUBLIC;
}
/**
* {@inheritDoc}
*/
@Override
public LicensePlateView as(String alias) {
return new LicensePlateView(DSL.name(alias), this);
}
/**
* {@inheritDoc}
*/
@Override
public LicensePlateView as(Name alias) {
return new LicensePlateView(alias, this);
}
/**
* Rename this table
*/
@Override
public LicensePlateView rename(String name) {
return new LicensePlateView(DSL.name(name), null);
}
/**
* Rename this table
*/
@Override
public LicensePlateView rename(Name name) {
return new LicensePlateView(name, null);
}
}
| [
"hvorovk@gmail.com"
] | hvorovk@gmail.com |
16a8b176c467e2b37f9909a6ec8992eed4944020 | 4077ab983f28bc1c6c1b2c3e3fd5359e85e19031 | /src/com/example/data/LocationJsonParser.java | 3e87a2af6273a71ecc0cf52773a266bb98d89f1b | [
"MIT"
] | permissive | SFis/weather | e15d855c2672469097cfa68d20e3df7dcbae4f5c | 723777feabe1dd789e8e18c484f0b29c77e0c7ad | refs/heads/master | 2020-04-13T20:48:30.640736 | 2018-12-29T13:42:13 | 2018-12-29T13:42:13 | 163,439,996 | 0 | 0 | null | 2018-12-28T18:45:21 | 2018-12-28T18:45:21 | null | UTF-8 | Java | false | false | 1,788 | java | package com.example.data;
import org.json.simple.parser.*;
import com.example.Location;
import com.example.WeatherServlet;
import java.security.Timestamp;
import org.json.simple.*;
public class LocationJsonParser implements IDataSource {
public LocationJsonParser() {
}
@Override
public Location getLocation(int id) {
Request r = new Request(WeatherServlet.APIKEY, id);
return parseRequest(r);
}
@Override
public Location getLocation(String location) {
Request r = new Request(WeatherServlet.APIKEY, location);
return parseRequest(r);
}
private Location parseRequest(Request r) {
Location loc = new Location();
JSONParser parser = new JSONParser();
try {
JSONObject obj = (JSONObject) parser.parse(r.execute());
loc.locationId = Integer.valueOf(obj.get("id").toString());
loc.name = obj.get("name").toString();
JSONArray weatherArr = new JSONArray();
weatherArr = (JSONArray) obj.get("weather");
JSONObject weatherEntry = (JSONObject) parser.parse(
weatherArr.get(0).toString());
loc.weather = weatherEntry.get("main").toString();
JSONObject mainObj = new JSONObject();
mainObj = (JSONObject)obj.get("main");
loc.temp = Float.valueOf(mainObj.get("temp").toString());
JSONObject sysObj = new JSONObject();
sysObj = (JSONObject)obj.get("sys");
loc.sunrise = new java.sql.Timestamp(
Long.valueOf(sysObj.get("sunrise").toString())*1000);
JSONObject coordObj = new JSONObject();
coordObj = (JSONObject)obj.get("coord");
loc.lat = Float.valueOf(coordObj.get("lat").toString());
loc.lon = Float.valueOf(coordObj.get("lon").toString());
} catch (ParseException e) {
System.out.println("Error while parsing data.");
e.printStackTrace();
}
return loc;
}
}
| [
"sfischer@sf-productions.net"
] | sfischer@sf-productions.net |
7ec45087d0a6c7672e9fb828e7aedfc276b6b255 | 569c1ff52bfc78e7e49d93e5bc4616ff8a81f73f | /src/main/java/page/LoginPage.java | ac59a0d00e0d95a075380bf65ee3e787476ff4ea | [] | no_license | SmithaPrasanna/Survey-Monkey | d84f2081ea8682bfa565ab0da05bc31d110b1dd2 | c8dcc48c30871aa2a0d08f52ebf7fde289c2b415 | refs/heads/master | 2020-05-07T12:04:37.637926 | 2019-04-14T21:10:58 | 2019-04-14T21:10:58 | 180,488,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,091 | java | package page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import resources.base;
public class LoginPage {
public WebDriver driver;
By userNameTxt = By.xpath("//input[@id='username']");
By passWordTxt = By.xpath("//input[@id='password']");
By loginBtn = By.xpath("//button[@type='submit']");
public LoginPage(WebDriver driver){
this.driver = driver;
}
/**********************************************************************************************************************************
* Method Name - enterUserName()
* Description - Entering User Name on Login Page
* Creation Date - 13th Dec 2018
* Author - Naresh Kumar Guntipalli
*********************************************************************************************************************************/
public WebElement enterUserName(){
//return driver.findElement(userNameTxt);
return driver.findElement(userNameTxt);
}
/**********************************************************************************************************************************
* Method Name - enterPassword()
* Description - Entering Password on Login Page
* Creation Date - 13th Dec 2018
* Author - Naresh Kumar Guntipalli
*********************************************************************************************************************************/
public WebElement enterPassword(){
//return driver.findElement(passWordTxt);
return driver.findElement(passWordTxt);
}
/**********************************************************************************************************************************
* Method Name - clickLoginBtn()
* Description - Clicking on "Login" button on Login page
* Creation Date - 13th Dec 2018
* Author - Naresh Kumar Guntipalli
*********************************************************************************************************************************/
public WebElement clickLoginBtn(){
//return driver.findElement(loginBtn);
return driver.findElement(loginBtn);
}
}
| [
"globalerp.naresh@gmail.com"
] | globalerp.naresh@gmail.com |
0ffd6fb620fa578821d1bb066d382ac048984783 | 750be6a2d35e811b8ad9fc1e7fecd2ef77d61bb8 | /src/br/ufc/engsoft/util/rss/Dates.java | 88904577118e4e491809d647fd461f3dbac0528d | [] | no_license | gustavolgcr/wiki-comp-mobile | 944c5871dae18e7ace371cad8223c6cc4487b987 | c2f1d0f20a8b863adce41f5231b9a8e6fa7911b5 | refs/heads/master | 2020-12-25T05:28:49.400322 | 2012-07-22T17:42:20 | 2012-07-22T17:42:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,366 | java | /*
* Copyright (C) 2010 A. Horn
*
* 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 br.ufc.engsoft.util.rss;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* Internal helper class for date conversions.
*
* @author Mr Horn
*/
final class Dates {
/**
* @see <a href="http://www.ietf.org/rfc/rfc0822.txt">RFC 822</a>
*/
private static final SimpleDateFormat RFC822 = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss Z", java.util.Locale.ENGLISH);
/* Hide constructor */
private Dates() {}
/**
* Parses string as an RFC 822 date/time.
*
* @throws RSSFault if the string is not a valid RFC 822 date/time
*/
static java.util.Date parseRfc822(String date) {
try {
return RFC822.parse(date);
} catch (ParseException e) {
throw new RSSFault(e);
}
}
}
| [
"franzejr@gmail.com"
] | franzejr@gmail.com |
329bc0ce466409bd0a57b57166b7bbb7537dcbca | e5138042be9297dd0be83aa6ba910ef7f8d19f2b | /src/main/java/music/player/playMusic/artists/rap/SixNine.java | cd16a8306f836a4747d08aa23cb6e11415250b4e | [] | no_license | raipi12/PlayList | 122185b42e1ebe367c3569c31ea325cf43e38a20 | 7a3594df8d19f2c5eb5396b540f47f1cde2f164e | refs/heads/master | 2022-12-03T00:42:23.215061 | 2020-08-20T14:11:35 | 2020-08-20T14:11:35 | 289,023,868 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package music.player.playMusic.artists.rap;
import music.player.playMusic.artists.Artists;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class SixNine implements Artists {
private List<String> listOfSongs = new ArrayList<String>();
private Random ranndom = new Random();
private String randomChoice;
{
listOfSongs.add("Gooba");
listOfSongs.add("Punani");
listOfSongs.add("YAYA");
}
public String getSong() {
randomChoice = listOfSongs.get(ranndom.nextInt(listOfSongs.size()));
return "6IX9INE - " + randomChoice;
}
}
| [
"dimapanainte2@gmail.com"
] | dimapanainte2@gmail.com |
9ed1eeaf749235c2df9d0692643649f585ead979 | 827bf064e482700d7ded2cd0a3147cb9657db883 | /source_NewVersionImported/app/src/main/java/com/aadhk/restpos/c/aj.java | 60fcd46c29db26920aae0fd6b21d1998e21960e2 | [] | no_license | cody0117/LearnAndroid | d30b743029f26568ccc6dda4313a9d3b70224bb6 | 02fd4d2829a0af8a1706507af4b626783524813e | refs/heads/master | 2021-01-21T21:10:18.553646 | 2017-02-12T08:43:24 | 2017-02-12T08:43:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.aadhk.restpos.c;
import android.view.View;
import android.view.Window;
// Referenced classes of package com.aadhk.restpos.c:
// ai
final class aj
implements android.view.View.OnFocusChangeListener
{
final ai a;
aj(ai ai1)
{
a = ai1;
super();
}
public final void onFocusChange(View view, boolean flag)
{
if (flag)
{
a.getWindow().setSoftInputMode(5);
}
}
}
| [
"em3888@gmail.com"
] | em3888@gmail.com |
01afd86b05f34f082063a5a0892fd636ea79b866 | 26872d82655a892fc1f6fb973fc99650269c14cb | /src/test/java/jp/seraphr/common/Tuple3Test.java | c4f7d6b71453d6141351838858ac06a6f93d9e57 | [
"BSD-2-Clause"
] | permissive | seraphr/seraph-java-common | 9b168395c2b80cf40c247344f97cc3f67956ca10 | 627813f1f03846952a4784d5b13458396db64d77 | refs/heads/master | 2021-01-15T16:17:35.993099 | 2013-11-20T12:13:31 | 2013-11-20T12:13:31 | 4,887,090 | 0 | 0 | BSD-2-Clause | 2020-10-12T23:44:17 | 2012-07-04T16:34:25 | Java | UTF-8 | Java | false | false | 1,125 | java | package jp.seraphr.common;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.*;
import org.junit.Test;
public class Tuple3Test {
@Test
public void test() {
Tuple3<Integer, String, Boolean> tTuple1 = Tuple3.create(111, "test", true);
Tuple3<Integer, String, Boolean> tTuple2 = Tuple3.create(111, "test", true);
Tuple3<Integer, String, Boolean> tTuple3 = Tuple3.create(112, "test", true);
Tuple3<Integer, String, Boolean> tTuple4 = Tuple3.create(111, "testes", true);
Tuple3<Integer, String, Boolean> tTuple5 = Tuple3.create(111, "test", false);
assertThat(tTuple1.get1(), is(111));
assertThat(tTuple1.get2(), is("test"));
assertThat(tTuple1.get3(), is(true));
assertThat(tTuple1.toString(), is("(111,test,true)"));
assertThat(tTuple1.hashCode(), is(tTuple2.hashCode()));
assertThat(tTuple1, is(tTuple2));
assertThat(tTuple1, is(not(tTuple3)));
assertThat(tTuple1, is(not(tTuple4)));
assertThat(tTuple1, is(not(tTuple5)));
}
}
| [
"local@seraphr.jp"
] | local@seraphr.jp |
80d1ce38a64edec21d7c1b27258c902410694cad | 92348fed2bf3b9833c83b56383e707c4b7bc2404 | /Mundo5.java | 376394a34b0440b336883b64ec2a14d1485dbffd | [] | no_license | Danval-003/Looking-for-the-cure | 671358873e6ede5b1e130f9d2f1e8c3a7c1aef9c | b4ba4bc6c734a85e343fb2097cc0939b656f04df | refs/heads/main | 2023-06-29T01:29:22.624198 | 2021-08-03T04:15:23 | 2021-08-03T04:15:23 | 388,245,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,791 | java | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Mundo5 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Mundo5 extends MyWorld
{
/**
* Constructor for objects of class Mundo5.
*
*/
int base=64;
int compon;
int compoe;
int x=1008;
int y=720;
public Mundo5()
{
super(800,480,1, 1280,1024);
addObject(new puerta6(),compox(1), compoy(11)-32);
addObject(new puerta2(),compox(18),624);
setMainActor(new Primer_jugador(), 200,180);
mainActor.setLocation(compox(18), 656);
GreenfootImage bg = new GreenfootImage("Mundo1.png");
setScrollingBackground(bg);
borde();
prepare();
enemigo();
addObject(new Musica(),128,48, false);
addObject(new Vida(),128,48, false);
addObject(new Score(0),128,90, false);
}
public Mundo5(int score, int lives)
{
super(800,480,1, 1280,1024);
addObject(new puerta6(),compox(1), compoy(11)-32);
addObject(new puerta2(),compox(18),624);
setMainActor(new Primer_jugador(), 200,180);
mainActor.setLocation(compox(18), 656);
GreenfootImage bg = new GreenfootImage("Mundo1.png");
setScrollingBackground(bg);
borde();
prepare();
enemigo();
addObject(new Musica(),128,48, false);
addObject(new Vida(lives),128,48, false);
addObject(new Score(score),128,90, false);
}
public int compoy(int fila){
compon=fila*base;
compon=y-compon;
return compon;
}
public int compox(int columna){
compoe=columna*base;
compoe=x-compoe;
return compoe;
}
public int compox1(int columna){
compoe=columna*base;
compoe=x-compoe-32;
return compoe;
}
public void enemigo(){
addObject(new Enfermo1(), compox(12), compoy(1));
addObject(new Enfermo1(), compox(15), compoy(12));
addObject(new Enfermo1(), compox(11), compoy(1));
addObject(new Enfermo1(), compox(7), compoy(1));
addObject(new Enfermo1(), compox(8), compoy(1));
addObject(new Enfermo1(), compox(9), compoy(1));
}
public void prepare(){
for(int i=1;i<7;i++){
addObject(new Fondo(1), compox(18-i), compoy(1*i));}
addObject(new Bloqueinvisible(), compox(16), compoy(1));
addObject(new moneda(), compox(18), compoy(13));
addObject(new Fondo(4), compox1(16), compoy(11));
addObject(new bloqueBonus(), compox(11), compoy(7));
addObject(new bloqueBonus(), compox(10), compoy(8));
for(int i=1;i<7;i++){
addObject(new Fondo(1), compox(10-i), compoy(8+i));}
addObject(new Fondo(2), compox1(11), compoy(11));
addObject(new Bloqueinvisible(), compox(14), compoy(12));
for(int i=1;i<3;i++){
addObject(new Fondo(1), compox(6-i), compoy(0+i));}
for(int i=1;i<3;i++){
addObject(new Fondo(1), compox(3-i), compoy(3+i));}
addObject(new bloqueBonus(), compox(3), compoy(3));
addObject(new Fondo(2), compox1(5), compoy(4));
addObject(new Fondo(1), compox(7), compoy(5));
for(int i=1;i<4;i++){
addObject(new Fondo(1), compox(6-i), compoy(6+i));}
addObject(new Fondo(2), compox1(1), compoy(10));
addObject(new moneda(), compox(1), compoy(1));
}
public void borde(){
addObject(new Fondo(20),400, -240);
addObject(new Ladrillo(1),-208, -240);
addObject(new bloque(16),-208, 240);
addObject(new bloque(16),1008, 240);
addObject(new Ladrillo(20),400, 720);
}
}
| [
"noreply@github.com"
] | Danval-003.noreply@github.com |
1a1b5a9727c002db45baf9ba7588814f82449ef2 | 853b5a39acbfee66b28a058a7a5e3982e756812d | /src/Worker.java | 7649f88ae318c1c925bedfab01243c562991f234 | [] | no_license | PavloVovnyuk/Inheritance | 0841dfb63ff8dce3de9c563d385958161198eeab | 934c96934bab06c10785543ef1b8a2786cca9274 | refs/heads/master | 2023-08-05T01:43:45.323427 | 2021-10-07T14:09:24 | 2021-10-07T14:09:24 | 408,785,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,010 | java | import java.time.LocalDate;
import java.time.LocalDateTime;
public class Worker {
String name;
String sureName;
LocalDate dayOfBorn;
public Worker(String name, String sureName, LocalDate dayOfBorn) {
this.name = name;
this.sureName = sureName;
this.dayOfBorn = dayOfBorn;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSureName() {
return sureName;
}
public void setSureName(String sureName) {
this.sureName = sureName;
}
public LocalDate getDayOfBorn() {
return dayOfBorn;
}
public void setDayOfBorn(LocalDate dayOfBorn) {
this.dayOfBorn = dayOfBorn;
}
@Override
public String toString() {
return "Worker{" +
"name='" + name + '\'' +
", sureName='" + sureName + '\'' +
", dayOfBorn=" + dayOfBorn +
'}';
}
}
| [
"pawel.wowniuk@gmail.com"
] | pawel.wowniuk@gmail.com |
95a6db65b7120bee0db36b25dbd9464d5c34fc66 | aabfa540e2b9747387240e833d176a9d05df385c | /common/src/main/java/com/yannis/common/util/ScreenUtils.java | c4f56aa43d72b6bfadef6a3a01aecb3d4ecca824 | [] | no_license | YannisYwx/GameTerraceAndroid | 0bde3826beed593a2a96c33f95be7823baacc553 | 7118692bf8a874d049bc9e876f2cf0eb142be0b2 | refs/heads/master | 2020-05-28T08:36:16.565503 | 2019-05-28T08:18:03 | 2019-05-28T08:18:03 | 188,940,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | package com.yannis.common.util;
import android.app.Activity;
import android.util.DisplayMetrics;
/**
* @author : Yannis.Ywx
* @createTime : 2017/9/16 14:45
* @email : 923080261@qq.com
* @description : 屏幕信息工具类
* 获取屏幕宽高 以及截屏
*/
public class ScreenUtils {
private ScreenUtils(){
}
/**
* 获取屏幕高度
* @param activity 当前屏幕
* @return 高度值
*/
public static int getScreenHeight(Activity activity){
DisplayMetrics displayMetrics = getDisplayMetrics(activity);
return displayMetrics.heightPixels;
}
/**
* 获取屏幕宽
* @param activity 当前屏幕
* @return 宽值
*/
public static int getScreenWidth(Activity activity){
DisplayMetrics displayMetrics = getDisplayMetrics(activity);
return displayMetrics.widthPixels;
}
public static DisplayMetrics getDisplayMetrics(Activity activity){
DisplayMetrics displayMetrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
return displayMetrics;
}
}
| [
"alvin@urmet.cn"
] | alvin@urmet.cn |
562f80379ecebcb544ce0f609f3ef921c16bfe42 | 9e9e6735e6769acc2f6791d19ea68421fcec7558 | /src/main/java/com/tangquan/framework/SimpleCorsFilter.java | c0857e126c32ad685e797b3e9a47a0d34ff41301 | [] | no_license | xztzgl/hezu-server | 3a9a3067e05ea27085e8b462ed631fb2b6194c3d | ae5a8c8f56194d903676ce5dab08c0df09e7ed13 | refs/heads/master | 2020-03-19T11:14:59.535039 | 2018-09-19T14:03:28 | 2018-09-19T14:03:28 | 136,442,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 807 | java | package com.tangquan.framework;
import org.springframework.stereotype.Component;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import javax.servlet.http.HttpServletRequest;
@Component
public class SimpleCorsFilter extends CorsFilter {
public SimpleCorsFilter() {
super(newCorsConfigurationSource());
}
private static CorsConfigurationSource newCorsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
config.addAllowedMethod("*");
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.setAllowCredentials(true);
config.setMaxAge(3600L);
return request -> config;
}
} | [
"songdun@iciyun.com"
] | songdun@iciyun.com |
0556ab361e699f4f97171a8bda36495582b648c3 | 7d0adeafc447508d13c552789f85c94aba002b9a | /src/main/java/com/greco/service/CommentService.java | 917ef145770293f613ce16129e57e0f3865140e8 | [] | no_license | CarlosdelCanizo/greco---backend | efcd2961549b20d8a27ad3a5b2a6db4aa78510b4 | 67fc56edc1f9a8f0d45d6ba636ff84afae142802 | refs/heads/master | 2023-07-21T00:55:49.496961 | 2020-12-15T10:06:30 | 2020-12-15T10:06:30 | 403,974,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.greco.service;
import com.greco.model.Comment;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface CommentService {
Comment insert(Comment comment);
Comment findById(Long id);
void deleteById(Long id);
Page<Comment> findBySolarPanelId(Long solarPanelId, Pageable pageable);
}
| [
"michelle.cabrera@basetis.com"
] | michelle.cabrera@basetis.com |
626676721c7875832bfd208f3a01b4a0d64cac21 | 2efb7173445a829835409fabefe0ee3504423ee9 | /ph-graph/src/test/java/com/helger/graph/impl/GraphObjectIDFactoryTest.java | f854a228760ad257b75d020fd51272ac47925665 | [
"Apache-2.0"
] | permissive | phax/ph-commons | 207f6d6be4b004a3decea7d40967270cd604909d | f6798b311d9ad7dbda7717f1216145dbb2bc785a | refs/heads/master | 2023-08-28T01:01:56.141949 | 2023-08-22T12:51:40 | 2023-08-22T12:51:40 | 23,062,279 | 35 | 15 | Apache-2.0 | 2023-03-29T09:58:08 | 2014-08-18T07:21:36 | Java | UTF-8 | Java | false | false | 1,558 | java | /*
* Copyright (C) 2014-2023 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* 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.helger.graph.impl;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import com.helger.commons.id.factory.IIDFactory;
import com.helger.commons.id.factory.StringIDFromGlobalIntIDFactory;
/**
* Test class for class {@link GraphObjectIDFactory}.
*
* @author Philip Helger
*/
public final class GraphObjectIDFactoryTest
{
@Test
public void testAll ()
{
final IIDFactory <String> aOld = GraphObjectIDFactory.getIDFactory ();
assertNull (aOld);
try
{
GraphObjectIDFactory.setIDFactory (null);
assertNotNull (GraphObjectIDFactory.createNewGraphObjectID ());
GraphObjectIDFactory.setIDFactory (new StringIDFromGlobalIntIDFactory ());
assertNotNull (GraphObjectIDFactory.createNewGraphObjectID ());
}
finally
{
GraphObjectIDFactory.setIDFactory (aOld);
}
}
}
| [
"philip@helger.com"
] | philip@helger.com |
40c41a19af9a2bff2779f822c3a899a4ad8d0be0 | 2a3385327c386a5a35e16c50d110ca114109cc9c | /kr-scientific/kr-scientific-impl/src/main/java/com/ronglian/kangrui/saas/research/sci/rest/FormRest.java | a86b2fbb221da7dcd23f633e67947b601d65fac6 | [] | no_license | ahjsjxy/research-node | 22a99bab03f514e2dea7f303cd894491793f7d0d | 011a7dcee2c8e9288820b708a29b64ad05fd1439 | refs/heads/master | 2022-12-24T21:38:03.770462 | 2019-08-06T10:23:06 | 2019-08-06T10:23:06 | 189,509,461 | 0 | 2 | null | 2022-12-16T12:13:01 | 2019-05-31T01:54:59 | JavaScript | UTF-8 | Java | false | false | 4,977 | java | package com.ronglian.kangrui.saas.research.sci.rest;
import com.ronglian.kangrui.saas.research.common.msg.ObjectRestResponse;
import com.ronglian.kangrui.saas.research.common.vo.Msg;
import com.ronglian.kangrui.saas.research.sci.manager.CrfDictFieldManager;
import com.ronglian.kangrui.saas.research.sci.manager.FormConfigManager;
import com.ronglian.kangrui.saas.research.sci.manager.FormsManager;
import com.ronglian.kangrui.saas.research.sci.vo.*;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* crf form
*
* @author lanyan
* @create 2019-03-05 11:32
**/
@RestController
@RequestMapping("form")
@Slf4j
public class FormRest {
@Autowired
private FormsManager formsManager ;
@Autowired
private CrfDictFieldManager crfDictFieldManager ;
@Autowired
private FormConfigManager formConfigManager ;
@ApiOperation("研究对象-设置显示字段")
@RequestMapping(value = "getDisplayFieldList",method = RequestMethod.GET)
public StudyTreeVo getDisplayFieldList(@RequestParam Long studyId){
StudyTreeVo studyTreeVo = formsManager.getDisplayFieldList(studyId) ;
return studyTreeVo ;
}
@ApiOperation("项目-校验存在未删除的CRF且还没创建表")
@RequestMapping(value = "checkHasCrfFormGenerateToDb",method = RequestMethod.GET)
public ObjectRestResponse checkHasCrfFormGenerateToDb(@RequestParam Long studyId) {
boolean flag = crfDictFieldManager.checkHasCrfFormGenerateToDb(studyId) ;
return new ObjectRestResponse().rel(flag) ;
}
@ApiOperation("项目-创建Crf表单到DB")
@RequestMapping(value = "saveCrfFormGenerateToDb",method = RequestMethod.POST)
public ObjectRestResponse saveCrfFormGenerateToDb(@RequestParam Long studyId) {
Msg msg = formConfigManager.saveCrfFormGenerateToDb(studyId) ;
return new ObjectRestResponse().rel(msg.getSucFlag()).data(msg.getDesc()) ;
}
@ApiOperation("Crf表单-校验存在未删除的字段")
@RequestMapping(value = "checkHasFieldsGenerateToDb",method = RequestMethod.GET)
public ObjectRestResponse checkHasFieldsGenerateToDb(@RequestParam Long crfFormId) {
boolean flag = crfDictFieldManager.checkHasFieldsGenerateToDb(crfFormId) ;
return new ObjectRestResponse().rel(flag) ;
}
@ApiOperation("Crf表单-创建字段到DB")
@RequestMapping(value = "saveFieldsGenerateToDb",method = RequestMethod.POST)
public ObjectRestResponse saveFieldsGenerateToDb(@RequestParam Long crfFormId) {
Msg msg = formConfigManager.saveFieldsGenerateToDb(crfFormId) ;
return new ObjectRestResponse().rel(msg.getSucFlag()).data(msg.getDesc()) ;
}
@ApiOperation("研究对象-保存设置显示字段")
@RequestMapping(value = "saveDisplayFieldInfo",method = RequestMethod.POST)
public ObjectRestResponse saveDisplayFieldInfo(@RequestBody StudyTreeVo studyTreeVo) {
int rowNum = formsManager.saveDisplayFieldInfo(studyTreeVo) ;
return new ObjectRestResponse().rel(rowNum>0) ;
}
@ApiOperation("研究对象-添加展示字段")
@RequestMapping(value = "getDisplayFormInfo",method = RequestMethod.GET)
public FormsVo getDisplayFormInfo(@RequestParam Long studyId) {
FormsVo formsVo = formsManager.getFormConfigAndDataInfo(studyId) ;
return formsVo ;
}
@ApiOperation("研究对象-展示字段数据保存")
@RequestMapping(value = "saveDisplayFormInfo",method = RequestMethod.POST)
public ObjectRestResponse saveDisplayFormInfo(@RequestBody FormConvertVo formConvertVo) {
boolean flag = formsManager.saveDisplayForm(formConvertVo.getFormsVo(), formConvertVo.getStudyId(), formConvertVo.getStudyGroupId()) ;
return new ObjectRestResponse().rel(flag) ;
}
@ApiOperation("研究对象-点击单个Crf对应的题组树形")
@RequestMapping(value = "getOneFormInfoTree",method = RequestMethod.GET)
public CrfParentVo getOneFormInfoTree(@RequestParam Long crfFormId) {
return formsManager.getOneFormInfoTree(crfFormId) ;
}
@ApiOperation("研究对象-点击单个Crf展示")
@RequestMapping(value = "getOneFormInfo",method = RequestMethod.GET)
public FormsVo getOneFormInfo(@RequestParam Long objectId, @RequestParam Long crfFormId, @RequestParam Long crfSecondId) {
return formsManager.getOneFormConfigAndDataInfo(objectId, crfFormId, crfSecondId) ;
}
@ApiOperation("研究对象-点击单个Crf保存")
@RequestMapping(value = "saveOneFormInfo",method = RequestMethod.POST)
public ObjectRestResponse saveOneFormInfo(@RequestBody FormUpdateVo formUpdateVo) {
boolean flag = formsManager.saveOneFormInfo(formUpdateVo.getFormsVo(), formUpdateVo.getObjectId()) ;
return new ObjectRestResponse().rel(flag) ;
}
}
| [
"xuyang@ronglian.com"
] | xuyang@ronglian.com |
71f7be3b6c9091077cc8eebc928f4d282a6f4f25 | 835c5e5a428465a1bb14aa2922dd8bf9d1f83648 | /bitcamp-java/src/main/java/com/eomcs/oop/ex05/g/B.java | 376329d36db5d0eb9561751800199562e9d17028 | [] | no_license | juneglee/bitcamp-study | cc1de00c3e698db089d0de08488288fb86550260 | 605bddb266510109fb78ba440066af3380b25ef1 | refs/heads/master | 2020-09-23T13:00:46.749867 | 2020-09-18T14:26:39 | 2020-09-18T14:26:39 | 225,505,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package com.eomcs.oop.ex05.g;
public class B extends A {
int v2;
B() {
// 수퍼 클래스의 어떤 생성자를 호출할지 지정하지 않으면 컴파일러는
// 다음과 같이 수퍼 클래스의 기본 생성자를 호출하라는 명령을 붙인다.
// 해결 방법?
// => 개발자가 직접 수퍼 클래스에 있는 생성자를 호출하라!
//super();
// 만약 수퍼 클래스에 기본 생성자가 없으면 컴파일 오류가 발생한다!
super(100);
// 기본생성자가 아닌 파라미터가 있는 메서드인 경우에는 super를 정의해줘야 한다
System.out.println("B() 생성자!");
}
}
| [
"klcpop1@example.com"
] | klcpop1@example.com |
0e91e22a9872917b9b00a5e38f1dedfa01c8b1f1 | 860634e52837126b08c8702252d637ab761ee49e | /AssignmentDay15/country-microservice/src/main/java/com/manipal/service/CountryService.java | 8183f8593dabfb7ee93af9c6e147e51888a53271 | [] | no_license | ankitchhikara13/ManipalAssignmentDay10 | ed600c33e664d5087ca5b46a1c1f9b647ce50000 | 225ffd8c5b00db6baa02289e5102015a33550185 | refs/heads/master | 2022-12-09T04:28:31.581892 | 2020-09-15T18:45:49 | 2020-09-15T18:45:49 | 292,400,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 574 | java | package com.manipal.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.manipal.model.Country;
import com.manipal.repository.ICountryRepository;
@Service
public class CountryService implements ICountryService{
@Autowired
ICountryRepository repository;
@Override
public Country getCountryByName(String countryName) {
return repository.findByCountryName(countryName);
}
@Override
public void addCountry(Country country) {
repository.save(country);
}
} | [
"noreply@github.com"
] | ankitchhikara13.noreply@github.com |
eb1d87a54e64a0388d4a88d14adc8e78a2b9b1a7 | fb5c5099ccccf099772966b7ff0eb4b6bb4ef100 | /src/main/java/com/a41/invoice/service/DefaultPdfGeneratorService.java | 9c5dcaf4701966309a3de2f72f0eb56379f65700 | [
"Apache-2.0"
] | permissive | Canbayraktar/allforoneshopinvoice-yaas | 044ed5a805f8c4c96fe262cf1d13a2377d67c8d0 | 5249ca77bd04411340670c86969f091cb6386c22 | refs/heads/master | 2021-01-13T11:17:19.645830 | 2016-12-23T15:20:53 | 2016-12-23T15:20:53 | 77,226,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,270 | java | package com.a41.invoice.service;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.annotation.ManagedBean;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;
import com.a41.invoice.order.model.Order;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import com.itextpdf.text.Image;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
/**
* @author Can Bayraktar
*
*/
@ManagedBean
public class DefaultPdfGeneratorService{
/*
* TODO : - decouple the service from raml schema definitions - remove the
* compilation phase here
*/
/**
* generating a pdf output stream from a template
*
* @param templateData
*/
public StreamingOutput generate(Order order) {
return new StreamingOutput() {
@Override
public void write(OutputStream output) throws IOException, WebApplicationException {
InputStream ips = getAndCreatePdfFileById(order);
FileOutputStream outputStream = new FileOutputStream(new File("C:\\Calismalar\\pdf-"+order.getId()+".pdf"));
int c;
while ((c = ips.read()) != -1) {
output.write(c);
outputStream.write(c);
}
ips.close();
outputStream.close();
}
};
}
private InputStream getAndCreatePdfFileById(Order order) {
Document document = new Document();
try {
ByteArrayOutputStream ops = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, ops);
document.open();
Image image2 = Image.getInstance("C:\\Calismalar\\logo.png");
document.add(image2);
document.add(new Paragraph("All For One Steeb"));
PdfPTable table = new PdfPTable(3); // 3 columns.
table.setWidthPercentage(100); // Width 100%
table.setSpacingBefore(10f); // Space before table
table.setSpacingAfter(10f); // Space after table
// Set Column widths
float[] columnWidths = { 1f, 1f, 1f };
table.setWidths(columnWidths);
PdfPCell cell1 = new PdfPCell(new Paragraph(order.getCustomer().getFirstName() + "" + order.getCustomer().getLastName()));
// cell1.setBorderColor(BaseColor.BLUE);
cell1.setPaddingLeft(10);
cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
PdfPCell cell2 = new PdfPCell(new Paragraph(order.getTotalPrice().toString()));
// cell2.setBorderColor(BaseColor.GREEN);
cell2.setPaddingLeft(10);
cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
PdfPCell cell3 = new PdfPCell(new Paragraph(order.getCurrency()));
// cell3.setBorderColor(BaseColor.RED);
cell3.setPaddingLeft(10);
cell3.setHorizontalAlignment(Element.ALIGN_CENTER);
cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell(cell1);
table.addCell(cell2);
table.addCell(cell3);
document.add(table);
document.close();
writer.close();
return new ByteArrayInputStream(ops.toByteArray());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| [
"Can.Bayraktar@all-for-one.com"
] | Can.Bayraktar@all-for-one.com |
3eb6a3b78b905adafe049a4a76a72a35578fe41b | d492576b6d452f1f4bc8c4f4ffc1b054f5cc5eff | /ViewController/src/co/gov/ideam/sirh/calidad/view/PuntosMonitoreoTreeHandler.java | f10a92745b7d738757565b342868e17262a8e219 | [] | no_license | Sirhv2/AppSirh | d5f3cb55e259c29e46f3e22a7d39ed7b01174c84 | 6074d04bc0f4deb313e7f3c73a284d51e499af4d | refs/heads/master | 2021-01-15T12:04:12.129393 | 2016-09-16T21:09:30 | 2016-09-16T21:09:30 | 68,330,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java | package co.gov.ideam.sirh.calidad.view;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
import org.apache.myfaces.trinidad.component.core.data.CoreTree;
import org.apache.myfaces.trinidad.model.TreeModel;
public class PuntosMonitoreoTreeHandler extends JPanel {
private List focusRowKey = new ArrayList();
private Object selectedNode;
private TreeModel treemodel;
private CoreTree jsfTree;
public PuntosMonitoreoTreeHandler() {
}
public void setSelectedNode(Object selectedNode) {
this.selectedNode = selectedNode;
}
public Object getSelectedNode() {
return selectedNode;
}
public void setTreemodel(TreeModel treemodel) {
this.treemodel = treemodel;
}
public TreeModel getTreemodel() {
return treemodel;
}
public void setJsfTree(CoreTree jsfTree) {
this.jsfTree = jsfTree;
}
public CoreTree getJsfTree() {
return jsfTree;
}
public void setFocusRowKey(List focusRowKey) {
this.focusRowKey = focusRowKey;
}
public List getFocusRowKey() {
return focusRowKey;
}
} | [
"jfgc1394@gmail.com"
] | jfgc1394@gmail.com |
fd571e5827fc8058b526c18172667e7c3238a259 | ee53611e5854c1e565c97214566da3a80000c7d2 | /src/test/java/testCases/ViewStores.java | 99aa736375e96ec7cb758f4ccc979da86eea454a | [] | no_license | amanpandey104/ComprehensiveAssessment_HybridBDD | f8cc3b3d1e5be62ce102f459364dc7c23d3e617b | 4b6c664dbe64c74992cd8908bb801537cdcd8ba5 | refs/heads/main | 2023-08-15T07:35:58.846076 | 2021-09-30T06:00:35 | 2021-09-30T06:00:35 | 410,802,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,561 | java | package testCases;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import pageObjects.BaseFile;
import pageObjects.ViewStoresObjects;
public class ViewStores extends BaseFile {
public static Logger log = LogManager.getLogger(BaseFile.class.getName());
public WebDriver driver = null;
public Properties prop = null;
@BeforeTest
public void openBrowser() throws IOException {
prop = new Properties();
FileInputStream fis = new FileInputStream(".\\Utilities\\datadriven.properties");
prop.load(fis);
driver = initializeDriver();
driver.get(prop.getProperty("url"));
driver.manage().window().maximize();
}
@Test
public void clickStore() {
ViewStoresObjects vso = new ViewStoresObjects(driver);
vso.getStore().click();
log.info("Clicking on Store Option in Header Bar");
}
@Test
public void selectLocation() throws IOException {
ViewStoresObjects vso = new ViewStoresObjects(driver);
FileInputStream fis = new FileInputStream(".\\Utilities\\datadriven.properties");
prop.load(fis);
String city = prop.getProperty("city");
log.info("Entering City to get the Store Location");
vso.getLocation(city).click();
}
@AfterTest
public void close() {
driver.quit();
driver = null;
log.info("End of View Details for Store Test Case");
}
}
| [
"36291873+amanpandey104@users.noreply.github.com"
] | 36291873+amanpandey104@users.noreply.github.com |
60efc17f23566156430fb56a3e03df5b18e3d1d2 | b5f855e8457abb1321b93517eb97205a06a54279 | /src/main/java/servlet/UpdateUserServlet.java | 9433cf77090798663b106b6b7364cf7f0c5c92ab | [] | no_license | Shura293/PreProject1 | 66fa35ccc7777a0c01a8b4a79fa06118272b4237 | 2bc47f2ab9a281886db26163db0d8c3ffd662672 | refs/heads/master | 2022-07-22T08:17:29.221158 | 2020-01-21T01:03:42 | 2020-01-21T01:03:42 | 233,395,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | package servlet;
public class UpdateUserServlet {
}
| [
"n_aix@list.ru"
] | n_aix@list.ru |
1a198be0a98e799bbe8afb14ac88c672e2f5bda3 | 58923e5cff9c09ba7814b055ab244ddd69ab1421 | /src/main/java/com/wurmcraft/minecraftnotincluded/client/gui/farm/SlotOutput.java | 7f2c702351e294320eff6847a251cf8b622097f1 | [] | no_license | Wurmatron/Minecraft-Not-Included | a8ee0ef00256ce6b62ebee8415a3d813ae2388ab | 4d46ba3f971cdec431b2e40b897152ae0f3470ba | refs/heads/master | 2023-01-10T00:37:22.742469 | 2023-01-03T20:44:45 | 2023-01-03T20:44:45 | 151,340,511 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package com.wurmcraft.minecraftnotincluded.client.gui.farm;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotOutput extends Slot {
public SlotOutput(IInventory inventoryIn, int index, int xPosition, int yPosition) {
super(inventoryIn, index, xPosition, yPosition);
}
@Override
public boolean isItemValid(ItemStack stack) {
return false;
}
}
| [
"wurmatron@gmail.com"
] | wurmatron@gmail.com |
eaca7a6b35ddb57bebc3256fb7a4fb0f3671ef8e | 4928505ca1f278dec4b9485ba48740d196b6762c | /nb_project/MonteCarlo_ExamPreparation/src/solutions/McSolution_14.java | 6e05478c7eba2ac4ec07249f1590f1b73067ce85 | [] | no_license | mondrasovic/MonteCarlo | 1da0c2a12901929ee84f5383e0a16be8a04273a8 | f12e255e04ee1d574cac6a4e476950fc6faa1f85 | refs/heads/master | 2021-06-11T13:04:35.421864 | 2017-01-16T09:55:06 | 2017-01-16T09:55:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,048 | java | package solutions;
import OSPRNG.ExponentialRNG;
import montecarlo.IMcSolution;
public class McSolution_14 implements IMcSolution {
private static final double MEAN_TIME = 200.0;
private double atLeast300HoursProb_;
private double noLongerThanMeanProb_;
private double maxWarrantyHours_;
public McSolution_14() {
atLeast300HoursProb_ = noLongerThanMeanProb_ = maxWarrantyHours_ = 0.0;
}
@Override
public void run(int replsNum) {
ExponentialRNG rnd = new ExponentialRNG(MEAN_TIME);
int atLeast300Num = 0;
int noLongerThanMeanNum = 0;
for (int i = 0; i < replsNum; i++) {
double time = rnd.sample();
if (time >= 300.0) {
atLeast300Num++;
}
else if (time <= MEAN_TIME) {
noLongerThanMeanNum++;
}
}
atLeast300HoursProb_ = (double) atLeast300Num / (double) replsNum;
noLongerThanMeanProb_
= (double) noLongerThanMeanNum / (double) replsNum;
rnd = new ExponentialRNG(MEAN_TIME);
for (int hours = 1;; hours++) {
int brokenNum = 0;
for (int i = 0; i < replsNum; i++) {
if (rnd.sample() <= hours) {
brokenNum++;
}
}
if (((double) brokenNum / (double) replsNum) > 0.05) {
maxWarrantyHours_ = hours - 1;
break;
}
}
}
@Override
public String getReport() {
StringBuilder str = new StringBuilder(String.format("Results%n"));
str.append(String.format("\tP(at least 300h) = %.8f%%%n",
atLeast300HoursProb_ * 100.0));
str.append(String.format("\tP(working no more than mean) = %.8f%%%n",
noLongerThanMeanProb_ * 100.0));
str.append(String.format("\tMax. hours num (5%% returns) = %.0f%n",
maxWarrantyHours_));
return str.toString();
}
}
| [
"milan.ondrasovic@gmail.com"
] | milan.ondrasovic@gmail.com |
7259910590f66a48cb238943feb3b1697a2345c7 | 56bc0a0e30ef75e273b35de9faadf2206ff2e09a | /app/src/main/java/com/example/pet_dairy/Walk.java | d788ca007326c08566bfe7943ae1b63fba26714f | [] | no_license | jjjaennn27/Pet_Dairy | 42ddf238120313047cef6795e894c2196507174c | fda55774ea67ac50bf462a9ae8e0cb413f3b9147 | refs/heads/master | 2023-05-27T04:35:38.009950 | 2021-06-09T13:17:59 | 2021-06-09T13:17:59 | 371,048,792 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | package com.example.pet_dairy;
// 산책 등록 파이어베이스 연결
public class Walk {
String Time, Place, Person, Now;
public Walk(String Time, String Place, String Person, String Now) {
this.Time = Time;
this.Place = Place;
this.Person = Person;
this.Now = Now;
}
public Walk(){}
public String getTime() { return Time; }
public void setTime(String Time) { this.Time = Time; }
public String getPlace() { return Place; }
public void setPlace(String Place) { this.Place = Place; }
public String getPerson() { return Person; }
public void setPerson(String Person) { this.Person = Person; }
public String getNow() { return Now; }
public void setNow(String Now) { this.Now = Now; }
} | [
"jea7982@naver.com"
] | jea7982@naver.com |
3f441c4bf7f620440f9beddfadb0f52d588ab72e | 90710c3c97024e19759a4803200564a11c7f24a8 | /ddd/demo1/src/com/neusoft/JDBCDemo.java | f3b927cb5cc870bd0068db17d0d843451d7b324f | [
"Apache-2.0"
] | permissive | dwl12316/javaforme | ad321f1f57ce67c7d879e6b2c8da640cb4377492 | a7f52a49bd8e0c815f79b52e9302de59e45bf27c | refs/heads/main | 2023-01-29T15:53:43.106836 | 2020-12-02T16:06:22 | 2020-12-02T16:06:22 | 313,841,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | package com.neusoft;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class JDBCDemo {
public static void main(String[] args) {
Connection connection = null;
Statement statement = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/school", "root", "root");
String sql = "update account set balance = 1500 where id=1";
String insert ="delete from account where id=3";
statement = connection.createStatement();
int i = statement.executeUpdate(sql);
statement.executeUpdate(insert);
if(i!=0){
System.out.println("111");
}
statement.close();
connection.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"1906088619@qq.com"
] | 1906088619@qq.com |
cc3dca8a21e46f7070fa2242e425aa2485db8be4 | 7ba92c5383b2c751b2a6afbcffb97af6a8513f1c | /app/src/test/java/me/osborn/andrew/criminalintent/ExampleUnitTest.java | 2aec5db25a1613cb3d718339504e1dbc52e025ae | [] | no_license | akosborn/CriminalIntent | 66f914e3be690be90b86822deaa26727de1747a1 | ea565c53750b2faab5f39e0d64b55abad31b0516 | refs/heads/master | 2021-09-01T22:44:32.026528 | 2017-12-29T01:09:05 | 2017-12-29T01:09:05 | 111,497,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package me.osborn.andrew.criminalintent;
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);
}
} | [
"andrewosborn93@gmail.com"
] | andrewosborn93@gmail.com |
49b3ca89e5a821925947a34f4115d9367e5ff90b | 9f3d00d19d93df165347acdfd10548f43eb54513 | /3.JavaMultithreading/src/com/javarush/task/task27/task2707/Solution.java | bfccf7657e862116c3c16c7af45ebc684e252892 | [] | no_license | reset1301/javarushTasks | eebeb85e9cb35feb8aac2c96b73d7afa7bdaea67 | 29a8e8b08bc73f831ff182e7b04c3eb49a56c740 | refs/heads/master | 2018-09-28T10:01:06.772595 | 2018-07-09T10:33:07 | 2018-07-09T10:33:07 | 116,394,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,770 | java | package com.javarush.task.task27.task2707;
/*
Определяем порядок захвата монитора
*/
public class Solution {
public void someMethodWithSynchronizedBlocks(Object obj1, Object obj2) throws InterruptedException {
synchronized (obj1) {
Thread.sleep(100);
synchronized (obj2) {
System.out.println(obj1 + " " + obj2);
}
}
}
public static boolean isNormalLockOrder(final Solution solution, final Object o1, final Object o2) throws Exception {
//do something here
Thread thread1 = new Thread(new Runnable() {
@Override
public void run() {
synchronized (o1) {
try {
Thread.sleep(500);
synchronized (o2) {
Thread.sleep(500);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
// solution.someMethodWithSynchronizedBlocks(o1, o2);
}
}
});
// Thread thread1 = new Thread(new Runnable() {
// @Override
// public void run() {
// synchronized (o2) {
// try {
// Thread.sleep(100);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// synchronized (o1) {
// try {
// solution.someMethodWithSynchronizedBlocks(o1, o2);
//
// Thread.sleep(1000);
// } catch (InterruptedException ignored) {
// }
// }
// }
// }
// }
// });
Thread thread2 = new Thread(new Runnable() {
@Override
public void run() {
try {
solution.someMethodWithSynchronizedBlocks(o1, o2);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
thread1.start();
Thread.sleep(100);
thread2.start();
Thread.sleep(1000);
System.out.println(thread1.getState());
System.out.println(thread2.getState());
return !thread2.getState().equals(Thread.State.BLOCKED);
}
public static void main(String[] args) throws Exception {
final Solution solution = new Solution();
final Object o1 = new Object();
final Object o2 = new Object();
System.out.println(isNormalLockOrder(solution, o1, o2));
}
}
| [
"reset1301@mail.ru"
] | reset1301@mail.ru |
76810dd51e7874310d62be3a1f1c14279022558c | 504b49ba9ec724d8df847d463f8c4522205c58e4 | /src/main/java/SearchTask.java | 3e4d074c3bcd8fb673175ef16875cf158bbbf32f | [] | no_license | mayurm88/MultithreadedSearchFromFile | 03a3d9111f714a309925ed0b0dc274a2ae5b9469 | 223726bdf4298fd49b8fda9c021b747a5f49dbe6 | refs/heads/master | 2023-04-18T06:47:22.864313 | 2019-07-18T17:12:57 | 2019-07-18T17:12:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
public class SearchTask implements Runnable {
private BlockingQueue<FileContent> blockingQueue;
private String searchWord;
SearchTask(BlockingQueue<FileContent> blockingQueue, String searchWord) {
this.blockingQueue = blockingQueue;
this.searchWord = searchWord;
}
@Override
public void run() {
try {
while(true) {
FileContent fileContent = blockingQueue.poll(5, TimeUnit.SECONDS);
if(fileContent != null) {
search(fileContent, searchWord);
} else {
break;
}
}
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
private void search(FileContent fileContent, String searchWord) {
for(Line line : fileContent.getLines()) {
if(line.getLine().contains(searchWord)) {
System.out.println(searchWord + ":" + "Line number: " + line.getLineNumber() + " - " + line.getLine());
}
}
}
}
| [
"oscarsdeathrace@gmail.com"
] | oscarsdeathrace@gmail.com |
f86b60fcac9a852d035e7e026379507f323b9a09 | a2079f094ef1ef676f9582c618a60870a0c6a332 | /part2/loops/AverageOfPositiveNumbers.java | 8b22e6d3e554e59cd60bad54558c67817877431f | [] | no_license | Abdi-29/mooc | 5995948bb75dcf538279a62aeba65a137b37db85 | 63f05bf33d5fb4a0501a0e0becd8f2f2f7cf4a19 | refs/heads/main | 2023-08-04T02:44:07.631858 | 2021-09-12T20:22:30 | 2021-09-12T20:22:30 | 396,918,372 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | import java.util.Scanner;
public class AverageOfPositiveNumbers {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int count = 0;
int ave = 0;
while (true) {
int number = Integer.valueOf(scanner.nextLine());
if (number == 0) {
break;
}
else if (number < 0) {
continue;
}
ave += number;
count++;
}
while (true) {
if (count == 0) {
System.out.println("Cannot calculate the average");
break;
}
System.out.println("Average of the numbers: " + ((1.0 * ave) / count));
break;
}
}
}
| [
"Abdoulayeba29@gmail.com"
] | Abdoulayeba29@gmail.com |
953f9a65e59ad18c6368dd953a3df05cd970fc05 | bb7c10c03f3c0ae0064bbb60f4f24cf6d7d44c20 | /MobiLawyer/app/src/main/java/com/king/mobilawyer/Main2Activity.java | e4e4cbaddbb2d4f97e9ec36c5e29623e9a0a8f37 | [] | no_license | bsakari/Android-Studio-Projects | c0f8e513cbdc8e37557034d86632a638248bfd93 | e758339fc392bde8342d866c5829252fc5f465eb | refs/heads/master | 2020-03-17T13:00:40.895364 | 2018-05-16T05:13:12 | 2018-05-16T05:13:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,059 | java | package com.king.mobilawyer;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class Main2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
| [
"sakaribenjamin@gmail.com"
] | sakaribenjamin@gmail.com |
25bd2f5aab81682bcb66aa1fac34ec6a12c940b8 | 981898a15dc1d413d3ccebca62041a7a8e6d2b5e | /common/src/main/java/com/tcc/common/webcrawl/base/validate/CutImgStrategy.java | 331897ddd0c1ead96aeb9d3b1e0b183279fc55c3 | [] | no_license | gaowenbin/common | e8d12775da152ae5ca832ad8826d509ad70f973e | 7d57b3bba03b348f03a96b57116a1085c83e609e | refs/heads/master | 2020-12-27T21:22:02.994209 | 2016-02-24T05:41:04 | 2016-02-24T05:41:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package com.tcc.common.webcrawl.base.validate;
import java.awt.image.BufferedImage;
import java.util.List;
/**
* @Filename CutImgStrategy.java
*
* @Description 切割图片策略
*
* @author tcc 2015-12-28
*
*/
public abstract class CutImgStrategy {
/**
* 切割
* @param codeImg
* @return
*/
protected abstract List<BufferedImage> getSubImgs(BufferedImage codeImg);
}
| [
"450518053@qq.com"
] | 450518053@qq.com |
5e538cdd4b85850c230d6fe83d1f28912b19abf1 | c8f42ebfc546cc82820781ceef48826e19856e7f | /SpringMVC_HibernateValidation_DAO/src/main/java/com/perscholas/hibernate_validation_dao/models/Book.java | d68b0bc2b81d61c8164e096025b2c29ced7367fb | [] | no_license | sravanthi1986/PerScholasCode | 7089567a238a3f1dcf762c79089989f042379a08 | 78fb4939b45bc84fbd7308ec3ac44787d83963fa | refs/heads/master | 2022-12-21T13:04:21.505336 | 2019-12-06T18:23:51 | 2019-12-06T18:23:51 | 226,383,647 | 0 | 0 | null | 2022-12-16T00:38:03 | 2019-12-06T18:05:36 | Java | UTF-8 | Java | false | false | 940 | java | package com.perscholas.hibernate_validation_dao.models;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
public class Book {
@Id
@GeneratedValue
private Integer bookId;
@Size(min=2, max=50, message="Title must be between 2 and 50 characters long.")
@NotBlank(message="Title is required.")
private String title;
@Size(min=2, max=50, message="Author name must be between 2 and 50 characters long.")
@NotBlank(message="Author name is required.")
private String author;
public Integer getBookId() {
return bookId;
}
public void setBookId(Integer bookId) {
this.bookId = bookId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
| [
"sravs.amc@gmail.com"
] | sravs.amc@gmail.com |
cbb6f146e09017d0aa7a2f4626ec6adf7807008b | 4d9fbb443bcfb8e49174baaad50ce52642490010 | /DM_StudypointExercise_3_Sets/src/dm_studypointexercise_3_sets/SetTheory.java | 199412d3762735d1c2a99bcd65158945282710a8 | [] | no_license | lalelarsen/DM_StudypointExercise_3_Sets | 87e5a87b576748b18e96268348ef03bdfdb29654 | 28df212d937303b40147d6801eea2a14a2ff6829 | refs/heads/master | 2021-07-08T13:43:55.543159 | 2017-10-01T23:01:00 | 2017-10-01T23:01:00 | 105,223,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,602 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dm_studypointexercise_3_sets;
import java.util.ArrayList;
/**
*
* @author Frederik
*/
public class SetTheory {
public static Set Difference(Set a, Set b){
if(a.isInfinite || a.isInfinite && b.isInfinite){
return new Set(true);
}
if(b.isInfinite){
return new Set();
}
ArrayList<Comparable> tmpArrayList = new ArrayList();
for (int i = 0; i < a.getValues().length; i++) {
boolean check = true;
for (int j = 0; j < b.getValues().length; j++) {
if(a.getValues()[i] == b.getValues()[j]){
check = false;
}
}
if(check){
tmpArrayList.add(a.getValues()[i]);
}
}
Comparable[] result = new Comparable[tmpArrayList.size()];
for (int i = 0; i < result.length; i++) {
result[i] = tmpArrayList.get(i);
}
return new Set(result);
}
public static Set Union(Set a, Set b){
if(a.isInfinite || b.isInfinite){
return new Set(true);
}
ArrayList<Comparable> tmpArrayList = new ArrayList();
for (int i = 0; i < a.getValues().length; i++) {
tmpArrayList.add(a.getValues()[i]);
}
for (int i = 0; i < b.getValues().length; i++) {
boolean check = true;
for (int j = 0; j < tmpArrayList.size(); j++) {
if(tmpArrayList.get(j) == b.getValues()[i]){
check = false;
}
}
if(check){
tmpArrayList.add(b.getValues()[i]);
}
}
Comparable[] result = new Comparable[tmpArrayList.size()];
for (int i = 0; i < result.length; i++) {
result[i] = tmpArrayList.get(i);
}
return new Set(result);
}
public static Set Intersection(Set a, Set b){
if(a.isInfinite && b.isInfinite){
return new Set(true);
}
if(a.isInfinite){
return b;
}
if(b.isInfinite){
return a;
}
if(a.getValues().length == 0 || b.getValues().length == 0){
return new Set();
}
ArrayList<Comparable> tmpArrayList = new ArrayList<>();
for (int i = 0; i < a.getValues().length; i++) {
boolean check = false;
for (int j = 0; j < b.getValues().length; j++) {
if(a.getValues()[i] == b.getValues()[j]){
check = true;
}
}
if(check){
tmpArrayList.add(a.getValues()[i]);
}
}
Comparable[] result = new Comparable[tmpArrayList.size()];
for (int i = 0; i < result.length; i++) {
result[i] = tmpArrayList.get(i);
}
return new Set(result);
}
public static boolean membership(Comparable c, Set a){
if(a.isInfinite){
return true;
}
if(a.getValues().length == 0){
return false;
}
for (int i = 0; i < a.getValues().length; i++) {
if(c == a.getValues()[i]){
return true;
}
}
return false;
}
}
| [
"frederikblarsen@hotmail.com"
] | frederikblarsen@hotmail.com |
b4dd5ce67b2d5cde23ed6ee41b1d9ce4c54f6152 | f3bc056a40bbf69b37dfe2bf96036e7c420ad6d2 | /src/br/senai/sp/paletas/tela/TelaLogin.java | c18ef27b5bc64cc95021f8d3749711ba8d409037 | [] | no_license | SamaraSantana/LasPaletas | 433732fbe85c58e9c33235e5ff075b02cba9233f | bfa4e67e0bed310a07a15e5790ded4bf82cd13b2 | refs/heads/master | 2020-05-16T19:37:06.486800 | 2019-04-24T16:25:39 | 2019-04-24T16:25:39 | 183,266,310 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,537 | java | package br.senai.sp.paletas.tela;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class TelaLogin extends JFrame implements ActionListener {
JPanel pnCentral, pnBotao;
JLabel lbUsuario, lbSenha, imagem,lbFun;
JTextField tfUsuario;
JPasswordField jpSenha;
Font fontePadrao, fontePadrao2,fontePadrao3;
JButton btEntrar;
public TelaLogin() {
inicializarComponentes();
definirEventos();
}
private void inicializarComponentes() {
// fonte padrao
fontePadrao = new Font("Verdana", Font.BOLD | Font.ITALIC, 16 );
// fonte padrao2
fontePadrao2 = new Font("Arial", Font.PLAIN, 14);
// fonte padrao3
fontePadrao3 = new Font("Verdana", Font.BOLD | Font.ITALIC, 20);
// pnCentral
pnCentral = new JPanel();
pnCentral.setBackground(new Color(36,177,76));
pnCentral.setLayout(null);
// lbNome(label Usuario)
lbUsuario = new JLabel("Login:");
lbUsuario.setBounds(60, 280, 80, 30);
lbUsuario.setFont(fontePadrao);
// Text Field Login(tfUsuario)
tfUsuario = new JTextField();
tfUsuario.setBackground(Color.white);
tfUsuario.setBounds(130, 280, 200, 30);
tfUsuario.setFont(fontePadrao2);
// lbNome(label Usuario)
lbSenha = new JLabel("Senha:");
lbSenha.setBounds(60, 320, 100, 30);
lbSenha.setFont(fontePadrao);
// Text Field Login(tfUsuario)
jpSenha = new JPasswordField();
jpSenha.setBackground(Color.white);
jpSenha.setBounds(130, 320, 200, 30);
jpSenha.setFont(fontePadrao2);
imagem = new JLabel();
imagem.setBounds(110, 10, 408, 261);
imagem.setIcon(new ImageIcon(getClass().getResource(
"/imagens/logoVerde.png")));
// lbNome(label Usuario)
lbFun = new JLabel("Funcionário");
lbFun.setBounds(170, 240, 180, 30);
lbFun.setFont(fontePadrao3);
// btSalvar
btEntrar = new JButton("Entrar");
btEntrar.setFont(fontePadrao);
btEntrar.setBackground(Color.white);
btEntrar.setMnemonic(KeyEvent.VK_S);
// Painel do botao salvar,limpar e excluir
pnBotao = new JPanel();
GridLayout layout = new GridLayout(1, 3);
layout.setHgap(5);
pnBotao.setLayout(layout);
pnBotao.setBounds(170, 380, 100, 30);
pnBotao.add(btEntrar);
// adiconar ao pnCentral(Painel central)
pnCentral.add(lbUsuario);
pnCentral.add(tfUsuario);
pnCentral.add(lbSenha);
pnCentral.add(jpSenha);
pnCentral.add(imagem);
pnCentral.add(pnBotao);
pnCentral.add(lbFun);
// Adicionando os componentes
add(pnCentral, BorderLayout.CENTER);
// ****definir tamanho da janela ****
setSize(500, 500);
// ****Centralizar janela
setLocationRelativeTo(null);
// ****Colocar nome na janela****
setTitle("Login Funcionario");
// mudar de fundo do da janela do java e nova cor
// getContentPane().setBackground(Color.red);
getContentPane().setBackground(new Color(255, 165, 0));
// ****Nao redimencionar a janela****
setResizable(true);
// ****Desenha a tela, ultima coisa a ser colocada apos o inicializaçao
// componentes****
setVisible(true);
}
private void definirEventos() {
// Listener da tfUsuario
// keyListener serve para verificar as teclas que estão sendo
// presionadas
tfUsuario.addKeyListener(new KeyAdapter() {
@Override
// o objeto keyEvent (e) tem as informaçoes da
// tecla pressionada
public void keyTyped(KeyEvent e) {
// se p caractere da tecla pressionada
// for númerico não deixa ir para TextField
if (Character.isDigit(e.getKeyChar()) || (tfUsuario.getText().length() >= 15))
e.consume();
if(Character.isSpace(e.getKeyChar()))
e.consume();
}
});
jpSenha.addKeyListener(new KeyAdapter() {
@Override
// o objeto keyEvent (e) tem as informaçoes da
// tecla pressionada
public void keyTyped(KeyEvent e) {
// se p caractere da tecla pressionada
// for númerico não deixa ir para TextField
if (jpSenha.getText().length() >= 8)
e.consume();
if(Character.isSpace(e.getKeyChar()))
e.consume();
}
});
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
}
| [
"samara-santana98@hotmail.com"
] | samara-santana98@hotmail.com |
59c8de23c5c1b756fd89d61983fb0cd138f953a7 | 5eac9ba7487a4fb66fd23f0322799c97848b4435 | /PAS/.svn/pristine/6e/6ebbf0daa9f1d0d53f3ab0ae1879228dfd2e3a4f.svn-base | 51b2fd3fcc32d52178f6fe8707c439716451b10c | [] | no_license | mugi22/PAS | dbf637c18543906971dce1dc587e1fa51376a2f7 | d10979e295826f648822fa577d778183beb218c7 | refs/heads/master | 2021-01-10T22:28:54.760297 | 2015-07-15T07:24:24 | 2015-07-15T07:24:24 | 35,809,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | package co.id.pegadaian.pasg2.util;
import java.util.Random;
public class RandomString {
int length=16;
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public String randomString() {
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
String output = sb.toString();
System.out.println(output);
return output ;
}
/**
* @param args
*/
public static void main(String[] args) {
RandomString rd = new RandomString();
rd.setLength(4);
rd.randomString();
}
}
| [
"mugihnf@gmail.com"
] | mugihnf@gmail.com | |
36787c09950dcefaeaa2797950ef021c6a983545 | 317d69e6388c616683dec2ebb96c5aaf291d14ad | /lab3/src/lab3/WordLineCount.java | 56ee7e67180ab8075e580e481ce0d9ffa4c4dceb | [] | no_license | ShaliniPN03/capg | a3dc97b6ce63d65c83656d79f4c740cfc5972690 | 550f598c2dc58422dc76baf73e7a2255e0613681 | refs/heads/main | 2023-05-06T07:56:39.536996 | 2021-05-16T12:14:24 | 2021-05-16T12:14:24 | 367,864,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | package lab3;
import java.util.Scanner;
public class WordLineCount {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter the text");
String text=sc.nextLine();
int line=1;
int words=0,character=0;
for(int i=0;i<text.length();i++)
{
char ch=text.charAt(i);
if(ch=='\n' || ch=='.')
{
line++;
}
else if(ch==' ')
{
words++;
}
else
{
character++;
}
}
System.out.println("Word count: "+words);
System.out.println("Lines count: "+line);
System.out.println("Character count: "+character);
}
}
| [
"noreply@github.com"
] | ShaliniPN03.noreply@github.com |
626746415ac903442030af71c7ab12430ef3cb51 | 3668a996d6c0dd3a79fd42c1cdf2e6d4f7011a1b | /src/main/java/com/csv/integration/kafka/streams/demo/data/Employee.java | 9873db58be7fca21b5af6aabcd76d30a4261532f | [] | no_license | Crazy-Horse/kafka-streams-integration-demo | 9b7c0227dee25b810fcadaf77af69a3ed865cd97 | 8fccd51395b6cbac655bad392684e85cca73608b | refs/heads/master | 2023-03-26T17:10:38.457102 | 2021-03-16T11:44:40 | 2021-03-16T11:44:40 | 273,223,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,652 | java | package com.csv.integration.kafka.streams.demo.data;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
@Entity
public class Employee implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String firstName;
private String lastName;
@OneToMany(fetch=FetchType.EAGER)
List<Address> addresses;
private Integer yearsOfService;
private String departmentId;
private Long managerId;
public Employee() {}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public List<Address> getAddresses() {
return addresses;
}
public void setAddresses(List<Address> addresses) {
this.addresses = addresses;
}
public Integer getYearsOfService() {
return yearsOfService;
}
public void setYearsOfService(Integer yearsOfService) {
this.yearsOfService = yearsOfService;
}
public String getDepartmentId() {
return departmentId;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public Long getManagerId() {
return managerId;
}
public void setManagerId(Long managerId) {
this.managerId = managerId;
}
}
| [
"stuart.holland@softvision.com"
] | stuart.holland@softvision.com |
a699d2dcb9d7531b2393b7878c65476787bc599e | 715ee2dab091b74522df11967c9bff7505d372d9 | /src/com/company/Cifrecomune.java | 03a274bd916df014e8f524b98d9eef9c4caed994 | [] | no_license | grosuionutandrei/Exercitii | 435087a575b2d76d0c8e74d63eced4a11235e4bc | 0855fe27c7ca87750ed2aa7b63132106a98c0de4 | refs/heads/main | 2023-06-19T07:41:26.875238 | 2021-07-19T12:48:28 | 2021-07-19T12:48:28 | 387,459,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,205 | java | package com.company;
import java.util.*;
public class Cifrecomune {
public static void main(String[] args) {
int x = 21348;
int y = 14513;
List<List<Integer>> lists = getDigits(x,y);
getIntersection(lists);
}
private static List<List<Integer>> getDigits(int x, int y) {
List<Integer> xDigits = new LinkedList<>();
List<Integer> yDigits = new LinkedList<>();
while((x!=0)&& (y!=0)){
int r = x%10;
int s = y%10;
x=x/10;
y=y/10;
xDigits.add(r);
yDigits.add(s);
}
List<List<Integer>> lists = new LinkedList<>();
lists.add(xDigits);
lists.add(yDigits);
return lists;
}
private static void getIntersection(List<List<Integer>> lists){
List<Integer> list1 = lists.get(0);
List<Integer> list2 = lists.get(1);
List<Integer> list3 = new LinkedList<>();
for(Integer integer:list1){
list3.add(integer);
}
list3.retainAll(list2);
System.out.println("There are "+ list3.size() +" common digits");
System.out.println("They are " + list3);
}
}
| [
"ionut2129angel@yahoo.com"
] | ionut2129angel@yahoo.com |
efe025273dc68d756bf6ba99da4c425ec52323eb | 495d80e0db47fa3cf3994f6dc0e51d97eb1531c1 | /Java-DB-Fundamentals/Java_DB-Fundamentals-Advanced-Hibenate/XML Processing/Car Dealer/src/main/java/app/services/api/PartService.java | ac4220904d3043cdd8a200354872630e394837b5 | [] | no_license | VeselinValev/Java-SoftUni-Courses | d37ce5f68ac824d9864d53455da9f7a0e0d8feb9 | afc5b1a61470ed13a3331187c8bc5073361659c1 | refs/heads/master | 2020-04-12T09:58:00.469403 | 2019-01-08T12:10:04 | 2019-01-08T12:10:04 | 162,414,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package app.services.api;
import app.models.dtos.binding.PartDto;
import app.models.entities.Part;
import java.util.List;
public interface PartService {
void saveAll(List<PartDto> parts);
List<Part> getAllParts();
}
| [
"37142700+VeselinValev@users.noreply.github.com"
] | 37142700+VeselinValev@users.noreply.github.com |
d65775fb96151b43ac22e458a85aa64fe9290a19 | 1fdca1a6e67872e2bbb193f77d1e7b45947c2e47 | /sdl_android_4.4.0/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java | 39cdebfc7343b6b84352cea3c6bd1f7cd768822d | [] | no_license | mhlyak/sdl-kickstarter-app | 9c9e912e85357af2281c3d31e58bc23b20ceaec9 | 1a37d24a85b11d829c4ee3c9cae428ea154717ec | refs/heads/master | 2021-08-23T15:01:59.910874 | 2017-12-05T09:51:52 | 2017-12-05T09:51:52 | 113,153,447 | 1 | 0 | null | 2017-12-05T09:51:53 | 2017-12-05T08:20:06 | Java | UTF-8 | Java | false | false | 2,831 | java | package com.smartdevicelink.proxy.rpc.enums;
/**
* Defines the vehicle data types that can be published and subscribed to.
*
*/
public enum VehicleDataType {
/**
* Notifies GPSData may be subscribed
*/
VEHICLEDATA_GPS,
/**
* Notifies SPEED Data may be subscribed
*/
VEHICLEDATA_SPEED,
/**
* Notifies RPMData may be subscribed
*/
VEHICLEDATA_RPM,
/**
* Notifies FUELLEVELData may be subscribed
*/
VEHICLEDATA_FUELLEVEL,
/**
* Notifies FUELLEVEL_STATEData may be subscribed
*/
VEHICLEDATA_FUELLEVEL_STATE,
/**
* Notifies FUELCONSUMPTIONData may be subscribed
*/
VEHICLEDATA_FUELCONSUMPTION,
/**
* Notifies EXTERNTEMPData may be subscribed
*/
VEHICLEDATA_EXTERNTEMP,
/**
* Notifies VINData may be subscribed
*/
VEHICLEDATA_VIN,
/**
* Notifies PRNDLData may be subscribed
*/
VEHICLEDATA_PRNDL,
/**
* Notifies TIREPRESSUREData may be subscribed
*/
VEHICLEDATA_TIREPRESSURE,
/**
* Notifies ODOMETERData may be subscribed
*/
VEHICLEDATA_ODOMETER,
/**
* Notifies BELTSTATUSData may be subscribed
*/
VEHICLEDATA_BELTSTATUS,
/**
* Notifies BODYINFOData may be subscribed
*/
VEHICLEDATA_BODYINFO,
/**
* Notifies DEVICESTATUSData may be subscribed
*/
VEHICLEDATA_DEVICESTATUS,
/**
* Notifies BRAKINGData may be subscribed
*/
VEHICLEDATA_BRAKING,
/**
* Notifies WIPERSTATUSData may be subscribed
*/
VEHICLEDATA_WIPERSTATUS,
/**
* Notifies HEADLAMPSTATUSData may be subscribed
*/
VEHICLEDATA_HEADLAMPSTATUS,
/**
* Notifies BATTVOLTAGEData may be subscribed
*/
VEHICLEDATA_BATTVOLTAGE,
/**
* Notifies EGINETORQUEData may be subscribed
*/
VEHICLEDATA_ENGINETORQUE,
/**
* Notifies ACCPEDALData may be subscribed
*/
VEHICLEDATA_ACCPEDAL,
/**
* Notifies STEERINGWHEELData may be subscribed
*/
VEHICLEDATA_STEERINGWHEEL,
/**
* Notifies ECALLINFOData may be subscribed
*/
VEHICLEDATA_ECALLINFO,
/**
* Notifies AIRBAGSTATUSData may be subscribed
*/
VEHICLEDATA_AIRBAGSTATUS,
/**
* Notifies EMERGENCYEVENTData may be subscribed
*/
VEHICLEDATA_EMERGENCYEVENT,
/**
* Notifies CLUSTERMODESTATUSData may be subscribed
*/
VEHICLEDATA_CLUSTERMODESTATUS,
/**
* Notifies MYKEYData may be subscribed
*/
VEHICLEDATA_MYKEY;
/**
* Convert String to VehicleDataType
* @param value String
* @return VehicleDataType
*/
public static VehicleDataType valueForString(String value) {
try{
return valueOf(value);
}catch(Exception e){
return null;
}
}
}
| [
"matic.miheljak@gmail.com"
] | matic.miheljak@gmail.com |
9c8484968c585d19fef9a8e60a9c92e9d5976c63 | b385b964972a29a548f83ee53633484a6521d611 | /RestaurantAttractionProject/SP2020_project3_Hesiquio/SP2020_Project3_A2/app/src/main/java/com/example/sp2020_project3_a2/ListViewRestaurant.java | 7ab9be356aabf53dc4013fd411b4de7f675aab93 | [] | no_license | ballinesh/AndroidAttractionsList | 43a98bfda3e2c434670fe78f01b1468aa7645bea | 81c675f798e123ad8944eed65c28848bff428341 | refs/heads/master | 2022-08-14T11:25:22.892757 | 2020-05-20T20:03:50 | 2020-05-20T20:03:50 | 265,673,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,684 | java | package com.example.sp2020_project3_a2;
import android.content.Context;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.ListFragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.example.sp2020_project3_a2.dummy.DummyContent;
import com.example.sp2020_project3_a2.dummy.DummyContent.DummyItem;
import java.util.ArrayList;
import java.util.EventListener;
import java.util.List;
public class ListViewRestaurant extends ListFragment {
//Contents that will be used to populate the list of restaurants
ListView list;
String[] attractions = {"Nutella Cafe" , "Nando's Peri Peri Chicken", "Joy Yee", "Shake Shack", "Giordano's", "Portillo's"};
private ListSelectionListener listener = null;
// Callback interface that allows this Fragment to notify the QuoteViewerActivity when
// user clicks on a List Item
public interface ListSelectionListener {
public void onListSelection(int index);
}
//Good to go
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
{
setRetainInstance(true);
Log.i("ListFragment", getClass().getSimpleName() + ":entered onCreateView()");
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void onActivityCreated(Bundle savedState) {
Log.i("ListFragment", getClass().getSimpleName() + ":entered onActivityCreated()");
super.onActivityCreated(savedState);
// Set the list adapter for the ListView
// Discussed in more detail in the user interface classes lesson
setListAdapter(new ArrayAdapter<String>(getActivity(), R.layout.list_item, attractions));
// Set the list choice mode to allow only one selection at a time
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
// Called when the user selects an item from the List
//Good to go
@Override
public void onListItemClick(ListView l, View v, int pos, long id) {
// Indicates the selected item has been checked
getListView().setItemChecked(pos, true);
// Inform the QuoteViewerActivity that the item in position pos has been selected
listener.onListSelection(pos);
}
//Good to go
@Override
public void onAttach(Context activity) {
super.onAttach(activity);
try {
// Set the ListSelectionListener for communicating with the QuoteViewerActivity
// Try casting the containing activity to a ListSelectionListener
listener = (ListSelectionListener) activity;
} catch (ClassCastException e) {
// Cast failed: This is not going to work because containing activity may not
// have implemented onListSelection() method
throw new ClassCastException(activity.toString()
+ " must implement OnArticleSelectedListener");
}
}
//Given by default, had to add retain instance to not destroy the fragment
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i("ListFragment", getClass().getSimpleName() + ":entered onCreate()");
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
}
| [
"noreply@github.com"
] | ballinesh.noreply@github.com |
4c744159214c0d9b966e611d04c18b8f1c48ebbd | a91fb7f0e0b470b4640e50a8b6623422c800b42b | /src/main/java/com/iss/saas/server/package-info.java | e797fe98f6ecdb350e1fafaec41f302c779041ff | [] | no_license | WallaceMao/softstoneApp | ab2a1257f46551cd9cb084fa17f796c600a355eb | 104348280ac2f11f359b9bd95c87510570cc6dfd | refs/heads/master | 2021-01-10T14:33:08.824763 | 2016-04-07T12:20:21 | 2016-04-07T12:20:21 | 54,641,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | @javax.xml.bind.annotation.XmlSchema(namespace = "http://server.saas.iss.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.iss.saas.server;
| [
"maowenqiang0752@163.com"
] | maowenqiang0752@163.com |
14e2e5ff7c1cbea7d1185300fbc81df78caed5a2 | bb32e9beccc13a9726b1f76663e6fe2fd6546e26 | /app/src/main/java/br/com/jeff3/departamento/AgendaActivity.java | a7828f0b12f4b662acb5028691dbf742c0a452aa | [] | no_license | nobertojefferson78/Departamento | c912c21c9600f80539732e3b8212decdac1d4294 | 65dbd37f355c139c3373d15540c5cd558d477d7e | refs/heads/master | 2021-01-10T20:05:12.474717 | 2015-07-01T17:48:00 | 2015-07-01T17:48:00 | 38,250,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,004 | java | package br.com.jeff3.departamento;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import br.com.jeff3.departamento.app.MensageBox;
public class AgendaActivity extends ActionBarActivity implements View.OnClickListener{
private Button btnAgendar;
private Button btnListarAgendas;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_agenda);
btnAgendar = (Button)findViewById(R.id.btnCadastrarAgenda);
btnListarAgendas = (Button)findViewById(R.id.btnListar);
btnListarAgendas.setOnClickListener(this);
btnAgendar.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_agenda, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
Intent it;
if(v == btnAgendar) {
it = new Intent(this, CadastroAgendaActivity.class);
startActivityForResult(it, 0);
}else{
//MensageBox.show(this, "Atencao", "Em manutencao");
it = new Intent(this, ListaAgendaActivity.class);
startActivityForResult(it, 0);
}
}
}
| [
"nobertojefferson78@gmail.com"
] | nobertojefferson78@gmail.com |
d52fccb2897108c9c8d6ea24d9ac615fff02393f | 5ec412a52088911bf332646f26b55bcd2ac93aad | /plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPSystemInfoObject.java | f07a922c6e86e19857756021fceabb417edd1141 | [
"EPL-2.0",
"Apache-2.0"
] | permissive | Paresh-Wadhwani/dbeaver | 2e6c69ed417244c063354e0268ca7e883998a678 | 2f3a7749a853b863ce1b89f377a3f91ff69c08d7 | refs/heads/devel | 2023-01-14T04:39:29.932324 | 2020-11-13T14:36:32 | 2020-11-13T14:36:32 | 254,940,127 | 0 | 0 | Apache-2.0 | 2020-11-14T06:22:47 | 2020-04-11T19:29:02 | null | UTF-8 | Java | false | false | 791 | java | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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.jkiss.dbeaver.model;
/**
* Database system info object
*/
public interface DBPSystemInfoObject extends DBPObject
{
}
| [
"serge@jkiss.org"
] | serge@jkiss.org |
75f90dc3828f8abd547fbc399e08b11b1d25292d | 3e8604fa0386beb931bbd3041b124243106252c4 | /app/src/main/java/com/example/android/visitcard/MainActivity.java | ba9613df1324208b977a5dda471b0105965c9341 | [] | no_license | jurekora/Visitcard | 643fb8a23b03b0ee2c97dce5ffefc6b06ba68f38 | a43a9637b7771fc169ecaf76b5abb9cfec63f8ea | refs/heads/master | 2021-08-19T06:03:18.698320 | 2017-11-24T22:37:50 | 2017-11-24T22:37:50 | 111,957,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.example.android.visitcard;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"jurek.orawski@gmail.com"
] | jurek.orawski@gmail.com |
791c90c37f7b1b6063ad3a706c8053111a69a9c3 | 0850947cd22cc12029d253192d2fe73c8dcd3093 | /app/src/main/java/edu/anu/comp6442/retrogame2018s1/model/Bonus.java | 613f31c74bb3079f7a840a37db843a3a8301a9f9 | [
"MIT"
] | permissive | realmadrid/aircraft-battle | 61fc98738f8da5948aa83a412aa0a62103bb8510 | a8d1e2797dc86bd0f2b78802ce79b27d5d8dcba3 | refs/heads/master | 2020-07-15T10:43:30.297789 | 2019-08-31T14:09:58 | 2019-08-31T14:09:58 | 205,542,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,995 | java | package edu.anu.comp6442.retrogame2018s1.model;
/*
* Copyright (C) 2018,
*
* Haotian Shi <u6158063@anu.edu.au>
*/
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import java.util.Random;
/**
* Basic bonus class, the random movements would have be computed before drawing.
* The subclasses must implement the method getBonusEffect() for specific purpose.
*/
public abstract class Bonus extends Sprite {
private int stage = 1;
private boolean hasInitialized = false;
private Movement m1, m2, m3; // three stages when the bonus move in the screen
public Bonus(Bitmap bitmap) {
super(bitmap);
setSpeed(2);
}
/**
* The parameters should be computed before first drawing.
*/
private void initParameters(Canvas canvas) {
hasInitialized = true;
Random random = new Random();
int unitY = canvas.getHeight() / 4;
int x1 = 0;
if (random.nextBoolean()) {
x1 = canvas.getWidth();
this.moveTo(random.nextInt(canvas.getWidth() / 4) + canvas.getWidth() / 4, -getHeight());
} else {
this.moveTo(random.nextInt(canvas.getWidth() / 4) + canvas.getWidth() / 2, -getHeight());
}
int x2 = canvas.getWidth() - x1;
int x3 = x1;
int y1 = random.nextInt(unitY) + unitY;
int y2 = y1 + unitY;
int y3 = y1 + 3 * unitY;
m1 = computeMovement((int) getX(), (int) getY(), x1, y1);
m2 = computeMovement(x1, y1, x2, y2);
m3 = computeMovement(x2, y2, x3, y3);
}
/**
* Compute the movement for ticks in each stage.
*/
private Movement computeMovement(int startX, int startY, int targetX, int targetY) {
float deltaX = targetX - startX;
float deltaY = targetY - startY;
float distance = (float) Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
float unitDis = 3;
float moveX = getSpeed() * unitDis * deltaX / distance;
float moveY = getSpeed() * unitDis * deltaY / distance;
return new Movement(moveX, moveY);
}
private class Movement {
float x, y;
Movement(float x, float y) {
this.x = x;
this.y = y;
}
}
@Override
protected void beforeDraw(Canvas canvas, Paint paint) {
super.beforeDraw(canvas, paint);
if (!hasInitialized)
initParameters(canvas);
if (stage == 1) {
move(m1.x, m1.y);
} else if (stage == 2) {
move(m2.x, m2.y);
} else if (stage == 3) {
move(m3.x, m3.y);
} else {
destroy();
}
}
@Override
protected void afterDraw(Canvas canvas, Paint paint) {
super.afterDraw(canvas, paint);
if (getX() + getWidth() >= canvas.getWidth() || getX() <= 0) {
stage++;
}
}
protected abstract void getBonusEffect(PlayerPlane player);
}
| [
"realmadrid.anu@gmail.com"
] | realmadrid.anu@gmail.com |
f93d25cd17f3db6d2920400bcaaa10143846acd1 | 27c657771164eb8897f4f7be5199e63b2629408c | /src/com/tms/model/Qualification.java | 7d279074ce56e89a7c317a936ff6ffbee0a76e82 | [] | no_license | Bishnurai701/TMS1 | fd7e1903c6685c84618f7607341edc7e84057210 | e0d5d4b2025342b123917738049b1c57181ea7b2 | refs/heads/main | 2023-04-27T04:15:31.474451 | 2021-05-05T15:46:17 | 2021-05-05T15:46:17 | 364,627,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,561 | java | package com.tms.model;
import java.util.Date;
public class Qualification {
private int Qualification_id;
private int Level_id;
private String InstituteName;
private String PercentOrGPA;
private Date PassedYear;
private String Address;
private int Board_id;
private int Faculty_id;
private int University_id;
private int Registration_id;
private String FileName;
private String FilePath;
private String LevelName;
private String BoardName;
private String FacultyName;
private String UniversityName;
private String FirstName;
/* here constructor */
public Qualification(int Qualification_id){}
public Qualification(int Qualification_id, int Level_id, String InstituteName, String PercentOrGPA, Date PassedYear, String Address, int Board_id, int Faculty_id, int University_id, int Registration_id, String FilePath,String FileName) {
this.Qualification_id = Qualification_id;
this.Level_id = Level_id;
this.InstituteName = InstituteName;
this.PercentOrGPA = PercentOrGPA;
this.PassedYear = PassedYear;
this.Address = Address;
this.Board_id = Board_id;
this.Faculty_id = Faculty_id;
this.University_id = University_id;
this.Registration_id = Registration_id;
this.FilePath = FilePath;
this.FileName=FileName;
}
public Qualification(int Level_id, String InstituteName, String PercentOrGPA, Date PassedYear, String Address, int Board_id, int Faculty_id, int University_id, int Registration_id, String FilePath,String FileName) {
this.Level_id = Level_id;
this.InstituteName = InstituteName;
this.PercentOrGPA = PercentOrGPA;
this.PassedYear = PassedYear;
this.Address = Address;
this.Board_id = Board_id;
this.Faculty_id = Faculty_id;
this.University_id = University_id;
this.Registration_id = Registration_id;
this.FilePath = FilePath;
this.FileName=FileName;
}
public Qualification(int Qualification_id,String LevelName, String InstituteName, String PercentOrGPA, Date PassedYear, String Address, String BoardName, String FacultyName, String UniversityName, String FirstName) {
this.Qualification_id=Qualification_id;
this.LevelName = LevelName;
this.InstituteName = InstituteName;
this.PercentOrGPA = PercentOrGPA;
this.PassedYear = PassedYear;
this.Address = Address;
this.BoardName = BoardName;
this.FacultyName = FacultyName;
this.UniversityName = UniversityName;
this.FirstName = FirstName;
}
/* Here is getter */
public int getQualification_id() {
return Qualification_id;
}
public int getLevel_id() {
return Level_id;
}
public String getInstituteName() {
return InstituteName;
}
public String getPercentOrGPA() {
return PercentOrGPA;
}
public Date getPassedYear() {
return PassedYear;
}
public String getAddress() {
return Address;
}
public int getBoard_id() {
return Board_id;
}
public int getFaculty_id() {
return Faculty_id;
}
public int getUniversity_id() {
return University_id;
}
public int getRegistration_id() {
return Registration_id;
}
public String getFileName() {
return FileName;
}
public String getFilePath() {
return FilePath;
}
public String getLevelName() {
return LevelName;
}
public String getBoardName() {
return BoardName;
}
public String getFacultyName() {
return FacultyName;
}
public String getUniversityName() {
return UniversityName;
}
public String getFirstName() {
return FirstName;
}
/* Here is setter */
public void setQualification_id(int Qualification_id) {
this.Qualification_id = Qualification_id;
}
public void setLevel_id(int Level_id) {
this.Level_id = Level_id;
}
public void setInstituteName(String InstituteName) {
this.InstituteName = InstituteName;
}
public void setPercentOrGPA(String PercentOrGPA) {
this.PercentOrGPA = PercentOrGPA;
}
public void setPassedYear(Date PassedYear) {
this.PassedYear = PassedYear;
}
public void setAddress(String Address) {
this.Address = Address;
}
public void setBoard_id(int Board_id) {
this.Board_id = Board_id;
}
public void setFaculty_id(int Faculty_id) {
this.Faculty_id = Faculty_id;
}
public void setUniversity_id(int University_id) {
this.University_id = University_id;
}
public void setRegistration_id(int Registration_id) {
this.Registration_id = Registration_id;
}
public void setFileName(String FileName) {
this.FileName = FileName;
}
public void setFilePath(String FilePath) {
this.FilePath = FilePath;
}
public void setLevelName(String LevelName) {
this.LevelName = LevelName;
}
public void setBoardName(String BoardName) {
this.BoardName = BoardName;
}
public void setFacultyName(String FacultyName) {
this.FacultyName = FacultyName;
}
public void setUniversityName(String UniversityName) {
this.UniversityName = UniversityName;
}
public void setFirstName(String FirstName) {
this.FirstName = FirstName;
}
}
| [
"rajvison@gmail.com"
] | rajvison@gmail.com |
098968510afa35ed8aba97125da6fb330b16a723 | 86fb2fdfef583dbbd30b4b386a75f9512e2e3168 | /src/core/java/au/net/netstorm/boost/nursery/eight/legged/spider/core/Web.java | f654f122498d85a1f908044c7afd9a7b4fbd4dde | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | kef/boost | a1aa4febb0dbc05c0a7983c73cb9ba7ed264cb3e | cf4fba51ac98e463b8fe994024f8f61240c0a360 | refs/heads/master | 2021-01-22T06:53:41.163500 | 2008-09-01T11:29:56 | 2008-09-01T11:29:56 | 48,002 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package au.net.netstorm.boost.nursery.eight.legged.spider.core;
import au.net.netstorm.boost.nursery.eight.legged.spider.factory.core.Factory;
public interface Web {
void configure(Class<? extends SpiderConfig> config);
void register(Class<? extends Factory> type);
}
| [
"mark.hibberd@05db6a09-9903-0410-bedf-ba9bc4063e48"
] | mark.hibberd@05db6a09-9903-0410-bedf-ba9bc4063e48 |
edf6aac8d116f08128aa850fbf53c3e2cf49a9ce | 32b58da851b74ee2850cb3111159c13517ea4517 | /src/Main.java | f298ec4decfb81a249c3ff7dc83b5fce45d45cb8 | [] | no_license | aayvazyan-tgm/VerySimpleRmiExample | ebbb55a415de66a5eb2628c95e5f366c0efbdc6c | 265abf0c245aa28e28d1945e4ecf62523d4e17f0 | refs/heads/master | 2021-01-22T10:01:45.328969 | 2015-01-14T21:31:59 | 2015-01-14T21:31:59 | 29,266,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | public class Main {
public static void main(String[] args) {
Server.main(new String[0]);
Client.main("localhost:7771");
}
}
| [
"ariay@live.at"
] | ariay@live.at |
b79bc56024a6e471fd0b392c56cf4cce9d793862 | adae893cad75340b7b2eb09e0f5890420742e53b | /app/src/main/java/technomind/in/RewardFragment.java | b8899df1b9ceda42f4b0b9d26c4057cd9b7d793d | [] | no_license | Androidgyan1/Clap | 5ece356a3f574e5ced61c0c9b849d1907af684c5 | e6fb0ae84678e3faec7b4ffcfa06a35dc9d274bb | refs/heads/main | 2023-03-15T20:00:53.699236 | 2021-03-05T11:37:28 | 2021-03-05T11:37:28 | 340,597,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,032 | java | package technomind.in;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link RewardFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class RewardFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public RewardFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment RewardFragment.
*/
// TODO: Rename and change types and number of parameters
public static RewardFragment newInstance(String param1, String param2) {
RewardFragment fragment = new RewardFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_reward, container, false);
}
} | [
"ndrdgyan@gmail.com"
] | ndrdgyan@gmail.com |
db0f50dd2f9ebc9fcd662d01d7db78a566eca543 | fb239a2b92954691b06c45abd4320076321f64fb | /src/disparity/characterCreation/GUIresources/DisplayImage.java | 2e52098d5722f11bc2690d4e0be7262095a08de7 | [
"MIT"
] | permissive | oldmud0/Disparity-RHE | 6b1c801c19bf02dc9a114575534deb3c9413f5c3 | 8143737395af061186e7a07947903d4431c681ff | refs/heads/master | 2021-01-19T07:01:50.879932 | 2014-03-18T22:13:06 | 2014-03-18T22:14:22 | 15,805,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package disparity.characterCreation.GUIresources;
import java.awt.Image;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
public class DisplayImage implements ComponentListener {
private JLabel title = new JLabel("");
private String src;
public DisplayImage(JLabel label, String src) {
label.setText("");
title = label;
this.src = src;
}
@Override
public void componentHidden(ComponentEvent e) {}
@Override
public void componentMoved(ComponentEvent e) {}
@Override
public void componentResized(ComponentEvent e) {setImage();}
@Override
public void componentShown(ComponentEvent e) {setImage();}
private void setImage() {
try {BufferedImage img = ImageIO.read(getClass().getResource(src));
title.setIcon(new ImageIcon(img.getScaledInstance(title.getWidth(),-1,Image.SCALE_FAST)));
title.setHorizontalAlignment(JLabel.CENTER);
} catch (IOException e) { e.printStackTrace(); }
}
}
| [
"oldmud0@private.email"
] | oldmud0@private.email |
7bf8a864002e431cd089e4acce27391275c3a2a5 | 9b176e3bbc48a986e69d1bf528a3513542a07360 | /src/main/java/com/mitrais/trainingadminservice/model/Attendance.java | 69952437ab113744714f11a0688947fd549fb03c | [] | no_license | yuliawanrizka/tas-spring | f2248f74d25556a8b987778b1b2bbc7d772974b7 | bfa93e024631d4640b3da9e6a6c53bbb187300db | refs/heads/master | 2021-07-11T09:45:06.229423 | 2017-10-06T09:43:41 | 2017-10-06T09:43:41 | 103,214,575 | 0 | 0 | null | 2017-10-06T01:00:38 | 2017-09-12T02:56:19 | Shell | UTF-8 | Java | false | false | 1,395 | java | /*
* @(#) Attendance.java, v 1.0 2017/10/03 14:05:31
*
* Copyright (c) 2017, PT. Mitrais, Bali, Indonesia.
* All rights reserved.
*
* Revision History
*
* 03-Oct-2017 Yuliawan Rizka Syafaat [1.0]-Initial Coding
*
*/
package com.mitrais.trainingadminservice.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Class Description
*
*/
@Entity
public class Attendance {
@Id
@GeneratedValue
private Long attendanceId;
private Long scheduleId;
private Long enrolledParticipantsId;
private int attendanceStatus;
public Long getAttendanceId() {
return attendanceId;
}
public void setAttendanceId(Long attendanceId) {
this.attendanceId = attendanceId;
}
public Long getScheduleId() {
return scheduleId;
}
public void setScheduleId(Long scheduleId) {
this.scheduleId = scheduleId;
}
public Long getEnrolledParticipantsId() {
return enrolledParticipantsId;
}
public void setEnrolledParticipantsId(Long enrolledParticipantsId) {
this.enrolledParticipantsId = enrolledParticipantsId;
}
public int getAttendanceStatus() {
return attendanceStatus;
}
public void setAttendanceStatus(int attendanceStatus) {
this.attendanceStatus = attendanceStatus;
}
}
| [
"yuliawanrizka.syafaat@mitrais.com"
] | yuliawanrizka.syafaat@mitrais.com |
37dd4ae89ea446109cbbdf04a2b9bbf043e7c7d8 | 4a38f2fc347fb964a29b271687d09841e60295ac | /app/src/main/java/com/example/shreyaprabhu/ppfcompanion/Data/DataContentProvider.java | b8ddc1c38e92fbd908ff158b00d18e11a617c610 | [] | no_license | ShreyaPrabhu/PPFCompanion | 9529eb50a90302febd00dca35f5e100141c93ee0 | ccd92e109095de3f0a2af3655a3abfceb30e6d1e | refs/heads/master | 2021-01-19T15:31:42.418407 | 2017-02-04T11:49:17 | 2017-02-04T11:49:17 | 79,825,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,857 | java | package com.example.shreyaprabhu.ppfcompanion.Data;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import static com.example.shreyaprabhu.ppfcompanion.Data.DataContract.PPFEntry.CONTENT_URI;
/**
* Created by Shreya Prabhu on 28-01-2017.
*/
public class DataContentProvider extends ContentProvider {
private static final UriMatcher sUriMatcher = buildUriMatcher();
private DataDbHelper mOpenHelper;
static final int PLANS = 1;
static final int PLAN_ID = 2;
public static UriMatcher buildUriMatcher() {
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
final String authority = DataContract.CONTENT_AUTHORITY;
matcher.addURI(authority,DataContract.PATH_PPFDATA,PLANS);
matcher.addURI(authority, DataContract.PATH_PPFDATA + "/#",PLAN_ID);
return matcher;
}
@Override
public boolean onCreate() {
mOpenHelper = new DataDbHelper(getContext());
return true;
}
@Nullable
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DataContract.PPFEntry.TABLE_NAME);
switch (sUriMatcher.match(uri)){
case PLANS :
break;
case PLAN_ID :
qb.appendWhere( DataContract.PPFEntry.COLUMN_PLAN_ID + "=" + uri.getLastPathSegment());
break;
default:
break;
}
sortOrder = DataContract.PPFEntry.COLUMN_PLAN_ID;
Cursor c = qb.query(mOpenHelper.getWritableDatabase(), projection, selection,
selectionArgs,null, null, sortOrder);
/**
* register to watch a content URI for changes
*/
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
}
@Nullable
@Override
public String getType(Uri uri) {
return null;
}
@Nullable
@Override
public Uri insert(Uri uri, ContentValues contentValues) {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
long rowID = db.insert(DataContract.PPFEntry.TABLE_NAME, null , contentValues);
if (rowID > 0) {
Uri _uri = ContentUris.withAppendedId(CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(_uri, null);
return _uri;
}
throw new SQLException("Failed to add a record into " + uri);
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
int numRowsDeleted;
switch (sUriMatcher.match(uri)){
case PLANS:
numRowsDeleted = mOpenHelper.getWritableDatabase().delete(DataContract.PPFEntry.TABLE_NAME, selection, selectionArgs);
break;
case PLAN_ID:
String id = uri.getLastPathSegment();
Log.v("myId", "id " + id);
numRowsDeleted = mOpenHelper.getWritableDatabase().delete(
DataContract.PPFEntry.TABLE_NAME,
DataContract.PPFEntry.COLUMN_PLAN_ID + " = " + id,selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return numRowsDeleted;
}
@Override
public int update(Uri uri, ContentValues contentValues, String selection, String[] selectionArgs) {
int count = 0;
switch (sUriMatcher.match(uri)) {
case PLANS:
count = mOpenHelper.getWritableDatabase().update(DataContract.PPFEntry.TABLE_NAME, contentValues, selection, selectionArgs);
break;
case PLAN_ID:
count = mOpenHelper.getWritableDatabase().update(
DataContract.PPFEntry.TABLE_NAME, contentValues,
DataContract.PPFEntry.COLUMN_PLAN_ID + " = " + uri.getLastPathSegment() +
(!TextUtils.isEmpty(selection) ?
" AND (" +selection + ')' : ""), selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri );
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}
}
| [
"shreyaprabhu96@gmail.com"
] | shreyaprabhu96@gmail.com |
fc2d85f684834814b3c915553168f2122f750b58 | 189fa28cbe141465ea43dfd7da55bf96a2a55d64 | /patterns/src/main/java/ee/mtiidla/headfirst/factory/abstractfactory/ChicagoPizzaStore.java | 708f99e1beb6b3c066213ca7a7c0d7c8e3b3bc8d | [] | no_license | mtiidla/learning | c93c1321bd7746b1ffca700f6caf12adabc1daf5 | 86a94f24f663b3123852f055da801c5f39c304ed | refs/heads/master | 2021-07-17T09:46:51.483645 | 2021-06-08T21:32:55 | 2021-06-08T21:32:55 | 123,972,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 499 | java | package ee.mtiidla.headfirst.factory.abstractfactory;
class ChicagoPizzaStore extends PizzaStore {
@Override
Pizza createPizza(String type) {
Pizza pizza = null;
PizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory();
if (type.equals("cheese")) {
pizza = new CheesePizza(ingredientFactory);
} else if (type.equals("clam")) {
pizza = new ClamPizza(ingredientFactory);
}
return pizza;
}
}
| [
"marko.tiidla@tattoodo.com"
] | marko.tiidla@tattoodo.com |
df023d07d59e0cda9727c2b0276c5a70308b0538 | c110ec548c2ec2da71df43cbdd093acf88f2f719 | /src/java/Registration1.java | afe8187407cf124fa8d18d057e5dd9aeba597cc4 | [] | no_license | harshmashru/preSchool | 9d7f74461e6f9414cf5b5797209065568b74f2fb | de4a92f42bdee3ce14366094eda3b85d6eda007e | refs/heads/master | 2022-08-20T16:11:32.672969 | 2020-05-28T20:35:52 | 2020-05-28T20:35:52 | 267,690,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,158 | java | import bean.admin;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class Registration1 extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
HttpSession s3 = request.getSession();
String id = s3.getAttribute("aid").toString();
int aid= Integer.valueOf(id);
String name = request.getParameter("name");
String eid = request.getParameter("eid");
String mno = request.getParameter("mno");
String pass = request.getParameter("pass");
String fees = request.getParameter("fees");
float fee = Float.parseFloat(fees);
String status = request.getParameter("status");
// out.println(id);
try {
if(!(mno.length()<10 || mno.length()>10)){
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet register</title>");
out.println("</head>");
out.println("<body>");
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/preschool", "root","");
PreparedStatement pst = con.prepareStatement("insert into student(AID,SNAME,P_EmailAdd,P_Mobileno,Password,Fees,Status)values(?,?,?,?,?,?,?);");
pst.setInt(1, aid);
pst.setString(2, name);
pst.setString(3, eid);
pst.setString(4, mno);
pst.setString(5, pass);
pst.setFloat(6, fee);
pst.setString(7, status);
int rs = pst.executeUpdate();
//RequestDispatcher rd = request.getRequestDispatcher("");
//out.println("done");
response.setContentType("text/html");
request.getRequestDispatcher("registration.html").include(request, response);
out.println("<script type=\"text/javascript\">");
out.println("alert('Registered!');");
out.println("</script>");
// RequestDispatcher rd = request.getRequestDispatcher("login.html");
// rd.forward(request, response);
out.println("</body>");
out.println("</html>");
}
else{
out.println("<font color='red'<br><center> Mobile number must be of 10 digits...!</center></font>");
RequestDispatcher rd=request.getRequestDispatcher("registration.html");
rd.include(request, response);
}
}
catch(Exception e){
out.println(e);
}
}
}
| [
"harsh.mashru103477@marwadiuniversity.ac.in"
] | harsh.mashru103477@marwadiuniversity.ac.in |
d631ff58facb9f85a6e9a6cf3846a654d28b57c7 | e910ef08dd4dd7927d50d0f1e37d2cd08d703aed | /StockAndroid/app/src/main/java/com/xt/lxl/stock/config/StockConfig.java | 6a813964382f083c5bb95a53ed35ff7aa2754a68 | [] | no_license | shanghaif/Stock_ZZFIN | f56a1c9ae6e7eed013471b9ae169f52feac0f760 | 727603d490eaf7ae86e9b8600e6d3e58605d58f4 | refs/heads/master | 2021-12-25T05:44:40.024439 | 2017-12-26T02:32:24 | 2017-12-26T02:32:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,269 | java | package com.xt.lxl.stock.config;
/**
* Created by xiangleiliu on 2017/8/7.
*/
public class StockConfig {
public static final String STOCK_SAVE_DB_NAME = "STOCK_SAVE_DB_NAME";
public static final String STOCK_SAVE_DATA_NAME = "STOCK_SAVE_DATA_NAME";//用户存储的股票代码集合
public static final String STOCK_SAVE_DATA_HISTORY = "STOCK_SAVE_DATA_HISTORY";//用户历史搜索的关键词集合
public static final String STOCK_USER_DB_NAME = "STOCK_USER_DB_NAME";
public static final String STOCK_USER_DATA_USERID = "STOCK_SAVE_USERID";
public static final String STOCK_USER_DATA_MOBLIE = "STOCK_USER_DATA_MOBLIE";
public static final String STOCK_USER_DATA_NICKNAME = "STOCK_USER_DATA_NICKNAME";
public static final String STOCK_USER_DATA_AREA = "STOCK_USER_DATA_AREA";
public static final String STOCK_USER_DATA_AGE = "STOCK_USER_DATA_AGE";
public static final String STOCK_USER_DATA_CREATETIME = "STOCK_USER_DATA_CREATETIME";
//url地址
public static boolean isTest = true;
//test
public static String URL_REGISTER_TEST = "";
//release
public static String URL_REGISTER = isTest ? URL_REGISTER_TEST : "";
public static int INTERVAL_TIME = 10000;
}
| [
"xiangleiliu@Ctrip.com"
] | xiangleiliu@Ctrip.com |
044ffacd58856a487464e33ad6b5cafcd37103e0 | 9fc8a86d39dc519dc58a38ddf6352c4f01b04487 | /plancreator/src/main/java/com/plangenerator/ism/Config/WebConfig.java | 997a0170324b484be1222c41c984fe8754a74462 | [] | no_license | irakli1990/inz | 74a5753f5ced9301b2adee3d06a75f3cf8faac66 | 669853e0f200cb0c71d0d9edd28daef3766c6f52 | refs/heads/master | 2022-12-24T10:28:07.422916 | 2019-09-16T12:46:39 | 2019-09-16T12:46:39 | 203,212,842 | 0 | 0 | null | 2022-12-16T05:00:44 | 2019-08-19T16:48:44 | CSS | UTF-8 | Java | false | false | 3,826 | java | package com.plangenerator.ism.Config;
import com.plangenerator.ism.Controller.XlsView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.servlet.config.annotation.*;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
@Configuration
@ComponentScan("com.plangenerator.ism.Config")
public class WebConfig implements WebMvcConfigurer {
@Bean
public static BCryptPasswordEncoder passwordEncoder() {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
return bCryptPasswordEncoder;
}
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**").allowedOrigins("*");
}
@Autowired
private ApplicationContext applicationContext;
/*
* STEP 1 - Create SpringResourceTemplateResolver
* */
@Bean
public SpringResourceTemplateResolver templateResolver() {
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(applicationContext);
templateResolver.setPrefix("/WEB-INF/views/");
templateResolver.setSuffix(".html");
return templateResolver;
}
/*
* STEP 2 - Create SpringTemplateEngine
* */
@Bean
public SpringTemplateEngine templateEngine() {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
templateEngine.setEnableSpringELCompiler(true);
return templateEngine;
}
/*
* STEP 3 - Register ThymeleafViewResolver
* */
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setTemplateEngine(templateEngine());
registry.viewResolver(resolver);
registry.enableContentNegotiation(new XlsView());
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
registry.addResourceHandler("/webjars/**").addResourceLocations("/webjars/");
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/user/welcome").setViewName("/user/welcome.html");
registry.addViewController("/minimum").setViewName("/admin/minimum.html");
registry.addViewController("/plan").setViewName("/user/plan.html");
registry.addViewController("/form").setViewName("/user/form.html");
registry.addViewController("/welcome").setViewName("/admin/welcome.html");
registry.addViewController("/departments").setViewName("/admin/departments.html");
registry.addViewController("/forgotPassword").setViewName("/forgot-password.html");
registry.addViewController("/").setViewName("/login.html");
registry.addViewController("/signup").setViewName("/signup.html");
}
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.APPLICATION_JSON).favorPathExtension(true);
}
}
| [
"iraklikardawa@gmail.com"
] | iraklikardawa@gmail.com |
1199cfb1ddc6151b34c5c6a2b052dfe378e523c9 | 389d31580f426b020add2d5fbeabb776d9195c5b | /src/com/xtb4/sortfromfiles/Args.java | 6ca9e99d4ce3fbfa5c87c3dd5bf5df003ad6c8b4 | [] | no_license | Xtb4/SortFromFiles | 9d3a3e360966ba5b0f6c2f8bd8af88e941090a73 | 8aff8c64152b05241afcbfdb31b4a2bd4669a38d | refs/heads/master | 2020-07-23T13:33:58.431352 | 2019-09-13T08:15:01 | 2019-09-13T08:15:01 | 207,574,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.xtb4.sortfromfiles;
public enum Args {
TYPE_STRING("-s"),
TYPE_INTEGER("-i"),
ORDER_ASC("-a"),
ORDER_DESC("-d");
public static final Args DEFAULT_ORDER = ORDER_ASC;
public final String token;
Args(String token) {
this.token = token;
}
} | [
"54112333+Xtb4@users.noreply.github.com"
] | 54112333+Xtb4@users.noreply.github.com |
40adbf735da3bb830d150ee8ac13aee0669d29f7 | dd785feb4b9eb17723878578a544264085151f4d | /springmvc-01/src/main/java/spitter/config/MyWebAppInitializer.java | d8c0ca46b7f33930deb095a46b16dab6659be163 | [] | no_license | howeycheng/SpringMvc | c76f79ed26f9cc288ce58871d639d723085f47e4 | f22fc720a4a0c31cdd99b82cc8e357e805791c64 | refs/heads/master | 2023-01-20T03:44:45.511615 | 2020-11-26T03:23:05 | 2020-11-26T03:23:05 | 315,541,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | package spitter.config;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class MyWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[] { RootConfig.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] { WebConfig.class };
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
}
| [
"howeycheng@163.com"
] | howeycheng@163.com |
18ebe48b12eb43fa7a8428581f4434af6ecd49c2 | 95fda162f85e0479207947a240f27ba4d0b12fd8 | /backend/store-sale/src/main/java/org/demoiselle/jee7/example/store/sale/dao/EntityManagerMasterDAO.java | f73d3636916a533187fedfb3d38f509dc2f97131 | [] | no_license | DEXTERNATAN/example-store | 06cce7343a5f4c99198da180f1362ea4976f04c1 | 07de78f17576a068600f650ca7215c6b7465fb14 | refs/heads/master | 2021-01-12T10:10:56.540249 | 2016-12-13T16:11:53 | 2016-12-13T16:12:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package org.demoiselle.jee7.example.store.sale.dao;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.demoiselle.jee.multitenancy.hibernate.dao.context.EntityManagerMaster;
public class EntityManagerMasterDAO implements EntityManagerMaster {
@PersistenceContext(unitName = "SaleMasterPU")
protected EntityManager emEntity;
public EntityManager getEntityManager() {
return emEntity;
}
}
| [
"cassiomaes@gmail.com"
] | cassiomaes@gmail.com |
d71ece979406930e56c96f6b99fa30dbe225af42 | 079294a3ab1253fa12c3491f1dcafa3cd0e470e0 | /projects/dbupgrader/cgs-dbupgrader/src/main/java/com/t2k/cgs/dbupgrader/task/RemoveSelectedStandardsFromTasks.java | c5b7a0051443b5687e0e1257f4320469bc9b7c33 | [] | no_license | AssafMashiah/create | af2562bd6bc66260487028cecca79a608dc86b48 | ad298c0abb67cbba28cb524912636028c0b492a3 | refs/heads/master | 2022-12-14T23:48:42.995188 | 2020-09-07T11:49:48 | 2020-09-07T11:49:48 | 272,163,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,826 | java | package com.t2k.cgs.dbupgrader.task;
import com.mongodb.BasicDBList;
import com.mongodb.DBObject;
import com.t2k.cgs.dbupgrader.dao.MigrationDao;
import com.t2k.common.dbupgrader.task.common.CommonTask;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: micha.shlain
* Date: 6/19/13
* Time: 7:43 PM
*/
public class RemoveSelectedStandardsFromTasks extends CommonTask {
private static final String SELECTED_STANDARDS = "selectedStandards";
private MigrationDao migrationDao;
@Override
protected void executeUpInternal() throws Exception {
List<DBObject> lessons = migrationDao.getLessonsDbObjects();
for (DBObject lesson : lessons) {
removeSelectedStandards(lesson);
migrationDao.saveLesson(lesson);
}
}
private void removeSelectedStandards(DBObject object) {
if (object.containsField(SELECTED_STANDARDS)) {
object.removeField(SELECTED_STANDARDS);
}
for (String key : object.keySet()) {
Object value = object.get(key);
if (value instanceof BasicDBList) {
BasicDBList list = (BasicDBList) value;
for (int i = 0; i < list.size(); i++) {
if(list.get(i) instanceof DBObject) {
removeSelectedStandards((DBObject) list.get(i));
}
}
} else if (value instanceof DBObject) {
removeSelectedStandards((DBObject) value);
}
}
}
@Override
protected void executeDownInternal() throws Exception {
}
///////////////////////
// Injection Setters //
///////////////////////
public void setMigrationDao(MigrationDao migrationDao) {
this.migrationDao = migrationDao;
}
}
| [
"ygal.bellaiche@timetoknow.co.il"
] | ygal.bellaiche@timetoknow.co.il |
39041b6f3daa4c151c87bf0c8f5a9ef2d1e913c9 | bd2139703c556050403c10857bde66f688cd9ee6 | /valhalla/38/webrev.00/test/hotspot/jtreg/runtime/valhalla/valuetypes/TestJNIArrays.java | f50f18a3682903da8bd97b3be78420185c4e7495 | [] | no_license | isabella232/cr-archive | d03427e6fbc708403dd5882d36371e1b660ec1ac | 8a3c9ddcfacb32d1a65d7ca084921478362ec2d1 | refs/heads/master | 2023-02-01T17:33:44.383410 | 2020-12-17T13:47:48 | 2020-12-17T13:47:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,062 | java | /*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import jdk.test.lib.Asserts;
import java.lang.reflect.*;
import java.util.Random;
import java.util.Arrays;
import java.util.Comparator;
import jdk.internal.misc.Unsafe;
import jdk.internal.vm.jni.SubElementSelector;
/*
* @test
* @summary Test flattened arrays accesses through JNI
* @modules java.base/jdk.internal.misc java.base/jdk.internal.vm.jni
* @library /testlibrary /test/lib
* @requires (os.simpleArch == "x64")
* @requires (os.family == "linux" | os.family == "mac")
* @compile -XDallowWithFieldOperator TestJNIArrays.java
* @run main/othervm/native/timeout=3000 -XX:ValueArrayElemMaxFlatSize=128 -XX:+PrintFlattenableLayouts -XX:+UseCompressedOops TestJNIArrays
* @run main/othervm/native/timeout=3000 -XX:ValueArrayElemMaxFlatSize=128 -XX:+PrintFlattenableLayouts -XX:-UseCompressedOops TestJNIArrays
*/
public class TestJNIArrays {
static final Unsafe U = Unsafe.getUnsafe();
public static final int ARRAY_SIZE = 1024;
static long seed;
static Random random;
static {
seed = System.nanoTime();
System.out.println("Seed = " + seed);
random = new Random(seed);
}
static {
System.loadLibrary("TestJNIArrays");
}
static inline class IntInt {
int i0;
int i1;
public IntInt(int i0, int i1) {
this.i0 = i0;
this.i1 = i1;
}
}
static class IntIntComparator implements Comparator<IntInt.ref> {
public int compare(IntInt.ref a, IntInt.ref b) {
if (a.i0 < b.i0) return -1;
if (a.i0 > b.i0) return 1;
if (a.i1 < b.i1) return -1;
if (a.i1 > b.i1) return 1;
return 0;
}
}
static inline class Containee {
float f;
short s;
Containee(float f, short s) {
this.f = f;
this.s = s;
}
}
static inline class Container {
double d;
Containee c;
byte b;
Container(double d, Containee c, byte b) {
this.d = d ;
this.c = c;
this.b = b;
}
Container setc(Containee c) {
Container res = __WithField(this.c, c);
return res;
}
}
static inline class LongLongLongLong {
long l0, l1, l2, l3;
public LongLongLongLong(long l0, long l1, long l2, long l3) {
this.l0 = l0;
this.l1 = l1;
this.l2 = l2;
this.l3 = l3;
}
}
static inline class BigValue {
long l0 = 0, l1 = 0, l2 = 0, l3 = 0, l4 = 0, l5 = 0, l6 = 0, l7 = 0, l8 = 0, l9 = 0;
long l10 = 0, l11 = 0, l12 = 0, l13 = 0, l14 = 0, l15 = 0, l16 = 0, l17 = 0, l18 = 0, l19 = 0;
long l20 = 0, l21 = 0, l22 = 0, l23 = 0, l24 = 0, l25 = 0, l26 = 0, l27 = 0, l28 = 0, l29 = 0;
long l30 = 0, l31 = 0, l32 = 0, l33 = 0, l34 = 0, l35 = 0, l36 = 0, l37 = 0, l38 = 0, l39 = 0;
}
static inline class ValueWithOops {
String s = "bonjour";
int i = 0;
Containee c = new Containee(2.3f, (short)4);
BigValue b = new BigValue();
}
public static void main(String[] args) {
TestJNIArrays test = new TestJNIArrays();
test.checkGetFlattenedArrayElementSize();
test.checkGetFlattenedArrayElementClass();
test.checkGetFieldOffsetInFlattenedLayout();
test.checkGetFlattenedArrayElements();
test.checkSubElementAPI();
test.checkBehaviors();
// TODO: move these to micro-benchmark or out of tier1 testing...
// test.measureInitializationTime(1024 * 1024 * 10 , 1000);
// test.measureInitializationTime2(1024 * 1024 * 10 , 1000);
// test.measureUpdateTime2(1024 * 1024 * 10, 1000);
// test.measureSortingTime(1024 * 1024, 100); // reduced number of iterations because Java sorting is slow (because of generics?)
//test.measureInitializationTime3(1024 * 1024 * 2 , 10);
}
void checkSubElementAPI() {
Throwable e = null;
ValueWithOops[] arrayWithOops = new ValueWithOops[100];
ValueWithOops v = new ValueWithOops();
for (int i = 0; i < 100; i++) {
arrayWithOops[i] = v;
}
SubElementSelector selector1 = createSubElementSelector(arrayWithOops);
SubElementSelector selector2 = getSubElementSelector(selector1, ValueWithOops.class, "s", "Ljava/lang/String;");
String s = (String) getObjectSubElement(arrayWithOops, selector2, 1);
System.out.println("s = " + s);
Asserts.assertEquals(s.equals("bonjour"), true, "Wrong string, expecting \"bonjour\", got " + s);
SubElementSelector selector3 = getSubElementSelector(selector1, ValueWithOops.class, "c", "QTestJNIArrays$Containee;");
Containee c = (Containee) getObjectSubElement(arrayWithOops, selector3, 2);
Asserts.assertEquals(c.f, 2.3f, "Wrong float value: " + c.f);
Asserts.assertEquals(c.s, (short)4, "Wrong short value " + c.s);
setObjectSubElement(arrayWithOops, selector2, 1, "Hello");
Asserts.assertEquals(arrayWithOops[1].s.equals("Hello"), true, "Wrong string, expecting \"Hello\", got " + s);
Integer myInteger = new Integer(345);
e = null;
try {
setObjectSubElement(arrayWithOops, selector2, 1, myInteger);
} catch(Throwable t) {
e = t;
}
Asserts.assertNotNull(e, "An exception should have been thrown");
Asserts.assertEquals(e.getClass(), java.lang.ArrayStoreException.class, "Wrong exception type");
c = new Containee(9.8f, (short)-3);
setObjectSubElement(arrayWithOops, selector3, 2, c);
Asserts.assertEquals(c.f, 9.8f, "Wrong float value: " + c.f);
Asserts.assertEquals(c.s, (short)-3, "Wrong short value " + c.s);
e = null;
try {
setObjectSubElement(arrayWithOops, selector3, 2, null);
} catch(Throwable t) {
e = t;
}
Asserts.assertNotNull(e, "An exception should have been thrown");
Asserts.assertEquals(e.getClass(), java.lang.ArrayStoreException.class, "Wrong exception type");
SubElementSelector selector4 = getSubElementSelector(selector3, TestJNIArrays.Containee.class, "s", "S");
short s2 = getShortSubElement(arrayWithOops, selector4, 3);
Asserts.assertEquals(s2, (short)4, "Wrong short value " + s2);
setShortSubElement(arrayWithOops, selector4, 3, (short)7);
Asserts.assertEquals(arrayWithOops[3].c.s, (short)7, "Wrong short value " + arrayWithOops[3].c.s);
e = null;
try {
// should fail because selector4 designates a field with type short, not int
getIntSubElement(arrayWithOops, selector4, 3);
} catch(Throwable t) {
e = t;
}
Asserts.assertNotNull(e, "An exception should have been thrown");
Asserts.assertEquals(e.getClass(), java.lang.IllegalArgumentException.class, "Wrong exception type");
SubElementSelector selector5 = getSubElementSelector(selector1, ValueWithOops.class, "b", "QTestJNIArrays$BigValue;");
e = null;
try {
// Should fail because selector5 designates a non-flattened field
SubElementSelector selector6 = getSubElementSelector(selector5, TestJNIArrays.BigValue.class, "l0", "J");
} catch(Throwable t) {
e = t;
}
Asserts.assertNotNull(e, "An exception should have been thrown");
Asserts.assertEquals(e.getClass(), java.lang.IllegalArgumentException.class, "Wrong exception type");
System.gc();
}
void checkGetFlattenedArrayElementSize() {
Throwable exception = null;
try {
Object o = new Object();
GetFlattenedArrayElementSizeWrapper(o);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
int[] array = new int[16];
Object o = array;
GetFlattenedArrayElementSizeWrapper(o);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
GetFlattenedArrayElementSizeWrapper(new String[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
// Array of BigValue should not be flattened because BigValue is *big*
GetFlattenedArrayElementSizeWrapper(new BigValue[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertTrue(exception instanceof IllegalArgumentException , "Exception should be a IAE");
exception = null;
int size = -1;
try {
size = GetFlattenedArrayElementSizeWrapper(new IntInt[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNull(exception, "No exception should have been thrown");
Asserts.assertEquals(size, 8, "Wrong size");
}
void checkGetFlattenedArrayElementClass() {
Throwable exception = null;
try {
Object o = new Object();
GetFlattenedArrayElementClassWrapper(o);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
int[] array = new int[16];
Object o = array;
GetFlattenedArrayElementClassWrapper(o);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
GetFlattenedArrayElementClassWrapper(new String[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
// Array of BigValue should not be flattened because BigValue is *big*
GetFlattenedArrayElementClassWrapper(new BigValue[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertTrue(exception instanceof IllegalArgumentException , "Exception should be a IAE");
exception = null;
Class c = null;
try {
c = GetFlattenedArrayElementClassWrapper(new IntInt[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNull(exception, "No exception should have been thrown");
Asserts.assertEquals(c, IntInt.class, "Wrong class");
}
void checkGetFieldOffsetInFlattenedLayout() {
Throwable exception = null;
try {
Object o = new Object();
GetFieldOffsetInFlattenedLayoutWrapper(o.getClass(), "foo", "I", true);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
int[] array = new int[16];
GetFieldOffsetInFlattenedLayoutWrapper(array.getClass(), "foo", "I", true);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
String[] array = new String[16];
GetFieldOffsetInFlattenedLayoutWrapper(array.getClass(), "foo", "I", true);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
Containee ce = new Containee(3.4f, (short)5);
Container c = new Container(123.876, ce, (byte)7);
Class<?> cclass = c.getClass();
Container[] containerArray = new Container[32];
int elementSize = GetFlattenedArrayElementSizeWrapper(containerArray);
int offset = -1;
try {
offset = GetFieldOffsetInFlattenedLayoutWrapper(cclass, "d", "D", false);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNull(exception, "No exception should have been thrown");
Field f = null;
try {
f = cclass.getDeclaredField("d");
} catch(NoSuchFieldException e) {
e.printStackTrace();
return;
}
Asserts.assertEquals(U.valueHeaderSize(cclass) + offset, U.objectFieldOffset(cclass, f.getName()),
"Incorrect offset");
Asserts.assertLessThan(offset, elementSize, "Invalid offset");
exception = null;
try {
// Field c should be flattened, so last argument is true, no exception expected
GetFieldOffsetInFlattenedLayoutWrapper(cclass, "c", "QTestJNIArrays$Containee;", true);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNull(exception, "No exception should have been thrown");
Asserts.assertLessThan(offset, elementSize, "Invalid offset");
exception = null;
try {
// Field c should be flattened, with last argument being false, exception expected from the wrapper
GetFieldOffsetInFlattenedLayoutWrapper(cclass, "c", "QTestJNIArrays$Containee;", false);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "Wrapper should have thrown a RuntimeException");
Asserts.assertEquals(exception.getClass(), RuntimeException.class , "Wrong exception type");
}
void checkGetFlattenedArrayElements() {
Throwable exception = null;
Object o = new Object();
try {
GetFlattenedArrayElementsWrapper(o);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
int[] a1 = new int[16];
o = a1;
try {
GetFlattenedArrayElementsWrapper(o);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
GetFlattenedArrayElementsWrapper(new String[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertEquals(exception.getClass(), IllegalArgumentException.class , "Wrong exception type");
exception = null;
try {
// Array of BigValue should not be flattened because BigValue is *big*
GetFlattenedArrayElementsWrapper(new BigValue[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertTrue(exception instanceof IllegalArgumentException , "Exception should be a IAE");
exception = null;
try {
// Direct native access to flattened arrays is not allowed if elements contain oops
GetFlattenedArrayElementsWrapper(new ValueWithOops[16]);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNotNull(exception, "An IAE should have been thrown");
Asserts.assertTrue(exception instanceof IllegalArgumentException , "Exception should be a IAE");
exception = null;
long addr = 0;
IntInt[] a2 = new IntInt[16];
try {
addr = GetFlattenedArrayElementsWrapper(a2);
} catch(Throwable t) {
exception = t;
}
Asserts.assertNull(exception, "No exception should have been thrown");
if (exception == null) {
ReleaseFlattenedArrayElementsWrapper(a2, addr, 0);
}
}
void checkBehaviors() {
System.out.println("Check 1");
IntInt[] array = new IntInt[ARRAY_SIZE];
int value = getIntFieldAtIndex(array, 1, "i0", "I");
Asserts.assertEquals(value, 0, "Initial value must be zero");
printArrayInformation(array);
int i0_value = 42;
int i1_value = -314;
initializeIntIntArrayBuffer(array, i0_value, i1_value);
System.gc();
for (int i = 0; i < array.length; i++) {
Asserts.assertEquals(array[i].i0, i0_value, "Bad value of i0 at index " + i);
Asserts.assertEquals(array[i].i1, i1_value, "Bad value of i1 at index " + i);
}
System.out.println("Check 2");
array = new IntInt[ARRAY_SIZE];
i0_value = -194;
i1_value = 91;
initializeIntIntArrayFields(array, i0_value, i1_value);
System.gc();
for (int i = 0; i < array.length; i++) {
Asserts.assertEquals(array[i].i0, i0_value, "Bad value of i0 at index " + i);
Asserts.assertEquals(array[i].i1, i1_value, "Bad value of i1 at index " + i);
}
System.out.println("Check 3");
array = new IntInt[ARRAY_SIZE];
initializeIntIntArrayJava(array, i0_value, i1_value);
System.gc();
for (int i = 0; i < array.length; i++) {
Asserts.assertEquals(array[i].i0, i0_value, "Bad value of i0 at index " + i);
Asserts.assertEquals(array[i].i1, i1_value, "Bad value of i1 at index " + i);
}
System.out.println("Check 4");
random = new Random(seed);
array = new IntInt[ARRAY_SIZE];
for (int i = 0; i < ARRAY_SIZE; i++) {
array[i] = new IntInt(random.nextInt(), random.nextInt());
}
sortIntIntArray(array);
System.gc();
for (int i = 0; i < array.length - 1; i++) {
Asserts.assertLessThanOrEqual(array[i].i0, array[i+1].i0, "Incorrect i0 fields ordering at index " + i);
if (array[i].i0 == array[i+1].i0) {
Asserts.assertLessThanOrEqual(array[i].i1, array[i+1].i1, "Incorrect i1 fields ordering at index " + i);
}
}
System.out.println("Check 5");
random = new Random(seed);
array = new IntInt[ARRAY_SIZE];
for (int i = 0; i < ARRAY_SIZE; i++) {
array[i] = new IntInt(random.nextInt(), random.nextInt());
}
Arrays.sort(array, new IntIntComparator());
System.gc();
for (int i = 0; i < array.length - 1; i++) {
Asserts.assertLessThanOrEqual(array[i].i0, array[i+1].i0, "Incorrect i0 fields ordering at index " + i);
if (array[i].i0 == array[i+1].i0) {
Asserts.assertLessThanOrEqual(array[i].i1, array[i+1].i1, "Incorrect i1 fields ordering at index " + i);
}
}
System.out.println("Check 6");
Container[] array2 = new Container[ARRAY_SIZE];
double d = 1.23456789;
float f = -987.654321f;
short s = -512;
byte b = 127;
Containee c = new Containee(f,s);
Container c2 = new Container(d, c, b);
initializeContainerArray(array2, d, f, s, b);
System.gc();
for (int i = 0; i < array2.length; i++) {
Asserts.assertEquals(array2[i], c2, "Incorrect value at index " + i);
Asserts.assertEquals(array2[i].d, d, "Incorrect d value at index " + i);
Asserts.assertEquals(array2[i].c.f, f, "Incorrect f value at index " + i);
Asserts.assertEquals(array2[i].c.s, s, "Incorrect s value at index " + i);
Asserts.assertEquals(array2[i].b, b, "Incorrect b value at inde " +i);
}
System.out.println("Check 7");
f = 19.2837465f;
s = 231;
updateContainerArray(array2, f, s);
System.gc();
for (int i = 0; i < array2.length; i++) {
Asserts.assertEquals(array2[i].d, d, "Incorrect d value at index " + i);
Asserts.assertEquals(array2[i].c.f, f, "Incorrect f value at index " + i);
Asserts.assertEquals(array2[i].c.s, s, "Incorrect s value at index " + i);
Asserts.assertEquals(array2[i].b, b, "Incorrect b value at inde " +i);
}
System.out.println("Check 8");
long l0 = 52467923;
long l1= -7854022;
long l2 = 230947485;
long l3 = -752497024;
LongLongLongLong[] array3 = new LongLongLongLong[ARRAY_SIZE/8];
initializeLongLongLongLongArray(array3, l0, l1, l2, l3);
System.gc();
for (int i = 0; i < array3.length; i++) {
Asserts.assertEquals(array3[i].l0, l0, "Bad value of l0 at index " + i);
Asserts.assertEquals(array3[i].l1, l1, "Bad value of l1 at index " + i);
Asserts.assertEquals(array3[i].l2, l2, "Bad value of l2 at index " + i);
Asserts.assertEquals(array3[i].l3, l3, "Bad value of l3 at index " + i);
}
}
void initializeIntIntArrayJava(IntInt[] array, int i0, int i1) {
IntInt ii = new IntInt(i0, i1);
for (int i = 0; i < array.length; i++) {
array[i] = ii;
}
}
void initializeContainerArrayJava(Container[] array, double d, float f, short s, byte b) {
Containee c = new Containee(f,s);
Container c2 = new Container(d, c, b);
for (int i = 0; i < array.length; i++) {
array[i] = c2;
}
}
void updateContainerArrayJava(Container[] array, float f, short s) {
Containee c = new Containee(f, s);
for (int i = 0; i < array.length; i++) {
array[i] = array[i].setc(c);;
}
}
void initializeLongLongLongLongArrayJava(LongLongLongLong[] array, long l0, long l1, long l2, long l3) {
LongLongLongLong llll = new LongLongLongLong(l0, l1, l2, l3);
for (int i = 0; i < array.length; i++) {
array[i] = llll;
}
}
void measureInitializationTime(int array_size, int iterations) {
System.out.println("\nInitialization time for IntInt[]:");
long[] start = new long[iterations];
long[] end = new long[iterations];
System.out.println("\nJava:");
// Warmup
for (int i = 0; i < 10; i++) {
IntInt[] array = new IntInt[array_size];
initializeIntIntArrayJava(array, 42, -314);
}
// Measure
for (int i = 0; i < iterations; i++) {
IntInt[] array = new IntInt[array_size];
start[i] = System.nanoTime();
initializeIntIntArrayJava(array, 42, -314);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
System.out.println("\nNative(memcpy):");
// Warmup
for (int i = 0; i < 10; i++) {
IntInt[] array = new IntInt[array_size];
initializeIntIntArrayBuffer(array, 42, -314);
}
// Measure
for (int i = 0; i < iterations; i++) {
IntInt[] array = new IntInt[array_size];
start[i] = System.nanoTime();
initializeIntIntArrayBuffer(array, 42, -314);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
System.out.println("\nNative(fields):");
// Warmup
for (int i = 0; i < 10; i++) {
IntInt[] array = new IntInt[array_size];
initializeIntIntArrayFields(array, 42, -314);
}
// Measure
for (int i = 0; i < iterations; i++) {
IntInt[] array = new IntInt[array_size];
start[i] = System.nanoTime();
initializeIntIntArrayFields(array, 42, -314);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
}
void measureInitializationTime2(int array_size, int iterations) {
System.out.println("\nInitialization time for Container[]:");
long[] start = new long[iterations];
long[] end = new long[iterations];
double d = 0.369852147;
float f = -321.654987f;
short s = -3579;
byte b = 42;
System.out.println("\nJava:");
// Warmup
for (int i = 0; i < 10; i++) {
Container[] array = new Container[array_size];
initializeContainerArrayJava(array, d, f, s, b);
}
// Measure
for (int i = 0; i < iterations; i++) {
Container[] array = new Container[array_size];
start[i] = System.nanoTime();
initializeContainerArrayJava(array, d, f, s, b);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
System.out.println("\nNative:");
// Warmup
for (int i = 0; i < 10; i++) {
Container[] array = new Container[array_size];
initializeContainerArray(array, d, f, s, b);
}
// Measure
for (int i = 0; i < iterations; i++) {
Container[] array = new Container[array_size];
start[i] = System.nanoTime();
initializeContainerArray(array, d, f, s, b);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
}
void measureUpdateTime2(int array_size, int iterations) {
System.out.println("\nUpdating Container[]:");
long[] start = new long[iterations];
long[] end = new long[iterations];
double d = 0.369852147;
float f = -321.654987f;
short s = -3579;
byte b = 42;
Containee c = new Containee(f,s);
Container c2 = new Container(d, c, b);
System.out.println("\nJava:");
// Warmup
for (int i = 0; i < 10; i++) {
Container[] array = new Container[array_size];
for (int j = 0; j < array.length; j++) {
array[j] = c2;
}
updateContainerArrayJava(array, f, s);
}
// Measure
for (int i = 0; i < iterations; i++) {
Container[] array = new Container[array_size];
for (int j = 0; j < array.length; j++) {
array[i] = c2;
}
start[i] = System.nanoTime();
updateContainerArrayJava(array, f, s);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
System.out.println("\nNative:");
// Warmup
for (int i = 0; i < 10; i++) {
Container[] array = new Container[array_size];
for (int j = 0; j < array.length; j++) {
array[i] = c2;
}
updateContainerArray(array, f, s);
}
// Measure
for (int i = 0; i < iterations; i++) {
Container[] array = new Container[array_size];
for (int j = 0; j < array.length; j++) {
array[i] = c2;
}
start[i] = System.nanoTime();
updateContainerArray(array, f, s);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
}
void measureSortingTime(int array_size, int iterations) {
System.out.println("\nSorting time:");
long[] start = new long[iterations];
long[] end = new long[iterations];
random = new Random(seed);
System.out.println("\nJava:");
IntIntComparator comparator = new IntIntComparator();
// Warmup
for (int i = 0; i < 10; i++) {
IntInt[] array = new IntInt[array_size];
array = new IntInt[array_size];
for (int j = 0; j < array_size; j++) {
array[j] = new IntInt(random.nextInt(), random.nextInt());
}
Arrays.sort(array, comparator);
}
// Measure
for (int i = 0; i < iterations; i++) {
IntInt[] array = new IntInt[array_size];
for (int j = 0; j < array_size; j++) {
array[j] = new IntInt(random.nextInt(), random.nextInt());
}
start[i] = System.nanoTime();
Arrays.sort(array, comparator);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
random = new Random(seed);
System.out.println("\nNative:");
// Warmup
for (int i = 0; i < 10; i++) {
IntInt[] array = new IntInt[array_size];
array = new IntInt[array_size];
for (int j = 0; j < array_size; j++) {
array[j] = new IntInt(random.nextInt(), random.nextInt());
}
sortIntIntArray(array);
}
// Measure
for (int i = 0; i < iterations; i++) {
IntInt[] array = new IntInt[array_size];
for (int j = 0; j < array_size; j++) {
array[j] = new IntInt(random.nextInt(), random.nextInt());
}
start[i] = System.nanoTime();
sortIntIntArray(array);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
}
void measureInitializationTime3(int array_size, int iterations) {
System.out.println("\nInitialization time for LongLongLongLong[]:");
long[] start = new long[iterations];
long[] end = new long[iterations];
long l0 = 123456;
long l1 = -987654;
long l2 = 192837;
long l3 = -56473829;
System.out.println("\nJava:");
// Warmup
for (int i = 0; i < 10; i++) {
LongLongLongLong[] array = new LongLongLongLong[array_size];
initializeLongLongLongLongArrayJava(array, l0, l1, l2, l3);
}
// Measure
for (int i = 0; i < iterations; i++) {
LongLongLongLong[] array = new LongLongLongLong[array_size];
start[i] = System.nanoTime();
initializeLongLongLongLongArrayJava(array, l0, l1, l2, l3);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
System.out.println("\nNative:");
// Warmup
for (int i = 0; i < 10; i++) {
LongLongLongLong[] array = new LongLongLongLong[array_size];
initializeLongLongLongLongArray(array, l0, l1, l2, l3);
}
// Measure
for (int i = 0; i < iterations; i++) {
LongLongLongLong[] array = new LongLongLongLong[array_size];
start[i] = System.nanoTime();
initializeLongLongLongLongArray(array, l0, l1, l2, l3);
end[i] = System.nanoTime();
}
// Results
computeStatistics(start, end);
}
void computeStatistics(long[] start, long[] end) {
int iterations = start.length;
long[] duration = new long[iterations];
long sum = 0;
long min = end[0] - start[0];
long max = min;
double var = 0.0;
for (int i = 0 ; i < iterations; i++) {
duration[i] = end[i] - start[i];
if (duration[i] < min) min = duration[i];
if (duration[i] > max) max = duration[i];
sum += duration[i];
double d = (double) duration[i];
var += Math.pow(d, 2);
}
double avg = (sum/iterations) / 1000;
double std = (Math.sqrt(var/iterations - Math.pow(sum/iterations, 2))) / 1000;
System.out.println(String.format("Avg: %8.2f us", avg));
System.out.println(String.format("Std: %8.2f us", std));
System.out.println(String.format("Min: %8d us", (min/1000)));
System.out.println(String.format("Max: %8d us", (max/1000)));
}
native int GetFlattenedArrayElementSizeWrapper(Object array);
native Class GetFlattenedArrayElementClassWrapper(Object array);
native long GetFlattenedArrayElementsWrapper(Object array);
native void ReleaseFlattenedArrayElementsWrapper(Object array, long addr,int mode);
native int GetFieldOffsetInFlattenedLayoutWrapper(Class klass, String name, String signature, boolean flattened);
native int getIntFieldAtIndex(Object[] array, int index, String fieldName, String FieldSignature);
native void printArrayInformation(Object[] array);
native void initializeIntIntArrayBuffer(Object[] array, int i0, int i1);
native void initializeIntIntArrayFields(Object[] array, int i0, int i1);
native void sortIntIntArray(Object[] array);
native void initializeContainerArray(Object[] array, double d, float f, short s, byte b);
native void updateContainerArray(Object[] array, float f, short s);
native void initializeLongLongLongLongArray(Object[] array, long l0, long l1, long l2, long l3);
native SubElementSelector createSubElementSelector(Object[] array);
native SubElementSelector getSubElementSelector(SubElementSelector selector, Class<?> klass, String name, String signature);
native Object getObjectSubElement(Object[] array, SubElementSelector selector, int index);
native void setObjectSubElement(Object[] array, SubElementSelector selector, int index, Object value);
native short getShortSubElement(Object[] array, SubElementSelector selector, int index);
native void setShortSubElement(Object[] array, SubElementSelector selector, int index, short value);
native int getIntSubElement(Object[] array, SubElementSelector selector, int index);
native void setIntSubElement(Object[] array, SubElementSelector selector, int index, int value);
}
| [
"robin.westberg@oracle.com"
] | robin.westberg@oracle.com |
197234db5e63eddc3105f874ac0654b281178c18 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-418-3-26-SPEA2-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/internal/wiki/XWikiWikiModel_ESTest_scaffolding.java | 9e8aa47190045da6edc083729a2d8ab25e1f6a45 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 452 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Apr 06 11:28:50 UTC 2020
*/
package org.xwiki.rendering.internal.wiki;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class XWikiWikiModel_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
18d5eadaba6121cbc0eccd17ea045add4e69cc62 | fb0e611626841fda3e2470d9a2fe1c87958b7873 | /src/main/java/project/repository/RoleRepository.java | 002de395eb6961ca6d11bc7feec2b219503e0b51 | [] | no_license | dayan07/AirportARM | 17c78aaf0e0661961a4ad5fab7218786a735d062 | d1010d42979d2ddda7b601479adb3dff6ac31272 | refs/heads/master | 2020-03-27T22:31:50.888209 | 2018-09-03T18:23:54 | 2018-09-03T18:23:54 | 147,239,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package project.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import project.entity.Role;
@Repository
public interface RoleRepository extends JpaRepository<Role, Long>{
}
| [
"diana-lobach@yandex.ru"
] | diana-lobach@yandex.ru |
62e380ad2fc604ed5e2140a7193a0e82015e8d94 | 531cfe81fd1ad8bf878a3ec11ca372c0863dbfd0 | /IndoorPositioning/DragRelativeLayout/src/com/commonliabray/model/PushMessage.java | a9f8853a9f1a472eb8c54e833b5939802cba8c18 | [] | no_license | kkingo/AndroidApp | 68a54cadc8454941d9e369c43d04ea2669986732 | 1fd5d1bb82dd9b04179c8addfe2b9d374461145c | refs/heads/master | 2023-03-04T10:38:58.340804 | 2023-02-21T13:45:40 | 2023-02-21T13:45:40 | 98,880,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package com.commonliabray.model;
import java.io.Serializable;
/**
* @author vision
* @function 极光推送消息实体,包含所有的数据字段。
*/
public class PushMessage implements Serializable {
// 消息类型
public String messageType = null;
// 连接
public String messageUrl = null;
// 详情内容
public String messageContent = null;
}
| [
"king491071735"
] | king491071735 |
9d3d4e14ca37763cd09ac5878e8a5f0aed5d6a09 | 611d8b7fceca17efbc4aa9e4d47a549aeb2bfcef | /CalendarGrid/src/kpk/dev/CalendarGrid/widget/adapters/MonthPagerAdapter.java | dee02f51a2e98c96502618ff6cc3de944486180c | [] | no_license | krasi-karamazov/calendargrid-new | ceddb7e9b60ac923fecb9f3fdafa0f3ed2e53df3 | 8b1a8dc5bd49756ef3852467ab71f2a81510721e | refs/heads/master | 2021-01-15T10:47:42.857393 | 2013-09-11T11:28:21 | 2013-09-11T11:28:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,478 | java | package kpk.dev.CalendarGrid.widget.adapters;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import kpk.dev.CalendarGrid.widget.fragments.MonthGridFragment;
import kpk.dev.CalendarGrid.widget.util.Constants;
import java.util.ArrayList;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: krasimir.karamazov
* Date: 8/29/13
* Time: 12:13 PM
* To change this template use File | Settings | File Templates.
*/
public class MonthPagerAdapter extends FragmentPagerAdapter {
private List<MonthGridFragment> mFragments;
public MonthPagerAdapter(FragmentManager fm) {
super(fm);
}
public List<MonthGridFragment> getFragments() {
if(mFragments == null) {
mFragments = new ArrayList<MonthGridFragment>();
for(int i = 0; i < Constants.MAX_NUM_PAGES; i++) {
mFragments.add(new MonthGridFragment());
}
}
return mFragments;
}
public void setFragments(List<MonthGridFragment> fragments) {
mFragments = fragments;
}
@Override
public Fragment getItem(int i) {
return mFragments.get(i); //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public int getCount() {
return Constants.MAX_NUM_PAGES; //To change body of implemented methods use File | Settings | File Templates.
}
}
| [
"krasi.karamazov@gmail.com"
] | krasi.karamazov@gmail.com |
384713cd6a1faa43ee16e139e31230da4e29dfaf | 3169ce1f85ca2e0f751174135af5d8992e5533ae | /testlab/src/main/java/org/mytestlab/repository/StudentRepository.java | 9d0ea419375fbc38e1ca9b3bd9c4fde948d8bdf9 | [] | no_license | jaismeen/MOOCTestLab | 3c81e8b44d6db8ea2a0fae5e30404d277c91e4d8 | 447da3f4c60558c4aa85218b8467b8aa1cd223e2 | refs/heads/master | 2021-01-23T11:41:04.288534 | 2013-12-07T18:26:40 | 2013-12-07T18:26:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package org.mytestlab.repository;
import org.mytestlab.domain.Student;
import org.springframework.data.neo4j.repository.GraphRepository;
public interface StudentRepository extends GraphRepository<Student> {
Student findByUsername(String username);
}
| [
"vincent_tsui2004@yahoo.com"
] | vincent_tsui2004@yahoo.com |
6fe9d7f59a5587b8915a5afa285be3ccc50ed6f8 | 6e30eaf408aa958002a08eab50ce388aae0cad87 | /app/src/main/java/com/example/lenovo/iphonesave/bean/Bean.java | c14b52f2bb2040bd32de1ba4140f44945748188c | [] | no_license | 366628941/MyRepository | 14d66c5dc390e70266397da6e0288e177efd6f3b | e7340ea1e97f2366bca791d01efa736e80c2776b | refs/heads/master | 2021-01-01T05:54:24.469040 | 2017-07-15T08:47:26 | 2017-07-15T08:47:26 | 97,301,179 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | package com.example.lenovo.iphonesave.bean;
/**
* Created by Lenovo on 2017/6/30.
*/
public class Bean {
/**
* downloadurl : http://192.168.14.130:8080/xxx.apk
* version : 2
* desc : 这个是小码哥卫士的最新版本,赶紧来下载
*/
public String downloadurl;
public String version;
public String desc;
@Override
public String toString() {
return "Bean{" +
"downloadurl='" + downloadurl + '\'' +
", version='" + version + '\'' +
", desc='" + desc + '\'' +
'}';
}
}
| [
"366628941@qq.com"
] | 366628941@qq.com |
a4a2fed146598c84ccdede72382b9433d6918f34 | 93c87167a468ade574c9e5885f68eebe8010331c | /orion-agent/src/main/java/com/pinterest/orion/agent/OrionAgent.java | 02ae4fd45a979f42d62052e9f19c9f01b3c0d9f4 | [
"Apache-2.0"
] | permissive | isabella232/orion | 7b4345e071c4917fd7edde49cbad5ee8808414d8 | 3e277fe94cdef9be3deeab1699e08e92645ef97c | refs/heads/master | 2023-03-09T13:42:15.553644 | 2020-11-18T22:42:48 | 2020-11-18T22:42:48 | 324,139,902 | 0 | 0 | Apache-2.0 | 2021-02-23T23:36:48 | 2020-12-24T11:24:58 | null | UTF-8 | Java | false | false | 2,496 | java | /*******************************************************************************
* Copyright 2020 Pinterest, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.pinterest.orion.agent;
import java.io.FileInputStream;
import java.util.logging.Logger;
import com.pinterest.orion.agent.kafka.KafkaMirrorAgent;
import com.pinterest.orion.agent.metrics.TSDBMetricsCollectorService;
import io.dropwizard.metrics5.MetricRegistry;
import io.dropwizard.metrics5.SharedMetricRegistries;
import org.yaml.snakeyaml.Yaml;
import com.pinterest.orion.agent.kafka.KafkaAgent;
/**
*
*/
public class OrionAgent {
public static MetricRegistry HEARTBEAT_METRICS = SharedMetricRegistries.getOrCreate("heartbeat");
public static MetricRegistry TSDB_METRICS = SharedMetricRegistries.setDefault("tsdb");
private static final Logger logger = Logger.getLogger(OrionAgent.class.getCanonicalName());
public static void main(String[] args) throws Exception {
// fix Java in-memory DNS caching
java.security.Security.setProperty("networkaddress.cache.ttl" , "300");
OrionAgentConfig config = new Yaml().loadAs(new FileInputStream(args[0]), OrionAgentConfig.class);
BaseAgent agent;
if (config.getAgentConfigs().containsKey(KafkaMirrorAgent.KAFKAMIRROR_CONFIG_DIRECTORY)) {
agent = new KafkaMirrorAgent(config);
} else {
agent = new KafkaAgent(config);
}
logger.info("Starting Orion agent");
Runtime.getRuntime().addShutdownHook(new Thread(()->{
logger.info("Orion agent is being shutdown");
}));
agent.initialize();
if (config.isEnableHeartbeat()) {
HeartbeatService heartbeatService = new HeartbeatService(agent);
heartbeatService.start();
}
if (config.getStatsConfigs().isEnabled()) {
TSDBMetricsCollectorService metricsService = new TSDBMetricsCollectorService(agent);
metricsService.start();
}
}
} | [
"plin@pinterest.com"
] | plin@pinterest.com |
0b03c304373b729e9a5e96199b59795cb4147a6f | ac5f60c9ee46627ad41d312856e854452ab7e85b | /MyThread/src/Chapter2/SynNotExtends/MyThreadA.java | 95f7e0c806293e66041ab03685ad3e5a1360360a | [] | no_license | hesiyi/MyThread | 51df255524548fe4345b0c4ae742e7109d4692cc | 1e29e1a40ef0fc627a00b6bba84c6a61ec58806f | refs/heads/master | 2020-06-11T03:50:51.267885 | 2017-03-16T12:26:39 | 2017-03-16T12:26:39 | 75,989,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package Chapter2.SynNotExtends;
/**
* Created by 49005 on 2016/12/14.
*/
public class MyThreadA extends Thread {
private Sub sub;
public MyThreadA(Sub sub){
super();
this.sub=sub;
}
@Override
public void run() {
sub.servieMethod();
}
}
| [
"490052981@qq.com"
] | 490052981@qq.com |
bb2afadaaae64b366b63cf5238d8e6b672eef83c | 7ab7d1c9b30a0d22bc1ba3aeae588ffc42ea17c5 | /src/main/java/com/algaworks/brewer/repository/Testes.java | 92d07dcb10321a25b3e30b539345725a0f602fd5 | [] | no_license | RobertoAtanasio/Spring-Framework-Expert | d8b017f14d4cabc40199898af0f4b19c4b0a2330 | 554092aff6747efdee723251682e3372e923d70e | refs/heads/master | 2022-12-07T15:09:30.452768 | 2019-10-08T19:31:13 | 2019-10-08T19:31:13 | 190,302,247 | 2 | 0 | null | 2022-11-16T12:26:14 | 2019-06-05T01:04:20 | JavaScript | UTF-8 | Java | false | false | 211 | java | package com.algaworks.brewer.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.algaworks.brewer.model.Teste;
public interface Testes extends JpaRepository<Teste, Long> {
}
| [
"roberto.atanasio.pl@gmail.com"
] | roberto.atanasio.pl@gmail.com |
e60f02566a1680c8df4cf9145194eb24fea7c992 | c1ac0c0a066f8958510eeb8bff2510ed60b49546 | /src/main/java/uteplitel36/domain/Item.java | 583e6b790364a29d72b3a096bc78fb2e56266dd0 | [] | no_license | aloeseva/uteplitel36 | 78ddf4394be749976b01d9eff893a3d5a3ea218e | 3f2bc620deb046b7c4d8f67a09839524d3230bed | refs/heads/master | 2023-08-14T14:31:22.948983 | 2021-09-17T12:55:32 | 2021-09-17T12:55:32 | 407,300,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,946 | java | package uteplitel36.domain;
import javax.persistence.*;
@Entity
public class Item {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String code;
private String name;
private String brand;
private String category;
@Column(name = "sub_category")
private String subCategory;
private Float price;
private String image;
private String description;
private String model;
private String measure;
private Float square;
private Float capacity;
private String application;
private String keyWord;
private Boolean inStock;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getKeyWord() {
return keyWord;
}
public void setKeyWord(String keyWord) {
this.keyWord = keyWord;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getSubCategory() {
return subCategory;
}
public void setSubCategory(String subCategory) {
this.subCategory = subCategory;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public Float getPrice() {
return price;
}
public void setPrice(Float cost) {
this.price = cost;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getMeasure() {
return measure;
}
public void setMeasure(String measure) {
this.measure = measure;
}
public Float getSquare() {
return square;
}
public void setSquare(Float square) {
this.square = square;
}
public Float getCapacity() {
return capacity;
}
public void setCapacity(Float capacity) {
this.capacity = capacity;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public Boolean getInStock() {
return inStock;
}
public void setInStock(Boolean inStock) {
this.inStock = inStock;
}
}
| [
"45678913579@mail.ru"
] | 45678913579@mail.ru |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.