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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e38fe77c5b8bbeac6638e8c8b8a7893036a16d25 | f72490d3ed1b4afed9bbb8874ed8b8d5730152d4 | /8Puzzle/src/operator/Dreapta.java | e8a4272496c2405454a37473ff8d1bd98aac9bbc | []
| no_license | Emilian37/8Puzzle | a2e26fa949ff8f8505cb45928683164326998ad7 | 6455fd73f74bf93654db2d7454153ca6aeccb6f6 | refs/heads/master | 2022-04-20T14:58:11.446018 | 2020-04-15T15:39:54 | 2020-04-15T15:39:54 | 255,962,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 815 | java | package operator;
import model.Matrix;
import model.Pozitie;
/**
*
* @author Emilian
*
*/
public class Dreapta extends Operator{
@Override
public boolean valabil(Matrix m) {
Pozitie p0=m.pozitieZero();
if(p0!=null) {
Pozitie p1=new Pozitie(p0.getI(),p0.getJ()+1);
if(p1.getI()!=-1 && p1.getJ()!=-1) {
int el=m.getElement(p1);
return el!=-1;
}
else
return false;
}
else return false;
}
@Override
public Matrix execute(Matrix m) {
if(valabil(m)) {
Pozitie p0=m.pozitieZero();
Pozitie p1=new Pozitie(p0.getI(),p0.getJ()+1);
Matrix newMatrix=m.interschimbare(p0, p1);
Matrix.loger.info("DREAPTA init:\n"+m.toString()+" final:\n"+newMatrix.toString());
return newMatrix;
}
else
return m.clonare();
}
}
| [
"[email protected]"
]
| |
6dbd576fea0ea45457221c122005b8e1c6de2bfb | e9d1b2db15b3ae752d61ea120185093d57381f73 | /mytcuml-src/src/java/components/uml_tool_actions_-_diagram_actions/trunk/src/java/tests/com/topcoder/uml/actions/diagram/accuracytests/CreateDiagramActionAccuracyTests.java | f9b866c7dab673e1161f86a59f136960c1c64474 | []
| no_license | kinfkong/mytcuml | 9c65804d511ad997e0c4ba3004e7b831bf590757 | 0786c55945510e0004ff886ff01f7d714d7853ab | refs/heads/master | 2020-06-04T21:34:05.260363 | 2014-10-21T02:31:16 | 2014-10-21T02:31:16 | 25,495,964 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,731 | java | /*
* Copyright (C) 2007 TopCoder Inc., All Rights Reserved.
*
* TCS UML_Tool_Actions_-_Diagram_Actions Version 1.0 Accuracytests.
*
* @ CreateDiagramActionAccuracyTests.java
*/
package com.topcoder.uml.actions.diagram.accuracytests;
import java.util.List;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import com.topcoder.diagraminterchange.Diagram;
import com.topcoder.diagraminterchange.Dimension;
import com.topcoder.diagraminterchange.Point;
import com.topcoder.diagraminterchange.SemanticModelBridge;
import com.topcoder.diagraminterchange.SimpleSemanticModelElement;
import com.topcoder.diagraminterchange.Uml1SemanticModelBridge;
import com.topcoder.uml.model.core.Element;
import com.topcoder.uml.model.core.MethodImpl;
import com.topcoder.uml.modelmanager.UMLModelManager;
/**
* <p>
* The <code>CreateDiagramAction</code>'s Accuracy Tests.
* This accuracy tests addresses the functionality provided
* by the <code>CreateDiagramAction</code> class.
* </p>
*
* @author icyriver
* @version 1.0
*/
public class CreateDiagramActionAccuracyTests extends TestCase {
/**
* <p>
* Represents an instance of <code>CreateDiagramAction</code> uses for accuracy tests.
* </p>
*/
private MockCreateDiagramAction test = null;
/**
* <p>
* Represents an instance of <code>Element</code> uses for accuracy tests.
* </p>
*/
private Element element = null;
/**
* <p>
* Represents an instance of <code>UMLModelManager</code> uses for accuracy tests.
* </p>
*/
private UMLModelManager manager = null;
/**
* <p>
* Test suite of <code>CreateDiagramActionAccuracyTests</code>.
* </p>
*
* @return Test suite of <code>CreateDiagramActionAccuracyTests</code>.
*/
public static Test suite() {
return new TestSuite(CreateDiagramActionAccuracyTests.class);
}
/**
* <p>
* Initialization for all tests here.
* </p>
*
* @throws Exception to JUnit.
*/
protected void setUp() throws Exception {
manager = UMLModelManager.getInstance();
TestHelper.configUMLModelManager();
TestHelper.loadLogFile();
element = new MethodImpl();
test = new MockCreateDiagramAction("class", element, "title");
}
/**
* <p>
* Tears down test environment.
* </p>
*
* @throws Exception to JUnit.
*/
protected void tearDown() throws Exception {
// clean the ConfigManager.
TestHelper.clearConfig();
// clean the UMLModelManager for test.
manager.clearActivityGraphs();
manager.clearDiagrams();
}
/**
* <p>
* Accuracy Test of the <code>CreateDiagramAction(String, Element, String)</code>
* constructor.
* </p>
*
* @throws Exception to JUnit.
*/
public void testCreateDiagramActionCtor_Basic() throws Exception {
test = new MockCreateDiagramAction("class", null, "title");
// check for creating successful.
assertNotNull("Create failed.", test);
// get all the diagrams.
List<Diagram> diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have empty.", 0, diagrams.size());
test.executeAction();
// get all the diagrams.
diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have 1 element.", 1, diagrams.size());
Diagram diagram = diagrams.get(0);
// get the owner.
SemanticModelBridge owner = diagram.getOwner();
// check the type of the owner.
assertTrue("The type of the owner should be intance of Uml1SemanticModelBridge.",
owner instanceof Uml1SemanticModelBridge);
/*
* BugFix: UML-9507
*/
// // get the properties.
// Collection<Property> properties = diagram.getProperties();
// // check the number of the properties.
// assertEquals("The collection should have 1 element.", 1,
// properties.size());
//
// Property typeInfo = properties.iterator().next();
// // check the key of the typeInfo.
// assertEquals("The key of the typeInfo should be equal.", "typeInfo",
// typeInfo.getKey());
// // check the value of the typeInfo.
// assertEquals("The value of the typeInfo should be equal.", "class",
// typeInfo.getValue());
SimpleSemanticModelElement semanticModel = (SimpleSemanticModelElement) diagram.getSemanticModel();
assertEquals("The value of the typeInfo should be equal.", "class",
semanticModel.getTypeInfo());
}
/**
* <p>
* Accuracy Test of the <code>CreateDiagramAction(String, Element, String)</code>
* constructor.
* </p>
*
* @throws Exception to JUnit.
*/
public void testCreateDiagramActionCtor_Detail() throws Exception {
// check for creating successful.
assertNotNull("Create failed.", test);
// get all the diagrams.
List<Diagram> diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have empty.", 0, diagrams.size());
test.executeAction();
// get all the diagrams.
diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have 1 element.", 1, diagrams.size());
Diagram diagram = diagrams.get(0);
// get the owner.
SemanticModelBridge owner = diagram.getOwner();
// check the type of the owner.
assertTrue("The type of the owner should be intance of Uml1SemanticModelBridge.",
owner instanceof Uml1SemanticModelBridge);
// convert it to Uml1SemanticModelBridge.
Uml1SemanticModelBridge modelBridge = (Uml1SemanticModelBridge) owner;
// get the element in modelBridge.
Element getElement = modelBridge.getElement();
// check the activityGraph and the getElement.
assertSame("The two Element should be same.", element, getElement);
}
/**
* <p>
* Accuracy Test of the <code>CreateDiagramAction(String, Element, String)</code>
* constructor.
* </p>
*
* @throws Exception to JUnit.
*/
public void testCreateDiagramActionCtor_DiagramDetail()
throws Exception {
// check for creating successful.
assertNotNull("Create failed.", test);
test.executeAction();
// get all the diagrams.
List<Diagram> diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have 1 element.", 1, diagrams.size());
Diagram diagram = diagrams.get(0);
// get the point to test the diagram.
Point point = diagram.getPosition();
// check the point.
assertEquals("The point should at (0, 0).", 0.0, point.getX());
assertEquals("The point should at (0, 0).", 0.0, point.getY());
// get the zoom to test the diagram.
double zoom = diagram.getZoom();
// check the zoom.
assertEquals("The zoom should be 1.0.", 1.0, zoom);
// get the size to test the diagram.
Dimension dimension = diagram.getSize();
// check the dimension.
assertEquals("The height of dimension should be 0.", 0.0,
dimension.getHeight());
assertEquals("The width of dimension should be 0.", 0.0,
dimension.getWidth());
// get the viewpoint to test the diagram.
Point viewpoint = diagram.getViewport();
// check the viewpoint.
assertEquals("The viewpoint should at (0, 0).", 0.0, viewpoint.getX());
assertEquals("The viewpoint should at (0, 0).", 0.0, viewpoint.getY());
}
/**
* <p>
* Accuracy Test of the <code>executeAction()</code> and <code>undoAction()</code>
* methods.
* </p>
*
* @throws Exception to JUnit.
*/
public void testAction_Operation_Basic() throws Exception {
// get all the diagrams.
List<Diagram> diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have empty.", 0, diagrams.size());
test.executeAction();
// get all the diagrams.
diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have 1 element.", 1, diagrams.size());
}
/**
* <p>
* Accuracy Test of the <code>executeAction()</code>, <code>redoAction()</code>
* and <code>undoAction()</code> methods.
* </p>
*
* @throws Exception to JUnit.
*/
public void testAction_Operation_Detail() throws Exception {
// get all the diagrams.
List<Diagram> diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have empty.", 0, diagrams.size());
test.executeAction();
// get all the diagrams.
diagrams = manager.getDiagrams();
// check the number of the diagrams.
assertEquals("The list should have 1 element.", 1, diagrams.size());
test.undoAction();
// check the number of the diagrams.
assertEquals("The list should be empty.", 0,
manager.getDiagrams().size());
test.redoAction();
// check the number of the diagrams.
assertEquals("The list should have 1 element.", 1,
manager.getDiagrams().size());
}
}
| [
"[email protected]"
]
| |
8097160cb41ce90f42b485b156524189f8d0e2fe | 7bd01a8ef7fe3932370ba5e2d259a67ad49d32a0 | /src/main/java/com/maintacloud/repository/api/plendo/UserRepository.java | 282332baf092daf06c020e39747f50ed77001da1 | [
"BSD-2-Clause"
]
| permissive | jdliferay/plendo-backend | 06171578a39435921979848317c14202270f068c | 37321b7939adc2eccf427aa5b93643c15dbdc8c1 | refs/heads/master | 2021-07-23T06:30:59.657858 | 2017-11-02T08:53:59 | 2017-11-02T08:53:59 | 108,003,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | package com.maintacloud.repository.api.plendo;
import com.maintacloud.domain.configurationglobal.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
/**
* Created by stephan on 20.03.16.
*/
@RepositoryRestResource(exported = false)
public interface UserRepository extends JpaRepository<User, Long> {
User findByUsername(String username);
//User findByEmail(String email);
}
| [
"[email protected]"
]
| |
940b5a63d716bbd0dbd16f766ded5565591cdef3 | 6129637d01dfbe1260570de1bd5d6163c06245c3 | /01.Foundation/src/day05/Demo06_IsPrimeNumber.java | d3099d6d4a58baa048cd7f61e598881a82c921cc | []
| no_license | patrickucy/learn_java | 7e898b8aec8b593af2c95bedc25a61d06021b6ae | 6be872971c1dec4375f7e4c4f5e7011b338de41f | refs/heads/master | 2021-01-18T23:17:19.415794 | 2017-04-03T17:33:55 | 2017-04-03T17:33:55 | 87,101,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package day05;
/*
* 案例
* 1 检查一个数是否为质数(素数)
* 质数:一个数,除了能被自身和1整除,不能被其他数整除这个数就是质数
*
*/
public class Demo06_IsPrimeNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num = 6;
boolean isPrime = true;
for (int i = 2; i <= num / 2 ; i++) {
if (num%i == 0) {
isPrime = false;
System.out.println(num + " is Not Prime Number");
break;
}
}
if (isPrime) {
System.out.println(num + " is Prime Number");
}
}
}
| [
"[email protected]"
]
| |
7ec10a321483c010dead6ca88d2b6f9ae21e2a78 | 23cb2a0de790da6827451b53754a0b3b898cb18b | /src/kr/dogfoot/hwplib/object/etc/UnknownRecord.java | 8843682aefe921df516b83c06113d552c3193023 | [
"Apache-2.0"
]
| permissive | paek/hwplib | 828d7f1702293aad65e9918231cdb5ae107ab2ff | 6da6ead02f7c6892ef921477209ed07b976f3e9e | refs/heads/master | 2021-01-11T16:03:58.233547 | 2017-01-20T07:32:53 | 2017-01-20T07:32:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | java | package kr.dogfoot.hwplib.object.etc;
import kr.dogfoot.hwplib.reader.RecordHeader;
/**
* 알려지지 않은 레코드
*
* @author neolord
*/
public class UnknownRecord {
/**
* 레코드 헤더
*/
private RecordHeader header;
/**
* 레코드 데이터
*/
private byte[] body;
/**
* 생성자
*/
public UnknownRecord() {
}
/**
* 생성자
*
* @param header
* 레코드 헤더
*/
public UnknownRecord(RecordHeader header) {
this.header = header.copy();
}
/**
* 레코드 헤더를 반환한다.
*
* @return 레코드 헤더
*/
public RecordHeader getHeader() {
return header;
}
/**
* 레코드 헤더를 설정한다.
*
* @param header
* 레코드 헤더
*/
public void setHeader(RecordHeader header) {
this.header = header.copy();
}
/**
* 레코드 데이터를 반환한다.
*
* @return 레코드 데이터
*/
public byte[] getBody() {
return body;
}
/**
* 레코드 데이터를 설정한다.
*
* @param body
* 레코드 데이터
*/
public void setBody(byte[] body) {
this.body = body;
}
}
| [
"[email protected]"
]
| |
4e948f4e8c0c258b6210f5223b673da0df769b4a | ad5dcc454966734488149d24a38ea2790c0aca85 | /src/com/luv2code/hibernate/demo/entity/Student.java | d92f9f536123db57d803eb2156997a2ceebe6c43 | []
| no_license | kazemjahani24/Hibernate | b51624ec18e0e49f5d2d2299f201ab66acf1b148 | 7d8bd83946c489c1e723198a24af4d9137d38194 | refs/heads/master | 2021-01-09T12:08:37.649698 | 2020-02-22T07:47:13 | 2020-02-22T07:47:13 | 242,295,607 | 0 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 2,135 | java | package com.luv2code.hibernate.demo.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
//22.2_
@Entity
@Table(name ="studentt")
public class Student {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "email")
private String email;
/*
In java empty/default constructor is added automatically by compiler at the
compile time, if you donít write it explicitly.If you ask about the usages,
it is of no use UNTIL you have any overloaded constructor in your class.
When a class have a parameterized constructor it can not be instantiated
without passing the parameter values. In that can, if you want your class
to be instantiated with out parameters, you will have to declare an empty constructor.
Second, many frameworks, like Hibernate, initialize all the java beans by
calling their default/empty constructors. If default constructor is not found
there will be an error.
*/
public Student() {
}
// the line below is generated constructor using fields in Source option
public Student(String firstName, String lastName, String email) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
public int getId() {
return id;
}
public void setId(int 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 String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return "Student [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email + "]";
}
}
| [
"[email protected]"
]
| |
37ee0a2d61b1402eb6471a995ae670ceccb1400f | ddafc6dc89afbae0f1e77be47f4eb7748a92afad | /server/trunk/protocol/src/test/java/org/hydracache/protocol/data/mashaller/DataMessageXmlMarshallerTest.java | a3fa1f10d60150d78a84421fbea207f29b4cf7a0 | []
| no_license | codehaus/hydra-cache | 32f8e36df6053ae0f14cf60e109f240819c2e6a2 | a4fbd1c63341862e5542d88e8a42338cb5084be6 | refs/heads/master | 2023-07-20T00:34:44.177438 | 2011-07-11T17:46:43 | 2011-07-11T17:46:43 | 36,341,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,538 | java | /*
* Copyright 2010 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.hydracache.protocol.data.mashaller;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.hydracache.protocol.data.marshaller.DataMessageXmlMarshaller;
import org.hydracache.protocol.data.message.DataMessage;
import org.hydracache.server.Identity;
import org.hydracache.server.IdentityXmlMarshaller;
import org.hydracache.server.data.storage.Data;
import org.hydracache.server.data.versioning.IncrementVersionFactory;
import org.hydracache.server.data.versioning.Version;
import org.hydracache.server.data.versioning.VersionFactory;
import org.hydracache.server.data.versioning.VersionXmlMarshaller;
import org.jdom.output.XMLOutputter;
import org.junit.Test;
/**
* @author nzhu
*
*/
public class DataMessageXmlMarshallerTest {
Long keyHash = 100L;
VersionFactory versionFactory = new IncrementVersionFactory();
Version version = versionFactory.create(new Identity(8080));
DataMessageXmlMarshaller marshaller = new DataMessageXmlMarshaller(
new VersionXmlMarshaller(new IdentityXmlMarshaller(),
versionFactory));
@Test
public void ensureXmlEncode() throws Exception {
DataMessage dataMsg = new DataMessage(new Data(keyHash, version,
"Test Data".getBytes()));
String xml = new XMLOutputter().outputString(marshaller
.writeObject(dataMsg));
assertNotNull("Output is null", xml);
assertTrue("Missing child element", xml.contains("<data"));
assertTrue("Missing child element", xml.contains("<version"));
assertTrue("Missing cdata element", xml.contains("CDATA"));
}
@Test
public void ensureXmlEcodingHanldesNull() throws Exception{
String xml = new XMLOutputter().outputString(marshaller
.writeObject(null));
assertEquals("Xml output is incorrect", "<message />", xml);
}
@Test
public void ensureXmlDecode() throws Exception {
DataMessage dataMsg = new DataMessage(new Data(keyHash, version,
"Test Data".getBytes()));
String xml = new XMLOutputter().outputString(marshaller
.writeObject(dataMsg));
DataMessage restoredMsg = marshaller.readObject(xml);
assertEquals("Decoded message object is incorrect", dataMsg, restoredMsg);
}
@Test(expected=IOException.class)
public void ensureXmlDecodingHandlesNull() throws Exception{
marshaller.readObject(null);
}
@Test(expected=IOException.class)
public void ensureXmlDecodingHandlesBlank() throws Exception{
marshaller.readObject("");
}
@Test(expected=IOException.class)
public void ensureXmlDecodingHandlesInvalidXml() throws Exception{
marshaller.readObject(" invalid xml <>");
}
}
| [
"aucifer_nick@8800a6ce-cf61-0410-999d-ef38c60c1380"
]
| aucifer_nick@8800a6ce-cf61-0410-999d-ef38c60c1380 |
5fe2244fa54716e4f12f397c9d2a916d23471f81 | 848c2372f0afbc579e7d70889b0c9b6e1e87d6ed | /0809/src/AbstractMethodDemo.java | bf6747a0c705152a0a01c0b6989543b0afd35387 | []
| no_license | tmznf963/SIST-E | fdc505d223b680276e7b30468b56ea62f1891850 | d24806373ac2b4eab163803d28d23124ad91238f | refs/heads/master | 2020-03-24T16:49:09.117983 | 2018-09-13T03:40:30 | 2018-09-13T03:40:30 | 142,838,096 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 159 | java |
public class AbstractMethodDemo {
public static void main(String[] args) {
Demo d = new JasikDemo();//다형성 강제화
d.display();
d.print();
}
}
| [
"[email protected]"
]
| |
0af7e96744a99dc6f38da503cb079a63d43d4bf9 | e5851a671ddd72dbf771d57a3690f07fb832264b | /GraphDrawingTheory/src/main/java/graph/elements/Graph.java | a129df49331e679905e1817f72d68739417b150e | [
"MIT"
]
| permissive | fernandogodoy/GraphDrawing | 60af86feed5d55c35039d09a286ee2699c11a601 | 2d4c372ab463d8ee972c837c247aeaadee040331 | refs/heads/master | 2020-12-02T11:15:51.202847 | 2017-07-08T19:17:51 | 2017-07-08T19:17:51 | 96,621,781 | 0 | 0 | null | 2017-07-08T13:49:22 | 2017-07-08T13:49:22 | null | UTF-8 | Java | false | false | 13,223 | java | package graph.elements;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import graph.properties.GraphProperties;
/**
* /**
* A graph consisting of a set of vertices of type <code>V</code>
* and a set of edges of type <code>E</code>.
* @author xxx
*
* @param <V>
* @param <E>
*/
public class Graph<V extends Vertex,E extends Edge<V>>{
protected List<V> vertices;
protected List<E> edges;
protected boolean directed = false;
protected GraphProperties<V,E> properties;
/**
* An adjacent list contains a list of all the edges leaving the vertex
*/
protected Map<V, List<E>> adjacentLists;
protected Map<V, List<E>> outgoingEdges;
protected Map<V, List<E>> incomingEdges;
/**
* Vertex by content map
*/
protected Map<Object, V> vertexByContentMap;
public Graph(){
vertices = new ArrayList<V>();
edges = new ArrayList<E>();
adjacentLists = new HashMap<V, List<E>>();
vertexByContentMap = new HashMap<Object,V>();
properties = new GraphProperties<V, E>(this);
outgoingEdges = new HashMap<V, List<E>>();
incomingEdges = new HashMap<V, List<E>>();
}
@SuppressWarnings("unchecked")
public Graph(List<V> vertices, List<E> edges){
this();
for (V v : vertices)
addVertex(v);
for (E e : edges)
addEdge(e);
}
public Graph(boolean directed){
this();
this.directed = directed;
}
public boolean hasVertex(V v){
return vertices.contains(v);
}
@SuppressWarnings("unchecked")
public void addVertex(V...vert){
for (V v : vert){
if (!vertices.contains(v)){
vertices.add(v);
adjacentLists.put(v, new ArrayList<E>());
vertexByContentMap.put(v.getContent(), v);
}
}
}
public void addVertex(V v){
if (vertices.contains(v))
return;
vertices.add(v);
adjacentLists.put(v, new ArrayList<E>());
vertexByContentMap.put(v.getContent(), v);
}
public void addVertexBeginning(V v){
vertices.add(0, v);
adjacentLists.put(v, new ArrayList<E>());
}
public void removeVertex(V v){
vertices.remove(v);
List<E> adjacent = new ArrayList<E>();
adjacent.addAll(adjacentLists.get(v));
for (E e : adjacent){
removeEdge(e);
}
adjacentLists.remove(v);
outgoingEdges.remove(v);
incomingEdges.remove(v);
}
@SuppressWarnings("unchecked")
public void addEdge(E...edge){
for (E e : edge){
if (edges.contains(e))
continue;
edges.add(e);
V origin = e.getOrigin();
V destination = e.getDestination();
if (adjacentLists.get(origin) != null){
adjacentLists.get(origin).add(e);
}
//add it even if the graph is directed
if (adjacentLists.get(e.getDestination()) != null){
adjacentLists.get(e.getDestination()).add(e);
}
if (!incomingEdges.containsKey(destination))
incomingEdges.put(destination, new ArrayList<E>());
if (!outgoingEdges.containsKey(origin))
outgoingEdges.put(origin, new ArrayList<E>());
incomingEdges.get(destination).add(e);
outgoingEdges.get(origin).add(e);
}
}
/**
* Checks if vertices v1 and v2 are connected i.e. if there is an edge between them
* @param v1 Source vertex
* @param v2 Destination vertex
* @return true if there is and edge between v1 and v2, otherwise false
*/
public boolean hasEdge(V v1, V v2){
if (!directed){
for (E e : adjacentLists.get(v1)){
V other = e.getOrigin() == v1 ? e.getDestination() : e.getOrigin();
if (other == v2)
return true;
}
for (E e : adjacentLists.get(v2)){
V other = e.getOrigin() == v2 ? e.getDestination() : e.getOrigin();
if (other == v1)
return true;
}
}
else{
if (outgoingEdges.containsKey(v1))
for (E e : outgoingEdges.get(v1)){
V other = e.getOrigin() == v1 ? e.getDestination() : e.getOrigin();
if (other == v2)
return true;
}
}
return false;
}
/**
* Returns all edges between vertices v1 and v2
* @param v1 Source vertex
* @param v2 Destination vertex
* @return All edges between v1 and v2
*/
public List<E> edgeesBetween (V v1, V v2){
List<E> ret = new ArrayList<E>();
if (!directed){
if (adjacentLists.get(v1) != null)
for (E e : adjacentLists.get(v1))
if (e.getDestination() == v2 || e.getOrigin() == v2)
ret.add(e);
}
else{
if (outgoingEdges.containsKey(v1))
for (E e : outgoingEdges.get(v1))
if (e.getDestination() == v2)
ret.add(e);
}
return ret;
}
public E edgeBetween(V v1, V v2){
List<E> edges = edgeesBetween(v1, v2);
if (edges.size() == 0)
return null;
else
return edges.get(0);
}
public void removeEdge(E e){
edges.remove(e);
if (adjacentLists.get(e.getOrigin()) != null)
adjacentLists.get(e.getOrigin()).remove(e);
if (adjacentLists.get(e.getDestination()) != null)
adjacentLists.get(e.getDestination()).remove(e);
if (outgoingEdges.get(e.getOrigin()) != null)
outgoingEdges.get(e.getOrigin()).remove(e);
if (incomingEdges.get(e.getDestination()) != null)
incomingEdges.get(e.getDestination()).remove(e);
}
public List<E> adjacentEdges(V v){
return adjacentLists.get(v);
}
/**
* All edges leaving v
* @param v
* @return
*/
public List<E> outEdges(V v){
return outgoingEdges.get(v);
}
/**
* All vertices adjacent to the given one
* @param v
* @return
*/
public List<V> adjacentVertices(V v){
List<V> ret = new ArrayList<V>();
if (adjacentLists.get(v) != null)
for (E e : adjacentLists.get(v)){
V other = e.getDestination() != v ? e.getDestination() : e.getOrigin();
if (!ret.contains(other))
ret.add(other);
}
return ret;
}
/**
* Number of edges leaving vertex v
* @param v
* @return
*/
public int outDegree (V v){
if (!outgoingEdges.containsKey(v))
return 0;
return outEdges(v).size();
}
/**
* All edges entering v
* @param v
* @return
*/
public List<E> inEdges(V v){
return incomingEdges.get(v);
}
/**
* Number of edges entering v
* @param v
* @return
*/
public int inDegree(V v){
if (!incomingEdges.containsKey(v))
return 0;
return inEdges(v).size();
}
/**
* Checks if vertex is a source (vertex with no incoming edges)
* @param v
* @return
*/
public boolean isSource(V v){
return inDegree(v) == 0;
}
/**
* Checks if vertex is a sink (vertex with no outgoing edges)
* @param v
* @return
*/
public boolean isSink(V v){
return outDegree(v) == 0;
}
/**
* All edges leaving or entering v
* @param v
* @return
*/
public LinkedList<E> allEdges(V v){
LinkedList<E> ret = new LinkedList<E>();
for (E e : edges)
if (e.getDestination() == v || e.getOrigin() == v)
ret.add(e);
return ret;
}
public List<E> edgesBetween(List<V> vertices){
List<E> ret = new ArrayList<E>();
for (V v : vertices)
for (E e : adjacentEdges(v)){
if (!ret.contains(e)){
V other = e.getOrigin() == v ? e.getDestination() : e.getOrigin();
if (vertices.contains(other))
ret.add(e);
}
}
return ret;
}
/**
* All edges which connect one vertix to itself
* @return
*/
public List<E> getAllSelfLoopEdges(){
List<E> ret = new ArrayList<E>();
for (E e : edges){
if (e.getOrigin() == e.getDestination())
ret.add(e);
}
return ret;
}
/**
* Checks if graph has self loop edges
* @return
*/
public boolean hasSelfLoopEdges(){
for (E e : edges){
if (e.getOrigin() == e.getDestination())
return true;
}
return false;
}
/**
* Checks if graph is simple
* @return
*/
public boolean isSimple(){
if (hasSelfLoopEdges())
return false;
Set<V> covered = new HashSet<V>();
for (V v : vertices){
if (covered.contains(v))
return false;
covered.add(v);
}
return false;
}
/**
* Number of edges entering or leaving v
* @param v
* @return
*/
public int vertexDegree(V v){
return adjacentLists.get(v).size();
}
/**
* Max vertex degree
* @return
*/
public int graphMaxDegree(){
int degree = 0;
int vertDegree;
for (V v : vertices){
vertDegree = vertexDegree(v);
if (vertDegree > degree)
degree = vertDegree;
}
return degree;
}
/**
* Checks is graph is connected
* @return true if the graph is connected, false otherwise
*/
public boolean isConnected(){
return properties.isConnected();
}
/**
* Check if the graph is a tree
* @return true if the graph is a tree, false otherwise
*/
public boolean isTree(){
return properties.isTree();
}
/**
* @param root Root of the tree
* @return list of vertices which are tree leaves
* (presuming that the graph is a tree)
*/
public List<V> getTreeLeaves(V root){
return properties.treeLeaves(root);
}
/**
* Checks is graph is connected presumed that certain vertices are removed
* @return
*/
public boolean isConnected(List<V> excluding){
return properties.isConnected(excluding);
}
public boolean isCyclic(){
return properties.isCyclic();
}
public List<V> getAllSinks(){
List<V> ret = new ArrayList<V>();
for (V v : vertices)
if (isSink(v))
ret.add(v);
return ret;
}
public List<V> getAllSources(){
List<V> ret = new ArrayList<V>();
for (V v : vertices)
if (isSource(v))
ret.add(v);
return ret;
}
public List<List<E>> listMultiEdges(){
return properties.listMultiEdges();
}
public boolean isRing(){
return properties.isRing();
}
/**
* Checks if a graph is biconnected.
* A graph is biconnected if and only if any vertex is deleted, the graph remains connected.
* @return true if graph is biconnected, otherwise false
*/
public boolean isBiconnected(){
return properties.isBiconnected();
}
public List<V> listCutVertices(){
return properties.getCutVertices();
}
public List<Graph<V,E>>listBiconnectedComponents(){
return properties.listBiconnectedComponents();
}
/**
* Creates a subgraph of the graph containing the
* given vertices
* @param subgraphVertices Vertices that should be in the subgraph
* @return
*/
@SuppressWarnings("unchecked")
public Graph<V,E> subgraph(List<V> subgraphVertices){
Graph<V,E> subgraph = new Graph<V,E>();
for (V v : subgraphVertices)
subgraph.addVertex(v);
for (E e : edges)
if (subgraphVertices.contains(e.getDestination()) &&
subgraphVertices.contains(e.getOrigin()))
subgraph.addEdge(e);
return subgraph;
}
public int[][] adjacencyMatrix(){
int[][] ret = new int[vertices.size()][vertices.size()];
for (int i = 0; i < vertices.size(); i++)
for (int j = 0; j < vertices.size(); j++){
if (hasEdge(vertices.get(i), vertices.get(j)))
ret[i][j] = 1;
else
ret[i][j] = 0;
}
return ret;
}
public void printAdjacencyMatrix(){
int[][] adjMatrix = adjacencyMatrix();
for (int[] row : adjMatrix){
System.out.print("[");
for (int j = 0; j < row.length; j++){
System.out.print(row[j]);
if (j < row.length - 1)
System.out.print(", ");
}
System.out.print("],");
}
System.out.println("");
}
public V getVertexByContent(Object content){
return vertexByContentMap.get(content);
}
public List<V> getVertices() {
return vertices;
}
public void setVertices(List<V> vertices) {
this.vertices = vertices;
}
public List<E> getEdges() {
return edges;
}
public void setEdges(List<E> edges) {
this.edges = edges;
}
public boolean isDirected() {
return directed;
}
public void setDirected(boolean directed) {
this.directed = directed;
}
@Override
public String toString() {
return "Graph [vertices=" + vertices + ", edges=" + edges + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (directed ? 1231 : 1237);
result = prime * result + ((edges == null) ? 0 : edges.hashCode());
result = prime * result
+ ((vertices == null) ? 0 : vertices.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Graph<?,?> other = (Graph<?,?>) obj;
if (vertices != null && (other.getVertices()) == null )
return false;
if (vertices == null && (other.getVertices()) != null )
return false;
if (vertices != null && other.getVertices() != null){
if (vertices.size() != other.getVertices().size())
return false;
for (V v1 : vertices){
boolean found = false;
for (Object v2 : other.getVertices()){
if (v1.equals(v2)){
found = true;
break;
}
}
if (!found){
return false;
}
}
}
if (edges != null && (other.getEdges()) == null )
return false;
if (edges == null && (other.getEdges()) != null )
return false;
if (edges != null && other.getEdges() != null){
if (edges.size() != other.getEdges().size())
return false;
for (E e1 : edges){
boolean found = false;
for (Object e2 : other.getEdges()){
if (e1.equals(e2)){
found = true;
break;
}
}
if (!found){
return false;
}
}
}
return true;
}
/**
* @return the adjacentLists
*/
public Map<V, List<E>> getAdjacentLists() {
return adjacentLists;
}
}
| [
"[email protected]"
]
| |
ef87c6471cbeb3bfa7646f0984c5b60be1c57240 | fca9096ae40e7b3311358e4ee92cc512f6811e71 | /src/com/cw/wizbank/JsonMod/user/UserModuleParam.java | 55c4c0ffcb1e96c1c8a8179eac9ed9e09d1947f3 | []
| no_license | Conanjun/HK_CPDT | 0c3d1c00d8c3c02b5493cb3168e84e0693633d12 | 0cb797aff03fd4e8c24458c8f78d71a19c788829 | refs/heads/master | 2022-12-27T16:45:37.746697 | 2019-06-17T14:21:16 | 2019-06-17T14:21:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,835 | java | package com.cw.wizbank.JsonMod.user;
import com.cw.wizbank.JsonMod.BaseParam;
public class UserModuleParam extends BaseParam {
private long usr_ent_id;
// for home page of learner activetab
private String type;
// for select language on page
private String lang;
private String usr_id;
private String usr_email;
private String usr_pwd;
//for sending notify
private String sender_id;
private String sid;
private long tcr_id;
private String isPreView;
private String id_lst;
public String getId_lst() {
return id_lst;
}
public void setId_lst(String id_lst) {
this.id_lst = id_lst;
}
public String getUsr_email() {
return usr_email;
}
public void setUsr_email(String usr_email) {
this.usr_email = usr_email;
}
public String getUsr_id() {
return usr_id;
}
public void setUsr_id(String usr_id) {
this.usr_id = usr_id;
}
public long getUsr_ent_id() {
return usr_ent_id;
}
public void setUsr_ent_id(long user_id) {
this.usr_ent_id = user_id;
}
public String getLang() {
return lang;
}
public void setLang(String lang) {
this.lang = lang;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSender_id() {
return sender_id;
}
public void setSender_id(String sender_id) {
this.sender_id = sender_id;
}
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getUsr_pwd() {
return usr_pwd;
}
public void setUsr_pwd(String usr_pwd) {
this.usr_pwd = usr_pwd;
}
public void setTcr_id(long tcr_id) {
this.tcr_id = tcr_id;
}
public long getTcr_id() {
return tcr_id;
}
public String getIsPreView() {
return isPreView;
}
public void setIsPreView(String isPreView) {
this.isPreView = isPreView;
}
} | [
"[email protected]"
]
| |
873e400d7a7fc5d241964603604aa34678ef93ff | 0e0c7e65d03d1100f61bb23e9bfb97208824135a | /Tabuada.java | 4c7145eee4964a94ec1bf0b8c6053596615d9d99 | []
| no_license | iarcheski/exercicios-extras-para-estudo | 1e7e685c5389e850fc0dd8f8ee0952ed7a889a2e | 7eac05876e0e3bda412f68d0695c094390a168a2 | refs/heads/main | 2023-08-06T18:59:28.054706 | 2021-09-24T20:23:21 | 2021-09-24T20:23:21 | 407,372,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | import java.util.Scanner;
public class Tabuada {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in);
System.out.print("Digite um número o qual deseja saber a tabuada: ");
int numero = ler.nextInt();
for (int contador = 1; contador <= 10; contador++){
System.out.println(numero + " x " + contador + " : " + contador*numero);
}
}
}
| [
"[email protected]"
]
| |
c988b4eeb73427913d99e9fe890572f2c68b34e4 | 123d229e3edc1accefddabe3d679e0a689fa73b8 | /javaproject/CS211/Homework9/Triangle.java | 37a912390fb6d3fea73abf8f702a44394fb6990a | []
| no_license | Sindorman/Homework | b5dd2554359d2dd09080ed82379b41fbecd0289c | a811ed411e81bfb1a6638a7f37f259e0d39c0b30 | refs/heads/master | 2021-08-19T11:37:54.974401 | 2021-05-06T06:58:24 | 2021-05-06T06:58:24 | 120,358,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java |
public class Triangle implements Shape {
private double a;
private double b;
private double c;
//construct a new triangle with given side length
public Triangle(double a, double b, double c){
this.a = a;
this.b = b;
this.c = c;
}
//returns this triangle's area using Heron's formula
public double getArea(){
double s = (a + b + c) / 2.0;
return Math.sqrt(s * (s - a) * (s - b) * (s - c));
}
//returns the perimeter if this triangle
public double getPerimeter(){
return a + b + c;
}
public boolean equals(Shape triangle){
try{
triangle = (Triangle)triangle;
}catch (ClassCastException e){
System.out.println("Illegal format, please make sure it's a Triangle");
}
Triangle test = (Triangle)triangle;
if(this.a == test.a && this.b == test.b && this.c == test.c){
return true;
}else {
return false;
}
}
public String toString(){
return "a: " + this.a + " b: " + this.b + " c: " + this.c;
}
}
| [
"[email protected]"
]
| |
a1a3cdf5e820230c3ab02c296fe9e174137e0801 | edb27c4d96a8f1d7da87913e6f0abd8ee8bd4b99 | /src/main/java/com/itmain/proxy/cglib/Target.java | 965b2fa6859fbe346b3c33a637456581154858a2 | []
| no_license | LiXiaooo/workspace | d0bd246ec8e4439ea95944e04f307a4349b0ff56 | 45b14db8eca546d57b6d275856568a333d58125b | refs/heads/master | 2022-12-28T00:18:42.158678 | 2020-09-24T08:34:00 | 2020-09-24T08:34:00 | 298,217,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | package com.itmain.proxy.cglib;
public class Target {
public void save(){
System.out.println("save is running!");
}
}
| [
"[email protected]"
]
| |
3be87d2197b1c3ec5a4c7b86225f907e42eb2eb7 | 40665051fadf3fb75e5a8f655362126c1a2a3af6 | /intuit-Tank/33f7f86351bbc076efe3b269d2988e65ee00b954/118/GenericFunctions.java | 07717f4b61f332d7c0312b1de7cdf49dd0c87f00 | []
| no_license | fermadeiral/StyleErrors | 6f44379207e8490ba618365c54bdfef554fc4fde | d1a6149d9526eb757cf053bc971dbd92b2bfcdf1 | refs/heads/master | 2020-07-15T12:55:10.564494 | 2019-10-24T02:30:45 | 2019-10-24T02:30:45 | 205,546,543 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,986 | java | package com.intuit.tank.harness.functions;
/*
* #%L
* Intuit Tank Agent (apiharness)
* %%
* Copyright (C) 2011 - 2015 Intuit Inc.
* %%
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* #L%
*/
import java.util.Map;
import java.util.Random;
import java.util.Stack;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.intuit.tank.harness.test.data.Variables;
import com.intuit.tank.vm.common.TankConstants;
class GenericFunctions {
static Random rnd = new Random();
static Logger logger = LogManager.getLogger(GenericFunctions.class);
private static Map<Long, String[]> csvLineMap = new ConcurrentHashMap<Long, String[]>();
private static Map<String, String[]> fileLineMap = new ConcurrentHashMap<String, String[]>();
private static int lastSSN = -1;
/**
* Is this a valid Generic function request
*
* @param values
* The command
* @return TRUE if valid format; FALSE otherwise
*/
public static boolean isValid(String[] values) {
try {
if (values[2].equalsIgnoreCase("getcsv")) {
if (values[3] != "")
return true;
} else if (values[2].equalsIgnoreCase("getfiledata")) {
if (values[3] != "")
return true;
} else if (values[2].equalsIgnoreCase("getssn")) {
return true;
}
return false;
} catch (Exception ex) {
return false;
}
}
/**
* Process the date request
*
* @param values
* The command line
* @return The requested value; "" if there was an error
*/
public static String executeFunction(String[] values, Variables variables) {
try {
if (values[2].equalsIgnoreCase("getcsv")) {
return GenericFunctions.getCSVData(Integer.parseInt(values[3]));
} else if (values[2].equalsIgnoreCase("getfiledata")) {
return GenericFunctions.getCSVData(values, variables);
} else if (values[2].equalsIgnoreCase("getssn")) {
return GenericFunctions.getSsn(values[3]);
}
return "";
} catch (Exception ex) {
return "";
}
}
public static String getCSVData(int index) {
String ret = null;
String[] currentLine = csvLineMap.get(Thread.currentThread().getId());
if (currentLine == null || index >= currentLine.length || currentLine[index] == null) {
currentLine = CSVReader.getInstance(TankConstants.DEFAULT_CSV_FILE_NAME).getNextLine(false);
csvLineMap.put(Thread.currentThread().getId(), currentLine);
}
if (null == currentLine) {
logger.debug("Next line in CSV file is null; returning empty string...");
} else if (index < currentLine.length) {
logger.debug("Next item retrieved from csv file: " + currentLine[index]);
ret = currentLine[index];
currentLine[index] = null;
} else {
logger.debug("Next line in index file has " + currentLine.length + " elements; tried to retrieve index "
+ index);
}
return ret != null ? ret : "";
}
public static String getCSVData(String[] values, Variables variables) {
String ret = null;
int index = Integer.parseInt(values[values.length - 1]);
String file = values[3];
for (int i = 4; i < values.length - 1; i++) {
file += "." + values[i];
}
String[] currentLine = fileLineMap.get(Thread.currentThread().getId() + "-" + file);
if (currentLine == null || index >= currentLine.length || currentLine[index] == null) {
currentLine = CSVReader.getInstance(file).getNextLine(false);
fileLineMap.put(Thread.currentThread().getId() + "-" + file, currentLine);
}
if (null == currentLine) {
logger.debug("Next line in CSV file is null; returning empty string...");
} else if (index < currentLine.length) {
logger.debug("Next item retrieved from csv file: " + currentLine[index]);
ret = currentLine[index];
currentLine[index] = null;
} else {
logger.debug("Next line in index file has " + currentLine.length + " elements; tried to retrieve index "
+ index);
}
return ret != null ? ret : "";
}
/**
*
* @param startSsn
* @return
*/
public static String getSsn(String val) {
int ret = 0;
if (lastSSN < 0) {
int startSsn = 100000000;
if (NumberUtils.isDigits(val)) {
startSsn = Integer.parseInt(val);
}
lastSSN = startSsn;
}
Stack<Integer> stack = StringFunctions.getStack(lastSSN, 899999999, null, false);
do {
ret = stack.pop();
} while (!isValidSsn(ret));
String ssnString = Integer.toString(ret);
StringUtils.leftPad(ssnString, 9, '0');
ssnString = ssnString.substring(0, 3) + "-" + ssnString.substring(3, 5) + "-" + ssnString.substring(5, 9);
return ssnString;
}
private static boolean isValidSsn(int ssn) {
if (((ssn >= 1010001) && (ssn <= 699999999)) ||
((ssn >= 700010001) && (ssn <= 733999999)) ||
((ssn >= 750010001) && (ssn <= 763999999)) ||
((ssn >= 764010001) && (ssn <= 899999999))) {
return true;
}
return false;
}
} | [
"[email protected]"
]
| |
367a933e044750b81364384fa6785ff4ddd222fe | 3b3d65b5fb0de28cc0205f53f7f1bc2435126b35 | /chapter7/src/main/java/com/apress/hibernaterecipes/chapter7/recipe1/Book1.java | 2d9999548587dfd6cf4ced4d5706a38698f7c9e6 | []
| no_license | dlee0113/hibernate_recipes_second_edition | d8145eccb4da451d683bf92f489b0f8aa8d19da3 | edcee59e671750580a3b3664c8369ee6baf6c456 | refs/heads/master | 2016-09-06T13:55:07.823882 | 2015-07-07T18:01:20 | 2015-07-07T18:01:20 | 38,683,522 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package com.apress.hibernaterecipes.chapter7.recipe1;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
@Entity
@Data
@NoArgsConstructor
public class Book1 {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
int id;
String title;
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "book_id")
Set<Chapter1> chapters = new HashSet<>();
} | [
"[email protected]"
]
| |
9f5cb64ecf66a7e36ff588a3eb2af1c30dfd8df8 | 40cd4da5514eb920e6a6889e82590e48720c3d38 | /desktop/applis/apps/core/common/expressionlanguage/src/main/java/code/expressionlanguage/exec/blocks/ExecDeclareVariable.java | 68edf319963dc0a713520120759bbcb1e9786256 | []
| no_license | Cardman/projects | 02704237e81868f8cb614abb37468cebb4ef4b31 | 23a9477dd736795c3af10bccccb3cdfa10c8123c | refs/heads/master | 2023-08-17T11:27:41.999350 | 2023-08-15T07:09:28 | 2023-08-15T07:09:28 | 34,724,613 | 4 | 0 | null | 2020-10-13T08:08:38 | 2015-04-28T10:39:03 | Java | UTF-8 | Java | false | false | 849 | java | package code.expressionlanguage.exec.blocks;
import code.expressionlanguage.ContextEl;
import code.expressionlanguage.exec.StackCall;
import code.expressionlanguage.exec.calls.AbstractPageEl;
import code.util.StringList;
public final class ExecDeclareVariable extends ExecAbstractDeclareVariable {
private final String importedClassName;
public ExecDeclareVariable(String _importedClassName, StringList _variableNames) {
super(_variableNames);
importedClassName = _importedClassName;
}
@Override
public void processEl(ContextEl _cont, StackCall _stack) {
ExecHelperBlocks.processDeclare(_cont, _stack, importedClassName, this);
}
@Override
public void removeLocalVars(AbstractPageEl _ip) {
for (String v: getVariableNames()) {
_ip.removeRefVar(v);
}
}
}
| [
"[email protected]"
]
| |
a9415fbc8cad46fc6b5d224d6dc578865d7b7f4e | 10acd8c52a067661f0314fba8efe963617878631 | /src/Trees/ZigZagOrderTraversal.java | 04a6229e853e278948e781de0171efd753d40672 | []
| no_license | utkarsh2kalia/Data_Structures | 3e260c6405734425bfaad5917e03bc838275d0a7 | 897f2914610d15ce71dd5821b20ac9cc2fd1d6a5 | refs/heads/master | 2023-06-14T09:10:43.852879 | 2021-07-01T09:13:35 | 2021-07-01T09:13:35 | 290,283,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,637 | java | package Trees;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedList;
import static Trees.InorderTraversal.maketree;
public class ZigZagOrderTraversal {
public static void zigzagtraversal(TreeNode root){
Deque<TreeNode> qi = new ArrayDeque<>();
if(root == null)
return;
qi.addFirst(root);
boolean reverse = false; // reverse true means right to left
while (!qi.isEmpty()){
int count = qi.size();
if(reverse)
{
//right to left
for(int i = 0; i<count; i++){
TreeNode curr = qi.pollFirst();
if(curr!=null){
System.out.print(curr.data+" ");}
if(curr.left!=null)
qi.addLast(curr.left);
if(curr.right!=null)
qi.addLast(curr.right);
}
}
else{
for(int i = 0; i<count; i++)
{
// left to right
TreeNode curr = qi.pollLast();
System.out.print(curr.data+" ");
if(curr.left!=null)
qi.addFirst(curr.right);
if(curr.right!=null)
qi.addFirst(curr.left);
}
}
reverse = !reverse;
System.out.println();
}
}
public static void main(String[] args) {
int arr[] = {4,3,2,6,5,7,1};
zigzagtraversal(maketree(arr));
}
}
| [
"[email protected]"
]
| |
95bbf2beee5aef7622309ac45ae0e42056d4865c | 659f2dfa9e5efcb6619aa5bdc087ed127f8c93e4 | /sources/libraries/config/model/src/main/java/com/minsait/onesait/platform/config/model/GadgetMeasure.java | 7ee94ad63c9e8a4d80331ca620dc7b368765ce5b | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | onesaitplatform/onesaitplatform-revolution-the-minspait-crowd | cdb806cbcf5d38d9301a955a88b1e6f540f1be05 | 09937b4df0317013c2dfd0416cfe1c45090486f8 | refs/heads/master | 2021-06-17T10:53:26.819575 | 2019-10-09T14:58:20 | 2019-10-09T14:58:20 | 210,382,466 | 2 | 1 | NOASSERTION | 2021-06-04T02:20:29 | 2019-09-23T14:55:26 | Java | UTF-8 | Java | false | false | 1,918 | java | /**
* Copyright Indra Soluciones Tecnologías de la Información, S.L.U.
* 2013-2019 SPAIN
*
* 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.minsait.onesait.platform.config.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.annotations.Type;
import org.springframework.beans.factory.annotation.Configurable;
import com.minsait.onesait.platform.config.model.base.AuditableEntityWithUUID;
import lombok.Getter;
import lombok.Setter;
@Configurable
@Entity
@Table(name = "GADGET_MEASURE")
public class GadgetMeasure extends AuditableEntityWithUUID {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "GADGET_ID", referencedColumnName = "ID")
@OnDelete(action = OnDeleteAction.CASCADE)
@Getter
@Setter
private Gadget gadget;
@ManyToOne
@JoinColumn(name = "DATASOURCE_ID", referencedColumnName = "ID")
@OnDelete(action = OnDeleteAction.CASCADE)
@Getter
@Setter
private GadgetDatasource datasource;
@Column(name = "CONFIG")
@Lob
@Type(type = "org.hibernate.type.TextType")
@Getter
@Setter
private String config;
}
| [
"[email protected]"
]
| |
07669e80c4093d1d9632b86bf771eacb10e786b8 | a7454682c6413d11647e0eacc63704b5c3bc8ee4 | /SAVOIR_MgmtServices/src/ca/gc/nrc/iit/savoir/resourceMgmt/InstanceState.java | 4be49a7736d47700eebce305e7a852b942865e0b | []
| no_license | savoir2013/savoir | ffec9b38d2cd41cac689c776bb5c742d0d1dc65a | daa80b13475729ba1d490f8dd93d85553bca09aa | refs/heads/master | 2021-01-22T09:47:18.370871 | 2013-01-29T21:26:46 | 2013-01-29T21:26:46 | 7,899,749 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | // Licensed under Apache 2.0
// Copyright 2011, National Research Council of Canada
// Property of Lakehead University
package ca.gc.nrc.iit.savoir.resourceMgmt;
/**
* Represents the state of a specific instance of an ED
*
* @author Aaron Moss
*/
public class InstanceState {
/** Reference to the instance this state is of */
private InstanceId id;
/** State of the ED instance */
private ResourceState state;
public InstanceState() {}
public InstanceState(InstanceId id) {
this(id, ResourceState.INACTIVE);
}
public InstanceState(InstanceId id, ResourceState state) {
this.id = id;
this.state = state;
}
public InstanceId getId() {
return id;
}
public ResourceState getState() {
return state;
}
public void setId(InstanceId id) {
this.id = id;
}
public void setState(ResourceState state) {
this.state = state;
}
}
| [
"[email protected]"
]
| |
01ab078bcff066e62d5065b7e953094b12e71cab | 3f11c2c79fa345eea9dc1235091d2088a3d0a219 | /src/part_1/com/endava/entity/info/CountriesBlackList.java | cad3c3c6f4631739a385b877ce9866f45359cbc3 | []
| no_license | Stason1o/IonExercise_2 | f4dcf34dcf59b8a508a6a06ecc4fd00f790a9009 | ce5806ad12391d8def92da04a542a55661e085b7 | refs/heads/master | 2021-01-23T00:25:00.357077 | 2017-10-03T15:56:04 | 2017-10-03T15:56:04 | 85,727,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,025 | java | package part_1.com.endava.entity.info;
import part_1.com.endava.entity.Country;
import java.util.ArrayList;
import java.util.List;
/**
* Created by sbogdanschi on 21/03/2017.
*/
public class CountriesBlackList {
static private List<Country> supportedCountries;
static {
supportedCountries = new ArrayList<>();
supportedCountries.add(new Country("Moldova", 20.5));
supportedCountries.add(new Country("Romania", 10.4));
supportedCountries.add(new Country("Italy", 40.3));
supportedCountries.add(new Country("Belgrade", 10.4));
supportedCountries.add(new Country("Russia", 50.3));
supportedCountries.add(new Country("Ukraine", 11.2));
supportedCountries.add(new Country("USA", 34.6));
}
public CountriesBlackList() {
}
public static List<Country> getSupportedCountries() {
return supportedCountries;
}
public static void setSupportedCountries(List<Country> list) {
supportedCountries.addAll(list);
}
}
| [
"[email protected]"
]
| |
70f71d905421c49edb57f7cf322018140bdb1158 | 0a9ce9f974c29f182d73580b96cabd0a3eb61e03 | /app/src/main/java/com/toto/proyecto/MainActivity.java | 1b046043aebdb1611e2e313491a58c65ad422f87 | []
| no_license | hprobertos/RecommenDish | e773a65961e08982c57d3d1786af60cbb9285d89 | 336e02ed73b0f6e02384c04c4e089ff916b2e374 | refs/heads/master | 2020-06-24T07:39:39.009970 | 2020-01-07T05:37:17 | 2020-01-07T05:37:17 | 198,899,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,989 | java | package com.toto.proyecto;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private SQLiteDatabase db;
private Cursor favoritesCursor;
private Button recomendButton;
private Button shuffleButton;
private Button favoriteButton;
private TextView welcomeTitle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
welcomeTitle = (TextView)findViewById(R.id.welcome_title);
recomendButton = (Button)findViewById(R.id.recommend_button);
recomendButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
onClickRecommend();
}
});
shuffleButton = (Button)findViewById(R.id.shuffle_button);
favoriteButton = (Button)findViewById(R.id.favorites_button);
favoriteButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
onClickFavorite();
}
});
}
public void onClickRecommend(){
Intent intent = new Intent(MainActivity.this, RecommendActivity.class);
startActivity(intent);
}
public void onClickShuffle(View v){
Intent intent = new Intent(MainActivity.this, ShuffleActivity.class);
startActivity(intent);
}
public void onClickFavorite(){
Intent intent = new Intent(MainActivity.this, FavoritesActivity.class);
startActivity(intent);
}
}
| [
"[email protected]"
]
| |
5d6d81613676eef5ae29c67b4386b5fd42ced14d | c2b0743ee2f663c5fd48bb9f2ef0db48d121b097 | /eventos/src/eventos/OuvinteMuse.java | af407fa0b83b3c2405d831dcdedddb5713e2c27d | []
| no_license | thiagofaustinoads/ADS017 | 978103f878a2abc95c230bb6f912a14df7c5340b | 297f2c579e6bebe5e4de2f999e1811b5c19db30a | refs/heads/master | 2022-03-10T02:03:23.286358 | 2019-11-08T01:42:40 | 2019-11-08T01:42:40 | 201,349,802 | 0 | 0 | null | 2019-08-08T23:02:06 | 2019-08-08T23:02:05 | null | UTF-8 | Java | false | false | 933 | java | package eventos;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class OuvinteMuse implements MouseListener {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("Disparando mouseClicked...");
System.out.println("Clicou o botão" + e.getButton());
System.out.println("Clicou" + e.getClickCount() + "vez(es)");
}
@Override
public void mousePressed(MouseEvent e) {
System.out.println("Disparando mousePressed...");
}
@Override
public void mouseReleased(MouseEvent e) {
System.out.println("Disparando mouseReleased...");
}
@Override
public void mouseEntered(MouseEvent e) {
System.out.println("Disparando mouseEntered...");
}
@Override
public void mouseExited(MouseEvent e) {
System.out.println("Disparando mouseExited...");
}
}
| [
"[email protected]"
]
| |
c2d172c951b98b8578cc492f4cf91d713d033b72 | 43e3f15d861c76e0859dc9e4bb5d5ad43a6f2844 | /src/session8Polymorphism/CoveriantReturn.java | aef9a2c12b19c8311c262ef0fedb36e3d94055da | []
| no_license | LinZhenli/ThinkingInJavaLearn | 6f3463d6c7d3e81fe1ffeaf4c4113f67673f1270 | fffa7efa4b502f09ce750ae671ba9bdfa5ff4aa9 | refs/heads/master | 2023-03-21T09:21:54.088013 | 2021-03-10T13:14:05 | 2021-03-10T13:14:05 | 346,356,443 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 635 | java | package session8Polymorphism;
class Grain{
public String toString() {return "Grain";}
}
class Wheat extends Grain{
public String toString() {return "Wheat";}
}
class Mill{
Grain process(){return new Grain();}
}
class WheatMill extends Mill{
@Override
Wheat process() {return new Wheat();}//这里虽然是覆盖,但是返回类型却是基类的返回类型的导出类。
}
public class CoveriantReturn {
public static void main(String[] args) {
// TODO Auto-generated method stub
Mill m=new Mill();
Grain g=m.process();
System.out.println(g);
m=new WheatMill();
g=m.process();
System.out.println(g);
}
}
| [
"‘[email protected]’"
]
| |
2888eb0ff572989b94c6792261295053a6eb3756 | d82926628234a44b2c5c3097501d991875550ab8 | /tcg-admin/src/main/java/com/tcg/admin/model/QCategoryRole.java | 210cfeb519ce18742e8e791fb74c00e42690dd15 | []
| no_license | shiwanning/tcg_admin | 2cf95ce796ce1585e95f2da537f74bf93942318a | d3e9a85489c2bc5c4ed00a14e1568c7f21ee9880 | refs/heads/master | 2022-12-23T14:28:53.662324 | 2019-07-18T10:46:08 | 2019-07-18T10:46:08 | 151,556,864 | 0 | 0 | null | 2022-12-16T08:55:34 | 2018-10-04T10:48:29 | Java | UTF-8 | Java | false | false | 1,763 | java | package com.tcg.admin.model;
import static com.mysema.query.types.PathMetadataFactory.*;
import com.mysema.query.types.path.*;
import com.mysema.query.types.PathMetadata;
import javax.annotation.Generated;
import com.mysema.query.types.Path;
/**
* QCategoryRole is a Querydsl query type for CategoryRole
*/
@Generated("com.mysema.query.codegen.EntitySerializer")
public class QCategoryRole extends EntityPathBase<CategoryRole> {
private static final long serialVersionUID = 605112571L;
public static final QCategoryRole categoryRole = new QCategoryRole("categoryRole");
public final QBaseEntity _super = new QBaseEntity(this);
public final NumberPath<Integer> categoryId = createNumber("categoryId", Integer.class);
public final NumberPath<Integer> categoryRoleId = createNumber("categoryRoleId", Integer.class);
public final StringPath createOperator = createString("createOperator");
//inherited
public final DateTimePath<java.util.Date> createTime = _super.createTime;
public final StringPath description = createString("description");
public final NumberPath<Integer> roleId = createNumber("roleId", Integer.class);
public final StringPath updateOperator = createString("updateOperator");
//inherited
public final DateTimePath<java.util.Date> updateTime = _super.updateTime;
//inherited
public final NumberPath<Long> version = _super.version;
public QCategoryRole(String variable) {
super(CategoryRole.class, forVariable(variable));
}
public QCategoryRole(Path<? extends CategoryRole> path) {
super(path.getType(), path.getMetadata());
}
public QCategoryRole(PathMetadata<?> metadata) {
super(CategoryRole.class, metadata);
}
}
| [
"[email protected]"
]
| |
18f280edc2a73215500d2afa83e4b572b8b438d8 | ae661f9e620f3d14ebdf04f98fe7ea2c7ca948a4 | /2Trimestre/Extra-Fotocopiadora/src/extra/fotocopiadora/Metodos.java | 1dfda594be8660b6f857da32db36f1236edd7cfd | []
| no_license | ablancoabalde/Ejercicios_extra | c95e7db836f90ba157cedae33a9f5faa13753bbc | 27de3dfd74f11261a4a212cfd5541a9c1c965ef9 | refs/heads/master | 2021-05-07T14:20:59.777679 | 2018-02-07T10:47:18 | 2018-02-07T10:47:18 | 109,812,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package extra.fotocopiadora;
import java.util.LinkedList;
public class Metodos {
// Clase LinkedList
LinkedList<Texto> impresion=new LinkedList<Texto>();
public void enviar(Texto t) {
//Agrega el elemento especificado al final de esta lista.
impresion.add(t);
}
public void imprimir() {
//Recupera, pero no elimina, el encabezado (primer elemento) de esta lista.
if (impresion.element().getTexto()==null) {
System.out.println("No hay cola");
} else {
for (int i=0; i<impresion.element().getnCopias(); i++) {
System.out.println(impresion.element().getTexto());
}
// Recupera y elimina el encabezado (primer elemento) de esta lista.
impresion.poll();
}
}
public void verCola() {
// Devuelve la cantidad de elementos en esta lista.
System.out.println("Hay "+impresion.size()+" elementos por imprimir");
}
}
| [
"[email protected]"
]
| |
cdf22c34fde41a62570584fd971e1914182df6f8 | 5ad8f7647de77659b0278f259c1ed88c65c10596 | /src/test2/Testframe.java | 31d12f794b8f4bdd71c0bc9de99d1b431963ba97 | []
| no_license | JameeElrufai/Test2 | 25f8cbfa69a6d6584b84b4bd3cef54daf84b50ff | 67ce6b8cc22fe44cbd79640bf996e21a8c4879e6 | refs/heads/master | 2021-01-22T18:32:42.076527 | 2017-03-15T15:37:03 | 2017-03-15T15:37:03 | 85,087,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,079 | 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 test2;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
/**
*
* @author AZIZA
*/
public class Testframe extends javax.swing.JFrame {
/**
* Creates new form Testframe
*/
public Testframe() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
lblPhoto = new javax.swing.JLabel();
btnSubmit = new javax.swing.JButton();
txtDname = new javax.swing.JTextField();
txtId = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
txtDosage = new javax.swing.JTextArea();
txtQuantity = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel1.setText("Pharmacy Management System");
jLabel2.setText("Drug Name:");
jLabel3.setText("ID:");
jLabel4.setText("Dosage:");
jLabel5.setText("Quantity:");
lblPhoto.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
lblPhotoMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
lblPhotoMouseEntered(evt);
}
});
btnSubmit.setText("Submit");
btnSubmit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSubmitActionPerformed(evt);
}
});
txtId.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtIdActionPerformed(evt);
}
});
txtDosage.setColumns(20);
txtDosage.setRows(5);
jScrollPane1.setViewportView(txtDosage);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnSubmit)
.addGap(162, 162, 162))
.addGroup(layout.createSequentialGroup()
.addGap(99, 99, 99)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtDname, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(15, 15, 15)
.addComponent(txtId, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 227, Short.MAX_VALUE)
.addComponent(lblPhoto, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(21, 21, 21))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtDname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(56, 56, 56)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txtId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(lblPhoto, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(txtQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(75, 75, 75)
.addComponent(btnSubmit)
.addGap(24, 24, 24))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void lblPhotoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblPhotoMouseClicked
// TODO add your handling code here:
JFileChooser myChooser = new JFileChooser();
myChooser.setCurrentDirectory(new File(System.getProperty("user.home")));
int result = myChooser.showOpenDialog(myChooser);
if(result == JFileChooser.APPROVE_OPTION)
{
File myFile = myChooser.getSelectedFile();
String filepath = myFile.toString();
System.out.println("filepath");
Icon myIcon;
myIcon = new ImageIcon(new ImageIcon(filepath).getImage().getScaledInstance(80,100, java.awt.Image.SCALE_SMOOTH));
lblPhoto.setIcon(myIcon);
new File ("C:\\Pharmacy").mkdir();
Path source = Paths.get(filepath);
Path targetDir = Paths.get("C:\\Pharmacy");
Path target = targetDir.resolve(myChooser.getSelectedFile().getName());
System.out.println("target.toString(Drug)");
try{
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
}catch(Exception e)
{
System.out.println(e.getMessage());
}
}
// System.out.println("mouse clicked....");
}//GEN-LAST:event_lblPhotoMouseClicked
private void txtIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtIdActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtIdActionPerformed
private void lblPhotoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblPhotoMouseEntered
// TODO add your handling code here:
System.out.println("mouse entered...");
}//GEN-LAST:event_lblPhotoMouseEntered
String Drug_name,ID,Dosage,Quantity;
private void btnSubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitActionPerformed
// TODO add your handling code here:
Drug_name = txtDname.getText();
ID = txtId.getText();
Dosage = txtDosage.getText();
Quantity = txtQuantity.getText();
System.out.println(Drug_name+ID+Dosage+Quantity);
}//GEN-LAST:event_btnSubmitActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Testframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Testframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Testframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Testframe.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Testframe().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnSubmit;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel lblPhoto;
private javax.swing.JTextField txtDname;
private javax.swing.JTextArea txtDosage;
private javax.swing.JTextField txtId;
private javax.swing.JTextField txtQuantity;
// End of variables declaration//GEN-END:variables
}
| [
"AZIZA@DESKTOP-S3EUOHQ"
]
| AZIZA@DESKTOP-S3EUOHQ |
c1a57d53aa0b8dc2b0f0c5fb565689bbea396577 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_4dbe8ad3a815a74abaa780b40298793a5401da69/ExportProjectSetMainPage/8_4dbe8ad3a815a74abaa780b40298793a5401da69_ExportProjectSetMainPage_s.java | 7d4087b1f1cc5c24241277b0602a02aa6a8531eb | []
| 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 | 6,519 | java | /*******************************************************************************
* Copyright (c) 2002 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM - Initial API and implementation
******************************************************************************/
package org.eclipse.team.internal.ui;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
public class ExportProjectSetMainPage extends TeamWizardPage {
Text fileText;
String file = ""; //$NON-NLS-1$
Button browseButton;
List selectedProjects = new ArrayList();
CheckboxTableViewer tableViewer;
Table table;
class ProjectContentProvider extends WorkbenchContentProvider {
public Object[] getElements(Object element) {
if (element instanceof IProject[]) return (IProject[]) element;
return null;
}
};
public ExportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
}
/*
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
Composite composite = createComposite(parent, 1);
initializeDialogUnits(composite);
createLabel(composite, Policy.bind("ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2")); //$NON-NLS-1$
table = new Table(composite, SWT.CHECK);
tableViewer = new CheckboxTableViewer(table);
table.setLayout(new TableLayout());
table.setLayoutData(new GridData(GridData.FILL_BOTH));
tableViewer.setContentProvider(new ProjectContentProvider());
tableViewer.setLabelProvider(new WorkbenchLabelProvider());
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
IProject project = (IProject)event.getElement();
if (event.getChecked()) {
selectedProjects.add(project);
} else {
selectedProjects.remove(project);
}
}
});
createLabel(composite, Policy.bind("ExportProjectSetMainPage.Project_Set_File_Name__3")); //$NON-NLS-1$
Composite inner = new Composite(composite, SWT.NULL);
inner.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
inner.setLayout(layout);
fileText = createTextField(inner);
if (file != null) fileText.setText(file);
fileText.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event event) {
file = fileText.getText();
updateEnablement();
}
});
browseButton = new Button(inner, SWT.PUSH);
browseButton.setText(Policy.bind("ExportProjectSetMainPage.Browse_4")); //$NON-NLS-1$
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
browseButton.setLayoutData(data);
browseButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
FileDialog d = new FileDialog(getShell());
d.setFilterExtensions(new String[] {Policy.bind("ExportProjectSetMainPage.*.psf_2")}); //$NON-NLS-1$
d.setFilterNames(new String[] {Policy.bind("ExportProjectSetMainPage.Project_Set_Files_3")}); //$NON-NLS-1$
String f = d.open();
if (f != null) {
fileText.setText(f);
file = f;
}
}
});
initializeProjects();
setControl(composite);
updateEnablement();
}
private void initializeProjects() {
List projectList = new ArrayList();
IProject[] workspaceProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < workspaceProjects.length; i++) {
if (RepositoryProvider.getProvider(workspaceProjects[i]) != null) {
projectList.add(workspaceProjects[i]);
}
}
tableViewer.setInput((IProject[]) projectList.toArray(new IProject[projectList.size()]));
// Check any necessary projects
if (selectedProjects != null) {
tableViewer.setCheckedElements((IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]));
}
}
private void updateEnablement() {
boolean complete;
if (file.length() == 0) {
setMessage(null);
complete = false;
} else {
File f = new File(file);
if (f.isDirectory()) {
setMessage(Policy.bind("ExportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$
complete = false;
} else {
complete = true;
}
}
if (complete) {
setMessage(null);
}
setPageComplete(complete);
}
public String getFileName() {
return file;
}
public void setFileName(String file) {
if (file != null) {
this.file = file;
}
}
public IProject[] getSelectedProjects() {
return (IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]);
}
public void setSelectedProjects(IProject[] selectedProjects) {
this.selectedProjects.addAll(Arrays.asList(selectedProjects));
}
}
| [
"[email protected]"
]
| |
da3b2c55155ac291eba687ccc3198b3158d38392 | ccf5afceaf104a26660c49eaf83f7b2cfb1fb155 | /src/main/java/be/ordina/fbousson/domain/SocialUserConnection.java | f16fbd1eca14f23405de05e3beac9c9972473a24 | []
| no_license | fbousson/demojhipster | 26cc01d81cf99bd5c4d2fb5d9daa0f81195c0f51 | 65d52b26a793170b8ba83220f726d1bbb7f87de4 | refs/heads/master | 2021-01-02T09:30:00.591700 | 2017-08-03T12:51:01 | 2017-08-03T12:51:01 | 99,228,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,551 | java | package be.ordina.fbousson.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;
/**
* A Social user.
*/
@Entity
@Table(name = "jhi_social_user_connection")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class SocialUserConnection implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "user_id", length = 255, nullable = false)
private String userId;
@NotNull
@Column(name = "provider_id", length = 255, nullable = false)
private String providerId;
@NotNull
@Column(name = "provider_user_id", length = 255, nullable = false)
private String providerUserId;
@NotNull
@Column(nullable = false)
private Long rank;
@Column(name = "display_name", length = 255)
private String displayName;
@Column(name = "profile_url", length = 255)
private String profileURL;
@Column(name = "image_url", length = 255)
private String imageURL;
@NotNull
@Column(name = "access_token", length = 255, nullable = false)
private String accessToken;
@Column(length = 255)
private String secret;
@Column(name = "refresh_token", length = 255)
private String refreshToken;
@Column(name = "expire_time")
private Long expireTime;
public SocialUserConnection() {}
public SocialUserConnection(String userId,
String providerId,
String providerUserId,
Long rank,
String displayName,
String profileURL,
String imageURL,
String accessToken,
String secret,
String refreshToken,
Long expireTime) {
this.userId = userId;
this.providerId = providerId;
this.providerUserId = providerUserId;
this.rank = rank;
this.displayName = displayName;
this.profileURL = profileURL;
this.imageURL = imageURL;
this.accessToken = accessToken;
this.secret = secret;
this.refreshToken = refreshToken;
this.expireTime = expireTime;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getProviderId() {
return providerId;
}
public void setProviderId(String providerId) {
this.providerId = providerId;
}
public String getProviderUserId() {
return providerUserId;
}
public void setProviderUserId(String providerUserId) {
this.providerUserId = providerUserId;
}
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getProfileURL() {
return profileURL;
}
public void setProfileURL(String profileURL) {
this.profileURL = profileURL;
}
public String getImageURL() {
return imageURL;
}
public void setImageURL(String imageURL) {
this.imageURL = imageURL;
}
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
public Long getExpireTime() {
return expireTime;
}
public void setExpireTime(Long expireTime) {
this.expireTime = expireTime;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SocialUserConnection user = (SocialUserConnection) o;
if (!id.equals(user.id)) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "SocialUserConnection{" +
"id=" + id +
", userId=" + userId +
", providerId='" + providerId + '\'' +
", providerUserId='" + providerUserId + '\'' +
", rank=" + rank +
", displayName='" + displayName + '\'' +
", profileURL='" + profileURL + '\'' +
", imageURL='" + imageURL + '\'' +
", accessToken='" + accessToken + '\'' +
", secret='" + secret + '\'' +
", refreshToken='" + refreshToken + '\'' +
", expireTime=" + expireTime +
'}';
}
}
| [
"[email protected]"
]
| |
ff6d92feac498bb76ea30510e289e705439938b8 | e78f31e1ab0a502f23229912161356fcee17d586 | /app/src/main/java/com/esprit/insta360/Activity/LoginActivity.java | 014c71d759ea4434ad9bbe537c4bd6e4e7bd72bc | []
| no_license | EwoutH/Insta360 | c7371cb515d644c4d7adcaee47820a2f32c49fcc | 0bc9bc6308793b7b132d0054ef3f6e9fd976d5d9 | refs/heads/instaMaster | 2023-04-10T14:52:05.186923 | 2017-04-06T23:57:28 | 2017-04-06T23:57:28 | 166,666,028 | 0 | 0 | null | 2023-04-04T00:24:39 | 2019-01-20T13:43:27 | Java | UTF-8 | Java | false | false | 962 | java | package com.esprit.insta360.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.esprit.insta360.Fragments.LoginFragment;
import com.esprit.insta360.R;
/**
* A login screen that offers login via email/password.
*/
public class LoginActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
getFragmentManager().beginTransaction().add(R.id.container,new LoginFragment()).commit();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Fragment fragment = getFragmentManager().findFragmentById(R.id.container);
fragment.onActivityResult(requestCode, resultCode, data);
}
}
| [
"[email protected]"
]
| |
75c393b7ebf728e6800e7b8abc5e599d5ec0f5fc | f12c77fb9dc9daacf71a8aa7ec59944fd97753d2 | /ruoyi-system/src/main/java/com/ruoyi/system/domain/StandardItem.java | e4f90066230a321a244549d3f24c6a8b4d65f0bc | []
| no_license | and0429/wife-admin | 4a323f2902b1a7d8dcfc368ffa1f1abc2a4d5e1e | e5d1ad5139ce5272980fb7b0f0cb4b58514f1013 | refs/heads/master | 2023-08-12T00:27:48.093434 | 2021-10-14T09:29:40 | 2021-10-14T09:29:40 | 364,923,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 标准类目对象 b_standard_item
*
* @author zhangkai
* @date 2021-04-23
*/
public class StandardItem extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 规格 */
@Excel(name = "规格")
private String format;
/** 单位 */
@Excel(name = "单位")
private String unit;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setFormat(String format)
{
this.format = format;
}
public String getFormat()
{
return format;
}
public void setUnit(String unit)
{
this.unit = unit;
}
public String getUnit()
{
return unit;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("format", getFormat())
.append("unit", getUnit())
.toString();
}
}
| [
"[email protected]"
]
| |
240076e0edb5a756145c30608e27eda25e17209e | a4f53e417d8a6268cd0412dba05a65c83acccd65 | /Online_read_source_code/While Loop/src/com/company/Even_Number.java | f5ba290e4e3d18dd029c18955991407b59a9b53f | []
| no_license | LalithaRajesh/My-Java-Learnings | bd4e63523319fd249183ab45978e347be3117994 | 42be72a619d68b1519ebcfbc8c1e76129b6b6a9d | refs/heads/master | 2021-05-18T22:05:16.807412 | 2020-06-15T22:43:58 | 2020-06-15T22:43:58 | 251,444,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 855 | java | package com.company;
public class Even_Number {
public static void main(String[] args) {
isEvenNumber(4);
isEvenNumber(9);
ischeckeven(6);
}
public static void isEvenNumber(int num) {
if(num % 2 == 0) {
System.out.println(num + " is a even number");
} else {
System.out.println(num + " is not a even number");
}
}
public static void ischeckeven(int num) {
int count = 1;
while (count <= 10) {
System.out.println("Count value was " + count);
count++;
}
for (int i = 10; i < 11; i++) {
if (num % 2 == 0) {
System.out.println(num + " is a even number");
} else {
System.out.println(num + " is not a even number");
}
}
}
}
| [
"[email protected]"
]
| |
a9d0b0d8eaadee50c44dcd1b44db8555bbc37421 | a5b7853f5cce068f8da48e607e02449c7e6d722f | /src/test/java/com/bbg/beacon/web/rest/AuditResourceIntTest.java | 3f96e6f19593afeca3811e703ca4fa9b58064de0 | []
| no_license | miketregan/beacon | cd52be3b118af63d1e9acff21af67981c89c52f2 | 0f08a6057d803c5f90f2f38c819514420e6a2899 | refs/heads/master | 2021-01-25T12:36:56.635794 | 2018-03-01T20:00:30 | 2018-03-01T20:00:30 | 123,485,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,939 | java | package com.bbg.beacon.web.rest;
import com.bbg.beacon.BeaconApp;
import com.bbg.beacon.config.audit.AuditEventConverter;
import com.bbg.beacon.domain.PersistentAuditEvent;
import com.bbg.beacon.repository.PersistenceAuditEventRepository;
import com.bbg.beacon.service.AuditEventService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the AuditResource REST controller.
*
* @see AuditResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = BeaconApp.class)
@Transactional
public class AuditResourceIntTest {
private static final String SAMPLE_PRINCIPAL = "SAMPLE_PRINCIPAL";
private static final String SAMPLE_TYPE = "SAMPLE_TYPE";
private static final Instant SAMPLE_TIMESTAMP = Instant.parse("2015-08-04T10:11:30Z");
private static final long SECONDS_PER_DAY = 60 * 60 * 24;
@Autowired
private PersistenceAuditEventRepository auditEventRepository;
@Autowired
private AuditEventConverter auditEventConverter;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private FormattingConversionService formattingConversionService;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
private PersistentAuditEvent auditEvent;
private MockMvc restAuditMockMvc;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
AuditEventService auditEventService =
new AuditEventService(auditEventRepository, auditEventConverter);
AuditResource auditResource = new AuditResource(auditEventService);
this.restAuditMockMvc = MockMvcBuilders.standaloneSetup(auditResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setConversionService(formattingConversionService)
.setMessageConverters(jacksonMessageConverter).build();
}
@Before
public void initTest() {
auditEventRepository.deleteAll();
auditEvent = new PersistentAuditEvent();
auditEvent.setAuditEventType(SAMPLE_TYPE);
auditEvent.setPrincipal(SAMPLE_PRINCIPAL);
auditEvent.setAuditEventDate(SAMPLE_TIMESTAMP);
}
@Test
public void getAllAudits() throws Exception {
// Initialize the database
auditEventRepository.save(auditEvent);
// Get all the audits
restAuditMockMvc.perform(get("/management/audits"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].principal").value(hasItem(SAMPLE_PRINCIPAL)));
}
@Test
public void getAudit() throws Exception {
// Initialize the database
auditEventRepository.save(auditEvent);
// Get the audit
restAuditMockMvc.perform(get("/management/audits/{id}", auditEvent.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.principal").value(SAMPLE_PRINCIPAL));
}
@Test
public void getAuditsByDate() throws Exception {
// Initialize the database
auditEventRepository.save(auditEvent);
// Generate dates for selecting audits by date, making sure the period will contain the audit
String fromDate = SAMPLE_TIMESTAMP.minusSeconds(SECONDS_PER_DAY).toString().substring(0,10);
String toDate = SAMPLE_TIMESTAMP.plusSeconds(SECONDS_PER_DAY).toString().substring(0,10);
// Get the audit
restAuditMockMvc.perform(get("/management/audits?fromDate="+fromDate+"&toDate="+toDate))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].principal").value(hasItem(SAMPLE_PRINCIPAL)));
}
@Test
public void getNonExistingAuditsByDate() throws Exception {
// Initialize the database
auditEventRepository.save(auditEvent);
// Generate dates for selecting audits by date, making sure the period will not contain the sample audit
String fromDate = SAMPLE_TIMESTAMP.minusSeconds(2*SECONDS_PER_DAY).toString().substring(0,10);
String toDate = SAMPLE_TIMESTAMP.minusSeconds(SECONDS_PER_DAY).toString().substring(0,10);
// Query audits but expect no results
restAuditMockMvc.perform(get("/management/audits?fromDate=" + fromDate + "&toDate=" + toDate))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(header().string("X-Total-Count", "0"));
}
@Test
public void getNonExistingAudit() throws Exception {
// Get the audit
restAuditMockMvc.perform(get("/management/audits/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
}
| [
"[email protected]"
]
| |
e10d5b2346682bea94dc5a6ff908d944d2f5adc5 | aa7b284666e4c1916bf1436d42ade2453660a9ca | /src/main/java/com/myfinances/auth/AuthInterceptor.java | b3593808030a08a5bf9c72d906febe744258c5bc | []
| no_license | samandmoore/myfinances | 3646414f42bccec5efe57f041e5984d19979334d | 78323a9627678d591eab3f9a9a17a677a25473e0 | refs/heads/main | 2023-06-24T12:34:18.259698 | 2013-08-26T02:43:36 | 2013-08-26T02:43:36 | 11,141,179 | 1 | 1 | null | 2023-06-18T17:39:59 | 2013-07-03T03:36:03 | CSS | UTF-8 | Java | false | false | 1,906 | java | package com.myfinances.auth;
import com.myfinances.users.IUserService;
import com.myfinances.users.User;
import com.myfinances.users.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AuthInterceptor extends HandlerInterceptorAdapter {
private final IAuthService authService;
private static final boolean ranOnce = false;
@Autowired
public AuthInterceptor(IAuthService authService, IUserService userService) {
this.authService = authService;
userService.create("sam", "[email protected]", "asdfasdf");
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (request.getRequestURI().startsWith(AuthConstants.LOGIN_URL)) {
return true;
}
boolean result = preHandleInternal(request, response);
if (!result) {
response.sendRedirect(AuthConstants.LOGIN_URL);
}
return result;
}
private boolean preHandleInternal(HttpServletRequest request, HttpServletResponse response) {
if (!authService.isAuthCookiePresent(request)) {
return false;
}
User user = authService.getCurrentUser(request);
if (user == null) {
return false;
}
updateRequest(request, response, user);
return true;
}
private void updateRequest(HttpServletRequest request, HttpServletResponse response, User user) {
Assert.notNull(user, "user must be logged in, cannot be null");
authService.login(request, response, user);
}
}
| [
"[email protected]"
]
| |
de01a969575742060439a3b551b886c9c58c43b4 | 5389a8c69c80029ec19bd8ffd1145a684ebe3764 | /ch07/fig07_11_13/DeckOfCardsTest.java | df3b577da70d52d351e7cc674aa41c3ab5a7776b | []
| no_license | elossi/Java-JHTP11ed | 2563dfbcab2761c0cefe8cdb6de0b56d671d95c9 | b498eb50f87aa367a25efb48f9939ad14135a5fd | refs/heads/master | 2022-11-15T13:50:24.754419 | 2020-07-02T06:03:14 | 2020-07-02T06:03:14 | 261,314,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,732 | java | // Fig. 7.13: DeckOfCardsTest.java
// Card shuffling and dealing.
public class DeckOfCardsTest {
// execute application
public static void main(String[] args) {
DeckOfCards myDeckOfCards = new DeckOfCards();
myDeckOfCards.shuffle(); // place Cards in random order
// print all 52 Cards in the order in which they are dealt
for (int i = 1; i <= 52; i++) {
// deal and display a Card
System.out.printf("%-19s", myDeckOfCards.dealCard());
if (i % 4 == 0) { // output a newline after every fourth card
System.out.println();
}
}
}
}
/**************************************************************************
* (C) Copyright 1992-2018 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
| [
"[email protected]"
]
| |
ae2a09c4c6c39b3653b7c4be2a56e6d68e123648 | ead8c163093453fdfff08858da363e6acda65d37 | /src/workflow/AbstractGraph.java | dfbd3b5596638b189e12cfa1594f32c653c7221c | []
| no_license | Fruit-Basket/WorkFlowSystemBaseOnAOE | c731750acd3f1beb51d0a09b1c84714544f26da9 | 48d05adb667df78da01b9d1ba207927d47f6bd20 | refs/heads/master | 2021-01-19T15:14:05.441808 | 2017-08-21T13:11:54 | 2017-08-21T13:11:54 | 100,953,681 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,012 | java | /**
* 基于AOE网的轻量工作流系统
* Author: FruitBasket
* Time: 2013/4/1
* Email: [email protected]
* Source code: github.com/Fruit-Basket
*/
package workflow;
import java.util.ArrayList;
import java.util.List;
/**
* 使用边的数组来存放边
* @author FruitBasket
*
*/
public abstract class AbstractGraph implements Graph {
protected List<String> vertices;
protected List<List<Integer>> neighbors;
protected AbstractGraph(int [][] edges,String[] vertices){
this.vertices=new ArrayList<String>();
for(int i=0;i<vertices.length;i++)
this.vertices.add(vertices[i]);
createAdjacencyLists(edges,vertices.length);
}
/**Create adjacency lists for each vertex*/
private void createAdjacencyLists(int[][] edges,int numberOfVertices){
neighbors=new ArrayList<List<Integer>>();
for(int i=0;i<numberOfVertices;i++){
neighbors.add(new ArrayList<Integer>());
}
for(int i=0;i<edges.length;i++){
int u=edges[i][0];
int v=edges[i][1];
neighbors.get(u).add(u);
}
}
/**Return the number of vertices in the graph*/
public int getSize() {
return vertices.size();
}
/**Return all the vertices in the graph*/
public List<String> getVertices() {
return vertices;
}
/**Return the object for the specified vertex*/
public String getVertex(int index) {
return vertices.get(index);
}
public int getIntex(String v) {
return vertices.indexOf(v);
}
/**Return the neighbors of vertax with the specified index*/
public List<Integer> getNeighbors(int index) {
return neighbors.get(index);
}
/**Return the out-degreee for a specified vertex*/
public int getDegree(int v) {
return neighbors.get(v).size();
}
/**An inner class inside the AbstarctGraph class,which to mean a edge*/
public static class Edge{
public int u;//starting vertex of the edge
public int v;//ending vertex of the edge
public Edge(int u,int v){
this.u=u;
this.v=v;
}
}
}
| [
"[email protected]"
]
| |
50e6ff661bd15db018d10527ed9ded859f5a7015 | e571b40200f7b275f246904094a00fdb4046e0de | /cloud-gateway-conf-9527/src/main/java/com/xcx/springcloud/gateway/filter/MyGatewayFilter.java | 5f0eb08d94c2706d9b2cae4f4b6353e9ae133517 | []
| no_license | xcx-scanner/cloudproject | 876269db97b5ce06aad4e04844f0ddb5b288fae3 | 9d452056c12d66c04f6b84f1c019cba9fcd75ab3 | refs/heads/master | 2022-07-07T04:54:34.899928 | 2020-04-24T08:10:12 | 2020-04-24T08:10:12 | 258,231,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,756 | java | package com.xcx.springcloud.gateway.filter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
/**
* @Auther: 自定义网关过滤器
* @Date: 2020/4/22 12:58
* @Description:
*/
@Component
@Slf4j
public class MyGatewayFilter implements GlobalFilter,Ordered {
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
log.info("*****全局自定义过滤器****");
//获取reqeust对象
ServerHttpRequest request = exchange.getRequest();
//获取所有参数
MultiValueMap<String, String> queryParams = request.getQueryParams();
//获取指定参数
String username = queryParams.getFirst("username");
//比如这里判断如果username为null返回
if(username==null){
System.out.println("。。。。参数为null。。。。");
//返回响应
exchange.getResponse().setStatusCode(HttpStatus.NOT_ACCEPTABLE);
return exchange.getResponse().setComplete();
}
return chain.filter(exchange);
}
/**
* 加载过滤器的顺序,值越小越高
* @param:
* @return:
* @auther: 肖朝翔
* @date: 2020/4/22 13:00
*/
@Override
public int getOrder() {
return 0;
}
}
| [
"[email protected]"
]
| |
d1b74fcf3d9e432ec9e59602cec72283a0090412 | 0ae199a25f8e0959734f11071a282ee7a0169e2d | /core/api/src/main/java/org/onosproject/net/EdgeLink.java | 914d6a41b79a7f109f91d9c8842f64df46362073 | [
"Apache-2.0"
]
| permissive | lishuai12/onosfw-L3 | 314d2bc79424d09dcd8f46a4c467bd36cfa9bf1b | e60902ba8da7de3816f6b999492bec2d51dd677d | refs/heads/master | 2021-01-10T08:09:56.279267 | 2015-11-06T02:49:00 | 2015-11-06T02:49:00 | 45,652,234 | 0 | 1 | null | 2016-03-10T22:30:45 | 2015-11-06T01:49:10 | Java | UTF-8 | Java | false | false | 1,164 | java | /*
* Copyright 2014 Open Networking Laboratory
*
* 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.onosproject.net;
/**
* Abstraction of a link between an end-station host and the network
* infrastructure.
*/
public interface EdgeLink extends Link {
/**
* Returns the host identification.
*
* @return host identifier
*/
HostId hostId();
/**
* Returns the connection point where the host attaches to the
* network infrastructure.
*
* @return host location point
*/
HostLocation hostLocation();
}
| [
"[email protected]"
]
| |
b7c56da57b27b10b713148f70931b34c455f3d01 | 777640a710ed839bc0b7ce3d79d305bd595c7ac8 | /spring-framework-custom-14/src/main/java/com/xufangfang/spring/framework/factory/support/ListableBeanFactory.java | 7b5bfafa4d274a4642c47fc63ea56c06faca84a3 | []
| no_license | fangfangxu/Spring-family | 2485713a1f75577ad4aff5c4c303045fca5add22 | 7f6704f9d266819dba896e63ca749b84fd661e1f | refs/heads/master | 2022-12-31T17:54:10.116544 | 2020-06-09T18:30:39 | 2020-06-09T18:30:39 | 263,952,004 | 0 | 0 | null | 2020-10-13T22:30:40 | 2020-05-14T15:25:11 | Java | UTF-8 | Java | false | false | 754 | java | package com.xufangfang.spring.framework.factory.support;
import com.xufangfang.spring.framework.factory.BeanFactory;
import java.util.List;
/**
*
* //TODO 可列表化的展示Spring容器中的bean实例
*/
public interface ListableBeanFactory extends BeanFactory {
/**
* 可以根据参数获取它子类型的实例,比如传递Object.class,
* 则说明获取的是所有的实例对象
* @param clazz
* @return
*/
List<Object> getBeansByType(Class<?> clazz);
/**
* 可以根据参数获取它子类型的实例,比如传递Object.class,
* 则说明获取的是所有的实例对象的名称
* @param clazz
* @return
*/
List<Object> getBeanNamesByType(Class<?> clazz);
}
| [
"[email protected]"
]
| |
8f74601d5a3bc41ad584008a03f0ecf3c9f72d9b | a5c0afe0edf94e2019c6049b1300eeb19de67c3b | /Employee Management/src/main/java/com/nagarro/springboot/SpringbootCrudRestfulWebservicesApplication.java | 5f45bcab821e51d285ba203daaab23f501055f44 | []
| no_license | colourful-breeze19/AdvanceJava-SpringBoot | f45262b32786f0791b4edabd6c8a572890e7e9f7 | 60016b39fd7e9448937d29394fda9cb31206b847 | refs/heads/master | 2023-06-05T14:44:34.255002 | 2021-06-23T09:52:39 | 2021-06-23T09:52:39 | 379,361,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.nagarro.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author chahat
*
*/
@SpringBootApplication
public class SpringbootCrudRestfulWebservicesApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootCrudRestfulWebservicesApplication.class, args);
}
}
| [
"[email protected]"
]
| |
fa284416cb638d7a51136fb570a070f487bdb183 | bc0449a5735009ea61f5392a838e4d282e315774 | /src/ru/mishapan/isoscelestriangle/main/Main.java | 8d80f046bf0a433ffa82873d83975b07a297c74e | []
| no_license | Michaelpan21/SFT_Focus_Start | 4da40c5552a2d7c3f888747d6c8a62a13bbb4c29 | 2ae4cdfee74e069d5821f36e6b0c555be424c71c | refs/heads/master | 2020-08-07T13:02:04.261255 | 2019-10-15T10:44:08 | 2019-10-15T10:44:08 | 213,461,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 977 | java | package ru.mishapan.isoscelestriangle.main;
import ru.mishapan.isoscelestriangle.filereaderwriter.TriangleReader;
import ru.mishapan.isoscelestriangle.filereaderwriter.FileWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
public class Main {
/**
* Reads coordinates from file and save the largest
* Writes coordinates to file
*
* @param args contains name of input file and name of output file
*/
public static void main(String[] args) {
if (args.length != 2) {
throw new IllegalArgumentException("Type two files");
}
Path filePathIn = Paths.get(args[0]).toAbsolutePath().normalize();
Path filePathOut = Paths.get(args[1]).toAbsolutePath().normalize();
TriangleReader fileIn = new TriangleReader();
fileIn.readAndSave(filePathIn.toString());
FileWriter fileOut = new FileWriter();
fileOut.write(filePathOut.toString(), fileIn.getList());
}
}
| [
"[email protected]"
]
| |
8f9a31bc73d59aedeff396fbf8154d9384a2dfc5 | c50b572406c66650b6f0692552beef7a05675d9b | /src/inter/amazonJoe.java | 0809eac3a644a107ad495dc736d55a29d328b486 | []
| no_license | joetomjob/JMJ | d786aa36d62be8e25e61343cdf031785b35293a3 | a94e60599bb9ed7197f83fd9eaad4cb78cf5a2f2 | refs/heads/master | 2021-06-01T13:52:05.406038 | 2020-10-24T23:10:31 | 2020-10-24T23:10:31 | 111,360,105 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,961 | java | package inter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created by joetomjob on 8/18/19.
*/
public class amazonJoe {
public static int minimumTime(int numOfParts, List<Integer> parts)
{
if(parts.size() == 0) {
return 0;
}
if(parts.size() == 1) {
return parts.get(0);
}
int sum = 0;
for (int i = 0; i < parts.size(); i++) {
int[] small = smallestElement(parts);
sum += small[0] + small[1];
}
return sum;
}
static int[] smallestElement(List<Integer> parts) {
int f = Integer.MAX_VALUE, s = Integer.MAX_VALUE;
int findex = -1, sindex = -1;
for (int i = 0; i < parts.size(); i++) {
if(parts.get(i) < f && parts.get(i) > -1) {
s = f;
sindex = findex;
f = parts.get(i);
findex = i;
} else if (parts.get(i) < s && parts.get(i) > -1) {
s = parts.get(i);
sindex = i;
}
}
int[] small = new int[2];
small[0] = f;
parts.set(findex, f+s);
if(s < Integer.MAX_VALUE) {
small[1] = s;
parts.set(sindex, -1);
} else {
small[0] =0;
}
return small;
}
public static void main(String[] args) {
List<Integer> l = new ArrayList<>();
l.add(8);
l.add(4);
l.add(6);
l.add(12);
// for (int i = 0; i < l.size(); i++) {
// System.out.print(l.get(i));
// System.out.print('\t');
// }
int res = minimumTime(l.size(),l);
System.out.print(res);
// Collections.sort(l);
// System.out.print('\n');
// for (int i = 0; i < l.size(); i++) {
// System.out.print(l.get(i));
// System.out.print('\t');
// }
}
}
| [
"[email protected]"
]
| |
a866c541fb482b558dd71f990b9f5dee10635c69 | 1ec7ca713f7ff3132efbef515354cc386652bdb2 | /src/main/java/com/kaikeba/app/action/OrderAction.java | c8a9a5212d1bbe8c50fae1a6ba416f395eef7461 | []
| no_license | kaikebaH/ssm | c25969506ca7f843d3a59716dcf8abf3ca3d9247 | 611b666b8486c584356d44f97978ad61bb76b95a | refs/heads/master | 2021-01-01T19:37:07.924870 | 2017-07-28T08:28:44 | 2017-07-28T08:28:44 | 98,627,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,174 | java | package com.kaikeba.app.action;
import com.kaikeba.app.entity.*;
import com.kaikeba.app.service.ICartItemService;
import com.kaikeba.app.service.IOrderService;
import com.kaikeba.app.utils.CommonUtils;
import com.kaikeba.app.utils.paymentUtils;
import com.kaikeba.commons.PageBean;
import com.kaikeba.commons.PropKit;
import com.kaikeba.commons.StrKit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
/**
* Created by Administrator on 2017/7/26.
*/
@Controller
@RequestMapping("/orderAction")
public class OrderAction {
@Autowired
private IOrderService orderService;
@Autowired
private ICartItemService cartItemService;
@RequestMapping("/listOrdersByUser")
public String listOrdersByUser(HttpServletRequest request){
User user = (User) request.getSession().getAttribute("user");
PageBean<Order> pb = this.getpb(request);
pb.setList(orderService.getOrdersByUid(user.getUid(), pb));
pb.setTotalRecords(orderService.countOrderByUid(user.getUid()));
request.setAttribute("pb",pb);
return "forward:/jsps/order/list.jsp";
}
@RequestMapping("/saveOrder")
public String saveOrder(@RequestParam String cartItemIds,@RequestParam String address,HttpServletRequest request){
User user = (User) request.getSession().getAttribute("user");
Order order = new Order();
order.setOid(CommonUtils.uuid());
order.setAddress(address);
order.setUser(user);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String ordertime = dateFormat.format(new Date());
order.setOrdertime(ordertime);
order.setStatus(1);
List<OrderItem> orderItems = new ArrayList<OrderItem>();
List<CartItem> cartItems = cartItemService.loadCartItems(cartItemIds.split(","));
for (CartItem cartItem : cartItems) {
OrderItem orderItem = new OrderItem();
orderItem.setOrderItemId(CommonUtils.uuid());
orderItem.setQuantity(cartItem.getQuantity());
orderItem.setSubtotal(cartItem.getSubtotal());
orderItem.setBook(cartItem.getBook());
orderItem.setBname(cartItem.getBook().getBname());
orderItem.setCurrPrice(cartItem.getBook().getCurrPrice());
orderItem.setImage_b(cartItem.getBook().getImage_b());
orderItem.setOrder(order);
orderItems.add(orderItem);
}
BigDecimal totaldDecimal = new BigDecimal("0");
for (OrderItem orderItem : orderItems) {
totaldDecimal = totaldDecimal.add(new BigDecimal(orderItem.getSubtotal() + ""));
}
order.setTotal(totaldDecimal.doubleValue());
// 给订单增加订单明细的数据
order.setOrderItemList(orderItems);
orderService.add(order);
//删除购物车数据
cartItemService.delCartItemByCartItemIds(cartItemIds.split(","));
request.setAttribute("order", order);
return "forward:/jsps/order/ordersucc.jsp";
}
@RequestMapping("/getOrderByOid")
public String getOrderByOid(@RequestParam String oid,HttpServletRequest request){
Order order = orderService.getOrderByOid(oid);
request.setAttribute("order", order);
return "forward:/jsps/order/desc.jsp";
}
@RequestMapping("/delOrder")
public String delOrder(@RequestParam String oid ,HttpServletRequest request){
orderService.delOrderByOid(oid);
User user = (User) request.getSession().getAttribute("user");
PageBean<Order> pb = this.getpb(request);
pb.setList(orderService.getOrdersByUid(user.getUid(), pb));
pb.setTotalRecords(orderService.countOrderByUid(user.getUid()));
request.setAttribute("pb",pb);
return "forward:/jsps/order/list.jsp";
}
@RequestMapping("/confirmReceipt")
public String confirmReceipt(@RequestParam String oid,HttpServletRequest request){
User user = (User) request.getSession().getAttribute("user");
orderService.updateStatusByOid(oid);
PageBean<Order> pb = this.getpb(request);
pb.setList(orderService.getOrdersByUid(user.getUid(), pb));
pb.setTotalRecords(orderService.countOrderByUid(user.getUid()));
request.setAttribute("pb",pb);
return "forward:/jsps/order/list.jsp";
}
//提交orderId和订单金额到支付页面
@RequestMapping("/paymentPre")
public String paymentPre(@RequestParam String oid,HttpServletRequest request){
Order order = orderService.getOrderByOid(oid);
request.setAttribute("order", order);
return "forward:/jsps/order/pay.jsp";
}
@RequestMapping("/payment")
public String payment(HttpServletRequest request,HttpServletResponse response){
try {
String p0_Cmd = "Buy";
Properties properties = new Properties();
InputStream is = OrderAction.class.getResourceAsStream("/mercmantInfo.properties");
properties.load(is);
String p1_MerId = properties.getProperty("p1_MerId");
String p2_Order = request.getParameter("oid");
String p3_Amt = "0.01";
String p4_Cur = "CNY";
String p5_Pid = "";
String p6_Pcat = "";
String p7_Pdesc = "";
String p8_Url = properties.getProperty("responseURL");
String p9_SAF = "";
String pa_MP = "";
String pd_FrpId = request.getParameter("yh");
String pr_NeedResponse = "1";
String keyValue = properties.getProperty("KeyValue");
String hmac = paymentUtils.buildHmac(p0_Cmd, p1_MerId, p2_Order,
p3_Amt, p4_Cur, p5_Pid, p6_Pcat,
p7_Pdesc, p8_Url, p9_SAF, pa_MP, pd_FrpId,
pr_NeedResponse, keyValue);
StringBuilder sb = new StringBuilder("https://www.yeepay.com/app-merchant-proxy/node");
sb.append("?").append("p0_Cmd=").append(p0_Cmd);
sb.append("&").append("p1_MerId=").append(p1_MerId);
sb.append("&").append("p2_Order=").append(p2_Order);
sb.append("&").append("p3_Amt=").append(p3_Amt);
sb.append("&").append("p4_Cur=").append(p4_Cur);
sb.append("&").append("p5_Pid=").append(p5_Pid);
sb.append("&").append("p6_Pcat=").append(p6_Pcat);
sb.append("&").append("p7_Pdesc=").append(p7_Pdesc);
sb.append("&").append("p8_Url=").append(p8_Url);
sb.append("&").append("p9_SAF=").append(p9_SAF);
sb.append("&").append("pa_MP=").append(pa_MP);
sb.append("&").append("pd_FrpId=").append(pd_FrpId);
sb.append("&").append("pr_NeedResponse=").append(pr_NeedResponse);
sb.append("&").append("hmac=").append(hmac);
response.sendRedirect(sb.toString());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return null;
}
@RequestMapping("/back")
public String back(HttpServletRequest request,HttpServletResponse response){
//获取返回的数据
try {
String p1_MerId = request.getParameter("p1_MerId");
String r0_Cmd = request.getParameter("p0_Cmd");
String r1_Code = request.getParameter("r1_Code");
String r2_TrxId = request.getParameter("r2_TrxId");
String r3_Amt = request.getParameter("r3_Amt");
String r4_Cur = request.getParameter("r4_Cur");
String r5_Pid = request.getParameter("r5_Pid");
String r6_Order = request.getParameter("r6_Order");
String r7_Uid = request.getParameter("r7_Uid");
String r8_MP = request.getParameter("r8_MP");
String r9_BType = request.getParameter("r9_BType");
String hmac = request.getParameter("hmac");
Properties properties = new Properties();
InputStream is = OrderAction.class.getResourceAsStream("/mercmantInfo.properties");
properties.load(is);
String keyValue = properties.getProperty("KeyValue");
boolean bool = paymentUtils.verifyCallback(hmac, p1_MerId, r0_Cmd, r1_Code,
r2_TrxId, r3_Amt, r4_Cur, r5_Pid, r6_Order,
r7_Uid, r8_MP, r9_BType, keyValue);
if(!bool){
request.setAttribute("code", "error");
request.setAttribute("msg", "无效的签名,支付失败!");
return "forward:/jsps/msg.jsp";
}
if("1".equals(r1_Code)){
orderService.updateStatusByOid(r6_Order,2);
if(r9_BType.equals("1")){
request.setAttribute("code", "success");
request.setAttribute("msg", "支付成功!");
return "forward:/jsps/msg.jsp";
}else if(r9_BType.equals("2")){
response.getWriter().write("success");
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return "";
}
private PageBean<Order> getpb(HttpServletRequest request){
PageBean<Order> pb = new PageBean<Order>();
pb.setPageNumber(this.getPageNum(request));
pb.setUrl(this.getUrl(request));
pb.setPageSize(PropKit.use("pagesize.properties").getInt("order_pageSize"));
return pb;
}
/**
* 从请求流中获取前台传递过来的当前页的页码
* @param request
* @return
*/
private int getPageNum(HttpServletRequest request){
try {
String pageNumber = request.getParameter("pageNumber");
if(StrKit.notBlank(pageNumber)){
//pageNumber不为空,说明当前不是第一页
return Integer.parseInt(pageNumber);
}else {
//pageNumber为空,当前页为第一页
return 1;
}
} catch (NumberFormatException e) {
throw new RuntimeException(e.getMessage(),e);
}
}
/**
* 动态获取前台传递过来的url
* @param request
* @return
*/
private String getUrl(HttpServletRequest request){
try {
String uri = request.getRequestURI();// 得到的是:/ssm/bookAction/getBooksByCategoryId
//request.getRequestURL(); //得到的是:http://localhost/ssm/bookAction/getBooksByCategoryId
String queryString = request.getQueryString(); //得到请求地址 ? 后面的值
//如果请求地址为:/ssm/bookAction/getBooksByCategoryId
if(queryString == null){
return uri;
}else {
//如果请求地址为:/ssm/bookAction/getBooksByCategoryId?pageNumber=2
if(queryString.indexOf("pageNumber=") == 0){
return uri;
}
//如果请求地址为:/ssm/bookAction/getBooksByCategoryId?bname=java&pageNumber=2
if(queryString.contains("&pageNumber=")){
return uri + "?" + queryString.substring(0,queryString.lastIndexOf("&pageNumber="));
//substring:前闭后开
}
//如果请求地址为:/ssm/bookAction/getBooksByCategoryId?bname=java(不需要分页)
return uri + "?" + queryString;
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage(),e);
}
}
}
| [
"[email protected]"
]
| |
8d3616916a18f8edb6362e086d8995e13e8bfeb9 | 3df715c046ce3d96680b3df88ca26a048fb3c71d | /src/문제집/backjoon/부분합/Main.java | c071814cd68b644cb784983c7d8bb5a122f5e18d | []
| no_license | camel-man-ims/algorithm-collection | 79163d0f0681b4e682ed14b3ac3cc499e832204d | 225473c41f206337de9c97a33ea92414f2793c37 | refs/heads/main | 2022-12-27T04:52:59.505738 | 2022-11-16T15:23:14 | 2022-11-16T15:23:14 | 303,552,853 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,261 | java | package 문제집.backjoon.부분합;
import java.io.*;
import java.util.StringTokenizer;
public class Main {
static int N,S;
static int[] arr;
static int answer;
public static void main(String[] args) throws IOException {
System.setIn(new FileInputStream("./src/backjoon/부분합/input.txt"));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st = new StringTokenizer(br.readLine()," ");
N = Integer.parseInt(st.nextToken());
S = Integer.parseInt(st.nextToken());
arr = new int[N];
st = new StringTokenizer(br.readLine()," ");
for(int i=0;i<N;i++){
arr[i] = Integer.parseInt(st.nextToken());
}
int left=0,right = 0;
int sum = 0;
answer = Integer.MAX_VALUE;
while(true){
if(sum>=S){
answer = Math.min(answer,right-left);
sum -= arr[left++];
}else if(right == N){
break;
}else{
sum += arr[right++];
}
}
System.out.println(answer == Integer.MAX_VALUE ? 0 : answer);
}
}
| [
"[email protected]"
]
| |
71898848897a75c32dd08eabceaf258c6d7d381e | 6bf994a02a21c5a190918973804277773b001878 | /motanServiceBoot/src/main/java/com/MotanServiceBoot/starter/condition/BasicServiceConfigCondition.java | d736e9c052c09b3412bceb1518c95b6c387e95e6 | []
| no_license | TopJames/SpringCloudDemo | 9ef135dc57d20982e7b54788c06f10277b558ef1 | 6b012cec1cec40c6d30705521b1adc077b656aa2 | refs/heads/master | 2020-03-13T14:08:47.918525 | 2020-01-20T09:13:21 | 2020-01-20T09:13:21 | 131,152,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.MotanServiceBoot.starter.condition;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;
public class BasicServiceConfigCondition implements Condition{
@Override
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
Environment env = conditionContext.getEnvironment();
return (!StringUtils.isEmpty(env.getProperty("motan.basicservice.exportPort"))
|| !StringUtils.isEmpty(env.getProperty("motan.basicservice.export")));
}
}
| [
"[email protected]"
]
| |
36886944f8e1d168769612133f0a47ad9b7bb602 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_dee9420cdab18b1fbd79fd64240c202c07a01842/MethodInvokerUtils/9_dee9420cdab18b1fbd79fd64240c202c07a01842_MethodInvokerUtils_t.java | 3792d742d1f1d76f1f481cc19ddb95d11d259461 | []
| 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 | 6,091 | java | /*
* Copyright 2002-2008 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.batch.support;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicReference;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
/**
* Utility methods for create MethodInvoker instances.
*
* @author Lucas Ward
* @since 2.0
*/
public class MethodInvokerUtils {
/**
* Create a {@link MethodInvoker} using the provided method name to search.
*
* @param object to be invoked
* @param methodName of the method to be invoked
* @param paramsRequired boolean indicating whether the parameters are
* required, if false, a no args version of the method will be
* searched for.
* @param paramTypes - parameter types of the method to search for.
* @return MethodInvoker if the method is found, null if it is not.
*/
public static MethodInvoker createMethodInvokerByName(Object object, String methodName, boolean paramsRequired,
Class<?>... paramTypes) {
Assert.notNull(object, "Object to invoke must not be null");
Method method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, paramTypes);
// if no method was found for the given parameters, and the parameters
// aren't required
if (method == null && !paramsRequired) {
// try with no params
method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, new Class[] {});
}
if (method == null) {
return null;
}
else {
return new SimpleMethodInvoker(object, method);
}
}
/**
* Create a {@link MethodInvoker} using the provided interface, and method
* name from that interface.
*
* @param cls the interface to search for the method named
* @param methodName of the method to be invoked
* @param object to be invoked
* @param paramTypes - parameter types of the method to search for.
* @return MethodInvoker if the method is found, null if it is not.
*/
public static MethodInvoker getMethodInvokerForInterface(Class<?> cls, String methodName, Object object,
Class<?>... paramTypes) {
if (cls.isAssignableFrom(object.getClass())) {
return MethodInvokerUtils.createMethodInvokerByName(object, methodName, true, paramTypes);
}
else {
return null;
}
}
/**
* Create {@link MethodInvoker} for the method with the provided annotation
* on the provided object. It should be noted that annotations that cannot
* be applied to methods (i.e. that aren't annotated with an element type of
* METHOD) will cause an exception to be thrown.
*
* @param annotationType to be searched for
* @param candidate to be invoked
* @return MethodInvoker for the provided annotation, null if none is found.
*/
public static MethodInvoker getMethodInvokerByAnnotation(final Class<? extends Annotation> annotationType,
final Object candidate) {
Assert.notNull(candidate, "class must not be null");
Assert.notNull(annotationType, "annotationType must not be null");
Assert.isTrue(ObjectUtils.containsElement(annotationType.getAnnotation(Target.class).value(),
ElementType.METHOD), "Annotation [" + annotationType + "] is not a Method-level annotation.");
final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>();
ReflectionUtils.doWithMethods(candidate.getClass(), new ReflectionUtils.MethodCallback() {
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
Annotation annotation = AnnotationUtils.findAnnotation(method, annotationType);
if (annotation != null) {
Assert.isNull(annotatedMethod.get(), "found more than one method on target class ["
+ candidate.getClass().getSimpleName() + "] with the annotation type ["
+ annotationType.getSimpleName() + "].");
annotatedMethod.set(method);
}
}
});
Method method = annotatedMethod.get();
if (method == null) {
return null;
}
else {
return new SimpleMethodInvoker(candidate, annotatedMethod.get());
}
}
/**
* Create a {@link MethodInvoker} for the delegate from a single public
* method with the signature provided.
*
* @param candidate an object to search for an appropriate method
* @return a MethodInvoker that calls a method on the delegate
*/
public static <C, T> MethodInvoker getMethodInvokerForSingleArgument(Object candidate) {
final AtomicReference<Method> methodHolder = new AtomicReference<Method>();
ReflectionUtils.doWithMethods(candidate.getClass(), new ReflectionUtils.MethodCallback() {
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) {
return;
}
if (method.getReturnType().equals(Void.TYPE) || ReflectionUtils.isEqualsMethod(method)) {
return;
}
Assert.state(methodHolder.get() == null,
"More than one non-void public method detected with single argument.");
methodHolder.set(method);
}
});
Method method = methodHolder.get();
return new SimpleMethodInvoker(candidate, method);
}
}
| [
"[email protected]"
]
| |
5dcb5a5ad29d3c5e47a378da30d990ef45a28239 | c4faf92837f3c163be4f0089adfbc60828b7fce3 | /src/by/it/tarasiuk/jd01_15/TaskA.java | fa83ea9317888d3f1883039ccbffe550e9512c7b | []
| no_license | AlexandrRogov/JD2018-04-11 | f3407f240f0dcfa76d4a56346c40e606f49764bb | 4597619c75cbf8e5b35ed72ad5808413502b57e2 | refs/heads/master | 2020-03-15T11:50:33.268173 | 2018-07-05T23:21:10 | 2018-07-05T23:21:10 | 132,129,820 | 0 | 1 | null | 2018-05-04T11:09:42 | 2018-05-04T11:09:41 | null | UTF-8 | Java | false | false | 1,462 | java | package by.it.tarasiuk.jd01_15;
import java.io.*;
public class TaskA {
private static String path(Class<?> cl) {
String rootPrj = System.getProperty("user.dir");
String path = cl.getName()
.replaceAll(cl.getSimpleName(), "")
.replace('.', File.separator.charAt(0));
path = rootPrj + File.separator + "src" + File.separator + path;
return path;
}
static String path(String filename) {
return path(TaskA.class) + filename;
}
public static void main(String[] args) {
int[][] intMatrix = new int[6][4];
for (int[] row : intMatrix)
for (int i = 0; i < row.length; i++)
row[i] = (-15 + (int) (Math.random() * 31));
String filename = path("matrix.txt");
try (PrintWriter printWriter = new PrintWriter(new FileWriter(filename))) {
for (int[] row : intMatrix) {
for (int i = 0; i < row.length; i++)
printWriter.printf("%3d ", row[i]);
printWriter.println();
}
} catch (IOException e) {
e.printStackTrace();
}
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(filename))) {
while (bufferedReader.ready()) {
System.out.println(bufferedReader.readLine());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
37000cdab6eaa894c9278bdaab53c8db448cbd96 | e270c6f5a7d2432297eab900894389f8f8764495 | /Ass01Calculator/app/src/androidTest/java/com/example/ass01_calculator/ExampleInstrumentedTest.java | 4948b99aaddd81a89c1b5f38f80b5a29a521a1fb | []
| no_license | Huy1411/Android | 1af5b605ff6c9c023250cd94aa8dfc40e2787b58 | 7a4a23ccde618d836104b5eb2d92d0ba05c0ea48 | refs/heads/main | 2023-06-06T00:03:57.803961 | 2021-06-21T02:24:40 | 2021-06-21T02:24:40 | 371,236,026 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package com.example.ass01_calculator;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.ass01_calculator", appContext.getPackageName());
}
} | [
"[email protected]"
]
| |
0da9fcad90e0bb5b0d8ff6888bf99d52748997cb | 7f96515ad18b5f7c2dac0446823e3cff85c00b21 | /src/com/code/MergeSort.java | 11ec1c6a3128906c97281fbb28ce4ea2cd879bbb | []
| no_license | netesh3/SortingAlgorithm | 8bf530271735d0927e656807c61742f0aab31c79 | ed28a3fcc4a30e8ad4e1ef48249dd0b6bc03daa3 | refs/heads/master | 2020-04-18T08:19:07.606763 | 2019-01-25T20:45:01 | 2019-01-25T20:45:01 | 167,392,217 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46 | java | package com.code;
public class MergeSort {
}
| [
"[email protected]"
]
| |
17eba676d6faee292dbefebfbf2dab23810edd5b | 70a7bb238a9d4395a2a660b4a907b95672f4a052 | /app/src/test/java/com/anwesh/uiprojects/linkedxtoyballview/ExampleUnitTest.java | 6f6c224cee5319caffc9a21df3920d6669c78273 | []
| no_license | Anwesh43/LinkedXTOYBallView | 01fe2d2a4b697605ec6c2d9afc22e1f28f2b5034 | 34efa54d96d3c0f024246af6ef60e17c155312e3 | refs/heads/master | 2020-03-24T01:52:32.926933 | 2018-07-26T04:45:16 | 2018-07-26T04:45:16 | 142,354,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.anwesh.uiprojects.linkedxtoyballview;
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);
}
} | [
"[email protected]"
]
| |
4fcfaf825578d967073ea92c4729f93477575095 | 879e4e9846df1f1b41aec4b13e88e18bf928f09c | /src/main/java/com/web/kpbanking/services/MembersService.java | b6c6ddad07b1ca2603b9251522ac281c155b5b5d | []
| no_license | KingCarmo/KPBanking | 2a9afc861e936deebbc70e3e0df3d57d0c90dfaf | 17d2ee2eb86ce93258b8a92a1f62d13ba01667e7 | refs/heads/master | 2020-04-10T14:07:57.782577 | 2018-12-09T22:18:29 | 2018-12-09T22:18:29 | 161,068,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,328 | java | package com.web.kpbanking.services;
import com.web.kpbanking.GetsSets.Members;
import com.web.kpbanking.database.Database;
/**
*
* @author Kevin Carmody && Peter Finegan w/ help of my cousin who helped me
* write the code for the service part
*
*/
public class MembersService {
/* creating database object - same concept from AccountsService */
Database data = new Database();
//constructor created
public MembersService() {
}
// creates a members object and Gathers
//all Members By There UniqID given to them from the database
public Members getMembersByUID(int uid) {
Members mid = new Members();
for (Members c : data.getMembersDB()) {
if (c.getMemberUniqID() == uid) {
mid = c;
}
}
return mid;
}
//Gather information from the Database.java file and
//Create Members to the database
public boolean addMember(Members c) {
data.addMembers(c);
return true;
}
// Delete Members from the DB
public boolean deleteMember(Members c) {
//Gather information from the Database.java file and
//Delete Members and account with UID
return data.deleteMember(c);
}
//Couldn't get code for Updating Members working, only create and delete :(
}
| [
"[email protected]"
]
| |
f3f3f8e247bcfa803582833d3c2809a847df1ac8 | 4005d1f8fd90c8a382b385159b5b10b89b24dd5b | /src/main/java/com/wisew/nioserver/Message.java | f9d9528fcc95819947f8ccbf92c0247eb9d7fb5f | [
"Apache-2.0"
]
| permissive | wisew/java-nio-server | 0c85c0fc1899db4eeec85bc6916e8c066b374cc9 | 5f4a6d556f9cebb29976116eebd1aa4b82d5097e | refs/heads/master | 2023-01-28T08:25:54.842189 | 2020-12-10T11:06:24 | 2020-12-10T11:06:24 | 320,217,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,031 | java | package com.wisew.nioserver;
import java.nio.ByteBuffer;
public class Message {
private MessageBuffer messageBuffer = null;
public long socketId = 0; // the id of source socket or destination socket, depending on whether is going in or out.
public byte[] sharedArray = null;
public int offset = 0; //offset into sharedArray where this message data starts.
public int capacity = 0; //the size of the section in the sharedArray allocated to this message.
public int length = 0; //the number of bytes used of the allocated section.
public Object metaData = null;
public Message(MessageBuffer messageBuffer) {
this.messageBuffer = messageBuffer;
}
// 把ByteBuffer中的数据写到MessageBuffer
public int writeToMessage(ByteBuffer byteBuffer) {
int remaining = byteBuffer.remaining();
while (this.length + remaining > capacity) {
// 如果扩展了,之前在小block中的数据已经复制到了扩容后的block中
if (!this.messageBuffer.expandMessage(this)) {
return -1;
}
}
int bytesToCopy = Math.min(remaining, this.capacity - this.length);
byteBuffer.get(this.sharedArray, this.offset + this.length, bytesToCopy);
this.length += bytesToCopy;
return bytesToCopy;
}
public int writeToMessage(byte[] byteArray) {
return writeToMessage(byteArray, 0, byteArray.length);
}
public int writeToMessage(byte[] byteArray, int offset, int length) {
int remaining = length;
while (this.length + remaining > capacity) {
if (!this.messageBuffer.expandMessage(this)) {
return -1;
}
}
int bytesToCopy = Math.min(remaining, this.capacity - this.length);
System.arraycopy(byteArray, offset, this.sharedArray, this.offset + this.length, bytesToCopy);
this.length += bytesToCopy;
return bytesToCopy;
}
public void writePartialMessageToMessage(Message message, int endIndex) {
int startIndexOfPartialMessage = message.offset + endIndex;
int lengthOfPartialMessage = (message.offset + message.length) - endIndex;
System.arraycopy(message.sharedArray, startIndexOfPartialMessage, this.sharedArray, this.offset, lengthOfPartialMessage);
}
public int writeToByteBuffer(ByteBuffer byteBuffer) {
return 0;
}
@Override
public String toString() {
byte[] content = new byte[length];
System.arraycopy(sharedArray,offset,content,0,length);
String describe = String.format(
"==============================\ntotal=%dKB\nblock=%dKB\noffset=%dKB\nlength=%d\ncontent=%s\nsocketId=%d\n==============================",
sharedArray.length / 1024,
capacity / 1024,
offset / 1024,
length,
new String(content),
this.socketId
);
return describe;
}
}
| [
"[email protected]"
]
| |
0f2bd56c720de5272755d4f95601769fde25319c | 69327c77b81a4ec3d119c9be03e672306e0d64a6 | /src/MemoryBase/UI.java | 1b72c3dac44a4640b01173acffc42da72e314e73 | []
| no_license | Group2BTB/MemoryBase | cae56af9af5233b90c454c3dab57219bd7e76726 | e18df58c96902935c93ff44ad10e4b47593f2714 | refs/heads/master | 2021-01-10T17:40:49.986969 | 2015-06-15T16:15:55 | 2015-06-15T16:15:55 | 36,208,060 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,385 | java | package MemoryBase;
import java.util.Scanner;
public class UI {
int width=79;
/**
* To show sequence of symbols in the first line of table
*/
public void line1(){
for(int i=0;i<width;i++){
if(i==0){
System.out.print("+");
}else if(i>=(width-1)){
System.out.print("+");
}else{
System.out.print("=");
}
}
System.out.println();
}
/**
* To show sequence of symbols in the second line of table (the first row of contents)
* @param str the content to display in table
* @param length the length of table
*/
public void line2(String str, int length){
length = length - str.length()+2;
int pos = length/2;
for(int i=0;i<length;i++){
if(i==0){
System.out.print("|");
}else{
if(i<length && i!=pos){
System.out.print(" ");
}else if(i==pos){
System.out.print(str);
}
}
}
}
/**
* To show sequence of symbols in the third line of table
* @param length the length of table to show
*/
public void line3(int length){
for(int i=0; i<length;i++){
if(i==0)
{ System.out.print("+");
continue;
}
System.out.print("=");
}
}
/**
* To show sequence of symbols in the forth line of table
* @param length the length of table to show
*/
public void line4(int length){
for(int i=0; i<length;i++){
if(i==0)
{ System.out.print("+");
continue;
}
System.out.print("-");
}
}
/**
* Display header of table
*/
public void table_head(){
String[] title_head = {"NO","Title","Author","Date"};
line1();
for(int i=0;i<4;i++){
if(i==0 || i==3)
line2(title_head[i],13);
else if(i==1 || i==2)
line2(title_head[i],24);
}
System.out.print("|");
System.out.println();
for(int i=0;i<4;i++){
if(i==0 || i==3)
line3(14);
else if(i==1 || i==2)
line3(25);
}
System.out.print("+");
System.out.println();
}
/**
* Display content of table in a row
* @param str content of table to show, if length of @param str greater than 15 it will concatenate with ...
* @param length the length of table to show
*/
public void table_body(String str,int length){
if (str.length()>15){
str = str.substring(0, 15)+"...";
}
int len = length - str.length();
for(int i=0;i<len;i++){
if(i==0){
System.out.print("|");
System.out.print(" "+str);
}
else
System.out.print(" ");
}
}
/**
* Display sequence of symbols concatenate with content in a row
* @param str content in each column
*/
public void tbl_row(String[] str){
for(int i=0;i<str.length;i++){
if(i==0 || i==3)
table_body(str[i],13);
else if(i==1 || i==2)
table_body(str[i],24);
}
System.out.print("|");
System.out.println();
for(int i=0;i<str.length;i++){
if(i==0 || i==3)
line4(14);
else if(i==1 || i==2)
line4(25);
}
System.out.print("+");
System.out.println();
}
/**
* Display sequence of symbols concatenate with page and total records to display in footer of table
* @param cur_page number represent current page
* @param count_page number represent total page
* @param record number represent total record
* @param length number represent length of table
*/
public void tbl_footer(int cur_page, int count_page, int record, int length){
int space = length - ("| pages: " + cur_page + "/" + count_page + "Total records: "+record+" ").length();
System.out.print("| pages: " + cur_page + "/" + count_page);
for(int i=0;i<space-1;i++){
System.out.print(" ");
}
System.out.print("Total records: "+record+" |");
System.out.println();
line1();
}
/**
* Descript the members of group who make this application
*/
public void head(){
System.out.println("+======================>} Korean Software HTD Center {<=======================+");
System.out.println("| |");
System.out.println("| Article Management |");
System.out.println("| |");
System.out.println("| *Team 2 Of Battambong |");
System.out.println("| -> Chann Vichet (GL) |");
System.out.println("| -> Chan Sophath |");
System.out.println("| -> Nao Narith |");
System.out.println("| -> Prem Chanthorn |");
System.out.println("| -> Sry Leangheng |");
System.out.println("| -> Thorn Sereyvong |");
System.out.println("|_____________________________________________________________________________|");
System.out.println("");
}
/**
* Display Menu for user on startup
*/
public void menu(){
System.out.println("+=================================>} MENU {<==================================+");
System.out.println("| HM)Home X)Exit |");
System.out.println("| F)First | P)Previous | N)Next | L)Last | G)Goto | R)Set Row X)Exit |");
System.out.println("| S)Search| RD)Read | A)Add | E)Edit | D)Delete | DL)Delete-All | H)Help |");
System.out.println("|_____________________________________________________________________________|");
System.out.print("\n*Choose: ");
}
/**
* Display Thank when user exit
*/
public void thanks(){
System.out.println("____________________________________-Thanks-___________________________________");
}
/**
* Show how to use all commands with example for user to use this application
*/
public void help(){
System.out.println("+=================================>} HELP {<==================================+");
System.out.println("| 1. F)First : Goto the first page. (*Choose: F) |");
System.out.println("| 2. P)Previous : Previous page. (*Choose: P) |");
System.out.println("| 3. N)Next : Next page. (*Choose: N) |");
System.out.println("| 4. L)Last : Goto the last page. (*Choose: L) |");
System.out.println("| 5. G)Goto : Goto the page. (*Choose: G 12) |");
System.out.println("| 6. R)Set Row : Set row to dispay in page. (*Choose: R 20) |");
System.out.println("| 7. RD)Read : Read by ID. (*Choose: RD 8) |");
System.out.println("| 8. S)Search : Filter by Title, Contain or Author (*Choose: S AJAX) |");
System.out.println("| 9. A)Add : Add new Article. (*Choose: I) |");
System.out.println("| 10. E)Edit : Edit Article by ID. (*Choose: E 10) |");
System.out.println("| 11. D)Delete : Delete Article by ID. (*Choose: D 10) |");
System.out.println("| 12. DL)Delete-All : Delete All Article. (*Choose: DL) |");
System.out.println("| 13. H)Help : Guiline application. (*Choose: H) |");
System.out.println("| 14. X)Exit : Exit application. (*Choose: X) |");
System.out.println("| 15. HM)Home : Home page. (*Choose: HM) |");
System.out.println("|_____________________________________________________________________________|");
}
/**
* Tell user to input id and display to user if id is invalid
* @param scan take id from user input
* @return return any id back or zero if id is invalid
*/
public Integer enterData(Scanner scan){
try{
System.out.print("Enter ID: ");
int id = scan.nextInt();
return id;
}catch(Exception ex){
System.out.println("ID invalid.");
return 0;
}
}
}
| [
"[email protected]"
]
| |
25382842fd9dc8ace8e09d669441d55023502589 | 901476af236a6a3d3388cfe1efea89da99c77155 | /e-rpc-test/src/main/java/com/app/test/service/PersonServiceImpl.java | 3c25d316cf0d28623daa31b56e0ecc0f3a7b62e0 | []
| no_license | xsliu2018/ERpc | f4d132b0a134553a826001e0c10e527f7d42a461 | b446fca6d452d4b6c564184a68df6ab2fcde2884 | refs/heads/master | 2023-07-16T01:08:54.139230 | 2021-08-25T14:26:56 | 2021-08-25T14:26:56 | 393,708,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | package com.app.test.service;
import top.xsliu.erpc.core.annotation.ServiceProvider;
import java.util.ArrayList;
import java.util.List;
/**
* Created by luxiaoxun on 2016-03-10.
*/
@ServiceProvider(PersonService.class)
public class PersonServiceImpl implements PersonService {
@Override
public List<Person> callPerson(String name, Integer num) {
List<Person> persons = new ArrayList<>(num);
for (int i = 0; i < num; ++i) {
persons.add(new Person(Integer.toString(i), name));
}
return persons;
}
}
| [
"[email protected]"
]
| |
cd3502ed266f8951e44272f344bf34ecc3e05d7e | c634236c7fb442dde4913c665f89a46a5703583b | /EemBlue/libs/src/main/java/com/souja/lib/base/AdapterWithFooter.java | 14b36fa535d89f8d9f7572ab2773eafc5824efd0 | []
| no_license | souja/EEM | 117850a4089e1bf95ee7a6d7e813bc0775503bf4 | 5f875eb0045260cd7bc0366c2ff0cb72e6a89fe7 | refs/heads/master | 2020-05-03T02:02:01.711413 | 2019-09-24T02:27:17 | 2019-09-24T02:27:17 | 178,355,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,428 | java | package com.souja.lib.base;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.souja.lib.tools.ViewHolderCommon;
import com.souja.lib.R;
import java.util.List;
/**
* 咩有分页but有Footer
* Created by Ydz on 2017/6/12 0012.
*/
public abstract class AdapterWithFooter<T> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
protected Context mContext;
protected List<T> mList;
private final int COMMON = 1, EMPTY = 2, FOOTER = 3;
public AdapterWithFooter(Context context, List<T> list) {
mContext = context;
mList = list;
}
public RecyclerView.ViewHolder getEmptyView(ViewGroup parent) {
return new ViewHolderEmpty(LayoutInflater.from(mContext).inflate(
R.layout.item_empty, parent, false));
}
public RecyclerView.ViewHolder getFooterView(ViewGroup parent) {
return new ViewHolderCommon(LayoutInflater.from(mContext).inflate(
R.layout.item_header_footer, parent, false));
}
public abstract RecyclerView.ViewHolder onCreateView(ViewGroup parent);
public abstract void onBindView(RecyclerView.ViewHolder holder, int position);
protected void bindEmpty(RecyclerView.ViewHolder holder) {
}
protected void bindFooter(RecyclerView.ViewHolder holder) {
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == EMPTY)
return getEmptyView(parent);
else if (viewType == FOOTER)
return getFooterView(parent);
else
return onCreateView(parent);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (position == mList.size()) {
bindFooter(holder);
} else {
if (mList.size() == 0) bindEmpty(holder);
else {
onBindView(holder, position);
}
}
}
@Override
public int getItemViewType(int position) {
if (position == mList.size()) {
return FOOTER;
} else {
if (mList.size() == 0) {
return EMPTY;
} else {
return COMMON;
}
}
}
@Override
public int getItemCount() {
return mList.size() + 1;
}
}
| [
"[email protected]"
]
| |
20c1674085c6841ad90e900c58bac909239294a6 | 5ed1cd47eacf53abfe7892130282dc49e4f41e7b | /mall-platform/src/main/java/com/perenc/mall/platform/entity/vo/ActionVO.java | 32a1145d0061032dbe57327b856e6386cf294a41 | []
| no_license | 15116446660/mall-2 | 75a4068fd946b73d2d5026e1c3c8d170452f8881 | ad1c351f9cd154428ef76c6d3a68f946093c86bd | refs/heads/master | 2020-09-19T12:15:28.762837 | 2019-10-10T10:09:36 | 2019-10-10T10:09:36 | 224,227,748 | 4 | 1 | null | 2019-11-26T15:43:08 | 2019-11-26T15:43:08 | null | UTF-8 | Java | false | false | 813 | java | package com.perenc.mall.platform.entity.vo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @ClassName: ActionVO
* @Description: 前端活动返回数据
*
* @Author: GR
* @Date: 2019/9/18 12:51
*
* Modification History:
* Date Author Description
*---------------------------------------------------------*
* 2019/9/18 GR
*/
@Data
@Accessors(chain = true)
@NoArgsConstructor(staticName = "build")
public class ActionVO {
private Integer id;
private String title;
private String fileUrl;
private Integer sort;
private String desc;
private String remark;
private Integer status;
private Integer type;
private Integer skipType;
private String skipContent;
private String createTime;
}
| [
"[email protected]"
]
| |
e7f507d0fa6f191b6de5b30f10d60c4fc743666c | 91b7f72835defbfd2e2240590272bed71deb9197 | /TestApp/app/src/main/java/com/example/initish/testapp/SignupActivity.java | a5c542e8bd84f411c424d73a5426c3320dfc997d | []
| no_license | initishh/Smart-Odisha-Hackathon | 405e1ad9d8fdd6533686fc931092ee814488ff90 | da4cf64cd25cee0561166eadc9ed638abb661b7b | refs/heads/master | 2020-04-04T16:08:45.495905 | 2019-04-10T22:49:17 | 2019-04-10T22:49:17 | 156,066,352 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,924 | java | package com.example.initish.testapp;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class SignupActivity extends AppCompatActivity {
FirebaseAuth mAuth;
EditText email,password;
Button btn_register;
ProgressBar progressBar;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.register_email);
mAuth = FirebaseAuth.getInstance();
btn_register=findViewById(R.id.signupButton);
email=findViewById(R.id.userEmail);
password=findViewById(R.id.userPassword);
progressBar=findViewById(R.id.progressBar);
}
public void signUp(View view){
btn_register.setVisibility(View.INVISIBLE);
progressBar.setVisibility(View.VISIBLE);
createAccount(email.getText().toString(),password.getText().toString());
}
public void createAccount(String email,String password){
mAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d("Message", "createUserWithEmail:success");
FirebaseUser user = mAuth.getCurrentUser();
updateUI(user);
} else {
// If sign in fails, display a message to the user.
Log.w("Message", "createUserWithEmail:failure", task.getException());
Toast.makeText(SignupActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
updateUI(null);
btn_register.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.INVISIBLE);
}
// ...
}
});
}
private void updateUI(FirebaseUser currentUser) {
Intent intent=new Intent(this,Ask.class);
startActivity(intent);
}
}
| [
"[email protected]"
]
| |
620882ed7496d932bbe55a24ed5cc29ab7963a2d | 233114dc382119bff46e770effee31e4dfac1d00 | /android/src/main/java/com/twiliorn/library/TwilioRemotePreviewManager.java | e82fea874436572c9f7ac97e1e26c41fca12106b | []
| no_license | rotmanyan/rn-twilio-video-webrtc | f1aa30dccdf184d214855b4ed9445f7d484947b0 | c27558831c3ff2b6bb246e6c82a162e2ecdfeb5a | refs/heads/master | 2023-02-08T14:01:25.548408 | 2020-10-01T16:15:16 | 2020-10-01T16:15:16 | 252,473,417 | 0 | 0 | null | 2023-01-25T00:01:20 | 2020-04-02T14:08:29 | Java | UTF-8 | Java | false | false | 1,576 | java | /**
* Component for Twilio Video participant views.
* <p>
* Authors:
* Jonathan Chang <[email protected]>
*/
package com.twiliorn.library;
import androidx.annotation.Nullable;
import android.util.Log;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.annotations.ReactProp;
import org.webrtc.RendererCommon;
public class TwilioRemotePreviewManager extends SimpleViewManager<TwilioRemotePreview> {
public static final String REACT_CLASS = "RNTwilioRemotePreview";
public String myTrackSid = "";
@Override
public String getName() {
return REACT_CLASS;
}
@ReactProp(name = "scaleType")
public void setScaleType(TwilioRemotePreview view, @Nullable String scaleType) {
if (scaleType.equals("fit")) {
view.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
} else {
view.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
}
}
@ReactProp(name = "trackSid")
public void setTrackId(TwilioRemotePreview view, @Nullable String trackSid) {
Log.i("CustomTwilioVideoView", "Initialize Twilio REMOTE");
Log.i("CustomTwilioVideoView", trackSid);
myTrackSid = trackSid;
CustomTwilioVideoView.registerPrimaryVideoView(view.getSurfaceViewRenderer(), trackSid);
}
@Override
protected TwilioRemotePreview createViewInstance(ThemedReactContext reactContext) {
return new TwilioRemotePreview(reactContext, myTrackSid);
}
}
| [
"[email protected]"
]
| |
b53640245160b9f0047d47cc13f6f3872043cd5f | bc2586bd8fea9042b2589e35400f2e2ffa2d3308 | /UserFavourite/UserFavourite/src/main/java/com/ust/Exception/RestuarantNotFoundException.java | 1084e50f3ef967ec102c50193995454e65b8d8f0 | []
| no_license | Rasmiya-K-M/FoodieAppSpringboot | 4d7369a961abae6615c19fcfae0b7eaf2c192f70 | 9c49579822dae184e9d1ba26255e0e575a52a93b | refs/heads/master | 2023-05-01T18:29:53.965727 | 2021-05-12T07:09:58 | 2021-05-12T07:09:58 | 366,622,185 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.ust.Exception;
public class RestuarantNotFoundException extends Exception {
/**
*
*/
private static final long serialVersionUID = 2L;
public RestuarantNotFoundException() {
super();
}
}
| [
"[email protected]"
]
| |
09937be8e27b717e1afc64d05e71491f6fd7b574 | b37726900ee16a5b72a6cd7b2a2d72814fffe924 | /src/main/java/vn/com/vndirect/web/struts2/home/help/ReleaseNoteAction.java | 3e0c1598bb27e583e85adb7760d8578879f39f4b | []
| no_license | UnsungHero0/portal | 6b9cfd7271f2b1d587a6f311de49c67e8dd8ff9f | 32325d3e1732d900ee3f874c55890afc8f347700 | refs/heads/master | 2021-01-20T06:18:01.548033 | 2014-11-12T10:27:43 | 2014-11-12T10:27:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,844 | java | package vn.com.vndirect.web.struts2.home.help;
import java.util.ArrayList;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import vn.com.vndirect.business.INewsInfoManager;
import vn.com.vndirect.domain.IfoNews;
import vn.com.vndirect.domain.struts2.newsinfo.NewsModel;
import vn.com.web.commons.exception.FunctionalException;
import vn.com.web.commons.exception.SystemException;
import vn.com.web.commons.utility.Utilities;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
public class ReleaseNoteAction extends ActionSupport implements ModelDriven<NewsModel> {
private static Logger logger = Logger.getLogger(ReleaseNoteAction.class);
protected static final String DISCLOSURE_NEWSTYPE = "Disclousure";
private String newsURL;
@Autowired
private INewsInfoManager newsInfoManager;
private NewsModel model = new NewsModel();
@Override
public NewsModel getModel() {
return model;
}
public String releaseNoteDetails() throws FunctionalException, SystemException{
final String LOCATION = "release note details";
if (logger.isDebugEnabled()) {
logger.debug(LOCATION + "::BEGIN");
}
try {
if (StringUtils.isNotEmpty(newsURL)) {
final IfoNews inputIfoNews = model.getIfoNews() == null ? new IfoNews() : model.getIfoNews();
final String newsId = newsURL.substring(newsURL.lastIndexOf("-") + 1, newsURL.length());
inputIfoNews.setNewsId(Long.parseLong(newsId));
inputIfoNews.setNewsType(model.getNewsType());
final IfoNews ifoNews = newsInfoManager.getIfoNewsById(inputIfoNews);
model.setIfoNews(ifoNews);
// SEO
model.setPageTitle(this.getText("releaseNote.page.title"));
model.setPageDescription(this.getText("releaseNote.page.desc"));
model.setPageKeywords(this.getText("releaseNote.page.keys"));
// breadcrumbs
ArrayList<String> breadcrumbs = new ArrayList<String>();
breadcrumbs.add(this.getText("br.help.releaseNote2"));
breadcrumbs.add(this.getText("br.vnd"));
breadcrumbs.add("ttvndRoot");
breadcrumbs.add(this.getText("br.help"));
breadcrumbs.add("/tro-giup/hoi-dap-huong-dan.shtml");
model.setBreadcrumbs(breadcrumbs);
}
if (logger.isDebugEnabled()) {
logger.debug(LOCATION + "::END");
}
} catch (Exception e) {
logger.error(LOCATION + ":: Exception: " + e);
Utilities.processErrors(this, e);
}
return SUCCESS;
}
/*
* GETTERS AND SETTERS
*/
public INewsInfoManager getNewsInfoManager() {
return newsInfoManager;
}
public void setNewsInfoManager(INewsInfoManager newsInfoManager) {
this.newsInfoManager = newsInfoManager;
}
public String getNewsURL() {
return newsURL;
}
public void setNewsURL(String newsURL) {
this.newsURL = newsURL;
}
}
| [
"[email protected]"
]
| |
5ffd10f38df8b1734d20edeb3df75634e7eada49 | 8f3c07b26e4e341f075a54af92e9645e5a50f4bb | /AcademicManagement/src/main/java/ejbs/CourseBean.java | ebc356651f0ee30b5fd7c09cecfece2adfe0edfd | []
| no_license | Soares234/AulasDAE | cce037b7600619d06eaf424e36cafffcdb8a584f | e2a4c7e4e8c4dc7c5882c3960ccc71641b902472 | refs/heads/master | 2022-12-28T04:59:16.753411 | 2020-10-15T17:12:14 | 2020-10-15T17:12:14 | 300,654,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package ejbs;
import entities.Course;
import entities.Student;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
@Stateless
public class CourseBean {
@PersistenceContext
EntityManager em;
public void create(int code,String name,List<Student> students){
Course course = new Course(code,name);
for (Student student:students) {
course.addStudent(student);
}
em.persist(course);
}
public List<Course> getAllCourses() {
// remember, maps to: “SELECT s FROM Student s ORDER BY s.name”
return (List<Course>) em.createNamedQuery("getAllCourses").getResultList();
}
} | [
"[email protected]"
]
| |
a91e4dc947586851125ff88d52be03cbf7db5a48 | f109e6c465664cbd982dcb55bccb547e513373d6 | /onestore/src/cn/onestore/utils/MD5Utils.java | d09a1cded71777d60185c9712e159c5dcfd41925 | []
| no_license | mymmyy/oneStore | c696f2910c4748e8a40de1c9c0f45d467402c89d | 80e0202d05511ff8c5b5f13ecd49219d3b928341 | refs/heads/master | 2021-01-23T17:06:58.645479 | 2017-09-07T16:28:15 | 2017-09-07T16:28:15 | 102,760,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 866 | java | package cn.onestore.utils;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* Created by 明柯 on 2017/4/13.
*对密码使用MD5加密 32位
*/
public class MD5Utils {
public static String md5(String plainText){
//1.准备一个字符数组
byte[] secretBytes = null;
try {
secretBytes = MessageDigest.getInstance("md5")
.digest(plainText.getBytes());
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("没有md5这个算法");
}
String md5code = new BigInteger(1,secretBytes).toString(16);
//如果生成数字未满32位,需要前面补零
for(int i = 0;i<32-md5code.length();i++){
md5code = "0"+md5code;
}
return md5code;
}
}
| [
"[email protected]"
]
| |
315f425b8394030ff96c1af0913cdaa10212b350 | 278dab559864a5f4e5c2d8544f374209f6e19707 | /src/main/java/menu_combination_sum/MenuCombinationSum.java | 2bc8cb489e00e0b8360df1e8fc6324da592bd379 | [
"MIT"
]
| permissive | 1stClassMovementCustomClassic/airbnb | a8e8e2c9a09cd8a23ebf4e340529b863ca3d4250 | 29cb40381b5cef3766c67d2b79114ee463bb25b0 | refs/heads/master | 2021-07-09T12:50:37.081953 | 2020-10-15T14:58:24 | 2020-10-15T14:58:24 | 202,969,732 | 1 | 0 | MIT | 2019-08-18T06:46:56 | 2019-08-18T06:46:56 | null | UTF-8 | Java | false | false | 2,094 | java | package menu_combination_sum;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
public class MenuCombinationSum {
/*
Menu Combination Sum
AirBnB Interview Question
*/
public class Solution {
private void search(List<List<Double>> res, int[] centsPrices, int start, int centsTarget,
List<Double> curCombo, double[] prices) {
if (centsTarget == 0) {
res.add(new ArrayList<>(curCombo));
return;
}
for (int i = start; i < centsPrices.length; i++) {
if (i > start && centsPrices[i] == centsPrices[i - 1]) {
continue;
}
if (centsPrices[i] > centsTarget) {
break;
}
curCombo.add(prices[i]);
search(res, centsPrices, i + 1, centsTarget - centsPrices[i], curCombo, prices);
curCombo.remove(curCombo.size() - 1);
}
}
public List<List<Double>> getCombos(double[] prices, double target) {
List<List<Double>> res = new ArrayList<>();
if (prices == null || prices.length == 0 || target <= 0) {
return res;
}
int centsTarget = (int) Math.round(target * 100);
Arrays.sort(prices);
int[] centsPrices = new int[prices.length];
for (int i = 0; i < prices.length; i++) {
centsPrices[i] = (int) Math.round(prices[i] * 100);
}
search(res, centsPrices, 0, centsTarget, new ArrayList<>(), prices);
return res;
}
}
public static class UnitTest {
@Test
public void test1() {
Solution sol = new MenuCombinationSum().new Solution();
double[] prices = {10.02, 1.11, 2.22, 3.01, 4.02, 2.00, 5.03};
List<List<Double>> combos = sol.getCombos(prices, 7.03);
System.out.println(combos);
assertEquals(2, combos.size());
}
}
}
| [
"[email protected]"
]
| |
200b8ad020b55f7a4f24a8051c1deccdcee1039f | 24f640f08a2ff39878a82c5aa62f9b6c4cb22f5b | /app/src/main/java/com/example/jorda/provasub2/Model/Exemple.java | e5edd45aa186d19a20a762d10eef84336958978a | []
| no_license | jordanavi/provaSub2 | 64fa042f8cc91976c21a7750ec376222ecf584c4 | 782d6d882bea976292f53bf4eb618aa53d933ee1 | refs/heads/master | 2020-04-09T03:00:33.862970 | 2018-12-01T20:32:26 | 2018-12-01T20:32:26 | 159,964,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | package com.example.jorda.provasub2.Model;
public class Exemple{
private Double latitude;
private Double longitude;
private String timezone;
private Currently currently;
private Integer offset;
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public String getTimezone() {
return timezone;
}
public void setTimezone(String timezone) {
this.timezone = timezone;
}
public Currently getCurrently() {
return currently;
}
public void setCurrently(Currently currently) {
this.currently = currently;
}
public Integer getOffset() {
return offset;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
} | [
"[email protected]"
]
| |
73a5dd1333feee2fd3c9c511d3725ca3f02034c5 | a972859cd5e573fcc242ddb3cfe61782a644eaf5 | /src/main/java/org/redlich/publications/db/publications/publications/Publications.java | a31a281acb8aaaba229168c8e7e05bf0153c067a | []
| no_license | mpredli01/publications | 30826d20b73964b788b4b778f06c3325cab15375 | ae4f4256d51664ba11729e2bce73bb83b5165784 | refs/heads/master | 2021-01-11T12:19:54.951053 | 2016-12-16T23:52:40 | 2016-12-16T23:52:40 | 76,465,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package org.redlich.publications.db.publications.publications;
import org.redlich.publications.db.publications.publications.generated.GeneratedPublications;
/**
* The main interface for entities of the {@code publications}-table in the
* database.
* <p>
* This file is safe to edit. It will not be overwritten by the code generator.
*
* @author company
*/
public interface Publications extends GeneratedPublications {
} | [
"[email protected]"
]
| |
17cbc15f4aafa3403d3495d237dff27410fd0fb8 | a0ee0310b39db845d415fb47e7d6ed7c77713f0a | /generic_tree/Kth_Largest_In_GT_25.java | 7860efe2297181fc86c8423a5038d1169d96482f | []
| no_license | Bhuvneshwar-Vishwakarma/Foundation-Course | ac38712a9b6fe71241ee5e333da650b815fcb2fa | 24a5ffbfafd86f743281379115c3fc80d3b8b934 | refs/heads/master | 2023-08-19T02:06:34.454000 | 2021-10-06T15:35:27 | 2021-10-06T15:35:27 | 414,270,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,062 | java | package generic_tree;
import java.io.*;
import java.util.*;
public class Kth_Largest_In_GT_25 {
private static class Node {
int data;
ArrayList<Node> children = new ArrayList<>();
}
public static void display(Node node) {
String str = node.data + " -> ";
for (Node child : node.children) {
str += child.data + ", ";
}
str += ".";
System.out.println(str);
for (Node child : node.children) {
display(child);
}
}
public static Node construct(int[] arr) {
Node root = null;
Stack<Node> st = new Stack<>();
for (int i = 0; i < arr.length; i++) {
if (arr[i] == -1) {
st.pop();
} else {
Node t = new Node();
t.data = arr[i];
if (st.size() > 0) {
st.peek().children.add(t);
} else {
root = t;
}
st.push(t);
}
}
return root;
}
static int ceil;
static int floor;
public static void ceilAndFloor(Node node, int data) {
if(node.data > data){
if(node.data < ceil){
ceil = node.data;
}
}
if(node.data < data){
if(node.data > floor){
floor = node.data;
}
}
for (Node child : node.children) {
ceilAndFloor(child, data);
}
}
public static int kthLargest(Node node, int k){
floor = Integer.MIN_VALUE;
int factor = Integer.MAX_VALUE;
for(int i = 0; i<k; i++){
ceilAndFloor(node, factor);
factor = floor;
floor = Integer.MIN_VALUE;
}
return factor;
}
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] arr = new int[n];
String[] values = br.readLine().split(" ");
for (int i = 0; i < n; i++) {
arr[i] = Integer.parseInt(values[i]);
}
int k = Integer.parseInt(br.readLine());
Node root = construct(arr);
int kthLargest = kthLargest(root, k);
System.out.println(kthLargest);
}
} | [
"[email protected]"
]
| |
57299b5199487bb868cad7b27193535604f09dab | 1cdc488a41654bb352aff445d06f509afa3bdf3b | /src/main/java/com/github/jtam2000/jpa/relationships/bidirectiononetomany/PostageStamp.java | 45b5fcfd086a7be09f3631a7f8a7625718b883f2 | []
| no_license | jtam2000/learn_hibernate | af9a685701a856e0c5c321e9253145b2586b4853 | c6c08283d8a42b89e116923e09fba1e9fd393be0 | refs/heads/main | 2023-01-18T15:32:28.046930 | 2020-11-13T16:09:47 | 2020-11-13T16:09:47 | 292,982,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,711 | java | package com.github.jtam2000.jpa.relationships.bidirectiononetomany;
import com.github.jtam2000.jpa.HasPrimaryKey;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;
import static com.github.jtam2000.jpa.relationships.bidirectiononetomany.BiDirectionStampCollection_.ID;
import static com.github.jtam2000.jpa.relationships.bidirectiononetomany.PostalCountry_.COUNTRY_ID;
import static com.github.jtam2000.jpa.relationships.bidirectiononetomany.PostageStamp_.*;
import static javax.persistence.CascadeType.ALL;
@SuppressWarnings("unused")
@Entity(name = "BiDirectionPostageStamp")
public class PostageStamp implements HasPrimaryKey {
public void setTitle(String title) {
this.title = title;
}
@Id
@GeneratedValue
int stampID;
@ManyToOne
@JoinColumn(name = "fk_"+ COUNTRY_ID)
private PostalCountry country;
private double faceValue;
private String title;
private LocalDate issueDate;
public void setKeptInCollection(BiDirectionStampCollection keptInCollection) {
this.keptInCollection = keptInCollection;
}
@ManyToOne(cascade = ALL)
@JoinColumn(name = "FK_Collection_" + ID) //specify the name of the FK column
private BiDirectionStampCollection keptInCollection;
public static PostageStamp of(PostalCountry country) {
String title = "Definitive Forever Stamp";
LocalDate issueDate = LocalDate.now();
double faceValue = getRandomFaceValueWithTwoDecimals(0.99D);
return new PostageStamp(country, faceValue, title, issueDate);
}
private static double getRandomFaceValueWithTwoDecimals(@SuppressWarnings("SameParameterValue") double valueBound) {
double randomValue = ThreadLocalRandom.current().nextDouble(valueBound);
return getDoubleWithinDecimalPlaces(randomValue, 2);
}
@SuppressWarnings("SameParameterValue")
private static double getDoubleWithinDecimalPlaces(double value, int decimalPlaces) {
BigDecimal convertedValue = new BigDecimal(value).setScale(decimalPlaces, RoundingMode.UP);
return convertedValue.doubleValue();
}
@SuppressWarnings({"unused", "RedundantSuppression"})
public int getStampID() {
return stampID;
}
public PostalCountry getCountry() {
return country;
}
public double getFaceValue() {
return faceValue;
}
public String getTitle() {
return title;
}
public void setCountry(PostalCountry country) {
this.country = country;
}
public LocalDate getIssueDate() {
return issueDate;
}
public PostageStamp(PostalCountry country, double faceValue, String title, LocalDate issueDate) {
this.country = country;
this.faceValue = faceValue;
this.title = title;
this.issueDate = issueDate;
}
@Override
public String toString() {
return "\tPostageStamp = {" + "\n" +
"\t\tstampID=" + stampID + "\n" +
"\t\tcountry=" + country + "\n" +
"\t\tfaceValue=" + String.format("%,.2f", faceValue) + "\n" +
"\t\ttitle='" + title + '\'' + "\n" +
"\t\tissueDate=" + issueDate + "\n" +
"\t}";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PostageStamp that = (PostageStamp) o;
return stampID == that.stampID &&
Double.compare(that.faceValue, faceValue) == 0 &&
country == that.country &&
Objects.equals(title, that.title) &&
Objects.equals(issueDate, that.issueDate) &&
Objects.equals(keptInCollection,that.keptInCollection);
}
@Override
public int hashCode() {
return Objects.hash(stampID, country, faceValue, title, issueDate, keptInCollection);
}
public void setFaceValue(double faceValue) {
this.faceValue = faceValue;
}
//required per JPA specification: kept here for compatible with JPA providers
@SuppressWarnings({"unused", "RedundantSuppression"})
protected PostageStamp() {
}
@Override
public Object getPrimaryKey() {
return stampID;
}
@Override
public String getPrimaryKeyName() {
return STAMP_ID;
}
}
| [
"[email protected]"
]
| |
9a0ace5191aa7c5d562f0ee0776054a076ed885c | ac32eeab54726be482b0e43193637d68bcbcfc8d | /src/DAO/MajorDAO.java | 6cea324012f69cd1222466c03410f55ba3317dd7 | []
| no_license | JohnQue/KOOTD | 68177b562ef9657a664f1c04568e3967a2826a39 | 2217434584aea4fb708f86ded1bb0bb2cc4bdda6 | refs/heads/master | 2021-03-17T12:29:05.541853 | 2020-03-13T04:53:32 | 2020-03-13T04:53:32 | 246,990,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,915 | java | package DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class MajorDAO {
private Connection conn = null; // 데이터베이스를 접근하기 위한 객체
private PreparedStatement pstmt = null;
private ResultSet rs = null; // 정보를 담을 수 있는 변수를 만들어준다.
DataSource dataSource;
private static MajorDAO uniqInstance = new MajorDAO();
public MajorDAO(){ // 생성자인 동시에 데이터베이스에 접근하게 해줆.
try {
InitialContext initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
dataSource = (DataSource) envContext.lookup("jdbc/TeamProject");
}catch(Exception e) {
e.printStackTrace();
}
}
public static MajorDAO getInstance() {
return uniqInstance;
}
public void connect() {
// 생성자를 만들어준다.
try {
conn = dataSource.getConnection();
} catch (Exception e) {
e.printStackTrace();
}
}
public void disconnect() {
try {
if (rs != null)
rs.close();
if (pstmt != null)
pstmt.close();
if (conn != null)
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public ArrayList<String> getMajorList(String univ){
ArrayList<String> majorList = new ArrayList<String>();
String SQL = "SELECT usermajor FROM MAJOR WHERE university=?";
try {
connect();
pstmt = conn.prepareStatement(SQL);
pstmt.setString(1, univ);
rs = pstmt.executeQuery();
while(rs.next()) {
String usermajor = rs.getString("usermajor");
majorList.add(usermajor);
}
return majorList;
}catch(Exception e){
e.printStackTrace();
}finally { // sql문장이 실행이 끝나면 모든 리소스 종료
disconnect();
}
return null;
}
}
| [
"[email protected]"
]
| |
a97439e52333a23a6ab388b60f14d2ae565972e1 | b1b68de78e1a722b91810a205294486be1fcd87e | /src/main/java/google/com/ortona/hashcode/final_2015/model/SolutionContainer.java | 66925d2a32acf04059cdfb8dd8dee83caa8bcca9 | [
"MIT"
]
| permissive | stefano-ortona/google-hash-code | 4bce563c3ef1d59a771520e92c9b4ce0715a6b4d | 9e0b8cc282cefc8d17f70c80c2d532e70b70f82f | refs/heads/master | 2023-06-27T08:08:15.692192 | 2022-02-16T14:04:31 | 2022-02-16T14:04:31 | 121,667,987 | 0 | 1 | NOASSERTION | 2023-06-14T22:18:56 | 2018-02-15T18:49:15 | Java | UTF-8 | Java | false | false | 733 | java | package google.com.ortona.hashcode.final_2015.model;
import java.util.List;
public class SolutionContainer {
List<Baloon> baloons;
public SolutionContainer(List<Baloon> baloons) {
this.baloons = baloons;
}
private int score;
public void setScore(int score) {
this.score = score;
}
public int getScore() {
return this.score;
}
public List<Baloon> getBaloons() {
return this.baloons;
}
@Override
public String toString() {
final StringBuilder string = new StringBuilder();
for (int i = 0; i < getBaloons().get(0).getMoves().size(); i++) {
for (final Baloon baloon : getBaloons()) {
string.append(baloon.getMoves().get(i) + " ");
}
string.append("\n");
}
return string.toString();
}
}
| [
"[email protected]"
]
| |
cfd86dde7c72d675a21736ef0bd92b3536ab6c23 | 34934f6cbfb7384671fd9bff9daed69efef78a92 | /app/src/main/java/com/bignerdranch/android/criminalintent/ui/ViewModelFactory.java | e7195f7b21fcb0b41ed203fb6a2eaf7efb3927e4 | []
| no_license | jcavalieri8619/CriminalIntent | 4db97f0e0048242d6e062843d48966701c1c0b12 | 42b9afa95e504693c32f67b5f2d5639b3ea2783b | refs/heads/master | 2020-03-19T02:25:47.264044 | 2018-10-17T21:41:28 | 2018-10-17T21:41:28 | 135,626,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package com.bignerdranch.android.criminalintent.ui;
import android.app.Activity;
import android.arch.lifecycle.ViewModel;
import android.support.annotation.NonNull;
import com.bignerdranch.android.criminalintent.repository.CrimeRepository;
import com.bignerdranch.android.criminalintent.ui.crimedetail.DetailPagerViewModel;
import com.bignerdranch.android.criminalintent.ui.crimelist.ListViewModel;
public class ViewModelFactory implements android.arch.lifecycle.ViewModelProvider.Factory {
private CrimeRepository mDataSource;
private Activity mActivity;
public ViewModelFactory(final CrimeRepository dataSource, Activity activity) {
mDataSource = dataSource;
this.mActivity = activity;
}
/**
* Creates a new instance of the given {@code Class}.
* <p>
*
* @param modelClass a {code Class} whose instance is requested
* @return a newly created ViewModel
*/
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull final Class<T> modelClass) {
if (modelClass.isAssignableFrom(ListViewModel.class)) {
return (T) new ListViewModel(mDataSource, mActivity.getApplication());
}else if (modelClass.isAssignableFrom(DetailPagerViewModel.class)){
return (T) new DetailPagerViewModel(mDataSource);
}
throw new IllegalArgumentException("Unknown ViewModel class");
}
}
| [
"[email protected]"
]
| |
d4cbd272b201e21c19f875f2b25601f572c04bd0 | 4e6012a52f538c4d947b41214ed721b7bb765c62 | /src/SevenLesson/Chapter_1_Task_1/BMW.java | ce0846dd4a5a1383737fb8ecac0d19a3c1e5dc44 | []
| no_license | MykolaKozlov/MyProjectJava | dd059659d852cc99a3aa11174606e867d74fbba4 | 94c7ddddb659605e80448a17a458b7d988aac948 | refs/heads/master | 2021-05-31T07:19:42.406673 | 2016-04-10T17:41:39 | 2016-04-10T17:41:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package SevenLesson.Chapter_1_Task_1;
public class BMW extends Motorcycle {
public BMW() {
}
}
| [
"[email protected]"
]
| |
d26bdc046526bb1c07ed303269bfc7d9cca4f728 | c22d1b314a07aeb240323a7a333f4cdf7997c91b | /src/com/pixel/communication/CommunicationInfoServer.java | 1d857e93857314b57d31e157b4a2a4799807d236 | []
| no_license | Integer-Studios/Pixel-Realms-Server-Archive | 089c10d7e3fa982e20eae8046597ef4729213df2 | 39d6038f878c0df5a77df41e7f9ca224f7f36d27 | refs/heads/master | 2021-03-27T18:35:51.774390 | 2016-01-28T09:09:06 | 2016-01-28T09:09:06 | 11,692,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | package com.pixel.communication;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import com.pixel.admin.PixelLogger;
import com.pixel.start.PixelRealmsServer;
public class CommunicationInfoServer implements Runnable {
public int port;
public CommunicationInfoServer() {
port = PixelRealmsServer.port + 1;
}
@Override
public void run() {
// TODO Auto-generated method stub
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(port);
}
catch (IOException e) {
PixelLogger.err("Error: Could not listen on port " + port);
System.exit(-1);
}
while (true) {
Socket clientSocket;
try {
clientSocket = serverSocket.accept();
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
String cmd = in.readLine();
if (cmd.equals("status")) {
out.println("1");
}
} catch (IOException e) {
PixelLogger.err("Error: Accept failed on " + port);
System.exit(-1);
}
}
}
}
| [
"[email protected]"
]
| |
29c0e734be1870916574bec643dd5e9b27fb7cf4 | 8e9e6ba3a44f482372c6e59c79956645adbda2fe | /src/main/java/com/backbase/kalah/KalahApplication.java | fc768598e5f3e2a2ebee45df30e79c759d02c1e9 | []
| no_license | diegotdiaz/Kalah | 717936c1df66fbea9075b2403b5c93fceb7c210c | 14b29e2dc5d217c6b82b8810178e53e6dd3235a6 | refs/heads/master | 2021-04-06T02:27:25.025098 | 2018-06-28T19:34:24 | 2018-06-28T19:34:24 | 125,236,180 | 0 | 0 | null | 2018-03-21T05:14:30 | 2018-03-14T15:44:07 | Java | UTF-8 | Java | false | false | 308 | java | package com.backbase.kalah;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class KalahApplication {
public static void main(String[] args) {
SpringApplication.run(KalahApplication.class, args);
}
}
| [
"[email protected]"
]
| |
f29e1905d920fe916a4abd6ab6da879aefb6f2b9 | 1b2df87b8631047149cf900afed6fd6e0eab09f3 | /src/main/java/com/taim/taimwebcontent/controller/TransactionResourceController.java | e912b9b4e08563043cf5b23b26afafd4f15b9afc | []
| no_license | TianqiJin/TaimFrontendContent | 8b9fecf5560660e4a41a7058e2b15ccd8d7c9c2d | 2d7ead3ceda1717db313994f250f9b33ca2712f5 | refs/heads/master | 2020-05-16T09:26:05.769809 | 2019-07-04T06:32:19 | 2019-07-04T06:32:19 | 182,948,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,148 | java | package com.taim.taimwebcontent.controller;
import com.taim.taimwebcontent.manager.TransactionManager;
import com.taim.taimwebcontent.model.CreateQuotationInput;
import com.taim.taimwebcontent.model.QuotationOverviewView;
import com.taim.taimwebcontent.model.quotationdetail.QuotationDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class TransactionResourceController {
private final TransactionManager transactionManager;
@Autowired
public TransactionResourceController(TransactionManager transactionManager) {
this.transactionManager = transactionManager;
}
@GetMapping(
value = "/quotations",
params = "action=init"
)
public QuotationDetail initNewQuotation() {
return this.transactionManager.initNewQuotation();
}
@PostMapping(
value = "/quotations",
params = "action=save"
)
public void saveQuotation(@RequestBody CreateQuotationInput createQuotationInput) {
this.transactionManager.createNewQuotation(createQuotationInput);
}
@GetMapping(
value = "/quotations",
params = "action=getByCustomerId"
)
public List<QuotationOverviewView> getQuotationOverviewViewsByCustomerId(
@RequestParam("customerId") Long customerId) {
return this.transactionManager.getQuotationOverviewViewByCustomerId(customerId);
}
@GetMapping(
value = "/quotations",
params = "action=getAll"
)
public List<QuotationOverviewView> getAllQuotationOverviewViews() {
return this.transactionManager.getAllQuotationOverviewViews();
}
@GetMapping(
value = "/quotations",
params = "action=getQuotationDetailByQuotationId"
)
public QuotationDetail getQuotationDetailByQuotationId(@RequestParam("quotationId") String quotationId) {
return this.transactionManager.getQuotationDetailByQuotationId(quotationId);
}
}
| [
"[email protected]"
]
| |
53d975f3a96f8e43ac1d410d3753824a4d1c8005 | b6e99b0346572b7def0e9cdd1b03990beb99e26f | /src/gcom/gerencial/cadastro/bean/ResumoMetasHelper.java | bb6596e93ebf3a7913844b8f76f9124659a00bb5 | []
| no_license | prodigasistemas/gsan | ad64782c7bc991329ce5f0bf5491c810e9487d6b | bfbf7ad298c3c9646bdf5d9c791e62d7366499c1 | refs/heads/master | 2023-08-31T10:47:21.784105 | 2023-08-23T17:53:24 | 2023-08-23T17:53:24 | 14,600,520 | 19 | 20 | null | 2015-07-29T19:39:10 | 2013-11-21T21:24:16 | Java | ISO-8859-1 | Java | false | false | 16,146 | java | package gcom.gerencial.cadastro.bean;
import java.util.Date;
/**
* Classe bean para agrupamento dos historicos de consumo com as quebras
* solicitadas
*
*
* @author Sávio Luiz
* @date 20/07/2007
*/
public class ResumoMetasHelper {
private Integer idGerenciaRegional;
private Integer idUnidadeNegocio;
private Integer idLocalidade;
private Integer idElo;
private Integer idSetorComercial;
private Integer idRota;
private Integer idQuadra;
private Integer codigoSetorComercial;
private Integer numeroQuadra;
private Integer idImovelPerfil;
private Integer idLigacaoAguaSituacao;
private Integer idLigacaoEsgotoSituacao;
private Integer idCategoria;
private Integer idSubCategoria;
private Integer idEsferaPoder;
private Integer idClienteTipo;
private Integer idLigacaoAguaPerfil;
private Integer idLigacaoEsgotoPerfil;
private Integer quantidadeLigacoesCadastradas = new Integer(0);
private Integer quantidadeLigacoesSuprimidas = new Integer(0);
private Integer quantidadeLigacoesCortadas = new Integer(0);
private Integer quantidadeLigacoesAtivas = new Integer(0);
private Integer quantidadeLigacoesAtivasDebito3M = new Integer(0);
private Integer quantidadeLigacoesConsumoMedido = new Integer(0);
private Integer quantidadeLigacoesConsumoAte5M3 = new Integer(0);
private Integer quantidadeLigacoesConsumoMedio = new Integer(0);
private Integer quantidadeLigacoesConsumoNaoMedido = new Integer(0);
private Integer quantidadeEconomias = new Integer(0);
private Date dataLigacao;
private Date dataSupressao;
private Date dataCorte;
private Date dataReligacao;
private Date dataRestabelecimentoAgua;
private int[] tipoData;
private Integer idHidrometroInstalado;
private Integer codigoGrupoSubcategoria;
// indicadores da data de ligação agua
public static final int INIDCADOR_DATA_LIGACAO = 1;
public static final int INIDCADOR_DATA_SUPRESSAO = 2;
public static final int INIDCADOR_DATA_CORTE = 3;
public static final int INIDCADOR_DATA_RELIGACAO = 4;
public static final int INIDCADOR_DATA_RESTABELECIMENTO = 5;
public Integer getIdClienteTipo() {
return idClienteTipo;
}
public void setIdClienteTipo(Integer idClienteTipo) {
this.idClienteTipo = idClienteTipo;
}
public Integer getCodigoSetorComercial() {
return codigoSetorComercial;
}
public void setIdCodigoSetorComercial(Integer codigoSetorComercial) {
this.codigoSetorComercial = codigoSetorComercial;
}
public Integer getIdElo() {
return idElo;
}
public void setIdElo(Integer idElo) {
this.idElo = idElo;
}
public Integer getIdEsferaPoder() {
return idEsferaPoder;
}
public void setIdEsferaPoder(Integer idEsferaPoder) {
this.idEsferaPoder = idEsferaPoder;
}
public Integer getIdGerenciaRegional() {
return idGerenciaRegional;
}
public void setIdGerenciaRegional(Integer idGerenciaRegional) {
this.idGerenciaRegional = idGerenciaRegional;
}
public Integer getIdImovelPerfil() {
return idImovelPerfil;
}
public void setIdImovelPerfil(Integer idImovelPerfil) {
this.idImovelPerfil = idImovelPerfil;
}
public Integer getIdLocalidade() {
return idLocalidade;
}
public void setIdLcalidade(Integer idLocalidade) {
this.idLocalidade = idLocalidade;
}
public Integer getIdLigacaoAguaPerfil() {
return idLigacaoAguaPerfil;
}
public void setIdLigacaoAguaPerfil(Integer idLigacaoAguaPerfil) {
this.idLigacaoAguaPerfil = idLigacaoAguaPerfil;
}
public Integer getIdLigacaoAguaSituacao() {
return idLigacaoAguaSituacao;
}
public void setIdLigacaoAguaSituacao(Integer idLigacaoAguaSituacao) {
this.idLigacaoAguaSituacao = idLigacaoAguaSituacao;
}
public Integer getIdLigacaoEsgotoPerfil() {
return idLigacaoEsgotoPerfil;
}
public void setIdLigacaoEsgotoPerfil(Integer idLigacaoEsgotoPerfil) {
this.idLigacaoEsgotoPerfil = idLigacaoEsgotoPerfil;
}
public Integer getIdLigacaoEsgotoSituacao() {
return idLigacaoEsgotoSituacao;
}
public void setIdLigacaoEsgotoSituacao(Integer idLigacaoEsgotoSituacao) {
this.idLigacaoEsgotoSituacao = idLigacaoEsgotoSituacao;
}
public Integer getNumeroQuadra() {
return numeroQuadra;
}
public void setIdNumeroQuadra(Integer numeroQuadra) {
this.numeroQuadra = numeroQuadra;
}
public Integer getIdQuadra() {
return idQuadra;
}
public void setIdQuadra(Integer idQuadra) {
this.idQuadra = idQuadra;
}
public Integer getIdRota() {
return idRota;
}
public void setIdRota(Integer idRota) {
this.idRota = idRota;
}
public Integer getIdSetorComercial() {
return idSetorComercial;
}
public void setIdSetorComercial(Integer idSetorComercial) {
this.idSetorComercial = idSetorComercial;
}
public Integer getIdUnidadeNegocio() {
return idUnidadeNegocio;
}
public void setIdUnidadeNegocio(Integer idUnidadeNegocio) {
this.idUnidadeNegocio = idUnidadeNegocio;
}
public Integer getQuantidadeEconomias() {
return quantidadeEconomias;
}
public void setQuantidadeEconomias(Integer quantidadeEconomias) {
this.quantidadeEconomias = quantidadeEconomias;
}
public Date getDataCorte() {
return dataCorte;
}
public void setDataCorte(Date dataCorte) {
this.dataCorte = dataCorte;
}
public Date getDataLigacao() {
return dataLigacao;
}
public void setDataLigacao(Date dataLigacao) {
this.dataLigacao = dataLigacao;
}
public Date getDataReligacao() {
return dataReligacao;
}
public void setDataReligacao(Date dataReligacao) {
this.dataReligacao = dataReligacao;
}
public Date getDataRestabelecimentoAgua() {
return dataRestabelecimentoAgua;
}
public void setDataRestabelecimentoAgua(Date dataRestabelecimentoAgua) {
this.dataRestabelecimentoAgua = dataRestabelecimentoAgua;
}
public Date getDataSupressao() {
return dataSupressao;
}
public void setDataSupressao(Date dataSupressao) {
this.dataSupressao = dataSupressao;
}
public void setTipoData(int[] tipoData) {
this.tipoData = tipoData;
}
public Integer getQuantidadeLigacoesAtivas() {
return quantidadeLigacoesAtivas;
}
public void setQuantidadeLigacoesAtivas(Integer quantidadeLigacoesAtivas) {
this.quantidadeLigacoesAtivas = quantidadeLigacoesAtivas;
}
public Integer getQuantidadeLigacoesAtivasDebito3M() {
return quantidadeLigacoesAtivasDebito3M;
}
public void setQuantidadeLigacoesAtivasDebito3M(
Integer quantidadeLigacoesAtivasDebito3M) {
this.quantidadeLigacoesAtivasDebito3M = quantidadeLigacoesAtivasDebito3M;
}
public Integer getQuantidadeLigacoesCadastradas() {
return quantidadeLigacoesCadastradas;
}
public void setQuantidadeLigacoesCadastradas(
Integer quantidadeLigacoesCadastradas) {
this.quantidadeLigacoesCadastradas = quantidadeLigacoesCadastradas;
}
public Integer getQuantidadeLigacoesConsumoAte5M3() {
return quantidadeLigacoesConsumoAte5M3;
}
public void setQuantidadeLigacoesConsumoAte5M3(
Integer quantidadeLigacoesConsumoAte5M3) {
this.quantidadeLigacoesConsumoAte5M3 = quantidadeLigacoesConsumoAte5M3;
}
public Integer getQuantidadeLigacoesConsumoMedido() {
return quantidadeLigacoesConsumoMedido;
}
public void setQuantidadeLigacoesConsumoMedido(
Integer quantidadeLigacoesConsumoMedido) {
this.quantidadeLigacoesConsumoMedido = quantidadeLigacoesConsumoMedido;
}
public Integer getQuantidadeLigacoesConsumoMedio() {
return quantidadeLigacoesConsumoMedio;
}
public void setQuantidadeLigacoesConsumoMedio(
Integer quantidadeLigacoesConsumoMedio) {
this.quantidadeLigacoesConsumoMedio = quantidadeLigacoesConsumoMedio;
}
public Integer getQuantidadeLigacoesConsumoNaoMedido() {
return quantidadeLigacoesConsumoNaoMedido;
}
public void setQuantidadeLigacoesConsumoNaoMedido(
Integer quantidadeLigacoesConsumoNaoMedido) {
this.quantidadeLigacoesConsumoNaoMedido = quantidadeLigacoesConsumoNaoMedido;
}
public Integer getQuantidadeLigacoesCortadas() {
return quantidadeLigacoesCortadas;
}
public void setQuantidadeLigacoesCortadas(Integer quantidadeLigacoesCortadas) {
this.quantidadeLigacoesCortadas = quantidadeLigacoesCortadas;
}
public Integer getQuantidadeLigacoesSuprimidas() {
return quantidadeLigacoesSuprimidas;
}
public void setQuantidadeLigacoesSuprimidas(
Integer quantidadeLigacoesSuprimidas) {
this.quantidadeLigacoesSuprimidas = quantidadeLigacoesSuprimidas;
}
public int[] getTipoData() {
return tipoData;
}
/**
* Construtor com a sequencia correta de quebras para o caso de uso UC[0570] -
* Gerar resumo do consumo de agua
*
* OBS - Duas quebras adicionais nao foram passadas neste contrutor, a
* saber, idCategoria e idSubCatergoria, pois no momento da criacao deste
* objeto essas informacoes nao estao disponiveis.
*
* @param idGerenciaRegional
* param idUnidadeNegocio
* @param idLocalidade
* @param idElo
* @param idSetorComercial
* @param idRota
* @param idQuadra
* @param codigoSetorComercial
* @param numeroQuadra
* @param idImovelPerfil
* @param idSituacaoLigacaoAgua
* @param idSituacaoLigacaoEsgoto
* @param idPerfilLigacaoAgua
* @param idPerfilLigacaoEsgoto
* @param idTipoConsumo
* @param qtdConsumoAgua
*/
public ResumoMetasHelper(Integer idGerenciaRegional,
Integer idUnidadeNegocio, Integer idLocalidade, Integer idElo,
Integer idSetorComercial, Integer idRota, Integer idQuadra,
Integer codigoSetorComercial, Integer numeroQuadra,
Integer idImovelPerfil, Integer idSituacaoLigacaoAgua,
Integer idSituacaoLigacaoEsgoto, Integer idPerfilLigacaoAgua,
Integer idPerfilLigacaoEsgoto, Date dataLigacao,
Date dataSupressao, Date dataCorte, Date dataReligacao,
Date dataRestabelecimentoAgua, Integer idHidrometroInstalado) {
this.idGerenciaRegional = idGerenciaRegional;
this.idUnidadeNegocio = idUnidadeNegocio;
this.idLocalidade = idLocalidade;
this.idElo = idElo;
this.idSetorComercial = idSetorComercial;
this.idRota = idRota;
this.idQuadra = idQuadra;
this.codigoSetorComercial = codigoSetorComercial;
this.numeroQuadra = numeroQuadra;
this.idImovelPerfil = idImovelPerfil;
this.idLigacaoAguaSituacao = idSituacaoLigacaoAgua;
this.idLigacaoEsgotoSituacao = idSituacaoLigacaoEsgoto;
this.idLigacaoAguaPerfil = idPerfilLigacaoAgua;
this.idLigacaoEsgotoPerfil = idPerfilLigacaoEsgoto;
this.dataLigacao = dataLigacao;
this.dataSupressao = dataSupressao;
this.dataCorte = dataCorte;
this.dataReligacao = dataReligacao;
this.dataRestabelecimentoAgua = dataRestabelecimentoAgua;
this.idHidrometroInstalado = idHidrometroInstalado;
}
public Integer getIdCategoria() {
return idCategoria;
}
public void setIdCategoria(Integer idCategoria) {
this.idCategoria = idCategoria;
}
public Integer getIdSubCategoria() {
return idSubCategoria;
}
public void setIdSubCategoria(Integer idSubCategoria) {
this.idSubCategoria = idSubCategoria;
}
public void setCodigoSetorComercial(Integer codigoSetorComercial) {
this.codigoSetorComercial = codigoSetorComercial;
}
public void setIdLocalidade(Integer idLocalidade) {
this.idLocalidade = idLocalidade;
}
public void setNumeroQuadra(Integer numeroQuadra) {
this.numeroQuadra = numeroQuadra;
}
public Integer getIdHidrometroInstalado() {
return idHidrometroInstalado;
}
public void setIdHidrometroInstalado(Integer idHidrometroInstalado) {
this.idHidrometroInstalado = idHidrometroInstalado;
}
/**
* Compara duas properiedades inteiras, comparando seus valores para
* descobrirmos se sao iguais
*
* @param pro1
* Primeira propriedade
* @param pro2
* Segunda propriedade
* @return Se iguais, retorna true
*/
private boolean propriedadesIguais(Integer pro1, Integer pro2) {
if (pro2 != null) {
if (!pro2.equals(pro1)) {
return false;
}
} else if (pro1 != null) {
return false;
}
// Se chegou ate aqui quer dizer que as propriedades sao iguais
return true;
}
/**
* Compara dois objetos levando em consideracao apenas as propriedades que
* identificam o agrupamento
*
* @param obj
* Objeto a ser comparado com a instancia deste objeto
*/
public boolean equals(Object obj) {
if (!(obj instanceof ResumoMetasHelper)) {
return false;
} else {
ResumoMetasHelper resumoTemp = (ResumoMetasHelper) obj;
// Verificamos se todas as propriedades que identificam o objeto sao
// iguais
return propriedadesIguais(this.idGerenciaRegional,
resumoTemp.idGerenciaRegional)
&& propriedadesIguais(this.idUnidadeNegocio,
resumoTemp.idUnidadeNegocio)
&& propriedadesIguais(this.idLocalidade,
resumoTemp.idLocalidade)
&& propriedadesIguais(this.idElo, resumoTemp.idElo)
&& propriedadesIguais(this.idSetorComercial,
resumoTemp.idSetorComercial)
&& propriedadesIguais(this.idRota, resumoTemp.idRota)
&& propriedadesIguais(this.idQuadra, resumoTemp.idQuadra)
&& propriedadesIguais(this.codigoSetorComercial,
resumoTemp.codigoSetorComercial)
&& propriedadesIguais(this.numeroQuadra,
resumoTemp.numeroQuadra)
&& propriedadesIguais(this.idImovelPerfil,
resumoTemp.idImovelPerfil)
&& propriedadesIguais(this.idLigacaoAguaSituacao,
resumoTemp.idLigacaoAguaSituacao)
&& propriedadesIguais(this.idLigacaoEsgotoSituacao,
resumoTemp.idLigacaoEsgotoSituacao)
&& propriedadesIguais(this.idCategoria,
resumoTemp.idCategoria)
&& propriedadesIguais(this.idSubCategoria,
resumoTemp.idSubCategoria)
&& propriedadesIguais(this.idEsferaPoder,
resumoTemp.idEsferaPoder)
&& propriedadesIguais(this.idClienteTipo,
resumoTemp.idClienteTipo)
&& propriedadesIguais(this.idLigacaoAguaPerfil,
resumoTemp.idLigacaoAguaPerfil)
&& propriedadesIguais(this.idLigacaoEsgotoPerfil,
resumoTemp.idLigacaoEsgotoPerfil)
&& propriedadesIguais(this.codigoGrupoSubcategoria,
resumoTemp.getCodigoGrupoSubcategoria());
}
}
// seta um indicador no helper que dirá que tipo de data de ligação água é o
// helper
public void setarTipoData(Date dataInicial, Date dataFinal) {
int[] tiposDataAux = new int[5];
int i = 0;
if (this.dataLigacao != null
&& (this.dataLigacao.after(dataInicial) && this.dataLigacao
.before(dataFinal))) {
tiposDataAux[i] = INIDCADOR_DATA_LIGACAO;
i++;
}
if (this.dataSupressao != null
&& (this.dataSupressao.after(dataInicial) && this.dataSupressao
.before(dataFinal))) {
tiposDataAux[i] = INIDCADOR_DATA_SUPRESSAO;
i++;
}
if (this.dataCorte != null
&& (this.dataCorte.after(dataInicial) && this.dataCorte
.before(dataFinal))) {
tiposDataAux[i] = INIDCADOR_DATA_CORTE;
i++;
}
if (this.dataReligacao != null
&& (this.dataReligacao.after(dataInicial) && this.dataReligacao
.before(dataFinal))) {
tiposDataAux[i] = INIDCADOR_DATA_RELIGACAO;
i++;
}
if (this.dataRestabelecimentoAgua != null
&& (this.dataRestabelecimentoAgua.after(dataInicial) && this.dataRestabelecimentoAgua
.before(dataFinal))) {
tiposDataAux[i] = INIDCADOR_DATA_RESTABELECIMENTO;
i++;
}
int[] tiposData = new int[i];
int aux = 0;
for (int tipoData : tiposDataAux) {
if (tipoData != 0) {
tiposData[aux] = tipoData;
aux++;
}
}
this.setTipoData(tiposData);
}
public Integer getCodigoGrupoSubcategoria() {
return codigoGrupoSubcategoria;
}
public void setCodigoGrupoSubcategoria(Integer codigoGrupoSubcategoria) {
this.codigoGrupoSubcategoria = codigoGrupoSubcategoria;
}
}
| [
"[email protected]"
]
| |
16d6bdcb6b31124b4e8c8fd1047600cc1286f8b5 | caab5ee348c17aaa6ed5fc5e01e9a74111711e63 | /tensquare_article/src/main/java/com/tensquare/article/repository/CommentRepository.java | f77975312bcad06ee4a935f3e02a9adc0bb10754 | [
"MIT"
]
| permissive | yuumiy/tensquare_parent | b0ea8eff938b9b8a27954dea4be6775b61196514 | 259dc6e677910dcaf44d96a94d93a73958d15679 | refs/heads/master | 2023-03-20T15:51:35.565384 | 2021-03-12T08:15:18 | 2021-03-12T08:15:18 | 347,018,285 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.tensquare.article.repository;
import com.tensquare.article.pojo.Comment;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.Date;
import java.util.List;
public interface CommentRepository extends MongoRepository<Comment, String> {
//SpringDataMongoDB,支持通过查询方法名进行查询定义的方式
//根据文章id查询文章评论数据
List<Comment> findByArticleid(String articleId);
//根据发布时间和点赞数查询查询
// List<Comment> findByPublishdateAndThumbup(Date date, Integer thumbup);
//根据用户id查询,并且根据发布时间倒序排序
// List<Comment> findByUseridOrderbOrderByPublishdateDesc(String userid);
}
| [
"[email protected]"
]
| |
18142848e826cd5517db6a12ae16a484a4e50d69 | a7344dab6ab24a567c13421aa133ca4deaf4f68f | /src/Lesson14/Example3Momento/TestClient.java | ac7c5ed0f6b8805c6130e40709162584935d68fa | []
| no_license | abdussametkaci/SoftwareEngineeringDesignPatterns | 4c4ba349f765c765da809d8e01149e121b662b6e | c3c7e0bc6d7da57210a58849e425f7ff842f16be | refs/heads/main | 2023-06-16T07:24:59.180224 | 2021-07-14T11:22:36 | 2021-07-14T11:22:36 | 385,914,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package Lesson14.Example3Momento;
public class TestClient {
public static void main(String[] args) {
Originator o = new Originator();
o.state = "Ahmet";
CareTaker c = new CareTaker();
c.add(o.saveState());
//do something
System.out.println(o.getState(c, 0).getState());
}
}
| [
"[email protected]"
]
| |
1b14fb549c1a3b3d8520da4dfb6c6ac43ab11846 | 988ac3b5947500c5b09fafe744cf6b4c80618370 | /Java_2_lab06_minhvtpd02930/bai1.java | 612354f00a1812d74da6792366febb79a9e0a92b | []
| no_license | TienMinh0147/java2 | bbba80811da04754fd2b727cb803fe8e79434eba | 7aa0c1957c87f44a69b5ca7387daabc189ddfb1b | refs/heads/main | 2023-04-12T16:53:26.449128 | 2021-04-15T01:29:47 | 2021-04-15T01:29:47 | 358,090,542 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | 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 Java_2_lab06_minhvtpd02930;
public class bai1 extends Thread{
public void run(){
System.out.println("running thread neme is:"+ Thread.currentThread().getName());
System.out.println("running thread neme is:"+ Thread.currentThread().getPriority());
}
public static void main(String[] args) {
bai1 m1 = new bai1();
bai1 m2 = new bai1();
m1.setPriority(Thread.MIN_PRIORITY);
m2.setPriority(Thread.MAX_PRIORITY);
m1.start();
m2.start();
}
}
| [
"[email protected]"
]
| |
49c8cb6e6b1e1ff0f9f6bdaa4812b7b22b65500b | 5d1cf21e5fcf6a17f9362e01bf5e059d6351facb | /app/src/main/java/android/bigplan/lego/task/AbTaskListListener.java | fcff6edc39641d08b5b702ccd187b754e4db825b | []
| no_license | normanxdp/android_lego | baaec0aae5e5832215714ee5ea368cce403c0846 | d41764292b5721823f2b8efcca5e75636d0ccff7 | refs/heads/master | 2021-08-30T02:04:08.596944 | 2017-12-15T16:09:45 | 2017-12-15T16:09:45 | 113,804,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,283 | java | /*
* Copyright (C) 2012 www.amsoft.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.bigplan.lego.task;
import java.util.List;
// TODO: Auto-generated Javadoc
/**
* © 2012 amsoft.cn
* 名称:AbTaskListListener.java
* 描述:数据执行的接口.
*
* @author 还如一梦中
* @version v1.0
* @date:2013-9-2 下午12:52:13
*/
public abstract class AbTaskListListener extends AbTaskListener {
/**
* 执行开始.
*
* @return 返回的结果列表
*/
public abstract List<?> getList();
/**
* 描述:执行完成后回调. 不管成功与否都会执行
*
* @param paramList
* 返回的List
*/
public abstract void update(List<?> paramList);
}
| [
"[email protected]"
]
| |
9fe81574541904a1e92a7d504e67a07afc8af76f | 9e3283f02428c12f262a0c19329073d5e56f522b | /Rent.java | 0a151613276fb5a8fe5fa0a8f6dde68493230ccd | []
| no_license | patrykszczur/save_to_txt_java | 4afce3df714a48473756f1cc25f6de51ee7ce96b | fedbf9ecaff86b0f301ee7a0239b8bd101f60de2 | refs/heads/master | 2021-01-21T16:31:22.421616 | 2016-04-23T12:10:24 | 2016-04-23T12:10:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package Movie;
public class Rent {
private String start , stop , title ;
Movie movie ;
Rent (String start , String stop , String title)
{
this.start = start ;
this.stop = stop ;
this.title = title ;
}
String getRentInfo()
{
return "start of the rent : " + " "+ start + " end of the rent : " + " " + stop + " " + " title :" + " " + title ;
}
}
| [
"[email protected]"
]
| |
a8b29c981ea06e0f97f7b5769b005da14cc7549e | f3da0ffb9d38196a800c3691cf4b7f3d78879891 | /src/main/java/com/example/amazonAPI/controllers/AuthController.java | c84ebabb1f03f07b3043eb1814f43e28a16ac5d2 | []
| no_license | Tultul-Chow/backend | c68ca7157d7dace36652316851d7b68ea3bb530c | 983a03ba82f497ff644f650bd2551f0680cda2e0 | refs/heads/main | 2023-04-08T17:41:35.037199 | 2021-04-22T06:13:32 | 2021-04-22T06:13:32 | 360,461,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,635 | java | package com.example.amazonAPI.controllers;
import com.example.amazonAPI.CustomizedResponse;
import com.example.amazonAPI.Models.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class AuthController {
@Autowired
private AuthenticationManager authenticationManager;
@PostMapping(value="/auth",consumes={
MediaType.APPLICATION_JSON_VALUE
})
public ResponseEntity login(@RequestBody Customer customer)
{
try{
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(customer.getUsername(), customer.getPassword()));
var customizedResponse = new CustomizedResponse("You login successfully", null);
return new ResponseEntity(customizedResponse, HttpStatus.OK);
}
catch(BadCredentialsException ex){
var customizedResponse = new CustomizedResponse("Your username and/or password were incorrect", null);
return new ResponseEntity(customizedResponse, HttpStatus.UNAUTHORIZED);
}
}
}
| [
"[email protected]"
]
| |
6e7fcb571eae9b1f6cf46d12fb60f10a81605412 | d56741ca6b6f1ed01a910ef34288b8faf985f084 | /src/main/java/com/UserRegistration/UserCrudRegistration/config/WebConfiguration.java | 04a870c058ea41c4bc4f963bd3a1a411e13be562 | []
| no_license | saiakash5/SpringBoot_UserReg | ee90a55fc0861563e49aa15c3968bc293dc852c8 | 2fe8bb3fda6bd438f57d7c155999d12ade86cd20 | refs/heads/master | 2020-03-18T10:02:17.995191 | 2018-05-23T15:59:18 | 2018-05-23T15:59:18 | 134,593,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package com.UserRegistration.UserCrudRegistration.config;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableWebMvc
public class WebConfiguration implements WebMvcConfigurer {
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
// Load file: validation.properties
messageSource.setBasename("classpath:validation");
messageSource.setDefaultEncoding("UTF-8");
return messageSource;
}
} | [
"[email protected]"
]
| |
64182519323e1a29f20dc57161bb561032095fbf | 29c9d7f947bdc85f58d1a3d2fe64b302a969496c | /codes/oop/src/main/java/io/github/dunwu/javacore/object/ClassDemo01.java | dc9b7beb8893d926f57cf1c3f31aa44303c30cca | [
"MIT"
]
| permissive | zwkzwk/javacore | 80a6c5058df45a8a22ce23cdeffbd2df16fc6238 | b97ed0f44001d8c79855f68fc603eb5eedda8605 | refs/heads/master | 2020-06-06T20:14:13.709575 | 2019-08-26T08:08:35 | 2019-08-26T08:08:35 | 192,842,859 | 0 | 0 | MIT | 2019-08-26T08:08:37 | 2019-06-20T03:34:19 | Java | UTF-8 | Java | false | false | 301 | java | package io.github.dunwu.javacore.object;
public class ClassDemo01 {
public static void main(String[] args) {
// 创建并实例化对象
Person person1 = new Person();
// 先声明再实例化对象
Person person2 = null;
person2 = new Person();
}
};
| [
"[email protected]"
]
| |
332b88430c46fb4a7a64d9e48f4e911591b3f33a | f199cd024ec23dc9bd2851af3948797370077ac2 | /src/com/syntax/Class16/Task4.java | 1b1b3706dd87a9580cf3afd5b6f9c4b643ca6ccb | []
| no_license | MartaOstash/JavaBatch8 | f16d40a12d464af049aefdb1c03d377ec3a12e64 | aabc6bab11a74bf22e1c8fc0507a0991ac7c87b4 | refs/heads/main | 2023-01-09T14:39:19.543775 | 2020-11-14T21:25:58 | 2020-11-14T21:25:58 | 312,905,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.syntax.Class16;
public class Task4 {
static void Hello(String country) {
String hello = "";
switch (country) {
case "Spain":
hello = "Hola";
break;
case "Italy":
hello = "Ciao";
break;
case "Russia":
hello = "Privet";
break;
case "China":
hello = "Ni hao";
break;
default:
hello = "No information";
break;
}
System.out.println("Hello in " + country + " is " + hello);
}
} | [
"[email protected]"
]
| |
abd1630e04249d524eedd7657c9f7759e223b25d | a4b9f95e25c3f9c1c45d3359b9d48b335053ebd8 | /impc_prod_tracker/dto/src/main/java/org/gentar/organization/person/PersonRoleWorkUnitDTO.java | 03e76941711b2a467d4d524c396ffd348a68daf6 | [
"Apache-2.0"
]
| permissive | mpi2/impc-production-tracker | cbc6a25e926b1d8a0e658a168b6afba5f26902b5 | 07ea235fe74643a322ac4c4e3525d13c6e14e9de | refs/heads/master | 2023-08-18T13:04:24.124623 | 2023-08-16T13:06:09 | 2023-08-16T13:06:09 | 170,522,962 | 3 | 8 | Apache-2.0 | 2023-08-16T13:06:11 | 2019-02-13T14:37:28 | Java | UTF-8 | Java | false | false | 254 | java | package org.gentar.organization.person;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@Data
@RequiredArgsConstructor
public class PersonRoleWorkUnitDTO
{
private Long id;
private String workUnitName;
private String roleName;
}
| [
"[email protected]"
]
| |
cf9788c56720421a8e52888f540238a4b7c7be2e | bbba83e7a2e5ab85f191bc51e19df23d785dfedb | /app/src/main/java/com/example/app_zing/activity/manhinhapp.java | beeb901b695e1517ff02de3416b2def3273ddf26 | []
| no_license | datcaoquoc/app-nhac | b1d4af2dbde9c333b7d23e991910ab63189c033a | bb1510e14d66fa4a2301a8371bf9cdb4ebc570ed | refs/heads/master | 2022-12-21T14:49:53.421204 | 2020-09-22T08:51:02 | 2020-09-22T08:51:02 | 297,589,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,776 | java | package com.example.app_zing.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import com.example.app_zing.R;
public class manhinhapp extends AppCompatActivity {
Button btnformdangki, btnformdangnhap;
SharedPreferences sharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_manhinhapp);
anhxa();
sharedPreferences = getSharedPreferences("datalogin",MODE_PRIVATE);
boolean idcheck = sharedPreferences.getBoolean("check", false);
if (idcheck == true){
Intent intent = new Intent(manhinhapp.this,manhinhgiaodien.class);
startActivity(intent);
}
btnformdangki.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(manhinhapp.this, dangki.class);
startActivity(intent);
}
});
btnformdangnhap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent inten1 = new Intent(manhinhapp.this, dangnhap.class);
startActivity(inten1);
}
});
}
private void anhxa() {
btnformdangki = findViewById(R.id.btnformdangki);
btnformdangnhap = findViewById(R.id.btnformdangnhap);
}
} | [
"[email protected]"
]
| |
080470ce43ae180d84d4d4e540d254c980d31f38 | a2dc00335c24c06311c11a3686b2c22d78f4702b | /Hashtables/BucketSort/src/nbattel/BucketSort/Main.java | 32b32506b824c3be8f0b17973eb6b3f167a44a45 | [
"MIT"
]
| permissive | Cr0ckyy/Java-AlgorithmsAndDataStructures | 04a80289d815279062d420a186e960f57a178ead | 78fc4974f28f53dc2fcb0e53d589a0121588ecd5 | refs/heads/master | 2022-02-05T13:22:03.685019 | 2019-03-01T05:56:00 | 2019-03-01T05:56:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,341 | java | package nbattel.BucketSort;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class Main {
public static void main(String[] args)
{
int[] intArray = {54, 46, 83, 66, 95, 92, 43};
bucketSort(intArray);
for(int i = 0; i < intArray.length; i++)
{
System.out.println(intArray[i]);
}
}
public static void bucketSort(int[] input)
{
List<Integer>[] buckets = new List[10];
for(int i = 0; i < buckets.length; i++)
{
//Using Linked Lis for the buckets
buckets[i] = new LinkedList<Integer>();
//Using Array List for the buckets
//buckets[i] = new LinkedList<Integer>();
}
for(int i = 0; i < input.length; i++)
{
buckets[hash(input[i])].add(input[i]);
}
for(List bucket: buckets)
{
Collections.sort(bucket);
}
int j = 0;
for(int i = 0; i < buckets.length; i++)
{
for(int value: buckets[i])
{
input[j++] = value;
}
}
}
private static int hash(int value)
{
return value / (int) 10;
}
}
| [
"[email protected]"
]
| |
d5e93d9c9f9aba9b863507bc870b5413f5a52740 | 93b2eb3f6aa15ceec4d7be5b69c56cb56e051fbb | /WTFCore/src/main/java/com/drc/wtf/execution/StepExecutor.java | 80799fd413a95532cefbfb9071b49a39a525d70f | []
| no_license | lgundeboina/selkeydriven | 8301a17a37c9475d5cfccf038b07f4217521d716 | 04042f760447bd8056ee9850ea945a4b9ed27828 | refs/heads/master | 2021-05-30T01:43:39.380000 | 2015-12-08T22:16:29 | 2015-12-08T22:16:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,978 | java | /*
*
*/
package com.drc.wtf.execution;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.LocalFileDetector;
import org.openqa.selenium.remote.RemoteWebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.SkipException;
import DRC.AutomationFramework.WebDriver.DriverSetup;
import DRC.AutomationFramework.WebDriver.RemoteDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import com.drc.wtf.actions.base.ActionBase;
import com.drc.wtf.actions.iat.Login;
import com.drc.wtf.core.CaptureData;
import com.drc.wtf.core.CodeTimer;
import com.drc.wtf.core.ScreenShot;
import com.drc.wtf.exceptions.ObjectRepositoryException;
import com.drc.wtf.exceptions.RestartTestException;
import com.drc.wtf.exceptions.TestStepFailureException;
import com.drc.wtf.object_repository.Element;
import com.drc.wtf.object_repository.ObjectRepository;
import com.drc.wtf.test_management.Action;
import com.drc.wtf.test_management.TestCase;
import com.drc.wtf.test_management.TestConfigInfo;
// TODO: Auto-generated Javadoc
/**
* The Class StepExecution.
*/
public class StepExecutor implements Runnable
{
private TestCase testCase;
private RestartTestException restartTest;
public Boolean stepFinished = false;
public StepExecutor(TestCase _testCase)
{
testCase = _testCase;
restartTest =null;
}
@Override
public void run() {
restartTest =null;
stepFinished = false;
try {
ExecuteStep(testCase);
} catch (RestartTestException e) {
restartTest =e;
}
}
public RestartTestException getRestartTestException()
{
return restartTest;
}
/**
* Execute step.
*
* @param testCase the test case
* @throws RestartTestException
* @throws ObjectRepositoryException the object repository exception
*/
public void ExecuteStep(TestCase testCase) throws RestartTestException //throws ObjectRepositoryException
{
Boolean timeCode = false;
ActionBase action = null;
CodeTimer timer = new CodeTimer();
CodeTimer initTimer = new CodeTimer();
CodeTimer actionTimer = new CodeTimer();
timer.start();
//testCase.browser.wait.PageLoad();
//System.out.print("THREAD" + Thread.currentThread().getId() + "::"
// + testCase.browser.driver().toString() + "::STEP" + testCase.currentStep + '\n');
if (testCase.action.testStep == 6 )
{
int a =5;
a+=5;
}
if(testCase.action.actionName.equals("Click") && testCase.action.fieldName.equals("Link_LogOn"))
{
Login IATLogin = new Login(testCase);
try {
IATLogin.Perform();
}
catch(RestartTestException e)
{
if(e.restartTestCase)
{
throw e;
}
else
{
testCase.SetStepStatusFailed(e);
}
}
catch(TestStepFailureException | WebDriverException e)
{
RestartTestException ex = new RestartTestException(e);
if(ex.restartTestCase)
{
throw ex;
}
else
{
e.printStackTrace();
}
}
catch (InterruptedException e) {
e.printStackTrace();
return;
}
stepFinished = true;
return;
}
try
{
if(testCase.action.actionName.equals(""))
{
String sExistNotExist = testCase.action.fieldValue.trim().toUpperCase();
if (sExistNotExist.toUpperCase().equals("NOTEXIST"))
{
testCase.logging().writeLogAndConsole(
"Step # " + testCase.action.testStep + "-->"
+ testCase.action.actionName
+ ">> Field does not exist in the field in the page '"
+ testCase.action.pageName + "'");
}
else
{
String message = "Step # " + testCase.action.testStep + "-->"
+ testCase.action.actionName
+ ">> Field exists in the field in the page '"
+ testCase.action.pageName + "'";
TestStepFailureException failure = new TestStepFailureException(message);
throw failure;
}
}
else
{
try
{
action = getAction(testCase);
}
catch (TestStepFailureException e1)
{
String message =
"Step # " + testCase.action.testStep + "-->"
+ testCase.action.actionName
+ ">> is not a keyword in the Testing Framework" + "\r\n"
+ "Step # " + testCase.action.testStep + "--> Test failed";
TestStepFailureException failure = new TestStepFailureException(message);
throw failure;
}
initTimer.start();
action.InitStep();
initTimer.stop();
if(timeCode)
{
testCase.logging().writeLogAndConsole("Init took: " + initTimer.getTime());
}
actionTimer.start();
action.Perform();
actionTimer.stop();
if(timeCode)
{
testCase.logging().writeLogAndConsole("Action took: " + actionTimer.getTime());
}
stepFinished= true;
return;
}
}
catch(TestStepFailureException | WebDriverException e)
{
RestartTestException ex = new RestartTestException(e);
if(ex.restartTestCase)
{
throw ex;
}
else
{
testCase.SetStepStatusFailed(e);
}
}
catch (RuntimeException e)
{
testCase.SetStepStatusFailed(e);
}
catch (Exception e)
{
testCase.SetStepStatusFailed(e);
}
stepFinished= true;
timer.stop();
if(timeCode)
{
testCase.logging().writeLogAndConsole("This step took " + timer.getTime() +" seconds inside step execution.");
}
}
public static ActionBase getAction(TestCase testCase) throws TestStepFailureException
{
String actionName = testCase.action.actionName;
ActionBase action = null;
String className = "com.drc.wtf.actions.";
className += actionName;
try {
Class cls = Class.forName(className);
Constructor constructor;
constructor = cls.getConstructor(TestCase.class);
action = (ActionBase)constructor.newInstance(testCase);
} catch (NoSuchMethodException
| SecurityException
| ClassNotFoundException
| InstantiationException
| IllegalAccessException
| IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
TestStepFailureException failure = new TestStepFailureException("Failed to retrive base action." +
System.getProperty("line.separator") +
e.getMessage());
throw failure;
}
return action;
}
}
| [
"[email protected]"
]
| |
7f850df4a9eaa9822c74cd754479fc5cb793e17d | 127de3ca326ed0d40a4aca1f2eb71210098bbe7f | /influent-server/src/main/java/influent/server/dataaccess/CachedPersistenceAccess.java | 4ec73f86692b3b7d7ccda81cba24273605c906f0 | [
"MIT"
]
| permissive | Halfnhav/influent | 40ea6216c4d791b8c2b3cd11c392a965f9f4a530 | 92a497c5c5dd3e0092834d339ad0b27c4547d200 | refs/heads/master | 2020-12-28T19:07:45.532756 | 2014-02-12T21:37:30 | 2014-02-12T21:37:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,834 | java | /**
* Copyright (c) 2013-2014 Oculus Info Inc.
* http://www.oculusinfo.com/
*
* Released under the MIT License.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package influent.server.dataaccess;
import influent.idl.FL_Persistence;
import influent.idl.FL_PersistenceState;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import org.apache.avro.AvroRemoteException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*/
public class CachedPersistenceAccess implements FL_Persistence {
private static Logger s_logger = LoggerFactory.getLogger(CachedPersistenceAccess.class);
private final Ehcache persistenceCache;
private final Ehcache clusteringCache;
public CachedPersistenceAccess(
String ehCacheConfig,
String persistenceCacheName,
String dynamicClusteringCacheName
) {
CacheManager cacheManager = (ehCacheConfig != null) ? CacheManager.create(ehCacheConfig) : null;
if (cacheManager == null) {
s_logger.warn("ehcache property not set, persistence data won't be cached");
}
this.persistenceCache = cacheManager.getEhcache(persistenceCacheName);
this.clusteringCache = cacheManager.getEhcache(dynamicClusteringCacheName);
}
@Override
public FL_PersistenceState persistData(String sessionId, String data) {
if (persistenceCache == null) {
return FL_PersistenceState.NONE;
}
FL_PersistenceState state = (!persistenceCache.isKeyInCache(sessionId)) ? FL_PersistenceState.NEW : FL_PersistenceState.MODIFIED;
Element element = new Element(sessionId, data);
persistenceCache.put(element);
return state;
}
@Override
public String getData(String sessionId) throws AvroRemoteException {
String data = null;
if (persistenceCache == null) {
return data;
}
Element element = persistenceCache.get(sessionId);
if (element != null) {
data = element.getObjectValue().toString();
Collection<String> contextIds = getContextIdsFromData(data);
if (contextIds.size() > 3) {
Map<Object, Element> contexts = clusteringCache.getAll(contextIds);
boolean containsContext = false;
for (Element e : contexts.values()) {
if (e != null) {
containsContext = true;
break;
}
}
if (!containsContext) {
data = null;
}
}
}
return data;
}
private Collection<String> getContextIdsFromData(String data) {
Set<String> ids = new HashSet<String>();
String regex = "column_[^\"]*";
Matcher m = Pattern.compile(regex).matcher(data);
while (m.find()) {
ids.add(m.group());
}
return ids;
}
}
| [
"[email protected]"
]
| |
c84525fb12951d66e041999d9d6234ef9cb03fee | e773dd657f85e253d28f27b3d989f1e262068321 | /Server/davinci-bulk-fhir-server/src/main/java/org/hl7/davinci/atr/server/service/PatientServiceImpl.java | 19c3abaf9abd7ceeca1859595c787622835d1dac | [
"Apache-2.0"
]
| permissive | Tubbz-alt/atr | 8f4cb67e2ed43e1036f1ada8170e79e061c5325b | 889b6bb99219e0f910524366c15e4e6b28705364 | refs/heads/master | 2022-12-14T21:32:44.345252 | 2020-09-11T12:25:10 | 2020-09-11T12:25:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,302 | java | package org.hl7.davinci.atr.server.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.davinci.atr.server.dao.PatientDao;
import org.hl7.davinci.atr.server.model.DafPatient;
import org.hl7.davinci.atr.server.util.SearchParameterMap;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Patient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.parser.IParser;
@Service("patientService")
@Transactional
public class PatientServiceImpl implements PatientService {
public static final String RESOURCE_TYPE = "Patient";
@Autowired
private PatientDao patientDao;
@Autowired
FhirContext fhirContext;
@Override
public Patient getPatientByVersionId(int theId, String versionId) {
Patient patient = null;
IParser jsonParser = fhirContext.newJsonParser();
DafPatient dafPatient = patientDao.getPatientByVersionId(theId, versionId);
if(dafPatient != null) {
patient = jsonParser.parseResource(Patient.class, dafPatient.getData());
patient.setId(patient.getId());
}
return patient;
}
@Override
public Patient getPatientById(int theId) {
Patient patient = null;
IParser jsonParser = fhirContext.newJsonParser();
DafPatient dafPatient = patientDao.getPatientById(theId);
if(dafPatient != null) {
patient = jsonParser.parseResource(Patient.class, dafPatient.getData());
patient.setId(patient.getId());
}
return patient;
}
@Override
public DafPatient createPatient(Patient thePatient) {
return patientDao.createPatient(thePatient);
}
@Override
public DafPatient updatePatientById(int id, Patient thePatient) {
return patientDao.updatePatientById(id, thePatient);
}
@Override
public List<Patient> search(SearchParameterMap paramMap) {
Patient patient = null;
List<Patient> patientList = new ArrayList<>();
IParser jsonParser = fhirContext.newJsonParser();
List<DafPatient> dafPatientList = patientDao.search(paramMap);
if(dafPatientList != null && !dafPatientList.isEmpty()) {
for(DafPatient dafPatient : dafPatientList) {
patient = jsonParser.parseResource(Patient.class, dafPatient.getData());
patient.setId(patient.getId());
patientList.add(patient);
}
}
return patientList;
}
@Override
@Transactional
public List<Patient> getPatientJsonForBulkData(List<String> patients, Date start, Date end) {
Patient patient = null;
List<Patient> patientList = new ArrayList<>();
List<DafPatient> dafPatientList = new ArrayList<>();
IParser jsonParser = fhirContext.newJsonParser();
if(patients != null) {
for(String id : patients) {
DafPatient dafPatientObj = patientDao.getPatientJsonForBulkData(id, start, end);
dafPatientList.add(dafPatientObj);
}
}
else {
dafPatientList = patientDao.getAllPatientJsonForBulkData(start, end);
}
if(dafPatientList != null && !dafPatientList.isEmpty()) {
for(DafPatient dafPatient : dafPatientList) {
patient = jsonParser.parseResource(Patient.class, dafPatient.getData());
patient.setId(patient.getId());
patientList.add(patient);
}
}
return patientList;
}
}
| [
"[email protected]"
]
| |
2902ae4013aa205572eb77344fd168f40e03bff3 | 38db4ac34c0bac5ab130a8f3ace016af5ebafb7b | /app/src/main/java/cloud/com/redcircle/adapter/viewholder/MViewHolder.java | 0f03adc9476984a21e54810025688a2684a1a304 | []
| no_license | chenyunzhan/redcircle_Android | 9944a9dfc732fcd4a62d2e0b50c2a1961d61d391 | 21ae046703d61389b35523fed08776450d7b51ae | refs/heads/master | 2021-01-17T12:49:42.814080 | 2016-12-19T23:22:51 | 2016-12-19T23:22:51 | 56,112,981 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package cloud.com.redcircle.adapter.viewholder;
import android.view.View;
/**
* Created by 大灯泡 on 2016/2/18.
* 普通vh接口化
*
* weblink:http://www.jianshu.com/p/56cf20a29a02
*/
public interface MViewHolder {
void onInFlate(View v);
}
| [
"[email protected]"
]
| |
25e8a032fde8cefc0f5304c5b2483bc54b6c6107 | 48c98c47b78670301d634fbc8ad99e2fdc86d1f7 | /simulator-core/src/main/java/org/jetlinks/simulator/core/network/udp/UDPClient.java | e1d1909de04c216cb3bb251b4e5638968c424038 | [
"Apache-2.0"
]
| permissive | jetlinks/device-simulator | 3c94385443dc02c9e766fd8930da3993b7dfc9f4 | 6184408f59b096696d6ba6509b9cc8bfc37b99c0 | refs/heads/master | 2023-04-13T04:58:03.782611 | 2023-04-10T02:57:26 | 2023-04-10T02:57:26 | 176,395,531 | 57 | 63 | Apache-2.0 | 2023-08-25T10:35:55 | 2019-03-19T01:05:15 | Java | UTF-8 | Java | false | false | 4,116 | java | package org.jetlinks.simulator.core.network.udp;
import io.netty.buffer.ByteBuf;
import io.netty.util.ReferenceCountUtil;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.datagram.DatagramPacket;
import io.vertx.core.datagram.DatagramSocket;
import org.jetlinks.simulator.core.Global;
import org.jetlinks.simulator.core.network.*;
import reactor.core.Disposable;
import reactor.core.publisher.Mono;
import java.net.InetSocketAddress;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
public class UDPClient extends AbstractConnection {
private final String id;
private final DatagramSocket socket;
private final InetSocketAddress remote;
private final Address address;
private final List<Consumer<DatagramPacket>> handlers = new CopyOnWriteArrayList<>();
public UDPClient(String id,
DatagramSocket socket,
InetSocketAddress remote,
Address address) {
this.id = id;
this.socket = socket;
this.remote = remote;
this.address = address;
changeState(State.connected);
socket.handler(packet -> {
received(packet.data().length());
for (Consumer<DatagramPacket> handler : handlers) {
handler.accept(packet);
}
});
}
public InetSocketAddress getRemote() {
return remote;
}
public InetSocketAddress getLocal() {
return InetSocketAddress.createUnresolved(
socket.localAddress().host(),
socket.localAddress().port()
);
}
public static Mono<UDPClient> create(UDPOptions options) {
Address address = AddressManager.global().takeAddress(options.getLocalAddress());
options.setLocalAddress(address.getAddress().getHostAddress());
return Mono.fromCompletionStage(() -> {
options.setReusePort(true);
return Global
.vertx()
.createDatagramSocket(options)
.listen(0, options.getLocalAddress())
.map(socket -> new UDPClient(options.getId(),
socket,
InetSocketAddress.createUnresolved(options.getHost(), options.getPort()),
address))
.toCompletionStage();
});
}
@Override
public String getId() {
return id;
}
public void send(Object packet) {
sendAsync(packet)
.subscribe();
}
public Disposable handlePayload(Consumer<Buffer> buffer) {
return handle(packet -> {
buffer.accept(packet.data());
});
}
public Disposable handle(Consumer<DatagramPacket> consumer) {
this.handlers.add(consumer);
return () -> this.handlers.remove(consumer);
}
@Override
public void reset() {
super.reset();
this.handlers.clear();
}
public Mono<Void> sendAsync(String host, int port, Object packet) {
ByteBuf buf = NetworkUtils.castToByteBuf(packet);
Buffer buffer = Buffer.buffer(buf);
int len = buffer.length();
return Mono.fromCompletionStage(() -> socket
.send(Buffer.buffer(buf), port, host)
.toCompletionStage())
.doAfterTerminate(() -> {
sent(len);
ReferenceCountUtil.safeRelease(buf);
})
.doOnError(this::error);
}
public Mono<Void> sendAsync(Object packet) {
return sendAsync(remote.getHostString(), remote.getPort(), packet);
}
@Override
protected void doDisposed() {
address.release();
socket.close();
super.doDisposed();
}
@Override
public NetworkType getType() {
return NetworkType.udp_client;
}
@Override
public boolean isAlive() {
return true;
}
}
| [
"[email protected]"
]
| |
47595bff7829f10270508fa788ca9ad341f5901f | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/autogen/mmdata/rpt/cf.java | 20b9bea47e74d4d9508475e2271d93697ea7caef | []
| no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 4,606 | java | package com.tencent.mm.autogen.mmdata.rpt;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.report.a;
public final class cf
extends a
{
public int ivK = -1;
public long ivm;
public long ivn;
public long ivo;
public int ivp;
public int ivq;
public int ivr;
public int ivs;
public long ivt;
public long ivu;
public long ivv;
private String ivw = "";
private String ivx = "";
public int ivy;
public final String aIE()
{
AppMethodBeat.i(368237);
Object localObject = new StringBuffer();
((StringBuffer)localObject).append(this.ivm);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivn);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivo);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivp);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivq);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivr);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivs);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivt);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivu);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivv);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivw);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivx);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivy);
((StringBuffer)localObject).append(",");
((StringBuffer)localObject).append(this.ivK);
localObject = ((StringBuffer)localObject).toString();
aUm((String)localObject);
AppMethodBeat.o(368237);
return localObject;
}
public final String aIF()
{
AppMethodBeat.i(368247);
Object localObject = new StringBuffer();
((StringBuffer)localObject).append("ResultCode:").append(this.ivm);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("AliveType:").append(this.ivn);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("FinalState:").append(this.ivo);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("PrepareCgiErrorCode:").append(this.ivp);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("ConfigCgiErrorCode:").append(this.ivq);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("CdnErrorCode:").append(this.ivr);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("VerifyCgiErrorCode:").append(this.ivs);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("CdnCost:").append(this.ivt);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("LivenessCost:").append(this.ivu);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("ResetCount:").append(this.ivv);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("StateRecord:").append(this.ivw);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("AndroidStateRecord:").append(this.ivx);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("FaceReset:").append(this.ivy);
((StringBuffer)localObject).append("\r\n");
((StringBuffer)localObject).append("ErrorType:").append(this.ivK);
localObject = ((StringBuffer)localObject).toString();
AppMethodBeat.o(368247);
return localObject;
}
public final int getId()
{
return 21131;
}
public final cf lx(String paramString)
{
AppMethodBeat.i(368217);
this.ivw = F("StateRecord", paramString, true);
AppMethodBeat.o(368217);
return this;
}
public final cf ly(String paramString)
{
AppMethodBeat.i(368225);
this.ivx = F("AndroidStateRecord", paramString, true);
AppMethodBeat.o(368225);
return this;
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes9.jar
* Qualified Name: com.tencent.mm.autogen.mmdata.rpt.cf
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
]
| |
8a48bb22c8ab020b9caa14ec7227fd2759334a5f | 6daa1b79ecb41b111291712875474ce062954c02 | /kodilla-patterns2/src/main/java/com/kodilla/patterns2/adapter/bookclasifier/MedianAdapter.java | b22b795982ccc60228ebef35e028f6e97aa108d0 | []
| no_license | joannagrobelak/joanna-grobelak-kodilla-java2 | 29d4b35b2e5a148e28c83304fad1e9b59c77910e | 819da1b55c29c9e4134cfaab1dfeb4255c0c24a3 | refs/heads/master | 2021-07-25T10:56:31.881388 | 2018-11-03T17:24:49 | 2018-11-03T17:24:49 | 136,919,388 | 0 | 0 | null | 2018-11-03T17:40:05 | 2018-06-11T11:53:06 | Java | UTF-8 | Java | false | false | 898 | java | package com.kodilla.patterns2.adapter.bookclasifier;
import com.kodilla.patterns2.adapter.bookclasifier.librarya.Book;
import com.kodilla.patterns2.adapter.bookclasifier.librarya.Clasifier;
import com.kodilla.patterns2.adapter.bookclasifier.libraryb.BookSignature;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class MedianAdapter extends MedianAdaptee implements Clasifier {
@Override
public int publicationYearMedian(Set<Book> bookSet) {
Map<BookSignature, com.kodilla.patterns2.adapter.bookclasifier.libraryb.Book> bookMap = new HashMap<>();
bookSet.stream().forEach(b -> bookMap.put(new BookSignature(b.getSignature()),
(new com.kodilla.patterns2.adapter.bookclasifier.libraryb.Book(
b.getAuthor(), b.getTitle(), b.getPublicationYear()))));
return medianPubliationYear(bookMap);
}
}
| [
"[email protected]"
]
| |
b11ce2fc1cbb2e3ee543ca8c14a5dc09b7255bb2 | 553a98070c46f1e4a42158a956591733df82b30a | /src/main/java/com/example/jpaexamen/Estudiante/infrastructure/controller/UserController.java | 02129302be478a062abe74dbc9b75fff3cdf0fa8 | []
| no_license | SergioLF1/java-examen | bfed964e5c4aa31ee33eac46f0520637cda6edbd | 2b6e85a9bbd3e44626afec94e132cd1712719c39 | refs/heads/master | 2023-05-06T04:47:51.689529 | 2021-05-13T11:19:06 | 2021-05-13T11:19:06 | 363,084,521 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,539 | java | package com.example.jpaexamen.Estudiante.infrastructure.controller;
import com.example.jpaexamen.Estudiante.infrastructure.controller.DTO.EstudianteInputDto;
import com.example.jpaexamen.Estudiante.infrastructure.controller.DTO.EstudianteOutputDto;
import com.example.jpaexamen.Estudiante.domain.User;
import com.example.jpaexamen.Estudiante.infrastructure.repository.UserPort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@CrossOrigin(origins = "http://localhost:4200")
@RestController
@RequestMapping({"/user"})
public class UserController {
@Autowired
UserPort userPort;
//Get All
@GetMapping("/get")
public List<EstudianteOutputDto> getAllContacts() {
List<User> list = userPort.findAll();
List<EstudianteOutputDto> list1 = new ArrayList<EstudianteOutputDto>();
EstudianteOutputDto dtoUser;
for (User user : list) {
dtoUser = new EstudianteOutputDto(user);
list1.add(dtoUser);
}
return list1;
}
//Add
@PostMapping("/add")
public User agregar(@RequestBody EstudianteInputDto dtoUser) {
User user = new User(dtoUser);
return userPort.save(user);
}
//Get by Id
@GetMapping("/get/{id}")
public EstudianteOutputDto getOneDto(@PathVariable String id) throws Exception {
User user = userPort.findById(id).orElseThrow(() -> new Exception("Not found"));
EstudianteOutputDto dtoUser = new EstudianteOutputDto(user);
return dtoUser;
}
//Delete
@DeleteMapping(value = "/delete/{id}")
public void borrarUsuarioById(@PathVariable String id) {
Optional<User> c = userPort.findById(id);
if (c.isPresent()) {
userPort.deleteById(id);
}
}
//Edit
@PutMapping(value = "/edit/{id}")
public ResponseEntity<EstudianteInputDto> updateUser(@PathVariable("id") String id, @RequestBody EstudianteInputDto dtoUser) {
Optional<User> userData = userPort.findById(id);
if (userData.isPresent()) {
User user = userData.get();
user = new User(dtoUser);
userPort.save(user);
return new ResponseEntity<>(dtoUser, HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
}
}
| [
"[email protected]"
]
| |
067087274bdae9ffc41c6832c9444953b04f5a3e | e23ef528f8e127553b3a714c4d5cad2550bc52f2 | /Cloud-Netty/src/main/java/com/cloud/staff/netty/echo/EchoServiceHandler.java | c5d998a2afe7c707166c75d6f9aff887bbe84c9a | []
| no_license | liuqianxi/Spring-Cloud | 4b96935e5d2c5e44784d759087de7bfd2c00657b | e3c418ce8adb6a58ae16308e792de52c3c6bbd3a | refs/heads/master | 2023-03-15T20:09:42.963441 | 2021-03-03T03:35:35 | 2021-03-03T03:35:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java | package com.cloud.staff.netty.echo;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import java.nio.ByteBuffer;
/**
* @ClassName EchoService
* @Description : 功能说明
*
* ChannelRead() -对于每个传入消息都要调用
*
* ChannelReadComplete() -通知ChannelInboundHandler最后一次对channelRead()的调用是当前批量读取中的最后一条消息
*
* exceptionCaught()—在读取操作期间,有异常抛出时会调用
*
* @Author : 赵参谋
* @Date : 2020/8/3 0:41
*/
@ChannelHandler.Sharable
public class EchoServiceHandler extends ChannelInboundHandlerAdapter {
/**
* 接收消息
* @param ctx
* @param msg
* @throws Exception
*/
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
// ByteBuffer in = (ByteBuffer) msg;
System.out.println("Service recived:"+msg);
ctx.write(msg);
}
/**
*
* @param ctx
*/
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.writeAndFlush(Unpooled.EMPTY_BUFFER)
.addListener(ChannelFutureListener.CLOSE);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) {
cause.printStackTrace();
ctx.close();
}
}
| [
"[email protected]"
]
| |
1235d06111bed4ce6ab19b6799a574af704bda0f | 5838b7805268808e0e3357c162bef7e9261bf894 | /xlogging/src/main/java/com/hello2mao/xlogging/internal/tcp/tcpv1/TcpV1.java | 32fe9606c76ad7b65e8464728570a0fa177aaeaa | [
"Apache-2.0"
]
| permissive | gybin02/XLogging | 0300b4b7fef54f11eb4b454a5fa9022dc4ea408f | 46bb7038dfe642938324a4ba4b0b36e30c272154 | refs/heads/master | 2021-05-09T05:55:52.211880 | 2017-10-29T13:58:40 | 2017-10-29T13:58:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package com.hello2mao.xlogging.internal.tcp.tcpv1;
import com.hello2mao.xlogging.internal.log.XLog;
import com.hello2mao.xlogging.internal.log.XLogManager;
import java.net.Socket;
public class TcpV1 {
private static final XLog log = XLogManager.getAgentLog();
private static boolean installed = false;
public static boolean install() {
if (installed) {
log.debug("Already install MonitoredSocketImplV1");
return true;
}
MonitoredSocketImplFactoryV1 socketImplFactory = new MonitoredSocketImplFactoryV1();
try {
Socket.setSocketImplFactory(socketImplFactory);
installed = true;
return true;
} catch (Throwable t) {
t.printStackTrace();
return installed;
}
}
}
| [
"[email protected]"
]
| |
8d0f38a0b707ab60b4e8bbd76e198560e537ebc3 | 2db67d27cd3dc324ea396d56d104c908ac911eca | /BinScure/0.4/src/main/kotlin/org/objectweb/asm/commons/MethodRemapper.java | 515c9e7c801eb0ed7eabd7fe0db37328956c1496 | []
| no_license | XeonLyfe/Archive | 61283a8fb4a9c1065d4aaf7d68ccd8446ee93768 | a4d6954e169663eeec79bfefd034a96a98e78e7e | refs/heads/main | 2023-08-14T09:46:02.589056 | 2021-10-14T13:37:18 | 2021-10-14T13:37:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,422 | java | // ASM: a very small and fast Java bytecode manipulation framework
// Copyright (c) 2000-2011 INRIA, France Telecom
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holders nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
package org.objectweb.asm.commons;
import org.objectweb.asm.*;
import static org.objectweb.asm.Opcodes.H_INVOKESTATIC;
/**
* A {@link MethodVisitor} that remaps types with a {@link Remapper}.
*
* @author Eugene Kuleshov
*/
public class MethodRemapper extends MethodVisitor {
private static final Handle META_FACTORY = new Handle(H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;", false);
private static final Handle ALT_META_FACTORY = new Handle(H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "altMetafactory", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;", false);
/** The remapper used to remap the types in the visited field. */
protected final Remapper remapper;
/**
* Constructs a new {@link MethodRemapper}. <i>Subclasses must not use this constructor</i>.
* Instead, they must use the {@link #MethodRemapper(int,MethodVisitor,Remapper)} version.
*
* @param methodVisitor the method visitor this remapper must deleted to.
* @param remapper the remapper to use to remap the types in the visited method.
*/
public MethodRemapper(final MethodVisitor methodVisitor, final Remapper remapper) {
this(Opcodes.ASM7, methodVisitor, remapper);
}
/**
* Constructs a new {@link MethodRemapper}.
*
* @param api the ASM API version supported by this remapper. Must be one of {@link
* org.objectweb.asm.Opcodes#ASM4}, {@link org.objectweb.asm.Opcodes#ASM5} or {@link
* org.objectweb.asm.Opcodes#ASM6}.
* @param methodVisitor the method visitor this remapper must deleted to.
* @param remapper the remapper to use to remap the types in the visited method.
*/
protected MethodRemapper(
final int api, final MethodVisitor methodVisitor, final Remapper remapper) {
super(api, methodVisitor);
this.remapper = remapper;
}
@Override
public AnnotationVisitor visitAnnotationDefault() {
AnnotationVisitor annotationVisitor = super.visitAnnotationDefault();
return annotationVisitor == null
? annotationVisitor
: new AnnotationRemapper(api, annotationVisitor, remapper);
}
@Override
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitAnnotation(remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: new AnnotationRemapper(api, annotationVisitor, remapper);
}
@Override
public AnnotationVisitor visitTypeAnnotation(
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: new AnnotationRemapper(api, annotationVisitor, remapper);
}
@Override
public AnnotationVisitor visitParameterAnnotation(
final int parameter, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitParameterAnnotation(parameter, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: new AnnotationRemapper(api, annotationVisitor, remapper);
}
@Override
public void visitFrame(
final int type,
final int numLocal,
final Object[] local,
final int numStack,
final Object[] stack) {
super.visitFrame(
type,
numLocal,
remapFrameTypes(numLocal, local),
numStack,
remapFrameTypes(numStack, stack));
}
private Object[] remapFrameTypes(final int numTypes, final Object[] frameTypes) {
if (frameTypes == null) {
return frameTypes;
}
Object[] remappedFrameTypes = null;
for (int i = 0; i < numTypes; ++i) {
if (frameTypes[i] instanceof String) {
if (remappedFrameTypes == null) {
remappedFrameTypes = new Object[numTypes];
System.arraycopy(frameTypes, 0, remappedFrameTypes, 0, numTypes);
}
remappedFrameTypes[i] = remapper.mapType((String) frameTypes[i]);
}
}
return remappedFrameTypes == null ? frameTypes : remappedFrameTypes;
}
@Override
public void visitFieldInsn(
final int opcode, final String owner, final String name, final String descriptor) {
super.visitFieldInsn(
opcode,
remapper.mapType(owner),
remapper.mapFieldName(owner, name, descriptor),
remapper.mapDesc(descriptor));
}
@Override
public void visitMethodInsn(
final int opcodeAndSource,
final String owner,
final String name,
final String descriptor,
final boolean isInterface) {
if (api < Opcodes.ASM5 && (opcodeAndSource & Opcodes.SOURCE_DEPRECATED) == 0) {
// Redirect the call to the deprecated version of this method.
super.visitMethodInsn(opcodeAndSource, owner, name, descriptor, isInterface);
return;
}
super.visitMethodInsn(
opcodeAndSource,
remapper.mapType(owner),
remapper.mapMethodName(owner, name, descriptor),
remapper.mapMethodDesc(descriptor),
isInterface);
}
@Override
public void visitInvokeDynamicInsn(
final String name,
final String descriptor,
final Handle bootstrapMethodHandle,
final Object... bootstrapMethodArguments) {
Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArguments.length];
for (int i = 0; i < bootstrapMethodArguments.length; ++i) {
remappedBootstrapMethodArguments[i] = remapper.mapValue(bootstrapMethodArguments[i]);
}
if (META_FACTORY.equals(bootstrapMethodHandle) || ALT_META_FACTORY.equals(bootstrapMethodHandle)) {
String owner = Type.getReturnType(descriptor).getInternalName();
String odesc = ((Type)bootstrapMethodArguments[0]).getDescriptor();
super.visitInvokeDynamicInsn(
remapper.mapMethodName(owner, name, odesc),
remapper.mapMethodDesc(descriptor),
(Handle) remapper.mapValue(bootstrapMethodHandle),
remappedBootstrapMethodArguments);
} else {
super.visitInvokeDynamicInsn(
remapper.mapInvokeDynamicMethodName(name, descriptor),
remapper.mapMethodDesc(descriptor),
(Handle) remapper.mapValue(bootstrapMethodHandle),
remappedBootstrapMethodArguments);
}
}
@Override
public void visitTypeInsn(final int opcode, final String type) {
super.visitTypeInsn(opcode, remapper.mapType(type));
}
@Override
public void visitLdcInsn(final Object value) {
super.visitLdcInsn(remapper.mapValue(value));
}
@Override
public void visitMultiANewArrayInsn(final String descriptor, final int numDimensions) {
super.visitMultiANewArrayInsn(remapper.mapDesc(descriptor), numDimensions);
}
@Override
public AnnotationVisitor visitInsnAnnotation(
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: new AnnotationRemapper(api, annotationVisitor, remapper);
}
@Override
public void visitTryCatchBlock(
final Label start, final Label end, final Label handler, final String type) {
super.visitTryCatchBlock(start, end, handler, type == null ? null : remapper.mapType(type));
}
@Override
public AnnotationVisitor visitTryCatchAnnotation(
final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitTryCatchAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: new AnnotationRemapper(api, annotationVisitor, remapper);
}
@Override
public void visitLocalVariable(
final String name,
final String descriptor,
final String signature,
final Label start,
final Label end,
final int index) {
super.visitLocalVariable(
name,
remapper.mapDesc(descriptor),
remapper.mapSignature(signature, true),
start,
end,
index);
}
@Override
public AnnotationVisitor visitLocalVariableAnnotation(
final int typeRef,
final TypePath typePath,
final Label[] start,
final Label[] end,
final int[] index,
final String descriptor,
final boolean visible) {
AnnotationVisitor annotationVisitor =
super.visitLocalVariableAnnotation(
typeRef, typePath, start, end, index, remapper.mapDesc(descriptor), visible);
return annotationVisitor == null
? annotationVisitor
: new AnnotationRemapper(api, annotationVisitor, remapper);
}
}
| [
"[email protected]"
]
| |
ad8369f3d3344828402eb9852dec59a35c8aa3b8 | 5fd4aaca3f800e7632bd542425a90c8c1390c405 | /Part7CleanCodeAndRefactoringBt/java-cleancode-refactoring-exercise-master/src/TennisGame.java | 178319fa95e2f5e212d2bb43f84b55eedf731631 | []
| no_license | HaiVo1994/Web_Back-end_Development | 5960603a7c967c0c049d4bc210374cb849dc378c | a67bbb433f4520ec8945baa190c5db38724d1674 | refs/heads/master | 2020-08-09T11:13:26.887804 | 2019-11-06T08:09:21 | 2019-11-06T08:09:21 | 214,075,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,347 | java | public class TennisGame {
public static final int scoreZero = 0;
public static final int scoreOne = 1;
public static final int scoreTwo = 2;
public static final int scoreThree = 3;
public static String getScore(String firstPlayerName, String secondPlayerName, int firstPlayerScore, int secondPlayerScore) {
String score = "";
int tempScore = scoreZero;
if (firstPlayerScore == secondPlayerScore) {
score = getScore(firstPlayerScore);
} else if (firstPlayerScore >= 4 || secondPlayerScore >= 4) {
int minusResult = firstPlayerScore - secondPlayerScore;
if (minusResult == 1) score = "Advantage player1";
else if (minusResult == -1) score = "Advantage player2";
else if (minusResult >= 2) score = "Win for player1";
else score = "Win for player2";
} else {
for (int i = 1; i < 3; i++) {
if (i == 1) tempScore = firstPlayerScore;
else {
score += "-";
tempScore = secondPlayerScore;
}
score += getScoreDifferent(tempScore);
}
}
return score;
}
private static String getScore(int firstPlayerScore) {
String score;
switch (firstPlayerScore) {
case scoreZero:
score = "Love-All";
break;
case scoreOne:
score = "Fifteen-All";
break;
case scoreTwo:
score = "Thirty-All";
break;
case scoreThree:
score = "Forty-All";
break;
default:
score = "Deuce";
break;
}
return score;
}
private static String getScoreDifferent(int tempScore) {
String score;
switch (tempScore) {
case scoreZero:
score = "Love";
break;
case scoreOne:
score = "Fifteen";
break;
case scoreTwo:
score = "Thirty";
break;
case scoreThree:
score = "Forty";
break;
default:
score = "";
}
return score;
}
}
| [
"[email protected]"
]
| |
b0bf352ebdb3795df9b9b8df0fa210b38b9238d6 | 86960aa32d28cb584be56cbc2b5a7e2e940be802 | /src/main/java/sk/fei/stuba/zadanie3/domain/contracts/life/TravelInsurance.java | b950f6fbfa8e7a6191e88ecf9b081aa56a20efbf | []
| no_license | HudakSamuel/frontend-to-backend-java | ac04c833775d20386fe41962bb45c183be3114a4 | 459b5524f22ff31a7cfbdb975bbb13369ab489c2 | refs/heads/master | 2023-05-06T07:58:52.534773 | 2020-06-26T18:43:46 | 2020-06-26T18:43:46 | 275,209,423 | 0 | 0 | null | 2021-06-04T22:11:37 | 2020-06-26T17:17:36 | Java | UTF-8 | Java | false | false | 2,099 | java | package sk.fei.stuba.zadanie3.domain.contracts.life;
import sk.fei.stuba.zadanie3.domain.user.User;
import java.time.LocalDateTime;
public class TravelInsurance extends LifeInsurance {
private boolean inEU; //1 for EU, 0 outside EU
private int tripPurpouse; //1 - work, 2 - holiday, 3 - family visit
public TravelInsurance(int prevID, LocalDateTime dateOfCreation, User assurer, String dateOfBegginingOfInsurance,
String dateOfEndOfInsurance, double insuranceAmount, double monthlyPayment, User assured, boolean inEU, int tripPurpouse) {
this.id = prevID + 1;
setDateOfCreation(dateOfCreation);
setAssurer(assurer);
setDateOfBegginingOfInsurance(dateOfBegginingOfInsurance);
setDateOfEndOfInsurance(dateOfEndOfInsurance);
setInsuranceAmount(insuranceAmount);
setMonthlyPayment(monthlyPayment);
setAssured(assured);
setInEU(inEU);
setTripPurpouse(tripPurpouse);
}
public void setInEU(boolean inEU) {
this.inEU = inEU;
}
public void setTripPurpouse(int tripPurpouse) {
if (tripPurpouse == 1 || tripPurpouse == 2 || tripPurpouse == 3){
this.tripPurpouse = tripPurpouse;
}
else{ throw new IllegalArgumentException(); }
}
public boolean isInEU() {
return inEU;
}
public int getTripPurpouse() {
return tripPurpouse;
}
@Override
public String toString() {
return "TravelInsurance{" +
"inEU=" + inEU +
", tripPurpouse=" + tripPurpouse +
", assured=" + assured +
", id=" + id +
", dateOfCreation='" + dateOfCreation + '\'' +
", assurer=" + assurer +
", dateOfBegginingOfInsurance='" + dateOfBegginingOfInsurance + '\'' +
", dateOfEndOfInsurance='" + dateOfEndOfInsurance + '\'' +
", insuranceAmount=" + insuranceAmount +
", monthlyPayment=" + monthlyPayment +
'}';
}
}
| [
"[email protected]"
]
| |
9ad5ff45450cb05e284949f3689b9d2ee65356da | 49e2900eff378d984ba07e635b7ae648d35b55b9 | /belajar java/basicOOP/BasicOOP.Date/Date/TestDate.java | c3831531bf71b698c8fdee0db1bc32a8e52b2cc7 | []
| no_license | rahmadnet/learning-java | 463562517a44f5d652cb1d8e7f31b65ec7652797 | ddf6660bb2364a47ed822a4d3cbecb90d8883b20 | refs/heads/master | 2020-06-30T22:05:18.711086 | 2019-08-07T03:17:02 | 2019-08-07T03:17:02 | 200,962,492 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package Date;
public class TestDate
{
public static void main(String[] args)
{
Date d1 = new Date(2016, 4, 6);
System.out.println(d1);
d1.setYear(2012);
d1.setMonth(12);
d1.setDay(23);
System.out.println(d1);
System.out.println("Year is : " + d1.getYear());
System.out.println("Month is : " + d1.getMonth());
System.out.println("Day is : " + d1.getDay());
d1.setDate(1995, 6, 14);
System.out.println(d1);
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.