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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4d602e396ac77e42f4539c59d15ca9ecd461e490 | 37,288,906,095,569 | ab52ebe1915685baa194b62fe7add09f6f93c696 | /src/br/ikomm/hsm/model/ws/MagazineWS.java | f9620330c7e4187b0803ff0cf81b164361bfbbf4 | [] | no_license | jvlstudio/HSM-Android-NewVersion | https://github.com/jvlstudio/HSM-Android-NewVersion | 90e76f12cd4e4a956071d228df1ead430eae6b7a | 7372cfcf6ecdb9d13fc6f2512be16d861bb80b92 | refs/heads/master | 2020-06-05T05:59:54.356000 | 2014-07-03T19:39:44 | 2014-07-03T19:39:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.ikomm.hsm.model.ws;
import java.util.List;
import br.ikomm.hsm.model.Magazine;
public class MagazineWS {
public List<Magazine> data;
public String total;
}
| UTF-8 | Java | 172 | java | MagazineWS.java | Java | [] | null | [] | package br.ikomm.hsm.model.ws;
import java.util.List;
import br.ikomm.hsm.model.Magazine;
public class MagazineWS {
public List<Magazine> data;
public String total;
}
| 172 | 0.761628 | 0.761628 | 10 | 16.200001 | 13.548431 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 9 |
ac904074dc8eb967da37e143e838edd3b7968ea4 | 24,146,306,201,282 | dfb0965395e8a083b33aea170921181eacc25326 | /src/main/java/com/hexlindia/drool/common/error/exception/RequestParameterNotValidException.java | c8bfc1241457523e372de9d05fb7f50eb590adc0 | [] | no_license | AbhayChandel/drool-java-server | https://github.com/AbhayChandel/drool-java-server | 75745e1cc553b6120233d2d935a8e302be486fb8 | 2c66732b474219d590415e61bd6f15fbeac4c8ab | refs/heads/develop-0.1.0 | 2020-09-15T22:00:50.806000 | 2020-06-11T08:18:33 | 2020-06-11T08:18:33 | 223,564,068 | 0 | 0 | null | false | 2020-06-11T08:18:34 | 2019-11-23T09:31:46 | 2020-05-01T19:07:52 | 2020-06-11T08:18:33 | 724 | 0 | 0 | 30 | Java | false | false | package com.hexlindia.drool.common.error.exception;
public class RequestParameterNotValidException extends RuntimeException {
public RequestParameterNotValidException(String parameterName, String message) {
super("Invalid parameter " + parameterName + ": " + message);
}
}
| UTF-8 | Java | 290 | java | RequestParameterNotValidException.java | Java | [] | null | [] | package com.hexlindia.drool.common.error.exception;
public class RequestParameterNotValidException extends RuntimeException {
public RequestParameterNotValidException(String parameterName, String message) {
super("Invalid parameter " + parameterName + ": " + message);
}
}
| 290 | 0.768966 | 0.768966 | 7 | 40.42857 | 34.499928 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 9 |
ace9e27679ac0703fabb3af4238bdfe32154201e | 30,597,347,020,002 | 0c2f152711edad50d58a80e7fc30bf92b4a782b9 | /java/src/com/vmware/avi/sdk/model/CfgState.java | 8068e7a73eb915322bcba3878d2a2f1d0b10486a | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | vmware/alb-sdk | https://github.com/vmware/alb-sdk | 56f417c8a62f53903b7b586d5ac9e5da1a150088 | f2386af42908d3c503ec0ec6f1b00f2095b0b004 | refs/heads/eng | 2023-09-04T07:31:41.767000 | 2023-08-14T10:08:24 | 2023-08-14T10:08:24 | 53,360,534 | 30 | 26 | Apache-2.0 | false | 2023-09-08T12:21:36 | 2016-03-07T21:29:17 | 2023-08-03T15:58:03 | 2023-09-08T12:21:34 | 184,225 | 59 | 66 | 26 | Java | false | false | /*
* Copyright 2021 VMware, Inc.
* SPDX-License-Identifier: Apache License 2.0
*/
package com.vmware.avi.sdk.model;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* The CfgState is a POJO class extends AviRestResource that used for creating
* CfgState.
*
* @version 1.0
* @since
*
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CfgState extends AviRestResource {
@JsonProperty("cfg_version")
private Integer cfgVersion = null;
@JsonProperty("cfg_version_in_flight")
private Integer cfgVersionInFlight = null;
@JsonProperty("last_changed_time")
private TimeStamp lastChangedTime = null;
@JsonProperty("reason")
private String reason = null;
@JsonProperty("site_uuid")
private String siteUuid = null;
@JsonProperty("status")
private String status = "SYSERR_SUCCESS";
@JsonProperty("uuid")
private String uuid = null;
/**
* This is the getter method this will return the attribute value.
* Cfg-version synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return cfgVersion
*/
public Integer getCfgVersion() {
return cfgVersion;
}
/**
* This is the setter method to the attribute.
* Cfg-version synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param cfgVersion set the cfgVersion.
*/
public void setCfgVersion(Integer cfgVersion) {
this.cfgVersion = cfgVersion;
}
/**
* This is the getter method this will return the attribute value.
* Cfg-version in flight to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return cfgVersionInFlight
*/
public Integer getCfgVersionInFlight() {
return cfgVersionInFlight;
}
/**
* This is the setter method to the attribute.
* Cfg-version in flight to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param cfgVersionInFlight set the cfgVersionInFlight.
*/
public void setCfgVersionInFlight(Integer cfgVersionInFlight) {
this.cfgVersionInFlight = cfgVersionInFlight;
}
/**
* This is the getter method this will return the attribute value.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return lastChangedTime
*/
public TimeStamp getLastChangedTime() {
return lastChangedTime;
}
/**
* This is the setter method to the attribute.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param lastChangedTime set the lastChangedTime.
*/
public void setLastChangedTime(TimeStamp lastChangedTime) {
this.lastChangedTime = lastChangedTime;
}
/**
* This is the getter method this will return the attribute value.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return reason
*/
public String getReason() {
return reason;
}
/**
* This is the setter method to the attribute.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param reason set the reason.
*/
public void setReason(String reason) {
this.reason = reason;
}
/**
* This is the getter method this will return the attribute value.
* Site_uuid to which the object was synced.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return siteUuid
*/
public String getSiteUuid() {
return siteUuid;
}
/**
* This is the setter method to the attribute.
* Site_uuid to which the object was synced.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param siteUuid set the siteUuid.
*/
public void setSiteUuid(String siteUuid) {
this.siteUuid = siteUuid;
}
/**
* This is the getter method this will return the attribute value.
* Status of the object.
* Enum options - SYSERR_SUCCESS, SYSERR_FAILURE, SYSERR_OUT_OF_MEMORY, SYSERR_NO_ENT, SYSERR_INVAL, SYSERR_ACCESS, SYSERR_FAULT, SYSERR_IO,
* SYSERR_TIMEOUT, SYSERR_NOT_SUPPORTED, SYSERR_NOT_READY, SYSERR_UPGRADE_IN_PROGRESS, SYSERR_WARM_START_IN_PROGRESS, SYSERR_TRY_AGAIN,
* SYSERR_NOT_UPGRADING, SYSERR_PENDING, SYSERR_EVENT_GEN_FAILURE, SYSERR_CONFIG_PARAM_MISSING, SYSERR_RANGE, SYSERR_BAD_REQUEST...
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as "SYSERR_SUCCESS".
* @return status
*/
public String getStatus() {
return status;
}
/**
* This is the setter method to the attribute.
* Status of the object.
* Enum options - SYSERR_SUCCESS, SYSERR_FAILURE, SYSERR_OUT_OF_MEMORY, SYSERR_NO_ENT, SYSERR_INVAL, SYSERR_ACCESS, SYSERR_FAULT, SYSERR_IO,
* SYSERR_TIMEOUT, SYSERR_NOT_SUPPORTED, SYSERR_NOT_READY, SYSERR_UPGRADE_IN_PROGRESS, SYSERR_WARM_START_IN_PROGRESS, SYSERR_TRY_AGAIN,
* SYSERR_NOT_UPGRADING, SYSERR_PENDING, SYSERR_EVENT_GEN_FAILURE, SYSERR_CONFIG_PARAM_MISSING, SYSERR_RANGE, SYSERR_BAD_REQUEST...
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as "SYSERR_SUCCESS".
* @param status set the status.
*/
public void setStatus(String status) {
this.status = status;
}
/**
* This is the getter method this will return the attribute value.
* Object-uuid that is being synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return uuid
*/
public String getUuid() {
return uuid;
}
/**
* This is the setter method to the attribute.
* Object-uuid that is being synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param uuid set the uuid.
*/
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CfgState objCfgState = (CfgState) o;
return Objects.equals(this.uuid, objCfgState.uuid)&&
Objects.equals(this.cfgVersion, objCfgState.cfgVersion)&&
Objects.equals(this.cfgVersionInFlight, objCfgState.cfgVersionInFlight)&&
Objects.equals(this.status, objCfgState.status)&&
Objects.equals(this.reason, objCfgState.reason)&&
Objects.equals(this.siteUuid, objCfgState.siteUuid)&&
Objects.equals(this.lastChangedTime, objCfgState.lastChangedTime);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CfgState {\n");
sb.append(" cfgVersion: ").append(toIndentedString(cfgVersion)).append("\n");
sb.append(" cfgVersionInFlight: ").append(toIndentedString(cfgVersionInFlight)).append("\n");
sb.append(" lastChangedTime: ").append(toIndentedString(lastChangedTime)).append("\n");
sb.append(" reason: ").append(toIndentedString(reason)).append("\n");
sb.append(" siteUuid: ").append(toIndentedString(siteUuid)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| UTF-8 | Java | 9,966 | java | CfgState.java | Java | [] | null | [] | /*
* Copyright 2021 VMware, Inc.
* SPDX-License-Identifier: Apache License 2.0
*/
package com.vmware.avi.sdk.model;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* The CfgState is a POJO class extends AviRestResource that used for creating
* CfgState.
*
* @version 1.0
* @since
*
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CfgState extends AviRestResource {
@JsonProperty("cfg_version")
private Integer cfgVersion = null;
@JsonProperty("cfg_version_in_flight")
private Integer cfgVersionInFlight = null;
@JsonProperty("last_changed_time")
private TimeStamp lastChangedTime = null;
@JsonProperty("reason")
private String reason = null;
@JsonProperty("site_uuid")
private String siteUuid = null;
@JsonProperty("status")
private String status = "SYSERR_SUCCESS";
@JsonProperty("uuid")
private String uuid = null;
/**
* This is the getter method this will return the attribute value.
* Cfg-version synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return cfgVersion
*/
public Integer getCfgVersion() {
return cfgVersion;
}
/**
* This is the setter method to the attribute.
* Cfg-version synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param cfgVersion set the cfgVersion.
*/
public void setCfgVersion(Integer cfgVersion) {
this.cfgVersion = cfgVersion;
}
/**
* This is the getter method this will return the attribute value.
* Cfg-version in flight to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return cfgVersionInFlight
*/
public Integer getCfgVersionInFlight() {
return cfgVersionInFlight;
}
/**
* This is the setter method to the attribute.
* Cfg-version in flight to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param cfgVersionInFlight set the cfgVersionInFlight.
*/
public void setCfgVersionInFlight(Integer cfgVersionInFlight) {
this.cfgVersionInFlight = cfgVersionInFlight;
}
/**
* This is the getter method this will return the attribute value.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return lastChangedTime
*/
public TimeStamp getLastChangedTime() {
return lastChangedTime;
}
/**
* This is the setter method to the attribute.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param lastChangedTime set the lastChangedTime.
*/
public void setLastChangedTime(TimeStamp lastChangedTime) {
this.lastChangedTime = lastChangedTime;
}
/**
* This is the getter method this will return the attribute value.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return reason
*/
public String getReason() {
return reason;
}
/**
* This is the setter method to the attribute.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param reason set the reason.
*/
public void setReason(String reason) {
this.reason = reason;
}
/**
* This is the getter method this will return the attribute value.
* Site_uuid to which the object was synced.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return siteUuid
*/
public String getSiteUuid() {
return siteUuid;
}
/**
* This is the setter method to the attribute.
* Site_uuid to which the object was synced.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param siteUuid set the siteUuid.
*/
public void setSiteUuid(String siteUuid) {
this.siteUuid = siteUuid;
}
/**
* This is the getter method this will return the attribute value.
* Status of the object.
* Enum options - SYSERR_SUCCESS, SYSERR_FAILURE, SYSERR_OUT_OF_MEMORY, SYSERR_NO_ENT, SYSERR_INVAL, SYSERR_ACCESS, SYSERR_FAULT, SYSERR_IO,
* SYSERR_TIMEOUT, SYSERR_NOT_SUPPORTED, SYSERR_NOT_READY, SYSERR_UPGRADE_IN_PROGRESS, SYSERR_WARM_START_IN_PROGRESS, SYSERR_TRY_AGAIN,
* SYSERR_NOT_UPGRADING, SYSERR_PENDING, SYSERR_EVENT_GEN_FAILURE, SYSERR_CONFIG_PARAM_MISSING, SYSERR_RANGE, SYSERR_BAD_REQUEST...
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as "SYSERR_SUCCESS".
* @return status
*/
public String getStatus() {
return status;
}
/**
* This is the setter method to the attribute.
* Status of the object.
* Enum options - SYSERR_SUCCESS, SYSERR_FAILURE, SYSERR_OUT_OF_MEMORY, SYSERR_NO_ENT, SYSERR_INVAL, SYSERR_ACCESS, SYSERR_FAULT, SYSERR_IO,
* SYSERR_TIMEOUT, SYSERR_NOT_SUPPORTED, SYSERR_NOT_READY, SYSERR_UPGRADE_IN_PROGRESS, SYSERR_WARM_START_IN_PROGRESS, SYSERR_TRY_AGAIN,
* SYSERR_NOT_UPGRADING, SYSERR_PENDING, SYSERR_EVENT_GEN_FAILURE, SYSERR_CONFIG_PARAM_MISSING, SYSERR_RANGE, SYSERR_BAD_REQUEST...
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as "SYSERR_SUCCESS".
* @param status set the status.
*/
public void setStatus(String status) {
this.status = status;
}
/**
* This is the getter method this will return the attribute value.
* Object-uuid that is being synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @return uuid
*/
public String getUuid() {
return uuid;
}
/**
* This is the setter method to the attribute.
* Object-uuid that is being synced to follower.
* Allowed in enterprise edition with any value, essentials, basic, enterprise with cloud services edition.
* Default value when not specified in API or module is interpreted by Avi Controller as null.
* @param uuid set the uuid.
*/
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CfgState objCfgState = (CfgState) o;
return Objects.equals(this.uuid, objCfgState.uuid)&&
Objects.equals(this.cfgVersion, objCfgState.cfgVersion)&&
Objects.equals(this.cfgVersionInFlight, objCfgState.cfgVersionInFlight)&&
Objects.equals(this.status, objCfgState.status)&&
Objects.equals(this.reason, objCfgState.reason)&&
Objects.equals(this.siteUuid, objCfgState.siteUuid)&&
Objects.equals(this.lastChangedTime, objCfgState.lastChangedTime);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CfgState {\n");
sb.append(" cfgVersion: ").append(toIndentedString(cfgVersion)).append("\n");
sb.append(" cfgVersionInFlight: ").append(toIndentedString(cfgVersionInFlight)).append("\n");
sb.append(" lastChangedTime: ").append(toIndentedString(lastChangedTime)).append("\n");
sb.append(" reason: ").append(toIndentedString(reason)).append("\n");
sb.append(" siteUuid: ").append(toIndentedString(siteUuid)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 9,966 | 0.678908 | 0.678005 | 247 | 39.348179 | 37.651184 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54251 | false | false | 9 |
99704946be1e6e18a6813369a0f1f1fcb509a550 | 39,505,109,209,326 | 739dbc1d0d065a193715b4ff1bcb20a45fa5efed | /Java/XmlParsing/test/com/vivek/xmlparse/XmlParseTest.java | 4a1179d39ab31b0b659021952e890a075288d329 | [] | no_license | vivtan11/SF | https://github.com/vivtan11/SF | 128df748d1edf79b5d76f8499a882e61edf68c83 | 397a173d1b91fb730ed68aafad57c7262854971a | refs/heads/master | 2020-12-04T04:32:45.217000 | 2020-01-03T16:37:41 | 2020-01-03T16:37:41 | 231,613,702 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vivek.xmlparse;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class XmlParseTest {
@BeforeAll
static void setUpBeforeClass() throws Exception {
}
@AfterAll
static void tearDownAfterClass() throws Exception {
}
@BeforeEach
void setUp() throws Exception {
}
@AfterEach
void tearDown() throws Exception {
}
@Test
void test() {
// test proper XML input
String testStr = "This is an abstract";
assertEquals(null, XmlParse.getTextWithinTags("<abstract>"+testStr+"</abstract>"), testStr);
// some other tag
assertEquals(null, XmlParse.getTextWithinTags("<blah>"+testStr+"</blah>"), testStr);
// badly formatted XML
assertEquals(null, XmlParse.getTextWithinTags("<abstract>"+testStr+"</blah>"), "");
assertEquals(null, XmlParse.getTextWithinTags(testStr), "");
// I'd normally test for null & empty inputs, but we haven't added that code yet
}
}
| UTF-8 | Java | 1,145 | java | XmlParseTest.java | Java | [] | null | [] | package com.vivek.xmlparse;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class XmlParseTest {
@BeforeAll
static void setUpBeforeClass() throws Exception {
}
@AfterAll
static void tearDownAfterClass() throws Exception {
}
@BeforeEach
void setUp() throws Exception {
}
@AfterEach
void tearDown() throws Exception {
}
@Test
void test() {
// test proper XML input
String testStr = "This is an abstract";
assertEquals(null, XmlParse.getTextWithinTags("<abstract>"+testStr+"</abstract>"), testStr);
// some other tag
assertEquals(null, XmlParse.getTextWithinTags("<blah>"+testStr+"</blah>"), testStr);
// badly formatted XML
assertEquals(null, XmlParse.getTextWithinTags("<abstract>"+testStr+"</blah>"), "");
assertEquals(null, XmlParse.getTextWithinTags(testStr), "");
// I'd normally test for null & empty inputs, but we haven't added that code yet
}
}
| 1,145 | 0.731878 | 0.731878 | 46 | 23.891304 | 26.364691 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.326087 | false | false | 9 |
4a44c8d44fdb954900eb3d5b5472bbce134a8edf | 38,998,303,090,758 | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/schnatterer_nusic/nusic-ui-android/src/main/java/info/schnatterer/nusic/android/util/ImageUtil.java | c600de36743519211b00f90929ed0af028ae4904 | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | https://github.com/cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297000 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // isComment
package info.schnatterer.nusic.android.util;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
public class isClassOrIsInterface {
private static final Logger isVariable = isNameExpr.isMethod(ImageUtil.class);
private isConstructor() {
}
public static Bitmap isMethod(InputStream isParameter, Context isParameter) {
if (isNameExpr.isFieldAccessExpr.isFieldAccessExpr < isNameExpr.isFieldAccessExpr.isFieldAccessExpr) {
return isMethod(isNameExpr, isNameExpr);
} else {
return isMethod(isNameExpr, isNameExpr);
}
}
@TargetApi(isNameExpr.isFieldAccessExpr.isFieldAccessExpr)
private static Bitmap isMethod(InputStream isParameter, Context isParameter) {
Bitmap isVariable = isNameExpr.isMethod(isNameExpr);
if (isNameExpr != null) {
isNameExpr = isNameExpr.isMethod(isNameExpr, (int) isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr.isFieldAccessExpr), (int) isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr.isFieldAccessExpr), true);
} else {
isNameExpr.isMethod("isStringConstant");
}
return isNameExpr;
}
private static Bitmap isMethod(InputStream isParameter, Context isParameter) {
/*isComment*/
return null;
}
}
| UTF-8 | Java | 1,562 | java | ImageUtil.java | Java | [
{
"context": "// isComment\npackage info.schnatterer.nusic.android.util;\n\nimport java.io.InputStream;\n",
"end": 37,
"score": 0.6576994061470032,
"start": 26,
"tag": "USERNAME",
"value": "schnatterer"
}
] | null | [] | // isComment
package info.schnatterer.nusic.android.util;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
public class isClassOrIsInterface {
private static final Logger isVariable = isNameExpr.isMethod(ImageUtil.class);
private isConstructor() {
}
public static Bitmap isMethod(InputStream isParameter, Context isParameter) {
if (isNameExpr.isFieldAccessExpr.isFieldAccessExpr < isNameExpr.isFieldAccessExpr.isFieldAccessExpr) {
return isMethod(isNameExpr, isNameExpr);
} else {
return isMethod(isNameExpr, isNameExpr);
}
}
@TargetApi(isNameExpr.isFieldAccessExpr.isFieldAccessExpr)
private static Bitmap isMethod(InputStream isParameter, Context isParameter) {
Bitmap isVariable = isNameExpr.isMethod(isNameExpr);
if (isNameExpr != null) {
isNameExpr = isNameExpr.isMethod(isNameExpr, (int) isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr.isFieldAccessExpr), (int) isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr.isFieldAccessExpr), true);
} else {
isNameExpr.isMethod("isStringConstant");
}
return isNameExpr;
}
private static Bitmap isMethod(InputStream isParameter, Context isParameter) {
/*isComment*/
return null;
}
}
| 1,562 | 0.732394 | 0.731114 | 43 | 35.325581 | 45.546154 | 271 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.581395 | false | false | 9 |
f3a0a5b68dbdadae1e6fb8bf18d18b3d34c0dcb4 | 34,849,364,699,093 | 2b55b9e63824c2be35a7709971b0c75f048b177a | /Structure/DoubleLink/src/main/java/ru/mrchebik/DoubleLink.java | fd65b10b700cdfcb282965a17f264a450f0934a5 | [] | no_license | MrChebik/Algorithms-Training | https://github.com/MrChebik/Algorithms-Training | da0bed972c2a8759fc03598f196eb6f9c1445851 | 7fba4688e9d81680802fcc698f0da1a1a445ac30 | refs/heads/master | 2020-05-24T16:28:43.609000 | 2017-05-20T14:55:08 | 2017-05-20T14:55:08 | 84,858,525 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.mrchebik;
/**
* Created by mrchebik on 22.03.17.
*/
public class DoubleLink {
public long dData;
public DoubleLink next;
public DoubleLink previous;
public DoubleLink(long data) {
dData = data;
}
public String toString() {
return dData + " // ";
}
}
| UTF-8 | Java | 310 | java | DoubleLink.java | Java | [
{
"context": "package ru.mrchebik;\n\n/**\n * Created by mrchebik on 22.03.17.\n */\npublic class DoubleLink {\n pu",
"end": 48,
"score": 0.9996105432510376,
"start": 40,
"tag": "USERNAME",
"value": "mrchebik"
}
] | null | [] | package ru.mrchebik;
/**
* Created by mrchebik on 22.03.17.
*/
public class DoubleLink {
public long dData;
public DoubleLink next;
public DoubleLink previous;
public DoubleLink(long data) {
dData = data;
}
public String toString() {
return dData + " // ";
}
}
| 310 | 0.6 | 0.580645 | 18 | 16.222221 | 13.235288 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 9 |
be5b72c258fb6289aaa1bdb643164012772e4abf | 8,761,733,352,700 | af5c80d8b26d9ed17e4816de20c5c3a0da23c53e | /App/Web app/src/main/java/com/geziyorum/argumentresolver/TokenPersonalSharing.java | b9c9fd7e2f95a3b3c42ba7f7aa0a0a1e462e0771 | [] | no_license | tariknural/Traveller | https://github.com/tariknural/Traveller | c230b405f0492734ad6a954127f65a5b94cd4123 | 6caaadce0d27fd83fe06292e5c30976f44c4b887 | refs/heads/master | 2023-04-03T07:56:05.010000 | 2021-04-08T16:56:57 | 2021-04-08T16:56:57 | 355,907,081 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.geziyorum.argumentresolver;
public class TokenPersonalSharing {
String token;
Integer personalSharingId;
public TokenPersonalSharing(){
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Integer getPersonalSharingId() {
return personalSharingId;
}
public void setPersonalSharingId(Integer personalSharingId) {
this.personalSharingId = personalSharingId;
}
}
| UTF-8 | Java | 466 | java | TokenPersonalSharing.java | Java | [] | null | [] | package com.geziyorum.argumentresolver;
public class TokenPersonalSharing {
String token;
Integer personalSharingId;
public TokenPersonalSharing(){
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Integer getPersonalSharingId() {
return personalSharingId;
}
public void setPersonalSharingId(Integer personalSharingId) {
this.personalSharingId = personalSharingId;
}
}
| 466 | 0.748927 | 0.748927 | 30 | 14.533334 | 17.593054 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.066667 | false | false | 9 |
14c6d616121b4a82798d275a203c346cfa6de060 | 36,120,674,959,808 | 91ffd3ba548215048377dd1940bdb333b2868bae | /final/ticket-service/src/main/java/com/epam/training/ticketservice/dataaccess/projection/compositekey/ScreeningCompositeKey.java | 2e15d2f6fccce15fb5cc1acb68d9cf9b09040548 | [] | no_license | duszka-akos-attila/EPAMJavaDev | https://github.com/duszka-akos-attila/EPAMJavaDev | 38a49bea9826e99946aec474d78d4e55c9703fec | ac5623390f600f0e6b19614e1104a3641b079ecd | refs/heads/main | 2023-04-28T19:47:30.951000 | 2021-05-21T17:09:27 | 2021-05-21T17:09:27 | 365,608,571 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.epam.training.ticketservice.dataaccess.projection.compositekey;
import com.epam.training.ticketservice.dataaccess.projection.MovieProjection;
import com.epam.training.ticketservice.dataaccess.projection.RoomProjection;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.io.Serializable;
import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Data
@Embeddable
public class ScreeningCompositeKey implements Serializable {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "movie_id", referencedColumnName = "id")
private MovieProjection movieProjection;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "room_id", referencedColumnName = "id")
private RoomProjection roomProjection;
private Date screeningTime;
}
| UTF-8 | Java | 970 | java | ScreeningCompositeKey.java | Java | [] | null | [] | package com.epam.training.ticketservice.dataaccess.projection.compositekey;
import com.epam.training.ticketservice.dataaccess.projection.MovieProjection;
import com.epam.training.ticketservice.dataaccess.projection.RoomProjection;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.io.Serializable;
import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Data
@Embeddable
public class ScreeningCompositeKey implements Serializable {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "movie_id", referencedColumnName = "id")
private MovieProjection movieProjection;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "room_id", referencedColumnName = "id")
private RoomProjection roomProjection;
private Date screeningTime;
}
| 970 | 0.81134 | 0.81134 | 32 | 29.3125 | 24.087648 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.53125 | false | false | 9 |
512b7187666ebd22abb2e2b330ba17171eda87aa | 34,273,839,048,708 | 2a0075f6033f8b1b489a0d0b6d436089e1e50bc5 | /src/main/java/com/vk/vertxapi/api/TestVerticle.java | bad08f18946c2cf91d171deba8815104e4a2fd37 | [
"Apache-2.0"
] | permissive | ravibiz/vertx-api-basic | https://github.com/ravibiz/vertx-api-basic | 988aded56711a1c89808594eb269d1a34cc67586 | 4638763f2b5e248f73fb3766915b9f69bc9f0079 | refs/heads/master | 2021-01-17T12:16:06.378000 | 2018-04-16T06:56:50 | 2018-04-16T06:56:50 | 84,062,726 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vk.vertxapi.api;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
public class TestVerticle extends AbstractVerticle {
@Override
public void start(Future<Void> fut)
{
HttpServer server = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route(HttpMethod.POST, "/catalogue/products/:producttype/:productid").handler(routingContext ->
{
System.out.println("STEP-1");
String producttype = routingContext.request().getParam("producttype");
String productid = routingContext.request().getParam("productid");
System.out.println("PRODUCTTYPE = " + producttype);
System.out.println("PRODUCTID = " + productid);
routingContext.response().putHeader("content-type", "text/html")
.end("<h1>PRODUCTTYPE = " + producttype + "<br/> PRODUCTID = " + productid + "</h1>");
});
server.requestHandler(router::accept).listen(8081);
}
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(TestVerticle.class.getCanonicalName());
}
} | UTF-8 | Java | 1,190 | java | TestVerticle.java | Java | [] | null | [] | package com.vk.vertxapi.api;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
public class TestVerticle extends AbstractVerticle {
@Override
public void start(Future<Void> fut)
{
HttpServer server = vertx.createHttpServer();
Router router = Router.router(vertx);
router.route(HttpMethod.POST, "/catalogue/products/:producttype/:productid").handler(routingContext ->
{
System.out.println("STEP-1");
String producttype = routingContext.request().getParam("producttype");
String productid = routingContext.request().getParam("productid");
System.out.println("PRODUCTTYPE = " + producttype);
System.out.println("PRODUCTID = " + productid);
routingContext.response().putHeader("content-type", "text/html")
.end("<h1>PRODUCTTYPE = " + producttype + "<br/> PRODUCTID = " + productid + "</h1>");
});
server.requestHandler(router::accept).listen(8081);
}
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(TestVerticle.class.getCanonicalName());
}
} | 1,190 | 0.726891 | 0.721008 | 38 | 30.342106 | 28.080969 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.736842 | false | false | 9 |
d680c11c1ebfcb11a9168aec914401f106c901f0 | 1,640,677,515,844 | 53fec52afea20b59af0f3b24a5cdff32e4393a92 | /app/src/main/java/com/example/guest/popularmovies/db/MoviesDbHelper.java | dfefc22c8e0b2776acadad1d0d40c7bce23cae45 | [] | no_license | liinahamari/PopularMovies | https://github.com/liinahamari/PopularMovies | dce8e1813d04a93d38cab66a60f2d511cb3a7004 | b8e076e5319c45d3e03f023ff1a7552242b0c9a9 | refs/heads/master | 2021-09-13T23:30:40.785000 | 2018-05-05T18:03:57 | 2018-05-05T18:03:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.guest.popularmovies.db;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.example.guest.popularmovies.db.MoviesContract.Entry;
import com.example.guest.popularmovies.mvp.model.SingleMovie;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.example.guest.popularmovies.db.MoviesContract.Entry.*;
/**
* Created by l1maginaire on 3/22/18.
*/
public class MoviesDbHelper extends SQLiteOpenHelper {
private static final String TAG = MoviesDbHelper.class.getSimpleName();
private static final String DATABASE_NAME = "movdb.db";
private static final int DATABASE_VERSION = 1;
public MoviesDbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
final String SQL_CREATE_TABLE = "CREATE TABLE " + Entry.TABLE_NAME + " (" +
Entry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
COLUMN_MOV_ID + " INTEGER, " +
COLUMN_BACKDROP_PATH + " TEXT, " +
COLUMN_GENRE_IDS + " TEXT, " +
COLUMN_ORIGINAL_TITLE + " TEXT, " +
COLUMN_OVERVIEW + " TEXT, " +
COLUMN_POPULARITY + " DOUBLE, " +
COLUMN_POSTER_PATH + " TEXT, " +
COLUMN_RELEASE_DATE + " TEXT, " +
COLUMN_TITLE + " TEXT, " +
COLUMN_VOTE_AVERAGE + " DOUBLE, " +
COLUMN_VOTE_COUNT + " INTEGER" +
"); ";
sqLiteDatabase.execSQL(SQL_CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
Log.d(TAG, "Upgrading database... Previous version: " + i + "; actual version: " + i1);
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + Entry.TABLE_NAME);
onCreate(sqLiteDatabase);
}
} | UTF-8 | Java | 2,094 | java | MoviesDbHelper.java | Java | [
{
"context": "vies.db.MoviesContract.Entry.*;\n\n/**\n * Created by l1maginaire on 3/22/18.\n */\n\npublic class MoviesDbHelper exte",
"end": 576,
"score": 0.9996455907821655,
"start": 565,
"tag": "USERNAME",
"value": "l1maginaire"
}
] | null | [] | package com.example.guest.popularmovies.db;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.example.guest.popularmovies.db.MoviesContract.Entry;
import com.example.guest.popularmovies.mvp.model.SingleMovie;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.example.guest.popularmovies.db.MoviesContract.Entry.*;
/**
* Created by l1maginaire on 3/22/18.
*/
public class MoviesDbHelper extends SQLiteOpenHelper {
private static final String TAG = MoviesDbHelper.class.getSimpleName();
private static final String DATABASE_NAME = "movdb.db";
private static final int DATABASE_VERSION = 1;
public MoviesDbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
final String SQL_CREATE_TABLE = "CREATE TABLE " + Entry.TABLE_NAME + " (" +
Entry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
COLUMN_MOV_ID + " INTEGER, " +
COLUMN_BACKDROP_PATH + " TEXT, " +
COLUMN_GENRE_IDS + " TEXT, " +
COLUMN_ORIGINAL_TITLE + " TEXT, " +
COLUMN_OVERVIEW + " TEXT, " +
COLUMN_POPULARITY + " DOUBLE, " +
COLUMN_POSTER_PATH + " TEXT, " +
COLUMN_RELEASE_DATE + " TEXT, " +
COLUMN_TITLE + " TEXT, " +
COLUMN_VOTE_AVERAGE + " DOUBLE, " +
COLUMN_VOTE_COUNT + " INTEGER" +
"); ";
sqLiteDatabase.execSQL(SQL_CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
Log.d(TAG, "Upgrading database... Previous version: " + i + "; actual version: " + i1);
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + Entry.TABLE_NAME);
onCreate(sqLiteDatabase);
}
} | 2,094 | 0.639924 | 0.635626 | 58 | 35.120689 | 25.955584 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.706897 | false | false | 9 |
65cccc3b6c716415087c34c74c3a6dc5f6551451 | 1,047,972,075,933 | 3f200999661a99a02c52a970d25847d32471e066 | /PIPS/javatree/com/perpetual/rp/control/query/VendorQueryTemplate.java | 2d0e607030b2746a2998344a1d120d821ca6ec01 | [] | no_license | bbaloi/sample-projects | https://github.com/bbaloi/sample-projects | 59bfc0e2e7c196c5576d3bf21cf0af2cac64ab0e | f3671587e84743174d74dfb7e54890aa3112a807 | refs/heads/master | 2022-09-04T13:47:03.947000 | 2022-08-16T15:59:53 | 2022-08-16T15:59:53 | 82,860,448 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* VendorQueryTemplate.java
*
* Created on July 25, 2003, 1:47 PM
*/
package com.perpetual.rp.control.query;
/**
*
* @author brunob
*/
public abstract class VendorQueryTemplate {
/** Creates a new instance of VendorQueryTemplate */
public VendorQueryTemplate() {
}
}
| UTF-8 | Java | 301 | java | VendorQueryTemplate.java | Java | [
{
"context": "om.perpetual.rp.control.query;\n\n/**\n *\n * @author brunob\n */\npublic abstract class VendorQueryTemplate {\n ",
"end": 142,
"score": 0.9989202618598938,
"start": 136,
"tag": "USERNAME",
"value": "brunob"
}
] | null | [] | /*
* VendorQueryTemplate.java
*
* Created on July 25, 2003, 1:47 PM
*/
package com.perpetual.rp.control.query;
/**
*
* @author brunob
*/
public abstract class VendorQueryTemplate {
/** Creates a new instance of VendorQueryTemplate */
public VendorQueryTemplate() {
}
}
| 301 | 0.647841 | 0.61794 | 19 | 14.842105 | 17.655365 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.157895 | false | false | 0 |
64a6ffd19d43f9995b46f0a203eabd3cd33dfb02 | 7,756,710,963,543 | ad17042bf08df7c4153096796b027f11591db49b | /app/src/main/java/com/tinakit/moveit/LifeCycle.java | 4ef03af66ef20fbdb65e9d97a28093436531d2f4 | [] | no_license | tkfreder/MoveIt | https://github.com/tkfreder/MoveIt | 5d501972199a579eb720c85bd3751a97080b660b | 61b4c4feeff8abddcaf8831d8216e52dc3e40586 | refs/heads/master | 2021-01-17T08:11:22.271000 | 2016-04-13T18:33:15 | 2016-04-13T18:33:15 | 41,690,409 | 0 | 1 | null | false | 2016-04-08T18:06:18 | 2015-08-31T17:35:43 | 2016-01-20T19:07:13 | 2016-04-08T18:06:18 | 8,096 | 0 | 1 | 0 | Java | null | null | package com.tinakit.moveit;
/**
* Created by Tina on 12/15/2015.
*/
public interface LifeCycle {
public void start();
public void pause();
public void resume();
public void stop();
}
| UTF-8 | Java | 206 | java | LifeCycle.java | Java | [
{
"context": "package com.tinakit.moveit;\n\n/**\n * Created by Tina on 12/15/2015.\n */\npublic interface LifeCycle {\n\n",
"end": 51,
"score": 0.9601486921310425,
"start": 47,
"tag": "NAME",
"value": "Tina"
}
] | null | [] | package com.tinakit.moveit;
/**
* Created by Tina on 12/15/2015.
*/
public interface LifeCycle {
public void start();
public void pause();
public void resume();
public void stop();
}
| 206 | 0.631068 | 0.592233 | 15 | 12.733334 | 12.896855 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 0 |
3ed2660f4a2db3d1701c44f925c1eb1f8908c1a7 | 31,739,808,334,020 | 567451d1ab1c33cef39142e3adc7b9f6de06095a | /src/main/java/minsk/codeanalysis/syntax/lexer/SyntaxToken.java | b6471c2a96d6cd3a19ffa046c0ed5fd4f05e700a | [
"MIT"
] | permissive | jasoncorlett/minsk-compiler | https://github.com/jasoncorlett/minsk-compiler | 8298b9aacfd79cd0bccd2cdac43e25eb74098e29 | 85a30b2e5fd3a955bdb6b89df6a30330e5c3b532 | refs/heads/main | 2023-03-22T14:04:16.497000 | 2020-06-25T00:22:50 | 2020-06-25T00:22:50 | 263,532,675 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package minsk.codeanalysis.syntax.lexer;
import minsk.codeanalysis.syntax.SyntaxKind;
import minsk.codeanalysis.syntax.SyntaxNode;
import minsk.codeanalysis.text.TextSpan;
public class SyntaxToken extends SyntaxNode {
private final int position;
private final String text;
private final Object value;
private final SyntaxKind kind;
public SyntaxToken(SyntaxKind kind, int position, String text, Object value) {
this.kind = kind;
this.position = position;
this.text = text;
this.value = value;
}
public boolean isMissing() {
return text == null;
}
public int getPosition() {
return position;
}
public String getText() {
return text;
}
public Object getValue() {
return value;
}
@Override
public TextSpan getSpan() {
var length = (text != null) ? text.length() : 0;
return new TextSpan(position, position + length);
}
@Override
public SyntaxKind getKind() {
return kind;
}
@Override
public String toString() {
var builder = new StringBuilder();
builder.append(getKind());
if (this.getKind() == SyntaxKind.IdentifierToken) {
builder.append(" ");
builder.append(this.getText());
}
if (this.getValue() != null) {
builder.append(" ");
builder.append(this.getValue());
}
return builder.toString();
}
} | UTF-8 | Java | 1,351 | java | SyntaxToken.java | Java | [] | null | [] | package minsk.codeanalysis.syntax.lexer;
import minsk.codeanalysis.syntax.SyntaxKind;
import minsk.codeanalysis.syntax.SyntaxNode;
import minsk.codeanalysis.text.TextSpan;
public class SyntaxToken extends SyntaxNode {
private final int position;
private final String text;
private final Object value;
private final SyntaxKind kind;
public SyntaxToken(SyntaxKind kind, int position, String text, Object value) {
this.kind = kind;
this.position = position;
this.text = text;
this.value = value;
}
public boolean isMissing() {
return text == null;
}
public int getPosition() {
return position;
}
public String getText() {
return text;
}
public Object getValue() {
return value;
}
@Override
public TextSpan getSpan() {
var length = (text != null) ? text.length() : 0;
return new TextSpan(position, position + length);
}
@Override
public SyntaxKind getKind() {
return kind;
}
@Override
public String toString() {
var builder = new StringBuilder();
builder.append(getKind());
if (this.getKind() == SyntaxKind.IdentifierToken) {
builder.append(" ");
builder.append(this.getText());
}
if (this.getValue() != null) {
builder.append(" ");
builder.append(this.getValue());
}
return builder.toString();
}
} | 1,351 | 0.662472 | 0.661732 | 64 | 19.140625 | 17.436373 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.734375 | false | false | 0 |
6f7668d8b651d12bbfc0377bf4eabc9eedcc9ccb | 27,522,150,476,657 | 203922d5923c95ab8ebdcf1b809d4b870e7c891d | /src/main/java/com/witmoon/xmb/activity/card/CardOrderSubmitSuccessActivity.java | 3627f2746eaf2f8e60ee199bd7abad7faff59b7b | [] | no_license | LaymanInCoding/workspace | https://github.com/LaymanInCoding/workspace | e17de245f7f9108f44283c7e7e5c7ca7b8f40e7e | e7b24edf218caba3c91c2519180ab47fefe63e46 | refs/heads/master | 2021-01-13T08:24:52.646000 | 2017-05-17T07:15:11 | 2017-05-17T07:15:11 | 71,868,877 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.witmoon.xmb.activity.card;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.CheckedTextView;
import com.alipay.sdk.app.PayTask;
import com.androidquery.AQuery;
import com.duowan.mobile.netroid.Listener;
import com.duowan.mobile.netroid.NetroidError;
import com.orhanobut.logger.Logger;
import com.tencent.mm.opensdk.modelpay.PayReq;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.witmoon.xmb.AppContext;
import com.witmoon.xmb.MainActivity;
import com.witmoon.xmb.R;
import com.witmoon.xmb.activity.shoppingcart.OrderPaySuccessActivity;
import com.witmoon.xmb.api.MabaoCardApi;
import com.witmoon.xmb.api.alipay.AlipayResult;
import com.witmoon.xmb.base.BaseActivity;
import com.witmoon.xmb.base.Const;
import com.witmoon.xmb.model.SimpleBackPage;
import com.witmoon.xmb.util.CommonUtil;
import com.witmoon.xmb.util.UIHelper;
import com.witmoon.xmb.wxapi.simcpux.Constants;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Map;
/**
* Created by ming on 2017/3/24.
*/
public class CardOrderSubmitSuccessActivity extends BaseActivity {
//判断跨境购/普通 接口标识符
private static final String TAG = "MicroMsg.SDKSample.OrderSubmitSuccessActivity";
PayReq req;
final IWXAPI msgApi = WXAPIFactory.createWXAPI(this, null);
Map<String, String> resultunifiedorder;
StringBuffer sb;
private int fee;
String sign;
public static final int PAYMENT_ALIPAY = 0;
public static final int PAYMENT_TENPAY = 1;
public static final int PAYMENT_UNIONPAY = 2;
private CheckedTextView mAlipayText;
private CheckedTextView mTenpayText;
// private CheckedTextView mUnionPayText;
// private String mIsSplitOrder;
private String mOrderSerialNo; // 订单号
private String mOrderId;
private String mOrderSubject = ""; // 订单主题(用于subject)
private String mOrderDescription = ""; // 订单描述(用于body)
private String mOrderAmount; // 订单总金额
private AQuery aQuery;
// 支付方式
private int paymentType;
private String orderInfo;
private BroadcastReceiver wx_callback = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int code = intent.getIntExtra("code", 0);
if (code == 2) {
CommonUtil.show(CardOrderSubmitSuccessActivity.this, "支付成功", 1000);
Intent intent1 = new Intent(CardOrderSubmitSuccessActivity.this, OrderPaySuccessActivity.class);
intent1.putExtra("ORDER_SN", mOrderSerialNo);
intent1.putExtra("TYPE", "card");
startActivity(intent1);
finish();
}
}
};
public static void startActivity(Context context, String orderInfo) {
Intent intent = new Intent(context, CardOrderSubmitSuccessActivity.class);
intent.putExtra("ORDER_INFO", orderInfo);
context.startActivity(intent);
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(wx_callback);
}
@Override
protected int getLayoutResourceId() {
return R.layout.activity_order_submit_success;
}
@Override
protected void configActionBar(Toolbar toolbar) {
toolbar.setBackgroundColor(getResources().getColor(R.color.master_shopping_cart));
setTitleColor_(R.color.master_shopping_cart);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
req = new PayReq();
sb = new StringBuffer();
msgApi.registerApp(Constants.APP_ID);
}
@Override
protected void initialize(Bundle savedInstanceState) {
// 接收传过来的Json字符
Intent intent = getIntent();
orderInfo = intent.getStringExtra("ORDER_INFO");
Log.e("Log", orderInfo.toString());
try {
JSONObject orderInfoObj = new JSONObject(orderInfo);
mOrderSerialNo = orderInfoObj.getString("order_sn");
mOrderSubject = orderInfoObj.getString("subject");
mOrderDescription = orderInfoObj.getString("desc");
mOrderAmount = orderInfoObj.getString("order_amount");
Log.e("mOrderAmount", mOrderAmount);
MainActivity.CURRENT_ORDER_TYPE = "goods";
if (mOrderAmount.matches("¥\\d*\\.\\d*元")) {
mOrderAmount = mOrderAmount.substring(1, mOrderAmount.length() - 1);
}
} catch (JSONException e) {
AppContext.showToast("服务器返回数据异常");
finish();
}
IntentFilter wx_callback_filter = new IntentFilter(Const.WX_CALLBACK);
registerReceiver(wx_callback, wx_callback_filter);
aQuery = new AQuery(this);
mAlipayText = (CheckedTextView) aQuery.id(R.id.payment_alipay).clicked(this).getView();
mTenpayText = (CheckedTextView) aQuery.id(R.id.payment_tenpay).clicked(this).getView();
// mUnionPayText = (CheckedTextView) aQuery.id(R.id.payment_unionpay).clicked(this).getView();
aQuery.id(R.id.order_sn).text("订单号:" + mOrderSerialNo).clicked(this);
aQuery.id(R.id.next_step_btn).clicked(this);
aQuery.id(R.id.total_payment).text(String.format("应付金额:%s元", mOrderAmount));
// if (null != mIsSplitOrder) {
// if (mIsSplitOrder.equals("1")) {
// mAlipayText.setText("国际支付宝客户端支付");
// mTenpayText.setVisibility(View.GONE);
// }
// }
aQuery.id(R.id.next_step_btn).clickable(false);
setRecRequest(1);
}
@Override
public void setRecRequest(int currentPage) {
MabaoCardApi.getSign(mOrderSerialNo, new Listener<JSONObject>() {
@Override
public void onSuccess(JSONObject response) {
Logger.json(response.toString());
try {
sign = response.getString("data");
aQuery.id(R.id.next_step_btn).clickable(true);
Logger.d(sign);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(NetroidError error) {
sign = "";
aQuery.id(R.id.next_step_btn).clickable(true);
}
});
}
@Override
protected String getActionBarTitle() {
return "确认成功";
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.payment_alipay:
resetCheckedState();
mAlipayText.setChecked(true);
paymentType = PAYMENT_ALIPAY;
break;
case R.id.payment_tenpay:
resetCheckedState();
mTenpayText.setChecked(true);
paymentType = PAYMENT_TENPAY;
break;
// case R.id.payment_unionpay:
// resetCheckedState();
// mUnionPayText.setChecked(true);
// paymentType = PAYMENT_UNIONPAY;
// break;
case R.id.order_sn:
Bundle bundle = new Bundle();
bundle.putString("order_sn", mOrderSerialNo);
// bundle.putString(OrderDetailFragment.KEY_ORDER_TYPE, OrderType
// .TYPE_WAITING_FOR_PAYMENT.name());
UIHelper.showSimpleBack(this, SimpleBackPage.CardOrderDetail, bundle);
break;
case R.id.next_step_btn:
// 付款逻辑
switch (paymentType) {
case PAYMENT_ALIPAY:
paymentWithAlipayNew();
break;
case PAYMENT_TENPAY:
MabaoCardApi.getWXSign(mOrderSerialNo, new Listener<JSONObject>() {
@Override
public void onPreExecute() {
showWaitDialog("处理中");
}
@Override
public void onSuccess(JSONObject response) {
Logger.json(response.toString());
try {
String appId = response.getJSONObject("data").getString("appid");
String nonceStr = response.getJSONObject("data").getString("noncestr");
String packageValue = response.getJSONObject("data").getString("package");
String partnerId = response.getJSONObject("data").getString("partnerid");
String prepayId = response.getJSONObject("data").getString("prepayid");
String timeStamp = response.getJSONObject("data").get("timestamp").toString();
String sign = response.getJSONObject("data").getString("sign");
Logger.d(appId + "/" + nonceStr + "/" + packageValue + "/" + partnerId + "/" + prepayId
+ "/" + timeStamp + "/" + sign);
req.appId = appId;
req.nonceStr = nonceStr;
req.packageValue = packageValue;
req.partnerId = partnerId;
req.prepayId = prepayId;
req.timeStamp = timeStamp;
req.sign = sign;
if (msgApi.isWXAppInstalled()) {
msgApi.sendReq(req);
} else {
AppContext.showToast("没有检测到微信,请安装!");
}
} catch (JSONException e) {
e.printStackTrace();
}
hideWaitDialog();
}
@Override
public void onError(NetroidError error) {
hideWaitDialog();
AppContext.showToast("支付异常");
}
});
// GetPrepayIdTask getPrepayId = new GetPrepayIdTask();
// getPrepayId.execute();
break;
default:
AppContext.showToast("该支付方式暂未实现");
}
break;
}
}
// 通过支付宝付款
private void paymentWithAlipayNew() {
if (sign.equals("")) {
AppContext.showToast("支付异常,请重进该页面");
return;
}
PaymentAsyncTask paymentAsyncTask = new PaymentAsyncTask();
paymentAsyncTask.execute(sign);
Log.e("finalParam", sign);
}
// 重置支付方式选择状态
private void resetCheckedState() {
mAlipayText.setChecked(false);
mTenpayText.setChecked(false);
// mUnionPayText.setChecked(false);
}
// 支付异步工作类
private class PaymentAsyncTask extends AsyncTask<String, Void, Map<String, String>> {
@Override
protected Map<String, String> doInBackground(String... params) {
Log.e("支付参数_params", params[0]);
PayTask payTask = new PayTask(CardOrderSubmitSuccessActivity.this);
Map<String, String> payResult = payTask.payV2(params[0], true);
return payResult;
}
@Override
protected void onPostExecute(Map<String, String> payResult) {
// Log.e("payResult", payResult);
AlipayResult result = new AlipayResult(payResult);
String resultStatus = result.getResultStatus();
// 判断resultStatus 为“9000”则代表支付成功,具体状态码代表含义可参考接口文档
if (TextUtils.equals(resultStatus, "9000")) {
CommonUtil.show(CardOrderSubmitSuccessActivity.this, "支付成功", 1000);
Intent intent1 = new Intent(CardOrderSubmitSuccessActivity.this, OrderPaySuccessActivity.class);
intent1.putExtra("ORDER_SN", mOrderSerialNo);
intent1.putExtra("TYPE", "card");
startActivity(intent1);
finish();
} else { // 判断resultStatus 为非“9000”则代表可能支付失败
// “8000”代表支付结果因为支付渠道原因或者系统原因还在等待支付结果确认,最终交易是否成功以服务端异步通知为准(小概率状态)
if (TextUtils.equals(resultStatus, "8000")) {
CommonUtil.show(CardOrderSubmitSuccessActivity.this, "支付结果确认中", 1000);
} else {
// 其他值就可以判断为支付失败,包括用户主动取消支付,或者系统返回的错误
CommonUtil.show(CardOrderSubmitSuccessActivity.this, result.getMemo(), 1000);
}
}
}
}
}
| UTF-8 | Java | 13,881 | java | CardOrderSubmitSuccessActivity.java | Java | [
{
"context": "NObject;\n\nimport java.util.Map;\n\n/**\n * Created by ming on 2017/3/24.\n */\npublic class CardOrderSubmitSuc",
"end": 1350,
"score": 0.9991299510002136,
"start": 1346,
"tag": "USERNAME",
"value": "ming"
}
] | null | [] | package com.witmoon.xmb.activity.card;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.CheckedTextView;
import com.alipay.sdk.app.PayTask;
import com.androidquery.AQuery;
import com.duowan.mobile.netroid.Listener;
import com.duowan.mobile.netroid.NetroidError;
import com.orhanobut.logger.Logger;
import com.tencent.mm.opensdk.modelpay.PayReq;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.witmoon.xmb.AppContext;
import com.witmoon.xmb.MainActivity;
import com.witmoon.xmb.R;
import com.witmoon.xmb.activity.shoppingcart.OrderPaySuccessActivity;
import com.witmoon.xmb.api.MabaoCardApi;
import com.witmoon.xmb.api.alipay.AlipayResult;
import com.witmoon.xmb.base.BaseActivity;
import com.witmoon.xmb.base.Const;
import com.witmoon.xmb.model.SimpleBackPage;
import com.witmoon.xmb.util.CommonUtil;
import com.witmoon.xmb.util.UIHelper;
import com.witmoon.xmb.wxapi.simcpux.Constants;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Map;
/**
* Created by ming on 2017/3/24.
*/
public class CardOrderSubmitSuccessActivity extends BaseActivity {
//判断跨境购/普通 接口标识符
private static final String TAG = "MicroMsg.SDKSample.OrderSubmitSuccessActivity";
PayReq req;
final IWXAPI msgApi = WXAPIFactory.createWXAPI(this, null);
Map<String, String> resultunifiedorder;
StringBuffer sb;
private int fee;
String sign;
public static final int PAYMENT_ALIPAY = 0;
public static final int PAYMENT_TENPAY = 1;
public static final int PAYMENT_UNIONPAY = 2;
private CheckedTextView mAlipayText;
private CheckedTextView mTenpayText;
// private CheckedTextView mUnionPayText;
// private String mIsSplitOrder;
private String mOrderSerialNo; // 订单号
private String mOrderId;
private String mOrderSubject = ""; // 订单主题(用于subject)
private String mOrderDescription = ""; // 订单描述(用于body)
private String mOrderAmount; // 订单总金额
private AQuery aQuery;
// 支付方式
private int paymentType;
private String orderInfo;
private BroadcastReceiver wx_callback = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int code = intent.getIntExtra("code", 0);
if (code == 2) {
CommonUtil.show(CardOrderSubmitSuccessActivity.this, "支付成功", 1000);
Intent intent1 = new Intent(CardOrderSubmitSuccessActivity.this, OrderPaySuccessActivity.class);
intent1.putExtra("ORDER_SN", mOrderSerialNo);
intent1.putExtra("TYPE", "card");
startActivity(intent1);
finish();
}
}
};
public static void startActivity(Context context, String orderInfo) {
Intent intent = new Intent(context, CardOrderSubmitSuccessActivity.class);
intent.putExtra("ORDER_INFO", orderInfo);
context.startActivity(intent);
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(wx_callback);
}
@Override
protected int getLayoutResourceId() {
return R.layout.activity_order_submit_success;
}
@Override
protected void configActionBar(Toolbar toolbar) {
toolbar.setBackgroundColor(getResources().getColor(R.color.master_shopping_cart));
setTitleColor_(R.color.master_shopping_cart);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
req = new PayReq();
sb = new StringBuffer();
msgApi.registerApp(Constants.APP_ID);
}
@Override
protected void initialize(Bundle savedInstanceState) {
// 接收传过来的Json字符
Intent intent = getIntent();
orderInfo = intent.getStringExtra("ORDER_INFO");
Log.e("Log", orderInfo.toString());
try {
JSONObject orderInfoObj = new JSONObject(orderInfo);
mOrderSerialNo = orderInfoObj.getString("order_sn");
mOrderSubject = orderInfoObj.getString("subject");
mOrderDescription = orderInfoObj.getString("desc");
mOrderAmount = orderInfoObj.getString("order_amount");
Log.e("mOrderAmount", mOrderAmount);
MainActivity.CURRENT_ORDER_TYPE = "goods";
if (mOrderAmount.matches("¥\\d*\\.\\d*元")) {
mOrderAmount = mOrderAmount.substring(1, mOrderAmount.length() - 1);
}
} catch (JSONException e) {
AppContext.showToast("服务器返回数据异常");
finish();
}
IntentFilter wx_callback_filter = new IntentFilter(Const.WX_CALLBACK);
registerReceiver(wx_callback, wx_callback_filter);
aQuery = new AQuery(this);
mAlipayText = (CheckedTextView) aQuery.id(R.id.payment_alipay).clicked(this).getView();
mTenpayText = (CheckedTextView) aQuery.id(R.id.payment_tenpay).clicked(this).getView();
// mUnionPayText = (CheckedTextView) aQuery.id(R.id.payment_unionpay).clicked(this).getView();
aQuery.id(R.id.order_sn).text("订单号:" + mOrderSerialNo).clicked(this);
aQuery.id(R.id.next_step_btn).clicked(this);
aQuery.id(R.id.total_payment).text(String.format("应付金额:%s元", mOrderAmount));
// if (null != mIsSplitOrder) {
// if (mIsSplitOrder.equals("1")) {
// mAlipayText.setText("国际支付宝客户端支付");
// mTenpayText.setVisibility(View.GONE);
// }
// }
aQuery.id(R.id.next_step_btn).clickable(false);
setRecRequest(1);
}
@Override
public void setRecRequest(int currentPage) {
MabaoCardApi.getSign(mOrderSerialNo, new Listener<JSONObject>() {
@Override
public void onSuccess(JSONObject response) {
Logger.json(response.toString());
try {
sign = response.getString("data");
aQuery.id(R.id.next_step_btn).clickable(true);
Logger.d(sign);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(NetroidError error) {
sign = "";
aQuery.id(R.id.next_step_btn).clickable(true);
}
});
}
@Override
protected String getActionBarTitle() {
return "确认成功";
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.payment_alipay:
resetCheckedState();
mAlipayText.setChecked(true);
paymentType = PAYMENT_ALIPAY;
break;
case R.id.payment_tenpay:
resetCheckedState();
mTenpayText.setChecked(true);
paymentType = PAYMENT_TENPAY;
break;
// case R.id.payment_unionpay:
// resetCheckedState();
// mUnionPayText.setChecked(true);
// paymentType = PAYMENT_UNIONPAY;
// break;
case R.id.order_sn:
Bundle bundle = new Bundle();
bundle.putString("order_sn", mOrderSerialNo);
// bundle.putString(OrderDetailFragment.KEY_ORDER_TYPE, OrderType
// .TYPE_WAITING_FOR_PAYMENT.name());
UIHelper.showSimpleBack(this, SimpleBackPage.CardOrderDetail, bundle);
break;
case R.id.next_step_btn:
// 付款逻辑
switch (paymentType) {
case PAYMENT_ALIPAY:
paymentWithAlipayNew();
break;
case PAYMENT_TENPAY:
MabaoCardApi.getWXSign(mOrderSerialNo, new Listener<JSONObject>() {
@Override
public void onPreExecute() {
showWaitDialog("处理中");
}
@Override
public void onSuccess(JSONObject response) {
Logger.json(response.toString());
try {
String appId = response.getJSONObject("data").getString("appid");
String nonceStr = response.getJSONObject("data").getString("noncestr");
String packageValue = response.getJSONObject("data").getString("package");
String partnerId = response.getJSONObject("data").getString("partnerid");
String prepayId = response.getJSONObject("data").getString("prepayid");
String timeStamp = response.getJSONObject("data").get("timestamp").toString();
String sign = response.getJSONObject("data").getString("sign");
Logger.d(appId + "/" + nonceStr + "/" + packageValue + "/" + partnerId + "/" + prepayId
+ "/" + timeStamp + "/" + sign);
req.appId = appId;
req.nonceStr = nonceStr;
req.packageValue = packageValue;
req.partnerId = partnerId;
req.prepayId = prepayId;
req.timeStamp = timeStamp;
req.sign = sign;
if (msgApi.isWXAppInstalled()) {
msgApi.sendReq(req);
} else {
AppContext.showToast("没有检测到微信,请安装!");
}
} catch (JSONException e) {
e.printStackTrace();
}
hideWaitDialog();
}
@Override
public void onError(NetroidError error) {
hideWaitDialog();
AppContext.showToast("支付异常");
}
});
// GetPrepayIdTask getPrepayId = new GetPrepayIdTask();
// getPrepayId.execute();
break;
default:
AppContext.showToast("该支付方式暂未实现");
}
break;
}
}
// 通过支付宝付款
private void paymentWithAlipayNew() {
if (sign.equals("")) {
AppContext.showToast("支付异常,请重进该页面");
return;
}
PaymentAsyncTask paymentAsyncTask = new PaymentAsyncTask();
paymentAsyncTask.execute(sign);
Log.e("finalParam", sign);
}
// 重置支付方式选择状态
private void resetCheckedState() {
mAlipayText.setChecked(false);
mTenpayText.setChecked(false);
// mUnionPayText.setChecked(false);
}
// 支付异步工作类
private class PaymentAsyncTask extends AsyncTask<String, Void, Map<String, String>> {
@Override
protected Map<String, String> doInBackground(String... params) {
Log.e("支付参数_params", params[0]);
PayTask payTask = new PayTask(CardOrderSubmitSuccessActivity.this);
Map<String, String> payResult = payTask.payV2(params[0], true);
return payResult;
}
@Override
protected void onPostExecute(Map<String, String> payResult) {
// Log.e("payResult", payResult);
AlipayResult result = new AlipayResult(payResult);
String resultStatus = result.getResultStatus();
// 判断resultStatus 为“9000”则代表支付成功,具体状态码代表含义可参考接口文档
if (TextUtils.equals(resultStatus, "9000")) {
CommonUtil.show(CardOrderSubmitSuccessActivity.this, "支付成功", 1000);
Intent intent1 = new Intent(CardOrderSubmitSuccessActivity.this, OrderPaySuccessActivity.class);
intent1.putExtra("ORDER_SN", mOrderSerialNo);
intent1.putExtra("TYPE", "card");
startActivity(intent1);
finish();
} else { // 判断resultStatus 为非“9000”则代表可能支付失败
// “8000”代表支付结果因为支付渠道原因或者系统原因还在等待支付结果确认,最终交易是否成功以服务端异步通知为准(小概率状态)
if (TextUtils.equals(resultStatus, "8000")) {
CommonUtil.show(CardOrderSubmitSuccessActivity.this, "支付结果确认中", 1000);
} else {
// 其他值就可以判断为支付失败,包括用户主动取消支付,或者系统返回的错误
CommonUtil.show(CardOrderSubmitSuccessActivity.this, result.getMemo(), 1000);
}
}
}
}
}
| 13,881 | 0.561262 | 0.556442 | 327 | 39.608562 | 26.626417 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.69419 | false | false | 0 |
62fbb9f7fa02c993a9c1c4a3146b004209341ce5 | 19,542,101,211,689 | d8f6f281b7faa7e60d3f0d09fdeaf75fbf5f5c24 | /ProjectUAS_00000013536/app/src/main/java/id/ac/umn/projectuas_00000013536/Fragments/TopAnimeFragment.java | 704d728206823a7aadf2dfa747d7a31eaa8feca5 | [
"MIT"
] | permissive | bifeldy/PM-Mingguan | https://github.com/bifeldy/PM-Mingguan | 00812d0c3ffd33712cba875c66e0fdb67da4200a | 37e44f9a391495d8b1e17bbfd3fe305958775af2 | refs/heads/master | 2020-04-29T22:41:07.700000 | 2019-10-24T15:27:23 | 2019-10-24T15:27:23 | 176,455,511 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package id.ac.umn.projectuas_00000013536.Fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import id.ac.umn.projectuas_00000013536.R;
public class TopAnimeFragment extends Fragment {
// For List Of Anime View
private RecyclerView recyclerView;
private View v;
public TopAnimeFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
v = inflater.inflate(R.layout.fragment_top_anime, container, false);
// Setting Up RecyclerView
recyclerView = v.findViewById(R.id.top_anime_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
return v;
}
@Override
public void onStart() {
super.onStart();
}
}
| UTF-8 | Java | 1,226 | java | TopAnimeFragment.java | Java | [] | null | [] | package id.ac.umn.projectuas_00000013536.Fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import id.ac.umn.projectuas_00000013536.R;
public class TopAnimeFragment extends Fragment {
// For List Of Anime View
private RecyclerView recyclerView;
private View v;
public TopAnimeFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
v = inflater.inflate(R.layout.fragment_top_anime, container, false);
// Setting Up RecyclerView
recyclerView = v.findViewById(R.id.top_anime_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
return v;
}
@Override
public void onStart() {
super.onStart();
}
}
| 1,226 | 0.718597 | 0.698206 | 47 | 25.085106 | 24.825201 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446809 | false | false | 0 |
3c7215ee04e80c5ecca2044490bc58829afe8bbe | 9,122,510,582,334 | 10e62455eed172d3f5103e5200fc8c9d318da5a5 | /src/java/hbo5/it/www/dataaccess/DAPassagier.java | 04660fa66368f9d62f48b0f4b2a0585e4219fdca | [] | no_license | JavaProjectTM/FixedJavaProject | https://github.com/JavaProjectTM/FixedJavaProject | 64bfaea759d2c17312650ddd56c608db3d5cb322 | 71f9e29d6ccc2fe0ae474de6fa0b67551e32d35b | refs/heads/master | 2020-05-30T16:02:15.351000 | 2019-06-03T13:09:59 | 2019-06-03T13:09:59 | 189,835,290 | 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 hbo5.it.www.dataaccess;
import hbo5.it.www.beans.Hangar;
import hbo5.it.www.beans.Luchthaven;
import hbo5.it.www.beans.Passagier;
import hbo5.it.www.beans.Persoon;
import hbo5.it.www.beans.Vliegtuig;
import hbo5.it.www.beans.VliegtuigType;
import hbo5.it.www.beans.Vlucht;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
/**
*
* @author Kevin
*/
public class DAPassagier {
private final String url, login, password;
public DAPassagier(String url, String login, String password, String driver) throws ClassNotFoundException {
Class.forName(driver);
this.url = url;
this.login = login;
this.password = password;
}
public Passagier getPassagier() {
Passagier passagier = null;
try (
Connection connection = DriverManager.getConnection(url, login, password);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM sportcentrum where id = 1");) {
if (resultSet.next()) {
passagier = new Passagier();
passagier.setId(resultSet.getInt("id"));
passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
passagier.setKlasse_id(resultSet.getInt("klasse_id"));
passagier.setPersoon_id(resultSet.getInt("persoon_id"));
passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
passagier.setPlaats(resultSet.getString("plaats"));
}
} catch (Exception e) {
e.printStackTrace();
}
return passagier;
}
public ArrayList<Passagier> getPassagiers() {
ArrayList<Passagier> Passagiers = new ArrayList<>();
try (
Connection connection = DriverManager.getConnection(url, login, password);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM passagier"
+ " inner join persoon on passagier.persoon_id = persoon.id"
);) {
while (resultSet.next()) {
Passagier passagier = new Passagier();
passagier.setId(resultSet.getInt("id"));
passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
passagier.setKlasse_id(resultSet.getInt("klasse_id"));
passagier.setPersoon_id(resultSet.getInt("persoon_id"));
passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
passagier.setPlaats(resultSet.getString("plaats"));
Persoon persoon = new Persoon();
persoon.setVoornaam(resultSet.getString("voornaam"));
persoon.setFamilienaam(resultSet.getString("familienaam"));
passagier.setPersoon(persoon);
Passagiers.add(passagier);
}
} catch (Exception e) {
e.printStackTrace();
}
return Passagiers;
}
// public int passagierCountOfVluchtById(int vluchtId){
// ArrayList<Passagier> Passagiers = new ArrayList<>();
// try (
// Connection connection = DriverManager.getConnection(url, login, password);
// PreparedStatement statement = connection.prepareStatement("SELECT * FROM PASSAGIER "
// + "WHERE VLUCHT_ID = ?");){
// statement.setInt(1, vluchtId);
// ResultSet resultSet = statement.executeQuery();
//
// while (resultSet.next()) {
// Passagier passagier = new Passagier();
// passagier.setId(resultSet.getInt("id"));
// passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
// passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
// passagier.setKlasse_id(resultSet.getInt("klasse_id"));
// passagier.setPersoon_id(resultSet.getInt("persoon_id"));
// passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
// passagier.setPlaats(resultSet.getString("plaats"));
//
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return Passagiers.size();
// }
public int passagierCountOfVluchtById(int id) {
ArrayList<Passagier> Passagiers = new ArrayList<>();
try (
Connection connection = DriverManager.getConnection(url, login, password);
PreparedStatement statement = connection.prepareStatement("SELECT * from PASSAGIER where VLUCHT_ID = ?");) {
statement.setInt(1, id);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
Passagier passagier = new Passagier();
passagier.setId(resultSet.getInt("id"));
passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
passagier.setKlasse_id(resultSet.getInt("klasse_id"));
passagier.setPlaats(resultSet.getString("plaats"));
passagier.setPersoon_id(resultSet.getInt("persoon_id"));
passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
Passagiers.add(passagier);
}
} catch (Exception e) {
e.printStackTrace();
}
return Passagiers.size();
}
}
| UTF-8 | Java | 5,983 | java | DAPassagier.java | Java | [
{
"context": "nt;\nimport java.util.ArrayList;\n\n/**\n *\n * @author Kevin\n */\npublic class DAPassagier {\n\n private final",
"end": 667,
"score": 0.9993733763694763,
"start": 662,
"tag": "NAME",
"value": "Kevin"
},
{
"context": " this.login = login;\n this.passwor... | 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 hbo5.it.www.dataaccess;
import hbo5.it.www.beans.Hangar;
import hbo5.it.www.beans.Luchthaven;
import hbo5.it.www.beans.Passagier;
import hbo5.it.www.beans.Persoon;
import hbo5.it.www.beans.Vliegtuig;
import hbo5.it.www.beans.VliegtuigType;
import hbo5.it.www.beans.Vlucht;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
/**
*
* @author Kevin
*/
public class DAPassagier {
private final String url, login, password;
public DAPassagier(String url, String login, String password, String driver) throws ClassNotFoundException {
Class.forName(driver);
this.url = url;
this.login = login;
this.password = <PASSWORD>;
}
public Passagier getPassagier() {
Passagier passagier = null;
try (
Connection connection = DriverManager.getConnection(url, login, password);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM sportcentrum where id = 1");) {
if (resultSet.next()) {
passagier = new Passagier();
passagier.setId(resultSet.getInt("id"));
passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
passagier.setKlasse_id(resultSet.getInt("klasse_id"));
passagier.setPersoon_id(resultSet.getInt("persoon_id"));
passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
passagier.setPlaats(resultSet.getString("plaats"));
}
} catch (Exception e) {
e.printStackTrace();
}
return passagier;
}
public ArrayList<Passagier> getPassagiers() {
ArrayList<Passagier> Passagiers = new ArrayList<>();
try (
Connection connection = DriverManager.getConnection(url, login, password);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM passagier"
+ " inner join persoon on passagier.persoon_id = persoon.id"
);) {
while (resultSet.next()) {
Passagier passagier = new Passagier();
passagier.setId(resultSet.getInt("id"));
passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
passagier.setKlasse_id(resultSet.getInt("klasse_id"));
passagier.setPersoon_id(resultSet.getInt("persoon_id"));
passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
passagier.setPlaats(resultSet.getString("plaats"));
Persoon persoon = new Persoon();
persoon.setVoornaam(resultSet.getString("voornaam"));
persoon.setFamilienaam(resultSet.getString("familienaam"));
passagier.setPersoon(persoon);
Passagiers.add(passagier);
}
} catch (Exception e) {
e.printStackTrace();
}
return Passagiers;
}
// public int passagierCountOfVluchtById(int vluchtId){
// ArrayList<Passagier> Passagiers = new ArrayList<>();
// try (
// Connection connection = DriverManager.getConnection(url, login, password);
// PreparedStatement statement = connection.prepareStatement("SELECT * FROM PASSAGIER "
// + "WHERE VLUCHT_ID = ?");){
// statement.setInt(1, vluchtId);
// ResultSet resultSet = statement.executeQuery();
//
// while (resultSet.next()) {
// Passagier passagier = new Passagier();
// passagier.setId(resultSet.getInt("id"));
// passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
// passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
// passagier.setKlasse_id(resultSet.getInt("klasse_id"));
// passagier.setPersoon_id(resultSet.getInt("persoon_id"));
// passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
// passagier.setPlaats(resultSet.getString("plaats"));
//
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return Passagiers.size();
// }
public int passagierCountOfVluchtById(int id) {
ArrayList<Passagier> Passagiers = new ArrayList<>();
try (
Connection connection = DriverManager.getConnection(url, login, password);
PreparedStatement statement = connection.prepareStatement("SELECT * from PASSAGIER where VLUCHT_ID = ?");) {
statement.setInt(1, id);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
Passagier passagier = new Passagier();
passagier.setId(resultSet.getInt("id"));
passagier.setIngeschreven(resultSet.getInt("ingeschreven"));
passagier.setIngecheckt(resultSet.getInt("ingecheckt"));
passagier.setKlasse_id(resultSet.getInt("klasse_id"));
passagier.setPlaats(resultSet.getString("plaats"));
passagier.setPersoon_id(resultSet.getInt("persoon_id"));
passagier.setVlucht_id(resultSet.getInt("vlucht_id"));
Passagiers.add(passagier);
}
} catch (Exception e) {
e.printStackTrace();
}
return Passagiers.size();
}
}
| 5,985 | 0.601371 | 0.599532 | 145 | 40.26207 | 28.555576 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.724138 | false | false | 0 |
8b7252895966adb7fdc5d14011296509c0c79681 | 2,327,872,286,965 | ecda8eca9dce469c6108af8df58f77fff714321d | /src/app/Productos/Productos.java | 36af3af7613305163366c801993001f32984d519 | [] | no_license | leonardopardo/uade-ioo-1c-2021-tpo | https://github.com/leonardopardo/uade-ioo-1c-2021-tpo | a790ba3698f3a3d35f8c8598abac8942d4e54835 | 1dde748365dae25f1e15d4ec760916bcac0b3f48 | refs/heads/main | 2023-06-12T01:02:57.723000 | 2021-07-07T21:25:34 | 2021-07-07T21:25:34 | 346,501,546 | 0 | 1 | null | false | 2021-07-06T12:38:45 | 2021-03-10T21:50:05 | 2021-07-04T03:09:27 | 2021-07-06T12:38:44 | 359 | 0 | 1 | 0 | Java | false | false | package app.Productos;
import app.Main.Main;
import controllers.PrecioController;
import controllers.ProveedorController;
import dto.ItemDTO;
import dto.PrecioDTO;
import dto.ProveedorDTO;
import modelos.enums.Rubro;
import modelos.enums.TipoItem;
import modelos.enums.Unidad;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;
public class Productos extends JFrame {
private JPanel pnlMain;
private JPanel pnlHeader;
private JPanel pnlBody;
private JTabbedPane tabbedPane;
private JTable tableItems;
private JButton btnNuevoItem;
private JButton btnModificarItem;
private JButton btnEliminarItem;
private JButton btnFiltrarItems;
private JButton btnLimpiarFiltroItems;
private JComboBox comboBoxTipoItem;
private JComboBox comboBoxRubroItem;
private JComboBox comboBoxUnidadItem;
private JTable tablePrecios;
private JComboBox comboBoxRubroPrecio;
private JComboBox comboBoxItemPrecio;
private JTextField textFieldItemCodigoPrecio;
private JComboBox comboBoxProveedorPrecio;
private JTextField textFieldProveedorCuitPrecio;
private JPanel pnlTabItems;
private JPanel pnlTabPrecios;
private JButton btnNuevoPrecio;
private JButton btnModificarPrecio;
private JButton btnEliminarPrecio;
private JButton btnFiltrarPrecios;
private JButton btnLimpiarFiltroPrecios;
private JLabel lblTipoItem;
private JLabel lblRubroItem;
private JLabel lblUnidadItem;
private JPanel pnlItemsFilters;
private JPanel pnlItemsTable;
private JPanel pnlItemsActions;
private JPanel pnlPrecioFilters;
private JPanel pnlPrecioTable;
private JPanel pnlPrecioActions;
private JLabel lblRubroPrecio;
private JLabel lblItemPrecio;
private JLabel lblItemCodigoPrecio;
private JLabel lblProveedorPrecio;
private JLabel lblProveedorCuitPrecio;
private JDialog nuevoItem;
private JDialog nuevoPrecio;
private List<ItemDTO> items;
private List<PrecioDTO> precios;
public Productos(String title) {
super(title);
//region Loaders
this.loadItems();
this.loadPrecios();
this.loadTableItems();
this.loadTablePrecios();
this.loadComboBoxItems();
this.loadComboBoxProveedores();
this.loadComboBoxRubros();
this.loadComboBoxTipo();
this.loadComboBoxUnidad();
//endregion
//region Settings
this.setContentPane(this.pnlMain);
this.setSize(pnlMain.getPreferredSize());
this.setResizable(false);
this.positionScreen();
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
//endregion
//region Actions
this.closeModule();
this.actionOnClickNuevoItem();
this.actionOnClickNuevoPrecio();
this.actionOnClickModificarPrecio();
this.actionOnClickEliminarPrecio();
this.actionOnClickFiltrarPrecios();
this.actionOnClickLimpiarFiltroPrecios();
this.actionOnChangeComboBoxProveedores();
this.actionOnChangeComboBoxItems();
this.actionOnClickModificarItem();
this.actionOnClickEliminarItem();
this.actionOnClickFiltrarItems();
this.actionOnClickLimpiarFiltroItems();
//endregion
}
//region Loaders
void loadComboBoxProveedores() {
try {
List<ProveedorDTO> proveedores = ProveedorController.getInstance().listar();
this.comboBoxProveedorPrecio.addItem("-- Seleccione --");
proveedores.stream().forEach(x -> {
this.comboBoxProveedorPrecio.addItem(x.razonSocial);
});
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadComboBoxRubros() {
this.comboBoxRubroItem.addItem("-- Seleccione --");
this.comboBoxRubroPrecio.addItem("-- Seleccione --");
for (Rubro r : Rubro.values()) {
this.comboBoxRubroItem.addItem(r);
this.comboBoxRubroPrecio.addItem(r);
}
}
void loadComboBoxTipo() {
this.comboBoxTipoItem.addItem("-- Seleccione --");
for (TipoItem t : TipoItem.values()) {
this.comboBoxTipoItem.addItem(t);
}
}
void loadComboBoxItems() {
this.comboBoxItemPrecio.addItem("-- Seleccione --");
for (ItemDTO item : this.items) {
this.comboBoxItemPrecio.addItem(item.titulo);
}
}
void loadComboBoxUnidad() {
this.comboBoxUnidadItem.addItem("-- Seleccione --");
;
for (Unidad u : Unidad.values()) {
this.comboBoxUnidadItem.addItem(u);
}
}
void loadTableItems() {
try {
String[] columns = new String[]{
"CÓDIGO",
"TÍTULO",
"RUBRO",
"UNIDAD"
};
DefaultTableModel tblModel = new DefaultTableModel(columns, 0);
this.items.stream().forEach(x -> {
Object[] o = {
x.codigo,
x.titulo,
x.rubro,
x.unidad,
};
tblModel.addRow(o);
});
this.tableItems.setModel(tblModel);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadTablePrecios() {
try {
String[] columns = new String[]{
"RUBRO",
"CÓDIGO",
"DESCRIPCIÓN",
"PROVEEDOR",
"CUIT",
"PRECIO"
};
DefaultTableModel tblModel = new DefaultTableModel(columns, 0);
this.precios.stream().forEach(x -> {
Object[] o = {
x.rubro,
x.itemCodigo,
x.itemTitulo,
x.razonSocial,
x.cuit,
x.precio
};
tblModel.addRow(o);
});
this.tablePrecios.setModel(tblModel);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadItems() {
try {
this.items = PrecioController.getInstance().listarItems();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadPrecios() {
try {
this.precios = PrecioController.getInstance().listarPrecios();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
//endregion
//region Actions
void actionOnClickNuevoItem() {
Productos self = this;
this.btnNuevoItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
self.nuevoItem = new Items(self);
}
});
}
void actionOnClickModificarItem() {
Productos self = this;
this.btnModificarItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tableItems.getSelectedRow();
if(row < 0)
throw new Exception("Debe seleccionar una fila de la tabla.");
ItemDTO item = self.items.get(row);
self.nuevoItem = new Items(self, item);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickEliminarItem() {
Productos self = this;
this.btnEliminarItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tableItems.getSelectedRow();
String codigoItem = self.tableItems.getValueAt(row, 0).toString();
int confirmResult = JOptionPane.showConfirmDialog(
pnlMain,
"¿Está seguro que desea eliminar el registro?",
"Cerrar",
JOptionPane.YES_NO_OPTION
);
if (confirmResult == JOptionPane.YES_OPTION) {
PrecioController.getInstance().eliminar(codigoItem);
self.items.remove(row);
self.loadTableItems();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickFiltrarItems() {
Productos self = this;
this.btnFiltrarItems.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
PrecioController controller = PrecioController.getInstance();
Rubro rubro = null;
TipoItem tipo = null;
Unidad unidad = null;
if (self.comboBoxRubroItem.getSelectedIndex() > 0)
rubro = Rubro.valueOf(self.comboBoxRubroItem.getSelectedItem().toString());
if (self.comboBoxTipoItem.getSelectedIndex() > 0)
tipo = TipoItem.valueOf(self.comboBoxTipoItem.getSelectedItem().toString());
if (self.comboBoxUnidadItem.getSelectedIndex() > 0)
unidad = Unidad.valueOf(self.comboBoxUnidadItem.getSelectedItem().toString());
self.items = null;
if (rubro != null && tipo == null && unidad == null) {
self.items = controller.listarItems(rubro);
} else if (rubro != null && tipo != null && unidad == null) {
self.items = controller.listarItemsPorTipo(rubro, tipo);
} else if (rubro != null && tipo == null && unidad != null) {
self.items = controller.listarItemsPorUnidad(rubro, unidad);
} else if (rubro != null && tipo != null && unidad != null) {
self.items = controller.listarItems(rubro, tipo, unidad);
} else if (rubro == null && tipo != null && unidad == null) {
self.items = controller.listarItemsPorTipo(tipo);
} else if (rubro == null && tipo != null && unidad != null) {
self.items = controller.listarItems(tipo, unidad);
} else if (rubro == null && tipo == null && unidad != null) {
self.items = controller.listarItemsPorUnidad(unidad);
} else {
self.items = controller.listarItems();
}
self.loadTableItems();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickLimpiarFiltroItems() {
Productos self = this;
this.btnLimpiarFiltroItems.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
self.comboBoxRubroItem.setSelectedIndex(0);
self.comboBoxUnidadItem.setSelectedIndex(0);
self.comboBoxTipoItem.setSelectedIndex(0);
self.loadItems();
self.loadTableItems();
} catch (Exception ex) {
}
}
});
}
void actionOnClickNuevoPrecio() {
Productos self = this;
this.btnNuevoPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
self.nuevoPrecio = new Precios(self);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickModificarPrecio() {
Productos self = this;
this.btnModificarPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tablePrecios.getSelectedRow();
if (row < 0)
throw new Exception("Debe seleccionar una fila de la tabla.");
PrecioDTO precio = self.precios.get(row);
self.nuevoPrecio = new Precios(self, precio);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickEliminarPrecio() {
Productos self = this;
this.btnEliminarPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tablePrecios.getSelectedRow();
String codigoItem = self.tablePrecios.getValueAt(row, 0).toString();
String cuitProveedor = self.tablePrecios.getValueAt(row, 2).toString();
int confirmResult = JOptionPane.showConfirmDialog(
pnlMain,
"¿Está seguro que desea eliminar el registro?",
"Cerrar",
JOptionPane.YES_NO_OPTION
);
if (confirmResult == JOptionPane.YES_OPTION) {
PrecioController.getInstance().eliminar(codigoItem, cuitProveedor);
self.precios.remove(row);
self.loadTablePrecios();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickFiltrarPrecios() {
Productos self = this;
this.btnFiltrarPrecios.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
PrecioController controller = PrecioController.getInstance();
Rubro rubro = null;
String codigoItem = null;
String cuitProveedor = null;
if (self.comboBoxRubroPrecio.getSelectedIndex() > 0)
rubro = Rubro.valueOf(self.comboBoxRubroPrecio.getSelectedItem().toString());
if (!self.textFieldItemCodigoPrecio.getText().equals(""))
codigoItem = self.textFieldItemCodigoPrecio.getText();
if (!self.textFieldProveedorCuitPrecio.getText().equals(""))
cuitProveedor = self.textFieldProveedorCuitPrecio.getText();
self.precios = null;
if (rubro != null && codigoItem == null && cuitProveedor == null) {
self.precios = controller.listarPrecios(rubro);
} else if (rubro != null && codigoItem != null && cuitProveedor == null) {
self.precios = controller.listarPreciosPorItem(rubro, codigoItem);
} else if (rubro != null && codigoItem == null && cuitProveedor != null) {
self.precios = controller.listarPreciosPorProveedor(rubro, cuitProveedor);
} else if (rubro != null && codigoItem != null && cuitProveedor != null) {
self.precios = controller.listarPrecios(rubro, codigoItem, cuitProveedor);
} else if (rubro == null && codigoItem != null && cuitProveedor == null) {
self.precios = controller.listarPreciosPorItem(codigoItem);
} else if (rubro == null && codigoItem != null && cuitProveedor != null) {
self.precios = controller.listarPrecios(codigoItem, cuitProveedor);
} else if (rubro == null && codigoItem == null && cuitProveedor != null) {
self.precios = controller.listarPreciosPorProveedor(cuitProveedor);
} else {
self.precios = controller.listarPrecios();
}
self.loadTablePrecios();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickLimpiarFiltroPrecios() {
Productos self = this;
this.btnLimpiarFiltroPrecios.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
self.comboBoxRubroPrecio.setSelectedIndex(0);
self.comboBoxItemPrecio.setSelectedIndex(0);
self.comboBoxProveedorPrecio.setSelectedIndex(0);
self.textFieldProveedorCuitPrecio.setText("");
self.textFieldItemCodigoPrecio.setText("");
self.loadPrecios();
self.loadTablePrecios();
} catch (Exception ex) {
}
}
});
}
void actionOnChangeComboBoxProveedores() {
Productos self = this;
this.comboBoxProveedorPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
String razonSocial = self.comboBoxProveedorPrecio
.getSelectedItem()
.toString();
ProveedorDTO dto = ProveedorController
.getInstance()
.obtenerPorRazonSocial(razonSocial);
if (dto != null) {
self.textFieldProveedorCuitPrecio.setText(dto.cuit);
} else {
self.textFieldProveedorCuitPrecio.setText("");
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnChangeComboBoxItems() {
Productos self = this;
this.comboBoxItemPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
String titulo = self.comboBoxItemPrecio
.getSelectedItem()
.toString();
ItemDTO dto = PrecioController
.getInstance()
.obtenerItemPorTitulo(titulo);
if (dto != null) {
self.textFieldItemCodigoPrecio.setText(dto.codigo);
} else {
self.textFieldItemCodigoPrecio.setText("");
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
//endregion
//region Settings
void positionScreen() {
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(
dim.width / 2 - this.getSize().width / 2,
dim.height / 2 - this.getSize().height / 2
);
}
void closeModule() {
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
try {
Main m = null;
m = new Main("Main");
m.setVisible(true);
} catch (Exception exception) {
exception.printStackTrace();
}
}
});
}
//endregion
}
| UTF-8 | Java | 23,070 | java | Productos.java | Java | [] | null | [] | package app.Productos;
import app.Main.Main;
import controllers.PrecioController;
import controllers.ProveedorController;
import dto.ItemDTO;
import dto.PrecioDTO;
import dto.ProveedorDTO;
import modelos.enums.Rubro;
import modelos.enums.TipoItem;
import modelos.enums.Unidad;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;
public class Productos extends JFrame {
private JPanel pnlMain;
private JPanel pnlHeader;
private JPanel pnlBody;
private JTabbedPane tabbedPane;
private JTable tableItems;
private JButton btnNuevoItem;
private JButton btnModificarItem;
private JButton btnEliminarItem;
private JButton btnFiltrarItems;
private JButton btnLimpiarFiltroItems;
private JComboBox comboBoxTipoItem;
private JComboBox comboBoxRubroItem;
private JComboBox comboBoxUnidadItem;
private JTable tablePrecios;
private JComboBox comboBoxRubroPrecio;
private JComboBox comboBoxItemPrecio;
private JTextField textFieldItemCodigoPrecio;
private JComboBox comboBoxProveedorPrecio;
private JTextField textFieldProveedorCuitPrecio;
private JPanel pnlTabItems;
private JPanel pnlTabPrecios;
private JButton btnNuevoPrecio;
private JButton btnModificarPrecio;
private JButton btnEliminarPrecio;
private JButton btnFiltrarPrecios;
private JButton btnLimpiarFiltroPrecios;
private JLabel lblTipoItem;
private JLabel lblRubroItem;
private JLabel lblUnidadItem;
private JPanel pnlItemsFilters;
private JPanel pnlItemsTable;
private JPanel pnlItemsActions;
private JPanel pnlPrecioFilters;
private JPanel pnlPrecioTable;
private JPanel pnlPrecioActions;
private JLabel lblRubroPrecio;
private JLabel lblItemPrecio;
private JLabel lblItemCodigoPrecio;
private JLabel lblProveedorPrecio;
private JLabel lblProveedorCuitPrecio;
private JDialog nuevoItem;
private JDialog nuevoPrecio;
private List<ItemDTO> items;
private List<PrecioDTO> precios;
public Productos(String title) {
super(title);
//region Loaders
this.loadItems();
this.loadPrecios();
this.loadTableItems();
this.loadTablePrecios();
this.loadComboBoxItems();
this.loadComboBoxProveedores();
this.loadComboBoxRubros();
this.loadComboBoxTipo();
this.loadComboBoxUnidad();
//endregion
//region Settings
this.setContentPane(this.pnlMain);
this.setSize(pnlMain.getPreferredSize());
this.setResizable(false);
this.positionScreen();
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
//endregion
//region Actions
this.closeModule();
this.actionOnClickNuevoItem();
this.actionOnClickNuevoPrecio();
this.actionOnClickModificarPrecio();
this.actionOnClickEliminarPrecio();
this.actionOnClickFiltrarPrecios();
this.actionOnClickLimpiarFiltroPrecios();
this.actionOnChangeComboBoxProveedores();
this.actionOnChangeComboBoxItems();
this.actionOnClickModificarItem();
this.actionOnClickEliminarItem();
this.actionOnClickFiltrarItems();
this.actionOnClickLimpiarFiltroItems();
//endregion
}
//region Loaders
void loadComboBoxProveedores() {
try {
List<ProveedorDTO> proveedores = ProveedorController.getInstance().listar();
this.comboBoxProveedorPrecio.addItem("-- Seleccione --");
proveedores.stream().forEach(x -> {
this.comboBoxProveedorPrecio.addItem(x.razonSocial);
});
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadComboBoxRubros() {
this.comboBoxRubroItem.addItem("-- Seleccione --");
this.comboBoxRubroPrecio.addItem("-- Seleccione --");
for (Rubro r : Rubro.values()) {
this.comboBoxRubroItem.addItem(r);
this.comboBoxRubroPrecio.addItem(r);
}
}
void loadComboBoxTipo() {
this.comboBoxTipoItem.addItem("-- Seleccione --");
for (TipoItem t : TipoItem.values()) {
this.comboBoxTipoItem.addItem(t);
}
}
void loadComboBoxItems() {
this.comboBoxItemPrecio.addItem("-- Seleccione --");
for (ItemDTO item : this.items) {
this.comboBoxItemPrecio.addItem(item.titulo);
}
}
void loadComboBoxUnidad() {
this.comboBoxUnidadItem.addItem("-- Seleccione --");
;
for (Unidad u : Unidad.values()) {
this.comboBoxUnidadItem.addItem(u);
}
}
void loadTableItems() {
try {
String[] columns = new String[]{
"CÓDIGO",
"TÍTULO",
"RUBRO",
"UNIDAD"
};
DefaultTableModel tblModel = new DefaultTableModel(columns, 0);
this.items.stream().forEach(x -> {
Object[] o = {
x.codigo,
x.titulo,
x.rubro,
x.unidad,
};
tblModel.addRow(o);
});
this.tableItems.setModel(tblModel);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadTablePrecios() {
try {
String[] columns = new String[]{
"RUBRO",
"CÓDIGO",
"DESCRIPCIÓN",
"PROVEEDOR",
"CUIT",
"PRECIO"
};
DefaultTableModel tblModel = new DefaultTableModel(columns, 0);
this.precios.stream().forEach(x -> {
Object[] o = {
x.rubro,
x.itemCodigo,
x.itemTitulo,
x.razonSocial,
x.cuit,
x.precio
};
tblModel.addRow(o);
});
this.tablePrecios.setModel(tblModel);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadItems() {
try {
this.items = PrecioController.getInstance().listarItems();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
void loadPrecios() {
try {
this.precios = PrecioController.getInstance().listarPrecios();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
//endregion
//region Actions
void actionOnClickNuevoItem() {
Productos self = this;
this.btnNuevoItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
self.nuevoItem = new Items(self);
}
});
}
void actionOnClickModificarItem() {
Productos self = this;
this.btnModificarItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tableItems.getSelectedRow();
if(row < 0)
throw new Exception("Debe seleccionar una fila de la tabla.");
ItemDTO item = self.items.get(row);
self.nuevoItem = new Items(self, item);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickEliminarItem() {
Productos self = this;
this.btnEliminarItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tableItems.getSelectedRow();
String codigoItem = self.tableItems.getValueAt(row, 0).toString();
int confirmResult = JOptionPane.showConfirmDialog(
pnlMain,
"¿Está seguro que desea eliminar el registro?",
"Cerrar",
JOptionPane.YES_NO_OPTION
);
if (confirmResult == JOptionPane.YES_OPTION) {
PrecioController.getInstance().eliminar(codigoItem);
self.items.remove(row);
self.loadTableItems();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickFiltrarItems() {
Productos self = this;
this.btnFiltrarItems.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
PrecioController controller = PrecioController.getInstance();
Rubro rubro = null;
TipoItem tipo = null;
Unidad unidad = null;
if (self.comboBoxRubroItem.getSelectedIndex() > 0)
rubro = Rubro.valueOf(self.comboBoxRubroItem.getSelectedItem().toString());
if (self.comboBoxTipoItem.getSelectedIndex() > 0)
tipo = TipoItem.valueOf(self.comboBoxTipoItem.getSelectedItem().toString());
if (self.comboBoxUnidadItem.getSelectedIndex() > 0)
unidad = Unidad.valueOf(self.comboBoxUnidadItem.getSelectedItem().toString());
self.items = null;
if (rubro != null && tipo == null && unidad == null) {
self.items = controller.listarItems(rubro);
} else if (rubro != null && tipo != null && unidad == null) {
self.items = controller.listarItemsPorTipo(rubro, tipo);
} else if (rubro != null && tipo == null && unidad != null) {
self.items = controller.listarItemsPorUnidad(rubro, unidad);
} else if (rubro != null && tipo != null && unidad != null) {
self.items = controller.listarItems(rubro, tipo, unidad);
} else if (rubro == null && tipo != null && unidad == null) {
self.items = controller.listarItemsPorTipo(tipo);
} else if (rubro == null && tipo != null && unidad != null) {
self.items = controller.listarItems(tipo, unidad);
} else if (rubro == null && tipo == null && unidad != null) {
self.items = controller.listarItemsPorUnidad(unidad);
} else {
self.items = controller.listarItems();
}
self.loadTableItems();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickLimpiarFiltroItems() {
Productos self = this;
this.btnLimpiarFiltroItems.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
self.comboBoxRubroItem.setSelectedIndex(0);
self.comboBoxUnidadItem.setSelectedIndex(0);
self.comboBoxTipoItem.setSelectedIndex(0);
self.loadItems();
self.loadTableItems();
} catch (Exception ex) {
}
}
});
}
void actionOnClickNuevoPrecio() {
Productos self = this;
this.btnNuevoPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
self.nuevoPrecio = new Precios(self);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickModificarPrecio() {
Productos self = this;
this.btnModificarPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tablePrecios.getSelectedRow();
if (row < 0)
throw new Exception("Debe seleccionar una fila de la tabla.");
PrecioDTO precio = self.precios.get(row);
self.nuevoPrecio = new Precios(self, precio);
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickEliminarPrecio() {
Productos self = this;
this.btnEliminarPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int row = self.tablePrecios.getSelectedRow();
String codigoItem = self.tablePrecios.getValueAt(row, 0).toString();
String cuitProveedor = self.tablePrecios.getValueAt(row, 2).toString();
int confirmResult = JOptionPane.showConfirmDialog(
pnlMain,
"¿Está seguro que desea eliminar el registro?",
"Cerrar",
JOptionPane.YES_NO_OPTION
);
if (confirmResult == JOptionPane.YES_OPTION) {
PrecioController.getInstance().eliminar(codigoItem, cuitProveedor);
self.precios.remove(row);
self.loadTablePrecios();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickFiltrarPrecios() {
Productos self = this;
this.btnFiltrarPrecios.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
PrecioController controller = PrecioController.getInstance();
Rubro rubro = null;
String codigoItem = null;
String cuitProveedor = null;
if (self.comboBoxRubroPrecio.getSelectedIndex() > 0)
rubro = Rubro.valueOf(self.comboBoxRubroPrecio.getSelectedItem().toString());
if (!self.textFieldItemCodigoPrecio.getText().equals(""))
codigoItem = self.textFieldItemCodigoPrecio.getText();
if (!self.textFieldProveedorCuitPrecio.getText().equals(""))
cuitProveedor = self.textFieldProveedorCuitPrecio.getText();
self.precios = null;
if (rubro != null && codigoItem == null && cuitProveedor == null) {
self.precios = controller.listarPrecios(rubro);
} else if (rubro != null && codigoItem != null && cuitProveedor == null) {
self.precios = controller.listarPreciosPorItem(rubro, codigoItem);
} else if (rubro != null && codigoItem == null && cuitProveedor != null) {
self.precios = controller.listarPreciosPorProveedor(rubro, cuitProveedor);
} else if (rubro != null && codigoItem != null && cuitProveedor != null) {
self.precios = controller.listarPrecios(rubro, codigoItem, cuitProveedor);
} else if (rubro == null && codigoItem != null && cuitProveedor == null) {
self.precios = controller.listarPreciosPorItem(codigoItem);
} else if (rubro == null && codigoItem != null && cuitProveedor != null) {
self.precios = controller.listarPrecios(codigoItem, cuitProveedor);
} else if (rubro == null && codigoItem == null && cuitProveedor != null) {
self.precios = controller.listarPreciosPorProveedor(cuitProveedor);
} else {
self.precios = controller.listarPrecios();
}
self.loadTablePrecios();
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnClickLimpiarFiltroPrecios() {
Productos self = this;
this.btnLimpiarFiltroPrecios.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
self.comboBoxRubroPrecio.setSelectedIndex(0);
self.comboBoxItemPrecio.setSelectedIndex(0);
self.comboBoxProveedorPrecio.setSelectedIndex(0);
self.textFieldProveedorCuitPrecio.setText("");
self.textFieldItemCodigoPrecio.setText("");
self.loadPrecios();
self.loadTablePrecios();
} catch (Exception ex) {
}
}
});
}
void actionOnChangeComboBoxProveedores() {
Productos self = this;
this.comboBoxProveedorPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
String razonSocial = self.comboBoxProveedorPrecio
.getSelectedItem()
.toString();
ProveedorDTO dto = ProveedorController
.getInstance()
.obtenerPorRazonSocial(razonSocial);
if (dto != null) {
self.textFieldProveedorCuitPrecio.setText(dto.cuit);
} else {
self.textFieldProveedorCuitPrecio.setText("");
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
void actionOnChangeComboBoxItems() {
Productos self = this;
this.comboBoxItemPrecio.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
String titulo = self.comboBoxItemPrecio
.getSelectedItem()
.toString();
ItemDTO dto = PrecioController
.getInstance()
.obtenerItemPorTitulo(titulo);
if (dto != null) {
self.textFieldItemCodigoPrecio.setText(dto.codigo);
} else {
self.textFieldItemCodigoPrecio.setText("");
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(
pnlMain,
ex.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE
);
}
}
});
}
//endregion
//region Settings
void positionScreen() {
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation(
dim.width / 2 - this.getSize().width / 2,
dim.height / 2 - this.getSize().height / 2
);
}
void closeModule() {
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
try {
Main m = null;
m = new Main("Main");
m.setVisible(true);
} catch (Exception exception) {
exception.printStackTrace();
}
}
});
}
//endregion
}
| 23,070 | 0.501257 | 0.500347 | 666 | 33.627628 | 24.409842 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.490991 | false | false | 0 |
9c0aadf2d0f33a9d88ddc8efbfe5304e190f7e56 | 3,607,772,596,139 | ccb365032f657a0369c1610dd144c8a7f76dd8c3 | /flex3 flex4/geraweb/src/info/webcase/servico/pesquisaBasica/PesquisaBasicaService.java | 475c90edf906e8c48b47c272cf7d4025b4416d12 | [] | no_license | jullierme/old-codes | https://github.com/jullierme/old-codes | 7a1dae65803696885fce57b09b181ff99851f787 | 5f8ccf8f7e16888022ea72c5574822f5d7409ba0 | refs/heads/master | 2019-07-19T13:02:48.765000 | 2017-06-10T15:39:44 | 2017-06-10T15:39:44 | 93,948,206 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package info.webcase.servico.pesquisaBasica;
import info.webcase.entidade.CamposDaTelaDePesquisaBasica;
import info.webcase.entidade.ColunasDaEntidadeJavaFlex;
import info.webcase.entidade.EntidadeJavaFlex;
import info.webcase.entidade.PesquisaBasica;
import info.webcase.entidade.Projeto;
import info.webcase.servico.base.GenericService;
import info.webcase.servico.entidadeJavaFlex.ColunasDaEntidadeJavaFlexService;
import info.webcase.servico.entidadeJavaFlex.EntidadeJavaFlexService;
import info.webcase.servico.projeto.ProjetoService;
import info.webcase.utilitarios.UtilString;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Service;
@Service
@RemotingDestination
//@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
public class PesquisaBasicaService extends GenericService<PesquisaBasica, Integer> {
@Autowired
private PesquisaBasicaDAO dao;
@Autowired
private ColunasDaEntidadeJavaFlexService colunasDaEntidadeJavaFlexService;
@Autowired
private CamposDaTelaDePesquisaBasicaService camposDaTelaDePesquisaBasicaService;
@Autowired
private EntidadeJavaFlexService entidadeJavaFlexService;
@Autowired
private ProjetoService projetoService;
@Override
protected PesquisaBasicaDAO getDAO() {
return dao;
}
@Override
public void antesDeValidarSalvar(PesquisaBasica entidade) {
if(!isRegistroSalvo(entidade)){
EntidadeJavaFlex entidadePrincipal = entidadeJavaFlexService.consultar(new EntidadeJavaFlex(entidade.getCodigoDaEntidadePrincipal()));
if(entidadePrincipal == null)
return;
if(isStringInvalida(entidade.getNomeDoArquivoDaPesquisa()) ){
if(isStringInvalida(entidade.getNomeDoArquivoDaPesquisa()))
entidade.setNomeDoArquivoDaPesquisa(entidadeJavaFlexService.formatarNomeDoArquivoDaTelaDePesquisa(entidadePrincipal.getNomeDaEntidade()));
if(isStringInvalida(entidade.getTituloDoArquivoDaPesquisa()))
entidade.setTituloDoArquivoDaPesquisa(entidadeJavaFlexService.formatarTituloDaPesquisa(entidadePrincipal.getNomeDaTabela()));
}
}
}
@Override
public void depoisDeSalvar(PesquisaBasica entidade) {
Integer quantidadeDeCampos = getQuantidadeDeCamposDoPesquisaBasica(entidade.getCodigoDaPesquisa());
if(isNumeroInvalido(quantidadeDeCampos))
adicionarColunasDaEntidadePrincipalNaPesquisa(entidade);
}
public List<PesquisaBasica> getPesquisasDoProjeto(Integer codigoDoProjeto){
return getDAO().getPesquisasDoProjeto(codigoDoProjeto);
}
public Integer getQuantidadeDeCamposDoPesquisaBasica(Integer codigoDoPesquisaBasica){
return getDAO().getQuantidadeDeCamposDoPesquisaBasica(codigoDoPesquisaBasica);
}
public void adicionarColunasDaEntidadePrincipalNaPesquisa(Integer codigoDaPesquisa){
if(isNumeroInvalido(codigoDaPesquisa))
return;
adicionarColunasDaEntidadePrincipalNaPesquisa(getRegistroPelaChave(codigoDaPesquisa));
}
public void adicionarColunasDaEntidadePrincipalNaPesquisa(PesquisaBasica PesquisaBasica){
if(PesquisaBasica == null)
return;
EntidadeJavaFlex entidadeJavaFlex = entidadeJavaFlexService.getRegistroPelaChave(PesquisaBasica.getCodigoDaEntidadePrincipal());
if(entidadeJavaFlex == null)
imprimirMensagem("Entidade " + PesquisaBasica.getCodigoDaEntidadePrincipal() + " não encontrada");
List<ColunasDaEntidadeJavaFlex> colunas = colunasDaEntidadeJavaFlexService.getColunasDaEntidadesJavaFlex(PesquisaBasica.getCodigoDaEntidadePrincipal());
if(isListaVazia(colunas))
return;
CamposDaTelaDePesquisaBasica campo;
int contador = 1;
for (ColunasDaEntidadeJavaFlex colunaEntidade : colunas) {
if(camposDaTelaDePesquisaBasicaService.getCampoDaTelaDePesquisaBasica(PesquisaBasica.getCodigoDaPesquisa(), colunaEntidade.getCodigoDaColunaDaEntidade()) != null)
continue;
campo = new CamposDaTelaDePesquisaBasica();
campo.setCodigoDaPesquisa(PesquisaBasica.getCodigoDaPesquisa());
campo.setCodigoDaColunaDaEntidade(colunaEntidade.getCodigoDaColunaDaEntidade());
campo.setOrdemDoComponenteNaTela(contador);
camposDaTelaDePesquisaBasicaService.salvar(campo);
contador ++;
}
logger.debug("Colunas adicionadas com sucesso na pesquisa " + PesquisaBasica.getNomeDoArquivoDaPesquisa());
}
public void gerar(PesquisaBasica PesquisaBasica){
if(!isRegistroSalvo(PesquisaBasica))
imprimirMensagemSuspensa("Informe um registro válido");
EntidadeJavaFlex entidadeJavaFlex = entidadeJavaFlexService.getRegistroPelaChave(PesquisaBasica.getCodigoDaEntidadePrincipal());
if(entidadeJavaFlex == null)
imprimirMensagemSuspensa("Entidade principal não encontrada. Informe um registro válido.");
Projeto projeto = projetoService.getRegistroPelaChave(entidadeJavaFlex.getCodigoDoProjeto());
if(projeto == null)
imprimirMensagemSuspensa("Projeto não encontrado. Informe um registro válido.");
StringBuilder arquivo = new StringBuilder();
String entidadeMinuscula = UtilString.getStringComPrimeiraLetraMinuscula(entidadeJavaFlex.getNomeDaEntidade());
formataCabecalhoDoArquivo(arquivo, projeto, PesquisaBasica, entidadeJavaFlex, entidadeMinuscula);
arquivo.append("</webcase:" + projeto.getNomeDoArquivoWebPesquisa() + ">");
String caminhoArquivo = projetoService.getCaminhoDaPastaFlex(projeto);
caminhoArquivo += "\\info\\webcase\\telas\\"+entidadeMinuscula;
projetoService.escreverArquivo(arquivo, caminhoArquivo, PesquisaBasica.getNomeDoArquivoDaPesquisa()+".mxml");
logger.debug("Pesquisa " + PesquisaBasica.getNomeDoArquivoDaPesquisa()+ " criada em disco com sucesso!");
}
private void formataCabecalhoDoArquivo(StringBuilder arquivo,Projeto projeto, PesquisaBasica PesquisaBasica, EntidadeJavaFlex entidadeJavaFlex, String entidadeMinuscula) {
arquivo.append("")
.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
.append("<webcase:" + projeto.getNomeDoArquivoWebPesquisa() + " xmlns:fx=\"http://ns.adobe.com/mxml/2009\"\n")
.append("\txmlns:s=\"library://ns.adobe.com/flex/spark\"\n")
.append("\txmlns:mx=\"library://ns.adobe.com/flex/mx\"\n")
.append("\txmlns:webcase=\""+projeto.getPacoteDoArquivoWebPesquisa()+".*\"\n")
.append("\txmlns:entidade=\"info.webcase.entidade.*\"\n")
.append("\txmlns:pr=\"info.webcase.componentes.pesquisaRegistro.*\"\n")
.append("\txmlns:ac=\"info.webcase.componentes.autoComplete.*\"\n")
.append("\txmlns:webspark=\"info.webcase.componentes.webspark.*\"\n")
.append("\txmlns:database=\"info.webcase.componentes.database.*\"\n")
.append("\tdataSource=\"{" + entidadeMinuscula +"}\"\n")
.append("\ttitle=\""+PesquisaBasica.getTituloDoArquivoDaPesquisa()+"\"\n")
.append("\tservico=\""+entidadeJavaFlex.getNomeDaEntidade()+"Service\"\n")
.append("\twidth=\"600\"\n")
.append("\theight=\"300\">\n")
.append("\t<fx:Declarations>\n")
.append("\t\t<entidade:"+entidadeJavaFlex.getNomeDaEntidade()+" id=\""+entidadeMinuscula+"\"/>\n")
.append("\t</fx:Declarations>\n")
.append("\t<webcase:layout>\n")
.append("\t\t<s:VerticalLayout gap=\"0\"/>\n")
.append("\t</webcase:layout>\n");
}
} | ISO-8859-1 | Java | 7,216 | java | PesquisaBasicaService.java | Java | [] | null | [] | package info.webcase.servico.pesquisaBasica;
import info.webcase.entidade.CamposDaTelaDePesquisaBasica;
import info.webcase.entidade.ColunasDaEntidadeJavaFlex;
import info.webcase.entidade.EntidadeJavaFlex;
import info.webcase.entidade.PesquisaBasica;
import info.webcase.entidade.Projeto;
import info.webcase.servico.base.GenericService;
import info.webcase.servico.entidadeJavaFlex.ColunasDaEntidadeJavaFlexService;
import info.webcase.servico.entidadeJavaFlex.EntidadeJavaFlexService;
import info.webcase.servico.projeto.ProjetoService;
import info.webcase.utilitarios.UtilString;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Service;
@Service
@RemotingDestination
//@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
public class PesquisaBasicaService extends GenericService<PesquisaBasica, Integer> {
@Autowired
private PesquisaBasicaDAO dao;
@Autowired
private ColunasDaEntidadeJavaFlexService colunasDaEntidadeJavaFlexService;
@Autowired
private CamposDaTelaDePesquisaBasicaService camposDaTelaDePesquisaBasicaService;
@Autowired
private EntidadeJavaFlexService entidadeJavaFlexService;
@Autowired
private ProjetoService projetoService;
@Override
protected PesquisaBasicaDAO getDAO() {
return dao;
}
@Override
public void antesDeValidarSalvar(PesquisaBasica entidade) {
if(!isRegistroSalvo(entidade)){
EntidadeJavaFlex entidadePrincipal = entidadeJavaFlexService.consultar(new EntidadeJavaFlex(entidade.getCodigoDaEntidadePrincipal()));
if(entidadePrincipal == null)
return;
if(isStringInvalida(entidade.getNomeDoArquivoDaPesquisa()) ){
if(isStringInvalida(entidade.getNomeDoArquivoDaPesquisa()))
entidade.setNomeDoArquivoDaPesquisa(entidadeJavaFlexService.formatarNomeDoArquivoDaTelaDePesquisa(entidadePrincipal.getNomeDaEntidade()));
if(isStringInvalida(entidade.getTituloDoArquivoDaPesquisa()))
entidade.setTituloDoArquivoDaPesquisa(entidadeJavaFlexService.formatarTituloDaPesquisa(entidadePrincipal.getNomeDaTabela()));
}
}
}
@Override
public void depoisDeSalvar(PesquisaBasica entidade) {
Integer quantidadeDeCampos = getQuantidadeDeCamposDoPesquisaBasica(entidade.getCodigoDaPesquisa());
if(isNumeroInvalido(quantidadeDeCampos))
adicionarColunasDaEntidadePrincipalNaPesquisa(entidade);
}
public List<PesquisaBasica> getPesquisasDoProjeto(Integer codigoDoProjeto){
return getDAO().getPesquisasDoProjeto(codigoDoProjeto);
}
public Integer getQuantidadeDeCamposDoPesquisaBasica(Integer codigoDoPesquisaBasica){
return getDAO().getQuantidadeDeCamposDoPesquisaBasica(codigoDoPesquisaBasica);
}
public void adicionarColunasDaEntidadePrincipalNaPesquisa(Integer codigoDaPesquisa){
if(isNumeroInvalido(codigoDaPesquisa))
return;
adicionarColunasDaEntidadePrincipalNaPesquisa(getRegistroPelaChave(codigoDaPesquisa));
}
public void adicionarColunasDaEntidadePrincipalNaPesquisa(PesquisaBasica PesquisaBasica){
if(PesquisaBasica == null)
return;
EntidadeJavaFlex entidadeJavaFlex = entidadeJavaFlexService.getRegistroPelaChave(PesquisaBasica.getCodigoDaEntidadePrincipal());
if(entidadeJavaFlex == null)
imprimirMensagem("Entidade " + PesquisaBasica.getCodigoDaEntidadePrincipal() + " não encontrada");
List<ColunasDaEntidadeJavaFlex> colunas = colunasDaEntidadeJavaFlexService.getColunasDaEntidadesJavaFlex(PesquisaBasica.getCodigoDaEntidadePrincipal());
if(isListaVazia(colunas))
return;
CamposDaTelaDePesquisaBasica campo;
int contador = 1;
for (ColunasDaEntidadeJavaFlex colunaEntidade : colunas) {
if(camposDaTelaDePesquisaBasicaService.getCampoDaTelaDePesquisaBasica(PesquisaBasica.getCodigoDaPesquisa(), colunaEntidade.getCodigoDaColunaDaEntidade()) != null)
continue;
campo = new CamposDaTelaDePesquisaBasica();
campo.setCodigoDaPesquisa(PesquisaBasica.getCodigoDaPesquisa());
campo.setCodigoDaColunaDaEntidade(colunaEntidade.getCodigoDaColunaDaEntidade());
campo.setOrdemDoComponenteNaTela(contador);
camposDaTelaDePesquisaBasicaService.salvar(campo);
contador ++;
}
logger.debug("Colunas adicionadas com sucesso na pesquisa " + PesquisaBasica.getNomeDoArquivoDaPesquisa());
}
public void gerar(PesquisaBasica PesquisaBasica){
if(!isRegistroSalvo(PesquisaBasica))
imprimirMensagemSuspensa("Informe um registro válido");
EntidadeJavaFlex entidadeJavaFlex = entidadeJavaFlexService.getRegistroPelaChave(PesquisaBasica.getCodigoDaEntidadePrincipal());
if(entidadeJavaFlex == null)
imprimirMensagemSuspensa("Entidade principal não encontrada. Informe um registro válido.");
Projeto projeto = projetoService.getRegistroPelaChave(entidadeJavaFlex.getCodigoDoProjeto());
if(projeto == null)
imprimirMensagemSuspensa("Projeto não encontrado. Informe um registro válido.");
StringBuilder arquivo = new StringBuilder();
String entidadeMinuscula = UtilString.getStringComPrimeiraLetraMinuscula(entidadeJavaFlex.getNomeDaEntidade());
formataCabecalhoDoArquivo(arquivo, projeto, PesquisaBasica, entidadeJavaFlex, entidadeMinuscula);
arquivo.append("</webcase:" + projeto.getNomeDoArquivoWebPesquisa() + ">");
String caminhoArquivo = projetoService.getCaminhoDaPastaFlex(projeto);
caminhoArquivo += "\\info\\webcase\\telas\\"+entidadeMinuscula;
projetoService.escreverArquivo(arquivo, caminhoArquivo, PesquisaBasica.getNomeDoArquivoDaPesquisa()+".mxml");
logger.debug("Pesquisa " + PesquisaBasica.getNomeDoArquivoDaPesquisa()+ " criada em disco com sucesso!");
}
private void formataCabecalhoDoArquivo(StringBuilder arquivo,Projeto projeto, PesquisaBasica PesquisaBasica, EntidadeJavaFlex entidadeJavaFlex, String entidadeMinuscula) {
arquivo.append("")
.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
.append("<webcase:" + projeto.getNomeDoArquivoWebPesquisa() + " xmlns:fx=\"http://ns.adobe.com/mxml/2009\"\n")
.append("\txmlns:s=\"library://ns.adobe.com/flex/spark\"\n")
.append("\txmlns:mx=\"library://ns.adobe.com/flex/mx\"\n")
.append("\txmlns:webcase=\""+projeto.getPacoteDoArquivoWebPesquisa()+".*\"\n")
.append("\txmlns:entidade=\"info.webcase.entidade.*\"\n")
.append("\txmlns:pr=\"info.webcase.componentes.pesquisaRegistro.*\"\n")
.append("\txmlns:ac=\"info.webcase.componentes.autoComplete.*\"\n")
.append("\txmlns:webspark=\"info.webcase.componentes.webspark.*\"\n")
.append("\txmlns:database=\"info.webcase.componentes.database.*\"\n")
.append("\tdataSource=\"{" + entidadeMinuscula +"}\"\n")
.append("\ttitle=\""+PesquisaBasica.getTituloDoArquivoDaPesquisa()+"\"\n")
.append("\tservico=\""+entidadeJavaFlex.getNomeDaEntidade()+"Service\"\n")
.append("\twidth=\"600\"\n")
.append("\theight=\"300\">\n")
.append("\t<fx:Declarations>\n")
.append("\t\t<entidade:"+entidadeJavaFlex.getNomeDaEntidade()+" id=\""+entidadeMinuscula+"\"/>\n")
.append("\t</fx:Declarations>\n")
.append("\t<webcase:layout>\n")
.append("\t\t<s:VerticalLayout gap=\"0\"/>\n")
.append("\t</webcase:layout>\n");
}
} | 7,216 | 0.790569 | 0.788488 | 175 | 40.205715 | 40.089512 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.085714 | false | false | 0 |
82a12bf9192d96f35bddc9793e74509124196c52 | 23,218,593,256,623 | 4999f55ee9e54e29610a2217c0f4aa68c1a8068b | /src/main/java/com/pulsarntk/winhelper/App.java | 0ace266ab116e1e07fa5af0b42080df1cf847393 | [] | no_license | PulsarNTK/win-helper | https://github.com/PulsarNTK/win-helper | f9ab23c33aa9e6cb7725eeedb2d823a8a6abe56d | 5eead63e2b308da75344bd2bc6edb9880cf558f8 | refs/heads/master | 2022-12-26T02:07:17.452000 | 2020-06-09T06:57:39 | 2020-06-09T06:57:39 | 263,049,276 | 1 | 0 | null | false | 2020-10-13T21:54:42 | 2020-05-11T13:23:26 | 2020-06-09T06:57:52 | 2020-10-13T21:54:41 | 136 | 1 | 0 | 1 | Java | false | false | package com.pulsarntk.winhelper;
import java.rmi.UnexpectedException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import com.pulsarntk.winhelper.itf.Feature;
import com.pulsarntk.winhelper.feature.taskbarscroll.TaskbarScroll;
import com.pulsarntk.winhelper.feature.desktopbackground.DesktopBackground;
import com.pulsarntk.winhelper.feature.desktopoverview.DesktopOverview;
import com.pulsarntk.winhelper.feature.hotkeys.Hotkeys;
import com.pulsarntk.winhelper.settings.Settings;
import com.formdev.flatlaf.FlatDarkLaf;
import com.sun.jna.platform.win32.WinDef.*;
import com.sun.jna.platform.win32.WinUser.MSG;
import com.pulsarntk.winhelper.lib.Kernel32Extra;
import com.pulsarntk.winhelper.lib.VirtualDesktopAccessor;
import com.pulsarntk.winhelper.lib.VirtualDesktopAccessor.VirtualDesktopListener;
import com.sun.jna.platform.win32.*;
import com.sun.jna.Memory;
public class App {
public static ArrayList<Feature> features = new ArrayList<Feature>();
public static void main(String[] args) throws UnexpectedException, InterruptedException {
FlatDarkLaf.install();
addFeature(new DesktopBackground());
addFeature(new TaskbarScroll());
addFeature(new Hotkeys());
addFeature(new DesktopOverview());
Settings settings = new Settings(features);
}
public static void addFeature(Feature feature) {
features.add(feature);
}
}
| UTF-8 | Java | 1,434 | java | App.java | Java | [] | null | [] | package com.pulsarntk.winhelper;
import java.rmi.UnexpectedException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import com.pulsarntk.winhelper.itf.Feature;
import com.pulsarntk.winhelper.feature.taskbarscroll.TaskbarScroll;
import com.pulsarntk.winhelper.feature.desktopbackground.DesktopBackground;
import com.pulsarntk.winhelper.feature.desktopoverview.DesktopOverview;
import com.pulsarntk.winhelper.feature.hotkeys.Hotkeys;
import com.pulsarntk.winhelper.settings.Settings;
import com.formdev.flatlaf.FlatDarkLaf;
import com.sun.jna.platform.win32.WinDef.*;
import com.sun.jna.platform.win32.WinUser.MSG;
import com.pulsarntk.winhelper.lib.Kernel32Extra;
import com.pulsarntk.winhelper.lib.VirtualDesktopAccessor;
import com.pulsarntk.winhelper.lib.VirtualDesktopAccessor.VirtualDesktopListener;
import com.sun.jna.platform.win32.*;
import com.sun.jna.Memory;
public class App {
public static ArrayList<Feature> features = new ArrayList<Feature>();
public static void main(String[] args) throws UnexpectedException, InterruptedException {
FlatDarkLaf.install();
addFeature(new DesktopBackground());
addFeature(new TaskbarScroll());
addFeature(new Hotkeys());
addFeature(new DesktopOverview());
Settings settings = new Settings(features);
}
public static void addFeature(Feature feature) {
features.add(feature);
}
}
| 1,434 | 0.820084 | 0.814505 | 38 | 36.736843 | 23.783768 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.263158 | false | false | 0 |
e8454eaa8b64a90f67c152caa19ecfdaf1246b61 | 5,308,579,605,389 | 8fa221482da055f4c8105b590617a27595826cc3 | /sources/com/google/android/gms/games/internal/api/zzm.java | 0d17cd7e7a767157dc1fcf2914005cf8bce529e8 | [] | no_license | TehVenomm/sauceCodeProject | https://github.com/TehVenomm/sauceCodeProject | 4ed2f12393e67508986aded101fa2db772bd5c6b | 0b4e49a98d14b99e7d144a20e4c9ead408694d78 | refs/heads/master | 2023-03-15T16:36:41.544000 | 2018-10-08T03:44:58 | 2018-10-08T03:44:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.google.android.gms.games.internal.api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.games.Games.zza;
import com.google.android.gms.games.achievement.Achievements.UpdateAchievementResult;
abstract class zzm extends zza<UpdateAchievementResult> {
private final String zzbsx;
public zzm(String str, GoogleApiClient googleApiClient) {
super(googleApiClient);
this.zzbsx = str;
}
public final /* synthetic */ Result zzb(Status status) {
return new zzn(this, status);
}
}
| UTF-8 | Java | 667 | java | zzm.java | Java | [] | null | [] | package com.google.android.gms.games.internal.api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.games.Games.zza;
import com.google.android.gms.games.achievement.Achievements.UpdateAchievementResult;
abstract class zzm extends zza<UpdateAchievementResult> {
private final String zzbsx;
public zzm(String str, GoogleApiClient googleApiClient) {
super(googleApiClient);
this.zzbsx = str;
}
public final /* synthetic */ Result zzb(Status status) {
return new zzn(this, status);
}
}
| 667 | 0.749625 | 0.749625 | 20 | 32.349998 | 25.792004 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 0 |
aa915f7982705e5f67468b88ddbfcc9df671c672 | 26,285,199,859,702 | caaabaa5712f84d8f5f9d064937c6312adafaf3b | /tags/release-2.75/src/gui/util/JToolBarCombo.java | 8bfb0001f7174b026e85fbf3d66f461bab88673c | [] | no_license | ObjectProcessMethodology/OPCAT4 | https://github.com/ObjectProcessMethodology/OPCAT4 | 131414c13349b87e62da021c423b5024ab4cc479 | b1b361e43e52e1146dac6f1c2b5d635ec03f19ef | refs/heads/master | 2016-09-07T21:58:53.610000 | 2015-06-22T16:16:11 | 2015-06-22T16:16:11 | 37,858,609 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gui.util;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComboBox;
import javax.swing.border.BevelBorder;
import javax.swing.border.EtchedBorder;
// Small toolbar button without text, only icon
public class JToolBarCombo extends JComboBox implements MouseListener{
protected static final BevelBorder m_raised = new BevelBorder(BevelBorder.RAISED);
protected static final BevelBorder m_lowered = new BevelBorder(BevelBorder.LOWERED);
protected static final EtchedBorder m_inactive = new EtchedBorder();
public JToolBarCombo(Object items[]){
super(items);
setBorder(m_inactive);
addMouseListener(this);
setRequestFocusEnabled(false);
}
public float getAlignmentY() { return 0.5f; }
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){
setBorder(m_inactive);
}
public void mouseClicked(MouseEvent e){}
public void mouseEntered(MouseEvent e){
if (isEnabled())
{
setBorder(m_lowered);
}
}
public void mouseExited(MouseEvent e) {
setBorder(m_inactive);
}
}
| UTF-8 | Java | 1,181 | java | JToolBarCombo.java | Java | [] | null | [] | package gui.util;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComboBox;
import javax.swing.border.BevelBorder;
import javax.swing.border.EtchedBorder;
// Small toolbar button without text, only icon
public class JToolBarCombo extends JComboBox implements MouseListener{
protected static final BevelBorder m_raised = new BevelBorder(BevelBorder.RAISED);
protected static final BevelBorder m_lowered = new BevelBorder(BevelBorder.LOWERED);
protected static final EtchedBorder m_inactive = new EtchedBorder();
public JToolBarCombo(Object items[]){
super(items);
setBorder(m_inactive);
addMouseListener(this);
setRequestFocusEnabled(false);
}
public float getAlignmentY() { return 0.5f; }
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){
setBorder(m_inactive);
}
public void mouseClicked(MouseEvent e){}
public void mouseEntered(MouseEvent e){
if (isEnabled())
{
setBorder(m_lowered);
}
}
public void mouseExited(MouseEvent e) {
setBorder(m_inactive);
}
}
| 1,181 | 0.701101 | 0.699407 | 41 | 27.780487 | 23.855778 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.439024 | false | false | 0 |
2fd93ca5151712c0fbb721e37e84e5092d02dfbe | 16,329,465,726,422 | a5d01febfd8d45a61f815b6f5ed447e25fad4959 | /Source Code/5.5.1/sources/com/iqoption/portfolio/a/ac.java | 9feca9b63ed0551d73f7d9a5eab48e7837a7b6b4 | [] | no_license | kkagill/Decompiler-IQ-Option | https://github.com/kkagill/Decompiler-IQ-Option | 7fe5911f90ed2490687f5d216cb2940f07b57194 | c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6 | refs/heads/master | 2020-09-14T20:44:49.115000 | 2019-11-04T06:58:55 | 2019-11-04T06:58:55 | 223,236,327 | 1 | 0 | null | true | 2019-11-21T18:17:17 | 2019-11-21T18:17:16 | 2019-11-04T07:03:15 | 2019-11-04T07:02:38 | 104,586 | 0 | 0 | 0 | null | false | false | package com.iqoption.portfolio.a;
import com.iqoption.fragment.bf.a;
final /* synthetic */ class ac implements Runnable {
private final a ddr;
private final a dds;
ac(a aVar, a aVar2) {
this.ddr = aVar;
this.dds = aVar2;
}
public void run() {
this.ddr.a(this.dds);
}
}
| UTF-8 | Java | 321 | java | ac.java | Java | [] | null | [] | package com.iqoption.portfolio.a;
import com.iqoption.fragment.bf.a;
final /* synthetic */ class ac implements Runnable {
private final a ddr;
private final a dds;
ac(a aVar, a aVar2) {
this.ddr = aVar;
this.dds = aVar2;
}
public void run() {
this.ddr.a(this.dds);
}
}
| 321 | 0.595016 | 0.588785 | 17 | 17.882353 | 15.169173 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 0 |
5b05898b45f86ffc74e1c489c59b5b371be5d894 | 22,333,829,949,947 | 15f086a77b722213126483277719c4eabc2eff89 | /app/src/main/java/com/oakonell/dndcharacter/model/character/companion/CompanionTypePet.java | c013930dc70d808561dec5db73d8541e398386e0 | [] | no_license | OakOnEll/DnDCharacter | https://github.com/OakOnEll/DnDCharacter | 0a64ec873d2fb3d2c214f89260ce74ab385dd08c | a341dbf52383f0693d2ef2a0abeb6932f54d97cf | refs/heads/master | 2021-01-10T16:00:59.955000 | 2018-09-11T19:49:54 | 2018-09-11T19:49:54 | 45,008,039 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oakonell.dndcharacter.model.character.companion;
import com.oakonell.dndcharacter.R;
/**
* Created by Rob on 11/27/2016.
*/
public class CompanionTypePet extends AbstractHardCompanionType {
@Override
public String getType() {
return "pet";
}
@Override
public int getStringResId() {
return R.string.companion_pet;
}
@Override
public int getDescriptionResId() {
return R.string.pet_description;
}
@Override
public int getShortDescriptionResId() {
return R.string.pet_short_description;
}
}
| UTF-8 | Java | 591 | java | CompanionTypePet.java | Java | [
{
"context": "rt com.oakonell.dndcharacter.R;\n\n/**\n * Created by Rob on 11/27/2016.\n */\n\npublic class CompanionTypePet",
"end": 120,
"score": 0.9922288060188293,
"start": 117,
"tag": "NAME",
"value": "Rob"
}
] | null | [] | package com.oakonell.dndcharacter.model.character.companion;
import com.oakonell.dndcharacter.R;
/**
* Created by Rob on 11/27/2016.
*/
public class CompanionTypePet extends AbstractHardCompanionType {
@Override
public String getType() {
return "pet";
}
@Override
public int getStringResId() {
return R.string.companion_pet;
}
@Override
public int getDescriptionResId() {
return R.string.pet_description;
}
@Override
public int getShortDescriptionResId() {
return R.string.pet_short_description;
}
}
| 591 | 0.663283 | 0.649746 | 32 | 17.46875 | 19.306709 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | false | false | 0 |
028c0e085f2cbaa05b15978b0f31e4cabb99d7d9 | 12,171,937,326,520 | 0db32fda02f50ac4d3260771019ffed47a586116 | /Transactions/src/main/java/com/transactions/model/Transaction.java | d2d2dc4466afdd406da3102382d0ace6bf8c9ca1 | [] | no_license | Citibridge/Flash | https://github.com/Citibridge/Flash | a890fa12b4835c24ccbc1515441041f56dca0145 | d69f56a2f161db6735a0a1237dbfd582ec871426 | refs/heads/master | 2023-04-14T13:01:51.173000 | 2021-04-29T20:25:54 | 2021-04-29T20:25:54 | 361,466,167 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.transactions.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "tb_transaction")
public class Transaction {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long ID;
@Column
private String transactionRef;
private String username;
@DateTimeFormat(pattern = "dd-mm-yyyy")
private Date value_Date;
private String payerName;
@JsonIgnore
private String payerAccount;
private String payeeName;
@JsonIgnore
private String payeeAccount;
private double amount;
private boolean feedStatus;
public Transaction() {
}
public Transaction(String transactionRef, String username, Date value_Date, String payerName,
String payerAccount, String payeeName, String payeeAccount, double amount, boolean feedStatus) {
super();
this.transactionRef = transactionRef;
this.username = username;
this.value_Date = value_Date;
this.payerName = payerName;
this.payerAccount = payerAccount;
this.payeeName = payeeName;
this.payeeAccount = payeeAccount;
this.amount = amount;
this.feedStatus = feedStatus;
}
public boolean isFeedStatus() {
return feedStatus;
}
public void setFeedStatus(boolean feedStatus) {
this.feedStatus = feedStatus;
}
public String getTransactionRef() {
return transactionRef;
}
public void setTransactionRef(String transactionRef) {
this.transactionRef = transactionRef;
}
@JsonFormat(pattern = "dd-mm-yyyy")
public Date getValue_Date() {
return value_Date;
}
public void setValue_Date(Date Value_Date) {
this.value_Date = Value_Date;
}
public String getPayerName() {
return payerName;
}
public void setPayerName(String payerName) {
this.payerName = payerName;
}
public String getPayerAccount() {
return payerAccount;
}
public void setPayerAccount(String payerAccount) {
this.payerAccount = payerAccount;
}
public String getPayeeName() {
return payeeName;
}
public void setPayeeName(String payeeName) {
this.payeeName = payeeName;
}
public String getPayeeAccount() {
return payeeAccount;
}
public void setPayeeAccount(String payeeAccount) {
this.payeeAccount = payeeAccount;
}
public double getamount() {
return amount;
}
public void setamount(double amount) {
this.amount = amount;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String toString() {
return "Transaction [ID=" + ID + ", transactionRef=" + transactionRef + ", username=" + username
+ ", value_Date=" + value_Date + ", payerName=" + payerName + ", payerAccount=" + payerAccount
+ ", payeeName=" + payeeName + ", payeeAccount=" + payeeAccount + ", amount=" + amount + ", feedStatus="
+ feedStatus+"]";
}
}
| UTF-8 | Java | 3,279 | java | Transaction.java | Java | [
{
"context": "ransactionRef = transactionRef;\r\n\t\tthis.username = username;\r\n\t\tthis.value_Date = value_Date;\r\n\t\tthis.payerNa",
"end": 1266,
"score": 0.9994586706161499,
"start": 1258,
"tag": "USERNAME",
"value": "username"
},
{
"context": "t;\r\n\t}\r\n\r\n\tpublic String ... | null | [] | package com.transactions.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "tb_transaction")
public class Transaction {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long ID;
@Column
private String transactionRef;
private String username;
@DateTimeFormat(pattern = "dd-mm-yyyy")
private Date value_Date;
private String payerName;
@JsonIgnore
private String payerAccount;
private String payeeName;
@JsonIgnore
private String payeeAccount;
private double amount;
private boolean feedStatus;
public Transaction() {
}
public Transaction(String transactionRef, String username, Date value_Date, String payerName,
String payerAccount, String payeeName, String payeeAccount, double amount, boolean feedStatus) {
super();
this.transactionRef = transactionRef;
this.username = username;
this.value_Date = value_Date;
this.payerName = payerName;
this.payerAccount = payerAccount;
this.payeeName = payeeName;
this.payeeAccount = payeeAccount;
this.amount = amount;
this.feedStatus = feedStatus;
}
public boolean isFeedStatus() {
return feedStatus;
}
public void setFeedStatus(boolean feedStatus) {
this.feedStatus = feedStatus;
}
public String getTransactionRef() {
return transactionRef;
}
public void setTransactionRef(String transactionRef) {
this.transactionRef = transactionRef;
}
@JsonFormat(pattern = "dd-mm-yyyy")
public Date getValue_Date() {
return value_Date;
}
public void setValue_Date(Date Value_Date) {
this.value_Date = Value_Date;
}
public String getPayerName() {
return payerName;
}
public void setPayerName(String payerName) {
this.payerName = payerName;
}
public String getPayerAccount() {
return payerAccount;
}
public void setPayerAccount(String payerAccount) {
this.payerAccount = payerAccount;
}
public String getPayeeName() {
return payeeName;
}
public void setPayeeName(String payeeName) {
this.payeeName = payeeName;
}
public String getPayeeAccount() {
return payeeAccount;
}
public void setPayeeAccount(String payeeAccount) {
this.payeeAccount = payeeAccount;
}
public double getamount() {
return amount;
}
public void setamount(double amount) {
this.amount = amount;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String toString() {
return "Transaction [ID=" + ID + ", transactionRef=" + transactionRef + ", username=" + username
+ ", value_Date=" + value_Date + ", payerName=" + payerName + ", payerAccount=" + payerAccount
+ ", payeeName=" + payeeName + ", payeeAccount=" + payeeAccount + ", amount=" + amount + ", feedStatus="
+ feedStatus+"]";
}
}
| 3,279 | 0.704788 | 0.704788 | 143 | 20.930071 | 22.302324 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.461538 | false | false | 0 |
1b26191207b9b93e334d42a0886527d8d09b587a | 21,586,505,634,756 | bfac53f4ea7debd1367b4b39a578fe2539415ecd | /app/src/main/java/sg/edu/np/madpractical2_activity_s10205375/MainActivity.java | 6ed2b6ed3457e1f6a7dd3951e391a629d0871fd7 | [] | no_license | MAD11877/mad21-practical-3---event-handling-CalebChoo1 | https://github.com/MAD11877/mad21-practical-3---event-handling-CalebChoo1 | 9029a394d202389293c043ca30295827732126c7 | 9918920782f1dcb22334c163415157d416cd7ade | refs/heads/main | 2023-04-22T11:54:44.242000 | 2021-05-06T07:01:53 | 2021-05-06T07:01:53 | 364,209,984 | 0 | 0 | null | false | 2021-05-04T09:51:15 | 2021-05-04T09:51:11 | 2021-05-04T09:51:14 | 2021-05-04T09:51:15 | 0 | 0 | 0 | 1 | null | false | false | package sg.edu.np.madpractical2_activity_s10205375;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
User user1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
user1 = new User();
TextView name = findViewById(R.id.name);
user1.name = "MAD";
name.setText(user1.getName());
TextView desc = findViewById((R.id.desc));
user1.description = "Loren ipsum dolor sit amet consectetur\n adipiscing elit sed do eiusmod tempor\n incididunt ut labore et dolore magna aliqua";
desc.setText(user1.getDesc());
Intent in = getIntent();
name.append(in.getStringExtra("ranInt"));
Button fllwBtn = findViewById(R.id.followbtn);
fllwBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView follow_text = findViewById((R.id.followbtn));
if (!user1.followed) {
follow_text.setText("Unfollow");
Toast.makeText(getApplicationContext(), "Followed", Toast.LENGTH_SHORT).show();
user1.followed = true;
}
else {
follow_text.setText("Follow");
Toast.makeText(getApplicationContext(), "Unfollowed", Toast.LENGTH_SHORT).show();
user1.followed = false;
}
}
});
}
} | UTF-8 | Java | 1,839 | java | MainActivity.java | Java | [
{
"context": " = findViewById(R.id.name);\n user1.name = \"MAD\";\n name.setText(user1.getName());\n\n ",
"end": 687,
"score": 0.986808180809021,
"start": 684,
"tag": "NAME",
"value": "MAD"
}
] | null | [] | package sg.edu.np.madpractical2_activity_s10205375;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
User user1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
user1 = new User();
TextView name = findViewById(R.id.name);
user1.name = "MAD";
name.setText(user1.getName());
TextView desc = findViewById((R.id.desc));
user1.description = "Loren ipsum dolor sit amet consectetur\n adipiscing elit sed do eiusmod tempor\n incididunt ut labore et dolore magna aliqua";
desc.setText(user1.getDesc());
Intent in = getIntent();
name.append(in.getStringExtra("ranInt"));
Button fllwBtn = findViewById(R.id.followbtn);
fllwBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView follow_text = findViewById((R.id.followbtn));
if (!user1.followed) {
follow_text.setText("Unfollow");
Toast.makeText(getApplicationContext(), "Followed", Toast.LENGTH_SHORT).show();
user1.followed = true;
}
else {
follow_text.setText("Follow");
Toast.makeText(getApplicationContext(), "Unfollowed", Toast.LENGTH_SHORT).show();
user1.followed = false;
}
}
});
}
} | 1,839 | 0.625884 | 0.616096 | 52 | 34.384617 | 28.819166 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.673077 | false | false | 0 |
35ccae6cfde0546b09069041421446b37ee4aff8 | 11,201,274,718,698 | 48b3878ca6d9aada8a8c6dd6023f18a86325a6d5 | /app/src/main/java/net/ivanvega/mibasedatosp77a/Crud1.java | ea2c37b3494c1020a65cc3c79364d348e79225ad | [] | no_license | jlmv97/App_base_de_datos1 | https://github.com/jlmv97/App_base_de_datos1 | 4f5aaae4637e323d2f2e601eb9710b46886bea13 | 06e0f258558b2c78d83d8a57f4de7a3114eef9ad | refs/heads/master | 2020-08-22T20:24:21.301000 | 2019-10-21T04:41:34 | 2019-10-21T04:41:34 | 216,471,650 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.ivanvega.mibasedatosp77a;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CalendarView;
import android.widget.EditText;
import android.widget.Toast;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class Crud1 extends AppCompatActivity {
DAOContactos dao;
EditText usuario;
EditText email;
EditText telefono;
EditText fecha;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_crud1);
usuario = findViewById(R.id.txtNombre);
email = findViewById(R.id.txtEmail);
telefono = findViewById(R.id.txtTelefono);
fecha = findViewById(R.id.txtFecha);
dao = new DAOContactos(this);
}
//Boton Agregar
public void Agregar(View view) {
String user = usuario.getText().toString();
String mail = email.getText().toString();
String tel = telefono.getText().toString();
String fec = fecha.getText().toString();
try {
dao.insert(new Contacto(0,user,mail,tel,new SimpleDateFormat("yyyy/MM/dd").parse(fec)));
} catch (ParseException e) {
e.printStackTrace();
}
Toast.makeText(this,"Agregado",Toast.LENGTH_SHORT).show();
Intent agregacion= new Intent(this,MainActivity.class);
startActivity(agregacion);
finish();
}
//Boton Cancelar
public void Cancelar(View view) {
Intent cancel= new Intent(this,MainActivity.class);
startActivity(cancel);
finish();
}
}
| UTF-8 | Java | 1,714 | java | Crud1.java | Java | [
{
"context": "package net.ivanvega.mibasedatosp77a;\n\nimport androidx.appcompat.app.A",
"end": 20,
"score": 0.7433181405067444,
"start": 14,
"tag": "USERNAME",
"value": "anvega"
}
] | null | [] | package net.ivanvega.mibasedatosp77a;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CalendarView;
import android.widget.EditText;
import android.widget.Toast;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class Crud1 extends AppCompatActivity {
DAOContactos dao;
EditText usuario;
EditText email;
EditText telefono;
EditText fecha;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_crud1);
usuario = findViewById(R.id.txtNombre);
email = findViewById(R.id.txtEmail);
telefono = findViewById(R.id.txtTelefono);
fecha = findViewById(R.id.txtFecha);
dao = new DAOContactos(this);
}
//Boton Agregar
public void Agregar(View view) {
String user = usuario.getText().toString();
String mail = email.getText().toString();
String tel = telefono.getText().toString();
String fec = fecha.getText().toString();
try {
dao.insert(new Contacto(0,user,mail,tel,new SimpleDateFormat("yyyy/MM/dd").parse(fec)));
} catch (ParseException e) {
e.printStackTrace();
}
Toast.makeText(this,"Agregado",Toast.LENGTH_SHORT).show();
Intent agregacion= new Intent(this,MainActivity.class);
startActivity(agregacion);
finish();
}
//Boton Cancelar
public void Cancelar(View view) {
Intent cancel= new Intent(this,MainActivity.class);
startActivity(cancel);
finish();
}
}
| 1,714 | 0.670362 | 0.667445 | 55 | 30.163637 | 20.466171 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.781818 | false | false | 0 |
a32afd6647a5b9b3409ecfea328274e7f42bf2ea | 6,347,961,685,775 | 44aee7d628db520334a4c317c4807877675b738c | /src/java/nl/fontys/prj2/BusinessManager/TruckBusinessManager.java | a2640bf5cc72a74ef0a273c27b92d95c18548dd8 | [] | no_license | kaszuster/LogisticsApplication | https://github.com/kaszuster/LogisticsApplication | 59bed6e9c922036d37d92ea911da4b0ee8b35310 | 3068e9ea07881e514e6efedbf77780bb1eff1709 | refs/heads/master | 2019-07-01T16:46:03.995000 | 2013-10-17T09:29:34 | 2013-10-17T09:29:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package nl.fontys.prj2.BusinessManager;
import java.util.ArrayList;
import nl.fontys.prj2.JavaBeans.Truck;
import nl.fontys.prj2.database.Mapper.TruckMapper;
/**
*
* @author sebi
*/
public class TruckBusinessManager {
private TruckMapper truckMapper = null;
private TruckMapper getTruckMapper() {
if (truckMapper == null) {
truckMapper = new TruckMapper();
}
return truckMapper;
}
public Truck getTruck(int id) {
return (Truck) getTruckMapper().retrieve(id);
}
public ArrayList<Truck> getAllTrucks() {
ArrayList<Truck> retval = new ArrayList<Truck>();
return retval;
}
public ArrayList<Integer> getTruckIds() {
return getTruckMapper().getTruckIds();
}
}
| UTF-8 | Java | 822 | java | TruckBusinessManager.java | Java | [
{
"context": "j2.database.Mapper.TruckMapper;\n\n/**\n *\n * @author sebi\n */\npublic class TruckBusinessManager {\n\n priv",
"end": 283,
"score": 0.9990728497505188,
"start": 279,
"tag": "USERNAME",
"value": "sebi"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package nl.fontys.prj2.BusinessManager;
import java.util.ArrayList;
import nl.fontys.prj2.JavaBeans.Truck;
import nl.fontys.prj2.database.Mapper.TruckMapper;
/**
*
* @author sebi
*/
public class TruckBusinessManager {
private TruckMapper truckMapper = null;
private TruckMapper getTruckMapper() {
if (truckMapper == null) {
truckMapper = new TruckMapper();
}
return truckMapper;
}
public Truck getTruck(int id) {
return (Truck) getTruckMapper().retrieve(id);
}
public ArrayList<Truck> getAllTrucks() {
ArrayList<Truck> retval = new ArrayList<Truck>();
return retval;
}
public ArrayList<Integer> getTruckIds() {
return getTruckMapper().getTruckIds();
}
}
| 822 | 0.693431 | 0.689781 | 41 | 19.04878 | 19.371782 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.487805 | false | false | 0 |
e70f2e5a916bf82fc0bd20c90363e99ed2403c1b | 26,525,718,029,127 | 770af259a49fb4293ee9e2e74a751fe86f4245b5 | /Library/src/business/converter/usergroup/UserGroupParamConverter.java | c45679332b6f06c33e4adf3ada3a881884af8242 | [] | no_license | Sorpy/LibraryRepo | https://github.com/Sorpy/LibraryRepo | 8a1a052ec9eb7c9344dfdfe806039fe4a3c79f95 | 7c5a34448aeabab7c127caf50b5f33aa05043cc1 | refs/heads/master | 2020-09-08T15:09:16.450000 | 2019-11-21T14:11:44 | 2019-11-21T14:11:44 | 221,167,090 | 0 | 0 | null | false | 2019-11-26T12:05:34 | 2019-11-12T08:26:38 | 2019-11-21T14:12:57 | 2019-11-26T11:30:57 | 8,641 | 0 | 0 | 0 | Java | false | false | package business.converter.usergroup;
import business.converter.common.BaseParamConverter;
import data.entity.UserGroup;
public interface UserGroupParamConverter extends BaseParamConverter<UserGroupParam,UserGroup> {
UserGroup convert(UserGroupParam param, UserGroup oldEntity);
}
| UTF-8 | Java | 287 | java | UserGroupParamConverter.java | Java | [] | null | [] | package business.converter.usergroup;
import business.converter.common.BaseParamConverter;
import data.entity.UserGroup;
public interface UserGroupParamConverter extends BaseParamConverter<UserGroupParam,UserGroup> {
UserGroup convert(UserGroupParam param, UserGroup oldEntity);
}
| 287 | 0.850174 | 0.850174 | 8 | 34.875 | 32.470901 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 0 |
c48c770fa4f41050eae7d431ccb641148328cdd8 | 9,698,036,167,567 | 41b0c33b9dba2599e580e68fa52b22daf7b88607 | /manager/sklay-widgets/src/main/java/com/sklay/dao/MedicalReportDao.java | 82af465cab51b7c8c3d055230c208d2ec2464bf8 | [] | no_license | qq85609655/njztsm | https://github.com/qq85609655/njztsm | 42f27bfb441df6a1ddab65a90eee267cbe38519b | 2134ab82c1c2e8487092ef0243438d7dbca9623a | refs/heads/master | 2021-01-25T13:12:02.212000 | 2014-12-22T08:18:56 | 2014-12-22T08:18:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sklay.dao;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import com.sklay.core.enums.SMSType;
import com.sklay.model.MedicalReport;
public interface MedicalReportDao extends JpaRepository<MedicalReport, Long> {
@Query(" select count(m) from MedicalReport m where m.targetUser.id = ?1 and m.reportTime >= ?2 and m.reportTime <= ?3 and m.reportType = ?4 ")
public long countDayReport(Long userId, long timeStart, long timeEnd,
SMSType reportType);
@Query(" select m from MedicalReport m where m.targetUser.id = ?1 and m.reportTime between ?2 and ?3 and m.reportType = ?4 GROUP BY date_format(from_unixtime(m.reportTime/1000),'%Y:%m:%d') order by m.reportTime desc")
public List<MedicalReport> getDayReport(Long userId, long timeStart,
long timeEnd, SMSType reportType);
@Query(" select m from MedicalReport m where date_format(from_unixtime(m.reportTime/1000),'%Y-%m-%d') = ?1 and m.reportType = ?2 order by m.targetUser.id desc")
public List<MedicalReport> findTodayReport(String time, SMSType reportType);
@Query(" select m from MedicalReport m where m.targetUser.id in (?1) and date_format(from_unixtime(m.reportTime/1000),'%Y-%m-%d') = ?2 and m.reportType = ?3 order by m.reportTime desc")
public List<MedicalReport> findUserTodayReport(Set<Long> ids, String time,
SMSType reportType);
@Modifying
@Query("delete from MedicalReport m where m.targetUser.id = ?1 ")
public void deleteMedicalReport(Long userId);
}
| UTF-8 | Java | 1,633 | java | MedicalReportDao.java | Java | [] | null | [] | package com.sklay.dao;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import com.sklay.core.enums.SMSType;
import com.sklay.model.MedicalReport;
public interface MedicalReportDao extends JpaRepository<MedicalReport, Long> {
@Query(" select count(m) from MedicalReport m where m.targetUser.id = ?1 and m.reportTime >= ?2 and m.reportTime <= ?3 and m.reportType = ?4 ")
public long countDayReport(Long userId, long timeStart, long timeEnd,
SMSType reportType);
@Query(" select m from MedicalReport m where m.targetUser.id = ?1 and m.reportTime between ?2 and ?3 and m.reportType = ?4 GROUP BY date_format(from_unixtime(m.reportTime/1000),'%Y:%m:%d') order by m.reportTime desc")
public List<MedicalReport> getDayReport(Long userId, long timeStart,
long timeEnd, SMSType reportType);
@Query(" select m from MedicalReport m where date_format(from_unixtime(m.reportTime/1000),'%Y-%m-%d') = ?1 and m.reportType = ?2 order by m.targetUser.id desc")
public List<MedicalReport> findTodayReport(String time, SMSType reportType);
@Query(" select m from MedicalReport m where m.targetUser.id in (?1) and date_format(from_unixtime(m.reportTime/1000),'%Y-%m-%d') = ?2 and m.reportType = ?3 order by m.reportTime desc")
public List<MedicalReport> findUserTodayReport(Set<Long> ids, String time,
SMSType reportType);
@Modifying
@Query("delete from MedicalReport m where m.targetUser.id = ?1 ")
public void deleteMedicalReport(Long userId);
}
| 1,633 | 0.758726 | 0.742805 | 33 | 48.484848 | 56.020626 | 221 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.393939 | false | false | 0 |
69c094dec8bf2ecba874fdda29186794572a65d0 | 22,926,535,479,581 | f616df6b3402f82dc5a1e5985af3bdc3bbb4682a | /epaye-dal/src/main/java/com/epaye/dal/commun/dao/AdresseDao.java | 4c428512408329668b571c678ffad9aa5c369c75 | [] | no_license | mzouaghi/dsn | https://github.com/mzouaghi/dsn | fa4a6c3bcb3224c78a2335c57ce02e4598b25fe2 | b46f0dab2c7257879714f8c58e80af46d09142cc | refs/heads/master | 2017-10-18T18:06:12.671000 | 2017-01-31T17:02:04 | 2017-01-31T17:02:57 | 54,975,178 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.epaye.dal.commun.dao;
import com.epaye.dal.commun.model.Adresse;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AdresseDao extends JpaRepository<Adresse, Integer> {
List<Adresse> findByVoie(String voie);
}
| UTF-8 | Java | 344 | java | AdresseDao.java | Java | [] | null | [] | package com.epaye.dal.commun.dao;
import com.epaye.dal.commun.model.Adresse;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AdresseDao extends JpaRepository<Adresse, Integer> {
List<Adresse> findByVoie(String voie);
}
| 344 | 0.80814 | 0.80814 | 14 | 23.571428 | 24.388857 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 0 |
1c46de333f56886d7b688cde44cb54400bab7328 | 12,532,714,636,202 | b79623530aadc39e7ed661ca44331e3368bf0991 | /walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java | 7899c5da3d209c1efee1372d0e7364eeee130a68 | [] | no_license | mapbox/josm-plugins | https://github.com/mapbox/josm-plugins | e15d1f571690f2fbc90cabd11dd297fb7c8c1ee1 | dd4ff87430e2fce3dd1f21a8f949283479ae0f73 | refs/heads/master | 2023-08-22T02:18:31.121000 | 2017-07-20T15:37:19 | 2017-07-20T15:37:19 | 97,875,487 | 0 | 2 | null | true | 2017-07-20T20:26:26 | 2017-07-20T20:26:25 | 2017-07-11T18:00:41 | 2017-07-20T16:10:09 | 504,369 | 0 | 0 | 0 | null | null | null | package org.openstreetmap.josm.plugins.walkingpapers;
import static org.openstreetmap.josm.tools.I18n.tr;
import java.awt.event.ActionEvent;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.coor.LatLon;
@SuppressWarnings("serial")
public class WalkingPapersAddLayerAction extends JosmAction {
public WalkingPapersAddLayerAction() {
super(tr("Walking Papers Scanned Map"), "walkingpapers",
tr("Display a map that was previously scanned and uploaded to walking-papers.org"), null, false);
}
@Override
public void actionPerformed(ActionEvent e) {
String wpid = JOptionPane.showInputDialog(Main.parent,
tr("Enter a walking-papers.org URL or ID (the bit after the ?id= in the URL)"),
Main.pref.get("walkingpapers.last-used-id"));
if (wpid == null || wpid.equals("")) return;
// Grab id= from the URL if we need to, otherwise get an ID
String mungedWpId = WalkingPapersAddLayerAction.getWalkingPapersId(wpid);
if (mungedWpId == null || mungedWpId.equals("")) return;
// screen-scrape details about this id from walking-papers.org
String wpUrl = Main.pref.get("walkingpapers.base-url", "http://walking-papers.org/") + "scan.php?id=" + mungedWpId;
Pattern spanPattern = Pattern.compile("<span class=\"(\\S+)\">(\\S+)</span>");
Matcher m;
double north = 0;
double south = 0;
double east = 0;
double west = 0;
int minz = -1;
int maxz = -1;
String tile = null;
try (BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"))) {
for (String line = r.readLine(); line != null; line = r.readLine()) {
m = spanPattern.matcher(line);
if (m.find()) {
if ("tile".equals(m.group(1))) tile = m.group(2);
else if ("north".equals(m.group(1))) north = Double.parseDouble(m.group(2));
else if ("south".equals(m.group(1))) south = Double.parseDouble(m.group(2));
else if ("east".equals(m.group(1))) east = Double.parseDouble(m.group(2));
else if ("west".equals(m.group(1))) west = Double.parseDouble(m.group(2));
else if ("minzoom".equals(m.group(1))) minz = Integer.parseInt(m.group(2));
else if ("maxzoom".equals(m.group(1))) maxz = Integer.parseInt(m.group(2));
}
}
if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) {
throw new IllegalStateException();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(Main.parent,tr("Could not read information from walking-papers.org the id \"{0}\"", mungedWpId));
return;
}
//http://walking-papers.org/scan.php?id=rmvdr3lq
// The server is apparently broken and returning the WpId in the URL twice
// which makes it return errors when we fetch it. So, strip out one of
// the dups. This is a hack and needs to get removed when the server
// is fixed.
tile = tile.replaceFirst(mungedWpId+"/"+mungedWpId, mungedWpId);
Main.pref.put("walkingpapers.last-used-id", mungedWpId);
Bounds b = new Bounds(new LatLon(south, west), new LatLon(north, east));
WalkingPapersLayer wpl = new WalkingPapersLayer(mungedWpId, tile, b, minz, maxz);
Main.getLayerManager().addLayer(wpl);
}
private static String getWalkingPapersId(String wpid) {
if (!wpid.contains("id=")) {
return wpid;
} else {
// To match e.g. http://walking-papers.org/scan.php?id=53h78bbx
final Pattern pattern = Pattern.compile("\\?id=(\\S+)");
final Matcher matcher = pattern.matcher(wpid);
final boolean found = matcher.find();
if (found) {
return matcher.group(1);
}
}
return null;
}
}
| UTF-8 | Java | 4,361 | java | WalkingPapersAddLayerAction.java | Java | [] | null | [] | package org.openstreetmap.josm.plugins.walkingpapers;
import static org.openstreetmap.josm.tools.I18n.tr;
import java.awt.event.ActionEvent;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.coor.LatLon;
@SuppressWarnings("serial")
public class WalkingPapersAddLayerAction extends JosmAction {
public WalkingPapersAddLayerAction() {
super(tr("Walking Papers Scanned Map"), "walkingpapers",
tr("Display a map that was previously scanned and uploaded to walking-papers.org"), null, false);
}
@Override
public void actionPerformed(ActionEvent e) {
String wpid = JOptionPane.showInputDialog(Main.parent,
tr("Enter a walking-papers.org URL or ID (the bit after the ?id= in the URL)"),
Main.pref.get("walkingpapers.last-used-id"));
if (wpid == null || wpid.equals("")) return;
// Grab id= from the URL if we need to, otherwise get an ID
String mungedWpId = WalkingPapersAddLayerAction.getWalkingPapersId(wpid);
if (mungedWpId == null || mungedWpId.equals("")) return;
// screen-scrape details about this id from walking-papers.org
String wpUrl = Main.pref.get("walkingpapers.base-url", "http://walking-papers.org/") + "scan.php?id=" + mungedWpId;
Pattern spanPattern = Pattern.compile("<span class=\"(\\S+)\">(\\S+)</span>");
Matcher m;
double north = 0;
double south = 0;
double east = 0;
double west = 0;
int minz = -1;
int maxz = -1;
String tile = null;
try (BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"))) {
for (String line = r.readLine(); line != null; line = r.readLine()) {
m = spanPattern.matcher(line);
if (m.find()) {
if ("tile".equals(m.group(1))) tile = m.group(2);
else if ("north".equals(m.group(1))) north = Double.parseDouble(m.group(2));
else if ("south".equals(m.group(1))) south = Double.parseDouble(m.group(2));
else if ("east".equals(m.group(1))) east = Double.parseDouble(m.group(2));
else if ("west".equals(m.group(1))) west = Double.parseDouble(m.group(2));
else if ("minzoom".equals(m.group(1))) minz = Integer.parseInt(m.group(2));
else if ("maxzoom".equals(m.group(1))) maxz = Integer.parseInt(m.group(2));
}
}
if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) {
throw new IllegalStateException();
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(Main.parent,tr("Could not read information from walking-papers.org the id \"{0}\"", mungedWpId));
return;
}
//http://walking-papers.org/scan.php?id=rmvdr3lq
// The server is apparently broken and returning the WpId in the URL twice
// which makes it return errors when we fetch it. So, strip out one of
// the dups. This is a hack and needs to get removed when the server
// is fixed.
tile = tile.replaceFirst(mungedWpId+"/"+mungedWpId, mungedWpId);
Main.pref.put("walkingpapers.last-used-id", mungedWpId);
Bounds b = new Bounds(new LatLon(south, west), new LatLon(north, east));
WalkingPapersLayer wpl = new WalkingPapersLayer(mungedWpId, tile, b, minz, maxz);
Main.getLayerManager().addLayer(wpl);
}
private static String getWalkingPapersId(String wpid) {
if (!wpid.contains("id=")) {
return wpid;
} else {
// To match e.g. http://walking-papers.org/scan.php?id=53h78bbx
final Pattern pattern = Pattern.compile("\\?id=(\\S+)");
final Matcher matcher = pattern.matcher(wpid);
final boolean found = matcher.find();
if (found) {
return matcher.group(1);
}
}
return null;
}
}
| 4,361 | 0.606054 | 0.598257 | 105 | 40.533333 | 34.238678 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.790476 | false | false | 0 |
3f25e2c29f7673886cecd3f0f14de6adf17f34d7 | 19,387,482,422,344 | acac52fecc1413074ec2395ccb89b2b5c3655b33 | /src/com/dhp/service/ContaBancariaService.java | d60b623d4efdb1b01102850ac668d1469f64b5e2 | [] | no_license | m4ndr4ck/BTC | https://github.com/m4ndr4ck/BTC | 7275570d5e451df4dda43f70c9d1137d8b72fb18 | 97695df35d73ff09c7de29f23d2b81bccf9ce4ab | refs/heads/master | 2020-04-18T00:41:04.379000 | 2019-01-23T00:04:52 | 2019-01-23T00:04:52 | 167,086,680 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dhp.service;
import java.util.List;
import com.dhp.model.ContaBancaria;
public interface ContaBancariaService {
void save(ContaBancaria contabancaria);
void delete(long clienteid);
List<ContaBancaria> findByClienteid(Long clienteid);
}
| UTF-8 | Java | 259 | java | ContaBancariaService.java | Java | [] | null | [] | package com.dhp.service;
import java.util.List;
import com.dhp.model.ContaBancaria;
public interface ContaBancariaService {
void save(ContaBancaria contabancaria);
void delete(long clienteid);
List<ContaBancaria> findByClienteid(Long clienteid);
}
| 259 | 0.791506 | 0.791506 | 14 | 17.5 | 18.461349 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.785714 | false | false | 0 |
ef37ae99274417c2439eafbdb10959f5d159df84 | 2,559,800,573,989 | 084d4691955159220013b0b4ed529d508286441f | /src/edu/junyao/usar/LoginActivity.java | ebb0c517bb83712eb0a9e5adaaa72840f2ff36a2 | [] | no_license | whalebill/USAR2 | https://github.com/whalebill/USAR2 | 3d6065ce2a79f5b0337344c7cfb5b5cda605211c | cacae4d582ef241364f2e971909c4ac5fb39a8c0 | refs/heads/master | 2021-01-10T02:15:49.283000 | 2015-10-28T09:18:56 | 2015-10-28T09:18:56 | 45,100,204 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.junyao.usar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class LoginActivity extends Activity implements OnClickListener{
private static final String TAG = "LoginActivity";
public static final String TEAM_NAME = "team name";
public static final String RESPONDER_ID = "responder id";
private EditText team_name_ed, responder_id_ed;
private Button cncl_btn, cnfm_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// register some ui components
team_name_ed = (EditText) findViewById(R.id.team_name);
responder_id_ed = (EditText) findViewById(R.id.responder_id);
cncl_btn = (Button) findViewById(R.id.login_cancel);
cnfm_btn = (Button) findViewById(R.id.login_confirm);
cncl_btn.setOnClickListener(this);
cnfm_btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent returnIntent = new Intent();
Bundle bundle;
switch(v.getId()){
case R.id.login_cancel:
setResult(RESULT_CANCELED, returnIntent);
finish();
break;
case R.id.login_confirm:
String teamName = team_name_ed.getText().toString();
int responderId = Integer.parseInt(responder_id_ed.getText().toString());
bundle = new Bundle();
bundle.putString(TEAM_NAME, teamName);
bundle.putInt(RESPONDER_ID, responderId);
returnIntent.putExtras(bundle);
setResult(RESULT_OK, returnIntent);
finish();
break;
}
}
}
| UTF-8 | Java | 1,656 | java | LoginActivity.java | Java | [] | null | [] | package edu.junyao.usar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class LoginActivity extends Activity implements OnClickListener{
private static final String TAG = "LoginActivity";
public static final String TEAM_NAME = "team name";
public static final String RESPONDER_ID = "responder id";
private EditText team_name_ed, responder_id_ed;
private Button cncl_btn, cnfm_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// register some ui components
team_name_ed = (EditText) findViewById(R.id.team_name);
responder_id_ed = (EditText) findViewById(R.id.responder_id);
cncl_btn = (Button) findViewById(R.id.login_cancel);
cnfm_btn = (Button) findViewById(R.id.login_confirm);
cncl_btn.setOnClickListener(this);
cnfm_btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent returnIntent = new Intent();
Bundle bundle;
switch(v.getId()){
case R.id.login_cancel:
setResult(RESULT_CANCELED, returnIntent);
finish();
break;
case R.id.login_confirm:
String teamName = team_name_ed.getText().toString();
int responderId = Integer.parseInt(responder_id_ed.getText().toString());
bundle = new Bundle();
bundle.putString(TEAM_NAME, teamName);
bundle.putInt(RESPONDER_ID, responderId);
returnIntent.putExtras(bundle);
setResult(RESULT_OK, returnIntent);
finish();
break;
}
}
}
| 1,656 | 0.740942 | 0.740942 | 56 | 28.571428 | 20.578991 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.214286 | false | false | 0 |
c7d26b8116474f47014e2fb7ae5bf68669de83e8 | 18,167,711,720,430 | a51ba6c2f67421c683b0d03477f6ffa7cd66936e | /app/src/main/java/by/project/dartlen/riversofbelarus/signup/SignupContract.java | c58c6fcabdea6979af3af82c7a3a1603ed47484f | [] | no_license | Dartlen/RiversOfBelarus | https://github.com/Dartlen/RiversOfBelarus | d310d9eb80d27de87362f5399298d324e8919ec7 | 30081e7068c7d92186dbce939fae990b62bc8239 | refs/heads/master | 2021-09-02T19:58:39.133000 | 2018-01-03T20:42:07 | 2018-01-03T20:42:07 | 110,472,163 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.project.dartlen.riversofbelarus.signup;
import by.project.dartlen.riversofbelarus.BasePresenter;
import by.project.dartlen.riversofbelarus.BaseView;
/***
* Created by Dartlen on 09.12.2017.
*/
public interface SignupContract {
interface Presenter extends BasePresenter<SignupContract.View>{
void onClickedSignUp(String phone, String Name, String password);
}
interface View extends BaseView<SignupContract.Presenter>{
void showProgressDialog();
void hideProgressDialog();
void showFailedRegister();
void showUserRegisterMessage();
}
}
| UTF-8 | Java | 607 | java | SignupContract.java | Java | [
{
"context": "tlen.riversofbelarus.BaseView;\n\n/***\n * Created by Dartlen on 09.12.2017.\n */\n\npublic interface SignupContra",
"end": 188,
"score": 0.9976325035095215,
"start": 181,
"tag": "NAME",
"value": "Dartlen"
}
] | null | [] | package by.project.dartlen.riversofbelarus.signup;
import by.project.dartlen.riversofbelarus.BasePresenter;
import by.project.dartlen.riversofbelarus.BaseView;
/***
* Created by Dartlen on 09.12.2017.
*/
public interface SignupContract {
interface Presenter extends BasePresenter<SignupContract.View>{
void onClickedSignUp(String phone, String Name, String password);
}
interface View extends BaseView<SignupContract.Presenter>{
void showProgressDialog();
void hideProgressDialog();
void showFailedRegister();
void showUserRegisterMessage();
}
}
| 607 | 0.738056 | 0.724876 | 20 | 29.35 | 24.617626 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 0 |
1816f1a9ad35cee1fb6dd4eb28082a241edf02a0 | 8,967,891,714,477 | 9125b58a5b27dd49681ef51a5c1b0fe1531afdc1 | /Jiny/프로그래머스/신규아이디추천.java | 4481537c4398394199b255c4d3b4498a84222b6c | [] | no_license | Luminousjiny/Algomate-Study | https://github.com/Luminousjiny/Algomate-Study | b1ceec3efd55c58960bba9d2652b99785b8d54c7 | e6ff3866d9f64c856e12d9b3f1f52a277dc70eaa | refs/heads/main | 2023-04-20T09:52:17.838000 | 2021-05-06T12:30:44 | 2021-05-06T12:30:44 | 350,759,471 | 1 | 0 | null | true | 2021-03-23T15:17:14 | 2021-03-23T15:17:14 | 2021-03-23T15:12:53 | 2021-03-23T15:12:51 | 0 | 0 | 0 | 0 | null | false | false | package programmers;
// 2021 카카오 코테 기출
public class 신규아이디추천 {
public static void main(String[] args) {
solution("z-+.^.");
}
public static String solution(String new_id) {
String answer = "";
// 1단계 new_id의 모든 대문자를 대응되는 소문자로 치환합니다.
new_id = new_id.toLowerCase();
System.out.println("1: "+new_id);
//2단계 new_id에서 알파벳 소문자, 숫자, 빼기(-), 밑줄(_), 마침표(.)를 제외한 모든 문자를 제거합니다.
StringBuffer sb = new StringBuffer();
sb.append(new_id);
for (int i = 0; i < sb.length(); i++) {
int now = sb.charAt(i);
if((now>=97 && now <=122) || (now>=48 && now<=57) || now == 45 || now == 95 || now == 46) continue;
sb.deleteCharAt(i);
i--;
}
System.out.println("2: "+sb.toString());
//3단계 new_id에서 마침표(.)가 2번 이상 연속된 부분을 하나의 마침표(.)로 치환합니다.
for (int i = 0; i < sb.length(); i++) {
if(sb.charAt(i) == '.'){ // .이면
if(i < sb.length()-1){ // 다음칸이 있을 때 다음칸이 .인지 보기
if(sb.charAt(i+1) == '.'){
sb.deleteCharAt(i+1);
i--;
}
}
}
}
System.out.println("3: "+sb.toString());
//4단계 new_id에서 마침표(.)가 처음이나 끝에 위치한다면 제거합니다.
if(sb.charAt(0) == '.') sb.deleteCharAt(0);
if(sb.length() != 0 && sb.charAt(sb.length()-1) == '.') sb.deleteCharAt(sb.length()-1);
System.out.println("4: "+sb.toString());
//5단계 new_id가 빈 문자열이라면, new_id에 "a"를 대입합니다.
if(sb.length() == 0) sb.append("a");
new_id = sb.toString();
System.out.println("5: "+new_id);
//6단계 new_id의 길이가 16자 이상이면, new_id의 첫 15개의 문자를 제외한 나머지 문자들을 모두 제거합니다.
// 만약 제거 후 마침표(.)가 new_id의 끝에 위치한다면 끝에 위치한 마침표(.) 문자를 제거합니다.
if(sb.length() >= 16) {
new_id = sb.substring(0, 15);
if(new_id.charAt(14) == '.'){
StringBuffer sbn = new StringBuffer();
sbn.append(new_id);
sbn.deleteCharAt(14);
new_id = sbn.toString();
}
}
System.out.println("6: "+new_id);
//7단계 new_id의 길이가 2자 이하라면, new_id의 마지막 문자를 new_id의 길이가 3이 될 때까지 반복해서 끝에 붙입니다.
if(new_id.length() <= 2){
StringBuffer nsb = new StringBuffer();
nsb.append(new_id);
char end = nsb.charAt(nsb.length()-1);
while (true){
if(nsb.length() == 3) break;
nsb.append(end);
}
new_id = nsb.toString();
}
System.out.println("7: "+new_id);
answer = new_id;
System.out.println("결과 : "+answer);
return answer;
}
} | UTF-8 | Java | 3,273 | java | 신규아이디추천.java | Java | [] | null | [] | package programmers;
// 2021 카카오 코테 기출
public class 신규아이디추천 {
public static void main(String[] args) {
solution("z-+.^.");
}
public static String solution(String new_id) {
String answer = "";
// 1단계 new_id의 모든 대문자를 대응되는 소문자로 치환합니다.
new_id = new_id.toLowerCase();
System.out.println("1: "+new_id);
//2단계 new_id에서 알파벳 소문자, 숫자, 빼기(-), 밑줄(_), 마침표(.)를 제외한 모든 문자를 제거합니다.
StringBuffer sb = new StringBuffer();
sb.append(new_id);
for (int i = 0; i < sb.length(); i++) {
int now = sb.charAt(i);
if((now>=97 && now <=122) || (now>=48 && now<=57) || now == 45 || now == 95 || now == 46) continue;
sb.deleteCharAt(i);
i--;
}
System.out.println("2: "+sb.toString());
//3단계 new_id에서 마침표(.)가 2번 이상 연속된 부분을 하나의 마침표(.)로 치환합니다.
for (int i = 0; i < sb.length(); i++) {
if(sb.charAt(i) == '.'){ // .이면
if(i < sb.length()-1){ // 다음칸이 있을 때 다음칸이 .인지 보기
if(sb.charAt(i+1) == '.'){
sb.deleteCharAt(i+1);
i--;
}
}
}
}
System.out.println("3: "+sb.toString());
//4단계 new_id에서 마침표(.)가 처음이나 끝에 위치한다면 제거합니다.
if(sb.charAt(0) == '.') sb.deleteCharAt(0);
if(sb.length() != 0 && sb.charAt(sb.length()-1) == '.') sb.deleteCharAt(sb.length()-1);
System.out.println("4: "+sb.toString());
//5단계 new_id가 빈 문자열이라면, new_id에 "a"를 대입합니다.
if(sb.length() == 0) sb.append("a");
new_id = sb.toString();
System.out.println("5: "+new_id);
//6단계 new_id의 길이가 16자 이상이면, new_id의 첫 15개의 문자를 제외한 나머지 문자들을 모두 제거합니다.
// 만약 제거 후 마침표(.)가 new_id의 끝에 위치한다면 끝에 위치한 마침표(.) 문자를 제거합니다.
if(sb.length() >= 16) {
new_id = sb.substring(0, 15);
if(new_id.charAt(14) == '.'){
StringBuffer sbn = new StringBuffer();
sbn.append(new_id);
sbn.deleteCharAt(14);
new_id = sbn.toString();
}
}
System.out.println("6: "+new_id);
//7단계 new_id의 길이가 2자 이하라면, new_id의 마지막 문자를 new_id의 길이가 3이 될 때까지 반복해서 끝에 붙입니다.
if(new_id.length() <= 2){
StringBuffer nsb = new StringBuffer();
nsb.append(new_id);
char end = nsb.charAt(nsb.length()-1);
while (true){
if(nsb.length() == 3) break;
nsb.append(end);
}
new_id = nsb.toString();
}
System.out.println("7: "+new_id);
answer = new_id;
System.out.println("결과 : "+answer);
return answer;
}
} | 3,273 | 0.463779 | 0.440845 | 77 | 34.688313 | 22.755196 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.74026 | false | false | 0 |
02c67e7454b5a4af94b57437f25fdfe7703a79f3 | 38,345,468,037,314 | 8687d2d9cc410b0d3614c99c0510c69c9a175421 | /app/src/main/java/com/njdp/njdp_farmer/register_image.java | 4df790a8acccff98cfa63698b89e6625ceb69649 | [] | no_license | hhanchong/NJDP_farmer | https://github.com/hhanchong/NJDP_farmer | 32eff547f5c2f648c4f417f6a0ce78f9366f29f0 | b02e43b531fdeeab429b9101c9bb7f3e4120af78 | refs/heads/master | 2021-01-17T12:36:04.027000 | 2016-07-04T09:21:40 | 2016-07-04T09:21:40 | 57,279,754 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.njdp.njdp_farmer;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.njdp.njdp_farmer.changeDefault.NewClickableSpan;
import com.njdp.njdp_farmer.db.AppConfig;
import com.njdp.njdp_farmer.db.SQLiteHandler;
import com.njdp.njdp_farmer.db.SessionManager;
import com.njdp.njdp_farmer.util.NetUtil;
import com.njdp.njdp_farmer.util.NormalUtil;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import me.nereo.multi_image_selector.MultiImageSelectorActivity;
import okhttp3.Call;
public class register_image extends AppCompatActivity {
private Button finish;
private ImageButton getback;
private com.njdp.njdp_farmer.changeDefault.CircleImageView userImage=null;
private ProgressDialog pDialog;
private String path,temppath;//用户头像路径
private Uri imageUri;
private String Url_Image;
private final int REQUEST_IMAGE=1;
private final int CROP_PHOTO_CODE = 2;
private ArrayList<String> defaultDataArray;
public boolean IsSetImage=false;
private NormalUtil nutil=new NormalUtil();
private static final String TAG = register_image.class.getSimpleName();
private String token;
private String telephone;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//设置沉浸模式
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
setContentView(R.layout.activity_register_image);
//修改
Url_Image=AppConfig.URL_USERINFO_EDIT;
// Progress dialog
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);
// SQLite database handler
//SQLiteHandler db = new SQLiteHandler(getApplicationContext());
TextView notice = (TextView) super.findViewById(R.id.regiser_termsOfService);
TextView setImage = (TextView) super.findViewById(R.id.set_user_image);
this.getback=(ImageButton) super.findViewById(R.id.getback);
this.finish=(Button) super.findViewById(R.id.btn_registerFinish);
assert finish != null;
finish.setEnabled(false);
this.userImage = (com.njdp.njdp_farmer.changeDefault.CircleImageView) super.findViewById(R.id.user_image);
token = getIntent().getStringExtra("token");
telephone = getIntent().getStringExtra("telephone");
IsSetImage = getIntent().getBooleanExtra("IsSetImage", false);
if(token==null&&telephone==null) {
error_hint("程序错误!请联系管理员!");
}
//服务条款
Intent intent = new Intent(this, register_TermsofService.class);
String s1 = "服务条款";
SpannableString span1 = new SpannableString(s1);
String s2 = "隐私协议";
SpannableString span2 = new SpannableString(s2);
ClickableSpan clickableSpan1 = new NewClickableSpan(ContextCompat.getColor(this, R.color.colorDefault), this, intent);
ClickableSpan clickableSpan2 = new NewClickableSpan(ContextCompat.getColor(this, R.color.colorDefault), this, intent);
span1.setSpan(clickableSpan1, 0, s1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
span2.setSpan(clickableSpan2, 0, s2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
assert notice != null;
notice.setText("注册即意味着您同意");
notice.append(span1);
notice.append("和");
notice.append(span2);
notice.setMovementMethod(LinkMovementMethod.getInstance());
//设置Textview超链接高亮背景色为透明色
notice.setHighlightColor(0);
//设置头像本地存储路径
File tempFile;
if(nutil.ExistSDCard()) {
tempFile =Environment.getExternalStorageDirectory();
}else {
tempFile =getCacheDir();
}
path= tempFile.getAbsolutePath()+"/NJDP/" + telephone + "/photo/userimage.png";
temppath = tempFile.getAbsolutePath()+"/NJDP/" + telephone + "/photo/userimage000.png";
if(new File(path).exists()){
userImage.setImageURI(Uri.parse(path));
}
//完成注册
finish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (IsSetImage)
{
//上传头像注册
register_uploadImage(Url_Image, temppath);
}
//默认头像注册
//register_finish(Url);
}
});
//返回上个界面
getback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//弹出图片选择菜单
assert setImage != null;
setImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectImage();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == 1)
return;
switch (requestCode) {
case REQUEST_IMAGE:
if(resultCode == RESULT_OK){
// 获取返回的图片列表
List<String> paths = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
File file=new File(paths.get(0));
imageUri=Uri.fromFile(file);
cropPhoto();
}
break;
case CROP_PHOTO_CODE:
if (null != data)
{
setCropImg(data);
finish.setEnabled(true);
}
break;
default:
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
//选择照片
private void selectImage()
{
Intent intent = new Intent(register_image.this, MultiImageSelectorActivity.class);
// 是否显示调用相机拍照
intent.putExtra(MultiImageSelectorActivity.EXTRA_SHOW_CAMERA, true);
// 设置模式 (支持 单选/MultiImageSelectorActivity.MODE_SINGLE 或者 多选/MultiImageSelectorActivity.MODE_MULTI)
intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_MODE, MultiImageSelectorActivity.MODE_SINGLE);
// 默认选择图片,回填选项(支持String ArrayList)
intent.putStringArrayListExtra(MultiImageSelectorActivity.EXTRA_DEFAULT_SELECTED_LIST, defaultDataArray);
startActivityForResult(intent, REQUEST_IMAGE);
}
//裁剪图片
private void cropPhoto() {
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("crop", "true"); //黑边
intent.putExtra("scaleUpIfNeeded", "true"); //黑边
intent.putExtra("aspectX", 1); //X 方向上的比例
intent.putExtra("aspectY", 1); //Y 方向上的比例
int crop = 200;
intent.putExtra("outputX", crop); //裁剪区的宽
intent.putExtra("outputY", crop); //裁剪区的高
intent.putExtra("scale", true); //是否保留比例
intent.putExtra("return-data", true);
startActivityForResult(intent, CROP_PHOTO_CODE);
}
//保存裁剪的照片
private void setCropImg(Intent picdata) {
Bundle bundle = picdata.getExtras();
if (null != bundle) {
Bitmap mBitmap = bundle.getParcelable("data");
boolean tag= nutil.saveBitmap(register_image.this,telephone, mBitmap);
if(tag)
{
userImage.setImageBitmap(mBitmap);
IsSetImage=true;
}
assert mBitmap != null;
if(!mBitmap.isRecycled()){
mBitmap.recycle(); //记得释放资源,否则会内存溢出
}
}
}
//上传头像
private void register_uploadImage(String url, final String temppath) {
final File fileNew=new File(temppath);
String tag_string_req = "req_edit_image";
pDialog.setMessage("正在上传图片 ...");
showDialog();
if (!fileNew.exists()) {
hideDialog();
Toast.makeText(register_image.this, "头像图片不存在!请重新选择!", Toast.LENGTH_SHORT).show();
} else if (!NetUtil.checkNet(register_image.this)) {
hideDialog();
error_hint("网络连接错误");
} else {
try {
OkHttpUtils.post()
.url(url)
.addParams("token", token)
.addFile("person_photo", "userimage.png", fileNew)
.addHeader("content-disposition", "form-data")
.build()
.execute(new StringCallback() {
@Override
public void onError(Call call, Exception e) {
Log.e(TAG, "3 Connect Error: " + e.getMessage());
hideDialog();
}
@Override
public void onResponse(String response) {
hideDialog();
try {
Log.e(TAG, "UploadImage:" + response);
JSONObject jObj = new JSONObject(response);
int status = jObj.getInt("status");
if (status == 0) {
String msg = jObj.getString("result");
error_hint("保存成功!");
//更新头像文件
File fileOld = new File(path);
if(fileOld.exists()){
fileOld.delete();
}
fileNew.renameTo(fileOld);
Log.e(TAG, "UploadImage response:" + msg);
Intent intent = new Intent(register_image.this, PersonalSet.class);
setResult(RESULT_OK, intent);
finish();
}else if(status == 3){
//密匙失效
error_hint("用户登录过期,请重新登录!");
SessionManager session=new SessionManager(getApplicationContext());
session.setLogin(false, false, "");
Intent intent = new Intent(register_image.this, login.class);
startActivity(intent);
finish();
}
else if(status == 4){
//密匙不存在
error_hint("用户登录过期,请重新登录!");
SessionManager session=new SessionManager(getApplicationContext());
session.setLogin(false, false, "");
Intent intent = new Intent(register_image.this, login.class);
startActivity(intent);
finish();
} else {
error_hint("保存失败!");
String errorMsg = jObj.getString("error_msg");
Log.e(TAG, "1 Json error:response错误:" + errorMsg);
}
} catch (Exception e) {
Log.e(TAG, "2 Json error:response错误: " + e.getMessage());
}
}
});
}
catch (Exception e){
e.printStackTrace();
hideDialog();
}
}
}
//ProgressDialog显示与隐藏
private void showDialog() {
if (!pDialog.isShowing())
pDialog.show();
}
private void hideDialog() {
if (pDialog.isShowing())
pDialog.dismiss();
}
//信息未输入提示
private void empty_hint(int in) {
Toast toast = Toast.makeText(getApplicationContext(), getResources().getString(in), Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, -50);
toast.show();
}
//错误信息提示
private void error_hint(String str) {
Toast toast = Toast.makeText(getApplicationContext(), str, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, -50);
toast.show();
}
@Override
public void onDestroy(){
super.onDestroy();
View view = findViewById(R.id.top_layout);
assert view != null;
view.setBackgroundResource(0); //释放背景图片
userImage.destroyDrawingCache();
userImage.setImageURI(null);
userImage = null;
}
//不跟随系统变化字体大小
@Override
public Resources getResources() {
Resources res = super.getResources();
Configuration config=new Configuration();
config.setToDefaults();
res.updateConfiguration(config, res.getDisplayMetrics());
return res;
}
} | UTF-8 | Java | 15,633 | java | register_image.java | Java | [] | null | [] | package com.njdp.njdp_farmer;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.njdp.njdp_farmer.changeDefault.NewClickableSpan;
import com.njdp.njdp_farmer.db.AppConfig;
import com.njdp.njdp_farmer.db.SQLiteHandler;
import com.njdp.njdp_farmer.db.SessionManager;
import com.njdp.njdp_farmer.util.NetUtil;
import com.njdp.njdp_farmer.util.NormalUtil;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import me.nereo.multi_image_selector.MultiImageSelectorActivity;
import okhttp3.Call;
public class register_image extends AppCompatActivity {
private Button finish;
private ImageButton getback;
private com.njdp.njdp_farmer.changeDefault.CircleImageView userImage=null;
private ProgressDialog pDialog;
private String path,temppath;//用户头像路径
private Uri imageUri;
private String Url_Image;
private final int REQUEST_IMAGE=1;
private final int CROP_PHOTO_CODE = 2;
private ArrayList<String> defaultDataArray;
public boolean IsSetImage=false;
private NormalUtil nutil=new NormalUtil();
private static final String TAG = register_image.class.getSimpleName();
private String token;
private String telephone;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//设置沉浸模式
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
setContentView(R.layout.activity_register_image);
//修改
Url_Image=AppConfig.URL_USERINFO_EDIT;
// Progress dialog
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);
// SQLite database handler
//SQLiteHandler db = new SQLiteHandler(getApplicationContext());
TextView notice = (TextView) super.findViewById(R.id.regiser_termsOfService);
TextView setImage = (TextView) super.findViewById(R.id.set_user_image);
this.getback=(ImageButton) super.findViewById(R.id.getback);
this.finish=(Button) super.findViewById(R.id.btn_registerFinish);
assert finish != null;
finish.setEnabled(false);
this.userImage = (com.njdp.njdp_farmer.changeDefault.CircleImageView) super.findViewById(R.id.user_image);
token = getIntent().getStringExtra("token");
telephone = getIntent().getStringExtra("telephone");
IsSetImage = getIntent().getBooleanExtra("IsSetImage", false);
if(token==null&&telephone==null) {
error_hint("程序错误!请联系管理员!");
}
//服务条款
Intent intent = new Intent(this, register_TermsofService.class);
String s1 = "服务条款";
SpannableString span1 = new SpannableString(s1);
String s2 = "隐私协议";
SpannableString span2 = new SpannableString(s2);
ClickableSpan clickableSpan1 = new NewClickableSpan(ContextCompat.getColor(this, R.color.colorDefault), this, intent);
ClickableSpan clickableSpan2 = new NewClickableSpan(ContextCompat.getColor(this, R.color.colorDefault), this, intent);
span1.setSpan(clickableSpan1, 0, s1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
span2.setSpan(clickableSpan2, 0, s2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
assert notice != null;
notice.setText("注册即意味着您同意");
notice.append(span1);
notice.append("和");
notice.append(span2);
notice.setMovementMethod(LinkMovementMethod.getInstance());
//设置Textview超链接高亮背景色为透明色
notice.setHighlightColor(0);
//设置头像本地存储路径
File tempFile;
if(nutil.ExistSDCard()) {
tempFile =Environment.getExternalStorageDirectory();
}else {
tempFile =getCacheDir();
}
path= tempFile.getAbsolutePath()+"/NJDP/" + telephone + "/photo/userimage.png";
temppath = tempFile.getAbsolutePath()+"/NJDP/" + telephone + "/photo/userimage000.png";
if(new File(path).exists()){
userImage.setImageURI(Uri.parse(path));
}
//完成注册
finish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (IsSetImage)
{
//上传头像注册
register_uploadImage(Url_Image, temppath);
}
//默认头像注册
//register_finish(Url);
}
});
//返回上个界面
getback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//弹出图片选择菜单
assert setImage != null;
setImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectImage();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == 1)
return;
switch (requestCode) {
case REQUEST_IMAGE:
if(resultCode == RESULT_OK){
// 获取返回的图片列表
List<String> paths = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
File file=new File(paths.get(0));
imageUri=Uri.fromFile(file);
cropPhoto();
}
break;
case CROP_PHOTO_CODE:
if (null != data)
{
setCropImg(data);
finish.setEnabled(true);
}
break;
default:
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
//选择照片
private void selectImage()
{
Intent intent = new Intent(register_image.this, MultiImageSelectorActivity.class);
// 是否显示调用相机拍照
intent.putExtra(MultiImageSelectorActivity.EXTRA_SHOW_CAMERA, true);
// 设置模式 (支持 单选/MultiImageSelectorActivity.MODE_SINGLE 或者 多选/MultiImageSelectorActivity.MODE_MULTI)
intent.putExtra(MultiImageSelectorActivity.EXTRA_SELECT_MODE, MultiImageSelectorActivity.MODE_SINGLE);
// 默认选择图片,回填选项(支持String ArrayList)
intent.putStringArrayListExtra(MultiImageSelectorActivity.EXTRA_DEFAULT_SELECTED_LIST, defaultDataArray);
startActivityForResult(intent, REQUEST_IMAGE);
}
//裁剪图片
private void cropPhoto() {
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("crop", "true"); //黑边
intent.putExtra("scaleUpIfNeeded", "true"); //黑边
intent.putExtra("aspectX", 1); //X 方向上的比例
intent.putExtra("aspectY", 1); //Y 方向上的比例
int crop = 200;
intent.putExtra("outputX", crop); //裁剪区的宽
intent.putExtra("outputY", crop); //裁剪区的高
intent.putExtra("scale", true); //是否保留比例
intent.putExtra("return-data", true);
startActivityForResult(intent, CROP_PHOTO_CODE);
}
//保存裁剪的照片
private void setCropImg(Intent picdata) {
Bundle bundle = picdata.getExtras();
if (null != bundle) {
Bitmap mBitmap = bundle.getParcelable("data");
boolean tag= nutil.saveBitmap(register_image.this,telephone, mBitmap);
if(tag)
{
userImage.setImageBitmap(mBitmap);
IsSetImage=true;
}
assert mBitmap != null;
if(!mBitmap.isRecycled()){
mBitmap.recycle(); //记得释放资源,否则会内存溢出
}
}
}
//上传头像
private void register_uploadImage(String url, final String temppath) {
final File fileNew=new File(temppath);
String tag_string_req = "req_edit_image";
pDialog.setMessage("正在上传图片 ...");
showDialog();
if (!fileNew.exists()) {
hideDialog();
Toast.makeText(register_image.this, "头像图片不存在!请重新选择!", Toast.LENGTH_SHORT).show();
} else if (!NetUtil.checkNet(register_image.this)) {
hideDialog();
error_hint("网络连接错误");
} else {
try {
OkHttpUtils.post()
.url(url)
.addParams("token", token)
.addFile("person_photo", "userimage.png", fileNew)
.addHeader("content-disposition", "form-data")
.build()
.execute(new StringCallback() {
@Override
public void onError(Call call, Exception e) {
Log.e(TAG, "3 Connect Error: " + e.getMessage());
hideDialog();
}
@Override
public void onResponse(String response) {
hideDialog();
try {
Log.e(TAG, "UploadImage:" + response);
JSONObject jObj = new JSONObject(response);
int status = jObj.getInt("status");
if (status == 0) {
String msg = jObj.getString("result");
error_hint("保存成功!");
//更新头像文件
File fileOld = new File(path);
if(fileOld.exists()){
fileOld.delete();
}
fileNew.renameTo(fileOld);
Log.e(TAG, "UploadImage response:" + msg);
Intent intent = new Intent(register_image.this, PersonalSet.class);
setResult(RESULT_OK, intent);
finish();
}else if(status == 3){
//密匙失效
error_hint("用户登录过期,请重新登录!");
SessionManager session=new SessionManager(getApplicationContext());
session.setLogin(false, false, "");
Intent intent = new Intent(register_image.this, login.class);
startActivity(intent);
finish();
}
else if(status == 4){
//密匙不存在
error_hint("用户登录过期,请重新登录!");
SessionManager session=new SessionManager(getApplicationContext());
session.setLogin(false, false, "");
Intent intent = new Intent(register_image.this, login.class);
startActivity(intent);
finish();
} else {
error_hint("保存失败!");
String errorMsg = jObj.getString("error_msg");
Log.e(TAG, "1 Json error:response错误:" + errorMsg);
}
} catch (Exception e) {
Log.e(TAG, "2 Json error:response错误: " + e.getMessage());
}
}
});
}
catch (Exception e){
e.printStackTrace();
hideDialog();
}
}
}
//ProgressDialog显示与隐藏
private void showDialog() {
if (!pDialog.isShowing())
pDialog.show();
}
private void hideDialog() {
if (pDialog.isShowing())
pDialog.dismiss();
}
//信息未输入提示
private void empty_hint(int in) {
Toast toast = Toast.makeText(getApplicationContext(), getResources().getString(in), Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, -50);
toast.show();
}
//错误信息提示
private void error_hint(String str) {
Toast toast = Toast.makeText(getApplicationContext(), str, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, -50);
toast.show();
}
@Override
public void onDestroy(){
super.onDestroy();
View view = findViewById(R.id.top_layout);
assert view != null;
view.setBackgroundResource(0); //释放背景图片
userImage.destroyDrawingCache();
userImage.setImageURI(null);
userImage = null;
}
//不跟随系统变化字体大小
@Override
public Resources getResources() {
Resources res = super.getResources();
Configuration config=new Configuration();
config.setToDefaults();
res.updateConfiguration(config, res.getDisplayMetrics());
return res;
}
} | 15,633 | 0.552261 | 0.549122 | 378 | 38.613758 | 26.889723 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.738095 | false | false | 0 |
86ba59ebd185b7520d41afe0f3344139fcd937f3 | 34,892,314,362,973 | 3b510bdba00b80fa537f892d8b8b70f1240c857e | /app/src/main/java/com/fournodes/ud/pranky/PrankDuration.java | 9cf3fd64806ba8a3410f0b244d28aa6bef361ea2 | [] | no_license | usmandurrany/Pranky-5.1 | https://github.com/usmandurrany/Pranky-5.1 | a4a02ba2ad5a4833b5c00a1f166a9e5fad1f0848 | 9a73f3e9ec2d4947c5be38330d3785ca64f53bc3 | refs/heads/master | 2021-01-21T13:04:08.012000 | 2016-05-04T18:09:43 | 2016-05-04T18:09:43 | 45,497,031 | 0 | 1 | null | false | 2015-12-14T19:13:03 | 2015-11-03T21:32:07 | 2015-11-03T21:33:34 | 2015-12-14T19:13:02 | 87,353 | 0 | 1 | 0 | Java | null | null | package com.fournodes.ud.pranky;
import android.app.Activity;
import android.content.Context;
import java.util.Locale;
import antistatic.spinnerwheel.AbstractWheel;
import antistatic.spinnerwheel.adapters.ArrayWheelAdapter;
/**
* Created by Usman on 26/2/2016.
*/
public class PrankDuration extends Activity {
private ArrayWheelAdapter<String> durationAdapter;
private AbstractWheel duration;
public void setDurationWheel(Context context, AbstractWheel duration, int durInMillis) {
this.duration = duration;
int i;
int durInSec = durInMillis / 1000;
int firstVal = ((int) Math.ceil((double) durInSec / 5)) * 5;
String[] values = new String[((60 - firstVal) / 5) + 1];
values[0] = String.format(Locale.US, "%02d", firstVal);
for (i = 1; i < values.length; i++) {
values[i] = String.format(Locale.US, "%02d", Integer.parseInt(values[i - 1]) + 5);
}
durationAdapter = new ArrayWheelAdapter<>(context, values);
//NumericWheelAdapter durationAdapter = new NumericWheelAdapter(ClockDialogActivity.this, 0, 60,"%02d");
durationAdapter.setItemResource(R.layout.wheel_item_duration);
durationAdapter.setItemTextResource(R.id.wheel_item);
duration.setViewAdapter(durationAdapter);
}
public int getDuration() {
return Integer.parseInt(String.valueOf(durationAdapter.getItemText(duration.getCurrentItem())));
}
}
| UTF-8 | Java | 1,460 | java | PrankDuration.java | Java | [
{
"context": "eel.adapters.ArrayWheelAdapter;\n\n/**\n * Created by Usman on 26/2/2016.\n */\npublic class PrankDuration exte",
"end": 251,
"score": 0.9785876274108887,
"start": 246,
"tag": "NAME",
"value": "Usman"
}
] | null | [] | package com.fournodes.ud.pranky;
import android.app.Activity;
import android.content.Context;
import java.util.Locale;
import antistatic.spinnerwheel.AbstractWheel;
import antistatic.spinnerwheel.adapters.ArrayWheelAdapter;
/**
* Created by Usman on 26/2/2016.
*/
public class PrankDuration extends Activity {
private ArrayWheelAdapter<String> durationAdapter;
private AbstractWheel duration;
public void setDurationWheel(Context context, AbstractWheel duration, int durInMillis) {
this.duration = duration;
int i;
int durInSec = durInMillis / 1000;
int firstVal = ((int) Math.ceil((double) durInSec / 5)) * 5;
String[] values = new String[((60 - firstVal) / 5) + 1];
values[0] = String.format(Locale.US, "%02d", firstVal);
for (i = 1; i < values.length; i++) {
values[i] = String.format(Locale.US, "%02d", Integer.parseInt(values[i - 1]) + 5);
}
durationAdapter = new ArrayWheelAdapter<>(context, values);
//NumericWheelAdapter durationAdapter = new NumericWheelAdapter(ClockDialogActivity.this, 0, 60,"%02d");
durationAdapter.setItemResource(R.layout.wheel_item_duration);
durationAdapter.setItemTextResource(R.id.wheel_item);
duration.setViewAdapter(durationAdapter);
}
public int getDuration() {
return Integer.parseInt(String.valueOf(durationAdapter.getItemText(duration.getCurrentItem())));
}
}
| 1,460 | 0.689041 | 0.668493 | 41 | 34.609756 | 31.953379 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.804878 | false | false | 0 |
47b97eecb28a3827330051e9d154f02fb1857622 | 36,782,099,954,089 | 4c0a5583376643f07d303f10e76001bb9912fa91 | /src/com/javarush/test/level20/lesson10/home06/Solution.java | 7658309968bed17634e742e21eabcc2648f8a5d5 | [] | no_license | gnoomqw6/JRHW | https://github.com/gnoomqw6/JRHW | 449750767188d0e1dd652101570f9e9e70022744 | ba13186347e963225f083fa6d2f3cd507df23d00 | refs/heads/master | 2021-01-10T10:47:34.096000 | 2016-03-18T10:46:56 | 2016-03-18T10:46:56 | 52,708,190 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //package com.javarush.test.level20.lesson10.home06;
//
//import java.io.*;
//
///* Запрет сериализации
//Запретите сериализацию класса SubSolution используя NotSerializableException.
//Сигнатуры классов менять нельзя
//*/
//public class Solution implements Serializable {
// public static class SubSolution extends Solution {
// private void writeObject(ObjectOutputStream out) throws NotSerializableException {
// throw new NotSerializableException();
// }
// private void readObject(ObjectInputStream in) throws NotSerializableException {
// throw new NotSerializableException();
// }
// }
//}
| UTF-8 | Java | 735 | java | Solution.java | Java | [] | null | [] | //package com.javarush.test.level20.lesson10.home06;
//
//import java.io.*;
//
///* Запрет сериализации
//Запретите сериализацию класса SubSolution используя NotSerializableException.
//Сигнатуры классов менять нельзя
//*/
//public class Solution implements Serializable {
// public static class SubSolution extends Solution {
// private void writeObject(ObjectOutputStream out) throws NotSerializableException {
// throw new NotSerializableException();
// }
// private void readObject(ObjectInputStream in) throws NotSerializableException {
// throw new NotSerializableException();
// }
// }
//}
| 735 | 0.709035 | 0.699847 | 18 | 35.277779 | 29.830643 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false | 0 |
cbe7557f5d103ce796cf201becd7b234c33d62e4 | 38,491,496,933,767 | c937499de9dd07c3908bedfc5a2bd5bef8e0f2ec | /src/DataStructure_LinkedList/Main.java | 2783171c7a94538128f9c349c2e27984e1a9b669 | [] | no_license | LimingTeng/Java | https://github.com/LimingTeng/Java | 8174603c3e7e9de2302e50b9af96811e55f287a2 | 21305a5cb521ed1242a4487aebdd4f43bd41d7a2 | refs/heads/master | 2020-04-28T23:43:08.866000 | 2019-05-08T23:43:26 | 2019-05-08T23:43:26 | 175,666,953 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package DataStructure_LinkedList;
import java.util.ArrayList;
/**
* Created by LynnTeng on 2019/4/15.
*/
public class Main {
public static void main(String[] args) {
Customer customer = new Customer("Lydia", 100.00);
Customer anotherCustomer;
/*
* Java was assigning the second customer class to point to the first class.
* It just save the memory address. It didn't create a separate class
* */
anotherCustomer = customer;
anotherCustomer.setBalance(150.00);
System.out.println("Balance for customer " + customer.getName() + " is " + customer.getBalance());
// Difference with ArrayList: ArrayList can only insert to the position queried
ArrayList<Integer> intList = new ArrayList<Integer>();
intList.add(1);
intList.add(3);
intList.add(4);
System.out.println("Original ArrayList:\n");
for (int i = 0; i < intList.size(); i++) {
System.out.println(i + ": " + intList.get(i));
}
intList.add(1, 2);
System.out.println("Update Added ArrayList:\n");
for (int i = 0; i < intList.size(); i++) {
System.out.println(i + ": " + intList.get(i));
}
}
}
| UTF-8 | Java | 1,250 | java | Main.java | Java | [
{
"context": "t;\n\nimport java.util.ArrayList;\n\n/**\n * Created by LynnTeng on 2019/4/15.\n */\npublic class Main {\n public ",
"end": 90,
"score": 0.7024157643318176,
"start": 82,
"tag": "NAME",
"value": "LynnTeng"
},
{
"context": "args) {\n Customer customer = new Cust... | null | [] | package DataStructure_LinkedList;
import java.util.ArrayList;
/**
* Created by LynnTeng on 2019/4/15.
*/
public class Main {
public static void main(String[] args) {
Customer customer = new Customer("Lydia", 100.00);
Customer anotherCustomer;
/*
* Java was assigning the second customer class to point to the first class.
* It just save the memory address. It didn't create a separate class
* */
anotherCustomer = customer;
anotherCustomer.setBalance(150.00);
System.out.println("Balance for customer " + customer.getName() + " is " + customer.getBalance());
// Difference with ArrayList: ArrayList can only insert to the position queried
ArrayList<Integer> intList = new ArrayList<Integer>();
intList.add(1);
intList.add(3);
intList.add(4);
System.out.println("Original ArrayList:\n");
for (int i = 0; i < intList.size(); i++) {
System.out.println(i + ": " + intList.get(i));
}
intList.add(1, 2);
System.out.println("Update Added ArrayList:\n");
for (int i = 0; i < intList.size(); i++) {
System.out.println(i + ": " + intList.get(i));
}
}
}
| 1,250 | 0.592 | 0.5728 | 37 | 32.783783 | 27.883091 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.594595 | false | false | 0 |
79e9065034500e4d503102cc179f81d8a7fe6fae | 35,880,156,829,350 | e6dcf09b712abf907bbb66e56c28c576ab3a9c1d | /src/main/java/com/trendsmixed/fma/module/loss/LossRepository.java | 91f4130ffdc0e529987969e46e7ac4a3a2d43c1b | [] | no_license | thilina01/file-manager-api | https://github.com/thilina01/file-manager-api | ddd226442a5ca625639e65808cffb02fe9c4c26d | e561712e252c96d895e5af5d5aa3a8d0f1133822 | refs/heads/master | 2022-03-08T20:48:21.332000 | 2021-10-12T06:54:50 | 2021-10-12T06:54:50 | 65,264,760 | 3 | 1 | null | false | 2021-11-16T03:55:50 | 2016-08-09T05:10:02 | 2021-11-16T03:54:38 | 2021-11-16T03:55:49 | 2,164 | 3 | 1 | 4 | Java | false | false | package com.trendsmixed.fma.module.loss;
import org.springframework.data.jpa.repository.JpaRepository;
public interface LossRepository extends JpaRepository<Loss, Integer> {
}
| UTF-8 | Java | 179 | java | LossRepository.java | Java | [] | null | [] | package com.trendsmixed.fma.module.loss;
import org.springframework.data.jpa.repository.JpaRepository;
public interface LossRepository extends JpaRepository<Loss, Integer> {
}
| 179 | 0.826816 | 0.826816 | 7 | 24.571428 | 29.266544 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 0 |
a3edfc6f1826b7a81b6cb24ba65d7dc294cea90b | 15,161,234,620,852 | 3bf5cb72e6d2ee860624609b3098eb77f37f1e42 | /app/src/main/java/com/example/bingo/FruitAdapter.java | c0c82d80e1ac9a692459a7fde93c86b2275f94e9 | [
"Apache-2.0"
] | permissive | bingo1118/GoodWeaher | https://github.com/bingo1118/GoodWeaher | 575f110818f06138d1c91fe16167bc0cb601d77b | a69391c2c1cd6abe532305706af9310b154957e9 | refs/heads/master | 2021-01-12T05:22:58.653000 | 2017-01-04T07:26:35 | 2017-01-04T07:26:35 | 77,916,478 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.bingo;
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2016/12/18.
*/
public class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder> {
private Context mContext;
private List<Fruit> list;
static class ViewHolder extends RecyclerView.ViewHolder{
CardView cardView;
ImageView imageView;
TextView textView;
public ViewHolder(View view){
super(view);
cardView=(CardView)view;
imageView=(ImageView)view.findViewById(R.id.fruit_image);
textView=(TextView)view.findViewById(R.id.fruit_name);
}
}
public FruitAdapter(List<Fruit> list){
this.list=list;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if(mContext==null){
mContext=parent.getContext();
}
View view= LayoutInflater.from(mContext).inflate(R.layout.fruit_item,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Fruit fruit=list.get(position);
holder.textView.setText(fruit.getName());
Glide.with(mContext).load(fruit.getImageID()).into(holder.imageView);
}
@Override
public int getItemCount() {
return list.size();
}
}
| UTF-8 | Java | 1,704 | java | FruitAdapter.java | Java | [] | null | [] | package com.example.bingo;
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2016/12/18.
*/
public class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder> {
private Context mContext;
private List<Fruit> list;
static class ViewHolder extends RecyclerView.ViewHolder{
CardView cardView;
ImageView imageView;
TextView textView;
public ViewHolder(View view){
super(view);
cardView=(CardView)view;
imageView=(ImageView)view.findViewById(R.id.fruit_image);
textView=(TextView)view.findViewById(R.id.fruit_name);
}
}
public FruitAdapter(List<Fruit> list){
this.list=list;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if(mContext==null){
mContext=parent.getContext();
}
View view= LayoutInflater.from(mContext).inflate(R.layout.fruit_item,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Fruit fruit=list.get(position);
holder.textView.setText(fruit.getName());
Glide.with(mContext).load(fruit.getImageID()).into(holder.imageView);
}
@Override
public int getItemCount() {
return list.size();
}
}
| 1,704 | 0.687793 | 0.681925 | 59 | 27.881355 | 23.04166 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.559322 | false | false | 0 |
6a8f0350d81302feff79b9a374971a7348655d5e | 39,230,231,286,990 | 6f39dc1ac142e5883f9fc8f545a67d061ddc0704 | /src/main/java/com/briup/apps/poll/service/IGradeService.java | 521750ddbfea8115887f45070c2c43ad6e154335 | [] | no_license | wangjinghui321/poll3 | https://github.com/wangjinghui321/poll3 | 346326dcdb71d716fb3d2a21fd9e0e58033fe794 | d73d7d0bc746a455e64c0b7e15c10100d92f98e5 | refs/heads/master | 2020-03-21T12:53:19.835000 | 2018-07-06T00:28:07 | 2018-07-06T00:28:07 | 138,576,686 | 7 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.briup.apps.poll.service;
import java.util.List;
import com.briup.apps.poll.bean.Grade;
public interface IGradeService {
List<Grade> findAllGrade() throws Exception;
Grade findById(long id) throws Exception;
List<Grade> query(String keywords) throws Exception;
void saveOrupdate(Grade grade) throws Exception;
void deleteById(long id) throws Exception;
void batchDelete(List<Long> ids) throws Exception;
}
| UTF-8 | Java | 440 | java | IGradeService.java | Java | [] | null | [] | package com.briup.apps.poll.service;
import java.util.List;
import com.briup.apps.poll.bean.Grade;
public interface IGradeService {
List<Grade> findAllGrade() throws Exception;
Grade findById(long id) throws Exception;
List<Grade> query(String keywords) throws Exception;
void saveOrupdate(Grade grade) throws Exception;
void deleteById(long id) throws Exception;
void batchDelete(List<Long> ids) throws Exception;
}
| 440 | 0.765909 | 0.765909 | 14 | 29.428572 | 19.952494 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.071429 | false | false | 0 |
a7abc1724b9170d039892d9ba75d42317122bd05 | 22,179,211,176,933 | a4cc724a3fb43d43ed3c1a4341374e43d8185c86 | /client/src/com/commune/client/UserListWindowController.java | 84febc6604e671c028d42353d7954e48f04174ac | [] | no_license | driver1998/Commune | https://github.com/driver1998/Commune | 565cfe1a74fb82e55890a6ea02597cda6000d4ac | b75b9cea20c839eb69c7d8849553f78994e634c8 | refs/heads/master | 2021-05-07T17:03:20.948000 | 2017-11-03T06:42:05 | 2017-11-03T06:42:05 | 108,639,087 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.commune.client;
import com.commune.model.User;
import com.commune.stream.BuddyListOperations;
import com.commune.stream.Presence;
import com.sun.javafx.scene.control.skin.LabeledText;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Side;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import java.io.IOException;
import java.net.URL;
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.UUID;
public class UserListWindowController implements Initializable, WindowController{
@FXML
Label usernameLabel;
@FXML
ListView<User> userListView;
@FXML
Button menuButton;
private ContextMenu mainMenu;
private ContextMenu contextMenu;
private Stage stage;
private Scene scene;
public void setScene(Scene scene) {
this.scene = scene;
}
public void setStage(Stage stage) {
this.stage = stage;
}
public Stage getStage() {
return stage;
}
public Scene getScene() {
return scene;
}
private EventHandler<WindowEvent> UserListWindowCloseEventHandler = (event) -> {
App.WindowControllers.remove(App.CONTROLLER_USER_LIST_WINDOW);
Presence presence = new Presence(App.CurrentUser, null, Presence.TYPE_UNAVAILABLE);
synchronized (App.ElementSendQueue) {
App.ElementSendQueue.add(presence);
App.ElementSendQueue.notify();
}
};
private EventHandler<ActionEvent> AddFriendMenuItemActionEventHandler = (event) -> {
AddFriendWindowController.newAddFriendWindow(getClass());
};
private EventHandler<ActionEvent> AboutMenuItemActionEventHandler = (event) -> {
Alert alert = new Alert(Alert.AlertType.INFORMATION, "Project Commune\nVersion 1.0 (Build 20171025)");
alert.showAndWait();
};
private EventHandler<ActionEvent> DeleteFriendMenuItemActionEventHandler = (event) -> {
User currentItemSelected = userListView.getSelectionModel().getSelectedItem();
if (currentItemSelected != null) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "真的要删除 " + currentItemSelected.getName() + " 吗?", ButtonType.YES, ButtonType.NO);
Optional<ButtonType> result = alert.showAndWait();
if (result.isPresent() && result.get().equals(ButtonType.YES)) {
Presence presence = new Presence(App.CurrentUser, currentItemSelected, Presence.TYPE_UNSUBSCRIBE);
synchronized (App.ElementSendQueue) {
App.ElementSendQueue.add(presence);
App.ElementSendQueue.notify();
}
App.UserList.remove(currentItemSelected);
}
}
};
private EventHandler<ActionEvent> SendMessageMenuItemActionEventHandler = (event) -> {
User currentItemSelected = userListView.getSelectionModel().getSelectedItem();
if (currentItemSelected != null) {
callSendMessage(currentItemSelected);
}
};
private class UserListCell extends ListCell<User> {
@Override
protected void updateItem(User item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
VBox vbox = new VBox();
Label usernameLabel = new Label(item.getName());
Label statusLabel = new Label(item.isOnline()? "在线" : "离线");
vbox.getChildren().addAll(usernameLabel, statusLabel);
setGraphic(vbox);
} else {
setGraphic(null);
}
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {
userListView.setCellFactory((ListView<User> user) -> new UserListCell());
userListView.setItems(App.UserList);
usernameLabel.setText(App.CurrentUser.getName());
//主菜单
mainMenu = new ContextMenu();
MenuItem addFriendItem = new MenuItem("添加好友");
addFriendItem.setOnAction(AddFriendMenuItemActionEventHandler);
MenuItem aboutMenuItem = new MenuItem("关于");
aboutMenuItem.setOnAction(AboutMenuItemActionEventHandler);
SeparatorMenuItem separatorMenuItem = new SeparatorMenuItem();
mainMenu.getItems().addAll(addFriendItem, separatorMenuItem, aboutMenuItem);
//右键菜单
contextMenu = new ContextMenu();
MenuItem deleteFriendItem = new MenuItem("删除好友");
deleteFriendItem.setOnAction(DeleteFriendMenuItemActionEventHandler);
MenuItem sendMessageItem = new MenuItem("发送消息");
sendMessageItem.setOnAction(SendMessageMenuItemActionEventHandler);
contextMenu.getItems().addAll(sendMessageItem, deleteFriendItem);
//发送获取好友列表请求
String id = UUID.randomUUID().toString();
BuddyListOperations query =
new BuddyListOperations(App.CurrentUser, null, id,
BuddyListOperations.OPERATION_NS_QUERY, null);
synchronized (App.RequestIDs) {
App.RequestIDs.add(id);
App.RequestIDs.notify();
}
synchronized (App.ElementSendQueue) {
App.ElementSendQueue.add(query);
App.ElementSendQueue.notify();
}
}
@FXML
void handleMenuButtonAction(ActionEvent event) {
mainMenu.show(menuButton, Side.TOP, 0, 0);
}
@FXML
void handleUserListViewClick(MouseEvent event) {
User currentItemSelected = userListView.getSelectionModel().getSelectedItem();
Object target = event.getTarget();
if (currentItemSelected != null) {
//ListCell里就这两个组件
//所以这么判断相当于判断点击的是否为ListCell
if (target instanceof VBox || target instanceof LabeledText) {
//鼠标左键双击
if (event.getClickCount() == 2 && event.getButton() == MouseButton.PRIMARY) {
callSendMessage(currentItemSelected);
} else if (event.getButton() == MouseButton.SECONDARY) {
//鼠标右键单击
contextMenu.show(userListView, event.getScreenX(), event.getScreenY());
return; //不然右键菜单又隐藏了
}
}
}
contextMenu.hide();
}
//打开消息窗口
private void callSendMessage(User user) {
if (App.WindowControllers.containsKey("USER_" + user.getName())) {
WindowController controller = App.WindowControllers.get("USER_" + user.getName());
controller.getStage().show();
controller.getStage().requestFocus();
} else {
ChatWindowController.newChatWindow(getClass(), user);
}
}
static UserListWindowController newUserListWindow(Class c) {
try {
Stage stage = new Stage();
FXMLLoader fxmlLoader = new FXMLLoader(c.getResource("UserListWindow.fxml"));
Parent root = fxmlLoader.load();
Scene scene = new Scene(root, 300, 600);
stage.setScene(scene);
UserListWindowController controller = fxmlLoader.getController();
controller.setScene(scene);
controller.setStage(stage);
App.WindowControllers.put(App.CONTROLLER_USER_LIST_WINDOW, controller);
stage.setMaxWidth(300);
stage.setMinWidth(300);
stage.setOnCloseRequest(controller.UserListWindowCloseEventHandler);
stage.show();
return controller;
} catch (IOException e) {
e.printStackTrace();
App.WindowControllers.remove(App.CONTROLLER_ADD_FRIEND_WINDOW);
return null;
}
}
}
| UTF-8 | Java | 8,473 | java | UserListWindowController.java | Java | [] | null | [] | package com.commune.client;
import com.commune.model.User;
import com.commune.stream.BuddyListOperations;
import com.commune.stream.Presence;
import com.sun.javafx.scene.control.skin.LabeledText;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Side;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import java.io.IOException;
import java.net.URL;
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.UUID;
public class UserListWindowController implements Initializable, WindowController{
@FXML
Label usernameLabel;
@FXML
ListView<User> userListView;
@FXML
Button menuButton;
private ContextMenu mainMenu;
private ContextMenu contextMenu;
private Stage stage;
private Scene scene;
public void setScene(Scene scene) {
this.scene = scene;
}
public void setStage(Stage stage) {
this.stage = stage;
}
public Stage getStage() {
return stage;
}
public Scene getScene() {
return scene;
}
private EventHandler<WindowEvent> UserListWindowCloseEventHandler = (event) -> {
App.WindowControllers.remove(App.CONTROLLER_USER_LIST_WINDOW);
Presence presence = new Presence(App.CurrentUser, null, Presence.TYPE_UNAVAILABLE);
synchronized (App.ElementSendQueue) {
App.ElementSendQueue.add(presence);
App.ElementSendQueue.notify();
}
};
private EventHandler<ActionEvent> AddFriendMenuItemActionEventHandler = (event) -> {
AddFriendWindowController.newAddFriendWindow(getClass());
};
private EventHandler<ActionEvent> AboutMenuItemActionEventHandler = (event) -> {
Alert alert = new Alert(Alert.AlertType.INFORMATION, "Project Commune\nVersion 1.0 (Build 20171025)");
alert.showAndWait();
};
private EventHandler<ActionEvent> DeleteFriendMenuItemActionEventHandler = (event) -> {
User currentItemSelected = userListView.getSelectionModel().getSelectedItem();
if (currentItemSelected != null) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "真的要删除 " + currentItemSelected.getName() + " 吗?", ButtonType.YES, ButtonType.NO);
Optional<ButtonType> result = alert.showAndWait();
if (result.isPresent() && result.get().equals(ButtonType.YES)) {
Presence presence = new Presence(App.CurrentUser, currentItemSelected, Presence.TYPE_UNSUBSCRIBE);
synchronized (App.ElementSendQueue) {
App.ElementSendQueue.add(presence);
App.ElementSendQueue.notify();
}
App.UserList.remove(currentItemSelected);
}
}
};
private EventHandler<ActionEvent> SendMessageMenuItemActionEventHandler = (event) -> {
User currentItemSelected = userListView.getSelectionModel().getSelectedItem();
if (currentItemSelected != null) {
callSendMessage(currentItemSelected);
}
};
private class UserListCell extends ListCell<User> {
@Override
protected void updateItem(User item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
VBox vbox = new VBox();
Label usernameLabel = new Label(item.getName());
Label statusLabel = new Label(item.isOnline()? "在线" : "离线");
vbox.getChildren().addAll(usernameLabel, statusLabel);
setGraphic(vbox);
} else {
setGraphic(null);
}
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {
userListView.setCellFactory((ListView<User> user) -> new UserListCell());
userListView.setItems(App.UserList);
usernameLabel.setText(App.CurrentUser.getName());
//主菜单
mainMenu = new ContextMenu();
MenuItem addFriendItem = new MenuItem("添加好友");
addFriendItem.setOnAction(AddFriendMenuItemActionEventHandler);
MenuItem aboutMenuItem = new MenuItem("关于");
aboutMenuItem.setOnAction(AboutMenuItemActionEventHandler);
SeparatorMenuItem separatorMenuItem = new SeparatorMenuItem();
mainMenu.getItems().addAll(addFriendItem, separatorMenuItem, aboutMenuItem);
//右键菜单
contextMenu = new ContextMenu();
MenuItem deleteFriendItem = new MenuItem("删除好友");
deleteFriendItem.setOnAction(DeleteFriendMenuItemActionEventHandler);
MenuItem sendMessageItem = new MenuItem("发送消息");
sendMessageItem.setOnAction(SendMessageMenuItemActionEventHandler);
contextMenu.getItems().addAll(sendMessageItem, deleteFriendItem);
//发送获取好友列表请求
String id = UUID.randomUUID().toString();
BuddyListOperations query =
new BuddyListOperations(App.CurrentUser, null, id,
BuddyListOperations.OPERATION_NS_QUERY, null);
synchronized (App.RequestIDs) {
App.RequestIDs.add(id);
App.RequestIDs.notify();
}
synchronized (App.ElementSendQueue) {
App.ElementSendQueue.add(query);
App.ElementSendQueue.notify();
}
}
@FXML
void handleMenuButtonAction(ActionEvent event) {
mainMenu.show(menuButton, Side.TOP, 0, 0);
}
@FXML
void handleUserListViewClick(MouseEvent event) {
User currentItemSelected = userListView.getSelectionModel().getSelectedItem();
Object target = event.getTarget();
if (currentItemSelected != null) {
//ListCell里就这两个组件
//所以这么判断相当于判断点击的是否为ListCell
if (target instanceof VBox || target instanceof LabeledText) {
//鼠标左键双击
if (event.getClickCount() == 2 && event.getButton() == MouseButton.PRIMARY) {
callSendMessage(currentItemSelected);
} else if (event.getButton() == MouseButton.SECONDARY) {
//鼠标右键单击
contextMenu.show(userListView, event.getScreenX(), event.getScreenY());
return; //不然右键菜单又隐藏了
}
}
}
contextMenu.hide();
}
//打开消息窗口
private void callSendMessage(User user) {
if (App.WindowControllers.containsKey("USER_" + user.getName())) {
WindowController controller = App.WindowControllers.get("USER_" + user.getName());
controller.getStage().show();
controller.getStage().requestFocus();
} else {
ChatWindowController.newChatWindow(getClass(), user);
}
}
static UserListWindowController newUserListWindow(Class c) {
try {
Stage stage = new Stage();
FXMLLoader fxmlLoader = new FXMLLoader(c.getResource("UserListWindow.fxml"));
Parent root = fxmlLoader.load();
Scene scene = new Scene(root, 300, 600);
stage.setScene(scene);
UserListWindowController controller = fxmlLoader.getController();
controller.setScene(scene);
controller.setStage(stage);
App.WindowControllers.put(App.CONTROLLER_USER_LIST_WINDOW, controller);
stage.setMaxWidth(300);
stage.setMinWidth(300);
stage.setOnCloseRequest(controller.UserListWindowCloseEventHandler);
stage.show();
return controller;
} catch (IOException e) {
e.printStackTrace();
App.WindowControllers.remove(App.CONTROLLER_ADD_FRIEND_WINDOW);
return null;
}
}
}
| 8,473 | 0.627278 | 0.624261 | 228 | 34.337719 | 28.750668 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.640351 | false | false | 0 |
51834d984476e0fe2b2f2037fd9abc50c53421ec | 19,542,101,201,927 | 54ef9d754527c9c4a08ddd675c628eb5849a77e2 | /src/br/com/caelum/formulariocaelum/task/EnviaAlunosTask.java | b5d3a74acc8846b4ef0941a0b9734256d77eb822 | [] | no_license | caseca/formulariocaelum | https://github.com/caseca/formulariocaelum | 876656dd2cc7ac19796678ebc3ad3b412f157974 | 0e36749c8714ae43fc0a04ca565b7890c1e23bce | refs/heads/master | 2020-06-13T22:33:32.716000 | 2014-03-19T00:36:44 | 2014-03-19T00:36:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.caelum.formulariocaelum.task;
import java.util.List;
import br.com.caelum.formulariocaelum.R;
import br.com.caelum.formulariocaelum.business.AlunoBusiness;
import br.com.caelum.formulariocaelum.utils.converter.AlunoConverter;
import br.com.caelum.formulariocaelum.vos.AlunoVO;
import br.com.caelum.formulariocaelum.web.WebClient;
import com.google.inject.Inject;
import roboguice.inject.InjectResource;
import roboguice.util.RoboAsyncTask;
import android.app.ProgressDialog;
import android.content.Context;
import android.widget.Toast;
public class EnviaAlunosTask extends RoboAsyncTask<String> {
@Inject
private AlunoBusiness alunoBusiness;
@Inject
private WebClient webClient;
private Context context;
@InjectResource(R.string.msgEnviandoAlunos)
private String msgEnviandoAlunos;
@InjectResource(R.string.msgEnvioPelaWeb)
private String msgEnvioPelaWeb;
private ProgressDialog progress;
@Inject
private AlunoConverter alunoConverter;
@Inject
protected EnviaAlunosTask(Context context) {
super(context);
this.context = context;
}
@Override
public String call() throws Exception {
List<AlunoVO> alunos = this.alunoBusiness.getList();
String alunosJson = this.alunoConverter.toJSON(alunos);
return this.webClient.post(alunosJson);
}
@Override
protected void onSuccess(String t) throws Exception {
super.onSuccess(t);
stopProgressDialog();
Toast.makeText(this.context, R.string.msgAlunosEnviadosComSucesso, Toast.LENGTH_SHORT).show();
}
@Override
protected void onException(Exception e) throws RuntimeException {
super.onException(e);
stopProgressDialog();
Toast.makeText(this.context, R.string.msgErroNoEnvioDeAlunos, Toast.LENGTH_SHORT).show();
}
@Override
protected void onPreExecute() throws Exception {
super.onPreExecute();
this.progress = ProgressDialog.show(this.context, this.msgEnviandoAlunos, this.msgEnvioPelaWeb, true, true);
}
protected void stopProgressDialog() {
this.progress.dismiss();
}
}
| UTF-8 | Java | 2,009 | java | EnviaAlunosTask.java | Java | [] | null | [] | package br.com.caelum.formulariocaelum.task;
import java.util.List;
import br.com.caelum.formulariocaelum.R;
import br.com.caelum.formulariocaelum.business.AlunoBusiness;
import br.com.caelum.formulariocaelum.utils.converter.AlunoConverter;
import br.com.caelum.formulariocaelum.vos.AlunoVO;
import br.com.caelum.formulariocaelum.web.WebClient;
import com.google.inject.Inject;
import roboguice.inject.InjectResource;
import roboguice.util.RoboAsyncTask;
import android.app.ProgressDialog;
import android.content.Context;
import android.widget.Toast;
public class EnviaAlunosTask extends RoboAsyncTask<String> {
@Inject
private AlunoBusiness alunoBusiness;
@Inject
private WebClient webClient;
private Context context;
@InjectResource(R.string.msgEnviandoAlunos)
private String msgEnviandoAlunos;
@InjectResource(R.string.msgEnvioPelaWeb)
private String msgEnvioPelaWeb;
private ProgressDialog progress;
@Inject
private AlunoConverter alunoConverter;
@Inject
protected EnviaAlunosTask(Context context) {
super(context);
this.context = context;
}
@Override
public String call() throws Exception {
List<AlunoVO> alunos = this.alunoBusiness.getList();
String alunosJson = this.alunoConverter.toJSON(alunos);
return this.webClient.post(alunosJson);
}
@Override
protected void onSuccess(String t) throws Exception {
super.onSuccess(t);
stopProgressDialog();
Toast.makeText(this.context, R.string.msgAlunosEnviadosComSucesso, Toast.LENGTH_SHORT).show();
}
@Override
protected void onException(Exception e) throws RuntimeException {
super.onException(e);
stopProgressDialog();
Toast.makeText(this.context, R.string.msgErroNoEnvioDeAlunos, Toast.LENGTH_SHORT).show();
}
@Override
protected void onPreExecute() throws Exception {
super.onPreExecute();
this.progress = ProgressDialog.show(this.context, this.msgEnviandoAlunos, this.msgEnvioPelaWeb, true, true);
}
protected void stopProgressDialog() {
this.progress.dismiss();
}
}
| 2,009 | 0.78895 | 0.78895 | 77 | 25.09091 | 24.947832 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.441558 | false | false | 0 |
d4c050ce0b65dd35905f91c76db4b348dacee341 | 14,147,622,329,475 | 24ca3741a2716273bc5858bb53ff0f80562ed382 | /gcrm-base/gcrm-sys-provider/src/main/java/com/good/sys/service/SyncServiceImpl.java | b22c068826dd46d1acf9f728420d8995f7ab7c1c | [] | no_license | plainww/crm-base | https://github.com/plainww/crm-base | 4a037434ad44c1d12141efa243e6c196f2501bb5 | c4d601aa05ecc3158069ded17315ede56ecf491f | refs/heads/master | 2018-10-22T16:40:30.440000 | 2018-09-29T03:00:54 | 2018-09-29T03:00:54 | 131,933,428 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.good.sys.service;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.good.monitor.bean.BaseInfoAppPo;
import com.good.monitor.service.BaseInfoService;
import com.good.sys.Constants;
import com.good.sys.MsgConstants;
import com.good.sys.ServiceException;
import com.good.sys.security.SecurityMetadataService;
/**
* 同步服务
*
*/
@Service
public class SyncServiceImpl implements SyncService {
private static Logger logger = LoggerFactory.getLogger(SyncServiceImpl.class);
@Autowired
private SecurityMetadataService metadata;
@Autowired
private RedisTemplate<String, ?> redisTemplate;
@Autowired
private BaseInfoService baseInfoService;
@Autowired
private AuditLogService logService;
/**
* 同步权限配置
*/
public void syncAuthMeta() {
metadata.loadResourceDefine();
}
/**
* 注册
*
* @throws ServiceException
*/
//@PostConstruct
public void register() throws ServiceException {
HashOperations<String, String, BaseInfoAppPo> op = redisTemplate.opsForHash();
try {
BaseInfoAppPo baseInfo = baseInfoService.getBaseInfo();
op.put(Constants.REDIS_REGISTER_MAP, baseInfo.getMachineIp() + ":" + baseInfo.getServicePort(), baseInfo);
logger.info("Register machine ({}:{}) successfully.", baseInfo.getMachineIp(), baseInfo.getServicePort());
} catch (ServiceException e) {
logger.error(MsgConstants.E0000, e);
throw e;
}
}
}
| UTF-8 | Java | 1,884 | java | SyncServiceImpl.java | Java | [] | null | [] | package com.good.sys.service;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.good.monitor.bean.BaseInfoAppPo;
import com.good.monitor.service.BaseInfoService;
import com.good.sys.Constants;
import com.good.sys.MsgConstants;
import com.good.sys.ServiceException;
import com.good.sys.security.SecurityMetadataService;
/**
* 同步服务
*
*/
@Service
public class SyncServiceImpl implements SyncService {
private static Logger logger = LoggerFactory.getLogger(SyncServiceImpl.class);
@Autowired
private SecurityMetadataService metadata;
@Autowired
private RedisTemplate<String, ?> redisTemplate;
@Autowired
private BaseInfoService baseInfoService;
@Autowired
private AuditLogService logService;
/**
* 同步权限配置
*/
public void syncAuthMeta() {
metadata.loadResourceDefine();
}
/**
* 注册
*
* @throws ServiceException
*/
//@PostConstruct
public void register() throws ServiceException {
HashOperations<String, String, BaseInfoAppPo> op = redisTemplate.opsForHash();
try {
BaseInfoAppPo baseInfo = baseInfoService.getBaseInfo();
op.put(Constants.REDIS_REGISTER_MAP, baseInfo.getMachineIp() + ":" + baseInfo.getServicePort(), baseInfo);
logger.info("Register machine ({}:{}) successfully.", baseInfo.getMachineIp(), baseInfo.getServicePort());
} catch (ServiceException e) {
logger.error(MsgConstants.E0000, e);
throw e;
}
}
}
| 1,884 | 0.68871 | 0.685484 | 60 | 29 | 27.688745 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.566667 | false | false | 0 |
7fc10ed3a11522af3b08241978a46415354e8d4e | 31,387,621,064,417 | 4edbe814ea4c004e69e919e69b223ce5d4b1a255 | /src/com/piyush/medium/MaxSumOfSubArrayIsMin.java | 7c5c97313987b35d64acdf87eae132a71a476d64 | [] | no_license | dhritarastra/problem-solving | https://github.com/dhritarastra/problem-solving | 972e3ca7bbfdde740ffbae059a98655551c56088 | a1f84f125463581a9f6bf03ff023e4989ec9639d | refs/heads/main | 2023-06-23T10:44:39.185000 | 2021-07-26T03:49:16 | 2021-07-26T03:49:16 | 367,243,727 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.piyush.medium;
import java.util.Arrays;
/**
* @author Piyush
*
* Given an array of numbers N and an integer k, your task is to split N into k
* partitions such that the maximum sum of any partition is minimized. Return this sum.
*
* For example, given N = [5, 1, 2, 7, 3, 4] and k = 3, you should return 8, since the
* optimal partition is [5, 1, 2], [7], [3, 4].
*
*/
public class MaxSumOfSubArrayIsMin
{
public static int maxSumOfSubArray(int[] arr, int k)
{
Arrays.sort(arr);
int arrLen = arr.length;
// array length cannot be less than the number of partitions to be formed
if(arrLen<k)
{
return 0;
}
// get the largest int in the array
int max = arr[arrLen-1];
/*
* assuming the maximum size of partition to be the largest number, the sum of
* remaining numbers should be divided among the remaining partition such that
* each partition should be less than the largest number (max)
*/
int remainingAverage = sumOfRemainingArray(arr, arrLen)/(k-1);
/*
* if remainingAverage is greater than max, therefore the largest number stored
* in a partition would be greater than max, and this larger number would be
* equal to the remaining average
*/
if(remainingAverage > max)
{
max = remainingAverage;
}
return max;
}
/*
* simply calculates the sum of the remaining integers in the array (apart from the
* largest element of the array)
*/
private static int sumOfRemainingArray(int[] arr, int arrLen)
{
int sum = 0;
for(int i=0; i<arrLen-1; i++)
{
sum += arr[i];
}
return sum;
}
// Driver code
public static void main(String[] args)
{
int[] arr = {5, 2, 1, 4, 5};
int k = 3;
System.out.println(maxSumOfSubArray(arr, k));
}
}
| UTF-8 | Java | 1,843 | java | MaxSumOfSubArrayIsMin.java | Java | [
{
"context": "um;\r\n\r\nimport java.util.Arrays;\r\n\r\n/**\r\n * @author Piyush\r\n * \r\n * Given an array of numbers N and an integ",
"end": 80,
"score": 0.9988173842430115,
"start": 74,
"tag": "NAME",
"value": "Piyush"
}
] | null | [] | package com.piyush.medium;
import java.util.Arrays;
/**
* @author Piyush
*
* Given an array of numbers N and an integer k, your task is to split N into k
* partitions such that the maximum sum of any partition is minimized. Return this sum.
*
* For example, given N = [5, 1, 2, 7, 3, 4] and k = 3, you should return 8, since the
* optimal partition is [5, 1, 2], [7], [3, 4].
*
*/
public class MaxSumOfSubArrayIsMin
{
public static int maxSumOfSubArray(int[] arr, int k)
{
Arrays.sort(arr);
int arrLen = arr.length;
// array length cannot be less than the number of partitions to be formed
if(arrLen<k)
{
return 0;
}
// get the largest int in the array
int max = arr[arrLen-1];
/*
* assuming the maximum size of partition to be the largest number, the sum of
* remaining numbers should be divided among the remaining partition such that
* each partition should be less than the largest number (max)
*/
int remainingAverage = sumOfRemainingArray(arr, arrLen)/(k-1);
/*
* if remainingAverage is greater than max, therefore the largest number stored
* in a partition would be greater than max, and this larger number would be
* equal to the remaining average
*/
if(remainingAverage > max)
{
max = remainingAverage;
}
return max;
}
/*
* simply calculates the sum of the remaining integers in the array (apart from the
* largest element of the array)
*/
private static int sumOfRemainingArray(int[] arr, int arrLen)
{
int sum = 0;
for(int i=0; i<arrLen-1; i++)
{
sum += arr[i];
}
return sum;
}
// Driver code
public static void main(String[] args)
{
int[] arr = {5, 2, 1, 4, 5};
int k = 3;
System.out.println(maxSumOfSubArray(arr, k));
}
}
| 1,843 | 0.634835 | 0.620727 | 73 | 23.246574 | 27.331944 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.931507 | false | false | 0 |
03270735df4c697d696c24f680cb674a83e7791f | 19,816,979,147,113 | 169d875ba0eeb10baf20c3a243c03b20a552887b | /src/com/algorithm/excercise/Substring.java | 401289178870dd32cae291a91dc72ad4bdcf7799 | [] | no_license | thoufee/impersonateapi | https://github.com/thoufee/impersonateapi | 5054fc9f7cfdc6f078b61b6482300a74beeb47a8 | 01b51abc7487a5cb12ca3b02f805da4af9adf81b | refs/heads/master | 2021-01-10T02:33:36.106000 | 2015-10-26T00:27:03 | 2015-10-26T00:27:03 | 44,361,735 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.algorithm.excercise;
public class Substring {
public static void main(String[] args) {
String first = "abc";
String second = "a";
if(first == second) {
System.out.println("referances is same");
} else {
System.out.println("referances is not same");
}
if(first.equals(second)) {
System.out.println("values is same");
} else {
System.out.println("values is not same");
}
}
}
| UTF-8 | Java | 420 | java | Substring.java | Java | [] | null | [] | package com.algorithm.excercise;
public class Substring {
public static void main(String[] args) {
String first = "abc";
String second = "a";
if(first == second) {
System.out.println("referances is same");
} else {
System.out.println("referances is not same");
}
if(first.equals(second)) {
System.out.println("values is same");
} else {
System.out.println("values is not same");
}
}
}
| 420 | 0.645238 | 0.645238 | 19 | 21.105263 | 16.590723 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.052632 | false | false | 0 |
6b986a639bbce50b64475fc4c0f43affcb94513e | 21,165,598,836,714 | 8c3d9fda53f93f7df361dcc7c192b485454c33f0 | /lt/warriorsJourney/common/database/InventoryHandler.java | e816fea8cd8b32e13f675f080e2aae52c6f7a5f1 | [] | no_license | Ideo-lt/WarriorsJourney-Android | https://github.com/Ideo-lt/WarriorsJourney-Android | 4ba795573ada3257c4cc6ab47515b42669c01720 | 31acf382ac300554e64e61ac26b2e54616dcf15d | refs/heads/master | 2021-01-21T14:12:49.516000 | 2016-04-01T16:15:24 | 2016-04-01T16:15:24 | 21,736,764 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lt.warriorsJourney.common.database;
import java.util.Iterator;
import java.util.Map;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
public class InventoryHandler
{
private SQLiteDatabase database;
private DataBaseHelper dbHelper;
private String[] allColumns = { DataBaseHelper.COLUMN_ITEM_PLACE,
DataBaseHelper.COLUMN_ITEM_ID,DataBaseHelper.COLUMN_ITEM_EQUIPED};
public InventoryHandler(Context context)
{
dbHelper = new DataBaseHelper(context);
}
public void open() throws SQLException
{
database = dbHelper.getWritableDatabase();
}
public void close()
{
dbHelper.close();
}
public void savePlayerInventory(InventoryData data)
{
open();
ContentValues values = new ContentValues();
Map<Integer,InventoryItem> inv = data.getInventory();
Iterator<Integer> invIter = inv.keySet().iterator();
for(int i= 0 ;i<inv.size();i++)
{
int id = invIter.next();
values.put(DataBaseHelper.COLUMN_ITEM_PLACE, inv.get(id).getPlace());
values.put(DataBaseHelper.COLUMN_ITEM_ID, inv.get(id).getPlace());
database.insert(DataBaseHelper.TABLE_PLAYER_INVENTORY, null, values);
values.clear();
}
close();
}
public void loadPlayerInventory(InventoryData data)
{
open();
Cursor cursor = database.query(DataBaseHelper.TABLE_PLAYER_INVENTORY,
allColumns, null, null, null, null, null);
cursor.moveToFirst();
while (!cursor.isAfterLast())
{
InventoryItem item = cursorToInventoryItem(cursor);
data.addInventoryItem(item);
cursor.moveToNext();
}
cursor.close();
close();
}
public InventoryItem cursorToInventoryItem(Cursor cursor)
{
return new InventoryItem(cursor.getInt(0),cursor.getInt(1));
}
}
| UTF-8 | Java | 1,871 | java | InventoryHandler.java | Java | [] | null | [] | package lt.warriorsJourney.common.database;
import java.util.Iterator;
import java.util.Map;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
public class InventoryHandler
{
private SQLiteDatabase database;
private DataBaseHelper dbHelper;
private String[] allColumns = { DataBaseHelper.COLUMN_ITEM_PLACE,
DataBaseHelper.COLUMN_ITEM_ID,DataBaseHelper.COLUMN_ITEM_EQUIPED};
public InventoryHandler(Context context)
{
dbHelper = new DataBaseHelper(context);
}
public void open() throws SQLException
{
database = dbHelper.getWritableDatabase();
}
public void close()
{
dbHelper.close();
}
public void savePlayerInventory(InventoryData data)
{
open();
ContentValues values = new ContentValues();
Map<Integer,InventoryItem> inv = data.getInventory();
Iterator<Integer> invIter = inv.keySet().iterator();
for(int i= 0 ;i<inv.size();i++)
{
int id = invIter.next();
values.put(DataBaseHelper.COLUMN_ITEM_PLACE, inv.get(id).getPlace());
values.put(DataBaseHelper.COLUMN_ITEM_ID, inv.get(id).getPlace());
database.insert(DataBaseHelper.TABLE_PLAYER_INVENTORY, null, values);
values.clear();
}
close();
}
public void loadPlayerInventory(InventoryData data)
{
open();
Cursor cursor = database.query(DataBaseHelper.TABLE_PLAYER_INVENTORY,
allColumns, null, null, null, null, null);
cursor.moveToFirst();
while (!cursor.isAfterLast())
{
InventoryItem item = cursorToInventoryItem(cursor);
data.addInventoryItem(item);
cursor.moveToNext();
}
cursor.close();
close();
}
public InventoryItem cursorToInventoryItem(Cursor cursor)
{
return new InventoryItem(cursor.getInt(0),cursor.getInt(1));
}
}
| 1,871 | 0.722074 | 0.72047 | 80 | 22.387501 | 22.939863 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.0125 | false | false | 0 |
042e958eb1886094d5cb68363bed1287ac025301 | 9,629,316,696,602 | 3ccf4eab7c5acdcc2bfa1a601252c2da0455f96c | /rpg/src/main/java/dms/pastor/prototypes/littlefighter/Battle.java | 64d7ebb44834dd990ad6c02b96b4b56bc666a002 | [] | no_license | pastorcmentarny/DomJavaKB | https://github.com/pastorcmentarny/DomJavaKB | 2760c328de1bd4ed160b846f91f69e80bc2d686c | f6bfad71d2268a86eaf1c4ee88aa690bb7d2fb49 | refs/heads/master | 2023-05-27T08:42:33.108000 | 2023-05-02T06:51:32 | 2023-05-02T06:51:32 | 84,251,539 | 0 | 0 | null | false | 2023-05-23T06:49:12 | 2017-03-07T22:14:58 | 2021-12-23T00:07:55 | 2023-05-23T06:49:12 | 21,235 | 0 | 0 | 1 | Java | false | false | package dms.pastor.prototypes.littlefighter;
import javax.swing.*;
/**
* Author Dominik Symonowicz
* WWW: https://dominiksymonowicz.com/welcome
* IT BLOG: https://dominiksymonowicz.blogspot.co.uk
* GitHub: https://github.com/pastorcmentarny
* Google Play: https://play.google.com/store/apps/developer?id=Dominik+Symonowicz
* LinkedIn: https://www.linkedin.com/in/dominik-symonowicz
*/
class Battle {
//Round
//private int dmg;
int playerAttack(Player player, Enemy enemy) {
int dmg = (player.getPlayerAttack() * player.getPlayerPower()) - (enemy.getEnemyDefence() * enemy.getEnemyPower()) - enemy.getEnemyArmor();
if (dmg < 0) {
return 0;
} else {
player.addExp(dmg);
player.addScore(dmg);
enemy.setEnemyHP(enemy.getEnemyHP() - dmg);
return dmg;
}
}
int enemyAttack(Player player, Enemy enemy, JTextArea console) {
boolean isIt = enemy.addOnToAttack(player);
if (isIt) {
console.setText(console.getText() + player.getMsg());
}
int dmg = (enemy.getEnemyAttack() * enemy.getEnemyPower()) - (player.getPlayerDefence() * player.getPlayerPower());
return Math.max(dmg, 0);
}
}
| UTF-8 | Java | 1,256 | java | Battle.java | Java | [
{
"context": "ttlefighter;\n\nimport javax.swing.*;\n\n/**\n * Author Dominik Symonowicz\n * WWW:\thttps://dominiksymonowicz.com/welcome\n * ",
"end": 101,
"score": 0.9998902082443237,
"start": 83,
"tag": "NAME",
"value": "Dominik Symonowicz"
},
{
"context": "wicz.blogspot.co.uk\n * ... | null | [] | package dms.pastor.prototypes.littlefighter;
import javax.swing.*;
/**
* Author <NAME>
* WWW: https://dominiksymonowicz.com/welcome
* IT BLOG: https://dominiksymonowicz.blogspot.co.uk
* GitHub: https://github.com/pastorcmentarny
* Google Play: https://play.google.com/store/apps/developer?id=Dominik+Symonowicz
* LinkedIn: https://www.linkedin.com/in/dominik-symonowicz
*/
class Battle {
//Round
//private int dmg;
int playerAttack(Player player, Enemy enemy) {
int dmg = (player.getPlayerAttack() * player.getPlayerPower()) - (enemy.getEnemyDefence() * enemy.getEnemyPower()) - enemy.getEnemyArmor();
if (dmg < 0) {
return 0;
} else {
player.addExp(dmg);
player.addScore(dmg);
enemy.setEnemyHP(enemy.getEnemyHP() - dmg);
return dmg;
}
}
int enemyAttack(Player player, Enemy enemy, JTextArea console) {
boolean isIt = enemy.addOnToAttack(player);
if (isIt) {
console.setText(console.getText() + player.getMsg());
}
int dmg = (enemy.getEnemyAttack() * enemy.getEnemyPower()) - (player.getPlayerDefence() * player.getPlayerPower());
return Math.max(dmg, 0);
}
}
| 1,244 | 0.632166 | 0.629777 | 42 | 28.904762 | 32.703438 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 0 |
6340f9e9c198b0200347501cc87d45314abb9d70 | 8,057,358,667,911 | 6de64034bca682697ccb6fb0453cacd3799fd8e9 | /jfbase/src/com/jf/system/dao/impl/SyUserDaoImpl.java | 0af7b6cf5cf97df11c4edb789558fa5c3ffb5f67 | [] | no_license | yepingping/jfbase | https://github.com/yepingping/jfbase | f0c8b1d687db711edc3d6ad0d59faa816758af67 | 51d740f80316d2f514341072a630af7ff3dbd7a7 | refs/heads/master | 2021-01-02T09:15:23.769000 | 2013-05-10T16:54:42 | 2013-05-10T16:54:42 | 33,716,236 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jf.system.dao.impl;
import org.springframework.stereotype.Repository;
import com.jf.framework.dao.BaseDaoImpl;
import com.jf.system.dao.SyUserDao;
import com.jf.system.model.SyUser;
/**
* @描述:<p>用户Dao实现类 </p>
*
* @作者: 叶平平(yepp)
*
* @时间: 2013-5-8 上午11:58:57
*/
@Repository("syUserDao")
public class SyUserDaoImpl extends BaseDaoImpl<SyUser> implements SyUserDao{
/**
* 构造方法
*/
public SyUserDaoImpl() {
// TODO Auto-generated constructor stub
}
/**
* @描述:<p>保存用户 </p>
*
* @作者: 叶平平(yepp)
*
* @时间: 2013-5-8 上午11:56:46
*
* @修改历史: <p>修改时间、修改人、修改原因/说明</p>
*
* @param syUser
* @return
*/
public SyUser saveSyUser(SyUser syUser){
return null;
}
}
| UTF-8 | Java | 848 | java | SyUserDaoImpl.java | Java | [
{
"context": "ser;\r\n\r\n/**\r\n * @描述:<p>用户Dao实现类 </p>\r\n *\r\n * @作者: 叶平平(yepp)\r\n *\r\n * @时间: 2013-5-8 上午11:58:57\r\n */\r\n@Rep",
"end": 250,
"score": 0.9128590226173401,
"start": 247,
"tag": "NAME",
"value": "叶平平"
},
{
"context": "\r\n\t}\r\n\t/**\r\n\t * @描述:<p>保存用户 </p>\r... | null | [] | package com.jf.system.dao.impl;
import org.springframework.stereotype.Repository;
import com.jf.framework.dao.BaseDaoImpl;
import com.jf.system.dao.SyUserDao;
import com.jf.system.model.SyUser;
/**
* @描述:<p>用户Dao实现类 </p>
*
* @作者: 叶平平(yepp)
*
* @时间: 2013-5-8 上午11:58:57
*/
@Repository("syUserDao")
public class SyUserDaoImpl extends BaseDaoImpl<SyUser> implements SyUserDao{
/**
* 构造方法
*/
public SyUserDaoImpl() {
// TODO Auto-generated constructor stub
}
/**
* @描述:<p>保存用户 </p>
*
* @作者: 叶平平(yepp)
*
* @时间: 2013-5-8 上午11:56:46
*
* @修改历史: <p>修改时间、修改人、修改原因/说明</p>
*
* @param syUser
* @return
*/
public SyUser saveSyUser(SyUser syUser){
return null;
}
}
| 848 | 0.609459 | 0.577027 | 40 | 16.5 | 17.389652 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.725 | false | false | 0 |
f51290f0cb6390be1a8c4b4f84aa3bbc50590510 | 9,912,784,547,121 | 8f194e41ed6db9b5a694d32c522bcb84fb149956 | /src/main/java/org/chain/shopassistant/service/ProductService.java | 39add69f6137315c32021d53474f87e8b83b40e2 | [
"MIT"
] | permissive | killerYe/shop-assistant | https://github.com/killerYe/shop-assistant | e39d7b4affd8e7265cd87d2c4feecd9889f29fcc | 940bb605536a6fce702976b23de5e9f8578bd640 | refs/heads/master | 2018-09-04T06:52:01.036000 | 2018-06-14T03:22:05 | 2018-06-14T03:22:05 | 133,498,041 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.chain.shopassistant.service;
import org.chain.shopassistant.domain.Product;
import java.util.List;
public interface ProductService {
Product findProduct(String name);
List<Product> findAllProduct();
Product findProduct(Integer id);
int addProduct(Product product);
int addProducts(List<Product> products);
int deleteAll();
Product findByIdAndName(Integer id,String name);
}
| UTF-8 | Java | 417 | java | ProductService.java | Java | [] | null | [] | package org.chain.shopassistant.service;
import org.chain.shopassistant.domain.Product;
import java.util.List;
public interface ProductService {
Product findProduct(String name);
List<Product> findAllProduct();
Product findProduct(Integer id);
int addProduct(Product product);
int addProducts(List<Product> products);
int deleteAll();
Product findByIdAndName(Integer id,String name);
}
| 417 | 0.755396 | 0.755396 | 15 | 26.799999 | 17.78089 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false | 0 |
bc9352dcae708e151d860b6f0cc14f4259b61a3c | 7,627,861,939,832 | afc984b6f4b89ddb5ba617c14e0f4badc6a3cecb | /ssrs-dao-jpa/src/main/java/org/mardep/ssrs/dao/codetable/LawyerJpaDao.java | db6805717db9be507cfea8c6e2497943853bb2c2 | [] | no_license | codefxone/ssrs2 | https://github.com/codefxone/ssrs2 | 9fc087837d121ff8944d24d4d77e141ae703f377 | 4212a954e3c4d8ccc35471735438640e3fa8e186 | refs/heads/master | 2023-01-06T18:38:17.193000 | 2020-11-09T10:15:54 | 2020-11-09T10:15:54 | 303,931,637 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.mardep.ssrs.dao.codetable;
import org.mardep.ssrs.dao.AbstractJpaDao;
import org.mardep.ssrs.dao.PredicateCriteria;
import org.mardep.ssrs.dao.PredicateCriteria.PredicateType;
import org.mardep.ssrs.domain.codetable.Lawyer;
import org.springframework.stereotype.Repository;
@Repository
public class LawyerJpaDao extends AbstractJpaDao<Lawyer, String> implements ILawyerDao {
public LawyerJpaDao() {
for (int i = 0; i < criteriaList.size(); i++) {
PredicateCriteria c = criteriaList.get(i);
switch (c.getKey()) {
case "id":
PredicateCriteria element = new PredicateCriteria(c.getKey(), PredicateType.EQUAL);
criteriaList.set(i, element);
break;
}
}
}
} | UTF-8 | Java | 697 | java | LawyerJpaDao.java | Java | [] | null | [] | package org.mardep.ssrs.dao.codetable;
import org.mardep.ssrs.dao.AbstractJpaDao;
import org.mardep.ssrs.dao.PredicateCriteria;
import org.mardep.ssrs.dao.PredicateCriteria.PredicateType;
import org.mardep.ssrs.domain.codetable.Lawyer;
import org.springframework.stereotype.Repository;
@Repository
public class LawyerJpaDao extends AbstractJpaDao<Lawyer, String> implements ILawyerDao {
public LawyerJpaDao() {
for (int i = 0; i < criteriaList.size(); i++) {
PredicateCriteria c = criteriaList.get(i);
switch (c.getKey()) {
case "id":
PredicateCriteria element = new PredicateCriteria(c.getKey(), PredicateType.EQUAL);
criteriaList.set(i, element);
break;
}
}
}
} | 697 | 0.750359 | 0.748924 | 23 | 29.347826 | 26.305246 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 0 |
da45df66797184a372bcdc6b46db9c50100107e0 | 2,113,123,976,131 | dd28e1a70fcc929db6ec7a66f149ced33643ff1b | /softkeyboardstatehelper/src/main/java/com/mam/softkeyboardstatehelper/AutoActivityLifeCycleCallback.java | 3014feaad7e9066aed3a3eb2d35b627ea0e63ced | [] | no_license | mirshahbazi/MAMSoftKeyBoardStateHelper | https://github.com/mirshahbazi/MAMSoftKeyBoardStateHelper | 3e1a6178e60b2bb5f9241dc9abef66e76d73ea1f | 4a4e958900c3781a63c6cae9edd5d22a65803441 | refs/heads/master | 2020-03-26T18:02:07.540000 | 2018-09-11T12:28:06 | 2018-09-11T12:28:06 | 145,193,025 | 6 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mam.softkeyboardstatehelper;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
/**
* *
* * ____ ____ _____ ___ ____
* * | \ \ / / |/ _ || \ \ / / |
* * | |\ V /| | (_| || |\ V /| |
* * |_| \_/ |_|\__,_||_| \_/ |_|
* *
* Created by Mohammad Ali Mirshahbazi
*/
public abstract class AutoActivityLifeCycleCallback implements Application.ActivityLifecycleCallbacks{
private final Activity mCurrentActivity;
public AutoActivityLifeCycleCallback(Activity activity) {
mCurrentActivity=activity;
}
@Override
public void onActivityCreated(Activity activity, Bundle bundle) {
}
@Override
public void onActivityStarted(Activity activity) {
}
@Override
public void onActivityResumed(Activity activity) {
}
@Override
public void onActivityPaused(Activity activity) {
if(mCurrentActivity == activity){
mCurrentActivity.getApplication().unregisterActivityLifecycleCallbacks(this);
onCurrentActivityDestroyed();
}
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override
public void onActivityDestroyed(Activity activity) {
if(mCurrentActivity == activity){
mCurrentActivity.getApplication().unregisterActivityLifecycleCallbacks(this);
onCurrentActivityDestroyed();
}
}
protected abstract void onCurrentActivityDestroyed();
}
| UTF-8 | Java | 1,616 | java | AutoActivityLifeCycleCallback.java | Java | [
{
"context": " |_| \\_/ |_|\\__,_||_| \\_/ |_|\n * *\n * Created by Mohammad Ali Mirshahbazi\n */\n\npublic abstract class AutoActivityLifeCycleC",
"end": 351,
"score": 0.9997156858444214,
"start": 327,
"tag": "NAME",
"value": "Mohammad Ali Mirshahbazi"
}
] | null | [] | package com.mam.softkeyboardstatehelper;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
/**
* *
* * ____ ____ _____ ___ ____
* * | \ \ / / |/ _ || \ \ / / |
* * | |\ V /| | (_| || |\ V /| |
* * |_| \_/ |_|\__,_||_| \_/ |_|
* *
* Created by <NAME>
*/
public abstract class AutoActivityLifeCycleCallback implements Application.ActivityLifecycleCallbacks{
private final Activity mCurrentActivity;
public AutoActivityLifeCycleCallback(Activity activity) {
mCurrentActivity=activity;
}
@Override
public void onActivityCreated(Activity activity, Bundle bundle) {
}
@Override
public void onActivityStarted(Activity activity) {
}
@Override
public void onActivityResumed(Activity activity) {
}
@Override
public void onActivityPaused(Activity activity) {
if(mCurrentActivity == activity){
mCurrentActivity.getApplication().unregisterActivityLifecycleCallbacks(this);
onCurrentActivityDestroyed();
}
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override
public void onActivityDestroyed(Activity activity) {
if(mCurrentActivity == activity){
mCurrentActivity.getApplication().unregisterActivityLifecycleCallbacks(this);
onCurrentActivityDestroyed();
}
}
protected abstract void onCurrentActivityDestroyed();
}
| 1,598 | 0.637376 | 0.637376 | 67 | 23.119404 | 26.386633 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.567164 | false | false | 0 |
b7402e50072fd1133e7de8a426d5c9f11c18dc97 | 3,891,240,432,878 | a2431595819f4cd2edb90090ec3f532a86721ee5 | /java/org.apache.derby.engine/org/apache/derby/impl/store/access/sort/SortBuffer.java | 0df632c9d074890b1eef1dadd3bfde8939dae627 | [
"Apache-2.0",
"LicenseRef-scancode-unicode",
"LGPL-2.0-or-later",
"CPL-1.0",
"CDDL-1.0",
"MIT",
"LicenseRef-scancode-other-copyleft",
"NAIST-2003",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"CC-BY-SA-3.0",
"LicenseRef-scancode-generic-export-compliance"
] | permissive | apache/derby | https://github.com/apache/derby | 13efbbdcf744499d897ded7992bc97c8758d775c | 4253dcf4aa37dc64cf7235d494cd2f00f72e678a | refs/heads/trunk | 2023-08-26T15:19:58.304000 | 2019-08-18T23:21:51 | 2019-08-18T23:21:51 | 1,918,497 | 336 | 173 | Apache-2.0 | false | 2022-07-08T18:14:22 | 2011-06-19T07:00:34 | 2022-06-30T07:46:12 | 2022-07-08T18:14:06 | 84,466 | 281 | 132 | 7 | Java | false | false | /*
Derby - Class org.apache.derby.impl.store.access.sort.SortBuffer
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.derby.impl.store.access.sort;
import org.apache.derby.shared.common.sanity.SanityManager;
import org.apache.derby.shared.common.error.StandardException;
import org.apache.derby.iapi.types.DataValueDescriptor;
/**
This class implements an in-memory ordered set
based on the balanced binary tree algorithm from
Knuth Vol. 3, Sec. 6.2.3, pp. 451-471.
Nodes are always maintained in order,
so that inserts and deletes can be intermixed.
<P>
This algorithm will insert/delete N elements
in O(N log(N)) time using O(N) space.
**/
class SortBuffer
{
/**
Returned from insert when the row was inserted
without incident.
**/
public static final int INSERT_OK = 0;
/**
Returned from insert when the row which was
inserted was a duplicate. The set will have
aggregated it in.
**/
public static final int INSERT_DUPLICATE = 1;
/**
Returned from insert when the row was not able to be
inserted because the set was full.
**/
public static final int INSERT_FULL = 2;
/**
The sort this set is associated with.
**/
private MergeSort sort;
/**
Where to allocate nodes from.
**/
private NodeAllocator allocator = null;
/**
Special head node for the tree. Head.rightLink is the
root of the tree.
**/
private Node head = null;
/**
The current height of the tree.
**/
private int height = 0;
/**
Set, as a side effect of deleteLeftMost (only), to the
key from the node that was deleted from the tree. This
field is only valid after a call to deleteLeftMost.
**/
private DataValueDescriptor[] deletedKey;
/**
Set, as a side effect of deleteLeftMost and rotateRight,
if the subtree they're working on decreased in height.
This field is only valid after a call to deleteLeftMost
or rotateRight.
**/
private boolean subtreeShrunk;
/**
Set by the setNextAux() method. This value is stuffed
into the aux field of the next node that's allocated.
**/
private int nextAux;
/**
Read by the getLastAux() method. This value is read out
of the last node that was deallocated from the tree.
**/
private int lastAux;
/**
Arrange that the next node allocated in the tree have
it's aux field set to the argument.
**/
void setNextAux(int aux)
{
nextAux = aux;
}
/**
Retrieve the aux value from the last node deallocated
from the tree.
**/
int getLastAux()
{
return lastAux;
}
/**
Construct doesn't do anything, callers must call init
and check its return code.
**/
SortBuffer(MergeSort sort)
{
this.sort = sort;
}
/**
Initialize. Returns false if the allocator
couldn't be initialized.
**/
boolean init()
{
allocator = new NodeAllocator();
boolean initOK = false;
if (sort.sortBufferMin > 0)
initOK = allocator.init(sort.sortBufferMin, sort.sortBufferMax);
else
initOK = allocator.init(sort.sortBufferMax);
if (initOK == false)
{
allocator = null;
return false;
}
reset();
return true;
}
void reset()
{
allocator.reset();
head = allocator.newNode();
height = 0;
}
void close()
{
if (allocator != null)
allocator.close();
allocator = null;
height = 0;
head = null;
}
/**
Grow by a certain percent if we can
*/
void grow(int percent)
{
if (percent > 0)
allocator.grow(percent);
}
/**
Return the number of elements this sorter can sort.
It's the capacity of the node allocator minus one
because the sorter uses one node for the head.
**/
int capacity()
{
if (allocator == null)
return 0;
return allocator.capacity() - 1;
}
/**
Insert a key k into the tree. Returns true if the
key was inserted, false if the tree is full. Silently
ignores duplicate keys.
<P>
See Knuth Vol. 3, Sec. 6.2.3, pp. 455-457 for the algorithm.
**/
int insert(DataValueDescriptor[] k)
throws StandardException
{
int c;
Node p, q, r, s, t;
if (head.rightLink == null)
{
if ((sort.sortObserver != null) &&
((k = sort.sortObserver.insertNonDuplicateKey(k)) == null))
{
return INSERT_DUPLICATE;
}
q = allocator.newNode();
q.key = k;
q.aux = nextAux;
head.rightLink = q;
height = 1;
return INSERT_OK;
}
// [A1. Initialize]
t = head;
p = s = head.rightLink;
// Search
while (true)
{
// [A2. Compare]
c = sort.compare(k, p.key);
if (c == 0)
{
// The new key compares equal to the
// current node's key.
// See if we can use the aggregators
// to get rid of the new key.
if ((sort.sortObserver != null) &&
((k = sort.sortObserver.insertDuplicateKey(k, p.key)) == null))
{
return INSERT_DUPLICATE;
}
// Keep the duplicate key...
// Allocate a new node for the key.
q = allocator.newNode();
if (q == null)
return INSERT_FULL;
q.aux = nextAux;
// Link the new node onto the current
// node's duplicate chain. The assumption
// is made that a newly allocated node
// has null left and right links.
q.key = k;
q.dupChain = p.dupChain;
p.dupChain = q;
// From the caller's perspective this was
// not a duplicate insertion.
return INSERT_OK;
}
if (c < 0)
{
// [A3. Move left]
q = p.leftLink;
if (q == null)
{
q = allocator.newNode();
if (q == null)
return INSERT_FULL;
q.aux = nextAux;
p.leftLink = q;
break;
}
}
else // c > 0
{
// [A4. Move right]
q = p.rightLink;
if (q == null)
{
q = allocator.newNode();
if (q == null)
return INSERT_FULL;
q.aux = nextAux;
p.rightLink = q;
break;
}
}
if (q.balance != 0)
{
t = p;
s = q;
}
p = q;
}
/*
* [A5. Insert]
* Node has been allocated and placed for k.
* Initialize it.
*/
if ((sort.sortObserver != null) &&
((k = sort.sortObserver.insertNonDuplicateKey(k)) == null))
{
return INSERT_DUPLICATE;
}
q.key = k;
/*
* [A6. Adjust balance factors for nodes between
* s and q]
*/
c = sort.compare(k, s.key);
if (c < 0)
r = p = s.leftLink;
else
r = p = s.rightLink;
while (p != q)
{
if (sort.compare(k, p.key) < 0)
{
p.balance = -1;
p = p.leftLink;
}
else // sort.compare(k, p.key) > 0
{
p.balance = 1;
p = p.rightLink;
}
}
// [A7. Balancing act]
int a = (c > 0 ? 1 : ((c == 0) ? 0 : -1));
if (s.balance == 0)
{
//debug("A7 (i). The tree has gotten higher");
s.balance = a;
height++;
return INSERT_OK;
}
if (s.balance == -a)
{
//debug("A7 (ii). The tree has gotten more balanced");
s.balance = 0;
return INSERT_OK;
}
//debug("A7 (iii). The tree has gotten more out of balance");
// s.balance == a
if (r.balance == a)
{
//debug("A8. Single rotation");
p = r;
s.setLink(a, r.link(-a));
r.setLink(-a, s);
s.balance = 0;
r.balance = 0;
}
else // r.balance == -a
{
//debug("A8. Double rotation");
p = r.link(-a);
r.setLink(-a, p.link(a));
p.setLink(a, r);
s.setLink(a, p.link(-a));
p.setLink(-a, s);
if (p.balance == a)
{
s.balance = -a;
r.balance = 0;
}
else if (p.balance == 0)
{
s.balance = 0;
r.balance = 0;
}
else // p.balance == -a
{
s.balance = 0;
r.balance = a;
}
p.balance = 0;
}
// [A10. Finishing touch]
if (s == t.rightLink)
t.rightLink = p;
else
t.leftLink = p;
return INSERT_OK;
}
/**
Return the lowest key and delete it from
the tree, preserving the balance of the tree.
**/
DataValueDescriptor[] removeFirst()
{
if (head.rightLink == null)
return null;
head.rightLink = deleteLeftmost(head.rightLink);
if (this.subtreeShrunk)
height--;
return this.deletedKey;
}
/**
Delete the node with the lowest key from the subtree defined
by 'thisNode', maintaining balance in the subtree. Returns
the node that should be the new root of the subtree. This
method sets this.subtreeShrunk if the subtree of thisNode
decreased in height. Saves the key that was in the deleted
node in 'deletedKey'.
**/
private Node deleteLeftmost(Node thisNode)
{
// If this node has no left child, we've found the
// leftmost one, so delete it.
if (thisNode.leftLink == null)
{
// See if the current node has duplicates. If so, we'll
// just return one of them and not change the tree.
if (thisNode.dupChain != null)
{
Node dupNode = thisNode.dupChain;
//System.out.println("deleteLeftmost(" + thisNode + "): found dup: " + dupNode);
// Return the key from the duplicate. Note that even
// though the keys compare equal they may not be equal,
// depending on how the column ordering was specified.
this.deletedKey = dupNode.key;
lastAux = dupNode.aux;
// Unlink the dup node and free it.
thisNode.dupChain = dupNode.dupChain;
allocator.freeNode(dupNode);
dupNode = null;
// Tree is not changing height since we're just removing
// a node from the duplicate chain.
this.subtreeShrunk = false;
// Preserve the current node as the root of this subtree..
return thisNode;
}
else // thisNode.dupChain == null
{
//System.out.println("deleteLeftmost(" + thisNode + "): found key");
// Key to return is this node's key.
this.deletedKey = thisNode.key;
lastAux = thisNode.aux;
// We're removing this node, so it's subtree is shrinking
// from height 1 to height 0.
this.subtreeShrunk = true;
// Save this node's right link which might be cleared
// out by the allocator.
Node newRoot = thisNode.rightLink;
// Free the node we're deleting.
allocator.freeNode(thisNode);
// Rearrange the tree to put this node's right subtree where
// this node was.
return newRoot;
}
}
// Since this wasn't the leftmost node, delete the leftmost
// node from this node's left subtree. This operation may
// rearrange the subtree, including the possiblility that the
// root note changed, so set the root of the left subtree to
// what the delete operation wants it to be.
thisNode.leftLink = deleteLeftmost(thisNode.leftLink);
// If the left subtree didn't change size, then this subtree
// could not have changed size either.
if (this.subtreeShrunk == false)
return thisNode;
// If the delete operation shrunk the subtree, we may have
// some rebalancing to do.
if (thisNode.balance == 1)
{
// Tree got more unbalanced. Need to do some
// kind of rotation to fix it. The rotateRight()
// method will set subtreeShrunk appropriately
// and return the node that should be the new
// root of this subtree.
return rotateRight(thisNode);
}
if (thisNode.balance == -1)
{
// Tree became more balanced
thisNode.balance = 0;
// Since the left subtree was higher, and it
// shrunk, then this subtree shrunk, too.
this.subtreeShrunk = true;
}
else // thisNode.balance == 0
{
// Tree became acceptably unbalanced
thisNode.balance = 1;
// We had a balanced tree, and just the left
// subtree shrunk, so this subtree as a whole
// has not changed in height.
this.subtreeShrunk = false;
}
// We have not rearranged this subtree.
return thisNode;
}
/**
Perform either a single or double rotation, as appropriate,
to get the subtree 'thisNode' back in balance, assuming
that the right subtree of 'thisNode' is higher than the
left subtree. Returns the node that should be the new
root of the subtree.
<P>
These are the cases depicted in diagrams (1) and (2) of
Knuth (p. 454), and the node names reflect these diagrams.
However, in deletion, the single rotation may encounter
a case where the "beta" and "gamma" subtrees are the same
height (b.balance == 0), so the resulting does not always
shrink.
<P>
Note: This code will not do the "mirror image" cases.
It only works when the right subtree is the higher one
(this is the only case encountered when deleting leftmost
nodes from the tree).
**/
private Node rotateRight(Node thisNode)
{
Node a = thisNode;
Node b = thisNode.rightLink;
if (b.balance >= 0)
{
// single rotation
a.rightLink = b.leftLink;
b.leftLink = a;
if (b.balance == 0)
{
a.balance = 1;
b.balance = -1;
this.subtreeShrunk = false;
}
else // b.balance == 1
{
a.balance = 0;
b.balance = 0;
this.subtreeShrunk = true;
}
return b;
}
else // b.balance == -1
{
// double rotation
Node x = b.leftLink;
a.rightLink = x.leftLink;
x.leftLink = a;
b.leftLink = x.rightLink;
x.rightLink = b;
if (x.balance == 1)
{
a.balance = -1;
b.balance = 0;
}
else if (x.balance == -1)
{
a.balance = 0;
b.balance = 1;
}
else // x.balance == 0
{
a.balance = 0;
b.balance = 0;
}
x.balance = 0;
this.subtreeShrunk = true;
return x;
}
}
public void check()
{
if (SanityManager.DEBUG)
{
String error = null;
if (head.rightLink == null)
{
if (height != 0)
error = "empty tree with height " + height;
}
else
{
if (depth(head.rightLink) != height)
error = "tree height " + height + " != depth " + depth(head.rightLink);
else
error = checkNode(head.rightLink);
}
if (error != null)
{
System.out.println("ERROR: " + error);
print();
System.exit(1);
}
}
}
private String checkNode(Node n)
{
if (SanityManager.DEBUG)
{
if (n == null)
return null;
int ld = depth(n.leftLink);
int rd = depth(n.rightLink);
if (n.balance != (rd - ld))
return "node " + n + ": left height " + ld + " right height " + rd;
String e;
e = checkNode(n.rightLink);
if (e == null)
e = checkNode(n.leftLink);
return e;
}
else
{
return(null);
}
}
private int depth(Node n)
{
int ld = 0;
int rd = 0;
if (n == null)
return 0;
if (n.leftLink != null)
ld = depth(n.leftLink);
if (n.rightLink != null)
rd = depth(n.rightLink);
if (rd > ld)
return rd + 1;
else
return ld + 1;
}
public void print()
{
Node root = head.rightLink;
System.out.println("tree height: " + height
+ " root: " + ((root == null) ? -1 : root.id));
if (root != null)
printRecursive(root, 0);
}
private void printRecursive(Node n, int depth)
{
if (n.rightLink != null)
printRecursive(n.rightLink, depth + 1);
for (int i = 0; i < depth; i++)
System.out.print(" ");
System.out.println(n);
if (n.leftLink != null)
printRecursive(n.leftLink, depth + 1);
}
private void debug(String s)
{
if (SanityManager.DEBUG)
{
System.out.println(" === [" + s + "] ===");
}
}
}
| UTF-8 | Java | 15,929 | java | SortBuffer.java | Java | [] | null | [] | /*
Derby - Class org.apache.derby.impl.store.access.sort.SortBuffer
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.derby.impl.store.access.sort;
import org.apache.derby.shared.common.sanity.SanityManager;
import org.apache.derby.shared.common.error.StandardException;
import org.apache.derby.iapi.types.DataValueDescriptor;
/**
This class implements an in-memory ordered set
based on the balanced binary tree algorithm from
Knuth Vol. 3, Sec. 6.2.3, pp. 451-471.
Nodes are always maintained in order,
so that inserts and deletes can be intermixed.
<P>
This algorithm will insert/delete N elements
in O(N log(N)) time using O(N) space.
**/
class SortBuffer
{
/**
Returned from insert when the row was inserted
without incident.
**/
public static final int INSERT_OK = 0;
/**
Returned from insert when the row which was
inserted was a duplicate. The set will have
aggregated it in.
**/
public static final int INSERT_DUPLICATE = 1;
/**
Returned from insert when the row was not able to be
inserted because the set was full.
**/
public static final int INSERT_FULL = 2;
/**
The sort this set is associated with.
**/
private MergeSort sort;
/**
Where to allocate nodes from.
**/
private NodeAllocator allocator = null;
/**
Special head node for the tree. Head.rightLink is the
root of the tree.
**/
private Node head = null;
/**
The current height of the tree.
**/
private int height = 0;
/**
Set, as a side effect of deleteLeftMost (only), to the
key from the node that was deleted from the tree. This
field is only valid after a call to deleteLeftMost.
**/
private DataValueDescriptor[] deletedKey;
/**
Set, as a side effect of deleteLeftMost and rotateRight,
if the subtree they're working on decreased in height.
This field is only valid after a call to deleteLeftMost
or rotateRight.
**/
private boolean subtreeShrunk;
/**
Set by the setNextAux() method. This value is stuffed
into the aux field of the next node that's allocated.
**/
private int nextAux;
/**
Read by the getLastAux() method. This value is read out
of the last node that was deallocated from the tree.
**/
private int lastAux;
/**
Arrange that the next node allocated in the tree have
it's aux field set to the argument.
**/
void setNextAux(int aux)
{
nextAux = aux;
}
/**
Retrieve the aux value from the last node deallocated
from the tree.
**/
int getLastAux()
{
return lastAux;
}
/**
Construct doesn't do anything, callers must call init
and check its return code.
**/
SortBuffer(MergeSort sort)
{
this.sort = sort;
}
/**
Initialize. Returns false if the allocator
couldn't be initialized.
**/
boolean init()
{
allocator = new NodeAllocator();
boolean initOK = false;
if (sort.sortBufferMin > 0)
initOK = allocator.init(sort.sortBufferMin, sort.sortBufferMax);
else
initOK = allocator.init(sort.sortBufferMax);
if (initOK == false)
{
allocator = null;
return false;
}
reset();
return true;
}
void reset()
{
allocator.reset();
head = allocator.newNode();
height = 0;
}
void close()
{
if (allocator != null)
allocator.close();
allocator = null;
height = 0;
head = null;
}
/**
Grow by a certain percent if we can
*/
void grow(int percent)
{
if (percent > 0)
allocator.grow(percent);
}
/**
Return the number of elements this sorter can sort.
It's the capacity of the node allocator minus one
because the sorter uses one node for the head.
**/
int capacity()
{
if (allocator == null)
return 0;
return allocator.capacity() - 1;
}
/**
Insert a key k into the tree. Returns true if the
key was inserted, false if the tree is full. Silently
ignores duplicate keys.
<P>
See Knuth Vol. 3, Sec. 6.2.3, pp. 455-457 for the algorithm.
**/
int insert(DataValueDescriptor[] k)
throws StandardException
{
int c;
Node p, q, r, s, t;
if (head.rightLink == null)
{
if ((sort.sortObserver != null) &&
((k = sort.sortObserver.insertNonDuplicateKey(k)) == null))
{
return INSERT_DUPLICATE;
}
q = allocator.newNode();
q.key = k;
q.aux = nextAux;
head.rightLink = q;
height = 1;
return INSERT_OK;
}
// [A1. Initialize]
t = head;
p = s = head.rightLink;
// Search
while (true)
{
// [A2. Compare]
c = sort.compare(k, p.key);
if (c == 0)
{
// The new key compares equal to the
// current node's key.
// See if we can use the aggregators
// to get rid of the new key.
if ((sort.sortObserver != null) &&
((k = sort.sortObserver.insertDuplicateKey(k, p.key)) == null))
{
return INSERT_DUPLICATE;
}
// Keep the duplicate key...
// Allocate a new node for the key.
q = allocator.newNode();
if (q == null)
return INSERT_FULL;
q.aux = nextAux;
// Link the new node onto the current
// node's duplicate chain. The assumption
// is made that a newly allocated node
// has null left and right links.
q.key = k;
q.dupChain = p.dupChain;
p.dupChain = q;
// From the caller's perspective this was
// not a duplicate insertion.
return INSERT_OK;
}
if (c < 0)
{
// [A3. Move left]
q = p.leftLink;
if (q == null)
{
q = allocator.newNode();
if (q == null)
return INSERT_FULL;
q.aux = nextAux;
p.leftLink = q;
break;
}
}
else // c > 0
{
// [A4. Move right]
q = p.rightLink;
if (q == null)
{
q = allocator.newNode();
if (q == null)
return INSERT_FULL;
q.aux = nextAux;
p.rightLink = q;
break;
}
}
if (q.balance != 0)
{
t = p;
s = q;
}
p = q;
}
/*
* [A5. Insert]
* Node has been allocated and placed for k.
* Initialize it.
*/
if ((sort.sortObserver != null) &&
((k = sort.sortObserver.insertNonDuplicateKey(k)) == null))
{
return INSERT_DUPLICATE;
}
q.key = k;
/*
* [A6. Adjust balance factors for nodes between
* s and q]
*/
c = sort.compare(k, s.key);
if (c < 0)
r = p = s.leftLink;
else
r = p = s.rightLink;
while (p != q)
{
if (sort.compare(k, p.key) < 0)
{
p.balance = -1;
p = p.leftLink;
}
else // sort.compare(k, p.key) > 0
{
p.balance = 1;
p = p.rightLink;
}
}
// [A7. Balancing act]
int a = (c > 0 ? 1 : ((c == 0) ? 0 : -1));
if (s.balance == 0)
{
//debug("A7 (i). The tree has gotten higher");
s.balance = a;
height++;
return INSERT_OK;
}
if (s.balance == -a)
{
//debug("A7 (ii). The tree has gotten more balanced");
s.balance = 0;
return INSERT_OK;
}
//debug("A7 (iii). The tree has gotten more out of balance");
// s.balance == a
if (r.balance == a)
{
//debug("A8. Single rotation");
p = r;
s.setLink(a, r.link(-a));
r.setLink(-a, s);
s.balance = 0;
r.balance = 0;
}
else // r.balance == -a
{
//debug("A8. Double rotation");
p = r.link(-a);
r.setLink(-a, p.link(a));
p.setLink(a, r);
s.setLink(a, p.link(-a));
p.setLink(-a, s);
if (p.balance == a)
{
s.balance = -a;
r.balance = 0;
}
else if (p.balance == 0)
{
s.balance = 0;
r.balance = 0;
}
else // p.balance == -a
{
s.balance = 0;
r.balance = a;
}
p.balance = 0;
}
// [A10. Finishing touch]
if (s == t.rightLink)
t.rightLink = p;
else
t.leftLink = p;
return INSERT_OK;
}
/**
Return the lowest key and delete it from
the tree, preserving the balance of the tree.
**/
DataValueDescriptor[] removeFirst()
{
if (head.rightLink == null)
return null;
head.rightLink = deleteLeftmost(head.rightLink);
if (this.subtreeShrunk)
height--;
return this.deletedKey;
}
/**
Delete the node with the lowest key from the subtree defined
by 'thisNode', maintaining balance in the subtree. Returns
the node that should be the new root of the subtree. This
method sets this.subtreeShrunk if the subtree of thisNode
decreased in height. Saves the key that was in the deleted
node in 'deletedKey'.
**/
private Node deleteLeftmost(Node thisNode)
{
// If this node has no left child, we've found the
// leftmost one, so delete it.
if (thisNode.leftLink == null)
{
// See if the current node has duplicates. If so, we'll
// just return one of them and not change the tree.
if (thisNode.dupChain != null)
{
Node dupNode = thisNode.dupChain;
//System.out.println("deleteLeftmost(" + thisNode + "): found dup: " + dupNode);
// Return the key from the duplicate. Note that even
// though the keys compare equal they may not be equal,
// depending on how the column ordering was specified.
this.deletedKey = dupNode.key;
lastAux = dupNode.aux;
// Unlink the dup node and free it.
thisNode.dupChain = dupNode.dupChain;
allocator.freeNode(dupNode);
dupNode = null;
// Tree is not changing height since we're just removing
// a node from the duplicate chain.
this.subtreeShrunk = false;
// Preserve the current node as the root of this subtree..
return thisNode;
}
else // thisNode.dupChain == null
{
//System.out.println("deleteLeftmost(" + thisNode + "): found key");
// Key to return is this node's key.
this.deletedKey = thisNode.key;
lastAux = thisNode.aux;
// We're removing this node, so it's subtree is shrinking
// from height 1 to height 0.
this.subtreeShrunk = true;
// Save this node's right link which might be cleared
// out by the allocator.
Node newRoot = thisNode.rightLink;
// Free the node we're deleting.
allocator.freeNode(thisNode);
// Rearrange the tree to put this node's right subtree where
// this node was.
return newRoot;
}
}
// Since this wasn't the leftmost node, delete the leftmost
// node from this node's left subtree. This operation may
// rearrange the subtree, including the possiblility that the
// root note changed, so set the root of the left subtree to
// what the delete operation wants it to be.
thisNode.leftLink = deleteLeftmost(thisNode.leftLink);
// If the left subtree didn't change size, then this subtree
// could not have changed size either.
if (this.subtreeShrunk == false)
return thisNode;
// If the delete operation shrunk the subtree, we may have
// some rebalancing to do.
if (thisNode.balance == 1)
{
// Tree got more unbalanced. Need to do some
// kind of rotation to fix it. The rotateRight()
// method will set subtreeShrunk appropriately
// and return the node that should be the new
// root of this subtree.
return rotateRight(thisNode);
}
if (thisNode.balance == -1)
{
// Tree became more balanced
thisNode.balance = 0;
// Since the left subtree was higher, and it
// shrunk, then this subtree shrunk, too.
this.subtreeShrunk = true;
}
else // thisNode.balance == 0
{
// Tree became acceptably unbalanced
thisNode.balance = 1;
// We had a balanced tree, and just the left
// subtree shrunk, so this subtree as a whole
// has not changed in height.
this.subtreeShrunk = false;
}
// We have not rearranged this subtree.
return thisNode;
}
/**
Perform either a single or double rotation, as appropriate,
to get the subtree 'thisNode' back in balance, assuming
that the right subtree of 'thisNode' is higher than the
left subtree. Returns the node that should be the new
root of the subtree.
<P>
These are the cases depicted in diagrams (1) and (2) of
Knuth (p. 454), and the node names reflect these diagrams.
However, in deletion, the single rotation may encounter
a case where the "beta" and "gamma" subtrees are the same
height (b.balance == 0), so the resulting does not always
shrink.
<P>
Note: This code will not do the "mirror image" cases.
It only works when the right subtree is the higher one
(this is the only case encountered when deleting leftmost
nodes from the tree).
**/
private Node rotateRight(Node thisNode)
{
Node a = thisNode;
Node b = thisNode.rightLink;
if (b.balance >= 0)
{
// single rotation
a.rightLink = b.leftLink;
b.leftLink = a;
if (b.balance == 0)
{
a.balance = 1;
b.balance = -1;
this.subtreeShrunk = false;
}
else // b.balance == 1
{
a.balance = 0;
b.balance = 0;
this.subtreeShrunk = true;
}
return b;
}
else // b.balance == -1
{
// double rotation
Node x = b.leftLink;
a.rightLink = x.leftLink;
x.leftLink = a;
b.leftLink = x.rightLink;
x.rightLink = b;
if (x.balance == 1)
{
a.balance = -1;
b.balance = 0;
}
else if (x.balance == -1)
{
a.balance = 0;
b.balance = 1;
}
else // x.balance == 0
{
a.balance = 0;
b.balance = 0;
}
x.balance = 0;
this.subtreeShrunk = true;
return x;
}
}
public void check()
{
if (SanityManager.DEBUG)
{
String error = null;
if (head.rightLink == null)
{
if (height != 0)
error = "empty tree with height " + height;
}
else
{
if (depth(head.rightLink) != height)
error = "tree height " + height + " != depth " + depth(head.rightLink);
else
error = checkNode(head.rightLink);
}
if (error != null)
{
System.out.println("ERROR: " + error);
print();
System.exit(1);
}
}
}
private String checkNode(Node n)
{
if (SanityManager.DEBUG)
{
if (n == null)
return null;
int ld = depth(n.leftLink);
int rd = depth(n.rightLink);
if (n.balance != (rd - ld))
return "node " + n + ": left height " + ld + " right height " + rd;
String e;
e = checkNode(n.rightLink);
if (e == null)
e = checkNode(n.leftLink);
return e;
}
else
{
return(null);
}
}
private int depth(Node n)
{
int ld = 0;
int rd = 0;
if (n == null)
return 0;
if (n.leftLink != null)
ld = depth(n.leftLink);
if (n.rightLink != null)
rd = depth(n.rightLink);
if (rd > ld)
return rd + 1;
else
return ld + 1;
}
public void print()
{
Node root = head.rightLink;
System.out.println("tree height: " + height
+ " root: " + ((root == null) ? -1 : root.id));
if (root != null)
printRecursive(root, 0);
}
private void printRecursive(Node n, int depth)
{
if (n.rightLink != null)
printRecursive(n.rightLink, depth + 1);
for (int i = 0; i < depth; i++)
System.out.print(" ");
System.out.println(n);
if (n.leftLink != null)
printRecursive(n.leftLink, depth + 1);
}
private void debug(String s)
{
if (SanityManager.DEBUG)
{
System.out.println(" === [" + s + "] ===");
}
}
}
| 15,929 | 0.611589 | 0.604307 | 715 | 21.278322 | 19.774166 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.138462 | false | false | 0 |
d718547d99c07443877bbf152634013d30ff578e | 25,048,249,301,413 | 25b8261abdd8ce7d13f85ecf75d254beebdbc24a | /StudentMIS/src/factory/UserLogin.java | 9334a7e449db18e275b958bbd1ba1679dc8ccb4a | [] | no_license | MOYUMENGYU/dream | https://github.com/MOYUMENGYU/dream | 27871d0aabff894126532838789f4499d24cb645 | 4a01cb205bfa206ac2427d3db9542be531143242 | refs/heads/master | 2023-06-07T00:55:50.390000 | 2021-06-27T12:35:13 | 2021-06-27T12:35:13 | 376,676,079 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package factory;
/**
* 工厂模式:接口
* 通用登录用户
*/
public interface UserLogin {
//进行用户账号密码验证
public void LoginCheck();
}
| GB18030 | Java | 164 | java | UserLogin.java | Java | [] | null | [] | package factory;
/**
* 工厂模式:接口
* 通用登录用户
*/
public interface UserLogin {
//进行用户账号密码验证
public void LoginCheck();
}
| 164 | 0.677966 | 0.677966 | 9 | 12.111111 | 9.218875 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 0 |
26f6fecc1f0db84ad7c527140b81557d6f8491f7 | 16,286,515,994,820 | 68151a24f176c10e87b617176061e39b0febc153 | /src/innerclasses/E10_InnerClassInScope.java | 0dfa6eedd9ddd8bb22525e428528bbceedbd7855 | [] | no_license | ie925155/ThinkingInJava | https://github.com/ie925155/ThinkingInJava | 7974bebd65c457259f0020846a9f920999bb3733 | a7572a7ca97b8bd92ea625317539c1068adb0f7f | refs/heads/master | 2021-01-22T13:46:50.626000 | 2014-11-13T16:40:11 | 2014-11-13T16:40:11 | 17,667,923 | 6 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /****************** Exercise 10 *****************
* Repeat Exercise 9 but define the inner
* class within a scope within a method.
************************************************/
package innerclasses;
import innerclasses.exercise6.SimpleInterface;
public class E10_InnerClassInScope {
public SimpleInterface get() {
{
class SI implements SimpleInterface{
public void f() {
System.out.println("SI.f");
}
}
return new SI();
}
}
public static void main(String args[]) {
SimpleInterface si =
new E10_InnerClassInScope().get();
si.f();
}
}
| UTF-8 | Java | 572 | java | E10_InnerClassInScope.java | Java | [] | null | [] | /****************** Exercise 10 *****************
* Repeat Exercise 9 but define the inner
* class within a scope within a method.
************************************************/
package innerclasses;
import innerclasses.exercise6.SimpleInterface;
public class E10_InnerClassInScope {
public SimpleInterface get() {
{
class SI implements SimpleInterface{
public void f() {
System.out.println("SI.f");
}
}
return new SI();
}
}
public static void main(String args[]) {
SimpleInterface si =
new E10_InnerClassInScope().get();
si.f();
}
}
| 572 | 0.589161 | 0.575175 | 26 | 21 | 17.789366 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769231 | false | false | 0 |
2b4252d017f58151fece59bb8ddcb4fd3d01e957 | 20,237,885,899,925 | ba44e8867d176d74a6ca0a681a4f454ca0b53cad | /component/entity/model/Role.java | 4dd3a5e44e0a06c3166f480657be10e3de3ef334 | [] | no_license | eric2323223/FATPUS | https://github.com/eric2323223/FATPUS | 1879e2fa105c7e7683afd269965d8b59a7e40894 | 989d2cf49127d88fdf787da5ca6650e2abd5a00e | refs/heads/master | 2016-09-15T19:10:35.317000 | 2012-06-29T02:32:36 | 2012-06-29T02:32:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package component.entity.model;
public class Role implements IWizardEntity {
private String name;
private String comment;
private String project;
@Override
public String sp() {
return this.project;
}
public Role name(String str){
this.name = str;
return this;
}
public Role comment(String str){
this.comment=str;
return this;
}
public String getName(){
return this.name;
}
public String getComment(){
return this.comment;
}
public Role startParameter(String str){
this.project = str;
return this;
}
}
| UTF-8 | Java | 540 | java | Role.java | Java | [] | null | [] | package component.entity.model;
public class Role implements IWizardEntity {
private String name;
private String comment;
private String project;
@Override
public String sp() {
return this.project;
}
public Role name(String str){
this.name = str;
return this;
}
public Role comment(String str){
this.comment=str;
return this;
}
public String getName(){
return this.name;
}
public String getComment(){
return this.comment;
}
public Role startParameter(String str){
this.project = str;
return this;
}
}
| 540 | 0.711111 | 0.711111 | 32 | 15.875 | 12.541805 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 0 |
a590f6bec690ffba0704ad16e37e146d19be1d47 | 3,642,132,280,260 | 962511afc9633f1efa26b00f9e2d343fb6f3275a | /app/src/main/java/com/github/kolandroid/kol/android/controller/LinkedModelController.java | eb815bd07f4c3606e3c6fa278e0c9288cd0c6b32 | [] | no_license | Kasekopf/kolandroid | https://github.com/Kasekopf/kolandroid | b00c759feeafbd857e0e3b8ebd702f3aa671e17f | 44b151d373ac74abba908e4954001c9732fa1482 | refs/heads/master | 2022-05-01T00:21:35.824000 | 2016-10-21T07:41:31 | 2016-10-21T07:41:31 | 21,230,304 | 26 | 3 | null | false | 2015-10-11T07:45:42 | 2014-06-26T06:18:56 | 2015-10-10T22:55:17 | 2015-10-11T07:45:41 | 2,884 | 2 | 1 | 0 | Java | null | null | package com.github.kolandroid.kol.android.controller;
import android.support.annotation.CallSuper;
import android.view.View;
import com.github.kolandroid.kol.android.screen.Screen;
import com.github.kolandroid.kol.android.util.HandlerCallback;
import com.github.kolandroid.kol.model.LinkedModel;
public abstract class LinkedModelController<C, M extends LinkedModel<C>> extends ModelController<M> {
/**
* Autogenerated by eclipse.
*/
private static final long serialVersionUID = 5761904333216584549L;
private transient HandlerCallback<C> callback;
public LinkedModelController(M model) {
super(model);
}
@Override
public void connect(final View view, final Screen host) {
if (callback != null) {
callback.close();
}
this.callback = new HandlerCallback<C>() {
@Override
public void receiveProgress(C message) {
LinkedModelController.this.receiveProgress(view, getModel(), message, host);
}
};
getModel().attachCallback(callback.weak());
super.connect(view, host);
}
public abstract void receiveProgress(View view, M model, C message, Screen host);
@CallSuper
@Override
public void disconnect(Screen host) {
if (callback != null) {
callback.close();
}
}
}
| UTF-8 | Java | 1,373 | java | LinkedModelController.java | Java | [] | null | [] | package com.github.kolandroid.kol.android.controller;
import android.support.annotation.CallSuper;
import android.view.View;
import com.github.kolandroid.kol.android.screen.Screen;
import com.github.kolandroid.kol.android.util.HandlerCallback;
import com.github.kolandroid.kol.model.LinkedModel;
public abstract class LinkedModelController<C, M extends LinkedModel<C>> extends ModelController<M> {
/**
* Autogenerated by eclipse.
*/
private static final long serialVersionUID = 5761904333216584549L;
private transient HandlerCallback<C> callback;
public LinkedModelController(M model) {
super(model);
}
@Override
public void connect(final View view, final Screen host) {
if (callback != null) {
callback.close();
}
this.callback = new HandlerCallback<C>() {
@Override
public void receiveProgress(C message) {
LinkedModelController.this.receiveProgress(view, getModel(), message, host);
}
};
getModel().attachCallback(callback.weak());
super.connect(view, host);
}
public abstract void receiveProgress(View view, M model, C message, Screen host);
@CallSuper
@Override
public void disconnect(Screen host) {
if (callback != null) {
callback.close();
}
}
}
| 1,373 | 0.659869 | 0.646031 | 48 | 27.604166 | 26.776653 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.520833 | false | false | 0 |
9a77fed072b460b3843c465b6dbcdee37065704d | 29,248,727,307,209 | 52cf7a114d54c285581617ce09b362492b27ef34 | /src/animaux/Animal.java | 1299bc762b38cfda0555c3782415e07993a25c7c | [] | no_license | maherya/chatPOO | https://github.com/maherya/chatPOO | 02c7bc0874356c5a5b8dc9b9517880b557d233a4 | f2087828ba624392ae3e26d4885d9a2de9f48fbe | refs/heads/master | 2021-07-01T01:06:09.634000 | 2017-09-18T14:39:18 | 2017-09-18T14:39:18 | 103,945,909 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package animaux;
public class Animal {
protected String name;
protected String carac;
protected String color;
public Animal() {
}
public Animal(String name, String carac, String color) {
this.name = name;
this.carac = carac;
this.color = color;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCarac() {
return carac;
}
public void setCarac(String carac) {
this.carac = carac;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public void manger(){
}
public void dormir(){
}
public void crier(){
}
}
| UTF-8 | Java | 853 | java | Animal.java | Java | [] | null | [] | package animaux;
public class Animal {
protected String name;
protected String carac;
protected String color;
public Animal() {
}
public Animal(String name, String carac, String color) {
this.name = name;
this.carac = carac;
this.color = color;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCarac() {
return carac;
}
public void setCarac(String carac) {
this.carac = carac;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public void manger(){
}
public void dormir(){
}
public void crier(){
}
}
| 853 | 0.526377 | 0.526377 | 54 | 14.796296 | 13.714522 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false | 0 |
a2b0e8882503ccfe8b1a860456a61e78d8849ba6 | 33,440,615,373,232 | 08dbac1864b25939040fcedc38b08774b9547aec | /app/src/main/java/com/siweisoft/heavycenter/module/upunit/titletip/TitleTipVA.java | a53c8158cb635069e6ec8be5afffb71806a6d37c | [] | no_license | summerviwox/heavycenter | https://github.com/summerviwox/heavycenter | b605346bc620ec340d560351db72b312e522d261 | 273adc2d51cdea5c0156bb5919eb28a19248cc8c | refs/heads/master | 2020-12-05T22:06:07.129000 | 2020-01-07T18:38:36 | 2020-01-07T18:38:36 | 232,259,809 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.siweisoft.heavycenter.module.upunit.titletip;
import com.summer.x.base.ui.VA;
public class TitleTipVA extends VA {
} | UTF-8 | Java | 133 | java | TitleTipVA.java | Java | [] | null | [] | package com.siweisoft.heavycenter.module.upunit.titletip;
import com.summer.x.base.ui.VA;
public class TitleTipVA extends VA {
} | 133 | 0.781955 | 0.781955 | 8 | 15.75 | 21.199942 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 0 |
0fcda9857a62239ea2ef28cd7d1bf2e3353bcd9b | 32,650,341,408,226 | a6f0dc137c13a40ae00fb9038071189f1a84eb46 | /src/com/p2p/service/impl/LoansServiceImpl.java | b1d7a7f62a1eed5d2d526639a58a6ab96985901e | [] | no_license | acgnwang/ServiceP2p | https://github.com/acgnwang/ServiceP2p | 8890e071a461ed1ede4cee8cb395ad6d7241b896 | 2afc4560bfe7e2264b3c15eadb6aa664fccc4305 | refs/heads/master | 2023-02-05T18:42:25.727000 | 2018-01-25T08:40:54 | 2018-01-25T08:40:54 | 118,886,429 | 0 | 0 | null | false | 2020-12-31T09:06:43 | 2018-01-25T08:42:05 | 2018-01-25T08:51:12 | 2020-12-31T09:06:40 | 39,287 | 0 | 1 | 1 | Java | false | false | package com.p2p.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.p2p.mapper.LoansMapper;
import com.p2p.pojo.Loans;
import com.p2p.services.LoansService;
@Transactional
@Service
public class LoansServiceImpl implements LoansService{
@Resource
private LoansMapper loansmapp;
@Override
public List<Loans> list() {
return loansmapp.list();
}
@Override
public void add(Loans t) {
loansmapp.add(t);
}
@Override
public void delete(Integer id) {
loansmapp.delete(id);
}
@Override
public void update(Loans t) {
loansmapp.update(t);
}
@Override
public Loans getById(Integer id) {
return loansmapp.getById(id);
}
}
| UTF-8 | Java | 837 | java | LoansServiceImpl.java | Java | [] | null | [] | package com.p2p.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.p2p.mapper.LoansMapper;
import com.p2p.pojo.Loans;
import com.p2p.services.LoansService;
@Transactional
@Service
public class LoansServiceImpl implements LoansService{
@Resource
private LoansMapper loansmapp;
@Override
public List<Loans> list() {
return loansmapp.list();
}
@Override
public void add(Loans t) {
loansmapp.add(t);
}
@Override
public void delete(Integer id) {
loansmapp.delete(id);
}
@Override
public void update(Loans t) {
loansmapp.update(t);
}
@Override
public Loans getById(Integer id) {
return loansmapp.getById(id);
}
}
| 837 | 0.713262 | 0.708483 | 46 | 16.195652 | 16.324987 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.934783 | false | false | 0 |
4112d6cfa1933e293580e4ab510df72635b5ec17 | 18,760,417,170,402 | 3f8b03449662d6bf7f438b57a245b7723db4b416 | /appiumFirst/src/test/java/setup/setup.java | 39bf940e9b178915cd67ed943a94c04f448d68c2 | [] | no_license | AnuMI4/appiumFirst | https://github.com/AnuMI4/appiumFirst | a8bc131a8f4e3cf2758096f774a328ef884af9ed | 6c0bb0f752ff099eb1e3b93a26165ac3f3231462 | refs/heads/master | 2023-02-07T02:54:45.291000 | 2020-02-05T19:35:56 | 2020-02-05T19:35:56 | 238,400,846 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package setup;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeSuite;
import java.net.MalformedURLException;
import java.net.URL;
public class setup {
public WebDriver driver;
@BeforeSuite
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9");
capabilities.setCapability("appPackage", "com.sec.android.app.popupcalculator");
capabilities.setCapability("appActivity", "com.sec.android.app.popupcalculator.Calculator");
driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
}
}
| UTF-8 | Java | 1,138 | java | setup.java | Java | [] | null | [] | package setup;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.BeforeSuite;
import java.net.MalformedURLException;
import java.net.URL;
public class setup {
public WebDriver driver;
@BeforeSuite
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9");
capabilities.setCapability("appPackage", "com.sec.android.app.popupcalculator");
capabilities.setCapability("appActivity", "com.sec.android.app.popupcalculator.Calculator");
driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
}
}
| 1,138 | 0.764499 | 0.75659 | 31 | 35.709679 | 33.863285 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.774194 | false | false | 0 |
6e061a00bca5e7e46e9661e4f4a4044c05f04720 | 18,760,417,171,213 | 492cfd7a41cf5cc244ad1fe47df6aec8adc37829 | /newstest2/app/src/main/java/com/example/lwjzsj/newstest2/NewsAdapter.java | d0d18f4e9a9fe4536a8754aa9a4afc2b58a7dfb2 | [] | no_license | lwjzsj/myprogram | https://github.com/lwjzsj/myprogram | b18dd87f71a880ec5130e349abd419d186ab2000 | 894471590d40ccecdaf4dbd749992a6d5cb007ab | refs/heads/master | 2021-01-18T18:53:15.116000 | 2017-05-11T01:11:45 | 2017-05-11T01:11:45 | 86,876,336 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.lwjzsj.newstest2;
import android.content.Context;
import android.support.v7.widget.LinearLayoutCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
/**
* Created by lwjzsj on 2017/3/27.
*/
public class NewsAdapter extends ArrayAdapter<News> {
private int resorceId;
public NewsAdapter(Context context, int resorce, List<News> object){
super(context,resorce,object);
resorceId = resorce;
}
@Override
public View getView(int position, View conventView, ViewGroup viewGroup){
News news = getItem(position);
View view;
if(conventView == null){
view = LayoutInflater.from(getContext()).inflate(resorceId,null);
}else{
view = conventView;
}
TextView textView = (TextView)view.findViewById(R.id.news_title);
textView.setText(news.getNewsTitle());
return view;
}
}
| UTF-8 | Java | 1,052 | java | NewsAdapter.java | Java | [
{
"context": "package com.example.lwjzsj.newstest2;\n\nimport android.content.Context;\nimpor",
"end": 26,
"score": 0.9318826198577881,
"start": 20,
"tag": "USERNAME",
"value": "lwjzsj"
},
{
"context": "xtView;\n\nimport java.util.List;\n\n/**\n * Created by lwjzsj on 2017/3/27.\n */... | null | [] | package com.example.lwjzsj.newstest2;
import android.content.Context;
import android.support.v7.widget.LinearLayoutCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
/**
* Created by lwjzsj on 2017/3/27.
*/
public class NewsAdapter extends ArrayAdapter<News> {
private int resorceId;
public NewsAdapter(Context context, int resorce, List<News> object){
super(context,resorce,object);
resorceId = resorce;
}
@Override
public View getView(int position, View conventView, ViewGroup viewGroup){
News news = getItem(position);
View view;
if(conventView == null){
view = LayoutInflater.from(getContext()).inflate(resorceId,null);
}else{
view = conventView;
}
TextView textView = (TextView)view.findViewById(R.id.news_title);
textView.setText(news.getNewsTitle());
return view;
}
}
| 1,052 | 0.688213 | 0.679658 | 38 | 26.68421 | 22.606596 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false | 0 |
52402716a0b36b4921ef2ffda08a4ba6fd2ad2c2 | 34,437,047,796,320 | db009f41bd031815294cbd1831e972b31d7d5ff6 | /SelectionCommittee/src/main/java/by/training/nc/dev3/factories/DaoFactoryImpl.java | 63f94ec0acf0921860705774233ca6dea6cb22a4 | [] | no_license | yalov4uk/Selection-committee-1 | https://github.com/yalov4uk/Selection-committee-1 | 4055bffdbdb22faf7019afd7361cc7417713fa1c | 9509a9f4a58699481719e9f83597cdee40fcba14 | refs/heads/master | 2021-06-24T19:44:06.839000 | 2017-04-26T18:36:34 | 2017-04-26T18:36:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.training.nc.dev3.factories;
import by.training.nc.dev3.exceptions.DaoUncheckedException;
import by.training.nc.dev3.initializers.BoneCPConfInitializer;
import by.training.nc.dev3.initializers.DaoFactoryInitializer;
import by.training.nc.dev3.iterfaces.dao.BaseDao;
import by.training.nc.dev3.iterfaces.factories.DaoFactory;
import by.training.nc.dev3.iterfaces.factories.creators.DaoCreator;
import com.jolbox.bonecp.BoneCP;
import java.sql.SQLException;
import java.util.Map;
/**
* Created by Valera Yalov4uk on 4/14/2017.
*/
public class DaoFactoryImpl implements DaoFactory {
private static BoneCP pool;
private Map<Class, DaoCreator> map;
private DaoFactoryImpl(BoneCP pool) {
this.pool = pool;
map = DaoFactoryInitializer.initialize();
}
public BaseDao getDao(Class name){
if (name != null && map.containsKey(name)) {
return map.get(name).create(pool);
}
return null;
}
private static DaoFactory ourInstance;
public static DaoFactory getInstance() {
if (ourInstance == null) {
try {
Class.forName("com.mysql.jdbc.Driver");
pool = new BoneCP(BoneCPConfInitializer.initialize());
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Cannot find the driver in the classpath!", e);
} catch (SQLException e) {
throw new DaoUncheckedException("BoneCP init error");
}
ourInstance = new DaoFactoryImpl(pool);
}
return ourInstance;
}
}
| UTF-8 | Java | 1,607 | java | DaoFactoryImpl.java | Java | [
{
"context": "xception;\nimport java.util.Map;\n\n/**\n * Created by Valera Yalov4uk on 4/14/2017.\n */\npublic class DaoFactoryImpl imp",
"end": 524,
"score": 0.9998663663864136,
"start": 509,
"tag": "NAME",
"value": "Valera Yalov4uk"
}
] | null | [] | package by.training.nc.dev3.factories;
import by.training.nc.dev3.exceptions.DaoUncheckedException;
import by.training.nc.dev3.initializers.BoneCPConfInitializer;
import by.training.nc.dev3.initializers.DaoFactoryInitializer;
import by.training.nc.dev3.iterfaces.dao.BaseDao;
import by.training.nc.dev3.iterfaces.factories.DaoFactory;
import by.training.nc.dev3.iterfaces.factories.creators.DaoCreator;
import com.jolbox.bonecp.BoneCP;
import java.sql.SQLException;
import java.util.Map;
/**
* Created by <NAME> on 4/14/2017.
*/
public class DaoFactoryImpl implements DaoFactory {
private static BoneCP pool;
private Map<Class, DaoCreator> map;
private DaoFactoryImpl(BoneCP pool) {
this.pool = pool;
map = DaoFactoryInitializer.initialize();
}
public BaseDao getDao(Class name){
if (name != null && map.containsKey(name)) {
return map.get(name).create(pool);
}
return null;
}
private static DaoFactory ourInstance;
public static DaoFactory getInstance() {
if (ourInstance == null) {
try {
Class.forName("com.mysql.jdbc.Driver");
pool = new BoneCP(BoneCPConfInitializer.initialize());
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Cannot find the driver in the classpath!", e);
} catch (SQLException e) {
throw new DaoUncheckedException("BoneCP init error");
}
ourInstance = new DaoFactoryImpl(pool);
}
return ourInstance;
}
}
| 1,598 | 0.667704 | 0.65837 | 50 | 31.139999 | 24.303095 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 0 |
5e930392bdd461d32717ae49fec38d944b9a3fa3 | 6,768,868,478,114 | 07f103d8c98d246b468b72bc54482ffe7cbde7ca | /test/src/main/java/com/icourt/app/loading/test/AlphaStateActivity.java | ab2d3e7f76791e3f3a8ff3db319d4a8df5f411fd | [] | no_license | icourt-android/alpha-loading | https://github.com/icourt-android/alpha-loading | 10c0adb99503a827fedebd6252c01ca31cf28a9c | 1c01ee6c55c00f9b648f75cdf62c891b83807fc6 | refs/heads/master | 2018-11-14T00:29:08.789000 | 2018-09-06T12:15:30 | 2018-09-06T12:15:30 | 108,635,639 | 2 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.icourt.app.loading.test;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.icourt.loading.AlphaStateLayout;
import static com.icourt.loading.ViewState.VIEW_STATE_CONTENT;
import static com.icourt.loading.ViewState.VIEW_STATE_EMPTY;
import static com.icourt.loading.ViewState.VIEW_STATE_ERROR;
import static com.icourt.loading.ViewState.VIEW_STATE_LOADING;
/**
* @author youxuan E-mail:xuanyouwu@163.com
* @version 2.2.1
* @Description
* @Company Beijing icourt
* @date createTime:2017/11/14
*/
public class AlphaStateActivity extends AppCompatActivity {
private ListView mList;
private AlphaStateLayout mAlphaStateLayout;
RadioGroup radioGroup;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alpha_state);
initView();
}
private void initView() {
mList = (ListView) findViewById(R.id.list);
mAlphaStateLayout = (AlphaStateLayout) findViewById(R.id.alphaStateLayout);
mAlphaStateLayout.setErrorRetryListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "rety", Toast.LENGTH_SHORT).show();
}
});
String[] data = new String[100];
for (int i = 0; i < 100; i++) {
data[i] = "Row " + i;
}
mList.setAdapter(new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, data));
radioGroup = findViewById(R.id.radioGroup);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
mAlphaStateLayout.setContentLoadingCoexist(checkedId == R.id.radio0);
mAlphaStateLayout.setContentEmptyCoexist(checkedId == R.id.radio1);
}
});
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(AlphaStateActivity.this,"xxx"+System.currentTimeMillis(),Toast.LENGTH_SHORT).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_state, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
for (int i = 0; i < mAlphaStateLayout.getChildCount(); i++) {
View childAt = mAlphaStateLayout.getChildAt(i);
Log.d("------------>child:", "" + i + " c:" + childAt);
}
switch (item.getItemId()) {
case R.id.error:
mAlphaStateLayout.setViewState(VIEW_STATE_ERROR);
return true;
case R.id.empty:
mAlphaStateLayout.setViewState(VIEW_STATE_EMPTY);
return true;
case R.id.content:
mAlphaStateLayout.setViewState(VIEW_STATE_CONTENT);
return true;
case R.id.loading:
mAlphaStateLayout.setViewState(VIEW_STATE_LOADING);
return true;
default:
break;
}
return super.onOptionsItemSelected(item);
}
}
| UTF-8 | Java | 3,774 | java | AlphaStateActivity.java | Java | [
{
"context": "ding.ViewState.VIEW_STATE_LOADING;\n\n/**\n * @author youxuan E-mail:xuanyouwu@163.com\n * @version 2.2.1\n * @D",
"end": 747,
"score": 0.9992273449897766,
"start": 740,
"tag": "USERNAME",
"value": "youxuan"
},
{
"context": "EW_STATE_LOADING;\n\n/**\n * @author youxuan... | null | [] | package com.icourt.app.loading.test;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.icourt.loading.AlphaStateLayout;
import static com.icourt.loading.ViewState.VIEW_STATE_CONTENT;
import static com.icourt.loading.ViewState.VIEW_STATE_EMPTY;
import static com.icourt.loading.ViewState.VIEW_STATE_ERROR;
import static com.icourt.loading.ViewState.VIEW_STATE_LOADING;
/**
* @author youxuan E-mail:<EMAIL>
* @version 2.2.1
* @Description
* @Company Beijing icourt
* @date createTime:2017/11/14
*/
public class AlphaStateActivity extends AppCompatActivity {
private ListView mList;
private AlphaStateLayout mAlphaStateLayout;
RadioGroup radioGroup;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alpha_state);
initView();
}
private void initView() {
mList = (ListView) findViewById(R.id.list);
mAlphaStateLayout = (AlphaStateLayout) findViewById(R.id.alphaStateLayout);
mAlphaStateLayout.setErrorRetryListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "rety", Toast.LENGTH_SHORT).show();
}
});
String[] data = new String[100];
for (int i = 0; i < 100; i++) {
data[i] = "Row " + i;
}
mList.setAdapter(new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_list_item_1, data));
radioGroup = findViewById(R.id.radioGroup);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
mAlphaStateLayout.setContentLoadingCoexist(checkedId == R.id.radio0);
mAlphaStateLayout.setContentEmptyCoexist(checkedId == R.id.radio1);
}
});
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(AlphaStateActivity.this,"xxx"+System.currentTimeMillis(),Toast.LENGTH_SHORT).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_state, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
for (int i = 0; i < mAlphaStateLayout.getChildCount(); i++) {
View childAt = mAlphaStateLayout.getChildAt(i);
Log.d("------------>child:", "" + i + " c:" + childAt);
}
switch (item.getItemId()) {
case R.id.error:
mAlphaStateLayout.setViewState(VIEW_STATE_ERROR);
return true;
case R.id.empty:
mAlphaStateLayout.setViewState(VIEW_STATE_EMPTY);
return true;
case R.id.content:
mAlphaStateLayout.setViewState(VIEW_STATE_CONTENT);
return true;
case R.id.loading:
mAlphaStateLayout.setViewState(VIEW_STATE_LOADING);
return true;
default:
break;
}
return super.onOptionsItemSelected(item);
}
}
| 3,764 | 0.647932 | 0.641039 | 105 | 34.923809 | 27.284286 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.638095 | false | false | 0 |
5a4497cefb36659f2f59316d0fa56eaca0e7abc0 | 18,923,625,955,437 | 67c9b7c453141a16522bff61c41745582256d89d | /ui/src/main/java/io/jmix/ui/component/PaginationComponent.java | 8ac7b769e95ce7d424ec60278ce9e3894bbc960c | [
"Apache-2.0"
] | permissive | stvliu/jmix-ui | https://github.com/stvliu/jmix-ui | c96ff392bbdb1249316a771ed36d2c7573f226a1 | 2cabf5019becb2143449f97bd61a81df68b47979 | refs/heads/master | 2023-04-04T09:32:07.777000 | 2021-03-28T11:52:03 | 2021-03-28T11:52:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2020 Haulmont.
*
* 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 io.jmix.ui.component;
import io.jmix.core.common.event.Subscription;
import io.jmix.ui.UiProperties;
import io.jmix.ui.component.pagination.data.PaginationDataBinder;
import io.jmix.ui.UiComponentProperties;
import javax.annotation.Nullable;
import java.util.EventObject;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* Base interface for components that make a data binding to load data by pages.
*/
public interface PaginationComponent extends Component.BelongToFrame {
/**
* @return delegate which is used to get the total count of items.
*/
@Nullable
Supplier<Integer> getTotalCountDelegate();
/**
* Sets delegate which is used to get the total count of items. For instance:
* <pre>
* @Autowired
* private DataManager dataManager;
*
* @Install(to = "pagination", subject = "totalCountDelegate")
* private Integer paginationTotalCountDelegate() {
* return dataManager.loadValue("select count(e) from demo_User e", Integer.class).one();
* }
* </pre>
*/
void setTotalCountDelegate(@Nullable Supplier<Integer> totalCountDelegate);
/**
* @return a data binder
*/
@Nullable
PaginationDataBinder getDataBinder();
/**
* Sets a data binder. It is used for managing data loading and dividing data to pages.
*/
void setDataBinder(PaginationDataBinder dataBinder);
/**
* Adds before refresh listener. It is invoked when data should be refreshed after user actions:
* click on navigation buttons (next, last etc), change items per page value.
*
* @return a registration object for removing an event listener
*/
Subscription addBeforeRefreshListener(Consumer<BeforeRefreshEvent> listener);
/**
* Adds after refresh listener. It is invoked when data is refreshed.
*
* @return a registration object for removing an event listener
*/
Subscription addAfterRefreshListener(Consumer<AfterRefreshEvent> listener);
/**
* @return true if items per page ComboBox is visible
*/
boolean isItemsPerPageVisible();
/**
* Sets visibility of items per page ComboBox. This ComboBox contains options to limit the number
* of items for one page. If custom options are not set component will use
* {@link UiComponentProperties#getPaginationItemsPerPageOptions()}. The default value is {@code false}.
*/
void setItemsPerPageVisible(boolean itemsPerPageVisible);
/**
* @return {@code true} if unlimited (null) option should be visible in the items per page ComboBox.
*/
boolean isItemsPerPageUnlimitedOptionVisible();
/**
* Sets visibility of unlimited (null) option value in the items per page ComboBox. If unlimited (null) option
* is selected component will try to load data with {@link UiProperties#getEntityMaxFetchSize(String)} limitation.
* The default value is {@code true}.
*/
void setItemsPerPageUnlimitedOptionVisible(boolean unlimitedOptionVisible);
/**
* @return items per page options.
*/
List<Integer> getItemsPerPageOptions();
/**
* Sets items per page options which should be used in the ComboBox. Options less than or equal to 0
* are ignored, options greater than entity's max fetch size will be replaced by it.
*
* @param options items per page options
* @see UiProperties#getEntityMaxFetchSize(String)
*/
void setItemsPerPageOptions(List<Integer> options);
/**
* @return items per page default value or {@code null}
*/
@Nullable
Integer getItemsPerPageDefaultValue();
/**
* Sets default value for the items per page ComboBox.
*/
void setItemsPerPageDefaultValue(@Nullable Integer defaultValue);
/**
* The event that is fired before refreshing the data when the user clicks next, previous, etc.
* <br>
* You can prevent the data container refresh by invoking {@link BeforeRefreshEvent#preventRefresh()},
* for example:
* <pre>{@code
* usersTable.getPagination().addBeforeRefreshListener(refreshEvent -> {
* // check modified data and prevent refresh
* refreshEvent.preventRefresh();
* });
* }</pre>
*/
class BeforeRefreshEvent extends EventObject {
protected boolean refreshPrevented = false;
public BeforeRefreshEvent(PaginationComponent source) {
super(source);
}
@Override
public PaginationComponent getSource() {
return (PaginationComponent) super.getSource();
}
/**
* If invoked, the component will not refresh the data container.
*/
public void preventRefresh() {
refreshPrevented = true;
}
public boolean isRefreshPrevented() {
return refreshPrevented;
}
}
/**
* The event that is fired after data refresh.
*/
class AfterRefreshEvent extends EventObject {
public AfterRefreshEvent(PaginationComponent source) {
super(source);
}
@Override
public PaginationComponent getSource() {
return (PaginationComponent) super.getSource();
}
}
}
| UTF-8 | Java | 5,910 | java | PaginationComponent.java | Java | [] | null | [] | /*
* Copyright 2020 Haulmont.
*
* 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 io.jmix.ui.component;
import io.jmix.core.common.event.Subscription;
import io.jmix.ui.UiProperties;
import io.jmix.ui.component.pagination.data.PaginationDataBinder;
import io.jmix.ui.UiComponentProperties;
import javax.annotation.Nullable;
import java.util.EventObject;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* Base interface for components that make a data binding to load data by pages.
*/
public interface PaginationComponent extends Component.BelongToFrame {
/**
* @return delegate which is used to get the total count of items.
*/
@Nullable
Supplier<Integer> getTotalCountDelegate();
/**
* Sets delegate which is used to get the total count of items. For instance:
* <pre>
* @Autowired
* private DataManager dataManager;
*
* @Install(to = "pagination", subject = "totalCountDelegate")
* private Integer paginationTotalCountDelegate() {
* return dataManager.loadValue("select count(e) from demo_User e", Integer.class).one();
* }
* </pre>
*/
void setTotalCountDelegate(@Nullable Supplier<Integer> totalCountDelegate);
/**
* @return a data binder
*/
@Nullable
PaginationDataBinder getDataBinder();
/**
* Sets a data binder. It is used for managing data loading and dividing data to pages.
*/
void setDataBinder(PaginationDataBinder dataBinder);
/**
* Adds before refresh listener. It is invoked when data should be refreshed after user actions:
* click on navigation buttons (next, last etc), change items per page value.
*
* @return a registration object for removing an event listener
*/
Subscription addBeforeRefreshListener(Consumer<BeforeRefreshEvent> listener);
/**
* Adds after refresh listener. It is invoked when data is refreshed.
*
* @return a registration object for removing an event listener
*/
Subscription addAfterRefreshListener(Consumer<AfterRefreshEvent> listener);
/**
* @return true if items per page ComboBox is visible
*/
boolean isItemsPerPageVisible();
/**
* Sets visibility of items per page ComboBox. This ComboBox contains options to limit the number
* of items for one page. If custom options are not set component will use
* {@link UiComponentProperties#getPaginationItemsPerPageOptions()}. The default value is {@code false}.
*/
void setItemsPerPageVisible(boolean itemsPerPageVisible);
/**
* @return {@code true} if unlimited (null) option should be visible in the items per page ComboBox.
*/
boolean isItemsPerPageUnlimitedOptionVisible();
/**
* Sets visibility of unlimited (null) option value in the items per page ComboBox. If unlimited (null) option
* is selected component will try to load data with {@link UiProperties#getEntityMaxFetchSize(String)} limitation.
* The default value is {@code true}.
*/
void setItemsPerPageUnlimitedOptionVisible(boolean unlimitedOptionVisible);
/**
* @return items per page options.
*/
List<Integer> getItemsPerPageOptions();
/**
* Sets items per page options which should be used in the ComboBox. Options less than or equal to 0
* are ignored, options greater than entity's max fetch size will be replaced by it.
*
* @param options items per page options
* @see UiProperties#getEntityMaxFetchSize(String)
*/
void setItemsPerPageOptions(List<Integer> options);
/**
* @return items per page default value or {@code null}
*/
@Nullable
Integer getItemsPerPageDefaultValue();
/**
* Sets default value for the items per page ComboBox.
*/
void setItemsPerPageDefaultValue(@Nullable Integer defaultValue);
/**
* The event that is fired before refreshing the data when the user clicks next, previous, etc.
* <br>
* You can prevent the data container refresh by invoking {@link BeforeRefreshEvent#preventRefresh()},
* for example:
* <pre>{@code
* usersTable.getPagination().addBeforeRefreshListener(refreshEvent -> {
* // check modified data and prevent refresh
* refreshEvent.preventRefresh();
* });
* }</pre>
*/
class BeforeRefreshEvent extends EventObject {
protected boolean refreshPrevented = false;
public BeforeRefreshEvent(PaginationComponent source) {
super(source);
}
@Override
public PaginationComponent getSource() {
return (PaginationComponent) super.getSource();
}
/**
* If invoked, the component will not refresh the data container.
*/
public void preventRefresh() {
refreshPrevented = true;
}
public boolean isRefreshPrevented() {
return refreshPrevented;
}
}
/**
* The event that is fired after data refresh.
*/
class AfterRefreshEvent extends EventObject {
public AfterRefreshEvent(PaginationComponent source) {
super(source);
}
@Override
public PaginationComponent getSource() {
return (PaginationComponent) super.getSource();
}
}
}
| 5,910 | 0.678003 | 0.675804 | 180 | 31.833334 | 31.72337 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.283333 | false | false | 0 |
2db576f683a40525f0033a82b62dd554fcb64f0f | 18,923,625,954,608 | f01e7ea88018e3b265e75d9848dd1da4cfc25036 | /ecwms/src/main/java/com/luolai/ecwms/model/efast/SystemInventoryLog.java | 3d3524b18c6ad0b674860cc9b4f020e8ca0c95bd | [] | no_license | 84665206/myRepository | https://github.com/84665206/myRepository | 20be14ee13a105b73028e26b00418933ebd816f5 | bebc0c92625934537cdd8bc7b08f1b9b2f89aef8 | refs/heads/master | 2018-03-29T10:39:04.546000 | 2017-08-09T04:04:29 | 2017-08-09T04:04:29 | 87,689,471 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.luolai.ecwms.model.efast;
import java.util.Date;
import com.luolai.ecwms.model.BaseModel;
public class SystemInventoryLog extends BaseModel {
private static final long serialVersionUID = 1L;
private String orderType;
private String orderSn;
private String desc;
private String barcode;
private Integer goodsId;
private String goodsSn;
private Integer colorId;
private String colorCode;
private Integer sizeId;
private String sizeCode;
private Integer ckId;
private String kcType;
private Integer num;
private Integer kcNew;
private Integer sl;
private Date addTime;
public String getOrderType() {
return orderType;
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public String getOrderSn() {
return orderSn;
}
public void setOrderSn(String orderSn) {
this.orderSn = orderSn;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public Integer getGoodsId() {
return goodsId;
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
public String getGoodsSn() {
return goodsSn;
}
public void setGoodsSn(String goodsSn) {
this.goodsSn = goodsSn;
}
public Integer getColorId() {
return colorId;
}
public void setColorId(Integer colorId) {
this.colorId = colorId;
}
public String getColorCode() {
return colorCode;
}
public void setColorCode(String colorCode) {
this.colorCode = colorCode;
}
public Integer getSizeId() {
return sizeId;
}
public void setSizeId(Integer sizeId) {
this.sizeId = sizeId;
}
public String getSizeCode() {
return sizeCode;
}
public void setSizeCode(String sizeCode) {
this.sizeCode = sizeCode;
}
public Integer getCkId() {
return ckId;
}
public void setCkId(Integer ckId) {
this.ckId = ckId;
}
public String getKcType() {
return kcType;
}
public void setKcType(String kcType) {
this.kcType = kcType;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getKcNew() {
return kcNew;
}
public void setKcNew(Integer kcNew) {
this.kcNew = kcNew;
}
public Integer getSl() {
return sl;
}
public void setSl(Integer sl) {
this.sl = sl;
}
public Date getAddTime() {
return addTime;
}
public void setAddTime(Date addTime) {
this.addTime = addTime;
}
}
| UTF-8 | Java | 2,604 | java | SystemInventoryLog.java | Java | [] | null | [] | package com.luolai.ecwms.model.efast;
import java.util.Date;
import com.luolai.ecwms.model.BaseModel;
public class SystemInventoryLog extends BaseModel {
private static final long serialVersionUID = 1L;
private String orderType;
private String orderSn;
private String desc;
private String barcode;
private Integer goodsId;
private String goodsSn;
private Integer colorId;
private String colorCode;
private Integer sizeId;
private String sizeCode;
private Integer ckId;
private String kcType;
private Integer num;
private Integer kcNew;
private Integer sl;
private Date addTime;
public String getOrderType() {
return orderType;
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public String getOrderSn() {
return orderSn;
}
public void setOrderSn(String orderSn) {
this.orderSn = orderSn;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public Integer getGoodsId() {
return goodsId;
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
public String getGoodsSn() {
return goodsSn;
}
public void setGoodsSn(String goodsSn) {
this.goodsSn = goodsSn;
}
public Integer getColorId() {
return colorId;
}
public void setColorId(Integer colorId) {
this.colorId = colorId;
}
public String getColorCode() {
return colorCode;
}
public void setColorCode(String colorCode) {
this.colorCode = colorCode;
}
public Integer getSizeId() {
return sizeId;
}
public void setSizeId(Integer sizeId) {
this.sizeId = sizeId;
}
public String getSizeCode() {
return sizeCode;
}
public void setSizeCode(String sizeCode) {
this.sizeCode = sizeCode;
}
public Integer getCkId() {
return ckId;
}
public void setCkId(Integer ckId) {
this.ckId = ckId;
}
public String getKcType() {
return kcType;
}
public void setKcType(String kcType) {
this.kcType = kcType;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getKcNew() {
return kcNew;
}
public void setKcNew(Integer kcNew) {
this.kcNew = kcNew;
}
public Integer getSl() {
return sl;
}
public void setSl(Integer sl) {
this.sl = sl;
}
public Date getAddTime() {
return addTime;
}
public void setAddTime(Date addTime) {
this.addTime = addTime;
}
}
| 2,604 | 0.683948 | 0.683564 | 123 | 19.170732 | 13.846844 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.609756 | false | false | 0 |
3a789c8626bf52fbc8bc19f18773376c3d248d4a | 34,153,579,960,447 | 1c3d75eabd3f6a45c7e987d221e6c4763cf85fef | /pinyougou-page-service/src/main/java/com/pinyougou/page/service/impl/ItemPageDeleteListener.java | 65479930458235064248050c06f37d62fbfb70ef | [] | no_license | jpower/pinyougou | https://github.com/jpower/pinyougou | b02f05c9048d7669d07079b3e79863e2275d7bbf | 055ce10c82ef5a95366a615c45cfc574604a691d | refs/heads/master | 2020-05-02T11:47:09.582000 | 2019-03-27T07:22:30 | 2019-03-27T07:22:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pinyougou.page.service.impl;
import com.pinyougou.page.service.ItemPageService;
import org.aspectj.lang.annotation.Around;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
/**
* Created by 周大侠
* 2018-12-15 11:19
*/
@Component
public class ItemPageDeleteListener implements MessageListener {
@Autowired
private ItemPageService itemPageService;
@Override
public void onMessage(Message message) {
ObjectMessage objectMessage = (ObjectMessage) message;
try {
boolean b = itemPageService.deleItemHtml((Long) objectMessage.getObject());
System.out.println(b);
} catch (JMSException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 953 | java | ItemPageDeleteListener.java | Java | [
{
"context": "mport javax.jms.ObjectMessage;\n\n/**\n * Created by 周大侠\n * 2018-12-15 11:19\n */\n@Component\npublic class",
"end": 439,
"score": 0.5456029176712036,
"start": 438,
"tag": "USERNAME",
"value": "周"
},
{
"context": "port javax.jms.ObjectMessage;\n\n/**\n * Created by 周大侠... | null | [] | package com.pinyougou.page.service.impl;
import com.pinyougou.page.service.ItemPageService;
import org.aspectj.lang.annotation.Around;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
/**
* Created by 周大侠
* 2018-12-15 11:19
*/
@Component
public class ItemPageDeleteListener implements MessageListener {
@Autowired
private ItemPageService itemPageService;
@Override
public void onMessage(Message message) {
ObjectMessage objectMessage = (ObjectMessage) message;
try {
boolean b = itemPageService.deleItemHtml((Long) objectMessage.getObject());
System.out.println(b);
} catch (JMSException e) {
e.printStackTrace();
}
}
}
| 953 | 0.733896 | 0.721225 | 32 | 28.59375 | 22.12586 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.46875 | false | false | 0 |
4c4447680c27e3c9836ac6953a7e475d30272ffe | 32,624,571,643,070 | c329d19f199cd40f75fe52e8a3e705b78a15dca3 | /src/ca/uqam/inf2120/labos/file/tda/impl/FileTableauImpl.java | 438187b1eefa1ddf5dbc28cd86b5581851b81d4d | [] | no_license | bittorpiron/coursJavaUqam | https://github.com/bittorpiron/coursJavaUqam | 8cea21256cc2371182a8a11f65a6f5ab2e7ac976 | e770b8a4fa3e8457c86ad568b00668ab36a047a4 | refs/heads/master | 2021-04-28T19:46:07.970000 | 2018-02-18T18:05:17 | 2018-02-18T18:05:17 | 121,905,087 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ca.uqam.inf2120.labos.file.tda.impl;
import ca.uqam.inf2120.labos.file.tda.File;
import ca.uqam.inf2120.labos.file.tda.FileVideException;
/**
* FileTableauImpl<T> implémente l'interface File<T>
* avec un tableau de taille statique.
*
* @author Ismael Doukoure / Gloire Lomani
* @version Février 2014.
*
*/
public class FileTableauImpl<T> implements File<T> {
// Liste dans laquelle les éléments
// sont stockés.
public final int TAILLE_MAX = 25;
private T [] tableau;
private int nbElements;
/**
* Constructeur sans argument
*/
@SuppressWarnings("unchecked")
public FileTableauImpl() {
tableau = (T[])new Object[TAILLE_MAX];
nbElements = 0;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#enfiler(java.lang.Object)
*/
@Override
public void enfiler(T e) {
if (nbElements >= TAILLE_MAX) {
throw new FilePleineException("Aucune place pour ajouter un autre élément");
}
tableau[nbElements] = e;
nbElements++;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#defiler()
*/
@Override
public T defiler() throws FileVideException {
if (nbElements == 0) {
throw new FileVideException("Impossible de defiler dans une file vide");
}
T element = tableau[0];
for (int i = 0; i < nbElements - 1; i++) {
tableau[i] = tableau[i+1];
}
nbElements--;
tableau[nbElements] = null;
return element;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#estVide()
*/
@Override
public boolean estVide() {
return (nbElements == 0);
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#taille()
*/
@Override
public int taille() {
return nbElements;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#debut()
*/
@Override
public T debut() throws FileVideException {
if (estVide()) {
throw new FileVideException("Impossible de retourner le premier dans une file vide");
}
return tableau[0];
}
}
| ISO-8859-2 | Java | 2,024 | java | FileTableauImpl.java | Java | [
{
"context": "vec un tableau de taille statique.\n * \n * @author Ismael Doukoure / Gloire Lomani\n * @version Février 2014.\n * \n */",
"end": 275,
"score": 0.9998826384544373,
"start": 260,
"tag": "NAME",
"value": "Ismael Doukoure"
},
{
"context": "taille statique.\n * \n * @auth... | null | [] | package ca.uqam.inf2120.labos.file.tda.impl;
import ca.uqam.inf2120.labos.file.tda.File;
import ca.uqam.inf2120.labos.file.tda.FileVideException;
/**
* FileTableauImpl<T> implémente l'interface File<T>
* avec un tableau de taille statique.
*
* @author <NAME> / <NAME>
* @version Février 2014.
*
*/
public class FileTableauImpl<T> implements File<T> {
// Liste dans laquelle les éléments
// sont stockés.
public final int TAILLE_MAX = 25;
private T [] tableau;
private int nbElements;
/**
* Constructeur sans argument
*/
@SuppressWarnings("unchecked")
public FileTableauImpl() {
tableau = (T[])new Object[TAILLE_MAX];
nbElements = 0;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#enfiler(java.lang.Object)
*/
@Override
public void enfiler(T e) {
if (nbElements >= TAILLE_MAX) {
throw new FilePleineException("Aucune place pour ajouter un autre élément");
}
tableau[nbElements] = e;
nbElements++;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#defiler()
*/
@Override
public T defiler() throws FileVideException {
if (nbElements == 0) {
throw new FileVideException("Impossible de defiler dans une file vide");
}
T element = tableau[0];
for (int i = 0; i < nbElements - 1; i++) {
tableau[i] = tableau[i+1];
}
nbElements--;
tableau[nbElements] = null;
return element;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#estVide()
*/
@Override
public boolean estVide() {
return (nbElements == 0);
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#taille()
*/
@Override
public int taille() {
return nbElements;
}
/* (non-Javadoc)
* @see ca.uqam.inf2120.labos.file.tda.File#debut()
*/
@Override
public T debut() throws FileVideException {
if (estVide()) {
throw new FileVideException("Impossible de retourner le premier dans une file vide");
}
return tableau[0];
}
}
| 2,008 | 0.65295 | 0.630144 | 102 | 18.774509 | 20.70517 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.362745 | false | false | 0 |
b4dd5411f71e515f76e0d909406092d8785f041c | 5,291,399,745,977 | ccd80979f4faf30b6be7f491132e9febbb2c2519 | /revno.java | 29cbb2c10779c467a75bc68ecb562c2a702440c4 | [] | no_license | pratiksachaniya/SEM-4 | https://github.com/pratiksachaniya/SEM-4 | c4313e5c6ae80d4b7a9a792559a2a537724a2d5b | b122d58e3c0fe2facbb164dd6e5c01132df6a4b9 | refs/heads/master | 2020-04-17T06:55:48.134000 | 2020-04-12T09:34:07 | 2020-04-12T09:34:07 | 166,345,573 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
class revno
{
public static void main(String ar[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter Number:");
int no = sc.nextInt();
int rev = 0;
int tmp = no;
while(tmp != 0)
{
rev = rev * 10;
rev += tmp%10;
tmp = tmp / 10;
}
System.out.println("Revers Is " + rev);
}
} | UTF-8 | Java | 372 | java | revno.java | Java | [] | null | [] | import java.util.Scanner;
class revno
{
public static void main(String ar[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter Number:");
int no = sc.nextInt();
int rev = 0;
int tmp = no;
while(tmp != 0)
{
rev = rev * 10;
rev += tmp%10;
tmp = tmp / 10;
}
System.out.println("Revers Is " + rev);
}
} | 372 | 0.543011 | 0.521505 | 21 | 15.809524 | 13.573851 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.238095 | false | false | 0 |
f4dacb7f5d79a8797ead21595ede904b4ee86fd6 | 2,705,829,401,027 | beaea87d105a48b2e42cb175339958ce56e59583 | /CucumberHelloWorld/src/main/java/com/fourthsource/cucumberhelloworld/common/Driver.java | 792f32ab435b32b954bdf11668829f434871e2b3 | [] | no_license | julio-almanza/programA | https://github.com/julio-almanza/programA | 5938d560e92fa78ea471eee37cf1735c83ceaa89 | 2f0ae8582ea72d72cb9f4347b540ef284c9e924d | refs/heads/master | 2022-12-21T06:01:40.080000 | 2019-07-16T14:57:32 | 2019-07-16T14:57:32 | 191,438,639 | 0 | 0 | null | false | 2022-12-14T20:30:21 | 2019-06-11T19:42:47 | 2019-07-16T14:57:36 | 2022-12-14T20:30:17 | 9,254 | 0 | 0 | 14 | Java | false | false | package com.fourthsource.cucumberhelloworld.common;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public final class Driver {
private static WebDriver driver;
public static void openBrowser(String str_browsername) {
try {
switch(str_browsername) {
case "Chrome":
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\drivers\\chromedriver.exe");
driver = new ChromeDriver();
break;
case "Firefox":
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\drivers\\geckodriver.exe");
driver = new FirefoxDriver();
break;
}
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
public static void openWebSite(String str_url) {
driver.get(str_url);
}
public static WebElement findElement(By byDef) {
return (new WebDriverWait(driver, 20)).until(ExpectedConditions.presenceOfElementLocated(byDef));
}
public static List<WebElement> findElements(By byDef) {
return (new WebDriverWait(driver, 20)).until(ExpectedConditions.presenceOfAllElementsLocatedBy(byDef));
}
public static String getNameTitle() {
return driver.getTitle();
}
public static void getBack() {
driver.navigate().back();
}
public static void close() {
driver.close();
}
}
| UTF-8 | Java | 1,592 | java | Driver.java | Java | [] | null | [] | package com.fourthsource.cucumberhelloworld.common;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public final class Driver {
private static WebDriver driver;
public static void openBrowser(String str_browsername) {
try {
switch(str_browsername) {
case "Chrome":
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\drivers\\chromedriver.exe");
driver = new ChromeDriver();
break;
case "Firefox":
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\drivers\\geckodriver.exe");
driver = new FirefoxDriver();
break;
}
}catch(Exception e) {
System.out.println(e.getMessage());
}
}
public static void openWebSite(String str_url) {
driver.get(str_url);
}
public static WebElement findElement(By byDef) {
return (new WebDriverWait(driver, 20)).until(ExpectedConditions.presenceOfElementLocated(byDef));
}
public static List<WebElement> findElements(By byDef) {
return (new WebDriverWait(driver, 20)).until(ExpectedConditions.presenceOfAllElementsLocatedBy(byDef));
}
public static String getNameTitle() {
return driver.getTitle();
}
public static void getBack() {
driver.navigate().back();
}
public static void close() {
driver.close();
}
}
| 1,592 | 0.73304 | 0.730528 | 58 | 26.448277 | 28.700098 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.068965 | false | false | 0 |
306a18f496111b1a0b939bda165e0b9c65b6ba61 | 9,981,504,062,059 | 88b130d5ff52d96248d8b946cfb0faaadb731769 | /document/src/test/java/com/yahoo/document/NumericDataTypeTestCase.java | 3298ac4f2cad19de735049dd649aca25af9c69e1 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | vespa-engine/vespa | https://github.com/vespa-engine/vespa | b8cfe266de7f9a9be6f2557c55bef52c3a9d7cdb | 1f8213997718c25942c38402202ae9e51572d89f | refs/heads/master | 2023-08-16T21:01:12.296000 | 2023-08-16T17:03:08 | 2023-08-16T17:03:08 | 60,377,070 | 4,889 | 619 | Apache-2.0 | false | 2023-09-14T21:02:11 | 2016-06-03T20:54:20 | 2023-09-13T10:32:22 | 2023-09-14T21:02:10 | 374,107 | 4,645 | 545 | 162 | Java | false | false | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;
import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.IntegerFieldValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.fail;
/**
* @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
* @since 5.1.10
*/
public class NumericDataTypeTestCase {
@Test
public void basic() {
NumericDataType type = new NumericDataType("foo", 0, FieldValue.class, IntegerFieldValue.getFactory());
NumericDataType clonedType = type.clone();
assertEquals(type,clonedType);
assertNotSame(type, clonedType);
}
@Test
public void create() {
try {
new NumericDataType("foo", 0, IntegerFieldValue.class, IntegerFieldValue.getFactory()).createFieldValue(new Object());
fail();
} catch (IllegalArgumentException e) {
assertEquals("Class class java.lang.Object not applicable to an class " +
"com.yahoo.document.datatypes.IntegerFieldValue instance.", e.getMessage());
}
}
}
| UTF-8 | Java | 1,271 | java | NumericDataTypeTestCase.java | Java | [
{
"context": "unit.Assert.fail;\n\n/**\n * @author <a href=\"mailto:einarmr@yahoo-inc.com\">Einar M R Rosenvinge</a>\n * @since 5.1.10\n */\npu",
"end": 442,
"score": 0.9999106526374817,
"start": 421,
"tag": "EMAIL",
"value": "einarmr@yahoo-inc.com"
},
{
"context": " * @author <a hre... | null | [] | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;
import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.IntegerFieldValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.fail;
/**
* @author <a href="mailto:<EMAIL>"><NAME></a>
* @since 5.1.10
*/
public class NumericDataTypeTestCase {
@Test
public void basic() {
NumericDataType type = new NumericDataType("foo", 0, FieldValue.class, IntegerFieldValue.getFactory());
NumericDataType clonedType = type.clone();
assertEquals(type,clonedType);
assertNotSame(type, clonedType);
}
@Test
public void create() {
try {
new NumericDataType("foo", 0, IntegerFieldValue.class, IntegerFieldValue.getFactory()).createFieldValue(new Object());
fail();
} catch (IllegalArgumentException e) {
assertEquals("Class class java.lang.Object not applicable to an class " +
"com.yahoo.document.datatypes.IntegerFieldValue instance.", e.getMessage());
}
}
}
| 1,243 | 0.688434 | 0.68214 | 36 | 34.305557 | 34.828804 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.638889 | false | false | 0 |
794a2518386240246dbbd57519a1e237d2c336c8 | 21,268,678,050,052 | e2171ad810384af43f7b5a88bfb6bdfd2ee20bea | /Application-Challenge/【瓜瓜队】狼人杀/langrensha/app/src/main/java/com/qgmodel/qggame/model/RoomModel.java | bd2bb0159c7ded7a9d571342da6d0f73196c5f6b | [
"MIT"
] | permissive | AgoraIO-Community/RTE-2021-Innovation-Challenge | https://github.com/AgoraIO-Community/RTE-2021-Innovation-Challenge | 249965c82697d1b248f39fbf2df6a3cbd6de6c78 | 558c96cf0f029fb02188ca83f60920c89afd210f | refs/heads/master | 2022-07-25T12:27:17.937000 | 2022-01-21T12:58:11 | 2022-01-21T12:58:11 | 355,093,340 | 36 | 128 | null | false | 2021-11-07T17:13:28 | 2021-04-06T07:12:11 | 2021-09-04T00:30:16 | 2021-06-08T08:03:27 | 1,941,910 | 24 | 80 | 6 | C++ | false | false | package com.qgmodel.qggame.model;
import com.qgmodel.qggame.entity.RoomInfo;
import com.qgmodel.qggame.model.exception.RoomException;
import java.util.List;
/**
* Room 业务接口
* @see com.qgmodel.qggame.model.impl.RoomModelImpl
* Created by HeYanLe on 2020/8/8 0008 16:52.
* https://github.com/heyanLE
*/
public interface RoomModel {
public interface OnGetAll{
void all(List<RoomInfo> rooms);
}
void deleteRoom(String roomerId);
void getAll(OnGetAll onGetAll) ;
/**
* 创建新房间
* @return 新房间实体
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
RoomInfo create() throws RoomException;
/**
* 获取当前房间
* @return 房间实体
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
RoomInfo now() throws RoomException;
/**
* 进入房间
* @param roomId 房间 Id
* @return 房间实体
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
RoomInfo enter(long roomId) throws RoomException;
/**
* 退出房间
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
void exit() throws RoomException;
}
| UTF-8 | Java | 1,435 | java | RoomModel.java | Java | [
{
"context": "odel.qggame.model.impl.RoomModelImpl\n * Created by HeYanLe on 2020/8/8 0008 16:52.\n * https://github.co",
"end": 245,
"score": 0.4939476549625397,
"start": 243,
"tag": "NAME",
"value": "He"
},
{
"context": "l.qggame.model.impl.RoomModelImpl\n * Created by HeYanLe on 2... | null | [] | package com.qgmodel.qggame.model;
import com.qgmodel.qggame.entity.RoomInfo;
import com.qgmodel.qggame.model.exception.RoomException;
import java.util.List;
/**
* Room 业务接口
* @see com.qgmodel.qggame.model.impl.RoomModelImpl
* Created by HeYanLe on 2020/8/8 0008 16:52.
* https://github.com/heyanLE
*/
public interface RoomModel {
public interface OnGetAll{
void all(List<RoomInfo> rooms);
}
void deleteRoom(String roomerId);
void getAll(OnGetAll onGetAll) ;
/**
* 创建新房间
* @return 新房间实体
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
RoomInfo create() throws RoomException;
/**
* 获取当前房间
* @return 房间实体
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
RoomInfo now() throws RoomException;
/**
* 进入房间
* @param roomId 房间 Id
* @return 房间实体
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
RoomInfo enter(long roomId) throws RoomException;
/**
* 退出房间
* @throws RoomException 异常
* @see com.qgmodel.qggame.model.exception.RoomException.RoomExceptionEnum
*/
void exit() throws RoomException;
}
| 1,435 | 0.66344 | 0.653016 | 57 | 22.561403 | 22.399889 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.192982 | false | false | 0 |
26a51810fbaaeb9e21bd9e1790cf9d25f1ad7c17 | 26,465,588,547,470 | bd2e9fcb13b01071111b2ca141ecd568e33c35dc | /src/main/java/chapter02/section02/thread_2_2_8/pro_1_synchronizedBlockLockAll/test1/MyObject.java | 0abde7ebee9900e27acf5eec8e524294a12d1e7c | [
"Apache-2.0"
] | permissive | turoDog/java-multi-thread-programming | https://github.com/turoDog/java-multi-thread-programming | 59bf392bcea73da7f5f43c06ff35e87a4b127f8a | cb0d5e1735577fb76e57ec2b53d692c8063d6d66 | refs/heads/master | 2020-09-03T12:47:58.686000 | 2019-12-03T15:19:19 | 2019-12-03T15:19:19 | 219,465,626 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package chapter02.section02.thread_2_2_8.pro_1_synchronizedBlockLockAll.test1;
/**
* Project Name:java-multi-thread-programming <br/>
* Package Name:chapter02.section02.thread_2_2_8.pro_1_synchronizedBlockLockAll.test1 <br/>
* Date:2019/11/17 14:19 <br/>
*
* @author <a href="turodog@foxmail.com">chenzy</a><br/>
*/
public class MyObject {
}
| UTF-8 | Java | 349 | java | MyObject.java | Java | [
{
"context": "ate:2019/11/17 14:19 <br/>\n *\n * @author <a href=\"turodog@foxmail.com\">chenzy</a><br/>\n */\npublic class MyObject {\n}\n",
"end": 301,
"score": 0.9999198913574219,
"start": 282,
"tag": "EMAIL",
"value": "turodog@foxmail.com"
},
{
"context": "<br/>\n *\n * @author <... | null | [] | package chapter02.section02.thread_2_2_8.pro_1_synchronizedBlockLockAll.test1;
/**
* Project Name:java-multi-thread-programming <br/>
* Package Name:chapter02.section02.thread_2_2_8.pro_1_synchronizedBlockLockAll.test1 <br/>
* Date:2019/11/17 14:19 <br/>
*
* @author <a href="<EMAIL>">chenzy</a><br/>
*/
public class MyObject {
}
| 337 | 0.724928 | 0.638968 | 11 | 30.727272 | 31.863604 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | false | false | 0 |
7619fb27aab4200e909ba42875829d64c8acfc12 | 11,845,519,850,889 | d4788bf20fa78da1df1a020040b0d10d9c0892f0 | /src/fragments/old/RegistrationOhNoFragment.java | 797bf3875c2fb60ce98eb1ccd9dfada02a3cd3e8 | [
"MIT"
] | permissive | Lundakarnevalen/futural-intern-android | https://github.com/Lundakarnevalen/futural-intern-android | 0aa8a06e000de5f16b043f502570c965798cf56e | 9f3bdb05f2ac54bf5e91684875a0a4975303e62c | refs/heads/master | 2021-05-01T05:01:19.049000 | 2016-11-09T20:26:03 | 2016-11-09T20:26:03 | 15,144,670 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //package fragments.old;
//
//import fragments.LKFragment;
//import fragments.SignInFragment;
//import se.lundakarnevalen.android.R;
//import se.lundakarnevalen.android.R.id;
//import se.lundakarnevalen.android.R.layout;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//
//
//public class RegistrationOhNoFragment extends LKFragment{
// //View loginButton;
// View registerButton;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
// View root = inflater.inflate(R.layout.registration_oh_no_layout, null);
// //loginButton = root.findViewById(R.id.login_text);
// registerButton = root.findViewById(R.id.register);
// return root;
// }
//
// @Override
// public void onActivityCreated(Bundle savedInstanceState){
// super.onActivityCreated(savedInstanceState);
// showActionBarLogo(true);
// /*if(loginButton != null)
// loginButton.setOnClickListener(loginClick);*/
// if(registerButton != null)
// registerButton.setOnClickListener(registerClick);
// }
//
// @Override
// public void onResume(){
// super.onResume();
// Log.d(LOG_TAG, "onResume");
// // check if user
// LKFragment fragment = getStartFragment(getContext());
// if(!(fragment instanceof RegistrationOhNoFragment)){
// Log.d(LOG_TAG, "change fragment!");
// loadFragment(fragment, false);
// }
// }
//
// View.OnClickListener registerClick = new View.OnClickListener() {
//
// @Override
// public void onClick(View v) {
// LKFragment fragment = new RegistrationFragment();
// loadFragment(fragment, true);
// }
// };
//
// View.OnClickListener loginClick = new View.OnClickListener() {
// @Override
// public void onClick(View arg0) {
// LKFragment fragment = new SignInFragment();
// loadFragment(fragment, true);//HAX
// }
// };
//}
| UTF-8 | Java | 1,920 | java | RegistrationOhNoFragment.java | Java | [] | null | [] | //package fragments.old;
//
//import fragments.LKFragment;
//import fragments.SignInFragment;
//import se.lundakarnevalen.android.R;
//import se.lundakarnevalen.android.R.id;
//import se.lundakarnevalen.android.R.layout;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//
//
//public class RegistrationOhNoFragment extends LKFragment{
// //View loginButton;
// View registerButton;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
// View root = inflater.inflate(R.layout.registration_oh_no_layout, null);
// //loginButton = root.findViewById(R.id.login_text);
// registerButton = root.findViewById(R.id.register);
// return root;
// }
//
// @Override
// public void onActivityCreated(Bundle savedInstanceState){
// super.onActivityCreated(savedInstanceState);
// showActionBarLogo(true);
// /*if(loginButton != null)
// loginButton.setOnClickListener(loginClick);*/
// if(registerButton != null)
// registerButton.setOnClickListener(registerClick);
// }
//
// @Override
// public void onResume(){
// super.onResume();
// Log.d(LOG_TAG, "onResume");
// // check if user
// LKFragment fragment = getStartFragment(getContext());
// if(!(fragment instanceof RegistrationOhNoFragment)){
// Log.d(LOG_TAG, "change fragment!");
// loadFragment(fragment, false);
// }
// }
//
// View.OnClickListener registerClick = new View.OnClickListener() {
//
// @Override
// public void onClick(View v) {
// LKFragment fragment = new RegistrationFragment();
// loadFragment(fragment, true);
// }
// };
//
// View.OnClickListener loginClick = new View.OnClickListener() {
// @Override
// public void onClick(View arg0) {
// LKFragment fragment = new SignInFragment();
// loadFragment(fragment, true);//HAX
// }
// };
//}
| 1,920 | 0.707812 | 0.707292 | 65 | 28.538462 | 22.040575 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.938462 | false | false | 0 |
64b328c945643f9333e73b7710759d957b5bb7da | 29,729,763,689,976 | a558577f696adb44ffaa7fac58ebc822e7bf6998 | /src/main/java/org/mule/modules/trello/bean/Memberships.java | 86d097e2c56b9cde2f5f88af85c368c16166a5a9 | [] | no_license | surender-eidiko/Trello-Connector | https://github.com/surender-eidiko/Trello-Connector | aa4e35606db30d1983868aad8ad875cb1ef1794f | 887a0f202b25f286673b873b8002f992e3bdca0b | refs/heads/master | 2020-04-12T07:28:56.321000 | 2017-01-17T10:31:47 | 2017-01-17T10:31:47 | 58,519,321 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package org.mule.modules.trello.bean;
// TODO: Auto-generated Javadoc
/**
* The Class Memberships.
*/
public class Memberships {
/** The id. */
private String _id;
/** The org member type. */
private String orgMemberType;
/**
* Gets the org member type.
*
* @return the org member type
*/
public String getOrgMemberType() {
return orgMemberType;
}
/**
* Sets the org member type.
*
* @param orgMemberType th Se new org member type
*/
public void setOrgMemberType(String orgMemberType) {
this.orgMemberType = orgMemberType;
}
public String get_id() {
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
/** The id member. */
private String idMember;
/** The member type. */
private String memberType;
/** The unconfirmed. */
private Boolean unconfirmed;
/** The deactivated. */
private Boolean deactivated;
/**
* Gets the deactivated.
*
* @return the deactivated
*/
public Boolean getDeactivated() {
return deactivated;
}
/**
* Sets the deactivated.
*
* @param deactivated the new deactivated
*/
public void setDeactivated(Boolean deactivated) {
this.deactivated = deactivated;
}
/**
* Gets the id member.
*
* @return the id member
*/
public String getIdMember ()
{
return idMember;
}
/**
* Sets the id member.
*
* @param idMember the new id member
*/
public void setIdMember (String idMember)
{
this.idMember = idMember;
}
/**
* Gets the member type.
*
* @return the member type
*/
public String getMemberType ()
{
return memberType;
}
/**
* Sets the member type.
*
* @param memberType the new member type
*/
public void setMemberType (String memberType)
{
this.memberType = memberType;
}
/**
* Gets the unconfirmed.
*
* @return the unconfirmed
*/
public Boolean getUnconfirmed ()
{
return unconfirmed;
}
/**
* Sets the unconfirmed.
*
* @param unconfirmed the new unconfirmed
*/
public void setUnconfirmed (Boolean unconfirmed)
{
this.unconfirmed = unconfirmed;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
return "ClassPojo [id = "+_id+", idMember = "+idMember+", memberType = "+memberType+", unconfirmed = "+unconfirmed+"]";
}
}
| UTF-8 | Java | 2,566 | java | Memberships.java | Java | [] | null | [] | /**
*
*/
package org.mule.modules.trello.bean;
// TODO: Auto-generated Javadoc
/**
* The Class Memberships.
*/
public class Memberships {
/** The id. */
private String _id;
/** The org member type. */
private String orgMemberType;
/**
* Gets the org member type.
*
* @return the org member type
*/
public String getOrgMemberType() {
return orgMemberType;
}
/**
* Sets the org member type.
*
* @param orgMemberType th Se new org member type
*/
public void setOrgMemberType(String orgMemberType) {
this.orgMemberType = orgMemberType;
}
public String get_id() {
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
/** The id member. */
private String idMember;
/** The member type. */
private String memberType;
/** The unconfirmed. */
private Boolean unconfirmed;
/** The deactivated. */
private Boolean deactivated;
/**
* Gets the deactivated.
*
* @return the deactivated
*/
public Boolean getDeactivated() {
return deactivated;
}
/**
* Sets the deactivated.
*
* @param deactivated the new deactivated
*/
public void setDeactivated(Boolean deactivated) {
this.deactivated = deactivated;
}
/**
* Gets the id member.
*
* @return the id member
*/
public String getIdMember ()
{
return idMember;
}
/**
* Sets the id member.
*
* @param idMember the new id member
*/
public void setIdMember (String idMember)
{
this.idMember = idMember;
}
/**
* Gets the member type.
*
* @return the member type
*/
public String getMemberType ()
{
return memberType;
}
/**
* Sets the member type.
*
* @param memberType the new member type
*/
public void setMemberType (String memberType)
{
this.memberType = memberType;
}
/**
* Gets the unconfirmed.
*
* @return the unconfirmed
*/
public Boolean getUnconfirmed ()
{
return unconfirmed;
}
/**
* Sets the unconfirmed.
*
* @param unconfirmed the new unconfirmed
*/
public void setUnconfirmed (Boolean unconfirmed)
{
this.unconfirmed = unconfirmed;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
return "ClassPojo [id = "+_id+", idMember = "+idMember+", memberType = "+memberType+", unconfirmed = "+unconfirmed+"]";
}
}
| 2,566 | 0.575994 | 0.575994 | 144 | 16.819445 | 17.630724 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 0 |
c5e00a9ef2251bddef28024900f5bb1b7266a95a | 21,569,325,807,398 | a6206ff369b3f7cb1d7676c73ca9b3d3bfe4c84a | /domain/src/main/java/com/shamildev/retro/domain/core/DomainObject.java | de862a5c4072aa72f46dccab88bca9142b885381 | [] | no_license | lazargit/Retro2.0 | https://github.com/lazargit/Retro2.0 | 2406f704dc1e1b1faab950567e94a1626eaf7058 | e1373af9cefe0a96d1a905aa6962e8bd1dc7b2de | refs/heads/master | 2020-03-29T09:29:42.902000 | 2018-10-25T21:40:14 | 2018-10-25T21:40:14 | 147,552,013 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.shamildev.retro.domain.core;
public interface DomainObject {
}
| UTF-8 | Java | 81 | java | DomainObject.java | Java | [] | null | [] | package com.shamildev.retro.domain.core;
public interface DomainObject {
}
| 81 | 0.753086 | 0.753086 | 8 | 9 | 15.467709 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | false | false | 0 |
69756f2afee98bee2678a3424160c94573e9a2fe | 3,573,412,848,101 | a8f0e401f5f9132b544c47d620d8d6453ed93027 | /src/fi/jjc/graphics/gui/GUIComponent.java | 38a2dbf2f1af6402654da58fce155215416474fa | [] | no_license | Kipt/JJC | https://github.com/Kipt/JJC | 3139aa372f40cdbd90c10b0b079852246bf9d115 | e0f541f43b3e0acdc485ff5a94949b87fbec9b31 | refs/heads/master | 2016-08-03T04:03:41.413000 | 2012-02-29T07:25:00 | 2012-02-29T07:25:00 | 3,548,025 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package fi.jjc.graphics.gui;
import java.awt.geom.Rectangle2D;
import java.util.HashMap;
import java.util.Map;
import org.lwjgl.opengl.GL11;
/**
* Component's abstract base class.
*
* @author Jens ┼kerblom
*/
public abstract class GUIComponent
{
/**
* Children of this component.
*/
private Map<GUIComponent, Rectangle2D> children = new HashMap<>();
/**
* Paints this component using relative coordinates (in unit vector space). This method is
* called by paint.
*/
protected abstract void paintComponent();
/**
* Paints this component, should be called from GUIHandler with root as start to set
* coordination system.
*/
final void paint()
{
this.paintComponent();
for (GUIComponent child : this.children.keySet())
{
GL11.glPushMatrix();
{
double w = this.children.get(child).getWidth();
double h = this.children.get(child).getHeight();
double left = this.children.get(child).getX();
double down = this.children.get(child).getY();
GL11.glTranslated(left, down, 0.0);
GL11.glScaled(w, h, 1.0);
child.paint();
}
GL11.glPopMatrix();
}
}
/**
* Adds child component.
*
* @param comp
* component to add.
* @param relSpace
* the position of the new component relative to this.
*/
public final void add(GUIComponent comp, Rectangle2D relSpace)
{
this.children.put(comp, relSpace);
}
/**
* Removes a component.
*
* @param comp
* component to remove.
*/
public final void remove(GUIComponent comp)
{
this.children.remove(comp);
}
}
| IBM852 | Java | 1,596 | java | GUIComponent.java | Java | [
{
"context": " * Component's abstract base class.\n * \n * @author Jens ┼kerblom\n */\npublic abstract class GUIComponent\n{\n\t/**\n\t *",
"end": 224,
"score": 0.9998506903648376,
"start": 211,
"tag": "NAME",
"value": "Jens ┼kerblom"
}
] | null | [] | /**
*
*/
package fi.jjc.graphics.gui;
import java.awt.geom.Rectangle2D;
import java.util.HashMap;
import java.util.Map;
import org.lwjgl.opengl.GL11;
/**
* Component's abstract base class.
*
* @author <NAME>
*/
public abstract class GUIComponent
{
/**
* Children of this component.
*/
private Map<GUIComponent, Rectangle2D> children = new HashMap<>();
/**
* Paints this component using relative coordinates (in unit vector space). This method is
* called by paint.
*/
protected abstract void paintComponent();
/**
* Paints this component, should be called from GUIHandler with root as start to set
* coordination system.
*/
final void paint()
{
this.paintComponent();
for (GUIComponent child : this.children.keySet())
{
GL11.glPushMatrix();
{
double w = this.children.get(child).getWidth();
double h = this.children.get(child).getHeight();
double left = this.children.get(child).getX();
double down = this.children.get(child).getY();
GL11.glTranslated(left, down, 0.0);
GL11.glScaled(w, h, 1.0);
child.paint();
}
GL11.glPopMatrix();
}
}
/**
* Adds child component.
*
* @param comp
* component to add.
* @param relSpace
* the position of the new component relative to this.
*/
public final void add(GUIComponent comp, Rectangle2D relSpace)
{
this.children.put(comp, relSpace);
}
/**
* Removes a component.
*
* @param comp
* component to remove.
*/
public final void remove(GUIComponent comp)
{
this.children.remove(comp);
}
}
| 1,587 | 0.650565 | 0.6399 | 80 | 18.924999 | 21.30245 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4375 | false | false | 0 |
c4d771299ace8873f96299039d2e9e15edda5598 | 8,186,207,677,790 | ff6c7f8942a5aefb5a6aec7018c7c1776ed0482c | /src/com/yasia/batch/configuration/Jpa2FileBatchConfig.java | f70b8057a106120c713fedf41a0e95ad28244e2c | [] | no_license | yzhlin/SpringBatchPractice | https://github.com/yzhlin/SpringBatchPractice | 6452b5d1ffcbf858ca005823ff0a96b127ac9c4a | 49087345fc1721bee88a134728615253f9b28ac1 | refs/heads/master | 2021-09-03T15:15:15.440000 | 2018-01-10T02:14:12 | 2018-01-10T02:14:12 | 116,771,784 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yasia.batch.configuration;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.file.FlatFileItemWriter;
import org.springframework.batch.item.file.transform.LineAggregator;
import org.springframework.batch.item.support.ListItemReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.FileSystemResource;
import com.yasia.batch.model.Student;
import com.yasia.batch.repository.StudentRepository;
/**
* Demo13
* @author LinYunZhi
* @since 2018-01-09 00:18:30
*/
//@Configuration
public class Jpa2FileBatchConfig {
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
StudentRepository studentRepository;
@Bean ListItemReader<Student> reader(){
return new ListItemReader<>(studentRepository.findAll());
}
@Bean Step jpa2FileStep() throws Exception {
return this.stepBuilderFactory.get("jpa2FileStep")
.<Student, Student>chunk(5)
.reader(reader())
//.processor(processor())
.writer(db2TxtFileWriter())
.allowStartIfComplete(true)
.build();
}
@Bean public ItemWriter<Student> db2TxtFileWriter() throws Exception{
FlatFileItemWriter<Student> writer = new FlatFileItemWriter<Student>();
writer.setLineAggregator(new StudentAggregator());//setLineAggregator是必须的
writer.setLineSeparator("\t\n");
String workFolder = System.getProperty("user.dir");
writer.setResource(new FileSystemResource(workFolder.concat("/output/data.txt")));
writer.afterPropertiesSet();//用于校验必须初始化的属性
System.err.println("writer to file: "+workFolder.concat("/output/data.txt"));
return writer;
}
public class StudentAggregator implements LineAggregator<Student>{
@Override
public String aggregate(Student item) {
return item.getId()+","+item.getName()+","+item.getAge()
+","+item.getGrade()+","+item.getCourses()+","+item.getScore()
+","+item.getMemo();
}
}
@Bean Job jpa2FileJob() throws Exception {
return this.jobBuilderFactory.get("jpa2FileJob")
.start(jpa2FileStep())
.build();
}
}
| UTF-8 | Java | 2,517 | java | Jpa2FileBatchConfig.java | Java | [
{
"context": "itory.StudentRepository;\n\n/**\n * Demo13\n * @author LinYunZhi\n * @since 2018-01-09 00:18:30\n */\n//@Configuratio",
"end": 894,
"score": 0.9997897148132324,
"start": 885,
"tag": "NAME",
"value": "LinYunZhi"
}
] | null | [] | package com.yasia.batch.configuration;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.file.FlatFileItemWriter;
import org.springframework.batch.item.file.transform.LineAggregator;
import org.springframework.batch.item.support.ListItemReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.FileSystemResource;
import com.yasia.batch.model.Student;
import com.yasia.batch.repository.StudentRepository;
/**
* Demo13
* @author LinYunZhi
* @since 2018-01-09 00:18:30
*/
//@Configuration
public class Jpa2FileBatchConfig {
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
StudentRepository studentRepository;
@Bean ListItemReader<Student> reader(){
return new ListItemReader<>(studentRepository.findAll());
}
@Bean Step jpa2FileStep() throws Exception {
return this.stepBuilderFactory.get("jpa2FileStep")
.<Student, Student>chunk(5)
.reader(reader())
//.processor(processor())
.writer(db2TxtFileWriter())
.allowStartIfComplete(true)
.build();
}
@Bean public ItemWriter<Student> db2TxtFileWriter() throws Exception{
FlatFileItemWriter<Student> writer = new FlatFileItemWriter<Student>();
writer.setLineAggregator(new StudentAggregator());//setLineAggregator是必须的
writer.setLineSeparator("\t\n");
String workFolder = System.getProperty("user.dir");
writer.setResource(new FileSystemResource(workFolder.concat("/output/data.txt")));
writer.afterPropertiesSet();//用于校验必须初始化的属性
System.err.println("writer to file: "+workFolder.concat("/output/data.txt"));
return writer;
}
public class StudentAggregator implements LineAggregator<Student>{
@Override
public String aggregate(Student item) {
return item.getId()+","+item.getName()+","+item.getAge()
+","+item.getGrade()+","+item.getCourses()+","+item.getScore()
+","+item.getMemo();
}
}
@Bean Job jpa2FileJob() throws Exception {
return this.jobBuilderFactory.get("jpa2FileJob")
.start(jpa2FileStep())
.build();
}
}
| 2,517 | 0.77505 | 0.76499 | 77 | 31.272728 | 25.985828 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.558442 | false | false | 0 |
12384ba2b4449ac6597236fd9ef42a0901a7c17f | 17,703,855,194,849 | ff973a21288ac88df6a083d297f379d7c67d9519 | /app/src/main/java/com/blumonplay/cesarcruz/pruebatecnica/FragQuizNumerico.java | eaded9cbbdefa7b6a53e0c9e2d485ef29fe2ec35 | [] | no_license | neurosistemas/PruebaTecnica | https://github.com/neurosistemas/PruebaTecnica | 83590750bf7193a8d267567f4bc797c574789dd2 | 2780ee746cf972d507a02d762ad07c3a0a662fdb | refs/heads/master | 2020-03-19T07:11:08.886000 | 2018-06-04T21:41:33 | 2018-06-04T21:41:33 | 136,094,233 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.blumonplay.cesarcruz.pruebatecnica;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class FragQuizNumerico extends Fragment implements View.OnClickListener{
public QuizNumericoListener listener;
public TextView titulo;
public EditText numero;
public TextView suma;
public Button agregarBtn;
private ArrayList<Double> listaNumeros;
private double contador;
private boolean puedeGuardar;
public FragQuizNumerico() {
// Required empty public constructor
}
public static FragQuizNumerico newInstance(String param1, String param2) {
FragQuizNumerico fragment = new FragQuizNumerico();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
listaNumeros=new ArrayList<>();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_quiz_numerico, container, false);
titulo = v.findViewById(R.id.quiz_num_titulo);
suma = v.findViewById(R.id.quiz_num_suma);
agregarBtn = v.findViewById(R.id.quiz_num_agregar);
numero = v.findViewById(R.id.quiz_num_edittext);
titulo.setText(getString(R.string.quiz_numerico_1));
agregarBtn.setText(getString(R.string.agregar));
suma.setVisibility(View.INVISIBLE);
puedeGuardar = false;
agregarBtn.setOnClickListener(this);
return v;
}
public void evaluarNumero(){
String numTxt = numero.getText().toString();
titulo.setText(CambiarTitulo(numTxt));
if(numTxt.equals("0")){
suma.setVisibility(View.VISIBLE);
int sumaTotal =0;
for(int i =0; i<listaNumeros.size(); i++){ sumaTotal+=listaNumeros.get(i); }
suma.setText(String.valueOf(sumaTotal));
numero.setText("");
puedeGuardar = true;
agregarBtn.setText(getString(R.string.guardar_json));
numero.setVisibility(View.INVISIBLE);
titulo.setText(getText(R.string.quiz_numerico_sumatotal));
} else if(!numTxt.equals("")){
listaNumeros.add(Double.parseDouble(numTxt));
suma.setText("");
numero.setText("");
}
}
private void ResetearDatos(){
suma.setText("0");
suma.setVisibility(View.INVISIBLE);
numero.setVisibility(View.VISIBLE);
contador=0;
numero.setText("");
agregarBtn.setText(getString(R.string.agregar));
puedeGuardar = false;
titulo.setText(getString(R.string.quiz_numerico_1));
}
private String CambiarTitulo(String txt){
String msg ="";
if(txt.equals("")){
msg = getString(R.string.quiz_numerico_alerta);
}
else {
if(contador==0){msg = getString(R.string.quiz_numerico_1);}
else{msg = getString(R.string.quiz_numerico_2);}
}
return msg;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof QuizNumericoListener) {
listener = (QuizNumericoListener) context;
}
}
@Override
public void onDetach() {
super.onDetach();
listener=null;
ResetearDatos();
Log.d("quizNumerico","onDetach");
}
@Override
public void onClick(View v) {
if(puedeGuardar){listener.guardarNumerosJSON(listaNumeros);
listaNumeros=new ArrayList<>();
}
else{ evaluarNumero();}
}
public interface QuizNumericoListener {
void interaccionNumericaListener();
void guardarNumerosJSON(ArrayList<Double> numeros);
}
}
| UTF-8 | Java | 4,360 | java | FragQuizNumerico.java | Java | [] | null | [] | package com.blumonplay.cesarcruz.pruebatecnica;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class FragQuizNumerico extends Fragment implements View.OnClickListener{
public QuizNumericoListener listener;
public TextView titulo;
public EditText numero;
public TextView suma;
public Button agregarBtn;
private ArrayList<Double> listaNumeros;
private double contador;
private boolean puedeGuardar;
public FragQuizNumerico() {
// Required empty public constructor
}
public static FragQuizNumerico newInstance(String param1, String param2) {
FragQuizNumerico fragment = new FragQuizNumerico();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
listaNumeros=new ArrayList<>();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_quiz_numerico, container, false);
titulo = v.findViewById(R.id.quiz_num_titulo);
suma = v.findViewById(R.id.quiz_num_suma);
agregarBtn = v.findViewById(R.id.quiz_num_agregar);
numero = v.findViewById(R.id.quiz_num_edittext);
titulo.setText(getString(R.string.quiz_numerico_1));
agregarBtn.setText(getString(R.string.agregar));
suma.setVisibility(View.INVISIBLE);
puedeGuardar = false;
agregarBtn.setOnClickListener(this);
return v;
}
public void evaluarNumero(){
String numTxt = numero.getText().toString();
titulo.setText(CambiarTitulo(numTxt));
if(numTxt.equals("0")){
suma.setVisibility(View.VISIBLE);
int sumaTotal =0;
for(int i =0; i<listaNumeros.size(); i++){ sumaTotal+=listaNumeros.get(i); }
suma.setText(String.valueOf(sumaTotal));
numero.setText("");
puedeGuardar = true;
agregarBtn.setText(getString(R.string.guardar_json));
numero.setVisibility(View.INVISIBLE);
titulo.setText(getText(R.string.quiz_numerico_sumatotal));
} else if(!numTxt.equals("")){
listaNumeros.add(Double.parseDouble(numTxt));
suma.setText("");
numero.setText("");
}
}
private void ResetearDatos(){
suma.setText("0");
suma.setVisibility(View.INVISIBLE);
numero.setVisibility(View.VISIBLE);
contador=0;
numero.setText("");
agregarBtn.setText(getString(R.string.agregar));
puedeGuardar = false;
titulo.setText(getString(R.string.quiz_numerico_1));
}
private String CambiarTitulo(String txt){
String msg ="";
if(txt.equals("")){
msg = getString(R.string.quiz_numerico_alerta);
}
else {
if(contador==0){msg = getString(R.string.quiz_numerico_1);}
else{msg = getString(R.string.quiz_numerico_2);}
}
return msg;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof QuizNumericoListener) {
listener = (QuizNumericoListener) context;
}
}
@Override
public void onDetach() {
super.onDetach();
listener=null;
ResetearDatos();
Log.d("quizNumerico","onDetach");
}
@Override
public void onClick(View v) {
if(puedeGuardar){listener.guardarNumerosJSON(listaNumeros);
listaNumeros=new ArrayList<>();
}
else{ evaluarNumero();}
}
public interface QuizNumericoListener {
void interaccionNumericaListener();
void guardarNumerosJSON(ArrayList<Double> numeros);
}
}
| 4,360 | 0.632798 | 0.629817 | 137 | 30.824818 | 22.003284 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.613139 | false | false | 0 |
b54caee00e5efab5eba0032c0b7c89537f2a4715 | 10,531,259,866,463 | 38a9c1beb09ed1d9ff46f2b559f0bab34f0bccea | /obix/src/obix/asm/ConstantPool.java | e200a7b41cc9171609abb2e81659014be026116d | [] | no_license | namgk/rifidi | https://github.com/namgk/rifidi | 15afacabb38e479bf2628623dfb98d6e36190c1a | 8b2d12f76c2268bc8d155697d19786530f8bb72d | refs/heads/master | 2021-01-22T15:00:02.529000 | 2014-02-13T11:23:15 | 2014-02-13T11:23:15 | 28,006,629 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* This code licensed to public domain
*/
package obix.asm;
import java.lang.reflect.*;
import java.util.*;
/**
* @author Brian Frank
* @creation 15 Mar 00
* @version $Revision$ $Date: 9/9/2003 9:35:50 AM$
*/
public class ConstantPool
{
////////////////////////////////////////////////////////////////
// Index Access
////////////////////////////////////////////////////////////////
public int utf(String str)
{
Integer ref = (Integer)utfTable.get(str);
if (ref != null)
return ref.intValue();
buf.u1(Jvm.CONSTANT_Utf8);
buf.utf(str);
count++;
utfTable.put(str, new Integer(count));
return count;
}
public int cls(String className)
{
Integer ref = (Integer)classTable.get(className);
if (ref != null) return ref.intValue();
int i = utf(className);
buf.u1(Jvm.CONSTANT_Class);
buf.u2(i);
count++;
classTable.put(className, new Integer(count));
return count;
}
public int string(String str)
{
Integer ref = (Integer)stringTable.get(str);
if (ref != null) return ref.intValue();
int i = utf(str);
buf.u1(Jvm.CONSTANT_String);
buf.u2(i);
count++;
stringTable.put(str, new Integer(count));
return count;
}
public int integer(int i)
{
Integer ref = (Integer)integerTable.get(i);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Integer);
buf.u4(i);
count++;
integerTable.put(i, new Integer(count));
return count;
}
public int floatConst(float f)
{
Float key = new Float(f);
Integer ref = (Integer)floatTable.get(key);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Float);
buf.u4( Float.floatToIntBits(f) );
count++;
floatTable.put(key, new Integer(count));
return count;
}
public int doubleConst(double d)
{
Double key = new Double(d);
Integer ref = (Integer)doubleTable.get(key);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Double);
buf.u8( Double.doubleToLongBits(d) );
count++;
doubleTable.put(key, new Integer(count));
count++; // float entries use two slots
return count-1;
}
public int longConst(long lng)
{
Long key = new Long(lng);
Integer ref = (Integer)longTable.get(key);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Long);
buf.u8(lng);
count++;
longTable.put(key, new Integer(count));
count++; // long entries use two slots
return count-1;
}
public int nt(int name, int type)
{
int hash = name << 16 | type;
Integer ref = (Integer)fieldTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_NameAndType);
buf.u2(name);
buf.u2(type);
count++;
ntTable.put(hash, new Integer(count));
return count;
}
public int field(int cls, int nt)
{
int hash = cls << 16 | nt;
Integer ref = (Integer)fieldTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Fieldref);
buf.u2(cls);
buf.u2(nt);
count++;
fieldTable.put(hash, new Integer(count));
return count;
}
public int method(int cls, int nt)
{
int hash = cls << 16 | nt;
Integer ref = (Integer)methodTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Methodref);
buf.u2(cls);
buf.u2(nt);
count++;
methodTable.put(hash, new Integer(count));
return count;
}
public int iface(int cls, int nt)
{
int hash = cls << 16 | nt;
Integer ref = (Integer)ifaceTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_InterfaceMethodref);
buf.u2(cls);
buf.u2(nt);
count++;
ifaceTable.put(hash, new Integer(count));
return count;
}
////////////////////////////////////////////////////////////////
// Convenience
////////////////////////////////////////////////////////////////
public int cls(Class c)
{
return cls( c.getName().replace('.', '/') );
}
public int nt(int name, String type)
{
return nt( name, utf(type) );
}
public int nt(String name, String type)
{
return nt( utf(name), utf(type) );
}
public int method(int cls, int name, String type)
{
return method(cls, nt(name, type));
}
public int method(int cls, String name, String type)
{
return method(cls, nt(name, type));
}
public int method(String cls, String name, String type)
{
return method(cls(cls), nt(name, type));
}
public int method(Method m)
{
int cls = cls(m.getDeclaringClass());
int name = utf(m.getName());
int type = utf(Jvm.methodDescriptor(m.getParameterTypes(), m.getReturnType()));
return method(cls, nt(name, type));
}
public int iface(int cls, String name, String type)
{
return iface(cls, nt(name, type));
}
public int field(int cls, int name, String type)
{
return field(cls, nt(name, type));
}
public int field(int cls, String name, String type)
{
return field(cls, nt(name, type));
}
public int field(FieldInfo fi)
{
return field(fi.asm.thisClass, nt(fi.name, fi.type));
}
////////////////////////////////////////////////////////////////
// Fields
////////////////////////////////////////////////////////////////
Buffer buf = new Buffer();
int count = 0;
Hashtable utfTable = new Hashtable();
Hashtable classTable = new Hashtable();
Hashtable stringTable = new Hashtable();
Hashtable floatTable = new Hashtable();
Hashtable doubleTable = new Hashtable();
Hashtable longTable = new Hashtable();
IntHashMap integerTable = new IntHashMap();
IntHashMap ntTable = new IntHashMap();
IntHashMap fieldTable = new IntHashMap();
IntHashMap methodTable = new IntHashMap();
IntHashMap ifaceTable = new IntHashMap();
}
| UTF-8 | Java | 5,948 | java | ConstantPool.java | Java | [
{
"context": ".reflect.*;\nimport java.util.*;\n\n/**\n * @author Brian Frank\n * @creation 15 Mar 00\n * @version $Revision$ ",
"end": 143,
"score": 0.9997599720954895,
"start": 132,
"tag": "NAME",
"value": "Brian Frank"
},
{
"context": "int doubleConst(double d)\n {\n Dou... | null | [] | /*
* This code licensed to public domain
*/
package obix.asm;
import java.lang.reflect.*;
import java.util.*;
/**
* @author <NAME>
* @creation 15 Mar 00
* @version $Revision$ $Date: 9/9/2003 9:35:50 AM$
*/
public class ConstantPool
{
////////////////////////////////////////////////////////////////
// Index Access
////////////////////////////////////////////////////////////////
public int utf(String str)
{
Integer ref = (Integer)utfTable.get(str);
if (ref != null)
return ref.intValue();
buf.u1(Jvm.CONSTANT_Utf8);
buf.utf(str);
count++;
utfTable.put(str, new Integer(count));
return count;
}
public int cls(String className)
{
Integer ref = (Integer)classTable.get(className);
if (ref != null) return ref.intValue();
int i = utf(className);
buf.u1(Jvm.CONSTANT_Class);
buf.u2(i);
count++;
classTable.put(className, new Integer(count));
return count;
}
public int string(String str)
{
Integer ref = (Integer)stringTable.get(str);
if (ref != null) return ref.intValue();
int i = utf(str);
buf.u1(Jvm.CONSTANT_String);
buf.u2(i);
count++;
stringTable.put(str, new Integer(count));
return count;
}
public int integer(int i)
{
Integer ref = (Integer)integerTable.get(i);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Integer);
buf.u4(i);
count++;
integerTable.put(i, new Integer(count));
return count;
}
public int floatConst(float f)
{
Float key = new Float(f);
Integer ref = (Integer)floatTable.get(key);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Float);
buf.u4( Float.floatToIntBits(f) );
count++;
floatTable.put(key, new Integer(count));
return count;
}
public int doubleConst(double d)
{
Double key = new Double(d);
Integer ref = (Integer)doubleTable.get(key);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Double);
buf.u8( Double.doubleToLongBits(d) );
count++;
doubleTable.put(key, new Integer(count));
count++; // float entries use two slots
return count-1;
}
public int longConst(long lng)
{
Long key = new Long(lng);
Integer ref = (Integer)longTable.get(key);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Long);
buf.u8(lng);
count++;
longTable.put(key, new Integer(count));
count++; // long entries use two slots
return count-1;
}
public int nt(int name, int type)
{
int hash = name << 16 | type;
Integer ref = (Integer)fieldTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_NameAndType);
buf.u2(name);
buf.u2(type);
count++;
ntTable.put(hash, new Integer(count));
return count;
}
public int field(int cls, int nt)
{
int hash = cls << 16 | nt;
Integer ref = (Integer)fieldTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Fieldref);
buf.u2(cls);
buf.u2(nt);
count++;
fieldTable.put(hash, new Integer(count));
return count;
}
public int method(int cls, int nt)
{
int hash = cls << 16 | nt;
Integer ref = (Integer)methodTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_Methodref);
buf.u2(cls);
buf.u2(nt);
count++;
methodTable.put(hash, new Integer(count));
return count;
}
public int iface(int cls, int nt)
{
int hash = cls << 16 | nt;
Integer ref = (Integer)ifaceTable.get(hash);
if (ref != null) return ref.intValue();
buf.u1(Jvm.CONSTANT_InterfaceMethodref);
buf.u2(cls);
buf.u2(nt);
count++;
ifaceTable.put(hash, new Integer(count));
return count;
}
////////////////////////////////////////////////////////////////
// Convenience
////////////////////////////////////////////////////////////////
public int cls(Class c)
{
return cls( c.getName().replace('.', '/') );
}
public int nt(int name, String type)
{
return nt( name, utf(type) );
}
public int nt(String name, String type)
{
return nt( utf(name), utf(type) );
}
public int method(int cls, int name, String type)
{
return method(cls, nt(name, type));
}
public int method(int cls, String name, String type)
{
return method(cls, nt(name, type));
}
public int method(String cls, String name, String type)
{
return method(cls(cls), nt(name, type));
}
public int method(Method m)
{
int cls = cls(m.getDeclaringClass());
int name = utf(m.getName());
int type = utf(Jvm.methodDescriptor(m.getParameterTypes(), m.getReturnType()));
return method(cls, nt(name, type));
}
public int iface(int cls, String name, String type)
{
return iface(cls, nt(name, type));
}
public int field(int cls, int name, String type)
{
return field(cls, nt(name, type));
}
public int field(int cls, String name, String type)
{
return field(cls, nt(name, type));
}
public int field(FieldInfo fi)
{
return field(fi.asm.thisClass, nt(fi.name, fi.type));
}
////////////////////////////////////////////////////////////////
// Fields
////////////////////////////////////////////////////////////////
Buffer buf = new Buffer();
int count = 0;
Hashtable utfTable = new Hashtable();
Hashtable classTable = new Hashtable();
Hashtable stringTable = new Hashtable();
Hashtable floatTable = new Hashtable();
Hashtable doubleTable = new Hashtable();
Hashtable longTable = new Hashtable();
IntHashMap integerTable = new IntHashMap();
IntHashMap ntTable = new IntHashMap();
IntHashMap fieldTable = new IntHashMap();
IntHashMap methodTable = new IntHashMap();
IntHashMap ifaceTable = new IntHashMap();
}
| 5,943 | 0.567754 | 0.559011 | 260 | 21.876923 | 19.246185 | 83 | false | false | 0 | 0 | 0 | 0 | 76 | 0.072125 | 0.673077 | false | false | 0 |
2ebfa6d9f20135423de1885c04f8cf1dcd6ab036 | 18,580,028,588,632 | 142bf3f011821eabf27fe3cb4dd8d1ab1ece5d7a | /src/main/java/com/nmys/story/mapper/OptionMapper.java | d50d8c8322d6aa3db57f5f362f561074d8e32c24 | [
"Apache-2.0"
] | permissive | zhangjianbing777/MyStory | https://github.com/zhangjianbing777/MyStory | 8576565536b9e50b1df0754b80e94edb4b020851 | 3545d9c70cf5556d9865354cba0d97e0f4e59088 | refs/heads/master | 2022-06-23T10:05:26.118000 | 2019-09-03T06:15:38 | 2019-09-03T06:15:38 | 155,835,435 | 3 | 2 | Apache-2.0 | false | 2022-06-21T00:52:21 | 2018-11-02T08:20:44 | 2021-01-30T08:34:16 | 2022-06-21T00:52:18 | 10,117 | 3 | 1 | 3 | Java | false | false | package com.nmys.story.mapper;
import com.nmys.story.model.entity.Options;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface OptionMapper {
Options getOptionByName(@Param("name") String name);
List<Options> getOptions();
void saveOption(Options options);
void updateByName(Options options);
}
| UTF-8 | Java | 410 | java | OptionMapper.java | Java | [] | null | [] | package com.nmys.story.mapper;
import com.nmys.story.model.entity.Options;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface OptionMapper {
Options getOptionByName(@Param("name") String name);
List<Options> getOptions();
void saveOption(Options options);
void updateByName(Options options);
}
| 410 | 0.768293 | 0.768293 | 19 | 20.578947 | 19.719923 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false | 0 |
274cf4f62065611c9940f289786aae9b9b1be9cc | 2,662,879,765,199 | e9eaef3f69f2bc3f731571cc7a673f0311a9d4ac | /app/src/main/java/project/revision/tap/retre/Places/Seto_gumba.java | 0a251716d154a79e812005a2df8450813306aa10 | [] | no_license | prakash9630/RetreatAppartment | https://github.com/prakash9630/RetreatAppartment | 57b7a08334b0db8ba69008cd01951ff7a7672d9e | 86ff95a8a9f492a1ca0addacd70d6212c300d374 | refs/heads/master | 2020-05-21T17:49:48.172000 | 2017-02-15T08:13:48 | 2017-02-15T08:13:48 | 65,004,605 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package project.revision.tap.retre.Places;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import java.util.Locale;
import project.revision.tap.retre.R;
/**
* Created by prakash on 9/26/2016.
*/
public class Seto_gumba extends AppCompatActivity {
Button button;
Toolbar toolbar;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.seto_gumba_layout);
button=(Button)findViewById(R.id.s_google_map);
toolbar=(Toolbar)findViewById(R.id.seto_gumba_id);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isOnline())
{
getDirection();
}
else
{
Toast.makeText(Seto_gumba.this, "There is no Internet connection", Toast.LENGTH_SHORT).show();
}
}
});
}
void getDirection()
{
String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?daddr=%f,%f (%s)",27.744437, 85.368351, "Druk Amitabh Monastery");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
try
{
startActivity(intent);
}
catch(ActivityNotFoundException ex)
{
try
{
Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(unrestrictedIntent);
}
catch(ActivityNotFoundException innerEx)
{
Toast.makeText(Seto_gumba.this, "Please install a maps application", Toast.LENGTH_LONG).show();
}
}
}
protected boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnected()) {
return true;
} else {
return false;
}
}
}
| UTF-8 | Java | 2,704 | java | Seto_gumba.java | Java | [
{
"context": "t project.revision.tap.retre.R;\n\n/**\n * Created by prakash on 9/26/2016.\n */\npublic class Seto_gumba extends",
"end": 589,
"score": 0.9092694520950317,
"start": 582,
"tag": "USERNAME",
"value": "prakash"
}
] | null | [] | package project.revision.tap.retre.Places;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import java.util.Locale;
import project.revision.tap.retre.R;
/**
* Created by prakash on 9/26/2016.
*/
public class Seto_gumba extends AppCompatActivity {
Button button;
Toolbar toolbar;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.seto_gumba_layout);
button=(Button)findViewById(R.id.s_google_map);
toolbar=(Toolbar)findViewById(R.id.seto_gumba_id);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isOnline())
{
getDirection();
}
else
{
Toast.makeText(Seto_gumba.this, "There is no Internet connection", Toast.LENGTH_SHORT).show();
}
}
});
}
void getDirection()
{
String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?daddr=%f,%f (%s)",27.744437, 85.368351, "Druk Amitabh Monastery");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
try
{
startActivity(intent);
}
catch(ActivityNotFoundException ex)
{
try
{
Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(unrestrictedIntent);
}
catch(ActivityNotFoundException innerEx)
{
Toast.makeText(Seto_gumba.this, "Please install a maps application", Toast.LENGTH_LONG).show();
}
}
}
protected boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnected()) {
return true;
} else {
return false;
}
}
}
| 2,704 | 0.651257 | 0.642012 | 87 | 30.08046 | 28.798235 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.586207 | false | false | 0 |
c91edb978d193fdc1ec8809b3bab69b744560d1a | 19,894,288,526,175 | 230c7c8b97d544e9fdff038887fac0c025ce8281 | / heroesquest/branches/BenBranch/bin/jobs/Gaian.java | 066f19b2e797e88032a9206891733467a4c16940 | [] | no_license | tectronics/heroesquest | https://github.com/tectronics/heroesquest | 47f826bab4647f624496b108c4b6fffe28d78c32 | e1ad292b5b191b9be718e2f0639407c27e25c8a6 | refs/heads/master | 2018-01-11T15:01:14.289000 | 2010-05-21T17:42:21 | 2010-05-21T17:42:21 | 45,770,708 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jobs;
import main.RandNum;
public class Gaian extends Job {
public Gaian(){
super("Gaian");
spells.put(1, null);
spells.put(3, null);
spells.put(5, null);
spells.put(7, null);
spells.put(10, null);
startStr=11;
startStam=9;
startInt=7;
startSp=6;
jobWeapon.damage=5;
jobWeapon.attackSpeed=.7;
armor.armorVal=3;
strChange=3*RandNum.randNum(1,2);
stamChange=2*RandNum.randNum(1,2);
intChange=2*RandNum.randNum(1,2);
spChange=2*RandNum.randNum(1,2);
}//end constructor
}//end class
| UTF-8 | Java | 525 | java | Gaian.java | Java | [] | null | [] | package jobs;
import main.RandNum;
public class Gaian extends Job {
public Gaian(){
super("Gaian");
spells.put(1, null);
spells.put(3, null);
spells.put(5, null);
spells.put(7, null);
spells.put(10, null);
startStr=11;
startStam=9;
startInt=7;
startSp=6;
jobWeapon.damage=5;
jobWeapon.attackSpeed=.7;
armor.armorVal=3;
strChange=3*RandNum.randNum(1,2);
stamChange=2*RandNum.randNum(1,2);
intChange=2*RandNum.randNum(1,2);
spChange=2*RandNum.randNum(1,2);
}//end constructor
}//end class
| 525 | 0.685714 | 0.63619 | 25 | 20 | 9.478396 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.56 | false | false | 0 |
1ae70ad419da0b3a5b5d0c662bbec75ec8b4aabd | 22,737,556,877,137 | 35cc3cc06e89bad5aa3c630993f8fd05f2b37d45 | /app/src/main/java/pugnator/com/cceunitrust/adapters/CropMonitoringPendingSurvey_Adapter.java | fe265f0f245ce3c968252d7feb70fde341daf06a | [] | no_license | jaiprajapati3/CCEUnitrust | https://github.com/jaiprajapati3/CCEUnitrust | a07f625315e6be452a4645e1ee8018c8a785bdf1 | 60e7250d2c29e631e3a90ec7899ab53705445901 | refs/heads/master | 2018-10-10T15:49:24.413000 | 2018-09-09T08:12:20 | 2018-09-09T08:12:20 | 135,726,656 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pugnator.com.cceunitrust.adapters;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
import pugnator.com.cceunitrust.R;
import pugnator.com.cceunitrust.helpers.DatabaseHelper;
import pugnator.com.cceunitrust.helpers.SharedPreferencesManager;
import pugnator.com.cceunitrust.models.CCECropMonitoringModel;
import pugnator.com.cceunitrust.models.CccDistrict;
import pugnator.com.cceunitrust.models.CceRevenueCode;
import pugnator.com.cceunitrust.models.CceState;
import pugnator.com.cceunitrust.models.CceTehsil;
/**
* Created by JAIMIN PRAJAPATI on 01-06-2018.
*/
public class CropMonitoringPendingSurvey_Adapter extends ArrayAdapter<String> {
private List<CCECropMonitoringModel> array;
private Context context;
private LayoutInflater inflater;
public CropMonitoringPendingSurvey_Adapter(Context context, List<CCECropMonitoringModel> array) {
super(context, R.layout.listview_3);
this.context = context;
this.array = array;
}
@Override
public int getCount() {
return array.size();
}
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.listview_3, null);
}
final ViewHolder holder = new ViewHolder();
holder.txt1 = (TextView) convertView.findViewById(R.id.txt1);
holder.txt2 = (TextView) convertView.findViewById(R.id.txt2);
holder.txt3 = (TextView) convertView.findViewById(R.id.txt3);
holder.txt4 = (TextView) convertView.findViewById(R.id.txt4);
holder.txt5 = (TextView) convertView.findViewById(R.id.txt5);
holder.txt6 = (TextView) convertView.findViewById(R.id.txt6);
holder.txt7 = (TextView) convertView.findViewById(R.id.txt7);
CCECropMonitoringModel survey = array.get(position);
SharedPreferencesManager preferencesManager = new SharedPreferencesManager(parent.getContext());
preferencesManager.setStateId(survey.getState());
DatabaseHelper db = new DatabaseHelper(parent.getContext());
String strState = "";
String strDistrict = "";
String strTehsil = "";
String strVillage = "";
if (survey.getState() > 0) {
strState = db.getNameById(CceState.TABLE_NAME, CceState.ID, survey.getState(), CceState.NAME);
}
if (survey.getDistrict() > 0) {
strDistrict = db.getNameById(CccDistrict.TABLE_NAME, CccDistrict.DIS_CODE, survey.getDistrict(), CccDistrict.DIS_NAME);
}
if (survey.getTehsil() > 0) {
strTehsil = db.getNameById(CceTehsil.TABLE_NAME, CceTehsil.TEHSIL_CODE, survey.getTehsil(), CceTehsil.TEHSIL_NANE);
}
if (survey.getPanchayat() > 0) {
strVillage = db.getNameById(CceRevenueCode.TABLE_NAME, CceRevenueCode.REVENUE_CODE, survey.getPanchayat(), CceRevenueCode.REVENUE_NAME);
}
holder.txt1.setText(survey.getSurveyUniqueKey());
holder.txt2.setText(survey.getCompanyName());
holder.txt3.setText(strState);
holder.txt4.setText(strDistrict);
holder.txt5.setText(strTehsil);
holder.txt6.setText(strVillage);
holder.txt7.setText(db.getYear(survey.getSurveyId()));
return convertView;
}
public class ViewHolder {
TextView txt1;
TextView txt2;
TextView txt3;
TextView txt4;
TextView txt5;
TextView txt6;
TextView txt7;
}
}
| UTF-8 | Java | 3,849 | java | CropMonitoringPendingSurvey_Adapter.java | Java | [
{
"context": "m.cceunitrust.models.CceTehsil;\n\n/**\n * Created by JAIMIN PRAJAPATI on 01-06-2018.\n */\n\npublic class CropMonitoringPe",
"end": 766,
"score": 0.999692976474762,
"start": 750,
"tag": "NAME",
"value": "JAIMIN PRAJAPATI"
}
] | null | [] | package pugnator.com.cceunitrust.adapters;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
import pugnator.com.cceunitrust.R;
import pugnator.com.cceunitrust.helpers.DatabaseHelper;
import pugnator.com.cceunitrust.helpers.SharedPreferencesManager;
import pugnator.com.cceunitrust.models.CCECropMonitoringModel;
import pugnator.com.cceunitrust.models.CccDistrict;
import pugnator.com.cceunitrust.models.CceRevenueCode;
import pugnator.com.cceunitrust.models.CceState;
import pugnator.com.cceunitrust.models.CceTehsil;
/**
* Created by <NAME> on 01-06-2018.
*/
public class CropMonitoringPendingSurvey_Adapter extends ArrayAdapter<String> {
private List<CCECropMonitoringModel> array;
private Context context;
private LayoutInflater inflater;
public CropMonitoringPendingSurvey_Adapter(Context context, List<CCECropMonitoringModel> array) {
super(context, R.layout.listview_3);
this.context = context;
this.array = array;
}
@Override
public int getCount() {
return array.size();
}
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.listview_3, null);
}
final ViewHolder holder = new ViewHolder();
holder.txt1 = (TextView) convertView.findViewById(R.id.txt1);
holder.txt2 = (TextView) convertView.findViewById(R.id.txt2);
holder.txt3 = (TextView) convertView.findViewById(R.id.txt3);
holder.txt4 = (TextView) convertView.findViewById(R.id.txt4);
holder.txt5 = (TextView) convertView.findViewById(R.id.txt5);
holder.txt6 = (TextView) convertView.findViewById(R.id.txt6);
holder.txt7 = (TextView) convertView.findViewById(R.id.txt7);
CCECropMonitoringModel survey = array.get(position);
SharedPreferencesManager preferencesManager = new SharedPreferencesManager(parent.getContext());
preferencesManager.setStateId(survey.getState());
DatabaseHelper db = new DatabaseHelper(parent.getContext());
String strState = "";
String strDistrict = "";
String strTehsil = "";
String strVillage = "";
if (survey.getState() > 0) {
strState = db.getNameById(CceState.TABLE_NAME, CceState.ID, survey.getState(), CceState.NAME);
}
if (survey.getDistrict() > 0) {
strDistrict = db.getNameById(CccDistrict.TABLE_NAME, CccDistrict.DIS_CODE, survey.getDistrict(), CccDistrict.DIS_NAME);
}
if (survey.getTehsil() > 0) {
strTehsil = db.getNameById(CceTehsil.TABLE_NAME, CceTehsil.TEHSIL_CODE, survey.getTehsil(), CceTehsil.TEHSIL_NANE);
}
if (survey.getPanchayat() > 0) {
strVillage = db.getNameById(CceRevenueCode.TABLE_NAME, CceRevenueCode.REVENUE_CODE, survey.getPanchayat(), CceRevenueCode.REVENUE_NAME);
}
holder.txt1.setText(survey.getSurveyUniqueKey());
holder.txt2.setText(survey.getCompanyName());
holder.txt3.setText(strState);
holder.txt4.setText(strDistrict);
holder.txt5.setText(strTehsil);
holder.txt6.setText(strVillage);
holder.txt7.setText(db.getYear(survey.getSurveyId()));
return convertView;
}
public class ViewHolder {
TextView txt1;
TextView txt2;
TextView txt3;
TextView txt4;
TextView txt5;
TextView txt6;
TextView txt7;
}
}
| 3,839 | 0.692907 | 0.681995 | 109 | 34.311928 | 31.696003 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.715596 | false | false | 0 |
436c3f5d0a4e67010e951713cfea843bb101b9de | 34,574,486,764,995 | d7384795fd89995bee26354660598c25e323bdfd | /wechat-common/src/main/java/com/lvtu/wechat/common/service/activity/flowrecharge/IFlowRechargeService.java | 3477dc8a721b77f0f453d12f74016ef5ace3d385 | [] | no_license | xinsec/c-wechat | https://github.com/xinsec/c-wechat | 581d72d8e3d442b5aa60cd36adf1405d9205bffc | 2b70eaaa9c326cd4d5f0b866491281a44a19696f | refs/heads/master | 2018-02-06T19:15:03.446000 | 2017-06-28T04:10:06 | 2017-06-28T04:10:20 | 95,628,989 | 0 | 1 | null | true | 2017-06-28T04:36:59 | 2017-06-28T04:36:59 | 2017-06-28T04:11:50 | 2017-06-28T04:11:46 | 0 | 0 | 0 | 0 | null | null | null | package com.lvtu.wechat.common.service.activity.flowrecharge;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.lvtu.wechat.common.hessian.RemoteService;
import com.lvtu.wechat.common.model.activity.flowrecharge.ExportFlowRechargeRecord;
import com.lvtu.wechat.common.model.activity.flowrecharge.FlowRecharge;
import com.lvtu.wechat.common.model.activity.flowrecharge.FlowRechargeRecord;
import com.lvtu.wechat.common.model.activity.flowrecharge.FlowRechargeRecordInfo;
import com.lvtu.wechat.common.model.activity.signflow.FlowExchange;
import com.lvtu.wechat.common.vo.back.FlowRechargeConditionVo;
import com.lvtu.wechat.common.vo.back.FlowRecordConditionVo;
@RemoteService("flowRechargeService")
public interface IFlowRechargeService {
/**
*
* @Title: queryFlowRechargeList
* @Description: TODO(手动充值流量首页面,分页)
* @param @param flowRechargeConditionVo
* @param @return 设定文件
* @return PageInfo<FlowRecharge> 返回类型
* @throws
*/
PageInfo<FlowRecharge> queryFlowRechargeList(FlowRechargeConditionVo flowRechargeConditionVo);
/**
*
* @Title: queryFlowRechargeRecordListById
* @Description: TODO(根据flow_recharge表的id, 查询相应的充值记录)
* @param @param flowRecordConditionVo
* @param @return 设定文件
* @return PageInfo<FlowRechargeRecordInfo> 返回类型
* @throws
*/
PageInfo<FlowRechargeRecordInfo> queryFlowRechargeRecordListById(FlowRecordConditionVo flowRecordConditionVo);
/**
*
* @Title: queryExportFlowRechargeRecord
* @Description: TODO(查询需要导出的充值流量记录)
* @param @param flowRecordConditionVo
* @param @return 设定文件
* @return PageInfo<ExportFlowRechargeRecord> 返回类型
* @throws
*/
PageInfo<ExportFlowRechargeRecord> queryExportFlowRechargeRecord(FlowRecordConditionVo flowRecordConditionVo);
/**
*
* @Title: addflowRechargeRecord
* @Description: TODO(添加流量充值活动, 向flow_recharge_record表中插入充值记录)
* @param @param flowRecharge
* @param @param flowRechargeRecordList 设定文件
* @return void 返回类型
* @throws
*/
void addflowRechargeRecord(FlowRecharge flowRecharge, List<FlowRechargeRecord> flowRechargeRecordList);
/**
*
* @Title: queryWxFlowExchange
* @Description: TODO(查询t_wx_flow_exchange表的记录)
* @param @param flowRecordConditionVo
* @param @return 设定文件
* @return PageInfo<FlowRecharge> 返回类型
* @throws
*/
PageInfo<FlowExchange> queryWxFlowExchange(FlowRecordConditionVo flowRecordConditionVo);
}
| UTF-8 | Java | 2,654 | java | IFlowRechargeService.java | Java | [] | null | [] | package com.lvtu.wechat.common.service.activity.flowrecharge;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.lvtu.wechat.common.hessian.RemoteService;
import com.lvtu.wechat.common.model.activity.flowrecharge.ExportFlowRechargeRecord;
import com.lvtu.wechat.common.model.activity.flowrecharge.FlowRecharge;
import com.lvtu.wechat.common.model.activity.flowrecharge.FlowRechargeRecord;
import com.lvtu.wechat.common.model.activity.flowrecharge.FlowRechargeRecordInfo;
import com.lvtu.wechat.common.model.activity.signflow.FlowExchange;
import com.lvtu.wechat.common.vo.back.FlowRechargeConditionVo;
import com.lvtu.wechat.common.vo.back.FlowRecordConditionVo;
@RemoteService("flowRechargeService")
public interface IFlowRechargeService {
/**
*
* @Title: queryFlowRechargeList
* @Description: TODO(手动充值流量首页面,分页)
* @param @param flowRechargeConditionVo
* @param @return 设定文件
* @return PageInfo<FlowRecharge> 返回类型
* @throws
*/
PageInfo<FlowRecharge> queryFlowRechargeList(FlowRechargeConditionVo flowRechargeConditionVo);
/**
*
* @Title: queryFlowRechargeRecordListById
* @Description: TODO(根据flow_recharge表的id, 查询相应的充值记录)
* @param @param flowRecordConditionVo
* @param @return 设定文件
* @return PageInfo<FlowRechargeRecordInfo> 返回类型
* @throws
*/
PageInfo<FlowRechargeRecordInfo> queryFlowRechargeRecordListById(FlowRecordConditionVo flowRecordConditionVo);
/**
*
* @Title: queryExportFlowRechargeRecord
* @Description: TODO(查询需要导出的充值流量记录)
* @param @param flowRecordConditionVo
* @param @return 设定文件
* @return PageInfo<ExportFlowRechargeRecord> 返回类型
* @throws
*/
PageInfo<ExportFlowRechargeRecord> queryExportFlowRechargeRecord(FlowRecordConditionVo flowRecordConditionVo);
/**
*
* @Title: addflowRechargeRecord
* @Description: TODO(添加流量充值活动, 向flow_recharge_record表中插入充值记录)
* @param @param flowRecharge
* @param @param flowRechargeRecordList 设定文件
* @return void 返回类型
* @throws
*/
void addflowRechargeRecord(FlowRecharge flowRecharge, List<FlowRechargeRecord> flowRechargeRecordList);
/**
*
* @Title: queryWxFlowExchange
* @Description: TODO(查询t_wx_flow_exchange表的记录)
* @param @param flowRecordConditionVo
* @param @return 设定文件
* @return PageInfo<FlowRecharge> 返回类型
* @throws
*/
PageInfo<FlowExchange> queryWxFlowExchange(FlowRecordConditionVo flowRecordConditionVo);
}
| 2,654 | 0.767129 | 0.767129 | 82 | 28.902439 | 30.102512 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.731707 | false | false | 0 |
840a9d33e6e3088710f31a8dd8997dac4e298c38 | 36,928,128,829,087 | 9f32c3eaa34268a7b6a8099b02dc94ea08aa9eab | /src/model/chatrecord.java | 0c96febf0bf243547ce42b75da8b753fb8c272c3 | [] | no_license | ttlinux/pp365 | https://github.com/ttlinux/pp365 | 45dc86a79adb5170d9d0bb3d827078418b440f5a | 46d15bab50771be6df92338248ab779621f6bbf9 | refs/heads/master | 2018-11-26T10:25:45.430000 | 2018-11-20T05:36:07 | 2018-11-20T05:36:07 | 110,314,165 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
public class chatrecord {
private Integer id;
private String countryid;
private Integer videoid;
private Integer hashcode;
private String username;
private String userpicpath;
private Integer userid;
private String message;
private Long chattime;
private Integer type;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCountryid() {
return countryid;
}
public void setCountryid(String countryid) {
this.countryid = countryid == null ? null : countryid.trim();
}
public Integer getVideoid() {
return videoid;
}
public void setVideoid(Integer videoid) {
this.videoid = videoid;
}
public Integer getHashcode() {
return hashcode;
}
public void setHashcode(Integer hashcode) {
this.hashcode = hashcode;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getUserpicpath() {
return userpicpath;
}
public void setUserpicpath(String userpicpath) {
this.userpicpath = userpicpath == null ? null : userpicpath.trim();
}
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message == null ? null : message.trim();
}
public Long getChattime() {
return chattime;
}
public void setChattime(Long chattime) {
this.chattime = chattime;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
} | UTF-8 | Java | 2,058 | java | chatrecord.java | Java | [
{
"context": "\n public String getUsername() {\r\n return username;\r\n }\r\n\r\n public void setUsername(String use",
"end": 1068,
"score": 0.9397387504577637,
"start": 1060,
"tag": "USERNAME",
"value": "username"
}
] | null | [] | package model;
public class chatrecord {
private Integer id;
private String countryid;
private Integer videoid;
private Integer hashcode;
private String username;
private String userpicpath;
private Integer userid;
private String message;
private Long chattime;
private Integer type;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCountryid() {
return countryid;
}
public void setCountryid(String countryid) {
this.countryid = countryid == null ? null : countryid.trim();
}
public Integer getVideoid() {
return videoid;
}
public void setVideoid(Integer videoid) {
this.videoid = videoid;
}
public Integer getHashcode() {
return hashcode;
}
public void setHashcode(Integer hashcode) {
this.hashcode = hashcode;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getUserpicpath() {
return userpicpath;
}
public void setUserpicpath(String userpicpath) {
this.userpicpath = userpicpath == null ? null : userpicpath.trim();
}
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message == null ? null : message.trim();
}
public Long getChattime() {
return chattime;
}
public void setChattime(Long chattime) {
this.chattime = chattime;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
} | 2,058 | 0.575802 | 0.575802 | 103 | 18 | 18.396391 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.300971 | false | false | 0 |
4de344d940c5652e4cf6aa24c800e99d67b5ef7a | 34,995,393,567,243 | 37308052c59526da4aaa9f281ee31d0738949e78 | /OrientacaodeObjetos/Cliente.java | c9a56df876d9923c1f77d79dd3259798ee5b394b | [] | no_license | devzinha/Logica | https://github.com/devzinha/Logica | e87ee8f2b20b17fe15c2e58059b49f85398787cc | 3bb5f5956068ac383983a08286a1b75ef4898649 | refs/heads/main | 2023-06-05T21:30:47.995000 | 2021-06-26T02:14:43 | 2021-06-26T02:14:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package OrientaçãodeObjetos;
public class Cliente {
private String nomeCliente;
private String idade;
private String cpf;
private String compra;
private String valor;
public Cliente(String nomeCliente, String idade, String cpf, String compra, String valor )
{
this.nomeCliente = nomeCliente;
this.idade=idade;
this.cpf=cpf;
this.compra=compra;
this.valor=valor;
}
public Cliente(String nomeCliente, String valor)
{
this.nomeCliente=nomeCliente;
this.valor=valor;
}
public void imprimirInfo()
{
System.out.println("O/A cliente " +nomeCliente+", de" +idade+", CPF: "+cpf+ ", fez a compra de um" +compra+ ", no valor de: R$ "+valor);
}
public String getNomeCliente() {
return nomeCliente;
}
public void setNomeCliente(String nomeCliente) {
this.nomeCliente = nomeCliente;
}
public String getIdade() {
return idade;
}
public void setIdade(String idade) {
this.idade = idade;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getCompra() {
return compra;
}
public void setCompra(String compra) {
this.compra = compra;
}
public String getValor() {
return valor;
}
public void setValor(String valor) {
this.valor = valor;
}
}
| ISO-8859-1 | Java | 1,273 | java | Cliente.java | Java | [] | null | [] | package OrientaçãodeObjetos;
public class Cliente {
private String nomeCliente;
private String idade;
private String cpf;
private String compra;
private String valor;
public Cliente(String nomeCliente, String idade, String cpf, String compra, String valor )
{
this.nomeCliente = nomeCliente;
this.idade=idade;
this.cpf=cpf;
this.compra=compra;
this.valor=valor;
}
public Cliente(String nomeCliente, String valor)
{
this.nomeCliente=nomeCliente;
this.valor=valor;
}
public void imprimirInfo()
{
System.out.println("O/A cliente " +nomeCliente+", de" +idade+", CPF: "+cpf+ ", fez a compra de um" +compra+ ", no valor de: R$ "+valor);
}
public String getNomeCliente() {
return nomeCliente;
}
public void setNomeCliente(String nomeCliente) {
this.nomeCliente = nomeCliente;
}
public String getIdade() {
return idade;
}
public void setIdade(String idade) {
this.idade = idade;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getCompra() {
return compra;
}
public void setCompra(String compra) {
this.compra = compra;
}
public String getValor() {
return valor;
}
public void setValor(String valor) {
this.valor = valor;
}
}
| 1,273 | 0.691581 | 0.691581 | 62 | 19.467741 | 22.383547 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.822581 | false | false | 0 |
a197a2936fdec1090c13361f532ad91d77ad58f2 | 5,755,256,228,611 | d8b882c0cb086fe30ab3cd6a1838174a5f79a0f8 | /app/src/main/java/com/example/jingbin/cloudreader/bean/UpdateBean.java | 49f4791a18107d3b5f7b30d3ad2d7f959a2462d5 | [
"Apache-2.0"
] | permissive | 3025077330/-Cloudread | https://github.com/3025077330/-Cloudread | 8717412b8fdd12a969a05580027cfa87d3d07973 | 2137bfc0a3d0d64082859ee2f53f0636e5103e1e | refs/heads/master | 2023-03-11T10:08:18.949000 | 2020-11-26T11:46:27 | 2020-11-26T11:46:27 | 304,525,500 | 11 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.jingbin.cloudreader.bean;
public class UpdateBean {
/**
* name : 云阅
* version : 13
* changelog : 1、[修复] 已选择分类退出App再次进入,type失效的问题 2、[修复] 跳转B站视频显示网页错误的问题
* updated_at : 1510629404
* versionShort : 1.8.3
* build : 13
* isShow : 1
* installUrl : http://download.fir.im/v2/app/install/58677918ca87a8490d000395?download_token=d19d3bd555629acaa07e7e5c7e4bee8d&source=update
* update_url : http://fir.im/cloudreader
*/
private String name;
private String version;// 版本号
private String changelog;// 更新日志
private String isShow;// 1显示弹框,不然不显示
private long updated_at;// 更新时间
private String versionShort;// 版本名称
private String build;
private String installUrl;
private String update_url;
public String getIsShow() {
return isShow;
}
public void setIsShow(String isShow) {
this.isShow = isShow;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getChangelog() {
return changelog;
}
public void setChangelog(String changelog) {
this.changelog = changelog;
}
public long getupdatedAt() {
return updated_at;
}
public String getVersionShort() {
return versionShort;
}
public void setVersionShort(String versionShort) {
this.versionShort = versionShort;
}
public String getBuild() {
return build;
}
public void setBuild(String build) {
this.build = build;
}
public String getInstallUrl() {
return installUrl;
}
public void setInstallUrl(String installUrl) {
this.installUrl = installUrl;
}
public String getupdateUrl() {
return update_url;
}
}
| UTF-8 | Java | 2,117 | java | UpdateBean.java | Java | [
{
"context": "public class UpdateBean {\n\n\n /**\n * name : 云阅\n * version : 13\n * changelog : 1、[修复] 已选",
"end": 100,
"score": 0.8465506434440613,
"start": 99,
"tag": "NAME",
"value": "云"
},
{
"context": "p/install/58677918ca87a8490d000395?download_token=d19d3bd5556... | null | [] | package com.example.jingbin.cloudreader.bean;
public class UpdateBean {
/**
* name : 云阅
* version : 13
* changelog : 1、[修复] 已选择分类退出App再次进入,type失效的问题 2、[修复] 跳转B站视频显示网页错误的问题
* updated_at : 1510629404
* versionShort : 1.8.3
* build : 13
* isShow : 1
* installUrl : http://download.fir.im/v2/app/install/58677918ca87a8490d000395?download_token=<PASSWORD>&source=update
* update_url : http://fir.im/cloudreader
*/
private String name;
private String version;// 版本号
private String changelog;// 更新日志
private String isShow;// 1显示弹框,不然不显示
private long updated_at;// 更新时间
private String versionShort;// 版本名称
private String build;
private String installUrl;
private String update_url;
public String getIsShow() {
return isShow;
}
public void setIsShow(String isShow) {
this.isShow = isShow;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getChangelog() {
return changelog;
}
public void setChangelog(String changelog) {
this.changelog = changelog;
}
public long getupdatedAt() {
return updated_at;
}
public String getVersionShort() {
return versionShort;
}
public void setVersionShort(String versionShort) {
this.versionShort = versionShort;
}
public String getBuild() {
return build;
}
public void setBuild(String build) {
this.build = build;
}
public String getInstallUrl() {
return installUrl;
}
public void setInstallUrl(String installUrl) {
this.installUrl = installUrl;
}
public String getupdateUrl() {
return update_url;
}
}
| 2,095 | 0.621798 | 0.592667 | 94 | 20.180851 | 21.226721 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.287234 | false | false | 0 |
3648b830e6f4e816e9665593a30c7759dc9471de | 11,948,599,065,120 | acbb56922b48774b9c4d03a335d8c971dd64b80d | /GOLauncher1.5_main/src/com/jiubang/ggheart/appgame/download/DownloadResult.java | c34ed5f1c79f59c1b4c2ef408a5d61626dac707e | [] | no_license | Lakkichand/smartapp-src | https://github.com/Lakkichand/smartapp-src | 91284c469308e9e40c45a7782d0bdb79c80bf9e2 | 1a174a9dd6a8a784d5faf204404e9a0abede4fa5 | refs/heads/master | 2021-01-10T16:51:09.042000 | 2015-03-28T15:15:06 | 2015-03-28T15:15:06 | 45,905,976 | 4 | 7 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 文 件 名: DownloadResult.java
* 版 权: 3G
* 描 述: <描述>
* 修 改 人: liuxinyang
* 修改时间: 2012-11-26
* 跟踪单号: <跟踪单号>
* 修改单号: <修改单号>
* 修改内容: <修改内容>
*/
package com.jiubang.ggheart.appgame.download;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
/**
* <br>类描述:
* <br>功能详细描述:
*
* @author liuxinyang
* @date [2012-11-26]
*/
public class DownloadResult {
public final static int DOWNLOAD_RUNNING = -1; // 下载运行
public final static int DOWNLOAD_FAIL = 0; // 下载失败
public final static int DOWNLOAD_COMPLETE = 1; // 下载完成
public final static int DOWNLOAD_STOP = 2; // 下载停止
public final static int DOWNLOAD_DELETE = 3; // 下载删除
private int mResult = DOWNLOAD_RUNNING;
private Object mDownloadSizeLocker = new Object();
private long mAlreadyDownloadSize = 0;
private long mTotalSize = 0;
private int mPercent = 0;
private DownloadManager mDownloadManager = null;
private DownloadTask mDownloadTask = null;
private ConcurrentHashMap<String, ThreadResultBean> mResultMap = null;
private long mTime = 0;
private final static long TIME_STEP = 10000;
public DownloadResult(DownloadManager manager, DownloadTask task) {
mDownloadManager = manager;
mDownloadTask = task;
mResultMap = new ConcurrentHashMap<String, ThreadResultBean>();
mTime = 0;
}
public void notifyDownloadResult(String tag, ThreadResultBean value) {
mResultMap.put(tag, value);
judgeResult();
DownloadTask.ThreadData data = new DownloadTask.ThreadData();
data.mEndPos = value.getEndPosition();
data.mStartPos = value.getStartPosition();
data.mTag = tag;
mDownloadTask.getThreadDataMap().put(tag, data);
// 保存未下载完成,下载完成和下载完成且安装的下载任务到SD卡
// 避免多个线程同时调用此方法造成频繁保存文件,设置一个时间差
if (System.currentTimeMillis() - mTime > TIME_STEP) {
mTime = System.currentTimeMillis();
mDownloadManager.saveNotCompleteTask();
mDownloadManager.getDownloadCompleteManager().saveDownlaodCompleteTask();
mDownloadManager.getDownloadCompleteManager().saveInstalledTask();
}
}
public int getResult() {
return mResult;
}
public void setResult(int result) {
mResult = result;
}
public long getAlreadyDownloadSize() {
synchronized (mDownloadSizeLocker) {
return mAlreadyDownloadSize;
}
}
public void updateAlreadyDownloadSize(long size) {
synchronized (mDownloadSizeLocker) {
mAlreadyDownloadSize += size;
}
if (mTotalSize > 0) {
mPercent = (int) (((double) mAlreadyDownloadSize / mTotalSize) * 100);
}
// 保存未下载完成的任务
if (System.currentTimeMillis() - mTime > TIME_STEP) {
mTime = System.currentTimeMillis();
mDownloadManager.saveNotCompleteTask();
}
}
public long getTotalSize() {
return mTotalSize;
}
public void setTotalSize(long size) {
mTotalSize = size;
}
public int getAlreadyDownloadPercent() {
return mPercent;
}
public ConcurrentHashMap<String, ThreadResultBean> getResultMap() {
return mResultMap;
}
/**
* <br>功能简述:分别所有线程的状态值,得到
* <br>功能详细描述:
* <br>注意:
*/
private void judgeResult() {
ArrayList<Integer> list = new ArrayList<Integer>();
Iterator<Entry<String, ThreadResultBean>> iter = mResultMap.entrySet().iterator();
while (iter.hasNext()) {
Entry<String, ThreadResultBean> entry = iter.next();
ThreadResultBean bean = entry.getValue();
list.add(bean.getState());
}
if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_RUNNING)) {
mResult = DOWNLOAD_RUNNING;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_ERROR)) {
mResult = DOWNLOAD_FAIL;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_NOT_FINISH)
&& mDownloadTask.getState() == DownloadTask.STATE_STOP) {
mResult = DOWNLOAD_STOP;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_NOT_FINISH)
&& mDownloadTask.getState() == DownloadTask.STATE_DELETE) {
mResult = DOWNLOAD_DELETE;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_FINISH)) {
mResult = DOWNLOAD_COMPLETE;
}
}
}
| UTF-8 | Java | 4,330 | java | DownloadResult.java | Java | [
{
"context": "lt.java\n * 版 权: 3G\n * 描 述: <描述>\n * 修 改 人: liuxinyang\n * 修改时间: 2012-11-26\n * 跟踪单号: <跟踪单号>\n * 修改单号: <",
"end": 87,
"score": 0.9956955313682556,
"start": 77,
"tag": "USERNAME",
"value": "liuxinyang"
},
{
"context": "p;\n\n/**\n * <br>类描述:\n * <br>功能详细描述:\... | null | [] | /*
* 文 件 名: DownloadResult.java
* 版 权: 3G
* 描 述: <描述>
* 修 改 人: liuxinyang
* 修改时间: 2012-11-26
* 跟踪单号: <跟踪单号>
* 修改单号: <修改单号>
* 修改内容: <修改内容>
*/
package com.jiubang.ggheart.appgame.download;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
/**
* <br>类描述:
* <br>功能详细描述:
*
* @author liuxinyang
* @date [2012-11-26]
*/
public class DownloadResult {
public final static int DOWNLOAD_RUNNING = -1; // 下载运行
public final static int DOWNLOAD_FAIL = 0; // 下载失败
public final static int DOWNLOAD_COMPLETE = 1; // 下载完成
public final static int DOWNLOAD_STOP = 2; // 下载停止
public final static int DOWNLOAD_DELETE = 3; // 下载删除
private int mResult = DOWNLOAD_RUNNING;
private Object mDownloadSizeLocker = new Object();
private long mAlreadyDownloadSize = 0;
private long mTotalSize = 0;
private int mPercent = 0;
private DownloadManager mDownloadManager = null;
private DownloadTask mDownloadTask = null;
private ConcurrentHashMap<String, ThreadResultBean> mResultMap = null;
private long mTime = 0;
private final static long TIME_STEP = 10000;
public DownloadResult(DownloadManager manager, DownloadTask task) {
mDownloadManager = manager;
mDownloadTask = task;
mResultMap = new ConcurrentHashMap<String, ThreadResultBean>();
mTime = 0;
}
public void notifyDownloadResult(String tag, ThreadResultBean value) {
mResultMap.put(tag, value);
judgeResult();
DownloadTask.ThreadData data = new DownloadTask.ThreadData();
data.mEndPos = value.getEndPosition();
data.mStartPos = value.getStartPosition();
data.mTag = tag;
mDownloadTask.getThreadDataMap().put(tag, data);
// 保存未下载完成,下载完成和下载完成且安装的下载任务到SD卡
// 避免多个线程同时调用此方法造成频繁保存文件,设置一个时间差
if (System.currentTimeMillis() - mTime > TIME_STEP) {
mTime = System.currentTimeMillis();
mDownloadManager.saveNotCompleteTask();
mDownloadManager.getDownloadCompleteManager().saveDownlaodCompleteTask();
mDownloadManager.getDownloadCompleteManager().saveInstalledTask();
}
}
public int getResult() {
return mResult;
}
public void setResult(int result) {
mResult = result;
}
public long getAlreadyDownloadSize() {
synchronized (mDownloadSizeLocker) {
return mAlreadyDownloadSize;
}
}
public void updateAlreadyDownloadSize(long size) {
synchronized (mDownloadSizeLocker) {
mAlreadyDownloadSize += size;
}
if (mTotalSize > 0) {
mPercent = (int) (((double) mAlreadyDownloadSize / mTotalSize) * 100);
}
// 保存未下载完成的任务
if (System.currentTimeMillis() - mTime > TIME_STEP) {
mTime = System.currentTimeMillis();
mDownloadManager.saveNotCompleteTask();
}
}
public long getTotalSize() {
return mTotalSize;
}
public void setTotalSize(long size) {
mTotalSize = size;
}
public int getAlreadyDownloadPercent() {
return mPercent;
}
public ConcurrentHashMap<String, ThreadResultBean> getResultMap() {
return mResultMap;
}
/**
* <br>功能简述:分别所有线程的状态值,得到
* <br>功能详细描述:
* <br>注意:
*/
private void judgeResult() {
ArrayList<Integer> list = new ArrayList<Integer>();
Iterator<Entry<String, ThreadResultBean>> iter = mResultMap.entrySet().iterator();
while (iter.hasNext()) {
Entry<String, ThreadResultBean> entry = iter.next();
ThreadResultBean bean = entry.getValue();
list.add(bean.getState());
}
if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_RUNNING)) {
mResult = DOWNLOAD_RUNNING;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_ERROR)) {
mResult = DOWNLOAD_FAIL;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_NOT_FINISH)
&& mDownloadTask.getState() == DownloadTask.STATE_STOP) {
mResult = DOWNLOAD_STOP;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_NOT_FINISH)
&& mDownloadTask.getState() == DownloadTask.STATE_DELETE) {
mResult = DOWNLOAD_DELETE;
} else if (list.contains(ThreadResultBean.DOWNLOAD_THREAD_FINISH)) {
mResult = DOWNLOAD_COMPLETE;
}
}
}
| 4,330 | 0.717348 | 0.708375 | 152 | 25.394737 | 23.084843 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.671053 | false | false | 0 |
3f0c1c5b3e5fbdccf57e5f6599da68bbaf16bdd5 | 33,449,205,354,337 | 01187a23f2aec03be906a2ae5b78abc6965ba5a1 | /src/leetcode/ReverseSinglyLinkedList.java | 9fd11813ec32f0f29748ae410609b5a56a203baa | [] | no_license | rushabh25/leetcode | https://github.com/rushabh25/leetcode | d716a35507bda65499c514884555fff5c78c8215 | 68f8b37d109788aa499fdf4819ecffe5900bd584 | refs/heads/master | 2021-01-09T05:50:24.317000 | 2017-03-27T20:12:10 | 2017-03-27T20:12:10 | 80,839,791 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcode;
public class ReverseSinglyLinkedList {
class ListNode {
int val;
ListNode next;
ListNode(int x) {val = x;}
}
public ListNode reverseList(ListNode head) {
ListNode node = null;;
ListNode current = head;
while(current != null) {
if(node == null) {
ListNode newNode = new ListNode(current.val);
node = newNode;
} else {
ListNode newNode = new ListNode(current.val);
newNode.next = node;
node = newNode;
}
current = current.next;
}
return node;
}
}
| UTF-8 | Java | 525 | java | ReverseSinglyLinkedList.java | Java | [] | null | [] | package leetcode;
public class ReverseSinglyLinkedList {
class ListNode {
int val;
ListNode next;
ListNode(int x) {val = x;}
}
public ListNode reverseList(ListNode head) {
ListNode node = null;;
ListNode current = head;
while(current != null) {
if(node == null) {
ListNode newNode = new ListNode(current.val);
node = newNode;
} else {
ListNode newNode = new ListNode(current.val);
newNode.next = node;
node = newNode;
}
current = current.next;
}
return node;
}
}
| 525 | 0.638095 | 0.638095 | 30 | 16.5 | 14.741664 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.333333 | false | false | 0 |
608c0a1d8f741e64cbb793b55c550426603ffe68 | 369,367,248,441 | 0bcff34a3e982b221e95314f114a0bc927c91ac6 | /src/main/java/app/PersistanceStorage.java | 1fd431055e5faeeff6541b8a3857a0bb9a5187bb | [] | no_license | csayogesh/Sam | https://github.com/csayogesh/Sam | 880b0c8c2e3d6a2b49b4a2df9d72d1f47a1e8624 | 2600f8befc1eb942fa802e015585870366838349 | refs/heads/master | 2020-04-15T20:37:34.448000 | 2019-01-13T14:35:52 | 2019-01-13T14:35:52 | 165,001,979 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package app;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class PersistanceStorage {
private static String dimensionsFile = "data/dimensions";
public static void storeDimensions(Dimension dimension) throws IOException {
if (dimension != null) {
PrintWriter pw = new PrintWriter(new File(dimensionsFile + "_temp"));
while (dimension.getParent() != null)
dimension = dimension.getParent();
storeAllChildNodes(pw, dimension);
pw.flush();
pw.close();
File dims = new File(dimensionsFile);
if (dims.exists())
dims.delete();
dims = new File(dimensionsFile + "_temp");
if (dims.exists())
dims.renameTo(new File(dimensionsFile));
}
}
private static void storeAllChildNodes(PrintWriter fw, Dimension dimension) {
if (dimension.getSubDimension().size() == 0) {
fw.println(dimension.getId());
return;
}
for (Dimension subDim : dimension.getSubDimension())
storeAllChildNodes(fw, subDim);
}
public static Dimension getRootDimension() throws FileNotFoundException {
Dimension rootDimension = new Dimension("root");
Scanner sc = new Scanner(new File(dimensionsFile));
while (sc.hasNext()) {
String line = sc.nextLine();
Dimension dim = rootDimension;
String[] path = line.split("\\.");
for (int i = 1; i < path.length; i++) {
Dimension matching = dim.getMatchingSubDimension(path[i]);
if (matching == null) {
matching = dim.addDimension(path[i]);
}
dim = matching;
}
}
return rootDimension;
}
}
| UTF-8 | Java | 1,933 | java | PersistanceStorage.java | Java | [] | null | [] | package app;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class PersistanceStorage {
private static String dimensionsFile = "data/dimensions";
public static void storeDimensions(Dimension dimension) throws IOException {
if (dimension != null) {
PrintWriter pw = new PrintWriter(new File(dimensionsFile + "_temp"));
while (dimension.getParent() != null)
dimension = dimension.getParent();
storeAllChildNodes(pw, dimension);
pw.flush();
pw.close();
File dims = new File(dimensionsFile);
if (dims.exists())
dims.delete();
dims = new File(dimensionsFile + "_temp");
if (dims.exists())
dims.renameTo(new File(dimensionsFile));
}
}
private static void storeAllChildNodes(PrintWriter fw, Dimension dimension) {
if (dimension.getSubDimension().size() == 0) {
fw.println(dimension.getId());
return;
}
for (Dimension subDim : dimension.getSubDimension())
storeAllChildNodes(fw, subDim);
}
public static Dimension getRootDimension() throws FileNotFoundException {
Dimension rootDimension = new Dimension("root");
Scanner sc = new Scanner(new File(dimensionsFile));
while (sc.hasNext()) {
String line = sc.nextLine();
Dimension dim = rootDimension;
String[] path = line.split("\\.");
for (int i = 1; i < path.length; i++) {
Dimension matching = dim.getMatchingSubDimension(path[i]);
if (matching == null) {
matching = dim.addDimension(path[i]);
}
dim = matching;
}
}
return rootDimension;
}
}
| 1,933 | 0.574754 | 0.57372 | 55 | 34.145454 | 23.079639 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 0 |
121adbc2670e8b244d3d0b00034bb66cb860ffa7 | 35,373,350,686,767 | af4499f000a2bb22ea306a72755b5b02a2eb7ed9 | /Da_Luong_TCP/src/main/java/com/mycompany/da_luong_tcp/NguyenThiNga_102180260/bai2/model/Server.java | cf0ba7705ce3dec34ef96740e7e02dd0c15ebda1 | [] | no_license | nguyenthinga-0206/Lap-trinh-mang | https://github.com/nguyenthinga-0206/Lap-trinh-mang | ed6e1e9f06322f5cf28efc4166418ce1ce4cabe9 | f7de27991d105326f426bc0f722e0e403ba34844 | refs/heads/main | 2023-07-10T17:51:58.692000 | 2021-08-28T03:14:54 | 2021-08-28T03:14:54 | 354,804,523 | 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.da_luong_tcp.NguyenThiNga_102180260.bai2.model;
/**
*
* @author OS
*/
import java.net.*;
import java.io.*;
import java.util.Stack;
public class Server {
public static void main(String[] args) throws Exception {
try{
ServerSocket server=new ServerSocket(8888);
int counter=0;
System.out.println("Server Started ....");
while(true){
counter++;
Socket serverClient=server.accept(); //server accept the client connection request
ServerClientThread sct = new ServerClientThread(serverClient,counter); //send the request to a separate thread
sct.start();
}
}catch(Exception e){
System.out.println(e);
}
}
}
class ServerClientThread extends Thread {
Socket serverClient;
int clientNo;
String squre;
ServerClientThread(Socket inSocket,int counter){
serverClient = inSocket;
clientNo=counter;
}
public static int ThuTu(Character n) {
if(n == '^' || n == '%') return 3;
if(n == '*' || n == '/') return 2;
if(n == '+' || n == '-') return 1;
return 0;
}
public static String HauTo(String n) {
Stack<Character> Sh = new Stack<Character>() ;
String kq = "";
for(int i = 0 ; i < n.length(); i++) {
if(n.charAt(i) >= '0' && n.charAt(i) <= '9') kq += n.charAt(i);
else if(n.charAt(i) == '(' ) Sh.push(n.charAt(i));
else if(n.charAt(i) == ')') {
while(!Sh.empty() && Sh.peek() != '(') {
kq += Sh.peek();
Sh.pop();
}
Sh.pop();
}
else if(n.charAt(i) == '+' || n.charAt(i) == '-' || n.charAt(i) == '*' ||n.charAt(i) == '/' ||n.charAt(i) == '^' ||n.charAt(i) =='%' ) {
if(n.charAt(i-1) >= '0' && n.charAt(i-1) <= '9') kq += "#";
while(!Sh.empty() && ThuTu(Sh.peek()) >= ThuTu(n.charAt(i))) {
kq += Sh.peek();
Sh.pop();
}
Sh.push(n.charAt(i));
}
}
while(!Sh.empty()) {
if(Sh.peek() != '(') kq += Sh.peek();
Sh.pop();
}
return kq;
}
public static String Tinh(String n) {
Stack<Double> Sh = new Stack<Double>() ;
for(int i = 0 ; i < n.length() ; i ++) {
if(n.charAt(i) == '+' || n.charAt(i) == '-' || n.charAt(i) == '*' ||n.charAt(i) == '/' ||n.charAt(i) == '^' ||n.charAt(i) == '%') {
double a = Sh.peek(); Sh.pop();
double b = Sh.peek(); Sh.pop();
double kq = 0;
if(n.charAt(i) == '+') kq = a + b;
else if(n.charAt(i) == '-') kq = b - a;
else if(n.charAt(i) == '*') kq = a * b;
else if(n.charAt(i) == '/') kq = b / a;
else if(n.charAt(i) == '%') kq = b % a;
else if(n.charAt(i) == '^') {
kq = b;
for(int j = 0 ; j < (int)a-1; j++) {
kq *= b;
}
}
Sh.push(kq);
}
else{
double kq = 0;
while( i < n.length() && n.charAt(i) >= '0' && n.charAt(i) <= '9' ) {
kq = 10 * kq + (double)(n.charAt(i)-'0');
i++;
}
if( n.length() != i && n.charAt(i) != '#') i--;
Sh.push(kq);
}
}
return Sh.peek().toString();
}
public void run(){
try{
ServerClientThread serverThread = new ServerClientThread(serverClient, clientNo);
DataInputStream inStream = new DataInputStream(serverClient.getInputStream());
DataOutputStream outStream = new DataOutputStream(serverClient.getOutputStream());
String clientMessage="", serverMessage="";
while(!clientMessage.equals("bye")){
clientMessage=inStream.readUTF();
System.out.println("Chuoi tu Client "+clientNo+" : "+clientMessage);
squre = serverThread.Tinh(serverThread.HauTo(clientMessage));
outStream.writeUTF(squre);
outStream.flush();
}
inStream.close();
outStream.close();
serverClient.close();
}catch(Exception ex){
System.out.println(ex);
}finally{
System.out.println("Client -" + clientNo + " exit!! ");
}
}
}
| UTF-8 | Java | 4,675 | java | Server.java | Java | [
{
"context": "yenThiNga_102180260.bai2.model;\n\n/**\n *\n * @author OS\n */\nimport java.net.*;\nimport java.io.*;\nimport j",
"end": 276,
"score": 0.9275469779968262,
"start": 274,
"tag": "USERNAME",
"value": "OS"
}
] | 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.da_luong_tcp.NguyenThiNga_102180260.bai2.model;
/**
*
* @author OS
*/
import java.net.*;
import java.io.*;
import java.util.Stack;
public class Server {
public static void main(String[] args) throws Exception {
try{
ServerSocket server=new ServerSocket(8888);
int counter=0;
System.out.println("Server Started ....");
while(true){
counter++;
Socket serverClient=server.accept(); //server accept the client connection request
ServerClientThread sct = new ServerClientThread(serverClient,counter); //send the request to a separate thread
sct.start();
}
}catch(Exception e){
System.out.println(e);
}
}
}
class ServerClientThread extends Thread {
Socket serverClient;
int clientNo;
String squre;
ServerClientThread(Socket inSocket,int counter){
serverClient = inSocket;
clientNo=counter;
}
public static int ThuTu(Character n) {
if(n == '^' || n == '%') return 3;
if(n == '*' || n == '/') return 2;
if(n == '+' || n == '-') return 1;
return 0;
}
public static String HauTo(String n) {
Stack<Character> Sh = new Stack<Character>() ;
String kq = "";
for(int i = 0 ; i < n.length(); i++) {
if(n.charAt(i) >= '0' && n.charAt(i) <= '9') kq += n.charAt(i);
else if(n.charAt(i) == '(' ) Sh.push(n.charAt(i));
else if(n.charAt(i) == ')') {
while(!Sh.empty() && Sh.peek() != '(') {
kq += Sh.peek();
Sh.pop();
}
Sh.pop();
}
else if(n.charAt(i) == '+' || n.charAt(i) == '-' || n.charAt(i) == '*' ||n.charAt(i) == '/' ||n.charAt(i) == '^' ||n.charAt(i) =='%' ) {
if(n.charAt(i-1) >= '0' && n.charAt(i-1) <= '9') kq += "#";
while(!Sh.empty() && ThuTu(Sh.peek()) >= ThuTu(n.charAt(i))) {
kq += Sh.peek();
Sh.pop();
}
Sh.push(n.charAt(i));
}
}
while(!Sh.empty()) {
if(Sh.peek() != '(') kq += Sh.peek();
Sh.pop();
}
return kq;
}
public static String Tinh(String n) {
Stack<Double> Sh = new Stack<Double>() ;
for(int i = 0 ; i < n.length() ; i ++) {
if(n.charAt(i) == '+' || n.charAt(i) == '-' || n.charAt(i) == '*' ||n.charAt(i) == '/' ||n.charAt(i) == '^' ||n.charAt(i) == '%') {
double a = Sh.peek(); Sh.pop();
double b = Sh.peek(); Sh.pop();
double kq = 0;
if(n.charAt(i) == '+') kq = a + b;
else if(n.charAt(i) == '-') kq = b - a;
else if(n.charAt(i) == '*') kq = a * b;
else if(n.charAt(i) == '/') kq = b / a;
else if(n.charAt(i) == '%') kq = b % a;
else if(n.charAt(i) == '^') {
kq = b;
for(int j = 0 ; j < (int)a-1; j++) {
kq *= b;
}
}
Sh.push(kq);
}
else{
double kq = 0;
while( i < n.length() && n.charAt(i) >= '0' && n.charAt(i) <= '9' ) {
kq = 10 * kq + (double)(n.charAt(i)-'0');
i++;
}
if( n.length() != i && n.charAt(i) != '#') i--;
Sh.push(kq);
}
}
return Sh.peek().toString();
}
public void run(){
try{
ServerClientThread serverThread = new ServerClientThread(serverClient, clientNo);
DataInputStream inStream = new DataInputStream(serverClient.getInputStream());
DataOutputStream outStream = new DataOutputStream(serverClient.getOutputStream());
String clientMessage="", serverMessage="";
while(!clientMessage.equals("bye")){
clientMessage=inStream.readUTF();
System.out.println("Chuoi tu Client "+clientNo+" : "+clientMessage);
squre = serverThread.Tinh(serverThread.HauTo(clientMessage));
outStream.writeUTF(squre);
outStream.flush();
}
inStream.close();
outStream.close();
serverClient.close();
}catch(Exception ex){
System.out.println(ex);
}finally{
System.out.println("Client -" + clientNo + " exit!! ");
}
}
}
| 4,675 | 0.46738 | 0.459679 | 131 | 34.67939 | 27.783039 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.908397 | false | false | 0 |
20648f6f28b9d6d98cc90337477f764813172131 | 26,809,185,922,031 | 9c8255352a96a91766857155107f99c87644aa19 | /src/com/qi/entity/PageInfo.java | 25e8738a96edac01ca5be54f932a93607f4c7b2d | [
"MIT"
] | permissive | Jason-lzm/MS | https://github.com/Jason-lzm/MS | 4d6a99548478aad59a159ecc6508f7d94ad264e3 | a8b4a1338fec76b23c169d041c463f233a2acfe8 | refs/heads/master | 2021-05-08T08:23:04.113000 | 2017-10-17T00:00:34 | 2017-10-17T00:00:34 | 107,077,826 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qi.entity;
import com.qi.utils.ConfigUtils;
import com.qi.utils.SelectPageUtil;
public class PageInfo {
private Integer page;
private Integer pagesize;
private Integer totalpages;
public Integer getPage() {
return page;
}
public void setPage(Integer page,Integer totalPages) {
if(page<1){
this.page=1;
}else if(totalPages>0 && page>totalPages){
this.page=totalPages;
}else{
this.page = page;
}
}
public Integer getPagesize() {
return pagesize;
}
public void setPagesize(String pageSize) {
this.pagesize = Integer.parseInt(ConfigUtils.getConfig(pageSize));
}
public Integer getTotalpages() {
return totalpages;
}
public void setTotalpages(Integer pageSize,String tableName,Integer totalPageCount) {
this.totalpages = SelectPageUtil.getTotalPage(pageSize, tableName,totalPageCount);
}
}
| UTF-8 | Java | 848 | java | PageInfo.java | Java | [] | null | [] | package com.qi.entity;
import com.qi.utils.ConfigUtils;
import com.qi.utils.SelectPageUtil;
public class PageInfo {
private Integer page;
private Integer pagesize;
private Integer totalpages;
public Integer getPage() {
return page;
}
public void setPage(Integer page,Integer totalPages) {
if(page<1){
this.page=1;
}else if(totalPages>0 && page>totalPages){
this.page=totalPages;
}else{
this.page = page;
}
}
public Integer getPagesize() {
return pagesize;
}
public void setPagesize(String pageSize) {
this.pagesize = Integer.parseInt(ConfigUtils.getConfig(pageSize));
}
public Integer getTotalpages() {
return totalpages;
}
public void setTotalpages(Integer pageSize,String tableName,Integer totalPageCount) {
this.totalpages = SelectPageUtil.getTotalPage(pageSize, tableName,totalPageCount);
}
}
| 848 | 0.741745 | 0.738208 | 38 | 21.31579 | 22.35845 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.684211 | false | false | 0 |
88306126aa532ca393d493bee89754995f7c6d87 | 8,787,503,124,628 | 548f30da7a2e4e03041ef41fce63568f161b7319 | /ExamQuestionSimpleChoice.java | 2b0ed1eeefdf4ed39205397a3a6129b973dc0796 | [] | no_license | wdowns/WS4 | https://github.com/wdowns/WS4 | acb31942802ee8ac3a10c1e95d71a4c88299dec7 | 2d110dd2849023a9243df2e3ed8bf1c4d3440669 | refs/heads/master | 2021-01-02T08:35:00.899000 | 2017-08-01T16:11:56 | 2017-08-01T16:11:56 | 99,020,389 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ArrayList;
/**
*(b) Write a subclass ExamQuestionSimpleChoice of class ExamQuestion, in which the
* possibleAnswers are an ArrayList<String>, that is, the answer is supposed to be
* a choice from the list and the correctAnswer is of type int, representing the position
* of the correct answer (start counting from 1, since that is what humans normally do).
* Write a method public int answer(int value) in the subclass that returns full
* marks if the answer is correct and 0 otherwise. Furthermore, write a suitable public
* String toString() method, making use of inheritance as far as possible.
*
* @author William Downs
* @version 07/11/15
*/
public class ExamQuestionSimpleChoice extends ExamQuestion {
private ArrayList<String> possibleAnswers = new ArrayList<>();
private int correctAnswer;
private String question;
private ExamQuestionSimpleChoice ExamQuestionSimpleChoice;
public ExamQuestionSimpleChoice(String question, int maximalMark,
ArrayList<String> possibleAnswers, int correctAnswer) {
super(question, maximalMark);
this.setPossibleAnswers(new ArrayList<String>(possibleAnswers));
this.correctAnswer = correctAnswer;
}
public int answer(int value) {// Method that returns full marks if the answer is correct.
if (value == this.correctAnswer) {
return getMaximalMark();
} else
return 0;
}
public ArrayList<String> getPossibleAnswers() {
return possibleAnswers;
}
public void setPossibleAnswers(ArrayList<String> possibleAnswers) {
this.possibleAnswers = possibleAnswers;
}
@Override
public String toString() {
return super.toString()
+ ("Possible answers are: 4\n" + "" + "5\n" + "10\n" + "20\n"
+ "" + "Correct answer position is: 2\n");
}
} | UTF-8 | Java | 1,759 | java | ExamQuestionSimpleChoice.java | Java | [
{
"context": " of inheritance as far as possible.\n * \n * @author William Downs\n * @version 07/11/15 \n */\n\npublic class ExamQuest",
"end": 650,
"score": 0.9996163249015808,
"start": 637,
"tag": "NAME",
"value": "William Downs"
}
] | null | [] | import java.util.ArrayList;
/**
*(b) Write a subclass ExamQuestionSimpleChoice of class ExamQuestion, in which the
* possibleAnswers are an ArrayList<String>, that is, the answer is supposed to be
* a choice from the list and the correctAnswer is of type int, representing the position
* of the correct answer (start counting from 1, since that is what humans normally do).
* Write a method public int answer(int value) in the subclass that returns full
* marks if the answer is correct and 0 otherwise. Furthermore, write a suitable public
* String toString() method, making use of inheritance as far as possible.
*
* @author <NAME>
* @version 07/11/15
*/
public class ExamQuestionSimpleChoice extends ExamQuestion {
private ArrayList<String> possibleAnswers = new ArrayList<>();
private int correctAnswer;
private String question;
private ExamQuestionSimpleChoice ExamQuestionSimpleChoice;
public ExamQuestionSimpleChoice(String question, int maximalMark,
ArrayList<String> possibleAnswers, int correctAnswer) {
super(question, maximalMark);
this.setPossibleAnswers(new ArrayList<String>(possibleAnswers));
this.correctAnswer = correctAnswer;
}
public int answer(int value) {// Method that returns full marks if the answer is correct.
if (value == this.correctAnswer) {
return getMaximalMark();
} else
return 0;
}
public ArrayList<String> getPossibleAnswers() {
return possibleAnswers;
}
public void setPossibleAnswers(ArrayList<String> possibleAnswers) {
this.possibleAnswers = possibleAnswers;
}
@Override
public String toString() {
return super.toString()
+ ("Possible answers are: 4\n" + "" + "5\n" + "10\n" + "20\n"
+ "" + "Correct answer position is: 2\n");
}
} | 1,752 | 0.74133 | 0.732234 | 53 | 32.207546 | 30.846153 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.415094 | false | false | 0 |
1f28cd1f38a8b12f1fbb0fc42c40fee4b8dc840d | 8,787,503,122,645 | e425c13a0e62ede731b19e432471c0821b1dd098 | /pa/src/public/nc/uap/lfw/pa/info/LabelCompInfo.java | 200edfb2933de33a2ebc0435e99e998791049ca3 | [] | no_license | thimda/rsd_web | https://github.com/thimda/rsd_web | 42c6ee54fcdd2fc699b74a1a48af2424fb5fd751 | 8c32851118eb98de1df2f0889a693258f10eab11 | refs/heads/master | 2020-05-17T18:58:22.839000 | 2012-04-01T22:24:41 | 2012-04-01T22:24:41 | 3,823,167 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package nc.uap.lfw.pa.info;
import java.util.ArrayList;
import java.util.List;
import nc.uap.lfw.core.common.StringDataTypeConst;
/**
* @author wupeng1
* @version 6.0 2011-9-6
* @since 1.6
*/
public class LabelCompInfo extends ControlInfo {
private static final long serialVersionUID = 1L;
private static final List<IPropertyInfo> list = new ArrayList<IPropertyInfo>();
static{
ComboPropertyInfo vis = new ComboPropertyInfo();
vis.setId("visible");
vis.setKeys(new String[]{"是","否"});
vis.setValues(new String[]{"Y", "N"});
vis.setType(StringDataTypeConst.bOOLEAN);
vis.setDsField("combo_ext1");
vis.setLabel("是否可见");
vis.setVoField("visibles");
vis.setVisible(true);
vis.setEditable(true);
list.add(vis);
ComboPropertyInfo ena = new ComboPropertyInfo();
ena.setId("enabled");
ena.setKeys(new String[]{"是", "否"});
ena.setValues(new String[]{"Y", "N"});
ena.setType(StringDataTypeConst.bOOLEAN);
ena.setVisible(true);
ena.setEditable(true);
ena.setDsField("combo_ext4");
ena.setLabel("是否可编辑");
ena.setVoField("enableds");
list.add(ena);
StringPropertyInfo width = new StringPropertyInfo();
width.setId("width");
width.setEditable(true);
width.setVisible(true);
width.setDsField("string_ext4");
width.setLabel("宽");
width.setVoField("width");
list.add(width);
StringPropertyInfo height = new StringPropertyInfo();
height.setId("height");
height.setEditable(true);
height.setVisible(true);
height.setDsField("string_ext5");
width.setLabel("高");
height.setVoField("height");
list.add(height);
// StringPropertyInfo top = new StringPropertyInfo();
// top.setId("top");
// top.setEditable(true);
// top.setVisible(false);
// top.setDsField("string_ext6");
// width.setLabel("顶层距");
// top.setVoField("itop");
// list.add(top);
//
// StringPropertyInfo left = new StringPropertyInfo();
// left.setId("left");
// left.setEditable(true);
// left.setVisible(false);
// left.setDsField("string_ext7");
// left.setLabel("左边距");
// left.setVoField("ileft");
// list.add(left);
// StringPropertyInfo position = new StringPropertyInfo();
// position.setId("position");
// position.setEditable(true);
// position.setVisible(true);
// position.setDsField("string_ext8");
// position.setLabel("位置");
// position.setVoField("positions");
// list.add(position);
StringPropertyInfo contextmenu = new StringPropertyInfo();
contextmenu.setId("contextMenu");
contextmenu.setEditable(true);
contextmenu.setVisible(true);
contextmenu.setDsField("string_ext9");
contextmenu.setLabel("弹出菜单");
contextmenu.setVoField("contextmenu");
list.add(contextmenu);
StringPropertyInfo classname = new StringPropertyInfo();
classname.setId("className");
classname.setEditable(true);
classname.setVisible(true);
classname.setDsField("string_ext10");
classname.setLabel("自定义主题");
classname.setVoField("classname");
list.add(classname);
StringPropertyInfo i18nname = new StringPropertyInfo();
i18nname.setId("i18nName");
i18nname.setEditable(true);
i18nname.setVisible(true);
i18nname.setDsField("string_ext11");
i18nname.setLabel("多语显示值");
i18nname.setVoField("i18nname");
list.add(i18nname);
StringPropertyInfo langdir = new StringPropertyInfo();
langdir.setId("langDir");
langdir.setEditable(true);
langdir.setVisible(true);
langdir.setDsField("string_ext12");
langdir.setLabel("多语目录");
langdir.setVoField("langdir");
list.add(langdir);
StringPropertyInfo text = new StringPropertyInfo();
text.setId("text");
text.setEditable(true);
text.setVisible(true);
text.setDsField("string_ext13");
text.setLabel("显示值");
text.setVoField("itext");
list.add(text);
StringPropertyInfo innerhtml = new StringPropertyInfo();
innerhtml.setId("innerHTML");
innerhtml.setEditable(true);
innerhtml.setVisible(true);
innerhtml.setDsField("string_ext14");
innerhtml.setLabel("HTML内容");
innerhtml.setVoField("innerhtml");
list.add(innerhtml);
StringPropertyInfo color = new StringPropertyInfo();
color.setId("color");
color.setEditable(true);
color.setVisible(true);
color.setDsField("string_ext15");
color.setLabel("字体颜色");
color.setVoField("color");
list.add(color);
StringPropertyInfo style = new StringPropertyInfo();
style.setId("style");
style.setEditable(true);
style.setVisible(true);
style.setDsField("string_ext16");
style.setLabel("字体样式");
style.setVoField("style");
//list.add(style);
StringPropertyInfo weight = new StringPropertyInfo();
weight.setId("weight");
weight.setEditable(true);
weight.setVisible(true);
weight.setDsField("string_ext17");
weight.setLabel("字体宽度");
weight.setVoField("weight");
//list.add(weight);
StringPropertyInfo size = new StringPropertyInfo();
size.setId("size");
size.setEditable(true);
size.setVisible(true);
size.setDsField("string_ext18");
size.setLabel("字体大小");
size.setVoField("size");
//list.add(size);
StringPropertyInfo family = new StringPropertyInfo();
family.setId("family");
family.setEditable(true);
family.setVisible(true);
family.setDsField("string_ext19");
family.setLabel("字体");
family.setVoField("family");
//list.add(family);
ComboPropertyInfo textAlign = new ComboPropertyInfo();
textAlign.setId("textAlign");
textAlign.setKeys(new String[]{"左", "中", "右"});
textAlign.setValues(new String[]{"left", "center", "right"});
textAlign.setType(StringDataTypeConst.STRING);
textAlign.setVisible(true);
textAlign.setEditable(true);
textAlign.setDsField("combo_ext5");
textAlign.setLabel("文字位置");
textAlign.setVoField("textalign");
list.add(textAlign);
// StringPropertyInfo parentid = new StringPropertyInfo();
// parentid.setId("");
// parentid.setVisible(false);
// parentid.setEditable(true);
// parentid.setDsField("parentid");
// parentid.setLabel("父ID");
// parentid.setVoField("parentid");
// list.add(parentid);
}
@Override
public IPropertyInfo[] getPropertyInfos() {
IPropertyInfo[] pinfos = super.getPropertyInfos();
if(pinfos == null)
return list.toArray(new IPropertyInfo[0]);
else{
int length = pinfos.length;
IPropertyInfo[] newArr = new IPropertyInfo[list.size() + length];
System.arraycopy(list.toArray(), 0, newArr, 0, list.size());
System.arraycopy(pinfos, 0, newArr, list.size(), length);
return newArr;
}
}
}
| GB18030 | Java | 6,590 | java | LabelCompInfo.java | Java | [
{
"context": "w.core.common.StringDataTypeConst;\n\n/**\n * @author wupeng1\n * @version 6.0 2011-9-6\n * @since 1.6\n */\npublic",
"end": 167,
"score": 0.9996792078018188,
"start": 160,
"tag": "USERNAME",
"value": "wupeng1"
}
] | null | [] | /**
*
*/
package nc.uap.lfw.pa.info;
import java.util.ArrayList;
import java.util.List;
import nc.uap.lfw.core.common.StringDataTypeConst;
/**
* @author wupeng1
* @version 6.0 2011-9-6
* @since 1.6
*/
public class LabelCompInfo extends ControlInfo {
private static final long serialVersionUID = 1L;
private static final List<IPropertyInfo> list = new ArrayList<IPropertyInfo>();
static{
ComboPropertyInfo vis = new ComboPropertyInfo();
vis.setId("visible");
vis.setKeys(new String[]{"是","否"});
vis.setValues(new String[]{"Y", "N"});
vis.setType(StringDataTypeConst.bOOLEAN);
vis.setDsField("combo_ext1");
vis.setLabel("是否可见");
vis.setVoField("visibles");
vis.setVisible(true);
vis.setEditable(true);
list.add(vis);
ComboPropertyInfo ena = new ComboPropertyInfo();
ena.setId("enabled");
ena.setKeys(new String[]{"是", "否"});
ena.setValues(new String[]{"Y", "N"});
ena.setType(StringDataTypeConst.bOOLEAN);
ena.setVisible(true);
ena.setEditable(true);
ena.setDsField("combo_ext4");
ena.setLabel("是否可编辑");
ena.setVoField("enableds");
list.add(ena);
StringPropertyInfo width = new StringPropertyInfo();
width.setId("width");
width.setEditable(true);
width.setVisible(true);
width.setDsField("string_ext4");
width.setLabel("宽");
width.setVoField("width");
list.add(width);
StringPropertyInfo height = new StringPropertyInfo();
height.setId("height");
height.setEditable(true);
height.setVisible(true);
height.setDsField("string_ext5");
width.setLabel("高");
height.setVoField("height");
list.add(height);
// StringPropertyInfo top = new StringPropertyInfo();
// top.setId("top");
// top.setEditable(true);
// top.setVisible(false);
// top.setDsField("string_ext6");
// width.setLabel("顶层距");
// top.setVoField("itop");
// list.add(top);
//
// StringPropertyInfo left = new StringPropertyInfo();
// left.setId("left");
// left.setEditable(true);
// left.setVisible(false);
// left.setDsField("string_ext7");
// left.setLabel("左边距");
// left.setVoField("ileft");
// list.add(left);
// StringPropertyInfo position = new StringPropertyInfo();
// position.setId("position");
// position.setEditable(true);
// position.setVisible(true);
// position.setDsField("string_ext8");
// position.setLabel("位置");
// position.setVoField("positions");
// list.add(position);
StringPropertyInfo contextmenu = new StringPropertyInfo();
contextmenu.setId("contextMenu");
contextmenu.setEditable(true);
contextmenu.setVisible(true);
contextmenu.setDsField("string_ext9");
contextmenu.setLabel("弹出菜单");
contextmenu.setVoField("contextmenu");
list.add(contextmenu);
StringPropertyInfo classname = new StringPropertyInfo();
classname.setId("className");
classname.setEditable(true);
classname.setVisible(true);
classname.setDsField("string_ext10");
classname.setLabel("自定义主题");
classname.setVoField("classname");
list.add(classname);
StringPropertyInfo i18nname = new StringPropertyInfo();
i18nname.setId("i18nName");
i18nname.setEditable(true);
i18nname.setVisible(true);
i18nname.setDsField("string_ext11");
i18nname.setLabel("多语显示值");
i18nname.setVoField("i18nname");
list.add(i18nname);
StringPropertyInfo langdir = new StringPropertyInfo();
langdir.setId("langDir");
langdir.setEditable(true);
langdir.setVisible(true);
langdir.setDsField("string_ext12");
langdir.setLabel("多语目录");
langdir.setVoField("langdir");
list.add(langdir);
StringPropertyInfo text = new StringPropertyInfo();
text.setId("text");
text.setEditable(true);
text.setVisible(true);
text.setDsField("string_ext13");
text.setLabel("显示值");
text.setVoField("itext");
list.add(text);
StringPropertyInfo innerhtml = new StringPropertyInfo();
innerhtml.setId("innerHTML");
innerhtml.setEditable(true);
innerhtml.setVisible(true);
innerhtml.setDsField("string_ext14");
innerhtml.setLabel("HTML内容");
innerhtml.setVoField("innerhtml");
list.add(innerhtml);
StringPropertyInfo color = new StringPropertyInfo();
color.setId("color");
color.setEditable(true);
color.setVisible(true);
color.setDsField("string_ext15");
color.setLabel("字体颜色");
color.setVoField("color");
list.add(color);
StringPropertyInfo style = new StringPropertyInfo();
style.setId("style");
style.setEditable(true);
style.setVisible(true);
style.setDsField("string_ext16");
style.setLabel("字体样式");
style.setVoField("style");
//list.add(style);
StringPropertyInfo weight = new StringPropertyInfo();
weight.setId("weight");
weight.setEditable(true);
weight.setVisible(true);
weight.setDsField("string_ext17");
weight.setLabel("字体宽度");
weight.setVoField("weight");
//list.add(weight);
StringPropertyInfo size = new StringPropertyInfo();
size.setId("size");
size.setEditable(true);
size.setVisible(true);
size.setDsField("string_ext18");
size.setLabel("字体大小");
size.setVoField("size");
//list.add(size);
StringPropertyInfo family = new StringPropertyInfo();
family.setId("family");
family.setEditable(true);
family.setVisible(true);
family.setDsField("string_ext19");
family.setLabel("字体");
family.setVoField("family");
//list.add(family);
ComboPropertyInfo textAlign = new ComboPropertyInfo();
textAlign.setId("textAlign");
textAlign.setKeys(new String[]{"左", "中", "右"});
textAlign.setValues(new String[]{"left", "center", "right"});
textAlign.setType(StringDataTypeConst.STRING);
textAlign.setVisible(true);
textAlign.setEditable(true);
textAlign.setDsField("combo_ext5");
textAlign.setLabel("文字位置");
textAlign.setVoField("textalign");
list.add(textAlign);
// StringPropertyInfo parentid = new StringPropertyInfo();
// parentid.setId("");
// parentid.setVisible(false);
// parentid.setEditable(true);
// parentid.setDsField("parentid");
// parentid.setLabel("父ID");
// parentid.setVoField("parentid");
// list.add(parentid);
}
@Override
public IPropertyInfo[] getPropertyInfos() {
IPropertyInfo[] pinfos = super.getPropertyInfos();
if(pinfos == null)
return list.toArray(new IPropertyInfo[0]);
else{
int length = pinfos.length;
IPropertyInfo[] newArr = new IPropertyInfo[list.size() + length];
System.arraycopy(list.toArray(), 0, newArr, 0, list.size());
System.arraycopy(pinfos, 0, newArr, list.size(), length);
return newArr;
}
}
}
| 6,590 | 0.704313 | 0.694229 | 227 | 27.396475 | 15.910864 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.69163 | false | false | 0 |
73beb8476429911e4326e3f4ae8880492c1ee622 | 23,252,952,966,488 | 4f4cc0d5fd94497fef25e11b41f2c85ed98e46e4 | /src/main/java/mcp/mobius/opis/data/managers/TileEntityManager.java | 97e42d1c3a1a9001720fcb8d36cb24efe0e3ed34 | [] | no_license | jaredlll08/Opis | https://github.com/jaredlll08/Opis | 06ab09d5f4d026f3cfe65fa23cff7a8a8cacc4bf | 91ee7a90ce4d9524638b0a6793d5a327decb18be | refs/heads/master | 2017-12-13T03:10:40.349000 | 2017-01-08T22:38:54 | 2017-01-08T22:38:54 | 78,375,256 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mcp.mobius.opis.data.managers;
import com.google.common.collect.HashBasedTable;
import mcp.mobius.opis.data.profilers.ProfilerSection;
import mcp.mobius.opis.data.holders.basetypes.*;
import mcp.mobius.opis.data.holders.newtypes.*;
import mcp.mobius.opis.data.holders.stats.StatsChunk;
import mcp.mobius.opis.data.profilers.ProfilerTileEntityUpdate;
import mcp.mobius.opis.ModOpis;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.*;
import net.minecraftforge.common.DimensionManager;
import java.util.*;
public enum TileEntityManager {
INSTANCE;
public HashMap<CoordinatesChunk, StatsChunk> getTimes(int dim) {
HashMap<CoordinatesChunk, StatsChunk> chunks = new HashMap<>();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().stream().filter((coord) -> (coord.dim == dim)).forEachOrdered((coord) -> {
CoordinatesChunk coordC = new CoordinatesChunk(coord);
if (!(chunks.containsKey(coordC))) {
chunks.put(coordC, new StatsChunk());
}
chunks.get(coordC).addEntity();
chunks.get(coordC).addMeasure(((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coord).getGeometricMean());
});
return chunks;
}
private void cleanUpStats() {
/*
HashSet<CoordinatesBlock> dirty = new HashSet<CoordinatesBlock>();
for (CoordinatesBlock tecoord : TileEntityManager.stats.keySet()){
World world = DimensionManager.getWorld(tecoord.dim);
int blockID = world.getBlockId(tecoord.x, tecoord.y, tecoord.z);
short blockMeta = (short)world.getBlockMetadata(tecoord.x, tecoord.y, tecoord.z);
if ((blockID != TileEntityManager.stats.get(tecoord).getID()) || (blockMeta != TileEntityManager.stats.get(tecoord).getMeta())){
dirty.add(tecoord);
}
}
for (CoordinatesBlock tecoord : dirty){
stats.remove(tecoord);
references.remove(tecoord);
}
*/
}
public ArrayList<DataBlockTileEntity> getTileEntitiesInChunk(CoordinatesChunk coord) {
cleanUpStats();
ArrayList<DataBlockTileEntity> returnList = new ArrayList<>();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().stream().filter((tecoord) -> (coord.equals(tecoord.asCoordinatesChunk()))).map((tecoord) -> new DataBlockTileEntity().fill(tecoord)).forEachOrdered((testats) -> {
returnList.add(testats);
});
return returnList;
}
public ArrayList<DataBlockTileEntity> getWorses(int amount) {
ArrayList<DataBlockTileEntity> sorted = new ArrayList<>();
ArrayList<DataBlockTileEntity> topEntities = new ArrayList<>();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().forEach((coord) -> {
sorted.add(new DataBlockTileEntity().fill(coord));
});
Collections.sort(sorted);
for (int i = 0; i < Math.min(amount, sorted.size()); i++) {
topEntities.add(sorted.get(i));
}
return topEntities;
}
public DataTiming getTotalUpdateTime() {
double updateTime = 0D;
updateTime = ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().stream().map((coords) -> ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coords).getGeometricMean()).reduce(updateTime, (accumulator, _item) -> accumulator + _item);
return new DataTiming(updateTime);
}
public int getAmountTileEntities() {
int amountTileEntities = 0;
for (WorldServer world : DimensionManager.getWorlds()) {
amountTileEntities += world.loadedTileEntityList.size();
}
return amountTileEntities;
}
public ArrayList<DataTileEntity> getOrphans() {
ArrayList<DataTileEntity> orphans = new ArrayList<>();
HashMap<CoordinatesBlock, DataTileEntity> coordHashset = new HashMap<>();
HashSet<Integer> registeredEntities = new HashSet<>();
for (WorldServer world : DimensionManager.getWorlds()) {
world.loadedTileEntityList.stream().map((o) -> (TileEntity) o).forEachOrdered((tileEntity) -> {
CoordinatesBlock coord = new CoordinatesBlock(world.provider.getDimension(), tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ());
//This entitie has already been seen;
int hash = System.identityHashCode(tileEntity);
if (!(registeredEntities.contains(hash))) {
IBlockState block = world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ()));
if (block.getBlock() == Blocks.AIR || !block.getBlock().hasTileEntity() || world.getTileEntity(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())) == null || world.getTileEntity(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())).getClass() != tileEntity.getClass()) {
orphans.add(new DataTileEntity().fill(tileEntity, "Orphan"));
registeredEntities.add(hash);
}
if (coordHashset.containsKey(coord)) {
if (!registeredEntities.contains(hash)) {
orphans.add(new DataTileEntity().fill(tileEntity, "Duplicate"));
}
if (!registeredEntities.contains(coordHashset.get(coord).hashCode)) {
orphans.add(coordHashset.get(coord));
}
}
if (!coordHashset.containsKey(coord)) {
coordHashset.put(coord, new DataTileEntity().fill(tileEntity, "Duplicate"));
}
}
});
}
ModOpis.log.warn(String.format("Found %d potential orphans !", orphans.size()));
return orphans;
}
public ArrayList<DataBlockTileEntityPerClass> getCumulativeAmountTileEntities() {
HashBasedTable<Integer, Integer, DataBlockTileEntityPerClass> data = HashBasedTable.create();
for (WorldServer world : DimensionManager.getWorlds()) {
world.loadedTileEntityList.stream().map((o) -> (TileEntity) o).forEachOrdered((tileEntity) -> {
int id = Block.getIdFromBlock(world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())).getBlock());
int meta = world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())).getBlock().getMetaFromState(world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())));
if (!data.contains(id, meta)) {
data.put(id, meta, new DataBlockTileEntityPerClass(id, meta));
}
data.get(id, meta).add();
});
}
return new ArrayList<>(data.values());
}
public ArrayList<DataBlockTileEntityPerClass> getCumulativeTimingTileEntities() {
HashBasedTable<Integer, Integer, DataBlockTileEntityPerClass> data = HashBasedTable.create();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().forEach((coord) -> {
World world = DimensionManager.getWorld(coord.dim);
int id = Block.getIdFromBlock(world.getBlockState(new BlockPos(coord.x, coord.y, coord.z)).getBlock());
int meta = world.getBlockState(new BlockPos(coord.x, coord.y, coord.z)).getBlock().getMetaFromState(world.getBlockState(new BlockPos(coord.x, coord.y, coord.z)));
if (!data.contains(id, meta)) {
data.put(id, meta, new DataBlockTileEntityPerClass(id, meta));
}
data.get(id, meta).add(((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coord).getGeometricMean());
});
return new ArrayList<>(data.values());
}
}
| UTF-8 | Java | 8,454 | java | TileEntityManager.java | Java | [] | null | [] | package mcp.mobius.opis.data.managers;
import com.google.common.collect.HashBasedTable;
import mcp.mobius.opis.data.profilers.ProfilerSection;
import mcp.mobius.opis.data.holders.basetypes.*;
import mcp.mobius.opis.data.holders.newtypes.*;
import mcp.mobius.opis.data.holders.stats.StatsChunk;
import mcp.mobius.opis.data.profilers.ProfilerTileEntityUpdate;
import mcp.mobius.opis.ModOpis;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.*;
import net.minecraftforge.common.DimensionManager;
import java.util.*;
public enum TileEntityManager {
INSTANCE;
public HashMap<CoordinatesChunk, StatsChunk> getTimes(int dim) {
HashMap<CoordinatesChunk, StatsChunk> chunks = new HashMap<>();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().stream().filter((coord) -> (coord.dim == dim)).forEachOrdered((coord) -> {
CoordinatesChunk coordC = new CoordinatesChunk(coord);
if (!(chunks.containsKey(coordC))) {
chunks.put(coordC, new StatsChunk());
}
chunks.get(coordC).addEntity();
chunks.get(coordC).addMeasure(((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coord).getGeometricMean());
});
return chunks;
}
private void cleanUpStats() {
/*
HashSet<CoordinatesBlock> dirty = new HashSet<CoordinatesBlock>();
for (CoordinatesBlock tecoord : TileEntityManager.stats.keySet()){
World world = DimensionManager.getWorld(tecoord.dim);
int blockID = world.getBlockId(tecoord.x, tecoord.y, tecoord.z);
short blockMeta = (short)world.getBlockMetadata(tecoord.x, tecoord.y, tecoord.z);
if ((blockID != TileEntityManager.stats.get(tecoord).getID()) || (blockMeta != TileEntityManager.stats.get(tecoord).getMeta())){
dirty.add(tecoord);
}
}
for (CoordinatesBlock tecoord : dirty){
stats.remove(tecoord);
references.remove(tecoord);
}
*/
}
public ArrayList<DataBlockTileEntity> getTileEntitiesInChunk(CoordinatesChunk coord) {
cleanUpStats();
ArrayList<DataBlockTileEntity> returnList = new ArrayList<>();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().stream().filter((tecoord) -> (coord.equals(tecoord.asCoordinatesChunk()))).map((tecoord) -> new DataBlockTileEntity().fill(tecoord)).forEachOrdered((testats) -> {
returnList.add(testats);
});
return returnList;
}
public ArrayList<DataBlockTileEntity> getWorses(int amount) {
ArrayList<DataBlockTileEntity> sorted = new ArrayList<>();
ArrayList<DataBlockTileEntity> topEntities = new ArrayList<>();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().forEach((coord) -> {
sorted.add(new DataBlockTileEntity().fill(coord));
});
Collections.sort(sorted);
for (int i = 0; i < Math.min(amount, sorted.size()); i++) {
topEntities.add(sorted.get(i));
}
return topEntities;
}
public DataTiming getTotalUpdateTime() {
double updateTime = 0D;
updateTime = ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().stream().map((coords) -> ((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coords).getGeometricMean()).reduce(updateTime, (accumulator, _item) -> accumulator + _item);
return new DataTiming(updateTime);
}
public int getAmountTileEntities() {
int amountTileEntities = 0;
for (WorldServer world : DimensionManager.getWorlds()) {
amountTileEntities += world.loadedTileEntityList.size();
}
return amountTileEntities;
}
public ArrayList<DataTileEntity> getOrphans() {
ArrayList<DataTileEntity> orphans = new ArrayList<>();
HashMap<CoordinatesBlock, DataTileEntity> coordHashset = new HashMap<>();
HashSet<Integer> registeredEntities = new HashSet<>();
for (WorldServer world : DimensionManager.getWorlds()) {
world.loadedTileEntityList.stream().map((o) -> (TileEntity) o).forEachOrdered((tileEntity) -> {
CoordinatesBlock coord = new CoordinatesBlock(world.provider.getDimension(), tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ());
//This entitie has already been seen;
int hash = System.identityHashCode(tileEntity);
if (!(registeredEntities.contains(hash))) {
IBlockState block = world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ()));
if (block.getBlock() == Blocks.AIR || !block.getBlock().hasTileEntity() || world.getTileEntity(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())) == null || world.getTileEntity(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())).getClass() != tileEntity.getClass()) {
orphans.add(new DataTileEntity().fill(tileEntity, "Orphan"));
registeredEntities.add(hash);
}
if (coordHashset.containsKey(coord)) {
if (!registeredEntities.contains(hash)) {
orphans.add(new DataTileEntity().fill(tileEntity, "Duplicate"));
}
if (!registeredEntities.contains(coordHashset.get(coord).hashCode)) {
orphans.add(coordHashset.get(coord));
}
}
if (!coordHashset.containsKey(coord)) {
coordHashset.put(coord, new DataTileEntity().fill(tileEntity, "Duplicate"));
}
}
});
}
ModOpis.log.warn(String.format("Found %d potential orphans !", orphans.size()));
return orphans;
}
public ArrayList<DataBlockTileEntityPerClass> getCumulativeAmountTileEntities() {
HashBasedTable<Integer, Integer, DataBlockTileEntityPerClass> data = HashBasedTable.create();
for (WorldServer world : DimensionManager.getWorlds()) {
world.loadedTileEntityList.stream().map((o) -> (TileEntity) o).forEachOrdered((tileEntity) -> {
int id = Block.getIdFromBlock(world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())).getBlock());
int meta = world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())).getBlock().getMetaFromState(world.getBlockState(new BlockPos(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ())));
if (!data.contains(id, meta)) {
data.put(id, meta, new DataBlockTileEntityPerClass(id, meta));
}
data.get(id, meta).add();
});
}
return new ArrayList<>(data.values());
}
public ArrayList<DataBlockTileEntityPerClass> getCumulativeTimingTileEntities() {
HashBasedTable<Integer, Integer, DataBlockTileEntityPerClass> data = HashBasedTable.create();
((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.keySet().forEach((coord) -> {
World world = DimensionManager.getWorld(coord.dim);
int id = Block.getIdFromBlock(world.getBlockState(new BlockPos(coord.x, coord.y, coord.z)).getBlock());
int meta = world.getBlockState(new BlockPos(coord.x, coord.y, coord.z)).getBlock().getMetaFromState(world.getBlockState(new BlockPos(coord.x, coord.y, coord.z)));
if (!data.contains(id, meta)) {
data.put(id, meta, new DataBlockTileEntityPerClass(id, meta));
}
data.get(id, meta).add(((ProfilerTileEntityUpdate) ProfilerSection.TILEENT_UPDATETIME.getProfiler()).data.get(coord).getGeometricMean());
});
return new ArrayList<>(data.values());
}
}
| 8,454 | 0.652354 | 0.651999 | 177 | 46.762711 | 57.87899 | 380 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.067797 | false | false | 0 |
ee220aef79102fae95fbf4f5494c178587fb2767 | 2,576,980,427,541 | f87fa090b10a629722d7672f5560048b12bee313 | /projects/batfish/src/org/batfish/representation/cisco/ExtendedAccessListLine.java | 5ce507fb06010df7f6b68b47a6f0274d05dce40c | [
"Apache-2.0"
] | permissive | 824728350/batfish | https://github.com/824728350/batfish | 9bc76282a54fce33ee45717ec5a5649b2a29e6e5 | 87db3c9bf22afd1974cc6eb2c2b943c903acee36 | refs/heads/master | 2021-05-30T22:54:26.833000 | 2015-12-15T07:17:56 | 2015-12-15T07:17:56 | 254,667,639 | 1 | 0 | Apache-2.0 | true | 2020-04-10T15:20:46 | 2020-04-10T15:20:45 | 2017-09-14T09:24:51 | 2015-12-15T07:19:27 | 22,768 | 0 | 0 | 0 | null | false | false | package org.batfish.representation.cisco;
import java.io.Serializable;
import java.util.List;
import org.batfish.representation.Ip;
import org.batfish.representation.IpProtocol;
import org.batfish.representation.LineAction;
import org.batfish.util.SubRange;
public class ExtendedAccessListLine implements Serializable {
private static final long serialVersionUID = 1L;
private LineAction _action;
private Ip _dstIp;
private List<SubRange> _dstPortRanges;
private Ip _dstWildcard;
private IpProtocol _protocol;
private Ip _srcIp;
private List<SubRange> _srcPortRanges;
private Ip _srcWildcard;
public ExtendedAccessListLine(LineAction action, IpProtocol protocol,
Ip srcIp, Ip srcWildcard, Ip dstIp, Ip dstWildcard,
List<SubRange> srcPortRanges, List<SubRange> dstPortRanges) {
_action = action;
_protocol = protocol;
_srcIp = srcIp;
_srcWildcard = srcWildcard;
_dstIp = dstIp;
_dstWildcard = dstWildcard;
_srcPortRanges = srcPortRanges;
_dstPortRanges = dstPortRanges;
}
public LineAction getAction() {
return _action;
}
public Ip getDestinationIp() {
return _dstIp;
}
public Ip getDestinationWildcard() {
return _dstWildcard;
}
public List<SubRange> getDstPortRanges() {
return _dstPortRanges;
}
public IpProtocol getProtocol() {
return _protocol;
}
public Ip getSourceIp() {
return _srcIp;
}
public Ip getSourceWildcard() {
return _srcWildcard;
}
public List<SubRange> getSrcPortRanges() {
return _srcPortRanges;
}
@Override
public String toString() {
String protocolName = _protocol.name();
return "[Action:" + _action + ", Protocol:" + protocolName + "("
+ _protocol.number() + ")" + ", SourceIp:" + _srcIp
+ ", SourceWildcard:" + _srcWildcard + ", DestinationIp:" + _dstIp
+ ", DestinationWildcard:" + _dstWildcard + ", PortRange:"
+ _srcPortRanges + "]";
}
}
| UTF-8 | Java | 2,045 | java | ExtendedAccessListLine.java | Java | [] | null | [] | package org.batfish.representation.cisco;
import java.io.Serializable;
import java.util.List;
import org.batfish.representation.Ip;
import org.batfish.representation.IpProtocol;
import org.batfish.representation.LineAction;
import org.batfish.util.SubRange;
public class ExtendedAccessListLine implements Serializable {
private static final long serialVersionUID = 1L;
private LineAction _action;
private Ip _dstIp;
private List<SubRange> _dstPortRanges;
private Ip _dstWildcard;
private IpProtocol _protocol;
private Ip _srcIp;
private List<SubRange> _srcPortRanges;
private Ip _srcWildcard;
public ExtendedAccessListLine(LineAction action, IpProtocol protocol,
Ip srcIp, Ip srcWildcard, Ip dstIp, Ip dstWildcard,
List<SubRange> srcPortRanges, List<SubRange> dstPortRanges) {
_action = action;
_protocol = protocol;
_srcIp = srcIp;
_srcWildcard = srcWildcard;
_dstIp = dstIp;
_dstWildcard = dstWildcard;
_srcPortRanges = srcPortRanges;
_dstPortRanges = dstPortRanges;
}
public LineAction getAction() {
return _action;
}
public Ip getDestinationIp() {
return _dstIp;
}
public Ip getDestinationWildcard() {
return _dstWildcard;
}
public List<SubRange> getDstPortRanges() {
return _dstPortRanges;
}
public IpProtocol getProtocol() {
return _protocol;
}
public Ip getSourceIp() {
return _srcIp;
}
public Ip getSourceWildcard() {
return _srcWildcard;
}
public List<SubRange> getSrcPortRanges() {
return _srcPortRanges;
}
@Override
public String toString() {
String protocolName = _protocol.name();
return "[Action:" + _action + ", Protocol:" + protocolName + "("
+ _protocol.number() + ")" + ", SourceIp:" + _srcIp
+ ", SourceWildcard:" + _srcWildcard + ", DestinationIp:" + _dstIp
+ ", DestinationWildcard:" + _dstWildcard + ", PortRange:"
+ _srcPortRanges + "]";
}
}
| 2,045 | 0.657702 | 0.657213 | 79 | 24.886076 | 21.111511 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.594937 | false | false | 0 |
9c075569730f5e17b0e02d020289304417683942 | 23,287,312,740,094 | 18502003913be93e1f08b7fb525a64adcfaf88f0 | /src/storyBrick/StoryBrick.java | 16732fc124e0307daea02cf11941972d1f81c861 | [] | no_license | zacharypetersen1/StoryToolPrototype | https://github.com/zacharypetersen1/StoryToolPrototype | 296a606112c496fc8565021aedcf691e7ffa2972 | c26d6c621ad70e9e002204be172839eb6daea518 | refs/heads/master | 2020-07-29T22:50:24.884000 | 2016-11-14T01:35:32 | 2016-11-14T01:35:32 | 73,655,963 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package storyBrick;
import infrastructure.Controller;
import infrastructure.Story;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Point;
import java.io.IOException;
import javax.swing.JButton;
import storyBrickListeners.InListener;
import storyBrickListeners.OutListener;
public class StoryBrick {
//Variables
Story targetStory;
StoryBrick pointer1, pointer2, pointer3;
int thisStage, targetStage1, targetStage2, targetStage3;
int timeLimit = 60;
//Display Var's
public int x = 50, y = 50;
int width = 64, height = 32, inOutWidth = 20, inOutHeight = 20;
int mainX, mainY, inX, inY, out1X, out1Y, out2X, out2Y, out3X, out3Y;
public Point mousePoint;
public JButton thisButton, in, out1, out2, out3;
public JButton stm; //used in SB_statement only!
public JButton opt1, opt2, opt3; //used in SB_ThreeSplit only!
InListener inListener;
OutListener out1Listener, out2Listener, out3Listener;
//Constructors
public StoryBrick()
{
x = 50 - Controller.globalX;
y = 50 - Controller.globalY;
}
//Methods
public void setPointer(int pointerNum, StoryBrick setPointer)
{
switch (pointerNum)
{
case (1) : pointer1 = setPointer; break;
case (2) : pointer2 = setPointer; break;
case (3) : pointer3 = setPointer; break;
}
}
public void setTimeLimit(int setToThis)
{
timeLimit = setToThis;
}
public void make() throws IOException
{
System.out.println("using main");
}
//Contains appearence initialization code that is shared by all children of "StoryTool"
public void setAppearance()
{
thisButton.setBackground(new Color(0,0,0,0));
thisButton.setBorder(null);
thisButton.setCursor(new Cursor(Cursor.MOVE_CURSOR));
thisButton.setSize(width, height);
}
public void findStage()
{
}
public void update()
{
}
//setStatement methods that will be overwritten by child obj's
//For now, just here on testing purposes
public void setStatement()
{
}
public void setStatement(String setToThis)
{
}
public void setStatement(String setToThis1, String setToThis2, String setToThis3)
{
}
public void setStatement(String setToThis, int optionNum)
{
}
public void setStatement(int optionNum)
{
}
}
| UTF-8 | Java | 2,203 | java | StoryBrick.java | Java | [] | null | [] | package storyBrick;
import infrastructure.Controller;
import infrastructure.Story;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Point;
import java.io.IOException;
import javax.swing.JButton;
import storyBrickListeners.InListener;
import storyBrickListeners.OutListener;
public class StoryBrick {
//Variables
Story targetStory;
StoryBrick pointer1, pointer2, pointer3;
int thisStage, targetStage1, targetStage2, targetStage3;
int timeLimit = 60;
//Display Var's
public int x = 50, y = 50;
int width = 64, height = 32, inOutWidth = 20, inOutHeight = 20;
int mainX, mainY, inX, inY, out1X, out1Y, out2X, out2Y, out3X, out3Y;
public Point mousePoint;
public JButton thisButton, in, out1, out2, out3;
public JButton stm; //used in SB_statement only!
public JButton opt1, opt2, opt3; //used in SB_ThreeSplit only!
InListener inListener;
OutListener out1Listener, out2Listener, out3Listener;
//Constructors
public StoryBrick()
{
x = 50 - Controller.globalX;
y = 50 - Controller.globalY;
}
//Methods
public void setPointer(int pointerNum, StoryBrick setPointer)
{
switch (pointerNum)
{
case (1) : pointer1 = setPointer; break;
case (2) : pointer2 = setPointer; break;
case (3) : pointer3 = setPointer; break;
}
}
public void setTimeLimit(int setToThis)
{
timeLimit = setToThis;
}
public void make() throws IOException
{
System.out.println("using main");
}
//Contains appearence initialization code that is shared by all children of "StoryTool"
public void setAppearance()
{
thisButton.setBackground(new Color(0,0,0,0));
thisButton.setBorder(null);
thisButton.setCursor(new Cursor(Cursor.MOVE_CURSOR));
thisButton.setSize(width, height);
}
public void findStage()
{
}
public void update()
{
}
//setStatement methods that will be overwritten by child obj's
//For now, just here on testing purposes
public void setStatement()
{
}
public void setStatement(String setToThis)
{
}
public void setStatement(String setToThis1, String setToThis2, String setToThis3)
{
}
public void setStatement(String setToThis, int optionNum)
{
}
public void setStatement(int optionNum)
{
}
}
| 2,203 | 0.727644 | 0.70404 | 103 | 20.38835 | 21.710913 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.718447 | false | false | 0 |
c4daa912e0cc586fa00725d05c1ce3d492adb50b | 23,218,593,224,649 | a05128130597b3bc4543ce4c98e1f2aeed7387b1 | /app/src/main/java/pis/logixams/AppPrefs/StudentDataActivity.java | d37a49af208f9a7dc6ce2b37a312a5394c8dcb89 | [] | no_license | iranjeet/GateSecuritySystem | https://github.com/iranjeet/GateSecuritySystem | f6fa437f1703a520e0dc40919f401666f3bceddb | 12d6f6248fe3c74f8425629ce15fb0cd4e668bd6 | refs/heads/master | 2020-11-23T22:31:11.391000 | 2020-07-06T19:05:11 | 2020-07-06T19:05:11 | 227,847,108 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pis.logixams.AppPrefs;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import pis.logixams.AppHomeActivity;
import pis.logixams.InAttendenceActivity;
import pis.logixams.R;
public class StudentDataActivity extends AppCompatActivity {
ProgressDialog progressDialog;
ListView StudentDataListView;
TextView StudentNameTextView;
ArrayList<String> StudentDataArrayList;
ArrayAdapter<String> arrayAdapter;
Button InAttendenceButton , OutAttendenceButton;
SharedPreferences sharedPreferences;
String ROLL_NUMBER=null;
String EMP_ID=null;
Bitmap STUDENT_PIC=null;
private static final int CAMERA_REQUEST = 1888;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_student_data);
sharedPreferences=getSharedPreferences(AppPrefs.APP_DATA,MODE_PRIVATE);
StudentNameTextView= (TextView) findViewById(R.id.student_name_id);
StudentDataListView=(ListView) findViewById(R.id.student_data_list_id);
InAttendenceButton= (Button) findViewById(R.id.in_attendence_btn);
OutAttendenceButton=(Button) findViewById(R.id.out_attendence_btn);
Bundle bundle = getIntent().getExtras();
String BAR_CODE = bundle.getString("BAR_CODE");
new FetchStudentDetails().execute(BAR_CODE);
InAttendenceButton.setVisibility(View.GONE);
OutAttendenceButton.setVisibility(View.GONE);
}
class FetchStudentDetails extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(StudentDataActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setCancelable(false);
progressDialog.show();
StudentDataArrayList=new ArrayList<>();
}
@Override
protected String doInBackground(String... params) {
String SERVER_RES = null;
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(AppPrefs.BASE_URL+"fetch_student_data.php");
ArrayList<NameValuePair> dataList = new ArrayList<NameValuePair>();
dataList.add(new BasicNameValuePair("barcode", params[0]));
try {
httpPost.setEntity(new UrlEncodedFormEntity(dataList));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
SERVER_RES = EntityUtils.toString(httpEntity);
} catch (Exception e) {
Log.d("SERVER_EXP", e.toString());
}
return SERVER_RES;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Log.d("SERVER_RES", s);
progressDialog.dismiss();
if (s == null) {
Toast.makeText(StudentDataActivity.this, "Try again", Toast.LENGTH_LONG).show();
} else {
try {
JSONArray jsonArray = new JSONArray(s);
JSONObject jsonObject;
for (int i = 0; i < jsonArray.length(); i++) {
jsonObject = jsonArray.getJSONObject(i);
StudentNameTextView.setText(jsonObject.getString("name"));
StudentDataArrayList.add("Roll number: "+jsonObject.getString("rollno"));
StudentDataArrayList.add("Name : "+jsonObject.getString("name"));
arrayAdapter=new ArrayAdapter<String>(StudentDataActivity.this , android.R.layout.simple_list_item_1 , StudentDataArrayList);
StudentDataListView.setAdapter(arrayAdapter);
ROLL_NUMBER=jsonObject.getString("rollno");
EMP_ID=sharedPreferences.getString("EMP_ID","");
}
if(!ROLL_NUMBER.equals("")||ROLL_NUMBER!=null)
{
InAttendenceButton.setVisibility(View.VISIBLE);
InAttendenceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/*Intent intent=new Intent(StudentDataActivity.this , InAttendenceActivity.class);
intent.putExtra("EMP_ID",EMP_ID);
intent.putExtra("ROLL_NUMBER",ROLL_NUMBER);
startActivity(intent);
new MarkAttendenceTask().execute(EMP_ID,ROLL_NUMBER,"in");*/
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
OutAttendenceButton.setVisibility(View.VISIBLE);
OutAttendenceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new MarkAttendenceTask().execute(EMP_ID,ROLL_NUMBER,"out");
}
});
}
} catch (Exception e) {
}
}
//Toast.makeText(DocetHomeActivity.this , s, Toast.LENGTH_LONG).show();
}
}
class MarkAttendenceTask extends AsyncTask<String , Void , String>
{
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(StudentDataActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected String doInBackground(String... params) {
String SERVER_RES = null;
String BASE64IMAGE=null;
if(params[2].equals("in"))
{
BASE64IMAGE = convertImageIntoString(STUDENT_PIC);
}
else if(params[2].equals("out"))
{
STUDENT_PIC= BitmapFactory.decodeResource(getResources() , R.mipmap.ic_launcher);
BASE64IMAGE= convertImageIntoString(STUDENT_PIC);
}
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(AppPrefs.BASE_URL+"mark_attendence.php");
ArrayList<NameValuePair> dataList = new ArrayList<NameValuePair>();
dataList.add(new BasicNameValuePair("emp_id", params[0]));
dataList.add(new BasicNameValuePair("roll_no", params[1]));
dataList.add(new BasicNameValuePair("type", params[2]));
dataList.add(new BasicNameValuePair("pic_name", String.valueOf(System.currentTimeMillis())));
dataList.add(new BasicNameValuePair("student_image", BASE64IMAGE));
try {
httpPost.setEntity(new UrlEncodedFormEntity(dataList));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
SERVER_RES = EntityUtils.toString(httpEntity);
} catch (Exception e) {
Log.d("SERVER_EXP", e.toString());
}
return SERVER_RES;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
progressDialog.dismiss();
if (s.equals("1"))
{
AlertDialog alrtbldr=new AlertDialog.Builder(StudentDataActivity.this).create();
alrtbldr.setTitle("Entry Status");
alrtbldr.setMessage("Success");
alrtbldr.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent=new Intent(StudentDataActivity.this , AppHomeActivity.class);
startActivity(intent);
}
});
alrtbldr.show();
}
else
{
//
}
Toast.makeText(StudentDataActivity.this, s, Toast.LENGTH_SHORT).show();
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
STUDENT_PIC = (Bitmap) data.getExtras().get("data");
if(STUDENT_PIC!=null)
{
new MarkAttendenceTask().execute(EMP_ID,ROLL_NUMBER,"in");
}
}
}
public String convertImageIntoString(Bitmap img) {
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
img.compress(Bitmap.CompressFormat.JPEG, 100, arrayOutputStream);
String encodedimg = Base64.encodeToString(arrayOutputStream.toByteArray(), Base64.DEFAULT);
return encodedimg;
}
}
| UTF-8 | Java | 10,804 | java | StudentDataActivity.java | Java | [] | null | [] | package pis.logixams.AppPrefs;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import pis.logixams.AppHomeActivity;
import pis.logixams.InAttendenceActivity;
import pis.logixams.R;
public class StudentDataActivity extends AppCompatActivity {
ProgressDialog progressDialog;
ListView StudentDataListView;
TextView StudentNameTextView;
ArrayList<String> StudentDataArrayList;
ArrayAdapter<String> arrayAdapter;
Button InAttendenceButton , OutAttendenceButton;
SharedPreferences sharedPreferences;
String ROLL_NUMBER=null;
String EMP_ID=null;
Bitmap STUDENT_PIC=null;
private static final int CAMERA_REQUEST = 1888;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_student_data);
sharedPreferences=getSharedPreferences(AppPrefs.APP_DATA,MODE_PRIVATE);
StudentNameTextView= (TextView) findViewById(R.id.student_name_id);
StudentDataListView=(ListView) findViewById(R.id.student_data_list_id);
InAttendenceButton= (Button) findViewById(R.id.in_attendence_btn);
OutAttendenceButton=(Button) findViewById(R.id.out_attendence_btn);
Bundle bundle = getIntent().getExtras();
String BAR_CODE = bundle.getString("BAR_CODE");
new FetchStudentDetails().execute(BAR_CODE);
InAttendenceButton.setVisibility(View.GONE);
OutAttendenceButton.setVisibility(View.GONE);
}
class FetchStudentDetails extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(StudentDataActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setCancelable(false);
progressDialog.show();
StudentDataArrayList=new ArrayList<>();
}
@Override
protected String doInBackground(String... params) {
String SERVER_RES = null;
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(AppPrefs.BASE_URL+"fetch_student_data.php");
ArrayList<NameValuePair> dataList = new ArrayList<NameValuePair>();
dataList.add(new BasicNameValuePair("barcode", params[0]));
try {
httpPost.setEntity(new UrlEncodedFormEntity(dataList));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
SERVER_RES = EntityUtils.toString(httpEntity);
} catch (Exception e) {
Log.d("SERVER_EXP", e.toString());
}
return SERVER_RES;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
Log.d("SERVER_RES", s);
progressDialog.dismiss();
if (s == null) {
Toast.makeText(StudentDataActivity.this, "Try again", Toast.LENGTH_LONG).show();
} else {
try {
JSONArray jsonArray = new JSONArray(s);
JSONObject jsonObject;
for (int i = 0; i < jsonArray.length(); i++) {
jsonObject = jsonArray.getJSONObject(i);
StudentNameTextView.setText(jsonObject.getString("name"));
StudentDataArrayList.add("Roll number: "+jsonObject.getString("rollno"));
StudentDataArrayList.add("Name : "+jsonObject.getString("name"));
arrayAdapter=new ArrayAdapter<String>(StudentDataActivity.this , android.R.layout.simple_list_item_1 , StudentDataArrayList);
StudentDataListView.setAdapter(arrayAdapter);
ROLL_NUMBER=jsonObject.getString("rollno");
EMP_ID=sharedPreferences.getString("EMP_ID","");
}
if(!ROLL_NUMBER.equals("")||ROLL_NUMBER!=null)
{
InAttendenceButton.setVisibility(View.VISIBLE);
InAttendenceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/*Intent intent=new Intent(StudentDataActivity.this , InAttendenceActivity.class);
intent.putExtra("EMP_ID",EMP_ID);
intent.putExtra("ROLL_NUMBER",ROLL_NUMBER);
startActivity(intent);
new MarkAttendenceTask().execute(EMP_ID,ROLL_NUMBER,"in");*/
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
OutAttendenceButton.setVisibility(View.VISIBLE);
OutAttendenceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new MarkAttendenceTask().execute(EMP_ID,ROLL_NUMBER,"out");
}
});
}
} catch (Exception e) {
}
}
//Toast.makeText(DocetHomeActivity.this , s, Toast.LENGTH_LONG).show();
}
}
class MarkAttendenceTask extends AsyncTask<String , Void , String>
{
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(StudentDataActivity.this);
progressDialog.setMessage("Please wait...");
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected String doInBackground(String... params) {
String SERVER_RES = null;
String BASE64IMAGE=null;
if(params[2].equals("in"))
{
BASE64IMAGE = convertImageIntoString(STUDENT_PIC);
}
else if(params[2].equals("out"))
{
STUDENT_PIC= BitmapFactory.decodeResource(getResources() , R.mipmap.ic_launcher);
BASE64IMAGE= convertImageIntoString(STUDENT_PIC);
}
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(AppPrefs.BASE_URL+"mark_attendence.php");
ArrayList<NameValuePair> dataList = new ArrayList<NameValuePair>();
dataList.add(new BasicNameValuePair("emp_id", params[0]));
dataList.add(new BasicNameValuePair("roll_no", params[1]));
dataList.add(new BasicNameValuePair("type", params[2]));
dataList.add(new BasicNameValuePair("pic_name", String.valueOf(System.currentTimeMillis())));
dataList.add(new BasicNameValuePair("student_image", BASE64IMAGE));
try {
httpPost.setEntity(new UrlEncodedFormEntity(dataList));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
SERVER_RES = EntityUtils.toString(httpEntity);
} catch (Exception e) {
Log.d("SERVER_EXP", e.toString());
}
return SERVER_RES;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
progressDialog.dismiss();
if (s.equals("1"))
{
AlertDialog alrtbldr=new AlertDialog.Builder(StudentDataActivity.this).create();
alrtbldr.setTitle("Entry Status");
alrtbldr.setMessage("Success");
alrtbldr.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent=new Intent(StudentDataActivity.this , AppHomeActivity.class);
startActivity(intent);
}
});
alrtbldr.show();
}
else
{
//
}
Toast.makeText(StudentDataActivity.this, s, Toast.LENGTH_SHORT).show();
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
STUDENT_PIC = (Bitmap) data.getExtras().get("data");
if(STUDENT_PIC!=null)
{
new MarkAttendenceTask().execute(EMP_ID,ROLL_NUMBER,"in");
}
}
}
public String convertImageIntoString(Bitmap img) {
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
img.compress(Bitmap.CompressFormat.JPEG, 100, arrayOutputStream);
String encodedimg = Base64.encodeToString(arrayOutputStream.toByteArray(), Base64.DEFAULT);
return encodedimg;
}
}
| 10,804 | 0.583302 | 0.580433 | 319 | 31.862068 | 30.650826 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.595611 | false | false | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.