blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
6f786f0a17622251efe454a8c1243d6b8e5e05d6
6ecb1e86ac04a4f4ad1aa2c63e9962081713fe92
/src/main/java/io/swagger/client/model/EskiKayitHatasi.java
a0e6ddcde79e1918587dadace8fb8f9b1fc4c690
[ "MIT" ]
permissive
huseyin-kilic/Fall2017Swe573
fae7a359af4d8a25e47e884adae4852e7ea7c75f
a01644f9debc88f24c64368336da539e487d8f2c
refs/heads/master
2021-09-01T07:11:40.735139
2017-12-25T15:41:24
2017-12-25T15:41:24
104,634,570
1
0
null
null
null
null
UTF-8
Java
false
false
3,383
java
/* * Etkinlik.io API * Tüm etkinlikleri toplamayı, kategorize etmeyi ve ilgili kişilere duyurmayı amaç edinmiş bir projedir. Bu API dokümantasyonu ile bir çok kaynaktan ve organizatörden beslenerek bir araya getirdiğimiz etkinlik içeriğine entegre olarak uygulamalar geliştirebilirsiniz. * * OpenAPI spec version: 1.0.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package io.swagger.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; /** * EskiKayitHatasi */ @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-11-29T05:46:48.775Z") public class EskiKayitHatasi { @SerializedName("sonuc") private Integer sonuc = null; @SerializedName("mesaj") private String mesaj = null; @SerializedName("yeniId") private Integer yeniId = null; public EskiKayitHatasi sonuc(Integer sonuc) { this.sonuc = sonuc; return this; } /** * Get sonuc * @return sonuc **/ @ApiModelProperty(value = "") public Integer getSonuc() { return sonuc; } public void setSonuc(Integer sonuc) { this.sonuc = sonuc; } public EskiKayitHatasi mesaj(String mesaj) { this.mesaj = mesaj; return this; } /** * Get mesaj * @return mesaj **/ @ApiModelProperty(value = "") public String getMesaj() { return mesaj; } public void setMesaj(String mesaj) { this.mesaj = mesaj; } public EskiKayitHatasi yeniId(Integer yeniId) { this.yeniId = yeniId; return this; } /** * Get yeniId * @return yeniId **/ @ApiModelProperty(value = "") public Integer getYeniId() { return yeniId; } public void setYeniId(Integer yeniId) { this.yeniId = yeniId; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } EskiKayitHatasi eskiKayitHatasi = (EskiKayitHatasi) o; return Objects.equals(this.sonuc, eskiKayitHatasi.sonuc) && Objects.equals(this.mesaj, eskiKayitHatasi.mesaj) && Objects.equals(this.yeniId, eskiKayitHatasi.yeniId); } @Override public int hashCode() { return Objects.hash(sonuc, mesaj, yeniId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class EskiKayitHatasi {\n"); sb.append(" sonuc: ").append(toIndentedString(sonuc)).append("\n"); sb.append(" mesaj: ").append(toIndentedString(mesaj)).append("\n"); sb.append(" yeniId: ").append(toIndentedString(yeniId)).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 "); } }
[ "huseyin.kilic@amadeus.com" ]
huseyin.kilic@amadeus.com
5ecca88dc40d492790f3535d30f7ecbb2e7195ec
8189d3e49039b9c4d0a493410b0ca4cb0e5aa135
/app/src/main/java/com/picovr/androidcollection/Utils/net/URLUtils.java
eb943451378670699a680d30964a24feb9e8b826
[]
no_license
necuil/AndroidCollection
4f3365ecdf0b5328e7eb2f728fd4540b75ed9fc5
7e1c7d2bff4bdeb29dd2a5eedd904c6b95fba7e4
refs/heads/master
2022-07-16T01:19:42.597483
2020-05-14T03:48:27
2020-05-14T03:48:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,218
java
package com.picovr.androidcollection.Utils.net; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class URLUtils { /** * url中常见的头部参数:x-www-form-urlencoded * 表示: * 用url即web形式的字符串进行编码 * 主要是将除一下三种之外的字符,进行编码。将其转换为字节,每个字节 * 要写为百分号后面加2个16进制数字,例如:%2B * 1.大小写字母 * 2.数字 * 3.标点符号 -_.!~*, * * @param sourceString * @return */ public static String getURLEncoder(String sourceString) { try { return URLEncoder.encode(sourceString, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; } /** * 将url即web形式的字符串进行解码 * * @param sourceString * @return */ public static String getURLDecoder(String sourceString) { try { return URLEncoder.encode(sourceString, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return null; } }
[ "patrick.ding@picovr.com" ]
patrick.ding@picovr.com
9cd575d055ef427f043bd2bd5875d6bc72fa6ef6
fc160694094b89ab09e5c9a0f03db80437eabc93
/java-channel/proto-google-cloud-channel-v1/src/main/java/com/google/cloud/channel/v1/ListChannelPartnerRepricingConfigsResponse.java
9de47230cbb77df7896342ea8e362eac9738951b
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
googleapis/google-cloud-java
4f4d97a145e0310db142ecbc3340ce3a2a444e5e
6e23c3a406e19af410a1a1dd0d0487329875040e
refs/heads/main
2023-09-04T09:09:02.481897
2023-08-31T20:45:11
2023-08-31T20:45:11
26,181,278
1,122
685
Apache-2.0
2023-09-13T21:21:23
2014-11-04T17:57:16
Java
UTF-8
Java
false
false
43,756
java
/* * Copyright 2023 Google LLC * * 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 * * https://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. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/channel/v1/service.proto package com.google.cloud.channel.v1; /** * * * <pre> * Response message for * [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. * </pre> * * Protobuf type {@code google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse} */ public final class ListChannelPartnerRepricingConfigsResponse extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse) ListChannelPartnerRepricingConfigsResponseOrBuilder { private static final long serialVersionUID = 0L; // Use ListChannelPartnerRepricingConfigsResponse.newBuilder() to construct. private ListChannelPartnerRepricingConfigsResponse( com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private ListChannelPartnerRepricingConfigsResponse() { channelPartnerRepricingConfigs_ = java.util.Collections.emptyList(); nextPageToken_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new ListChannelPartnerRepricingConfigsResponse(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.channel.v1.ServiceProto .internal_static_google_cloud_channel_v1_ListChannelPartnerRepricingConfigsResponse_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.channel.v1.ServiceProto .internal_static_google_cloud_channel_v1_ListChannelPartnerRepricingConfigsResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse.class, com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse.Builder.class); } public static final int CHANNEL_PARTNER_REPRICING_CONFIGS_FIELD_NUMBER = 1; @SuppressWarnings("serial") private java.util.List<com.google.cloud.channel.v1.ChannelPartnerRepricingConfig> channelPartnerRepricingConfigs_; /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ @java.lang.Override public java.util.List<com.google.cloud.channel.v1.ChannelPartnerRepricingConfig> getChannelPartnerRepricingConfigsList() { return channelPartnerRepricingConfigs_; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ @java.lang.Override public java.util.List< ? extends com.google.cloud.channel.v1.ChannelPartnerRepricingConfigOrBuilder> getChannelPartnerRepricingConfigsOrBuilderList() { return channelPartnerRepricingConfigs_; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ @java.lang.Override public int getChannelPartnerRepricingConfigsCount() { return channelPartnerRepricingConfigs_.size(); } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ @java.lang.Override public com.google.cloud.channel.v1.ChannelPartnerRepricingConfig getChannelPartnerRepricingConfigs(int index) { return channelPartnerRepricingConfigs_.get(index); } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ @java.lang.Override public com.google.cloud.channel.v1.ChannelPartnerRepricingConfigOrBuilder getChannelPartnerRepricingConfigsOrBuilder(int index) { return channelPartnerRepricingConfigs_.get(index); } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; @SuppressWarnings("serial") private volatile java.lang.Object nextPageToken_ = ""; /** * * * <pre> * A token to retrieve the next page of results. * Pass to * [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] * to obtain that page. * </pre> * * <code>string next_page_token = 2;</code> * * @return The nextPageToken. */ @java.lang.Override public java.lang.String getNextPageToken() { java.lang.Object ref = nextPageToken_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); nextPageToken_ = s; return s; } } /** * * * <pre> * A token to retrieve the next page of results. * Pass to * [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] * to obtain that page. * </pre> * * <code>string next_page_token = 2;</code> * * @return The bytes for nextPageToken. */ @java.lang.Override public com.google.protobuf.ByteString getNextPageTokenBytes() { java.lang.Object ref = nextPageToken_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); nextPageToken_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < channelPartnerRepricingConfigs_.size(); i++) { output.writeMessage(1, channelPartnerRepricingConfigs_.get(i)); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } getUnknownFields().writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < channelPartnerRepricingConfigs_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( 1, channelPartnerRepricingConfigs_.get(i)); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse)) { return super.equals(obj); } com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse other = (com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse) obj; if (!getChannelPartnerRepricingConfigsList() .equals(other.getChannelPartnerRepricingConfigsList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getChannelPartnerRepricingConfigsCount() > 0) { hash = (37 * hash) + CHANNEL_PARTNER_REPRICING_CONFIGS_FIELD_NUMBER; hash = (53 * hash) + getChannelPartnerRepricingConfigsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder( com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Response message for * [CloudChannelService.ListChannelPartnerRepricingConfigs][google.cloud.channel.v1.CloudChannelService.ListChannelPartnerRepricingConfigs]. * </pre> * * Protobuf type {@code google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse) com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.channel.v1.ServiceProto .internal_static_google_cloud_channel_v1_ListChannelPartnerRepricingConfigsResponse_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.channel.v1.ServiceProto .internal_static_google_cloud_channel_v1_ListChannelPartnerRepricingConfigsResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse.class, com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse.Builder.class); } // Construct using // com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse.newBuilder() private Builder() {} private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); } @java.lang.Override public Builder clear() { super.clear(); bitField0_ = 0; if (channelPartnerRepricingConfigsBuilder_ == null) { channelPartnerRepricingConfigs_ = java.util.Collections.emptyList(); } else { channelPartnerRepricingConfigs_ = null; channelPartnerRepricingConfigsBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); nextPageToken_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.channel.v1.ServiceProto .internal_static_google_cloud_channel_v1_ListChannelPartnerRepricingConfigsResponse_descriptor; } @java.lang.Override public com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse getDefaultInstanceForType() { return com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse .getDefaultInstance(); } @java.lang.Override public com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse build() { com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse buildPartial() { com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse result = new com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse(this); buildPartialRepeatedFields(result); if (bitField0_ != 0) { buildPartial0(result); } onBuilt(); return result; } private void buildPartialRepeatedFields( com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse result) { if (channelPartnerRepricingConfigsBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { channelPartnerRepricingConfigs_ = java.util.Collections.unmodifiableList(channelPartnerRepricingConfigs_); bitField0_ = (bitField0_ & ~0x00000001); } result.channelPartnerRepricingConfigs_ = channelPartnerRepricingConfigs_; } else { result.channelPartnerRepricingConfigs_ = channelPartnerRepricingConfigsBuilder_.build(); } } private void buildPartial0( com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse result) { int from_bitField0_ = bitField0_; if (((from_bitField0_ & 0x00000002) != 0)) { result.nextPageToken_ = nextPageToken_; } } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse) { return mergeFrom( (com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom( com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse other) { if (other == com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse .getDefaultInstance()) return this; if (channelPartnerRepricingConfigsBuilder_ == null) { if (!other.channelPartnerRepricingConfigs_.isEmpty()) { if (channelPartnerRepricingConfigs_.isEmpty()) { channelPartnerRepricingConfigs_ = other.channelPartnerRepricingConfigs_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.addAll(other.channelPartnerRepricingConfigs_); } onChanged(); } } else { if (!other.channelPartnerRepricingConfigs_.isEmpty()) { if (channelPartnerRepricingConfigsBuilder_.isEmpty()) { channelPartnerRepricingConfigsBuilder_.dispose(); channelPartnerRepricingConfigsBuilder_ = null; channelPartnerRepricingConfigs_ = other.channelPartnerRepricingConfigs_; bitField0_ = (bitField0_ & ~0x00000001); channelPartnerRepricingConfigsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getChannelPartnerRepricingConfigsFieldBuilder() : null; } else { channelPartnerRepricingConfigsBuilder_.addAllMessages( other.channelPartnerRepricingConfigs_); } } } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; bitField0_ |= 0x00000002; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.cloud.channel.v1.ChannelPartnerRepricingConfig m = input.readMessage( com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.parser(), extensionRegistry); if (channelPartnerRepricingConfigsBuilder_ == null) { ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.add(m); } else { channelPartnerRepricingConfigsBuilder_.addMessage(m); } break; } // case 10 case 18: { nextPageToken_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000002; break; } // case 18 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag } break; } // default: } // switch (tag) } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.unwrapIOException(); } finally { onChanged(); } // finally return this; } private int bitField0_; private java.util.List<com.google.cloud.channel.v1.ChannelPartnerRepricingConfig> channelPartnerRepricingConfigs_ = java.util.Collections.emptyList(); private void ensureChannelPartnerRepricingConfigsIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { channelPartnerRepricingConfigs_ = new java.util.ArrayList<com.google.cloud.channel.v1.ChannelPartnerRepricingConfig>( channelPartnerRepricingConfigs_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.channel.v1.ChannelPartnerRepricingConfig, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder, com.google.cloud.channel.v1.ChannelPartnerRepricingConfigOrBuilder> channelPartnerRepricingConfigsBuilder_; /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public java.util.List<com.google.cloud.channel.v1.ChannelPartnerRepricingConfig> getChannelPartnerRepricingConfigsList() { if (channelPartnerRepricingConfigsBuilder_ == null) { return java.util.Collections.unmodifiableList(channelPartnerRepricingConfigs_); } else { return channelPartnerRepricingConfigsBuilder_.getMessageList(); } } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public int getChannelPartnerRepricingConfigsCount() { if (channelPartnerRepricingConfigsBuilder_ == null) { return channelPartnerRepricingConfigs_.size(); } else { return channelPartnerRepricingConfigsBuilder_.getCount(); } } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public com.google.cloud.channel.v1.ChannelPartnerRepricingConfig getChannelPartnerRepricingConfigs(int index) { if (channelPartnerRepricingConfigsBuilder_ == null) { return channelPartnerRepricingConfigs_.get(index); } else { return channelPartnerRepricingConfigsBuilder_.getMessage(index); } } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder setChannelPartnerRepricingConfigs( int index, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig value) { if (channelPartnerRepricingConfigsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.set(index, value); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder setChannelPartnerRepricingConfigs( int index, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder builderForValue) { if (channelPartnerRepricingConfigsBuilder_ == null) { ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.set(index, builderForValue.build()); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder addChannelPartnerRepricingConfigs( com.google.cloud.channel.v1.ChannelPartnerRepricingConfig value) { if (channelPartnerRepricingConfigsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.add(value); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.addMessage(value); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder addChannelPartnerRepricingConfigs( int index, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig value) { if (channelPartnerRepricingConfigsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.add(index, value); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder addChannelPartnerRepricingConfigs( com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder builderForValue) { if (channelPartnerRepricingConfigsBuilder_ == null) { ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.add(builderForValue.build()); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder addChannelPartnerRepricingConfigs( int index, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder builderForValue) { if (channelPartnerRepricingConfigsBuilder_ == null) { ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.add(index, builderForValue.build()); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder addAllChannelPartnerRepricingConfigs( java.lang.Iterable<? extends com.google.cloud.channel.v1.ChannelPartnerRepricingConfig> values) { if (channelPartnerRepricingConfigsBuilder_ == null) { ensureChannelPartnerRepricingConfigsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, channelPartnerRepricingConfigs_); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder clearChannelPartnerRepricingConfigs() { if (channelPartnerRepricingConfigsBuilder_ == null) { channelPartnerRepricingConfigs_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.clear(); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public Builder removeChannelPartnerRepricingConfigs(int index) { if (channelPartnerRepricingConfigsBuilder_ == null) { ensureChannelPartnerRepricingConfigsIsMutable(); channelPartnerRepricingConfigs_.remove(index); onChanged(); } else { channelPartnerRepricingConfigsBuilder_.remove(index); } return this; } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder getChannelPartnerRepricingConfigsBuilder(int index) { return getChannelPartnerRepricingConfigsFieldBuilder().getBuilder(index); } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public com.google.cloud.channel.v1.ChannelPartnerRepricingConfigOrBuilder getChannelPartnerRepricingConfigsOrBuilder(int index) { if (channelPartnerRepricingConfigsBuilder_ == null) { return channelPartnerRepricingConfigs_.get(index); } else { return channelPartnerRepricingConfigsBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public java.util.List< ? extends com.google.cloud.channel.v1.ChannelPartnerRepricingConfigOrBuilder> getChannelPartnerRepricingConfigsOrBuilderList() { if (channelPartnerRepricingConfigsBuilder_ != null) { return channelPartnerRepricingConfigsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(channelPartnerRepricingConfigs_); } } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder addChannelPartnerRepricingConfigsBuilder() { return getChannelPartnerRepricingConfigsFieldBuilder() .addBuilder( com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.getDefaultInstance()); } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder addChannelPartnerRepricingConfigsBuilder(int index) { return getChannelPartnerRepricingConfigsFieldBuilder() .addBuilder( index, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.getDefaultInstance()); } /** * * * <pre> * The repricing configs for this channel partner. * </pre> * * <code> * repeated .google.cloud.channel.v1.ChannelPartnerRepricingConfig channel_partner_repricing_configs = 1; * </code> */ public java.util.List<com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder> getChannelPartnerRepricingConfigsBuilderList() { return getChannelPartnerRepricingConfigsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.channel.v1.ChannelPartnerRepricingConfig, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder, com.google.cloud.channel.v1.ChannelPartnerRepricingConfigOrBuilder> getChannelPartnerRepricingConfigsFieldBuilder() { if (channelPartnerRepricingConfigsBuilder_ == null) { channelPartnerRepricingConfigsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.channel.v1.ChannelPartnerRepricingConfig, com.google.cloud.channel.v1.ChannelPartnerRepricingConfig.Builder, com.google.cloud.channel.v1.ChannelPartnerRepricingConfigOrBuilder>( channelPartnerRepricingConfigs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); channelPartnerRepricingConfigs_ = null; } return channelPartnerRepricingConfigsBuilder_; } private java.lang.Object nextPageToken_ = ""; /** * * * <pre> * A token to retrieve the next page of results. * Pass to * [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] * to obtain that page. * </pre> * * <code>string next_page_token = 2;</code> * * @return The nextPageToken. */ public java.lang.String getNextPageToken() { java.lang.Object ref = nextPageToken_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); nextPageToken_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * A token to retrieve the next page of results. * Pass to * [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] * to obtain that page. * </pre> * * <code>string next_page_token = 2;</code> * * @return The bytes for nextPageToken. */ public com.google.protobuf.ByteString getNextPageTokenBytes() { java.lang.Object ref = nextPageToken_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); nextPageToken_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * A token to retrieve the next page of results. * Pass to * [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] * to obtain that page. * </pre> * * <code>string next_page_token = 2;</code> * * @param value The nextPageToken to set. * @return This builder for chaining. */ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } nextPageToken_ = value; bitField0_ |= 0x00000002; onChanged(); return this; } /** * * * <pre> * A token to retrieve the next page of results. * Pass to * [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] * to obtain that page. * </pre> * * <code>string next_page_token = 2;</code> * * @return This builder for chaining. */ public Builder clearNextPageToken() { nextPageToken_ = getDefaultInstance().getNextPageToken(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } /** * * * <pre> * A token to retrieve the next page of results. * Pass to * [ListChannelPartnerRepricingConfigsRequest.page_token][google.cloud.channel.v1.ListChannelPartnerRepricingConfigsRequest.page_token] * to obtain that page. * </pre> * * <code>string next_page_token = 2;</code> * * @param value The bytes for nextPageToken to set. * @return This builder for chaining. */ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); nextPageToken_ = value; bitField0_ |= 0x00000002; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse) } // @@protoc_insertion_point(class_scope:google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse) private static final com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse(); } public static com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<ListChannelPartnerRepricingConfigsResponse> PARSER = new com.google.protobuf.AbstractParser<ListChannelPartnerRepricingConfigsResponse>() { @java.lang.Override public ListChannelPartnerRepricingConfigsResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { Builder builder = newBuilder(); try { builder.mergeFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(builder.buildPartial()); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException() .setUnfinishedMessage(builder.buildPartial()); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(builder.buildPartial()); } return builder.buildPartial(); } }; public static com.google.protobuf.Parser<ListChannelPartnerRepricingConfigsResponse> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<ListChannelPartnerRepricingConfigsResponse> getParserForType() { return PARSER; } @java.lang.Override public com.google.cloud.channel.v1.ListChannelPartnerRepricingConfigsResponse getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
[ "noreply@github.com" ]
noreply@github.com
36439558073eaf02d73c80dcf66e5a3360f755a5
4627d514d6664526f58fbe3cac830a54679749cd
/results/evosuite5/closure-com.google.javascript.rhino.head.FunctionObject-15/com/google/javascript/rhino/head/FunctionObject_ESTest_scaffolding.java
aa71dbf444a6fab231431d38380b3c172885a680
[]
no_license
STAMP-project/Cling-application
c624175a4aa24bb9b29b53f9b84c42a0f18631bd
0ff4d7652b434cbfd9be8d8bb38cfc8d8eaa51b5
refs/heads/master
2022-07-27T09:30:16.423362
2022-07-19T12:01:46
2022-07-19T12:01:46
254,310,667
2
2
null
2021-07-12T12:29:50
2020-04-09T08:11:35
null
UTF-8
Java
false
false
25,387
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Aug 13 22:13:35 GMT 2019 */ package com.google.javascript.rhino.head; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class FunctionObject_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "com.google.javascript.rhino.head.FunctionObject"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); setSystemProperties(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); java.lang.System.setProperty("user.dir", "/home/pderakhshanfar/botsing-integration-experiment"); java.lang.System.setProperty("java.io.tmpdir", "/tmp"); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(FunctionObject_ESTest_scaffolding.class.getClassLoader() , "com.google.javascript.rhino.head.IdFunctionObject", "com.google.javascript.rhino.head.ast.ObjectProperty", "com.google.javascript.rhino.head.Icode", "com.google.javascript.rhino.head.json.JsonParser$ParseException", "com.google.javascript.rhino.head.ContextFactory$1", "com.google.javascript.rhino.head.ast.UnaryExpression", "com.google.javascript.rhino.head.WrappedException", "com.google.javascript.rhino.head.debug.DebuggableObject", "com.google.javascript.rhino.head.Arguments", "com.google.javascript.rhino.head.jdk13.VMBridge_jdk13", "com.google.javascript.rhino.head.IdScriptableObject$PrototypeValues", "com.google.javascript.rhino.head.ast.Yield", "com.google.javascript.rhino.head.regexp.RENode", "com.google.javascript.rhino.head.Function", "com.google.javascript.rhino.head.ScriptStackElement", "com.google.javascript.rhino.head.NativeJavaTopPackage", "com.google.javascript.rhino.head.ast.LetNode", "com.google.javascript.rhino.head.JavaMembers", "com.google.javascript.rhino.head.NativeJSON$StringifyState", "com.google.javascript.rhino.head.NativeJavaArray", "com.google.javascript.rhino.head.NativeGlobal", "com.google.javascript.rhino.head.ConsString", "com.google.javascript.rhino.head.regexp.NativeRegExpCtor", "org.mozilla.classfile.ConstantPool", "com.google.javascript.rhino.head.ContextFactory$Listener", "com.google.javascript.rhino.head.Decompiler", "com.google.javascript.rhino.head.ast.Jump", "com.google.javascript.rhino.head.NativeCall", "com.google.javascript.rhino.head.optimizer.BodyCodegen$ExceptionManager", "com.google.javascript.rhino.head.ClassCache", "com.google.javascript.rhino.head.ast.EmptyStatement", "com.google.javascript.rhino.head.annotations.JSStaticFunction", "com.google.javascript.rhino.head.ast.ForInLoop", "com.google.javascript.rhino.head.ScriptRuntime$NoSuchMethodShim", "com.google.javascript.rhino.head.ast.XmlFragment", "com.google.javascript.rhino.head.ast.CatchClause", "com.google.javascript.rhino.head.Node$1", "com.google.javascript.rhino.head.ast.AstRoot", "com.google.javascript.rhino.head.ast.Block", "com.google.javascript.rhino.head.Token$CommentType", "com.google.javascript.rhino.head.ast.SwitchCase", "com.google.javascript.rhino.head.ast.NewExpression", "com.google.javascript.rhino.head.ast.StringLiteral", "com.google.javascript.rhino.head.ast.ParenthesizedExpression", "com.google.javascript.rhino.head.ScriptableObject$Slot", "org.mozilla.classfile.ClassFileWriter$ClassFileFormatException", "com.google.javascript.rhino.head.ast.ReturnStatement", "com.google.javascript.rhino.head.Context$2", "com.google.javascript.rhino.head.ScriptRuntime$IdEnumeration", "com.google.javascript.rhino.head.Context$ClassShutterSetter", "com.google.javascript.rhino.head.GeneratedClassLoader", "com.google.javascript.rhino.head.regexp.SubString", "com.google.javascript.rhino.head.optimizer.OptFunctionNode", "com.google.javascript.rhino.head.ast.Label", "com.google.javascript.rhino.head.NativeJavaObject", "com.google.javascript.rhino.head.debug.DebugFrame", "com.google.javascript.rhino.head.ast.ArrayLiteral", "com.google.javascript.rhino.head.CompilerEnvirons", "com.google.javascript.rhino.head.NativeJavaPackage", "com.google.javascript.rhino.head.Callable", "com.google.javascript.rhino.head.InterfaceAdapter", "com.google.javascript.rhino.head.ast.RegExpLiteral", "com.google.javascript.rhino.head.debug.Debugger", "com.google.javascript.rhino.head.ClassShutter", "org.mozilla.classfile.FieldOrMethodRef", "com.google.javascript.rhino.head.ast.ScriptNode", "com.google.javascript.rhino.head.ast.XmlString", "com.google.javascript.rhino.head.ast.WhileLoop", "com.google.javascript.rhino.head.NativeArray", "com.google.javascript.rhino.head.NativeJavaMethod", "com.google.javascript.rhino.head.v8dtoa.CachedPowers", "com.google.javascript.rhino.head.NativeDate", "com.google.javascript.rhino.head.Parser", "com.google.javascript.rhino.head.NativeString", "com.google.javascript.rhino.head.ast.IfStatement", "com.google.javascript.rhino.head.ast.XmlRef", "com.google.javascript.rhino.head.regexp.RegExpImpl", "com.google.javascript.rhino.head.NativeGenerator", "com.google.javascript.rhino.head.ast.ElementGet", "com.google.javascript.rhino.head.NativeIterator$WrappedJavaIterator", "com.google.javascript.rhino.head.Evaluator", "com.google.javascript.rhino.head.JavaAdapter", "com.google.javascript.rhino.head.ast.XmlElemRef", "com.google.javascript.rhino.head.ast.VariableDeclaration", "com.google.javascript.rhino.head.TokenStream", "com.google.javascript.rhino.head.ContinuationPending", "com.google.javascript.rhino.head.xml.XMLLib$Factory$1", "com.google.javascript.rhino.head.ast.ObjectLiteral", "com.google.javascript.rhino.head.JavaScriptException", "com.google.javascript.rhino.head.ast.IdeErrorReporter", "com.google.javascript.rhino.head.ast.TryStatement", "com.google.javascript.rhino.head.NativeIterator", "com.google.javascript.rhino.head.TopLevel", "com.google.javascript.rhino.head.ast.InfixExpression", "com.google.javascript.rhino.head.BaseFunction", "com.google.javascript.rhino.head.Interpreter$GeneratorState", "com.google.javascript.rhino.head.ast.XmlPropRef", "com.google.javascript.rhino.head.Delegator", "com.google.javascript.rhino.head.ast.ArrayComprehension", "com.google.javascript.rhino.head.ScriptRuntime$1", "com.google.javascript.rhino.head.ObjToIntMap", "com.google.javascript.rhino.head.ast.VariableInitializer", "com.google.javascript.rhino.head.Node$PropListItem", "com.google.javascript.rhino.head.ast.ThrowStatement", "com.google.javascript.rhino.head.NativeArray$3", "com.google.javascript.rhino.head.NativeArray$2", "com.google.javascript.rhino.head.NativeArray$1", "com.google.javascript.rhino.head.ConstProperties", "com.google.javascript.rhino.head.debug.DebuggableScript", "com.google.javascript.rhino.head.MemberBox", "com.google.javascript.rhino.head.RegExpProxy", "com.google.javascript.rhino.head.DefaultErrorReporter", "com.google.javascript.rhino.head.xml.XMLLib", "com.google.javascript.rhino.head.Script", "com.google.javascript.rhino.head.ScriptRuntime$DefaultMessageProvider", "com.google.javascript.rhino.head.ast.DestructuringForm", "com.google.javascript.rhino.head.NativeJavaConstructor", "com.google.javascript.rhino.head.NativeGenerator$GeneratorClosedException", "com.google.javascript.rhino.head.TopLevel$Builtins", "com.google.javascript.rhino.head.ContextFactory$1GlobalSetterImpl", "com.google.javascript.rhino.head.SecurityUtilities", "com.google.javascript.rhino.head.ast.Comment", "com.google.javascript.rhino.head.ScriptableObject$RelinkedSlot", "com.google.javascript.rhino.head.NativeJavaClass", "com.google.javascript.rhino.head.UintMap", "com.google.javascript.rhino.head.RhinoException", "com.google.javascript.rhino.head.ast.EmptyExpression", "com.google.javascript.rhino.head.ast.XmlLiteral", "com.google.javascript.rhino.head.NodeTransformer", "com.google.javascript.rhino.head.ast.ContinueStatement", "com.google.javascript.rhino.head.regexp.RECompiled", "com.google.javascript.rhino.head.ErrorReporter", "com.google.javascript.rhino.head.optimizer.Codegen", "com.google.javascript.rhino.head.ast.FunctionCall", "com.google.javascript.rhino.head.ast.XmlMemberGet", "com.google.javascript.rhino.head.NativeIterator$StopIteration", "com.google.javascript.rhino.head.v8dtoa.DoubleHelper", "com.google.javascript.rhino.head.ast.Scope", "com.google.javascript.rhino.head.LazilyLoadedCtor$1", "com.google.javascript.rhino.head.regexp.NativeRegExp", "com.google.javascript.rhino.head.Scriptable", "com.google.javascript.rhino.head.FunctionObject", "com.google.javascript.rhino.head.EcmaError", "com.google.javascript.rhino.head.IRFactory", "com.google.javascript.rhino.head.annotations.JSConstructor", "com.google.javascript.rhino.head.NativeContinuation", "com.google.javascript.rhino.head.xml.XMLObject", "com.google.javascript.rhino.head.Node$NodeIterator", "com.google.javascript.rhino.head.xml.XMLLib$Factory", "com.google.javascript.rhino.head.regexp.REProgState", "com.google.javascript.rhino.head.InterpretedFunction", "com.google.javascript.rhino.head.NativeScript", "org.mozilla.classfile.ExceptionTableEntry", "com.google.javascript.rhino.head.NativeNumber", "com.google.javascript.rhino.head.ast.BreakStatement", "com.google.javascript.rhino.head.regexp.REBackTrackData", "com.google.javascript.rhino.head.ScriptableObject$GetterSlot", "com.google.javascript.rhino.head.ast.WithStatement", "com.google.javascript.rhino.head.v8dtoa.CachedPowers$CachedPower", "com.google.javascript.rhino.head.ScriptRuntime$MessageProvider", "com.google.javascript.rhino.head.ast.ForLoop", "com.google.javascript.rhino.head.ast.FunctionNode", "com.google.javascript.rhino.head.v8dtoa.FastDtoaBuilder", "com.google.javascript.rhino.head.ast.AstNode", "com.google.javascript.rhino.head.NativeMath", "com.google.javascript.rhino.head.optimizer.BodyCodegen$FinallyReturnPoint", "com.google.javascript.rhino.head.ast.ErrorCollector", "com.google.javascript.rhino.head.Context", "com.google.javascript.rhino.head.NativeError", "com.google.javascript.rhino.head.SecurityController", "com.google.javascript.rhino.head.DefiningClassLoader", "com.google.javascript.rhino.head.NativeJSON", "com.google.javascript.rhino.head.BoundFunction", "com.google.javascript.rhino.head.Node", "com.google.javascript.rhino.head.NativeBoolean", "com.google.javascript.rhino.head.regexp.GlobData", "com.google.javascript.rhino.head.ast.Name", "com.google.javascript.rhino.head.InterpreterData", "com.google.javascript.rhino.head.optimizer.OptTransformer", "com.google.javascript.rhino.head.ast.KeywordLiteral", "org.mozilla.classfile.ClassFileMethod", "com.google.javascript.rhino.head.ast.Assignment", "com.google.javascript.rhino.head.WrapFactory", "com.google.javascript.rhino.head.UniqueTag", "com.google.javascript.rhino.head.Undefined", "com.google.javascript.rhino.head.ast.ConditionalExpression", "com.google.javascript.rhino.head.ast.LabeledStatement", "com.google.javascript.rhino.head.LazilyLoadedCtor", "com.google.javascript.rhino.head.annotations.JSFunction", "com.google.javascript.rhino.head.ast.PropertyGet", "com.google.javascript.rhino.head.ContextFactory", "com.google.javascript.rhino.head.Parser$ConditionData", "com.google.javascript.rhino.head.VMBridge", "com.google.javascript.rhino.head.annotations.JSSetter", "com.google.javascript.rhino.head.v8dtoa.FastDtoa", "com.google.javascript.rhino.head.ast.XmlExpression", "org.mozilla.classfile.ClassFileWriter", "com.google.javascript.rhino.head.Kit", "com.google.javascript.rhino.head.DToA", "com.google.javascript.rhino.head.ObjArray", "com.google.javascript.rhino.head.Wrapper", "com.google.javascript.rhino.head.BeanProperty", "com.google.javascript.rhino.head.ContextListener", "com.google.javascript.rhino.head.jdk15.VMBridge_jdk15", "com.google.javascript.rhino.head.ast.Loop", "com.google.javascript.rhino.head.ContextAction", "com.google.javascript.rhino.head.annotations.JSGetter", "com.google.javascript.rhino.head.ast.GeneratorExpressionLoop", "com.google.javascript.rhino.head.EvaluatorException", "com.google.javascript.rhino.head.ast.NumberLiteral", "com.google.javascript.rhino.head.optimizer.BodyCodegen", "com.google.javascript.rhino.head.NativeWith", "com.google.javascript.rhino.head.v8dtoa.DiyFp", "com.google.javascript.rhino.head.ObjToIntMap$Iterator", "com.google.javascript.rhino.head.ast.ErrorNode", "com.google.javascript.rhino.head.SecurityUtilities$2", "com.google.javascript.rhino.head.Interpreter$CallFrame", "com.google.javascript.rhino.head.IdFunctionCall", "com.google.javascript.rhino.head.regexp.CompilerState", "com.google.javascript.rhino.head.ast.SwitchStatement", "com.google.javascript.rhino.head.Synchronizer", "com.google.javascript.rhino.head.Interpreter", "com.google.javascript.rhino.head.ImporterTopLevel", "com.google.javascript.rhino.head.ast.DoLoop", "com.google.javascript.rhino.head.optimizer.BodyCodegen$ExceptionManager$ExceptionInfo", "com.google.javascript.rhino.head.ast.Symbol", "com.google.javascript.rhino.head.JavaMembers$MethodSignature", "com.google.javascript.rhino.head.ast.GeneratorExpression", "com.google.javascript.rhino.head.ast.XmlDotQuery", "com.google.javascript.rhino.head.ScriptRuntime", "com.google.javascript.rhino.head.Ref", "com.google.javascript.rhino.head.ContextFactory$GlobalSetter", "com.google.javascript.rhino.head.ast.ExpressionStatement", "com.google.javascript.rhino.head.ast.NodeVisitor", "com.google.javascript.rhino.head.regexp.RECharSet", "com.google.javascript.rhino.head.ast.ArrayComprehensionLoop", "com.google.javascript.rhino.head.ScriptableObject", "com.google.javascript.rhino.head.IdScriptableObject", "com.google.javascript.rhino.head.NativeFunction", "com.google.javascript.rhino.head.regexp.REGlobalData", "com.google.javascript.rhino.head.Parser$ParserException", "com.google.javascript.rhino.head.NativeObject", "org.mozilla.classfile.ClassFileField" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(FunctionObject_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "com.google.javascript.rhino.head.ScriptableObject", "com.google.javascript.rhino.head.IdScriptableObject", "com.google.javascript.rhino.head.BaseFunction", "com.google.javascript.rhino.head.FunctionObject", "com.google.javascript.rhino.head.UniqueTag", "com.google.javascript.rhino.head.Scriptable", "com.google.javascript.rhino.head.Kit", "com.google.javascript.rhino.head.optimizer.Codegen", "com.google.javascript.rhino.head.Icode", "com.google.javascript.rhino.head.Interpreter", "com.google.javascript.rhino.head.Context", "com.google.javascript.rhino.head.ContextFactory", "com.google.javascript.rhino.head.ScriptRuntime$DefaultMessageProvider", "com.google.javascript.rhino.head.ScriptRuntime", "com.google.javascript.rhino.head.jdk13.VMBridge_jdk13", "com.google.javascript.rhino.head.jdk15.VMBridge_jdk15", "com.google.javascript.rhino.head.VMBridge", "com.google.javascript.rhino.head.TopLevel$Builtins", "com.google.javascript.rhino.head.TopLevel", "com.google.javascript.rhino.head.Undefined", "com.google.javascript.rhino.head.v8dtoa.FastDtoa", "com.google.javascript.rhino.head.v8dtoa.DoubleHelper", "com.google.javascript.rhino.head.v8dtoa.CachedPowers$CachedPower", "com.google.javascript.rhino.head.v8dtoa.CachedPowers", "com.google.javascript.rhino.head.DToA", "com.google.javascript.rhino.head.NativeObject", "com.google.javascript.rhino.head.MemberBox", "com.google.javascript.rhino.head.ClassCache", "com.google.javascript.rhino.head.IdScriptableObject$PrototypeValues", "com.google.javascript.rhino.head.IdFunctionObject", "com.google.javascript.rhino.head.ScriptableObject$Slot", "com.google.javascript.rhino.head.ScriptableObject$RelinkedSlot", "com.google.javascript.rhino.head.NativeError", "com.google.javascript.rhino.head.NativeGlobal", "com.google.javascript.rhino.head.NativeArray", "com.google.javascript.rhino.head.NativeString", "com.google.javascript.rhino.head.NativeBoolean", "com.google.javascript.rhino.head.NativeNumber", "com.google.javascript.rhino.head.NativeDate", "com.google.javascript.rhino.head.NativeMath", "com.google.javascript.rhino.head.NativeJSON", "com.google.javascript.rhino.head.NativeWith", "com.google.javascript.rhino.head.NativeCall", "com.google.javascript.rhino.head.NativeScript", "com.google.javascript.rhino.head.NativeIterator", "com.google.javascript.rhino.head.NativeGenerator", "com.google.javascript.rhino.head.NativeIterator$StopIteration", "com.google.javascript.rhino.head.xml.XMLLib$Factory", "com.google.javascript.rhino.head.xml.XMLLib$Factory$1", "com.google.javascript.rhino.head.LazilyLoadedCtor", "com.google.javascript.rhino.head.ScriptableObject$GetterSlot", "com.google.javascript.rhino.head.JavaAdapter", "com.google.javascript.rhino.head.NativeJavaObject", "com.google.javascript.rhino.head.NativeJavaClass", "com.google.javascript.rhino.head.WrapFactory", "com.google.javascript.rhino.head.JavaMembers", "com.google.javascript.rhino.head.NativeFunction", "com.google.javascript.rhino.head.InterpretedFunction", "com.google.javascript.rhino.head.SecurityController", "com.google.javascript.rhino.head.Arguments", "com.google.javascript.rhino.head.NativeJavaPackage", "com.google.javascript.rhino.head.NativeJavaTopPackage", "com.google.javascript.rhino.head.NativeJavaMethod", "com.google.javascript.rhino.head.Delegator", "com.google.javascript.rhino.head.Synchronizer", "com.google.javascript.rhino.head.DefaultErrorReporter", "com.google.javascript.rhino.head.RhinoException", "com.google.javascript.rhino.head.EcmaError", "com.google.javascript.rhino.head.EvaluatorException", "com.google.javascript.rhino.head.BoundFunction", "com.google.javascript.rhino.head.InterpreterData", "com.google.javascript.rhino.head.ImporterTopLevel", "com.google.javascript.rhino.head.ObjArray", "com.google.javascript.rhino.head.ContextFactory$1", "com.google.javascript.rhino.head.DefiningClassLoader", "com.google.javascript.rhino.head.Context$2", "com.google.javascript.rhino.head.LazilyLoadedCtor$1", "com.google.javascript.rhino.head.regexp.NativeRegExp", "com.google.javascript.rhino.head.regexp.RECompiled", "com.google.javascript.rhino.head.regexp.CompilerState", "com.google.javascript.rhino.head.regexp.RENode", "com.google.javascript.rhino.head.regexp.NativeRegExpCtor", "com.google.javascript.rhino.head.NativeContinuation", "com.google.javascript.rhino.head.NativeJavaArray", "com.google.javascript.rhino.head.JavaMembers$MethodSignature", "com.google.javascript.rhino.head.BeanProperty", "com.google.javascript.rhino.head.WrappedException", "com.google.javascript.rhino.head.NativeJavaConstructor", "com.google.javascript.rhino.head.ContextFactory$1GlobalSetterImpl", "com.google.javascript.rhino.head.regexp.RegExpImpl", "com.google.javascript.rhino.head.ConsString", "com.google.javascript.rhino.head.CompilerEnvirons", "com.google.javascript.rhino.head.Parser", "com.google.javascript.rhino.head.TokenStream", "com.google.javascript.rhino.head.ObjToIntMap", "com.google.javascript.rhino.head.Node", "com.google.javascript.rhino.head.ast.AstNode", "com.google.javascript.rhino.head.ast.Jump", "com.google.javascript.rhino.head.ast.Scope", "com.google.javascript.rhino.head.ast.ScriptNode", "com.google.javascript.rhino.head.ast.AstRoot", "com.google.javascript.rhino.head.ast.Name", "com.google.javascript.rhino.head.ast.InfixExpression", "com.google.javascript.rhino.head.ast.PropertyGet", "com.google.javascript.rhino.head.ast.ExpressionStatement", "com.google.javascript.rhino.head.IRFactory", "com.google.javascript.rhino.head.Decompiler", "com.google.javascript.rhino.head.Node$NodeIterator", "com.google.javascript.rhino.head.NodeTransformer", "com.google.javascript.rhino.head.optimizer.OptTransformer", "org.mozilla.classfile.ClassFileWriter", "org.mozilla.classfile.ConstantPool", "com.google.javascript.rhino.head.UintMap", "org.mozilla.classfile.ClassFileField", "org.mozilla.classfile.ClassFileMethod", "org.mozilla.classfile.FieldOrMethodRef", "com.google.javascript.rhino.head.optimizer.BodyCodegen", "com.google.javascript.rhino.head.optimizer.BodyCodegen$ExceptionManager", "com.google.javascript.rhino.head.SecurityUtilities", "com.google.javascript.rhino.head.SecurityUtilities$2", "com.google.javascript.rhino.head.ScriptRuntime$1", "com.google.javascript.rhino.head.NativeArray$3", "com.google.javascript.rhino.head.ContinuationPending", "com.google.javascript.rhino.head.ast.ErrorCollector", "com.google.javascript.rhino.head.v8dtoa.FastDtoaBuilder", "com.google.javascript.rhino.head.v8dtoa.DiyFp" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
0b9e313e5c71a9f62083aa5ef68e7566de71b4e6
2769b90b7982f1eb9c8b5e920a3c76b7f810674c
/Day23-eclipse-Thread/src/com/xiaxiaxia/sellTicket2/SellTicket.java
780bca745490dd8ccac8f963757c42aa3fc87f51
[]
no_license
xiahuya/javaSE
14e82e30f900ed26ac04cfff438b24b6cb76472e
bf40a659f9c69aaa8fe2299998866601ee922edc
refs/heads/master
2022-07-14T01:43:53.903043
2020-05-17T05:13:36
2020-05-17T05:13:36
null
0
0
null
null
null
null
GB18030
Java
false
false
916
java
package com.xiaxiaxia.sellTicket2; /* * 为了更加真实模拟卖票的场景,道理上讲是应该: * 窗口一:100 * 窗口二:99 * 窗口三:98 * ... * 所有应该加入睡眠 */ public class SellTicket implements Runnable { private int tickets = 100; @Override public void run() { while (true) { // t1,t2,t3三个线程 // 这一次的tickets = 1; if (tickets > 0) { // 为了模拟更真实的场景,我们稍作休息 try { Thread.sleep(100); // t1进来了并休息,t2进来了并休息,t3进来了并休息, } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName() + "正在出售第" + (tickets--) + "张票"); // 窗口1正在出售第1张票,tickets=0 // 窗口2正在出售第0张票,tickets=-1 // 窗口3正在出售第-1张票,tickets=-2 } } } }
[ "1765016445@qq.com" ]
1765016445@qq.com
82d1b4424cb2aae9dd0bf444745fdca20c7e732e
c9377759758b2075d4005a933e6107713404073d
/jdk-1.6-parent/gmap3-parent/gmap3-examples/src/main/java/org/wicketstuff/examples/gmap/listen/overlay/advanced/HomePage.java
98792da1a8563f7702f68296a33b6694bddc9a35
[ "Apache-2.0" ]
permissive
pmaingi/core
771f9837ff605f7ad5378bde45499d5a9b738bff
c23f46dd241754e2c23324cf201a81501db2805f
refs/heads/master
2021-01-17T22:35:03.837182
2012-11-21T10:32:01
2012-11-21T10:32:01
6,855,292
1
0
null
null
null
null
UTF-8
Java
false
false
7,305
java
package org.wicketstuff.examples.gmap.listen.overlay.advanced; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.markup.repeater.RepeatingView; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.wicketstuff.examples.gmap.WicketExamplePage; import org.wicketstuff.gmap.GMap; import org.wicketstuff.gmap.api.GEvent; import org.wicketstuff.gmap.api.GEventHandler; import org.wicketstuff.gmap.api.GLatLng; import org.wicketstuff.gmap.api.GMarker; import org.wicketstuff.gmap.api.GMarkerOptions; import org.wicketstuff.gmap.api.GOverlay; import org.wicketstuff.gmap.event.ClickListener; /** * Demonstrates how to listen to a marker on the map & toggle this behavior. */ public class HomePage extends WicketExamplePage { private static final long serialVersionUID = 1L; public HomePage() { final GMap map = new GMap("map"); add(map); final WebMarkupContainer repeaterParent = new WebMarkupContainer("repeaterParent"); repeaterParent.setOutputMarkupId(true); add(repeaterParent); final RepeatingView rv = new RepeatingView("label"); rv.setOutputMarkupId(true); repeaterParent.add(rv); map.add(new ClickListener() { private static final long serialVersionUID = 1L; @Override protected void onClick(AjaxRequestTarget target, GLatLng latLng) { if (latLng != null) { if (map.getOverlays().size() >= 3) { map.removeOverlay(map.getOverlays().get(0)); } final MyMarker marker = new MyMarker(new GMarkerOptions(map, latLng).draggable(true)) { private static final long serialVersionUID = 1L; @Override GEventHandler getDragendHandler() { return new GEventHandler() { private static final long serialVersionUID = 1L; @Override public void onEvent(AjaxRequestTarget eventTarget) { eventTarget.add(repeaterParent); } }; } @Override GEventHandler getDblclickHandler() { return new GEventHandler() { private static final long serialVersionUID = 1L; @Override public void onEvent(AjaxRequestTarget eventTarget) { eventTarget.add(repeaterParent); } }; } }; map.addOverlay(marker); marker.addListener(GEvent.dragend, marker.getDragendHandler()); rv.removeAll(); for (GOverlay myMarker : map.getOverlays()) { final GOverlayPanel label = new GOverlayPanel(myMarker.getId(), new CompoundPropertyModel<MyMarker>((MyMarker) myMarker)); label.setOutputMarkupId(true); rv.add(label); } target.add(repeaterParent); } } }); } /** * Panel for displaying and controlling the state of a GOverlay. */ private static class GOverlayPanel extends Panel { private static final long serialVersionUID = 1L; public GOverlayPanel(String id, final IModel<MyMarker> model) { super(id, model); add(new Label("latLng")); final Label dragendLabel = new Label("dragend", new Model<Boolean>() { private static final long serialVersionUID = 1L; /* * (non-Javadoc) * * @see org.apache.wicket.model.Model#getObject() */ @Override public Boolean getObject() { return model.getObject().getListeners().containsKey(GEvent.dragend); } }); dragendLabel.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { MyMarker overlay = model.getObject(); if ((Boolean) dragendLabel.getDefaultModelObject()) { overlay.clearListeners(GEvent.dragend); } else { overlay.addListener(GEvent.dragend, overlay.getDragendHandler()); } target.add(GOverlayPanel.this); } }); add(dragendLabel); final Label dblclickLabel = new Label("dblclick", new Model<Boolean>() { private static final long serialVersionUID = 1L; @Override public Boolean getObject() { return ((GOverlay) getDefaultModelObject()).getListeners().containsKey(GEvent.dblclick); } }); dblclickLabel.add(new AjaxEventBehavior("onclick") { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { MyMarker overlay = ((MyMarker) GOverlayPanel.this.getDefaultModelObject()); if ((Boolean) dragendLabel.getDefaultModelObject()) { overlay.clearListeners(GEvent.dblclick); } else { overlay.addListener(GEvent.dblclick, overlay.getDblclickHandler()); } target.add(GOverlayPanel.this); } }); add(dblclickLabel); } } /** * Extend a GMarker with factory methods for needed handler. */ private static abstract class MyMarker extends GMarker { private static final long serialVersionUID = -5720177222106241564L; public MyMarker(GMarkerOptions options) { super(options); } abstract GEventHandler getDblclickHandler(); abstract GEventHandler getDragendHandler(); } }
[ "jr@jr" ]
jr@jr
d801a87d5c15fc48766bb1d1def1db7ab0f81c66
940c479aa161485e2a733b504d7ea223bedc770f
/app/src/main/java/com/coolbanter/examprep/game/AnswersView.java
d663765cf233a084013f52c65692b2895a720c10
[]
no_license
carluvy/Dribbles
945c20bab557aa4b7dc3c03130ebfc3aafece3c3
c70623cd9fd33f3245a9d3b35bc6d70e8badd346
refs/heads/main
2023-03-02T16:02:54.965179
2021-02-12T09:39:07
2021-02-12T09:39:07
335,622,048
0
0
null
null
null
null
UTF-8
Java
false
false
3,734
java
package com.coolbanter.examprep.game; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.RadioButton; import android.widget.RadioGroup; import com.coolbanter.examprep.R; import com.coolbanter.examprep.data.Smiley; import java.util.List; public class AnswersView extends RadioGroup implements RadioGroup.OnCheckedChangeListener { private OnAnswerListener mAnswerListener; public AnswersView(Context context) { super(context); setOnCheckedChangeListener(this); } public AnswersView(Context context, AttributeSet attrs) { super(context, attrs); setOnCheckedChangeListener(this); } // @Override // protected void onCreateContextMenu(ContextMenu menu) { // super.onCreateContextMenu(menu); // ConstraintLayout mLayout = findViewById( R.id.main_view); // // RadioButton button = new RadioButton(getContext()); // button.setLayoutParams(new ConstraintLayout.LayoutParams( // ConstraintLayout.LayoutParams.MATCH_PARENT, // ConstraintLayout.LayoutParams.MATCH_PARENT)); // mLayout.addView(button); // } /** * Loads RadioButtons from the list of Smileys * * @param smileys list of {@see Smiley} */ public void loadAnswers(List<Smiley> smileys) { if (smileys == null) { return; } // else { // // // int ans = 0; // Intent intentExtra = ((Activity) getContext()).getIntent(); // intentExtra.getStringExtra("pref_key_answers"); // String valueKey = intentExtra.getStringExtra("pref_key_answers"); // switch(valueKey) { // case "0": // ans = 2; // return; // case "1": // ans = 3; // return; // case "3": // ans = 4; // return; // // } // } removeAllViews(); // LayoutInflater layoutInflater = LayoutInflater.from(getContext()).inflate(R.layout.answer_view, this, true); LayoutInflater inflater = LayoutInflater.from(getContext()); // RecyclerView recyclerView = findViewById(R.id.rec); for (Smiley smiley : smileys) { // int view = R.layout.activity_main; // LinearLayout parentLayout = findViewById(R.id.main_view); // View view = (View) inflater.inflate(R.layout.answer_view, this, false); // RadioGroup group = (RadioGroup) inflater.inflate(R.layout.answer_item, this, false); RadioButton button = (RadioButton) inflater.inflate(R.layout.answer_item, this, false); button.setText(smiley.getName()); button.setTag(R.string.answer_tag, smiley.getCode()); addView(button); } } @Override public void onCheckedChanged(RadioGroup group, int checkedId) { RadioButton button = group.findViewById(checkedId); mAnswerListener.onAnswerSelected((String) button.getTag(R.string.answer_tag)); } /** * Set enabled state of child views and parent view * * @param enabled True if child views are enabled? */ @Override public void setEnabled(boolean enabled) { for (int i = 0; i < getChildCount(); i++) { getChildAt(i).setEnabled(enabled); } super.setEnabled(enabled); } public interface OnAnswerListener { void onAnswerSelected(String answer); } public void setOnAnswerListener(OnAnswerListener listener) { mAnswerListener = listener; } }
[ "37089288+carluvy@users.noreply.github.com" ]
37089288+carluvy@users.noreply.github.com
a5e3292ed6a2667fd3b0b1e6729f2e9c137bc730
fa528ba0ca56b2c1d1da88280abe17e857a2515a
/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ZooKeeperQuorumCalculator.java
fa3683af5e182fdaf72cd57b1b3835c3f055bc06
[ "Apache-2.0", "MIT", "GPL-2.0-only", "OFL-1.1", "GPL-2.0-or-later", "BSD-2-Clause", "GPL-1.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "Python-2.0", "MS-PL", "AFL-2.1" ]
permissive
arenadata/ambari
23ca823c04bdab13be3d85012cf49f46495bfcb2
4628267441121779113d98936dcdf5d9be60553c
refs/heads/branch-adh-1.6
2022-03-25T15:40:19.266410
2021-04-28T10:34:35
2021-04-28T10:34:35
72,750,426
5
12
Apache-2.0
2022-01-17T22:02:26
2016-11-03T13:55:09
Java
UTF-8
Java
false
false
2,997
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ambari.server.serveraction.upgrades; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.ambari.server.Role; import org.apache.ambari.server.state.Cluster; import org.apache.ambari.server.state.Config; import org.apache.ambari.server.state.Service; import org.apache.ambari.server.state.ServiceComponentHost; import org.apache.commons.lang.StringUtils; /** * The {@link ZooKeeperQuorumCalculator} is a central location which can be used * to construct a comma-separated string of known ZooKeeper hosts. The returned * string constains FQDN of each known ZK host along with a port value for each. */ public class ZooKeeperQuorumCalculator { private static final String ZOO_CFG_CONFIG_TYPE = "zoo.cfg"; private static final String ZOOKEEPER_CLIENT_PORT_PROPERTY_NAME = "clientPort"; private static final String DEFAULT_ZK_CLIENT_PORT = "2181"; /** * Gets a comma-separate list of the ZK servers along with their ports. * * @param cluster * the cluster (not {@code null}). * @return the list of FQDN ZooKeeper hosts, or an empty string (never * {@code null}). */ static String getZooKeeperQuorumString(Cluster cluster) { // attempt to calculate the port String zkClientPort = DEFAULT_ZK_CLIENT_PORT; Config zooConfig = cluster.getDesiredConfigByType(ZOO_CFG_CONFIG_TYPE); if (zooConfig != null) { Map<String, String> zooProperties = zooConfig.getProperties(); if (zooProperties.containsKey(ZOOKEEPER_CLIENT_PORT_PROPERTY_NAME)) { zkClientPort = zooProperties.get(ZOOKEEPER_CLIENT_PORT_PROPERTY_NAME); } } // get all known ZK hosts List<ServiceComponentHost> zkServers = cluster.getServiceComponentHosts( Service.Type.ZOOKEEPER.name(), Role.ZOOKEEPER_SERVER.name()); List<String> zkAddresses = new ArrayList<>(); for (ServiceComponentHost zkServer : zkServers) { String zkAddress = zkServer.getHostName() + ":" + zkClientPort; zkAddresses.add(zkAddress); } // join on comma without any spaces String zkServersStr = StringUtils.join(zkAddresses, ","); return zkServersStr; } }
[ "jhurley@hortonworks.com" ]
jhurley@hortonworks.com
ef66617b578205b8c45e6f19f988a8425bffa0b1
c28c746d3202f63e2c11b0994f8b4d6308e96286
/src/main/java/com/project/rest/webservices/restfulwebservices/filtering/FilteringController.java
9d40b25da6ab8bbee6f8b0bd7dce87f6c2e56578
[]
no_license
p988998/restful-web-services
42f44d4526c6cb89544219c7ddc5ed6206764e08
fdc5a59af1586cbbcf1251a60a7cee8b122fda99
refs/heads/master
2020-04-10T16:02:35.156881
2018-12-13T23:33:59
2018-12-13T23:33:59
161,131,019
0
0
null
null
null
null
UTF-8
Java
false
false
1,699
java
package com.project.rest.webservices.restfulwebservices.filtering; import com.fasterxml.jackson.databind.ser.FilterProvider; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import org.springframework.http.converter.json.MappingJacksonValue; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Arrays; import java.util.List; @RestController public class FilteringController { // field1,field2 @GetMapping("/filtering") public MappingJacksonValue retrieveSomeBean() { SomeBean someBean = new SomeBean("value1", "value2", "value3"); SimpleBeanPropertyFilter filter = SimpleBeanPropertyFilter.filterOutAllExcept("field1", "field2"); FilterProvider filters = new SimpleFilterProvider().addFilter("SomeBeanFilter", filter); MappingJacksonValue mapping = new MappingJacksonValue(someBean); mapping.setFilters(filters); return mapping; } // field2, field3 @GetMapping("/filtering-list") public MappingJacksonValue retrieveListOfSomeBeans() { List<SomeBean> list = Arrays.asList(new SomeBean("value1", "value2", "value3"), new SomeBean("value12", "value22", "value32")); SimpleBeanPropertyFilter filter = SimpleBeanPropertyFilter.filterOutAllExcept("field2", "field3"); FilterProvider filters = new SimpleFilterProvider().addFilter("SomeBeanFilter", filter); MappingJacksonValue mapping = new MappingJacksonValue(list); mapping.setFilters(filters); return mapping; } }
[ "pannijin@gmail.com" ]
pannijin@gmail.com
f7103d5e3dfb38f2041d149140ae4ae73e111178
0b3e8eacf7835dfe6d10b48219718e076b1113e8
/org/javaturk/oop/ch09/shadowing/StaticOverridingExample.java
e5c79c43039b12809d43bd68d4823160b45d2b4f
[]
no_license
ErtanSidar/OOP-with-Java
7b5099a16f245dc0ee33c3a8eb05d25f9b6422de
ae3c9a7f58b2b248b0b9ae6d0ad9faf2d358f822
refs/heads/master
2023-03-15T07:51:29.218188
2014-12-19T00:40:09
2014-12-19T00:40:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
199
java
package org.javaturk.oop.ch09.shadowing; public class StaticOverridingExample { public static void main(String[] args) { Parent.g(); Child.g(); // Parent p = new Child(); // p.g(); } }
[ "akin@javaturk.org" ]
akin@javaturk.org
4f92bb0e733d44ce1052f7526cbd38657eaba9f8
2e71db4c1059741d916179b18747e130f519f1b5
/Mobile/HKMobile/src/com/esprit/pidevMobile/services/AnimalService.java
d4a018adab8c0a6b1973aac0b796a93147eea63f
[]
no_license
achrefzeddini/PIDEV-mobile-Codenameone
0e49cfc3f9730ddaf60559af2cab8443f0ab23fe
58a905a81bf096baf4e2f9e3f21d2eaa72a21990
refs/heads/main
2023-06-23T15:18:30.860531
2021-07-25T12:39:36
2021-07-25T12:39:36
389,343,178
0
0
null
null
null
null
UTF-8
Java
false
false
4,694
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.esprit.pidevMobile.services; /** * * @author hp */ import com.codename1.io.CharArrayReader; import com.codename1.io.ConnectionRequest; import com.codename1.io.JSONParser; import com.codename1.io.NetworkEvent; import com.codename1.io.NetworkManager; import com.codename1.ui.events.ActionListener; import com.esprit.pidevMobile.models.Animal; import com.esprit.pidevMobile.utils.DataSource; import com.esprit.pidevMobile.utils.Statics; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; public class AnimalService { private ConnectionRequest request; private boolean responseResult; public ArrayList<Animal> animals; public AnimalService() { request = DataSource.getInstance().getRequest(); } public boolean addAnimal(Animal animals) { String url = Statics.BASE_URL + "/newanimalapi?idA=" + animals.getIdA() + "&race=" + animals.getRace() + "&saison=" + animals.getSaison() + "&place=" + animals.getPlace() + "&image=" + animals.getImage() + "&hunted=" + animals.getHunted(); request.setUrl(url); request.addResponseListener(new ActionListener<NetworkEvent>() { @Override public void actionPerformed(NetworkEvent evt) { responseResult = request.getResponseCode() == 200; // Code HTTP 200 OK request.removeResponseListener(this); } }); NetworkManager.getInstance().addToQueueAndWait(request); return responseResult; } public ArrayList<Animal> getAllAnimals() { String url = Statics.BASE_URL + "/animals/all"; request.setUrl(url); request.setPost(false); request.addResponseListener(new ActionListener<NetworkEvent>() { @Override public void actionPerformed(NetworkEvent evt) { animals = parseAnimals(new String(request.getResponseData())); request.removeResponseListener(this); } }); NetworkManager.getInstance().addToQueueAndWait(request); return animals; } public ArrayList<Animal> parseAnimals(String jsonText) { try { animals = new ArrayList<>(); JSONParser jp = new JSONParser(); Map<String, Object> animalsListJson = jp.parseJSON(new CharArrayReader(jsonText.toCharArray())); List<Map<String, Object>> list = (List<Map<String, Object>>) animalsListJson.get("root"); for (Map<String, Object> obj : list) { int id = (int)Float.parseFloat(obj.get("id").toString()); int idA = (int)Float.parseFloat(obj.get("idA").toString()); String race = obj.get("race").toString(); String saison = obj.get("saison").toString(); String place = obj.get("place").toString(); String image = obj.get("image").toString(); int hunted = (int)Float.parseFloat(obj.get("hunted").toString()); // int season_id = (int)Float.parseFloat(obj.get("season_id").toString()); animals.add(new Animal(id, idA, race, saison, place, image, hunted)); } } catch (IOException ex) { } return animals; } public void supprimerAnimal(int id){ ConnectionRequest con = new ConnectionRequest(); String Url = "http://localhost/HuntKingdom/web/app_dev.php/deleteAnimal/"+id; con.setUrl(Url); System.out.println("tt"); System.out.println(Url); con.addResponseListener((e) -> { String str = new String(con.getResponseData()); System.out.println(str); }); System.out.println("bom bom bom"); con.setFailSilently(true); NetworkManager.getInstance().addToQueueAndWait(con); } public void updateAnimal(Animal animals){ ConnectionRequest con = new ConnectionRequest(); String Url = Statics.BASE_URL+"/updateanimalapi?idA=" + animals.getIdA() + "&race=" + animals.getRace() + "&saison=" + animals.getSaison() + "&place=" + animals.getPlace() + "&image=" + animals.getImage() + "&hunted=" + animals.getHunted(); con.setUrl(Url); System.out.println("tt"); con.addResponseListener((e) -> { String str = new String(con.getResponseData()); }); NetworkManager.getInstance().addToQueueAndWait(con); } }
[ "60570373+achrefzeddini@users.noreply.github.com" ]
60570373+achrefzeddini@users.noreply.github.com
2369fd81a5a10170df7baddff212561a6db91c26
6c6986806b750814710fcf678dd24a4979d9c7a0
/App/Represent/mobile/src/main/java/com/example/parulsingh/represent/BoxerActivity.java
6eb95187cb2754611188a6c222a6e60fbae8d7bd
[]
no_license
cs160-berkeley/prog-02-represent-parulsingh
b97f2799f3f4d443224546200297c21b07fb5875
1cde3c2ac74408bf3133511356dbdb3c64604c3d
refs/heads/master
2021-01-15T13:06:42.906115
2016-03-12T04:33:40
2016-03-12T04:33:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.example.parulsingh.represent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; public class BoxerActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_boxer); } }
[ "parulsingh@berkeley.edu" ]
parulsingh@berkeley.edu
e5623a6be12993438f40a152684790dfab227950
4f12e10de4d403257d91e63a8536ea1b232c536c
/app/src/main/java/com/ayuget/redface/ui/template/PostsTemplate.java
913ec76151a8e2b0c73012705a97e126ff59acfe
[ "Apache-2.0" ]
permissive
SoftRiot/Redface
b7fd9c407ed5b478d02a4abb4cf7087cd3717984
fbc992b80c53ee0cde3ae5c412fc001820e72c32
refs/heads/master
2020-02-26T17:04:09.254229
2016-01-02T11:01:41
2016-01-02T11:01:41
46,227,879
0
0
null
2015-11-15T17:26:59
2015-11-15T17:26:59
null
UTF-8
Java
false
false
2,157
java
/* * Copyright 2015 Ayuget * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ayuget.redface.ui.template; import android.content.Context; import com.ayuget.redface.data.api.model.Post; import com.ayuget.redface.ui.misc.ThemeManager; import com.squareup.phrase.Phrase; import java.util.List; public class PostsTemplate extends HTMLTemplate<List<Post>> { private static final String LOG_TAG = PostsTemplate.class.getSimpleName(); private static final String POSTS_TEMPLATE = "posts.html"; private PostTemplate postTemplate; private ThemeManager themeManager; public PostsTemplate(Context context, PostTemplate postTemplate, ThemeManager themeManager) { super(context, POSTS_TEMPLATE); this.postTemplate = postTemplate; this.themeManager = themeManager; } @Override public Phrase compile(String templateContent) { return Phrase.from(templateContent) .put("css", readAssetFile("styles.css")) .put("js", readAssetFile("hfr.js")); } @Override protected void render(List<Post> content, Phrase templateContent, StringBuilder stream) { StringBuilder postsBuffer = new StringBuilder(); for(Post post : content) { postTemplate.render(post, postsBuffer); } stream.append( templateContent .put("posts", postsBuffer.toString()) .put("theme_class", themeManager.getActiveThemeCssClass() + " " + themeManager.getFontSizeCssClass()) .format() .toString() ); } }
[ "ayuget@gmail.com" ]
ayuget@gmail.com
1f53b2ac6fc0e3e8b569f65f36b95e768f8efa07
f321db1ace514d08219cc9ba5089ebcfff13c87a
/generated-tests/adynamosa/tests/s1007/22_firebird/evosuite-tests/org/firebirdsql/jdbc/FBProcedureCall_ESTest.java
1f853d10f5671b32dd8660bc377b5244d1ef8d68
[]
no_license
sealuzh/dynamic-performance-replication
01bd512bde9d591ea9afa326968b35123aec6d78
f89b4dd1143de282cd590311f0315f59c9c7143a
refs/heads/master
2021-07-12T06:09:46.990436
2020-06-05T09:44:56
2020-06-05T09:44:56
146,285,168
2
2
null
null
null
null
UTF-8
Java
false
false
26,803
java
/* * This file was automatically generated by EvoSuite * Mon Jul 22 08:53:09 GMT 2019 */ package org.firebirdsql.jdbc; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.util.List; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.firebirdsql.jdbc.FBProcedureCall; import org.firebirdsql.jdbc.FBProcedureParam; import org.firebirdsql.jdbc.FBSQLException; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class FBProcedureCall_ESTest extends FBProcedureCall_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.getInputParam(2); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(1, "pWd/hnV5?C.dy"); assertEquals(1, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test01() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(2, fBProcedureParam0.getPosition()); int int0 = fBProcedureCall0.mapOutParamIndexToPosition((-23), true); assertEquals((-23), int0); } @Test(timeout = 4000) public void test02() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(1929, " not set and "); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals("not set and", fBProcedureParam0.getParamValue()); List<FBProcedureParam> list0 = fBProcedureCall0.getOutputParams(); assertEquals(1930, list0.size()); } @Test(timeout = 4000) public void test03() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.setName("y]U|Fb2hmJ(3h3"); String string0 = fBProcedureCall0.getName(); assertEquals("y]U|Fb2hmJ(3h3", string0); } @Test(timeout = 4000) public void test04() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); List<FBProcedureParam> list0 = fBProcedureCall0.getInputParams(); assertEquals(3, list0.size()); } @Test(timeout = 4000) public void test05() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureParam0.setValue("pWd/hnV5?C.dy"); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.getInputParam((-1)); assertEquals(2, fBProcedureParam1.getPosition()); } @Test(timeout = 4000) public void test06() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.getOutputParam(876); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.getInputParam(41); fBProcedureCall0.addOutputParam(fBProcedureParam0); fBProcedureCall0.addOutputParam(fBProcedureParam0); fBProcedureCall0.getName(); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.addParam(3, "0IKiQHo2"); fBProcedureCall0.getInputParam(3); FBProcedureParam fBProcedureParam2 = (FBProcedureParam)fBProcedureParam1.clone(); fBProcedureParam1.setIndex(3023); fBProcedureCall0.addInputParam(fBProcedureParam1); fBProcedureCall0.addInputParam(fBProcedureParam1); fBProcedureCall0.addOutputParam(fBProcedureParam0); fBProcedureCall0.addOutputParam(fBProcedureParam1); fBProcedureCall0.registerOutParam(3023, 3); FBProcedureCall fBProcedureCall1 = new FBProcedureCall(); fBProcedureParam2.setIndex(876); FBProcedureParam fBProcedureParam3 = fBProcedureCall0.getInputParam(3023); fBProcedureCall0.addInputParam(fBProcedureParam3); fBProcedureCall0.getSQL(false); String string0 = fBProcedureCall1.getName(); assertNull(string0); } @Test(timeout = 4000) public void test07() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(0, "08S01"); fBProcedureParam0.setType((-1)); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.getInputParam((-1)); assertEquals(0, fBProcedureParam1.getPosition()); } @Test(timeout = 4000) public void test08() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.setName((String) null); assertNull(fBProcedureCall0.getName()); } @Test(timeout = 4000) public void test09() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.setName(""); String string0 = fBProcedureCall0.getName(); assertEquals("", string0); } @Test(timeout = 4000) public void test10() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.registerOutParam((-218), 0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -219 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test11() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); int int0 = fBProcedureCall0.mapOutParamIndexToPosition(0, true); assertEquals(0, int0); } @Test(timeout = 4000) public void test12() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); int int0 = fBProcedureCall0.mapOutParamIndexToPosition(0); assertEquals(0, int0); } @Test(timeout = 4000) public void test13() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); int int0 = fBProcedureCall0.mapOutParamIndexToPosition((-1885)); assertEquals((-1885), int0); } @Test(timeout = 4000) public void test14() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.getOutputParam(0); assertEquals((-1), fBProcedureParam0.getIndex()); } @Test(timeout = 4000) public void test15() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.getInputParam((-1)); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -2 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test16() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); Object object0 = new Object(); boolean boolean0 = fBProcedureCall0.equals(object0); assertFalse(boolean0); } @Test(timeout = 4000) public void test17() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(7, ""); assertEquals(7, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test18() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureParam0.setValue((Object) null); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(2, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test19() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = new FBProcedureParam(); fBProcedureParam0.setType(63); fBProcedureCall0.addOutputParam(fBProcedureParam0); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.getOutputParam((-1)); assertEquals(63, fBProcedureParam1.getType()); } @Test(timeout = 4000) public void test20() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(0, "08S01"); fBProcedureParam0.setType((-1)); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(0, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test21() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = new FBProcedureParam(); fBProcedureCall0.addOutputParam(fBProcedureParam0); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.getOutputParam((-1)); assertEquals(0, fBProcedureParam1.getType()); } @Test(timeout = 4000) public void test22() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(407, "jnCC4:dk4lWR0\"jr"); fBProcedureParam0.setIndex(0); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(407, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test23() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureParam0.setValue("pWd/hnV5?C.dy"); fBProcedureCall0.addInputParam(fBProcedureParam0); assertEquals(2, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test24() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(0, "08S01"); fBProcedureParam0.setType((-1)); fBProcedureCall0.addInputParam(fBProcedureParam0); assertEquals(0, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test25() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = new FBProcedureParam(); fBProcedureCall0.addInputParam(fBProcedureParam0); assertEquals(0, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test26() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(407, "jnCC4:dk4lWR0\"jr"); fBProcedureParam0.setIndex(0); fBProcedureCall0.addInputParam(fBProcedureParam0); assertEquals(407, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test27() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.getOutputParam(1794); fBProcedureCall0.addInputParam(fBProcedureParam0); assertEquals((-1), fBProcedureParam0.getIndex()); } @Test(timeout = 4000) public void test28() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.getOutputParam(876); fBProcedureCall0.addOutputParam(fBProcedureParam0); fBProcedureCall0.addParam(259, "pWd/hnV5?C.dy"); // Undeclared exception! try { fBProcedureCall0.getSQL(true); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // Array index out of range: 259 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test29() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.getInputParam(0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -1 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test30() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.addParam(0, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.firebirdsql.jdbc.FBProcedureCall", e); } } @Test(timeout = 4000) public void test31() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.addParam((-23), ":?Rq2xMf@%"); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -23 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test32() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.addOutputParam((FBProcedureParam) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.firebirdsql.jdbc.FBProcedureCall", e); } } @Test(timeout = 4000) public void test33() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = new FBProcedureParam((-361), "]k"); // Undeclared exception! try { fBProcedureCall0.addOutputParam(fBProcedureParam0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -361 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test34() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.addInputParam((FBProcedureParam) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.firebirdsql.jdbc.FBProcedureCall", e); } } @Test(timeout = 4000) public void test35() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = new FBProcedureParam((-1678), "*uuF_"); // Undeclared exception! try { fBProcedureCall0.addInputParam(fBProcedureParam0); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -1678 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test36() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.setName("08S01"); fBProcedureCall0.hashCode(); } @Test(timeout = 4000) public void test37() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.hashCode(); } @Test(timeout = 4000) public void test38() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureCall fBProcedureCall1 = new FBProcedureCall(); fBProcedureCall0.setName(". "); boolean boolean0 = fBProcedureCall1.equals(fBProcedureCall0); assertFalse(fBProcedureCall1.equals((Object)fBProcedureCall0)); assertFalse(boolean0); } @Test(timeout = 4000) public void test39() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureCall fBProcedureCall1 = new FBProcedureCall(); fBProcedureCall0.setName("it was not rwi terd as output paameter"); boolean boolean0 = fBProcedureCall0.equals(fBProcedureCall1); // // Unstable assertion: assertFalse(fBProcedureCall1.equals((Object)fBProcedureCall0)); // // Unstable assertion: assertTrue(boolean0); } @Test(timeout = 4000) public void test40() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); boolean boolean0 = fBProcedureCall0.equals((Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test41() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); boolean boolean0 = fBProcedureCall0.equals(fBProcedureCall0); assertTrue(boolean0); } @Test(timeout = 4000) public void test42() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); fBProcedureCall0.getInputParam(2409); FBProcedureCall fBProcedureCall1 = new FBProcedureCall(); boolean boolean0 = fBProcedureCall0.equals(fBProcedureCall1); assertFalse(boolean0); } @Test(timeout = 4000) public void test43() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureCall0.addOutputParam(fBProcedureParam0); fBProcedureCall0.addParam(1, ":?Rq2xMf@%"); try { fBProcedureCall0.getSQL(true); fail("Expecting exception: FBSQLException"); } catch(FBSQLException e) { // // Value of parameter -1 not set and it was not registered as output parameter. // verifyException("org.firebirdsql.jdbc.FBProcedureCall", e); } } @Test(timeout = 4000) public void test44() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(2, fBProcedureParam0.getPosition()); String string0 = fBProcedureCall0.getSQL(true); assertEquals("SELECT * FROM null(pWd/hnV5?C.dy)", string0); } @Test(timeout = 4000) public void test45() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); assertEquals(2, fBProcedureParam0.getPosition()); String string0 = fBProcedureCall0.getSQL(true); assertEquals("SELECT * FROM null(pWd/hnV5?C.dy)", string0); } @Test(timeout = 4000) public void test46() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.getOutputParam(876); Object object0 = fBProcedureParam0.clone(); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.addParam(259, "pWd/hnV5?C.dy"); fBProcedureParam1.setValue(object0); assertEquals(259, fBProcedureParam1.getPosition()); String string0 = fBProcedureCall0.getSQL(true); assertEquals("SELECT * FROM null(pWd/hnV5?C.dy)", string0); } @Test(timeout = 4000) public void test47() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); String string0 = fBProcedureCall0.getSQL(true); assertEquals("SELECT * FROM null", string0); } @Test(timeout = 4000) public void test48() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureParam0.setIndex(2); Object object0 = new Object(); fBProcedureParam0.setValue(object0); fBProcedureCall0.registerOutParam(2, 2); assertNull(fBProcedureCall0.getName()); } @Test(timeout = 4000) public void test49() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "IntX6#}WxE/+}OqQq&"); assertEquals(2, fBProcedureParam0.getPosition()); assertEquals("IntX6#}WxE/+}OqQq&", fBProcedureParam0.getParamValue()); } @Test(timeout = 4000) public void test50() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(31, "o5"); fBProcedureParam0.setIndex(0); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.getInputParam(0); assertEquals(31, fBProcedureParam1.getPosition()); } @Test(timeout = 4000) public void test51() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(3291, "cb["); assertEquals(3291, fBProcedureParam0.getPosition()); } @Test(timeout = 4000) public void test52() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); try { fBProcedureCall0.mapOutParamIndexToPosition((-2962), false); fail("Expecting exception: FBSQLException"); } catch(FBSQLException e) { // // Specified parameter does not exist. // verifyException("org.firebirdsql.jdbc.FBProcedureCall", e); } } @Test(timeout = 4000) public void test53() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureParam0.setIndex(2); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(2, fBProcedureParam0.getPosition()); int int0 = fBProcedureCall0.mapOutParamIndexToPosition(2, false); assertEquals(1, int0); } @Test(timeout = 4000) public void test54() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(2, "pWd/hnV5?C.dy"); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(2, fBProcedureParam0.getPosition()); int int0 = fBProcedureCall0.mapOutParamIndexToPosition(5, true); assertEquals(5, int0); } @Test(timeout = 4000) public void test55() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(1929, " not set and "); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals("not set and", fBProcedureParam0.getParamValue()); assertEquals(1929, fBProcedureParam0.getPosition()); int int0 = fBProcedureCall0.mapOutParamIndexToPosition(1929, true); assertEquals(1929, int0); } @Test(timeout = 4000) public void test56() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(1929, " not set and "); fBProcedureCall0.addOutputParam(fBProcedureParam0); fBProcedureParam0.setIndex(1929); FBProcedureParam fBProcedureParam1 = fBProcedureCall0.getOutputParam(1929); assertEquals(1929, fBProcedureParam1.getPosition()); assertEquals("not set and", fBProcedureParam1.getParamValue()); } @Test(timeout = 4000) public void test57() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); // Undeclared exception! try { fBProcedureCall0.registerOutParam(0, 4); fail("Expecting exception: ArrayIndexOutOfBoundsException"); } catch(ArrayIndexOutOfBoundsException e) { // // -1 // verifyException("java.util.Vector", e); } } @Test(timeout = 4000) public void test58() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.addParam(1929, " not set and "); fBProcedureCall0.addOutputParam(fBProcedureParam0); assertEquals(1929, fBProcedureParam0.getPosition()); assertEquals("not set and", fBProcedureParam0.getParamValue()); Object object0 = fBProcedureCall0.clone(); assertNotSame(object0, fBProcedureCall0); assertTrue(object0.equals((Object)fBProcedureCall0)); } @Test(timeout = 4000) public void test59() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); FBProcedureParam fBProcedureParam0 = fBProcedureCall0.getOutputParam((-416)); try { fBProcedureParam0.setValue("@u'/KGb*;`WV]^|Ow3"); fail("Expecting exception: FBSQLException"); } catch(FBSQLException e) { // // You cannot set value of an non-existing parameter. // verifyException("org.firebirdsql.jdbc.FBProcedureCall$NullParam", e); } } @Test(timeout = 4000) public void test60() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); int int0 = fBProcedureCall0.mapOutParamIndexToPosition(407); assertEquals(407, int0); } @Test(timeout = 4000) public void test61() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); List<FBProcedureParam> list0 = fBProcedureCall0.getInputParams(); assertTrue(list0.isEmpty()); } @Test(timeout = 4000) public void test62() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); try { fBProcedureCall0.registerOutParam(13, (-2844)); fail("Expecting exception: FBSQLException"); } catch(FBSQLException e) { // // Cannot find parameter with the specified position. // verifyException("org.firebirdsql.jdbc.FBProcedureCall", e); } } @Test(timeout = 4000) public void test63() throws Throwable { FBProcedureCall fBProcedureCall0 = new FBProcedureCall(); List<FBProcedureParam> list0 = fBProcedureCall0.getOutputParams(); assertEquals(0, list0.size()); } }
[ "granogiovanni90@gmail.com" ]
granogiovanni90@gmail.com
27224f89246a4fae91b599f88080831969daa19f
48246a0bf2b17e5c318e9b4e04c39603a667a5e0
/FreeThePixel/src/com/community/xanadu/components/windows/dropShadow/FrameWithDropShadow.java
726157dd97f28f70fe5b0c87f1ae70a29abf71a4
[]
no_license
tonykwok/free-the-pixel
5a7621cd9bb872d5e1fa07b26fcc7706ca956082
538b2487a068be2867eff9b6f0e3876443b5ecd6
refs/heads/master
2021-01-15T09:32:17.418688
2017-01-13T03:44:49
2017-01-13T03:44:49
78,811,841
0
0
null
null
null
null
UTF-8
Java
false
false
12,974
java
package com.community.xanadu.components.windows.dropShadow; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Paint; import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.LineBorder; import net.miginfocom.swing.MigLayout; import org.pushingpixels.substance.api.DecorationAreaType; import org.pushingpixels.substance.api.SubstanceColorScheme; import org.pushingpixels.substance.api.SubstanceLookAndFeel; import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities; import org.pushingpixels.substance.internal.utils.SubstanceTitleButton; import org.pushingpixels.substance.internal.utils.icon.SubstanceIconFactory; import org.pushingpixels.substance.internal.utils.icon.TransitionAwareIcon; import com.community.xanadu.components.windows.WindowFadeInManager; import com.community.xanadu.demo.components.FrameWithDropShadowDemo; import com.community.xanadu.listeners.Draggable; import com.community.xanadu.utils.PaintUtils; import com.community.xanadu.utils.WindowsUtils; @SuppressWarnings("serial") public class FrameWithDropShadow extends JFrame { public static void main(final String[] args) { FrameWithDropShadowDemo.main(args); } private JComponent titleLabel; private JButton buttonClose; private JButton buttonMini; private JButton buttonMax; private JButton buttonRestore; private JPanel panelButton; private DropShadowContentPane contentPane; public FrameWithDropShadow() { this(true, true); } public FrameWithDropShadow(final boolean draggable, final boolean withCloseButton) { super(); initGUI(); if (draggable) { Draggable.makeDraggable(this); Draggable.makeDraggable(getTitleLabel(), this); Draggable.makeDraggable(getContentPane(), this); } addPropertyChangeListener("title", new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { titleBarStateChanged(); } }); } @Override public void setResizable(final boolean resizable) { super.setResizable(resizable); ((DropShadowContentPane) getContentPane()).setResizable(resizable); getButtonMax().setVisible(resizable); getButtonRestore().setVisible(resizable); setPanelButtonBounds(); } private void initGUI() { setUndecorated(true); WindowsUtils.setOpaque(this, false); setContentPane(getContentPane()); setSize(800, 500); getLayeredPane().add(getPanelButton()); getLayeredPane().add(getTitleLabel()); titleBarStateChanged(); } public JComponent getTitleLabel() { if (this.titleLabel == null) { if (SubstanceLookAndFeel.isCurrentLookAndFeel()) { this.titleLabel = new TitleLabel(this); } else { this.titleLabel = new JLabel(getTitle()); } this.titleLabel.setBounds(8, 7, getWidth() - 35, 25); } return this.titleLabel; } private void titleBarStateChanged() { if (this.titleLabel instanceof JLabel) { ((JLabel) this.titleLabel).setText(getTitle()); } this.titleLabel.repaint(); } @Override public Container getContentPane() { if (this.contentPane == null) { this.contentPane = new DropShadowContentPane(); this.contentPane.setOpaque(false); this.contentPane.setBorder(new LineBorder(new Color(0, 0, 0, 0), 25) { @Override public Insets getBorderInsets(final Component c) { return new Insets(this.thickness, 5, 5, 5); } }); this.contentPane.addComponentListener(new ComponentAdapter() { @Override public void componentResized(final ComponentEvent e) { setPanelButtonBounds(); } }); } return this.contentPane; } private void setPanelButtonBounds() { if (isResizable()) { getPanelButton().setBounds(getWidth() - 75, 5, 65, 20); } else { getPanelButton().setBounds(getWidth() - 55, 5, 45, 20); } } public void startShowAnim() { WindowFadeInManager.fadeIn(this); } public void startShowAnim(final int duration) { WindowFadeInManager.fadeIn(this, duration); } public void startHideAnim() { WindowFadeInManager.fadeOut(this); } public void startHideAnim(final int duration) { WindowFadeInManager.fadeOut(this, duration); } public void setContentPaneBackground(final Paint contentPaneBackground) { this.contentPane.setPaintBackground(contentPaneBackground); } private JButton getButtonClose() { if (this.buttonClose == null) { this.buttonClose = createTitleButton(); this.buttonClose.setIcon(getIconClose()); this.buttonClose.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { buttonCloseActionPerformed(); } }); } return this.buttonClose; } private JButton getButtonMini() { if (this.buttonMini == null) { this.buttonMini = createTitleButton(); this.buttonMini.setIcon(getIconMini()); this.buttonMini.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { buttonMiniActionPerformed(); } }); } return this.buttonMini; } private JButton getButtonMax() { if (this.buttonMax == null) { this.buttonMax = createTitleButton(); this.buttonMax.setIcon(getIconMax()); this.buttonMax.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { buttonMaxActionPerformed(); } }); } return this.buttonMax; } private JButton getButtonRestore() { if (this.buttonRestore == null) { this.buttonRestore = createTitleButton(); this.buttonRestore.setIcon(getIconRestore()); this.buttonRestore.setVisible(false); this.buttonRestore.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { buttonRestoreActionPerformed(); } }); } return this.buttonRestore; } private JButton createTitleButton() { JButton res; if (SubstanceLookAndFeel.isCurrentLookAndFeel()) { res = new SubstanceTitleButton(); res.putClientProperty(SubstanceLookAndFeel.FLAT_PROPERTY, Boolean.TRUE); SubstanceLookAndFeel.setDecorationType(res, DecorationAreaType.GENERAL); } else { res = new JButton(); res.setContentAreaFilled(false); } res.setFocusPainted(false); res.setFocusable(false); res.setOpaque(true); res.setText(null); res.setBorder(null); return res; } private Icon getIconMini() { if (SubstanceLookAndFeel.isCurrentLookAndFeel()) { return new TransitionAwareIcon(this.buttonMini, new TransitionAwareIcon.Delegate() { public Icon getColorSchemeIcon(final SubstanceColorScheme scheme) { return SubstanceIconFactory.getTitlePaneIcon(SubstanceIconFactory.IconKind.MINIMIZE, scheme, SubstanceCoreUtilities.getSkin(FrameWithDropShadow.this.rootPane).getBackgroundColorScheme( DecorationAreaType.GENERAL)); } }, "substance.titlePane.miniIcon"); } else { return new Icon() { @Override public void paintIcon(final Component c, final Graphics g, final int x, final int y) { g.setColor(Color.BLACK); g.fillRect(2, 15, 10, 2); } @Override public int getIconWidth() { return 20; } @Override public int getIconHeight() { return 20; } }; } } private Icon getIconMax() { if (SubstanceLookAndFeel.isCurrentLookAndFeel()) { return new TransitionAwareIcon(this.buttonMax, new TransitionAwareIcon.Delegate() { public Icon getColorSchemeIcon(final SubstanceColorScheme scheme) { return SubstanceIconFactory.getTitlePaneIcon(SubstanceIconFactory.IconKind.MAXIMIZE, scheme, SubstanceCoreUtilities.getSkin(FrameWithDropShadow.this.rootPane).getBackgroundColorScheme( DecorationAreaType.GENERAL)); } }, "substance.titlePane.MaxIcon"); } return new Icon() { @Override public void paintIcon(final Component c, final Graphics g, final int x, final int y) { final Graphics2D g2 = (Graphics2D) g; PaintUtils.turnOnAntialias(g2); final int size = 20; final int start = (size / 4) - 1; final int end = size - start - 1; g2.setColor(Color.BLACK); g2.drawRect(start, start, end - start, end - start); g2.drawLine(start, start + 1, end, start + 1); } @Override public int getIconWidth() { return 20; } @Override public int getIconHeight() { return 20; } }; } private Icon getIconRestore() { if (SubstanceLookAndFeel.isCurrentLookAndFeel()) { return new TransitionAwareIcon(this.buttonRestore, new TransitionAwareIcon.Delegate() { public Icon getColorSchemeIcon(final SubstanceColorScheme scheme) { return SubstanceIconFactory.getTitlePaneIcon(SubstanceIconFactory.IconKind.RESTORE, scheme, SubstanceCoreUtilities.getSkin(FrameWithDropShadow.this.rootPane).getBackgroundColorScheme( DecorationAreaType.GENERAL)); } }, "substance.titlePane.RestoreIcon"); } return new Icon() { @Override public void paintIcon(final Component c, final Graphics g, final int x, final int y) { final Graphics2D g2 = (Graphics2D) g; PaintUtils.turnOnAntialias(g2); final int isize = 20; final int start = (isize / 4) - 2; final int end = (3 * isize / 4) - 1; final int size = end - start - 3; g2.setColor(Color.BLACK); g2.drawRect(start, end - size + 1, size, size); g2.drawLine(start, end - size + 2, start + size, end - size + 2); g2.fillRect(end - size, start + 1, size + 1, 2); g2.drawLine(end, start + 1, end, start + size + 1); g2.drawLine(start + size + 2, start + size + 1, end, start + size + 1); } @Override public int getIconWidth() { return 20; } @Override public int getIconHeight() { return 20; } }; } private Icon getIconClose() { if (SubstanceLookAndFeel.isCurrentLookAndFeel()) { return new TransitionAwareIcon(this.buttonClose, new TransitionAwareIcon.Delegate() { public Icon getColorSchemeIcon(final SubstanceColorScheme scheme) { return SubstanceIconFactory.getTitlePaneIcon(SubstanceIconFactory.IconKind.CLOSE, scheme, SubstanceCoreUtilities.getSkin(FrameWithDropShadow.this.rootPane).getBackgroundColorScheme( DecorationAreaType.GENERAL)); } }, "substance.titlePane.closeIcon"); } return new Icon() { @Override public void paintIcon(final Component c, final Graphics g, final int x, final int y) { final Graphics2D g2 = (Graphics2D) g; PaintUtils.turnOnAntialias(g2); final int size = 20; final int start = (size / 4); final int end = (3 * size / 4); final Stroke stroke = new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); g2.setStroke(stroke); g2.setColor(Color.BLACK); g2.drawLine(start, start, end, end); g2.drawLine(start, end, end, start); } @Override public int getIconWidth() { return 20; } @Override public int getIconHeight() { return 20; } }; } private JPanel getPanelButton() { if (this.panelButton == null) { this.panelButton = new JPanel(); this.panelButton.setLayout(new MigLayout("inset 0 0 0 0,hidemode 3", "0[]0[]5[]0", "")); this.panelButton.add(getButtonMini(), "grow, h 20!, w 20!"); this.panelButton.add(getButtonMax(), "grow, h 20!, w 20!"); this.panelButton.add(getButtonRestore(), "grow, h 20!, w 20!"); this.panelButton.add(getButtonClose(), "grow, h 20!, w 20!"); } return this.panelButton; } protected void buttonCloseActionPerformed() { if (getDefaultCloseOperation() == JFrame.EXIT_ON_CLOSE) { System.exit(0); } else if (getDefaultCloseOperation() != JFrame.DO_NOTHING_ON_CLOSE) { startHideAnim(); } } private void buttonRestoreActionPerformed() { getButtonRestore().setVisible(false); getButtonMax().setVisible(true); setExtendedState(Frame.NORMAL); } private void buttonMiniActionPerformed() { setExtendedState(Frame.ICONIFIED); } private void buttonMaxActionPerformed() { getButtonRestore().setVisible(true); getButtonMax().setVisible(false); setExtendedState(Frame.MAXIMIZED_BOTH); } }
[ "mabs@b02fdaf0-aea2-c8bd-8f90-a7d40f0377e2" ]
mabs@b02fdaf0-aea2-c8bd-8f90-a7d40f0377e2
29ab2037d8651572dbf710dbac996b260646d52e
c042a19cb1be9f1f385e6200aa497a2e59a0b43b
/EasyReder/EasyReader Devfest19/EasyReader/EasyReader/obj/Debug/android/textrecognition/textrecognition/R.java
49a744362c357ec4972ce1215d94122b3cb66154
[]
no_license
Abousamah/Easy-Reader
b8ed51f2502696dd380fa1c1c46660b535957eae
4241be4d38f930ae58622c8badc9aea1edd94992
refs/heads/master
2020-08-12T16:27:24.074431
2019-10-12T12:53:43
2019-10-12T12:53:43
214,799,962
1
0
null
2019-10-13T10:24:34
2019-10-13T10:24:34
null
UTF-8
Java
false
false
15,111
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package textrecognition.textrecognition; public final class R { public static final class attr { /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>standard</code></td><td>0</td><td></td></tr> <tr><td><code>wide</code></td><td>1</td><td></td></tr> <tr><td><code>icon_only</code></td><td>2</td><td></td></tr> </table> */ public static final int buttonSize=0x7f010003; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int circleCrop=0x7f010002; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>dark</code></td><td>0</td><td></td></tr> <tr><td><code>light</code></td><td>1</td><td></td></tr> <tr><td><code>auto</code></td><td>2</td><td></td></tr> </table> */ public static final int colorScheme=0x7f010004; /** <p>Must be a floating point value, such as "<code>1.2</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int imageAspectRatio=0x7f010001; /** <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>none</code></td><td>0</td><td></td></tr> <tr><td><code>adjust_width</code></td><td>1</td><td></td></tr> <tr><td><code>adjust_height</code></td><td>2</td><td></td></tr> </table> */ public static final int imageAspectRatioAdjust=0x7f010000; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. */ public static final int scopeUris=0x7f010005; } public static final class color { public static final int common_google_signin_btn_text_dark=0x7f040008; public static final int common_google_signin_btn_text_dark_default=0x7f040000; public static final int common_google_signin_btn_text_dark_disabled=0x7f040001; public static final int common_google_signin_btn_text_dark_focused=0x7f040002; public static final int common_google_signin_btn_text_dark_pressed=0x7f040003; public static final int common_google_signin_btn_text_light=0x7f040009; public static final int common_google_signin_btn_text_light_default=0x7f040004; public static final int common_google_signin_btn_text_light_disabled=0x7f040005; public static final int common_google_signin_btn_text_light_focused=0x7f040006; public static final int common_google_signin_btn_text_light_pressed=0x7f040007; } public static final class drawable { public static final int ahsan=0x7f020000; public static final int common_full_open_on_phone=0x7f020001; public static final int common_google_signin_btn_icon_dark=0x7f020002; public static final int common_google_signin_btn_icon_dark_disabled=0x7f020003; public static final int common_google_signin_btn_icon_dark_focused=0x7f020004; public static final int common_google_signin_btn_icon_dark_normal=0x7f020005; public static final int common_google_signin_btn_icon_dark_pressed=0x7f020006; public static final int common_google_signin_btn_icon_light=0x7f020007; public static final int common_google_signin_btn_icon_light_disabled=0x7f020008; public static final int common_google_signin_btn_icon_light_focused=0x7f020009; public static final int common_google_signin_btn_icon_light_normal=0x7f02000a; public static final int common_google_signin_btn_icon_light_pressed=0x7f02000b; public static final int common_google_signin_btn_text_dark=0x7f02000c; public static final int common_google_signin_btn_text_dark_disabled=0x7f02000d; public static final int common_google_signin_btn_text_dark_focused=0x7f02000e; public static final int common_google_signin_btn_text_dark_normal=0x7f02000f; public static final int common_google_signin_btn_text_dark_pressed=0x7f020010; public static final int common_google_signin_btn_text_light=0x7f020011; public static final int common_google_signin_btn_text_light_disabled=0x7f020012; public static final int common_google_signin_btn_text_light_focused=0x7f020013; public static final int common_google_signin_btn_text_light_normal=0x7f020014; public static final int common_google_signin_btn_text_light_pressed=0x7f020015; } public static final class id { public static final int adjust_height=0x7f070000; public static final int adjust_width=0x7f070001; public static final int auto=0x7f070006; public static final int btnProcess=0x7f07000a; public static final int dark=0x7f070007; public static final int icon_only=0x7f070003; public static final int image_view=0x7f070009; public static final int light=0x7f070008; public static final int none=0x7f070002; public static final int standard=0x7f070004; public static final int txtView=0x7f07000b; public static final int wide=0x7f070005; } public static final class integer { public static final int google_play_services_version=0x7f060000; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int app_name=0x7f050011; public static final int common_google_play_services_enable_button=0x7f050000; public static final int common_google_play_services_enable_text=0x7f050001; public static final int common_google_play_services_enable_title=0x7f050002; public static final int common_google_play_services_install_button=0x7f050003; public static final int common_google_play_services_install_text=0x7f050004; public static final int common_google_play_services_install_title=0x7f050005; public static final int common_google_play_services_notification_ticker=0x7f050006; public static final int common_google_play_services_unknown_issue=0x7f050010; public static final int common_google_play_services_unsupported_text=0x7f050007; public static final int common_google_play_services_update_button=0x7f050008; public static final int common_google_play_services_update_text=0x7f050009; public static final int common_google_play_services_update_title=0x7f05000a; public static final int common_google_play_services_updating_text=0x7f05000b; public static final int common_google_play_services_wear_update_text=0x7f05000c; public static final int common_open_on_phone=0x7f05000d; public static final int common_signin_button_text=0x7f05000e; public static final int common_signin_button_text_long=0x7f05000f; } public static final class styleable { /** Attributes that can be used with a LoadingImageView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #LoadingImageView_circleCrop TextRecognition.TextRecognition:circleCrop}</code></td><td></td></tr> <tr><td><code>{@link #LoadingImageView_imageAspectRatio TextRecognition.TextRecognition:imageAspectRatio}</code></td><td></td></tr> <tr><td><code>{@link #LoadingImageView_imageAspectRatioAdjust TextRecognition.TextRecognition:imageAspectRatioAdjust}</code></td><td></td></tr> </table> @see #LoadingImageView_circleCrop @see #LoadingImageView_imageAspectRatio @see #LoadingImageView_imageAspectRatioAdjust */ public static final int[] LoadingImageView = { 0x7f010000, 0x7f010001, 0x7f010002 }; /** <p>This symbol is the offset where the {@link TextRecognition.TextRecognition.R.attr#circleCrop} attribute's value can be found in the {@link #LoadingImageView} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name TextRecognition.TextRecognition:circleCrop */ public static final int LoadingImageView_circleCrop = 2; /** <p>This symbol is the offset where the {@link TextRecognition.TextRecognition.R.attr#imageAspectRatio} attribute's value can be found in the {@link #LoadingImageView} array. <p>Must be a floating point value, such as "<code>1.2</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name TextRecognition.TextRecognition:imageAspectRatio */ public static final int LoadingImageView_imageAspectRatio = 1; /** <p>This symbol is the offset where the {@link TextRecognition.TextRecognition.R.attr#imageAspectRatioAdjust} attribute's value can be found in the {@link #LoadingImageView} array. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>none</code></td><td>0</td><td></td></tr> <tr><td><code>adjust_width</code></td><td>1</td><td></td></tr> <tr><td><code>adjust_height</code></td><td>2</td><td></td></tr> </table> @attr name TextRecognition.TextRecognition:imageAspectRatioAdjust */ public static final int LoadingImageView_imageAspectRatioAdjust = 0; /** Attributes that can be used with a SignInButton. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #SignInButton_buttonSize TextRecognition.TextRecognition:buttonSize}</code></td><td></td></tr> <tr><td><code>{@link #SignInButton_colorScheme TextRecognition.TextRecognition:colorScheme}</code></td><td></td></tr> <tr><td><code>{@link #SignInButton_scopeUris TextRecognition.TextRecognition:scopeUris}</code></td><td></td></tr> </table> @see #SignInButton_buttonSize @see #SignInButton_colorScheme @see #SignInButton_scopeUris */ public static final int[] SignInButton = { 0x7f010003, 0x7f010004, 0x7f010005 }; /** <p>This symbol is the offset where the {@link TextRecognition.TextRecognition.R.attr#buttonSize} attribute's value can be found in the {@link #SignInButton} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>standard</code></td><td>0</td><td></td></tr> <tr><td><code>wide</code></td><td>1</td><td></td></tr> <tr><td><code>icon_only</code></td><td>2</td><td></td></tr> </table> @attr name TextRecognition.TextRecognition:buttonSize */ public static final int SignInButton_buttonSize = 0; /** <p>This symbol is the offset where the {@link TextRecognition.TextRecognition.R.attr#colorScheme} attribute's value can be found in the {@link #SignInButton} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>dark</code></td><td>0</td><td></td></tr> <tr><td><code>light</code></td><td>1</td><td></td></tr> <tr><td><code>auto</code></td><td>2</td><td></td></tr> </table> @attr name TextRecognition.TextRecognition:colorScheme */ public static final int SignInButton_colorScheme = 1; /** <p>This symbol is the offset where the {@link TextRecognition.TextRecognition.R.attr#scopeUris} attribute's value can be found in the {@link #SignInButton} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. @attr name TextRecognition.TextRecognition:scopeUris */ public static final int SignInButton_scopeUris = 2; }; }
[ "n.add55@hotmail.com" ]
n.add55@hotmail.com
6dc93947b411cc1bab1dbdf9b443229282613404
dbb35d58c8114b2db6690d0b3ea65ccbaabf1635
/pkview/src/main/java/com/martin/customview/SeatTable.java
f2cba4cdaac104120c64ce462d9c782c15726198
[]
no_license
nanleiting/CustomView
10c7ddd80e68873618206566643c90c7eed76879
9ede261e3ceec9fd9c3ad50b5536879bf2ddf000
refs/heads/master
2020-06-02T09:45:27.828571
2019-06-26T06:37:58
2019-06-26T06:37:58
191,118,315
6
0
null
null
null
null
UTF-8
Java
false
false
37,494
java
package com.martin.customview; import android.animation.Animator; import android.animation.TypeEvaluator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Point; import android.graphics.RectF; import android.graphics.Typeface; import android.os.Handler; import android.text.TextPaint; import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; import android.view.animation.DecelerateInterpolator; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; /** * author:Martin Nan on 2019/6/14 * 选择座位View */ public class SeatTable extends View { private final boolean DBG = false; Paint paint = new Paint(); Paint overviewPaint=new Paint(); Paint lineNumberPaint; float lineNumberTxtHeight; /** * 设置行号 默认显示 1,2,3....数字 * @param lineNumbers */ public void setLineNumbers(ArrayList<String> lineNumbers) { this.lineNumbers = lineNumbers; invalidate(); } /** * 用来保存所有行号 */ ArrayList<String> lineNumbers = new ArrayList<>(); Paint.FontMetrics lineNumberPaintFontMetrics; Matrix matrix = new Matrix(); /** * 座位水平间距 */ int spacing; /** * 座位垂直间距 */ int verSpacing; /** * 行号宽度 */ int numberWidth; /** * 行数 */ int row; /** * 列数 */ int column; /** * 可选时座位的图片 */ Bitmap seatBitmap; /** * 选中时座位的图片 */ Bitmap checkedSeatBitmap; /** * 座位已经售出时的图片 */ Bitmap seatSoldBitmap; Bitmap overviewBitmap; int lastX; int lastY; /** * 整个座位图的宽度 */ int seatBitmapWidth; /** * 整个座位图的高度 */ int seatBitmapHeight; /** * 标识是否需要绘制座位图 */ boolean isNeedDrawSeatBitmap = true; /** * 概览图白色方块高度 */ float rectHeight; /** * 概览图白色方块的宽度 */ float rectWidth; /** * 概览图上方块的水平间距 */ float overviewSpacing; /** * 概览图上方块的垂直间距 */ float overviewVerSpacing; /** * 概览图的比例 */ float overviewScale = 4.8f; /** * 荧幕高度 */ float screenHeight; /** * 荧幕默认宽度与座位图的比例 */ float screenWidthScale = 0.5f; /** * 荧幕最小宽度 */ int defaultScreenWidth; /** * 标识是否正在缩放 */ boolean isScaling; float scaleX, scaleY; /** * 是否是第一次缩放 */ boolean firstScale = true; /** * 最多可以选择的座位数量 */ int maxSelected = Integer.MAX_VALUE; private SeatChecker seatChecker; /** * 荧幕名称 */ private String screenName = ""; /** * 整个概览图的宽度 */ float rectW; /** * 整个概览图的高度 */ float rectH; Paint headPaint; Bitmap headBitmap; /** * 是否第一次执行onDraw */ boolean isFirstDraw = true; /** * 标识是否需要绘制概览图 */ boolean isDrawOverview = false; /** * 标识是否需要更新概览图 */ boolean isDrawOverviewBitmap = true; int overview_checked; int overview_sold; int txt_color; int seatCheckedResID; int seatSoldResID; int seatAvailableResID; boolean isOnClick; /** * 座位已售 */ private static final int SEAT_TYPE_SOLD = 1; /** * 座位已经选中 */ private static final int SEAT_TYPE_SELECTED = 2; /** * 座位可选 */ private static final int SEAT_TYPE_AVAILABLE = 3; /** * 座位不可用 */ private static final int SEAT_TYPE_NOT_AVAILABLE = 4; private int downX, downY; private boolean pointer; /** * 顶部高度,可选,已选,已售区域的高度 */ float headHeight; Paint pathPaint; RectF rectF; /** * 头部下面横线的高度 */ int borderHeight = 1; Paint redBorderPaint; /** * 默认的座位图宽度,如果使用的自己的座位图片比这个尺寸大或者小,会缩放到这个大小 */ private float defaultImgW = 40; /** * 默认的座位图高度 */ private float defaultImgH = 34; /** * 座位图片的宽度 */ private int seatWidth; /** * 座位图片的高度 */ private int seatHeight; public SeatTable(Context context) { super(context); } public SeatTable(Context context, AttributeSet attrs) { super(context, attrs); init(context,attrs); } private void init(Context context,AttributeSet attrs){ TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SeatTableView); overview_checked = typedArray.getColor(R.styleable.SeatTableView_overview_checked, Color.parseColor("#5A9E64")); overview_sold = typedArray.getColor(R.styleable.SeatTableView_overview_sold, Color.RED); txt_color=typedArray.getColor(R.styleable.SeatTableView_txt_color,Color.WHITE); seatCheckedResID = typedArray.getResourceId(R.styleable.SeatTableView_seat_checked, R.drawable.seat_green); seatSoldResID = typedArray.getResourceId(R.styleable.SeatTableView_overview_sold, R.drawable.seat_sold); seatAvailableResID = typedArray.getResourceId(R.styleable.SeatTableView_seat_available, R.drawable.seat_gray); typedArray.recycle(); } public SeatTable(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context,attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } float xScale1 = 1; float yScale1 = 1; private void init() { spacing = (int) dip2Px(5); verSpacing = (int) dip2Px(10); defaultScreenWidth = (int) dip2Px(80); seatBitmap = BitmapFactory.decodeResource(getResources(), seatAvailableResID); float scaleX = defaultImgW / seatBitmap.getWidth(); float scaleY = defaultImgH / seatBitmap.getHeight(); xScale1 = scaleX; yScale1 = scaleY; seatHeight= (int) (seatBitmap.getHeight()*yScale1); seatWidth= (int) (seatBitmap.getWidth()*xScale1); checkedSeatBitmap = BitmapFactory.decodeResource(getResources(), seatCheckedResID); seatSoldBitmap = BitmapFactory.decodeResource(getResources(), seatSoldResID); seatBitmapWidth = (int) (column * seatBitmap.getWidth()*xScale1 + (column - 1) * spacing); seatBitmapHeight = (int) (row * seatBitmap.getHeight()*yScale1 + (row - 1) * verSpacing); paint.setColor(Color.RED); numberWidth = (int) dip2Px(20); screenHeight = dip2Px(20); headHeight = dip2Px(30); headPaint = new Paint(); headPaint.setStyle(Paint.Style.FILL); headPaint.setTextSize(24); headPaint.setColor(Color.WHITE); headPaint.setAntiAlias(true); pathPaint = new Paint(Paint.ANTI_ALIAS_FLAG); pathPaint.setStyle(Paint.Style.FILL); pathPaint.setColor(Color.parseColor("#e2e2e2")); redBorderPaint = new Paint(); redBorderPaint.setAntiAlias(true); redBorderPaint.setColor(Color.RED); redBorderPaint.setStyle(Paint.Style.STROKE); redBorderPaint.setStrokeWidth(getResources().getDisplayMetrics().density * 1); rectF = new RectF(); rectHeight = seatHeight / overviewScale; rectWidth = seatWidth / overviewScale; overviewSpacing = spacing / overviewScale; overviewVerSpacing = verSpacing / overviewScale; rectW = column * rectWidth + (column - 1) * overviewSpacing + overviewSpacing * 2; rectH = row * rectHeight + (row - 1) * overviewVerSpacing + overviewVerSpacing * 2; overviewBitmap = Bitmap.createBitmap((int) rectW, (int) rectH, Bitmap.Config.ARGB_4444); lineNumberPaint = new Paint(Paint.ANTI_ALIAS_FLAG); lineNumberPaint.setColor(bacColor); lineNumberPaint.setTextSize(getResources().getDisplayMetrics().density * 16); lineNumberTxtHeight = lineNumberPaint.measureText("4"); lineNumberPaintFontMetrics = lineNumberPaint.getFontMetrics(); lineNumberPaint.setTextAlign(Paint.Align.CENTER); if(lineNumbers==null){ lineNumbers=new ArrayList<>(); }else if(lineNumbers.size()<=0) { for (int i = 0; i < row; i++) { lineNumbers.add((i + 1) + ""); } } matrix.postTranslate(numberWidth + spacing, headHeight + screenHeight + borderHeight + verSpacing); } @Override protected void onDraw(Canvas canvas) { long startTime = System.currentTimeMillis(); if (row <= 0 || column == 0) { return; } drawSeat(canvas); drawNumber(canvas); if (headBitmap == null) { headBitmap = drawHeadInfo(); } canvas.drawBitmap(headBitmap, 0, 0, null); drawScreen(canvas); if (isDrawOverview) { long s = System.currentTimeMillis(); if (isDrawOverviewBitmap) { drawOverview(); } canvas.drawBitmap(overviewBitmap, 0, 0, null); drawOverview(canvas); Log.d("drawTime", "OverviewDrawTime:" + (System.currentTimeMillis() - s)); } if (DBG) { long drawTime = System.currentTimeMillis() - startTime; Log.d("drawTime", "totalDrawTime:" + drawTime); } } @Override public boolean onTouchEvent(MotionEvent event) { int y = (int) event.getY(); int x = (int) event.getX(); super.onTouchEvent(event); scaleGestureDetector.onTouchEvent(event); gestureDetector.onTouchEvent(event); int pointerCount = event.getPointerCount(); if (pointerCount > 1) { pointer = true; } switch (event.getAction()) { case MotionEvent.ACTION_DOWN: pointer = false; downX = x; downY = y; isDrawOverview = true; handler.removeCallbacks(hideOverviewRunnable); invalidate(); break; case MotionEvent.ACTION_MOVE: if (!isScaling && !isOnClick) { int downDX = Math.abs(x - downX); int downDY = Math.abs(y - downY); if ((downDX > 10 || downDY > 10) && !pointer) { int dx = x - lastX; int dy = y - lastY; matrix.postTranslate(dx, dy); invalidate(); } } break; case MotionEvent.ACTION_UP: handler.postDelayed(hideOverviewRunnable, 1500); autoScale(); int downDX = Math.abs(x - downX); int downDY = Math.abs(y - downY); if ((downDX > 10 || downDY > 10) && !pointer) { autoScroll(); } break; } isOnClick = false; lastY = y; lastX = x; return true; } private Runnable hideOverviewRunnable = new Runnable() { @Override public void run() { isDrawOverview = false; invalidate(); } }; Bitmap drawHeadInfo() { String txt = "已售"; float txtY = getBaseLine(headPaint, 0, headHeight); int txtWidth = (int) headPaint.measureText(txt); float spacing = dip2Px(10); float spacing1 = dip2Px(5); float y = (headHeight - seatBitmap.getHeight()) / 2; float width = seatBitmap.getWidth() + spacing1 + txtWidth + spacing + seatSoldBitmap.getWidth() + txtWidth + spacing1 + spacing + checkedSeatBitmap.getHeight() + spacing1 + txtWidth; Bitmap bitmap = Bitmap.createBitmap(getWidth(), (int) headHeight, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); //绘制背景 canvas.drawRect(0, 0, getWidth(), headHeight, headPaint); headPaint.setColor(Color.BLACK); float startX = (getWidth() - width) / 2; tempMatrix.setScale(xScale1,yScale1); tempMatrix.postTranslate(startX,(headHeight - seatHeight) / 2); canvas.drawBitmap(seatBitmap, tempMatrix, headPaint); canvas.drawText("可选", startX + seatWidth + spacing1, txtY, headPaint); float soldSeatBitmapY = startX + seatBitmap.getWidth() + spacing1 + txtWidth + spacing; tempMatrix.setScale(xScale1,yScale1); tempMatrix.postTranslate(soldSeatBitmapY,(headHeight - seatHeight) / 2); canvas.drawBitmap(seatSoldBitmap, tempMatrix, headPaint); canvas.drawText("已售", soldSeatBitmapY + seatWidth + spacing1, txtY, headPaint); float checkedSeatBitmapX = soldSeatBitmapY + seatSoldBitmap.getWidth() + spacing1 + txtWidth + spacing; tempMatrix.setScale(xScale1,yScale1); tempMatrix.postTranslate(checkedSeatBitmapX,y); canvas.drawBitmap(checkedSeatBitmap, tempMatrix, headPaint); canvas.drawText("已选", checkedSeatBitmapX + spacing1 + seatWidth, txtY, headPaint); //绘制分割线 headPaint.setStrokeWidth(1); headPaint.setColor(Color.GRAY); canvas.drawLine(0, headHeight, getWidth(), headHeight, headPaint); return bitmap; } /** * 绘制中间屏幕 */ void drawScreen(Canvas canvas) { pathPaint.setStyle(Paint.Style.FILL); pathPaint.setColor(Color.parseColor("#e2e2e2")); float startY = headHeight + borderHeight; float centerX = seatBitmapWidth * getMatrixScaleX() / 2 + getTranslateX(); float screenWidth = seatBitmapWidth * screenWidthScale * getMatrixScaleX(); if (screenWidth < defaultScreenWidth) { screenWidth = defaultScreenWidth; } Path path = new Path(); path.moveTo(centerX, startY); path.lineTo(centerX - screenWidth / 2, startY); path.lineTo(centerX - screenWidth / 2 + 20, screenHeight * getMatrixScaleY() + startY); path.lineTo(centerX + screenWidth / 2 - 20, screenHeight * getMatrixScaleY() + startY); path.lineTo(centerX + screenWidth / 2, startY); canvas.drawPath(path, pathPaint); pathPaint.setColor(Color.BLACK); pathPaint.setTextSize(20 * getMatrixScaleX()); canvas.drawText(screenName, centerX - pathPaint.measureText(screenName) / 2, getBaseLine(pathPaint, startY, startY + screenHeight * getMatrixScaleY()), pathPaint); } Matrix tempMatrix = new Matrix(); void drawSeat(Canvas canvas) { zoom = getMatrixScaleX(); long startTime = System.currentTimeMillis(); float translateX = getTranslateX(); float translateY = getTranslateY(); float scaleX = zoom; float scaleY = zoom; for (int i = 0; i < row; i++) { float top = i * seatBitmap.getHeight() * yScale1 * scaleY + i * verSpacing * scaleY + translateY; float bottom = top + seatBitmap.getHeight() * yScale1 * scaleY; if (bottom < 0 || top > getHeight()) { continue; } for (int j = 0; j < column; j++) { float left = j * seatBitmap.getWidth() * xScale1 * scaleX + j * spacing * scaleX + translateX; float right = (left + seatBitmap.getWidth() * xScale1 * scaleY); if (right < 0 || left > getWidth()) { continue; } int seatType = getSeatType(i, j); tempMatrix.setTranslate(left, top); tempMatrix.postScale(xScale1, yScale1, left, top); tempMatrix.postScale(scaleX, scaleY, left, top); switch (seatType) { case SEAT_TYPE_AVAILABLE: canvas.drawBitmap(seatBitmap, tempMatrix, paint); break; case SEAT_TYPE_NOT_AVAILABLE: break; case SEAT_TYPE_SELECTED: canvas.drawBitmap(checkedSeatBitmap, tempMatrix, paint); drawText(canvas, i, j, top, left); break; case SEAT_TYPE_SOLD: canvas.drawBitmap(seatSoldBitmap, tempMatrix, paint); break; } } } if (DBG) { long drawTime = System.currentTimeMillis() - startTime; Log.d("drawTime", "seatDrawTime:" + drawTime); } } private int getSeatType(int row, int column) { if (isHave(getID(row, column)) >= 0) { return SEAT_TYPE_SELECTED; } if (seatChecker != null) { if (!seatChecker.isValidSeat(row, column)) { return SEAT_TYPE_NOT_AVAILABLE; } else if (seatChecker.isSold(row, column)) { return SEAT_TYPE_SOLD; } } return SEAT_TYPE_AVAILABLE; } private int getID(int row, int column) { return row * this.column + (column + 1); } /** * 绘制选中座位的行号列号 * * @param row * @param column */ private void drawText(Canvas canvas, int row, int column, float top, float left) { String txt = (row + 1) + "排"; String txt1 = (column + 1) + "座"; if(seatChecker!=null){ String[] strings = seatChecker.checkedSeatTxt(row, column); if(strings!=null&&strings.length>0){ if(strings.length>=2){ txt=strings[0]; txt1=strings[1]; }else { txt=strings[0]; txt1=null; } } } TextPaint txtPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); txtPaint.setColor(txt_color); txtPaint.setTypeface(Typeface.DEFAULT_BOLD); float seatHeight = this.seatHeight * getMatrixScaleX(); float seatWidth = this.seatWidth * getMatrixScaleX(); txtPaint.setTextSize(seatHeight / 3); //获取中间线 float center = seatHeight / 2; float txtWidth = txtPaint.measureText(txt); float startX = left + seatWidth / 2 - txtWidth / 2; //只绘制一行文字 if(txt1==null){ canvas.drawText(txt, startX, getBaseLine(txtPaint, top, top + seatHeight), txtPaint); }else { canvas.drawText(txt, startX, getBaseLine(txtPaint, top, top + center), txtPaint); canvas.drawText(txt1, startX, getBaseLine(txtPaint, top + center, top + center + seatHeight / 2), txtPaint); } if (DBG) { Log.d("drawTest:", "top:" + top); } } int bacColor = Color.parseColor("#7e000000"); /** * 绘制行号 */ void drawNumber(Canvas canvas) { long startTime = System.currentTimeMillis(); lineNumberPaint.setColor(bacColor); int translateY = (int) getTranslateY(); float scaleY = getMatrixScaleY(); rectF.top = translateY - lineNumberTxtHeight / 2; rectF.bottom = translateY + (seatBitmapHeight * scaleY) + lineNumberTxtHeight / 2; rectF.left = 0; rectF.right = numberWidth; canvas.drawRoundRect(rectF, numberWidth / 2, numberWidth / 2, lineNumberPaint); lineNumberPaint.setColor(Color.WHITE); for (int i = 0; i < row; i++) { float top = (i *seatHeight + i * verSpacing) * scaleY + translateY; float bottom = (i * seatHeight + i * verSpacing + seatHeight) * scaleY + translateY; float baseline = (bottom + top - lineNumberPaintFontMetrics.bottom - lineNumberPaintFontMetrics.top) / 2; canvas.drawText(lineNumbers.get(i), numberWidth / 2, baseline, lineNumberPaint); } if (DBG) { long drawTime = System.currentTimeMillis() - startTime; Log.d("drawTime", "drawNumberTime:" + drawTime); } } /** * 绘制概览图 */ void drawOverview(Canvas canvas) { //绘制红色框 int left = (int) -getTranslateX(); if (left < 0) { left = 0; } left /= overviewScale; left /= getMatrixScaleX(); int currentWidth = (int) (getTranslateX() + (column * seatWidth + spacing * (column - 1)) * getMatrixScaleX()); if (currentWidth > getWidth()) { currentWidth = currentWidth - getWidth(); } else { currentWidth = 0; } int right = (int) (rectW - currentWidth / overviewScale / getMatrixScaleX()); float top = -getTranslateY() + headHeight; if (top < 0) { top = 0; } top /= overviewScale; top /= getMatrixScaleY(); if (top > 0) { top += overviewVerSpacing; } int currentHeight = (int) (getTranslateY() + (row * seatHeight + verSpacing * (row - 1)) * getMatrixScaleY()); if (currentHeight > getHeight()) { currentHeight = currentHeight - getHeight(); } else { currentHeight = 0; } int bottom = (int) (rectH - currentHeight / overviewScale / getMatrixScaleY()); canvas.drawRect(left, top, right, bottom, redBorderPaint); } Bitmap drawOverview() { isDrawOverviewBitmap = false; int bac = Color.parseColor("#7e000000"); overviewPaint.setColor(bac); overviewPaint.setAntiAlias(true); overviewPaint.setStyle(Paint.Style.FILL); overviewBitmap.eraseColor(Color.TRANSPARENT); Canvas canvas = new Canvas(overviewBitmap); //绘制透明灰色背景 canvas.drawRect(0, 0, rectW, rectH, overviewPaint); overviewPaint.setColor(Color.WHITE); for (int i = 0; i < row; i++) { float top = i * rectHeight + i * overviewVerSpacing + overviewVerSpacing; for (int j = 0; j < column; j++) { int seatType = getSeatType(i, j); switch (seatType) { case SEAT_TYPE_AVAILABLE: overviewPaint.setColor(Color.WHITE); break; case SEAT_TYPE_NOT_AVAILABLE: continue; case SEAT_TYPE_SELECTED: overviewPaint.setColor(overview_checked); break; case SEAT_TYPE_SOLD: overviewPaint.setColor(overview_sold); break; } float left; left = j * rectWidth + j * overviewSpacing + overviewSpacing; canvas.drawRect(left, top, left + rectWidth, top + rectHeight, overviewPaint); } } return overviewBitmap; } /** * 自动回弹 * 整个大小不超过控件大小的时候: * 往左边滑动,自动回弹到行号右边 * 往右边滑动,自动回弹到右边 * 往上,下滑动,自动回弹到顶部 * <p> * 整个大小超过控件大小的时候: * 往左侧滑动,回弹到最右边,往右侧滑回弹到最左边 * 往上滑动,回弹到底部,往下滑动回弹到顶部 */ private void autoScroll() { float currentSeatBitmapWidth = seatBitmapWidth * getMatrixScaleX(); float currentSeatBitmapHeight = seatBitmapHeight * getMatrixScaleY(); float moveYLength = 0; float moveXLength = 0; //处理左右滑动的情况 if (currentSeatBitmapWidth < getWidth()) { if (getTranslateX() < 0 || getMatrixScaleX() < numberWidth + spacing) { //计算要移动的距离 if (getTranslateX() < 0) { moveXLength = (-getTranslateX()) + numberWidth + spacing; } else { moveXLength = numberWidth + spacing - getTranslateX(); } } } else { if (getTranslateX() < 0 && getTranslateX() + currentSeatBitmapWidth > getWidth()) { } else { //往左侧滑动 if (getTranslateX() + currentSeatBitmapWidth < getWidth()) { moveXLength = getWidth() - (getTranslateX() + currentSeatBitmapWidth); } else { //右侧滑动 moveXLength = -getTranslateX() + numberWidth + spacing; } } } float startYPosition = screenHeight * getMatrixScaleY() + verSpacing * getMatrixScaleY() + headHeight + borderHeight; //处理上下滑动 if (currentSeatBitmapHeight+headHeight < getHeight()) { if (getTranslateY() < startYPosition) { moveYLength = startYPosition - getTranslateY(); } else { moveYLength = -(getTranslateY() - (startYPosition)); } } else { if (getTranslateY() < 0 && getTranslateY() + currentSeatBitmapHeight > getHeight()) { } else { //往上滑动 if (getTranslateY() + currentSeatBitmapHeight < getHeight()) { moveYLength = getHeight() - (getTranslateY() + currentSeatBitmapHeight); } else { moveYLength = -(getTranslateY() - (startYPosition)); } } } Point start = new Point(); start.x = (int) getTranslateX(); start.y = (int) getTranslateY(); Point end = new Point(); end.x = (int) (start.x + moveXLength); end.y = (int) (start.y + moveYLength); moveAnimate(start, end); } private void autoScale() { if (getMatrixScaleX() > 2.2) { zoomAnimate(getMatrixScaleX(), 2.0f); } else if (getMatrixScaleX() < 0.98) { zoomAnimate(getMatrixScaleX(), 1.0f); } } Handler handler = new Handler(); ArrayList<Integer> selects = new ArrayList<>(); public ArrayList<String> getSelectedSeat(){ ArrayList<String> results=new ArrayList<>(); for(int i=0;i<this.row;i++){ for(int j=0;j<this.column;j++){ if(isHave(getID(i,j))>=0){ results.add(i+","+j); } } } return results; } private int isHave(Integer seat) { return Collections.binarySearch(selects, seat); } private void remove(int index) { selects.remove(index); } float[] m = new float[9]; private float getTranslateX() { matrix.getValues(m); return m[2]; } private float getTranslateY() { matrix.getValues(m); return m[5]; } private float getMatrixScaleY() { matrix.getValues(m); return m[4]; } private float getMatrixScaleX() { matrix.getValues(m); return m[Matrix.MSCALE_X]; } private float dip2Px(float value) { return getResources().getDisplayMetrics().density * value; } private float getBaseLine(Paint p, float top, float bottom) { Paint.FontMetrics fontMetrics = p.getFontMetrics(); int baseline = (int) ((bottom + top - fontMetrics.bottom - fontMetrics.top) / 2); return baseline; } private void moveAnimate(Point start, Point end) { ValueAnimator valueAnimator = ValueAnimator.ofObject(new MoveEvaluator(), start, end); valueAnimator.setInterpolator(new DecelerateInterpolator()); MoveAnimation moveAnimation = new MoveAnimation(); valueAnimator.addUpdateListener(moveAnimation); valueAnimator.setDuration(400); valueAnimator.start(); } private void zoomAnimate(float cur, float tar) { ValueAnimator valueAnimator = ValueAnimator.ofFloat(cur, tar); valueAnimator.setInterpolator(new DecelerateInterpolator()); ZoomAnimation zoomAnim = new ZoomAnimation(); valueAnimator.addUpdateListener(zoomAnim); valueAnimator.addListener(zoomAnim); valueAnimator.setDuration(400); valueAnimator.start(); } private float zoom; private void zoom(float zoom) { float z = zoom / getMatrixScaleX(); matrix.postScale(z, z, scaleX, scaleY); invalidate(); } private void move(Point p) { float x = p.x - getTranslateX(); float y = p.y - getTranslateY(); matrix.postTranslate(x, y); invalidate(); } class MoveAnimation implements ValueAnimator.AnimatorUpdateListener { @Override public void onAnimationUpdate(ValueAnimator animation) { Point p = (Point) animation.getAnimatedValue(); move(p); } } class MoveEvaluator implements TypeEvaluator { @Override public Object evaluate(float fraction, Object startValue, Object endValue) { Point startPoint = (Point) startValue; Point endPoint = (Point) endValue; int x = (int) (startPoint.x + fraction * (endPoint.x - startPoint.x)); int y = (int) (startPoint.y + fraction * (endPoint.y - startPoint.y)); return new Point(x, y); } } class ZoomAnimation implements ValueAnimator.AnimatorUpdateListener, Animator.AnimatorListener { @Override public void onAnimationUpdate(ValueAnimator animation) { zoom = (Float) animation.getAnimatedValue(); zoom(zoom); if (DBG) { Log.d("zoomTest", "zoom:" + zoom); } } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationStart(Animator animation) { } } public void setData(int row, int column) { this.row = row; this.column = column; init(); invalidate(); } ScaleGestureDetector scaleGestureDetector = new ScaleGestureDetector(getContext(), new ScaleGestureDetector.OnScaleGestureListener() { @Override public boolean onScale(ScaleGestureDetector detector) { isScaling = true; float scaleFactor = detector.getScaleFactor(); if (getMatrixScaleY() * scaleFactor > 3) { scaleFactor = 3 / getMatrixScaleY(); } if (firstScale) { scaleX = detector.getCurrentSpanX(); scaleY = detector.getCurrentSpanY(); firstScale = false; } if (getMatrixScaleY() * scaleFactor < 0.5) { scaleFactor = 0.5f / getMatrixScaleY(); } matrix.postScale(scaleFactor, scaleFactor, scaleX, scaleY); invalidate(); return true; } @Override public boolean onScaleBegin(ScaleGestureDetector detector) { return true; } @Override public void onScaleEnd(ScaleGestureDetector detector) { isScaling = false; firstScale = true; } }); GestureDetector gestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapConfirmed(MotionEvent e) { isOnClick = true; int x = (int) e.getX(); int y = (int) e.getY(); for (int i = 0; i < row; i++) { for (int j = 0; j < column; j++) { int tempX = (int) ((j * seatWidth + (j+1) * spacing) * getMatrixScaleX() + getTranslateX()); int maxTemX = (int) (tempX + seatWidth * getMatrixScaleX()); int tempY = (int) ((i * seatHeight + i * verSpacing) * getMatrixScaleY() + getTranslateY()); int maxTempY = (int) (tempY + seatHeight * getMatrixScaleY()); if (seatChecker != null && seatChecker.isValidSeat(i, j) && !seatChecker.isSold(i, j)) { if (x >= tempX && x <= maxTemX && y >= tempY && y <= maxTempY) { int id = getID(i, j); int index = isHave(id); if (index >= 0) { remove(index); if (seatChecker != null) { seatChecker.unCheck(i, j); } } else { if (selects.size() >= maxSelected) { Toast.makeText(getContext(), "最多只能选择" + maxSelected + "个", Toast.LENGTH_SHORT).show(); return super.onSingleTapConfirmed(e); } else { addChooseSeat(i, j); if (seatChecker != null) { seatChecker.checked(i, j); } } } isNeedDrawSeatBitmap = true; isDrawOverviewBitmap = true; float currentScaleY = getMatrixScaleY(); if (currentScaleY < 1.7) { scaleX = x; scaleY = y; zoomAnimate(currentScaleY, 1.9f); } invalidate(); break; } } } } return super.onSingleTapConfirmed(e); } }); private void addChooseSeat(int row, int column) { int id = getID(row, column); for (int i = 0; i < selects.size(); i++) { int item = selects.get(i); if (id < item) { selects.add(i, id); return; } } selects.add(id); } public interface SeatChecker { /** * 是否可用座位 * * @param row * @param column * @return */ boolean isValidSeat(int row, int column); /** * 是否已售 * * @param row * @param column * @return */ boolean isSold(int row, int column); void checked(int row, int column); void unCheck(int row, int column); /** * 获取选中后座位上显示的文字 * @param row * @param column * @return 返回2个元素的数组,第一个元素是第一行的文字,第二个元素是第二行文字,如果只返回一个元素则会绘制到座位图的中间位置 */ String[] checkedSeatTxt(int row,int column); } public void setScreenName(String screenName) { this.screenName = screenName; } public void setMaxSelected(int maxSelected) { this.maxSelected = maxSelected; } public void setSeatChecker(SeatChecker seatChecker) { this.seatChecker = seatChecker; invalidate(); } private int getRowNumber(int row){ int result=row; if(seatChecker==null){ return -1; } for(int i=0;i<row;i++){ for (int j=0;j<column;j++){ if(seatChecker.isValidSeat(i,j)){ break; } if(j==column-1){ if(i==row){ return -1; } result--; } } } return result; } private int getColumnNumber(int row,int column){ int result=column; if(seatChecker==null){ return -1; } for(int i=row;i<=row;i++){ for (int j=0;j<column;j++){ if(!seatChecker.isValidSeat(i,j)){ if(j==column){ return -1; } result--; } } } return result; } }
[ "eerrerer@126.com" ]
eerrerer@126.com
4dcc039e4c0630c8c0a207464feef89077b49484
1f2a383d2cd7b49d46852a050a226b9669961204
/registry-spring-boot-persistence/src/main/java/org/gbif/registry/persistence/mapper/IdentifierMapper.java
e11b3ac6c6b17253043e2517c00dd8863e9c559a
[ "Apache-2.0" ]
permissive
gbif/registry-spring-boot
11600029a8832d3a8111024f1637a4b71e64f49f
ea1c70295632bf4febe2b85577f04433f6ba115e
refs/heads/master
2020-06-13T14:26:16.170982
2020-03-13T13:49:21
2020-03-13T13:49:21
194,686,709
0
0
Apache-2.0
2020-01-10T13:42:22
2019-07-01T14:17:48
Java
UTF-8
Java
false
false
1,256
java
/* * Copyright 2020 Global Biodiversity Information Facility (GBIF) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gbif.registry.persistence.mapper; import org.gbif.api.model.common.paging.Pageable; import org.gbif.api.model.registry.Identifier; import org.gbif.api.vocabulary.IdentifierType; import java.util.List; import javax.annotation.Nullable; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @Repository public interface IdentifierMapper { int createIdentifier(Identifier identifier); List<Identifier> list( @Nullable @Param("type") IdentifierType type, @Nullable @Param("identifier") String identifier, @Nullable @Param("page") Pageable page); }
[ "federicomh@gmail.com" ]
federicomh@gmail.com
268e4466fb5feff67f7a58d81959689748cb28c5
0b322badb2b35c85fd14de496fcc00328498a5a0
/app/src/main/java/com/android/timesheet/admin_operations/leave/approve_leave/ApproveLeaveRouter.java
c4cfc5c1cd004bde86ceb8862560e6674a11c6e6
[]
no_license
Vamsi7591/TSAndroid
4e85bf52a5dac0bb55ecee5f2f768145a8ba46be
202e455eb9a5f78a47756fd04d7a2747d956630b
refs/heads/master
2021-01-23T09:15:34.845955
2018-11-22T14:36:34
2018-11-22T14:36:34
102,572,768
0
2
null
null
null
null
UTF-8
Java
false
false
293
java
package com.android.timesheet.admin_operations.leave.approve_leave; import android.content.Context; import com.android.timesheet.shared.routers.BaseRouter; public class ApproveLeaveRouter extends BaseRouter{ public ApproveLeaveRouter(Context context) { super(context); } }
[ "vamsik@prisaminfotech.com" ]
vamsik@prisaminfotech.com
e7d60105d14b85183d7185300a646630d43d1e2d
1007e1cb464bf3a20c567afc9b857156227a7085
/src/main/java/com/zzgo/jeck/service/IRecordService.java
ff07a82fd5bad40e4e000700b8de79b05e07ea46
[]
no_license
zzgo/ject
163af04cc89b9a4b7b38439682e6e38df5f1d3af
2bc8306d335df38fa6556db9d4d230f907b96e14
refs/heads/master
2021-05-07T14:22:33.697759
2017-12-14T01:03:32
2017-12-14T01:03:32
109,814,355
0
0
null
null
null
null
UTF-8
Java
false
false
528
java
package com.zzgo.jeck.service; import com.zzgo.jeck.entity.Book; import com.zzgo.jeck.entity.Record; import org.springframework.data.domain.Page; import org.springframework.data.jpa.domain.Specification; import java.util.List; public interface IRecordService { void save(Record Record); void delete(String id); Record findRecordById(String id); Page<Record> findPage(int first, int max); //用于过滤条件查询 Page<Record> findPage(Specification<Record> specification, int first, int max); }
[ "815609229@qq.com" ]
815609229@qq.com
bfedea1773ebd95db23025f225a018846e74ff02
01e56b04b67e9c7b216e6a8236183b3ce8eb0934
/src/main/java/com/thisissporta/cart/CartService.java
691c8e0ab4db60306479ce4c4039a421157531bf
[]
no_license
vipulgupta504/thisissporta
66f5164db4b67fb5ac7567918b2172d5b4970f2c
5b8ccd05609f3b398db8a3a8fd424705441fcbbb
refs/heads/master
2020-05-21T19:14:52.387844
2016-10-17T13:07:12
2016-10-17T13:07:12
65,878,986
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package com.thisissporta.cart; import java.util.List; public interface CartService { Cart getCartById(int cartId); void update(Cart cart); void add(Cart cart); void delete(int i); public List<Cart> getAllProducts(); Cart getCartByUsername(String Username); String checkUsername(String Username); }
[ "vipulgupta504@gmail.com" ]
vipulgupta504@gmail.com
d94b8e636f42c010d09443a3ff9c4afbfdecad82
008c66edf4f79622c8afcbb9ce2fb9dbd0b6e255
/src/templateMethodDesignPattern/CookFood.java
8f7a565202b75c881769c720d0d7cdbaebda796d
[]
no_license
niannianli/ProblemsSolved
0a28a6ebf9f9e2cad2e81abc4de709d645cbdd90
0617f0a1d2ec72ea53a875c2dfe9725228054e61
refs/heads/master
2021-01-22T08:19:26.317109
2017-02-14T01:58:49
2017-02-14T01:58:49
81,892,900
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package templateMethodDesignPattern; public class CookFood { public static void main(String[] args){ Meat meat = new Meat(); meat.cook(); System.out.println(); Vegetable vegetable = new Vegetable(); vegetable.cook(); } }
[ "lijiao@192.168.1.102" ]
lijiao@192.168.1.102
7c4457fabfc5200045fed47e9788602aedccfb06
4ddb5bf2fa7d028e4f419f2d5eeda5d21e0c45db
/wyndham-automation/src/main/java/com/wr/automation/rewards/MyAccountScenario.java
62996949f9eefa82be25be7cc63fbe22da096f72
[]
no_license
sandeepduggi/rep
b27faa91b048edd81c3374bdd1400bc2c1186e81
cf8191af0bfc194ff998b41e7971e94c7a0c785a
refs/heads/master
2021-01-25T13:35:56.965717
2018-03-02T16:33:56
2018-03-02T16:33:56
123,592,055
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package com.wr.automation.rewards; import org.testng.annotations.Test; import com.wr.automation.rewards.pages.LoginPage; import com.wyn.automation.base.BasePageTest; import com.wr.automation.rewards.pages.MyAccount; public class MyAccountScenario extends BasePageTest{ @Test public void MyAccount() throws Exception { int testCaseNo=8; test=extent.startTest("MyAccount"); LoginPage loginPage = new LoginPage().openPage(LoginPage.class); super.captureScreenShot("1.Click SignIn"); loginPage.loginWithCredentials(testCaseNo); super.captureScreenShot("2.Enter the Security Question"); loginPage.validateSecurityQuestion(); MyAccount myAccount=new MyAccount().openPage(MyAccount.class); super.captureScreenShot("3.Click MyAccount"); myAccount.clickMyAccount(); super.captureScreenShot("4.Verify MyAccount Components"); myAccount.verifyComponentPresnets(); } }
[ "pc@192.168.0.5" ]
pc@192.168.0.5
5f1fdd09705cc4209405780f5d2aaed00a57ad44
2b858366379713e5aea49d7ef187f1485f0d533e
/app/src/main/java/demo/tzx/com/terminalmonitor/bean/MonitorBean.java
5f5774809b2e184033b0b10dd777020e28fc2378
[]
no_license
wonderfulSong/TerminalMonitor
613c22e8939d01bd16c2af5a465ffa5aeefe4042
c974bfe4e9a06b66b0ad2de5f85c518a6be07f9d
refs/heads/master
2021-01-25T01:15:28.672431
2017-06-26T05:50:22
2017-06-26T05:50:22
94,738,750
0
0
null
null
null
null
UTF-8
Java
false
false
3,186
java
package demo.tzx.com.terminalmonitor.bean; /** * Created by 呃呃呃 on 2017-06-22. */ /** * API详解 * metric: 最核心的字段,代表这个采集项具体度量的是什么, 比如是cpu_idle呢,还是memory_free, 还是qps * endpoint: 标明Metric的主体(属主),比如metric是cpu_idle,那么Endpoint就表示这是哪台机器的cpu_idle * timestamp: 表示汇报该数据时的unix时间戳,注意是整数,代表的是秒 * value: 代表该metric在当前时间点的值,float64 * step: 表示该数据采集项的汇报周期,这对于后续的配置监控策略很重要,必须明确指定。 * counterType: 只能是COUNTER或者GAUGE二选一,前者表示该数据采集项为计时器类型,后者表示其为原值 (注意大小写) * GAUGE:即用户上传什么样的值,就原封不动的存储 * COUNTER:指标在存储和展现的时候,会被计算为speed,即(当前值 - 上次值)/ 时间间隔 * tags: 一组逗号分割的键值对, 对metric进一步描述和细化, 可以是空字符串. 比如idc=lg,比如service=xbox等,多个tag之间用逗号分割 */ public class MonitorBean { private String endpoint="";//商家-门店 private String metric="";//监控项 private String timestamp="";//数据采集的时间点,值为当前时间的秒数表示,在Java中可以通过System.currentTimeMillis()/1000拿到 private String step=""; //上报周期,单位为秒 private String value="";//数据值 private String counterType=""; private String tags="";//为此监控项打几个标签,最多8个,只支持有限的字符:"a to z,A to Z,0 to 9,-,_,.,/"和Unicode,暂时请不要包含中文 public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } public String getMetric() { return metric; } public void setMetric(String metric) { this.metric = metric; } public String getTimestamp() { return timestamp; } public void setTimestamp(String timestamp) { this.timestamp = timestamp; } public String getStep() { return step; } public void setStep(String step) { this.step = step; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getCounterType() { return counterType; } public void setCounterType(String counterType) { this.counterType = counterType; } public String getTags() { return tags; } public void setTags(String tags) { this.tags = tags; } @Override public String toString() { return "MonitorBean{" + "endpoint='" + endpoint + '\'' + ", metric='" + metric + '\'' + ", timestamp='" + timestamp + '\'' + ", step='" + step + '\'' + ", value='" + value + '\'' + ", counterType='" + counterType + '\'' + ", tags='" + tags + '\'' + '}'; } }
[ "13121655483@163.com" ]
13121655483@163.com
ed5691068f37a0c76e401701001b32ea3e3265cf
7152d4cd47245ec795a66661a2b61438275c9eab
/src/main/java/pl/kostrowski/mtga/model/Project.java
580fd6505305d1b21a6d7e53d4202b90d007b1e0
[]
no_license
Tojemojek/MakeTasksGreatAgain
5f81afa97d06cb1349b8d5e973d41aca6e146166
1cd8a3ad62bd4cddd2cdf051805cdd68ee224578
refs/heads/master
2021-09-03T06:55:18.059054
2018-01-06T15:56:14
2018-01-06T15:56:14
111,944,485
2
0
null
2018-01-06T13:53:40
2017-11-24T18:02:41
Java
UTF-8
Java
false
false
2,064
java
package pl.kostrowski.mtga.model; import javax.persistence.*; import java.util.ArrayList; import java.util.List; /** * <h1>Project</h1> * First class that have more interesting features <br> * {@code id} is a String and should be made of 6 digits<br> * {@code name and type} will hopefully be a descriptive texts<br> * {@code salesman} will be one of users with specified role<br> * @see Customer * @see User * * @author Krzysztof Ostrowski */ @Entity @Table(schema = "mtgadb", name = "mtga_project") public class Project { @Id @Column(name = "id", unique = true) private String id; @Column(name = "name") private String name; @Column(name = "type") private String type; @ManyToOne @JoinColumn(name="branch_id", nullable=false) private Branch branch; @ManyToOne @JoinColumn(name="customer_id") private Customer customer; @ManyToOne @JoinColumn(name="salesman_id") private User salesman; @OneToMany(mappedBy = "project", cascade = CascadeType.ALL) private List<Task> tasks = new ArrayList<Task>(); public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Branch getBranch() { return branch; } public void setBranch(Branch branch) { this.branch = branch; } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public User getSalesman() { return salesman; } public void setSalesman(User salesman) { this.salesman = salesman; } public List<Task> getTasks() { return tasks; } public void setTasks(List<Task> tasks) { this.tasks = tasks; } }
[ "inz@kostrowski.pl" ]
inz@kostrowski.pl
346e70ca1c04dc999dc6f79dfa61b86973052a9b
984024d46604f49de520c0747fc83d0f5e9d2d1a
/src/main/java/addax/Action.java
60b60048d3b547f78bb6978fb0fecb8e80369d32
[]
no_license
masgari/addax
a02034d90ca341eebc9c7728f28564319d29e751
0bbaf292b7dd8d4d9a298558dcc782cf14dd2e64
refs/heads/master
2021-01-15T16:29:09.655175
2013-05-04T15:12:52
2013-05-04T15:12:52
9,088,820
0
2
null
null
null
null
UTF-8
Java
false
false
159
java
package addax; /** * @author Mamad * @version 1.0 * @since 28/03/13 */ public interface Action<T> { Action<T> execute(T input, Context<T> context); }
[ "mohammad.asgari@gmail.com" ]
mohammad.asgari@gmail.com
ec95df509075237a1de3a4e18d76d190ac8344d5
16480037f43ed53e0a885eafa80db8acd2d20b2b
/octopus-admin/src/main/java/com/oneape/octopus/admin/service/peekdata/impl/ImportRecordServiceImpl.java
87cd22a2c09be5e49651880dc5f367945a82b395
[]
no_license
oneape15/octopus
8ae39dce47cba1d208586ea93ee7f626af0a9cd8
d126fbc340230eefc14ffecf2ed1760318e55b74
refs/heads/master
2022-09-19T20:59:05.414059
2021-04-07T12:42:19
2021-04-07T12:42:19
230,389,795
1
0
null
2022-06-21T02:33:37
2019-12-27T06:52:10
Java
UTF-8
Java
false
false
3,075
java
package com.oneape.octopus.admin.service.peekdata.impl; import com.google.common.base.Preconditions; import com.oneape.octopus.query.data.Result; import com.oneape.octopus.mapper.peekdata.ImportRecordMapper; import com.oneape.octopus.domain.peekdata.ImportRecordDO; import com.oneape.octopus.admin.model.vo.ImportRecordVO; import com.oneape.octopus.admin.service.peekdata.ImportRecordService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; @Slf4j @Service public class ImportRecordServiceImpl implements ImportRecordService { @Resource private ImportRecordMapper importRecordMapper; /** * 上传数据 * * @param importRecord ImportRecordDO * @param file MultipartFile * @return int 0 - 失败; 1 - 成功; */ @Override public int uploadData(ImportRecordDO importRecord, MultipartFile file) { Preconditions.checkNotNull(file, "上传文件为空"); return 0; } /** * 逻辑删除指定id的数据 * * @param importRecord ImportRecordDO */ @Override public void archiveData(ImportRecordDO importRecord) { } /** * 预览导入数据 * * @param importRecord ImportRecordDO * @return Result */ @Override public Result previewData(ImportRecordDO importRecord) { return null; } /** * 根据条件查询 * * @param importRecord ImportRecordDO * @return List */ @Override public List<ImportRecordVO> list(ImportRecordDO importRecord) { if (importRecord == null) { importRecord = new ImportRecordDO(); } List<ImportRecordDO> list = importRecordMapper.list(importRecord); List<ImportRecordVO> ret = new ArrayList<>(); if (CollectionUtils.isNotEmpty(list)) { list.forEach(ir -> ret.add(ImportRecordVO.ofDO(ir))); } return ret; } /** * save data to table. * <p> * If the Model property ID is not null, the update operation is performed, or the insert operation is performed。 * * @param model T * @return int 1 - success; 0 - fail. */ @Override public int save(ImportRecordDO model) { return 0; } /** * Delete by primary key Id. * * @param id Long * @return int 1 - success; 0 - fail. */ @Override public int deleteById(Long id) { return 0; } /** * Get the model information by the primary key. * * @param id Long * @return T */ @Override public ImportRecordDO findById(Long id) { return null; } /** * Query against an object. * * @param model T * @return List */ @Override public List<ImportRecordDO> find(ImportRecordDO model) { return null; } }
[ "oneape15@163.com" ]
oneape15@163.com
1e4521a50505005c6921ec99b2f3ec2d0d96f221
553663c01ad02bde1e9ec2d87c7b935aba39ab57
/springModel/relationships/src/test/java/com/ceantolentino/relationships/RelationshipsApplicationTests.java
d018b74897104847b5aae6249012f75f17601072
[]
no_license
ceantolentino06/JavaStack
e1e076f3df072f18d2025078a2a8e7d0dd1e4b8a
30b707ca6e4764803d4a2e5525e759acabda3b9d
refs/heads/master
2020-07-23T19:33:22.708184
2019-09-11T00:11:41
2019-09-11T00:11:41
207,684,227
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package com.ceantolentino.relationships; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class RelationshipsApplicationTests { @Test public void contextLoads() { } }
[ "cean.tolentino@gmail.com" ]
cean.tolentino@gmail.com
013c0363726274a9d2933163c0909d467d9ed12a
aa7c2507ae925fdc48c6e686e15b01cf0a602cbd
/instagram/src/main/java/com/ariodev/instagram/requests/internal/InstagramFetchHeadersRequest.java
4d28cd4d5dd8862fab836924fe79197b3d0afde7
[]
no_license
OmidPvh/Instagram
7581535b32c732a1245940c6d9bd5c66696049cf
b544feb6bbf1e5358ed4bbf703f1ef030cae9a87
refs/heads/master
2021-07-04T05:48:11.940388
2021-01-14T10:26:40
2021-01-14T10:26:40
213,720,818
1
0
null
null
null
null
UTF-8
Java
false
false
750
java
package com.ariodev.instagram.requests.internal; import com.ariodev.instagram.requests.InstagramGetRequest; import com.ariodev.instagram.requests.payload.StatusResult; import com.ariodev.instagram.util.InstagramGenericUtil; /** * Created by root on 08/06/17. */ public class InstagramFetchHeadersRequest extends InstagramGetRequest<StatusResult> { @Override public String getUrl() { return "si/fetch_headers/?challenge_type=signup&guid=" + InstagramGenericUtil.generateUuid(false); } @Override public boolean requiresLogin() { return false; } @Override public StatusResult parseResult(int resultCode, String content) { return parseJson(resultCode, content, StatusResult.class); } }
[ "Omid.p73@gmail.com" ]
Omid.p73@gmail.com
4745fbaa1320d1b91691120f4b4243b8102ef8a2
7ef841751c77207651aebf81273fcc972396c836
/astream/src/main/java/com/loki/astream/stubs/SampleClass186.java
576e434d9ef18c94618a417691979ee44ae2b23c
[]
no_license
SergiiGrechukha/ModuleApp
e28e4dd39505924f0d36b4a0c3acd76a67ed4118
00e22d51c8f7100e171217bcc61f440f94ab9c52
refs/heads/master
2022-05-07T13:27:37.704233
2019-11-22T07:11:19
2019-11-22T07:11:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.loki.astream.stubs;import com.jenzz.pojobuilder.api.Builder;import com.jenzz.pojobuilder.api.Ignore; @Builder public class SampleClass186 { @Ignore private SampleClass187 sampleClass; public SampleClass186(){ sampleClass = new SampleClass187(); } public String getClassName() { return sampleClass.getClassName(); } }
[ "sergey.grechukha@gmail.com" ]
sergey.grechukha@gmail.com
15d37b124fdc6a8831cc01896350a4c8587c3a8f
b15e1c8853ca002a37729f00b84cda33d0cb9dc3
/spring-richclient-core/src/main/java/org/springframework/richclient/application/setup/SetupIntroWizardPage.java
ffec1b92bcc7178c2ae85f719f07879be340a0a5
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
danilovalente/spring-richclient
1c1a6d8c5c1b807489a35861c6972a7b9ed8b02a
8a6540f1a1a25e2baa8f4f52b1a5e91988e07d50
refs/heads/master
2022-12-23T05:03:54.745051
2020-02-04T20:29:15
2020-02-04T20:29:15
9,326,865
2
2
Apache-2.0
2022-12-16T15:23:31
2013-04-09T17:15:25
Java
UTF-8
Java
false
false
2,796
java
package org.springframework.richclient.application.setup; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.RenderingHints; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import org.springframework.richclient.layout.GridBagLayoutBuilder; import org.springframework.richclient.util.LabelUtils; import org.springframework.richclient.wizard.AbstractWizardPage; /** * @author cro */ public class SetupIntroWizardPage extends AbstractWizardPage { private static final Color TITLE_COLOR = new Color(48, 48, 48); public SetupIntroWizardPage() { super("intro"); } protected JComponent createControl() { GridBagLayoutBuilder builder = new GridBagLayoutBuilder(); builder.setDefaultInsets(new Insets(10, 20, 0, 0)); builder.append(createWelcomeToLabel(), 1, 1, true, false); builder.nextLine(); builder.append(createTitleLabel(), 1, 1, true, false, new Insets(10, 20, 15, 0)); builder.nextLine(); builder.append(createDescriptionLabel(), 1, 1, true, false); builder.nextLine(); builder.append(createSpacer(0, 0), 1, 1, true, true); JPanel control = builder.getPanel(); control.setOpaque(false); return control; } protected JLabel createTitleLabel() { JLabel bigTitleLabel = new JLabel(getMessage("setup.intro.title")) { public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); super.paintComponent(g2); } }; Font font = new Font(bigTitleLabel.getFont().getFontName(), Font.BOLD, 22); bigTitleLabel.setFont(font); bigTitleLabel.setForeground(TITLE_COLOR); return bigTitleLabel; } private JLabel createWelcomeToLabel() { JLabel welcomeToLabel = new JLabel(this.getMessage("setup.intro.welcomeTo")); Font font = new Font(welcomeToLabel.getFont().getFontName(), Font.BOLD, welcomeToLabel.getFont().getSize()); welcomeToLabel.setFont(font); welcomeToLabel.setForeground(TITLE_COLOR); return welcomeToLabel; } private JLabel createDescriptionLabel() { return new JLabel(LabelUtils.htmlBlock(getMessage("setup.intro.description"))); } private JComponent createSpacer(final int x, final int y) { JPanel spacer = new JPanel() { public Dimension getPreferredSize() { return new Dimension(x, y); } }; spacer.setOpaque(false); return spacer; } }
[ "valente.danilo@gmail.com" ]
valente.danilo@gmail.com
7639cdb7a03c198853edb7da8f53990fdb349a59
b7b9bbac778f673cf09c8e6e0ce736631ee11607
/componentlib/src/main/java/com/frame/component/router/ui/IComponentRouter.java
8575a39b6ea52e34769f863c0a848aabcbe914e4
[]
no_license
inins/ww
76c806f3911901b801b13717a9a9ed8e0611246a
ef23eec31adfcba96ede97509ee2250d225cf95e
refs/heads/master
2020-03-22T20:56:47.329517
2018-07-11T09:01:02
2018-07-11T09:01:02
140,644,718
0
0
null
null
null
null
UTF-8
Java
false
false
826
java
package com.frame.component.router.ui; import android.content.Context; import android.net.Uri; import android.os.Bundle; /** * router behaviors for component type * Created by mrzhang on 2017/6/20. */ public interface IComponentRouter { /** * 打开一个链接 * * @param url 目标url可以是http 或者 自定义scheme * @param bundle 打开目录activity时要传入的参数。建议只传基本类型参数。 * @return 是否正常打开 */ boolean openUri(Context context, String url, Bundle bundle); boolean openUri(Context context, Uri uri, Bundle bundle); boolean openUri(Context context, String url, Bundle bundle, Integer requestCode); boolean openUri(Context context, Uri uri, Bundle bundle, Integer requestCode); boolean verifyUri(Uri uri); }
[ "jaincjing@gmail.com" ]
jaincjing@gmail.com
e7e164515951e5af45a3a625b17f36b7af087229
12e73e7a3c4906f8d1bb4ae362e92018d6144fb0
/src/main/java/com/example/rest/security/AuthenticationException.java
828e955ec6a930e529980a78361cc71f2a2d50ce
[]
no_license
alEX860111/jersey-security
e949c465860f3dd55ebfbcde8dd1fc1304121804
4b10b1e4c8d180d487eafccba87ef0c1ca82eb7b
refs/heads/master
2016-09-01T22:24:35.961344
2015-06-02T16:40:55
2015-06-02T16:40:55
32,679,470
1
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.example.rest.security; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import com.example.rest.domain.Message; final class AuthenticationException extends WebApplicationException { private static final long serialVersionUID = 1L; public AuthenticationException(Status status, String msg) { super(msg, Response.status(status).entity(Message.create(msg)).build()); } }
[ "alex86011119@gmail.com" ]
alex86011119@gmail.com
a371aa0596b11132eedb94efb45c818336abe74c
ce14d8cb5a8cbf5cd935b20b011abc8738dd0d22
/vaadin7/src/main/java/w/wexpense/vaadin7/layout/GridPropertyFieldConfig.java
f68fd4f36e5019454cb733fd351130e79001bcda
[]
no_license
willix71/wexpenses7
97cb377abd92cb8d042fcbecda3316464f1a694a
65158b0e392904dab3e96ed93cc2cbb4d1ac1de7
refs/heads/master
2022-12-05T06:14:19.274607
2020-07-31T11:38:16
2020-07-31T11:38:16
12,802,926
0
0
null
2022-11-24T02:52:30
2013-09-13T06:25:01
Java
UTF-8
Java
false
false
2,402
java
package w.wexpense.vaadin7.layout; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.vaadin.ui.Component; import com.vaadin.ui.GridLayout; public class GridPropertyFieldConfig<T> extends PropertyFieldConfig<T> { private static final Logger LOGGER = LoggerFactory.getLogger(GridPropertyFieldConfig.class); public static class Incrementer { private int currentX, currentY; public void newLine() {currentX=0;currentY++;} public Position add() { return add(1,1); } public Position add(int width) { return add(width,1); } public Position add(int width, int height) { Position p = new Position(currentX,currentY,currentX+width-1,currentY+height-1); currentX+=width; return p; } } public static class Position { private int x1, y1, x2, y2; public Position(int col, int row) { this(col,row,col,row); } public Position(int col, int row, int colEnd, int rowEnd) { this.x1 = col; this.y1 = row; this.x2 = colEnd; this.y2 = rowEnd; } @Override public boolean equals(Object arg0) { if (arg0 != null && arg0 instanceof Position) { Position other = (Position) arg0; return x1==other.x1 && y1==other.y1 && x2==other.x2 && y2==other.y2; } return false; } @Override public String toString() { return String.format("[%1$d,%2$d-%3$d,%4$d]",x1,y1,x2,y2); } } private Position position; public GridPropertyFieldConfig(GridLayout layout, Object id, Position position) { super(layout, id); this.position = position; } public GridPropertyFieldConfig(GridLayout layout, Object id, int col, int row) { this(layout, id, col, row, col, row); } public GridPropertyFieldConfig(GridLayout layout, Object id, int col, int row, int colEnd, int rowEnd) { this(layout, id, new Position(col,row,colEnd,rowEnd)); } @Override public void addToLayout(Component c) { LOGGER.info("Adding component for " + getId() + " at " + position); ((GridLayout) getLayout()).addComponent( c, position.x1, position.y1, position.x2, position.y2); } }
[ "willix71@gmail.com" ]
willix71@gmail.com
614cc54e6369210614754bb4aa19ed475c712812
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_c25dfcb9356605579cbbc91619991387597b03dc/GraphicFileUtilities/9_c25dfcb9356605579cbbc91619991387597b03dc_GraphicFileUtilities_s.java
034a7933269082eb7349d8d511115750b4f84a61
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
13,874
java
/* * Copyright (C) 2003 Central Laboratory of the Research Councils * * History: * 14-FEB-2001 (Peter W. Draper): * Original version. */ package uk.ac.starlink.splat.util; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.IOException; import java.util.Iterator; import javax.imageio.ImageIO; import javax.imageio.ImageWriter; import javax.imageio.stream.ImageOutputStream; import javax.imageio.ImageWriteParam; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import uk.ac.starlink.ast.gui.DecimalField; import uk.ac.starlink.ast.gui.ScientificFormat; import uk.ac.starlink.util.gui.GridBagLayouter; /** * This class provides any graphic file utilities used in SPLAT. At present * this consists of the ability to print a given JComponent to a JPEG * file or a PNG file using the standard ImageIO facilities of Java2D. * <p> * * @author Peter W. Draper * @version $Id$ */ public class GraphicFileUtilities { /** Print to JPEG files */ final public static int JPEG = 1; /** Print to PNG files */ final public static int PNG = 2; /** * Display a dialog window to choose a file and print either a JPEG or PNG * to it. Offers the options to define the width and height and whether * to fit to the choosen width and height. The default width and * height are defined as the size of the a given component. */ public static void showGraphicChooser( JComponent component ) { GraphicsChooser chooser = new GraphicsChooser( component ); chooser.setVisible( true ); if ( chooser.accepted() ) { printGraphics( chooser.getFormat(), chooser.getFile(), component, chooser.getWidth(), chooser.getHeight(), chooser.getFit() ); } } /** * Create a JPEG or PNG file from the contents of a JComponent. * * @param format the format to print, JPEG or PNG. * @param outputFile the output file. * @param component the component to print * @param width the width of the graphics * @param height the height of the graphics * @param fit whether to scale the width and height of the component * to fit. Normally you should pass width and height as * the size of the component. */ public static void printGraphics( int format, File outputFile, JComponent component, int width, int height, boolean fit ) { // Get a BufferedImage to draw graphics in. BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB ); // Get the Graphics2D object needed to render into this. Graphics2D g2d = image.createGraphics(); // Scale the graphics to fit the width and height if requested. if ( fit ) { fitToWidthAndHeight( g2d, component, width, height ); } // Now make the JComponent draw into this. component.print( g2d ); g2d.dispose(); // And write this to the file format we need. try { OutputStream os = new FileOutputStream( outputFile ); if ( format == JPEG ) { write( image, "JPEG", os ); } else { write( image, "PNG", os ); } os.close(); } catch (Exception e) { e.printStackTrace(); } } /** * Write a BufferedImage to an output stream. Format should be a writable * format supported by the imageio facilities (currently JPEG and PNG). */ protected static void write( BufferedImage image, String format, OutputStream os ) throws SplatException { try { boolean supported = ImageIO.write( image, format, os ); if ( ! supported ) { throw new SplatException( "Failed to write image, " + "no support available for " + format + " format" ); } } catch (IOException e) { throw new SplatException( "Failed to write "+format+" image", e ); } } /** * Scale the current graphic so that it fits within the * given width and height. */ static protected void fitToWidthAndHeight( Graphics2D g2, JComponent component, int width, int height ) { double compWidth = (double) component.getWidth(); double compHeight = (double) component.getHeight(); double xscale = (double)width / compWidth; double yscale = (double)height / compHeight; if ( xscale < yscale ) { yscale = xscale; } else { xscale = yscale; } // Apply the scale. g2.scale( xscale, yscale ); } // // Internal class for choosing a JPEG filename and selecting from // a set of common options. // static class GraphicsChooser extends JDialog { /** Whether exit request was OK, otherwise cancel. */ protected boolean accepted = false; /** The dialog contentpane. */ protected JPanel contentPane; /** Accept and exit button. */ protected JButton okButton = new JButton(); /** Cancel and exit button. */ protected JButton cancelButton = new JButton(); /** Scale graphics to fit the image. */ protected JCheckBox fitButton = new JCheckBox(); /** X dimension for output file. */ protected DecimalField xSize = null; /** Y dimension for output file. */ protected DecimalField ySize = null; /** Name of the output file. */ protected JTextField fileName = new JTextField(); /** The graphic file format */ protected JComboBox format = new JComboBox(); /** * Construct an instance with default configuration. */ public GraphicsChooser( JComponent component ) { super(); setModal( true ); setTitle( Utilities.getTitle( "Print to graphics file" ) ); init( component ); } /** * Construct an instance, setting the parent, window title and * whether the dialog is modal. */ public GraphicsChooser( JComponent component, Frame owner, String title, boolean modal) { super( owner, title, modal ); init( component ); } /** * Start common initialisation sequence. */ protected void init( JComponent component ) { enableEvents( AWTEvent.WINDOW_EVENT_MASK ); try { initUI( component ); } catch(Exception e) { e.printStackTrace(); } this.accepted = false; } /** * Initialise the user interface. */ private void initUI( JComponent component ) { // Get the dialog content pane and set the layout manager. contentPane = (JPanel) this.getContentPane(); contentPane.setLayout( new BorderLayout() ); contentPane.setBorder ( BorderFactory.createEmptyBorder( 10, 10, 10, 10 ) ); // Configure and populate the controls for selecting // size and name options. JPanel centrePanel = new JPanel(); centrePanel.setBorder(BorderFactory.createTitledBorder ("Graphics image properties")); GridBagLayouter layouter = new GridBagLayouter( centrePanel, GridBagLayouter.SCHEME3 ); layouter.setInsets( new Insets( 5, 5, 5, 5 ) ); // Select the graphics format. format.addItem( "JPEG" ); format.addItem( "PNG" ); layouter.add( "Graphic format:" , false ); layouter.add( format, true ); // Choose whether to scale to fit. fitButton.setSelected( false ); layouter.add( "Scale to fit:", false ); layouter.add( fitButton, true ); fitButton.setToolTipText ( "Scale plot graphics to fit the width and height" ); // Offer size of output image in pixels. ScientificFormat scientificFormat = new ScientificFormat(); xSize = new DecimalField( 0, 10, scientificFormat ); xSize.setIntValue( component.getWidth() ); layouter.add( new JLabel( "X size:" ), false ); layouter.add( xSize, true ); xSize.setToolTipText( "Width, in pixels, of the "+ "output image (default is actual size" ); scientificFormat = new ScientificFormat(); ySize = new DecimalField( 0, 10, scientificFormat ); ySize.setIntValue( component.getHeight() ); layouter.add( new JLabel( "Y size:" ), false ); layouter.add( ySize, true ); ySize.setToolTipText( "Height, in pixels, of the "+ "output image (default is actual size" ); // Get a name for the file. fileName.setText( Utilities.getApplicationName() ); layouter.add( new JLabel( "Output file:" ), false ); layouter.add( fileName, true ); fileName.setToolTipText ( "Name for the output file (without extension)" ); layouter.eatSpare(); // Configure and place the OK and Cancel buttons. JPanel buttonPanel = new JPanel(); buttonPanel.setBorder( BorderFactory.createEmptyBorder(10,10,0,0)); buttonPanel.setLayout( new BoxLayout( buttonPanel, BoxLayout.X_AXIS ) ); buttonPanel.add( Box.createHorizontalGlue() ); buttonPanel.add( okButton ); buttonPanel.add( Box.createHorizontalGlue() ); buttonPanel.add( cancelButton ); buttonPanel.add( Box.createHorizontalGlue() ); // Set various close window buttons. okButton.setText( "OK" ); okButton.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { closeWindow( true ); } }); okButton.setToolTipText( "Press to create the graphics file" ); cancelButton.setText( "Cancel" ); cancelButton.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { closeWindow( false ); } }); cancelButton.setToolTipText ( "Press to cancel creation of graphics file" ); // Add main panels to contentPane. contentPane.add( buttonPanel, BorderLayout.SOUTH ); contentPane.add( centrePanel, BorderLayout.CENTER ); pack(); } /** * Return the exit status of the dialog. */ public boolean accepted() { return accepted; } /** * Return whether user opted for scaling the graphic to fit. */ public boolean getFit() { return fitButton.isSelected(); } /** * Return the width of the output file. */ public int getWidth() { return xSize.getIntValue(); } /** * Return the height of the output file. */ public int getHeight() { return ySize.getIntValue(); } /** * Return the name of the output file. */ public File getFile() { String extension = ".jpg"; if ( format.getSelectedIndex() == 1 ) { extension = ".png"; } return new File( fileName.getText() + extension ); } /** * Get the format. */ public int getFormat() { return ( format.getSelectedIndex() + 1 ); } /** * Close the window. If argument is true then the result is accepted. */ protected void closeWindow( boolean accepted ) { this.accepted = accepted; setVisible( false ); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
65f66f31032266121e65153ce948cf617639903d
44274a3bb6649f527bde1d70321a4db5685bdd51
/app/src/main/java/com/example/photogallery/Model/GallleryItem.java
f5515ad0acbce7d942a254b6f93ecb14d33e4d53
[]
no_license
yeecai/PhotoGallery
23873bdd9cac4c666553329ed454a323255afc26
cee2cfef7bb108452a3f7ad0332052264dbe16e1
refs/heads/master
2020-07-01T11:13:54.134532
2019-08-20T08:24:29
2019-08-20T08:24:29
201,158,275
0
0
null
null
null
null
UTF-8
Java
false
false
3,159
java
package com.example.photogallery.Model; import android.net.Uri; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Helper class for providing sample content for user interfaces created by * Android template wizards. * <p> * TODO: Replace all uses of this class before publishing your app. */ public class GallleryItem { /** * An array of sample (Model) items. */ public static final List<GalleryItem> ITEMS = new ArrayList<GalleryItem>(); /** * A map of sample (Model) items, by ID. */ public static final Map<String, GalleryItem> ITEM_MAP = new HashMap<String, GalleryItem>(); private static final int COUNT = 25; /* static { // Add some sample items. for (int i = 1; i <= COUNT; i++) { addItem(createGalleryItem(i)); } }*/ private static void addItem(GalleryItem item) { ITEMS.add(item); ITEM_MAP.put(item.mId, item); } /* private static GalleryItem createGalleryItem(int position) { return new GalleryItem(String.valueOf(position), "Item " + position, makeDetails(position)); }*/ private static String makeDetails(int position) { StringBuilder builder = new StringBuilder(); builder.append("Details about Item: ").append(position); for (int i = 0; i < position; i++) { builder.append("\nMore details information here."); } return builder.toString(); } public static class GalleryItem { private String mCaption; private String mId; private String mUrl; private String mOwner; /* public GalleryItem(String valueOf, String s, String makeDetails) { this.mCaption = mCaption; this.mId = mId; this.mUrl = mUrl; }*/ /* public GalleryItem(String mCaption, String mId, String mUrl) { this.mCaption = mCaption; this.mId = mId; this.mUrl = mUrl; }*/ @Override public String toString() { return mCaption; } public String getmCaption() { return mCaption; } public void setmCaption(String mCaption) { this.mCaption = mCaption; } public String getmId() { return mId; } public void setmId(String mId) { this.mId = mId; } public String getmUrl() { return mUrl; } public void setmUrl(String mUrl) { this.mUrl = mUrl; } public String getmOwner() { return mOwner; } public void setmOwner(String mOwner) { this.mOwner = mOwner; } public Uri getPhotoPageUri() { String PHOTOPOINT = "https://www.flickr.com/photos/"; return Uri.parse(PHOTOPOINT) .buildUpon() .appendPath(mOwner) .appendPath(mId) .build(); // return "https://www.flickr.com/photos/147421450@N06/48573169091"; } } }
[ "yushunchn@gmail.com" ]
yushunchn@gmail.com
5667e39eb5d1e17e84a73c09597725bd4334effd
570c485728ff0fd4832891cd1072d35274801f0c
/src/lineage/Ins_cell.java
33aec84c67da45bc6cec6451e24151529639392e
[]
no_license
maincover/MotherMachine
e45873e48ad4eeaa64a276340e430d6a2553124e
0be96067d71e66a98783c064bd157d6f501f65fb
refs/heads/master
2020-03-07T09:17:41.206173
2018-11-27T13:23:31
2018-11-27T13:23:31
127,404,085
0
0
null
null
null
null
UTF-8
Java
false
false
32,589
java
package lineage; import ij.IJ; import ij.ImagePlus; import ij.gui.Arrow; import ij.gui.PointRoi; import ij.gui.PolygonRoi; import ij.gui.Roi; import ij.gui.ShapeRoi; import ij.gui.Wand; import ij.plugin.filter.BackgroundSubtracter; import ij.process.ByteProcessor; import ij.process.ImageProcessor; import java.awt.Color; import java.awt.Rectangle; import java.util.Arrays; import java.util.Vector; import Ij_Plugin.Ins_find_peaks; //import Ij_Plugin.Ins_find_peaks; public class Ins_cell implements Comparable{ private int slice; private int height; private int width; private double skeletonLength; private int[] position; private int timeIndex; private int cell_num=-1; private Roi roi; private Roi roi1; private Roi roi2; private String label; protected String name; protected String time="-1"; private boolean vitrualState=false; protected double eGrowthRate; protected double pGrowthRate; protected double cGrowthDiff; protected double growthDiff; protected double sumIntensity=0; protected double meanIntensity = 0; protected double[] meanIntensityArray= null; protected double medianIntensity = 0; protected double meanIntensityBackground=0; protected double area=0; protected double[] areaArray; //protected double bgIntensity = 0; protected Ins_cell nextTopCell=null; protected Ins_cell nextBottomCell=null; protected Ins_cell parent=null; protected Arrow arrowToTop=null; protected Arrow arrowToBottom=null; protected Ins_cell nextCell=null; protected Arrow arrowToNext=null; protected Ins_cell previousCell = null; protected Ins_cell previousLowerCell = null; protected boolean ifLastCell =false; //protected boolean ifdevidedNextFrame; protected boolean ifdevidedFromPreviousCell = false; protected String type ="NO"; //0-comet 1-dot 2-comet&dot -1-to be defined protected int typeIndex; protected Foci[] foci; protected Comet[] comet; protected double sumFCintensity = 0; protected int numFoci=0; protected int numComet=0; private Color pointToNext = null; protected double xCentroid; protected double yCentroid; protected boolean identifyFC; protected String fociInfo = ""; protected String cometInfo = ""; protected String cellInfo=""; protected int split_current_cell = 0; protected int merge_previous_cell = 0; protected boolean mergedByOr = false; protected boolean manulTrackingCell = false; private boolean errorSegmentation = false; private double min; private double max; private double h5; private double h25; private boolean split; private boolean filamentChecked; private boolean filamentation; private int cellID = 0; private Roi[] aggRois; private String[][] aggInfo; private PointRoi[] pointRois; int pR = 0; int aR = 0; private double meanGFP; private double medianGFP; private boolean findFoci = false; private boolean isFoci = false; private Ins_cell[] attachedCell; private boolean roiAdded = false; private int divideNext = 0; public double[] fourierDesc; private double medianBG; private double medianBGAgg; private boolean theEnd = false; public Ins_cell(Roi roi) { if(roi == null) this.label = "Root Parent"; else { this.label = roi.getName(); this.slice = roi.getPosition(); this.height = roi.getBounds().height; this.width = roi.getBounds().width; this.roi = roi; this.meanIntensityArray = new double[1]; this.areaArray = new double[1]; this.parent = null; aggRois = new Roi[10]; pointRois = new PointRoi[10]; position = new int[]{roi.getBounds().x,roi.getBounds().y}; if(position == null) timeIndex = -1; else timeIndex=Lineage.computeTimeIndex(position[0] + roi.getBounds().width*0.5); } } public double getArea() { return areaArray[0]; } public int setAreaToAreaArray(double area) { if(areaArray == null) return -1; if(area == 0) return -1; for(int i=0; i<areaArray.length;i++) { if(areaArray[i] != 0) continue; areaArray[i] = area; return i; } return -1; } public boolean getIfSplit() { return split; } public void setIntensityToMeanIntensityArray(double intensity, int index) { if(index < 0) return; if(meanIntensityArray == null || index >= meanIntensityArray.length) return; meanIntensityArray[index] = intensity; } public void setMedianIntensity(double intensity) { this.medianIntensity = intensity; } public void setArea(double area) { this.area = area; } public void setMeanIntensity(double intensity) { this.meanIntensity = intensity; } private void setFociIntensity() { float sumAreaFC = 0; if(foci !=null) { for(int i=0;i<foci.length;i++) { if(foci[i]!=null) { numFoci ++; sumFCintensity = sumFCintensity+foci[i].sumIntensity; sumAreaFC = sumAreaFC + foci[i].area; } } } if(comet!=null) { for(int i=0;i<comet.length;i++) { if(comet[i]!=null) { numComet ++; sumFCintensity = sumFCintensity+comet[i].sumIntensity; sumAreaFC = sumAreaFC + comet[i].area; } } } this.meanIntensityBackground = (sumIntensity - sumFCintensity)>0?(sumIntensity - sumFCintensity)/(area-sumAreaFC):0; setType(); } public void setAsVirtualCell() { this.vitrualState = true; } public boolean getDeadState() { return this.vitrualState; } /** * * @param roi * @param xCentroid * @param yCentroid * @param area * @param sumIntensity */ public Ins_cell(Roi roi,double xCentroid, double yCentroid,double area,double sumIntensity) { this.roi = roi; this.height = roi.getBounds().height; this.label = roi.getName(); this.position = new int[]{roi.getBounds().x,roi.getBounds().y}; this.xCentroid = xCentroid; this.yCentroid = yCentroid; this.area = area; this.sumIntensity = sumIntensity; } public void copy(Ins_cell cell) { this.timeIndex = cell.timeIndex; this.identifyFC = cell.identifyFC; if(identifyFC) { Foci[] focis = new Foci[cell.foci.length]; for(int i=0;i<foci.length;i++) { if(foci[i]==null) continue; double[] xy= foci[i].center; if(roi.contains((int)xy[0],(int)xy[1])) { focis[i] = new Foci(foci[i]); } } this.foci = focis; setFociIntensity(); } } public void setSkeletonLength(double length) { this.skeletonLength = length; } public void setLabel(String label) { this.label = label; } private void setType() { if(numFoci >0 && numComet == 0) type = "F"; else if(numFoci == 0 && numComet > 0) type = "C"; else if(numFoci > 0 && numComet > 0) type = "FC"; } public Roi getRoi() { return roi; } public void setRoi(Roi roi) { roi.setPosition(slice); roi.setName(label); roi.setStrokeColor(roi.getStrokeColor()); this.height = roi.getBounds().height; this.width = roi.getBounds().width; this.position = new int[]{roi.getBounds().x,roi.getBounds().y}; this.roi = roi; } public void setCentroid(double xc, double yc) { this.xCentroid = xc; this.yCentroid = yc; } public double getYcenter() { return roi.getBounds().y + roi.getBounds().height*0.5; } public Arrow getLeftArrow() { return arrowToTop; } public Arrow getRightArrow() { return arrowToBottom; } public void setLeftArrow(Arrow toLeft) { this.arrowToTop = toLeft; } public void setRightArrow(Arrow toRight) { this.arrowToBottom = toRight; } public void setParentRoi(Ins_cell parent) { this.parent = parent; } public Ins_cell getParent() { return parent; } public String getLabel() { return label; } public String getName() { return name; } public double getEstimatedGrowthRate() { return eGrowthRate; } public double getPresumedGrowthRate() { return pGrowthRate; } public void setEstimatedGrowthRate(double growthRate) { this.eGrowthRate = growthRate; } public void setPresumedGrowthRate(double growthRate) { this.pGrowthRate = growthRate; } public void setGrowthDiff(double growthDiff) { this.growthDiff = growthDiff; } public void setGrowthCDiff(double cGrowthDiff) { this.cGrowthDiff = cGrowthDiff; } public double getGrowthDiff() { return this.growthDiff; } public double getGrowthCDiff() { return this.cGrowthDiff; } public void setName(String name) { this.name = name; } public int getSlice(){ return slice; } // public void setTimeIndex1(int time){ // this.timeIndex = time; // } public void setTime(String time){ this.time = time; } public int getTimeIndex() { return this.timeIndex; } public int[] getPosition(){ return position; } public void setCellNumber(int num){ cell_num = num; } public int getCellNumber() { return cell_num; } /** * Not useful for correction of segmentation * @param lastCell */ public void setifLastCell(int currentVectorSize) { if(currentVectorSize == cell_num) ifLastCell = true; } public int getHeight() { return height; } public void setPointNextColor(Color c) { this.pointToNext = c; } public Color getPointNextColor() { return pointToNext; } public String toString() { int last = 0; if(ifLastCell) last = 1; cellInfo = label+"\t"+ last+"\t"+ name+"\t" + timeIndex+"\t"+ time+"\t"+ cell_num+"\t"+ height+"\t"+ skeletonLength+"\t"+ sumIntensity + "\t"+ meanIntensityBackground + "\t"+ area + "\t"+ xCentroid + "\t"+ yCentroid + "\t"+ type+ "\t" + (ifdevidedFromPreviousCell ? "1":"0")+ "\t"; if(foci != null) for(int i=0;i<foci.length;i++) { if(foci[i]!=null) { fociInfo = fociInfo+cellInfo+"F" +"\t" + String.valueOf(numFoci)+ "\t" + String.valueOf(numComet)+ "\t" + foci[i].label + "\t" + String.valueOf(foci[i].area)+ "\t" + String.valueOf(foci[i].meanIntensity)+ "\t" + String.valueOf(foci[i].radius)+ "\t" + String.valueOf(foci[i].center[0]) + "\t" + String.valueOf(foci[i].center[1]) + "\t" + String.valueOf(foci[i].reletiveCenterToCell[0])+"\t" + String.valueOf(foci[i].reletiveCenterToCell[1])+ "\t"+ "\r"+"\n"; } } if(comet != null) for(int i=0;i<comet.length;i++) { if(comet[i]!=null) { cometInfo = cometInfo+cellInfo+"C" + "\t" + String.valueOf(numFoci)+ "\t" + String.valueOf(numComet)+"\t" + comet[i].label+"\t" + String.valueOf(comet[i].area)+ "\t" + String.valueOf(comet[i].meanIntensity)+ "\t" + String.valueOf(comet[i].length)+ "\t" + String.valueOf(comet[i].center[0]) + "\t" + String.valueOf(comet[i].center[1]) + "\t" + String.valueOf(comet[i].reletiveCenterToCell[0]) + "\t" + String.valueOf(comet[i].reletiveCenterToCell[1])+"\t"+ "\r"+"\n"; } } if(type.equals("NO")) return cellInfo+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"NA"+"\t"+"\r"+"\n"; else return fociInfo + cometInfo; } public String toString2() { int last = 0; if(ifLastCell) last = 1; return (label+"\t"+ last+"\t"+ name+"\t" + timeIndex+"\t"+ time+"\t"+ cell_num+"\t"+ height+"\t"+ xCentroid + "\t"+ yCentroid + "\t"+ cellID + "\n"); } public String toStringYifan() { int last = 0; if(ifLastCell) last = 1; String areaMeanintensity = ""; if(areaArray!=null) for(int i=0; i<areaArray.length; i++) { areaMeanintensity = areaMeanintensity +areaArray[i]+"\t"+ meanIntensityArray[i] + "\t"; } // if(filamentation) // System.out.println("filamentation detected"); int filam = filamentation?1:0; return (label+"\t"+ last+"\t"+ name+"\t" + timeIndex+"\t"+ // time+"\t"+ cell_num+"\t"+ // deadCell+"\t"+ height+"\t"+ xCentroid + "\t"+ yCentroid + "\t"+ area + "\t" + meanIntensity + "\t"+ medianIntensity+ "\t"+ min + "\t"+ max + "\t"+ h5 + "\t"+ h25 + "\n"); } public String toStringAntoine() { int last = 0; if(ifLastCell) last = 1; String areaMeanintensity = ""; if(areaArray!=null) for(int i=0; i<areaArray.length; i++) { areaMeanintensity = areaMeanintensity +areaArray[i]+"\t"+ meanIntensityArray[i] + "\t"; } // if(filamentation) // System.out.println("filamentation detected"); int filam = filamentation?1:0; cellInfo = label+"\t"+ last+"\t"+ name+"\t" + timeIndex+"\t"+ cell_num+"\t"+ height+"\t"+ xCentroid + "\t"+ yCentroid + "\t"+ area + "\t" + meanIntensity + "\t"+ medianIntensity+ "\t"+ min + "\t"+ max + "\t"+ h5 + "\t"+ h25 + "\t"+ filam + "\t"+ cellID + "\t"+ divideNext + "\t" + medianBG + "\t"+ meanGFP + "\t" + medianGFP + "\t" + medianBGAgg + "\t"; String aggString = ""; if(aggInfo!=null) { for(int i=0;i<aggInfo.length;i++) { if(aggInfo[i]!=null) { aggString = aggString+cellInfo+aggInfo.length+"\t" + String.valueOf(aggInfo[i][0])+"\t" + String.valueOf(aggInfo[i][1])+"\t" + String.valueOf(aggInfo[i][2])+"\t" + String.valueOf(aggInfo[i][3])+"\t" + String.valueOf(aggInfo[i][4])+"\t" + "\r"+"\n"; } } }else { aggString = aggString+cellInfo+String.valueOf(0)+"\t" + String.valueOf(0)+"\t" + String.valueOf(0)+"\t" + String.valueOf(0)+"\t" + String.valueOf(0)+"\t" + String.valueOf(0)+"\t" + "\r"+"\n"; } if(aggString!="") return aggString; else { return cellInfo + "\r" + "\n"; } } @Override public int compareTo(Object o) { if (slice < ((Ins_cell) o).slice) { return -1; }else if (slice > ((Ins_cell) o).slice) { return 1; }else { if (timeIndex < ((Ins_cell) o).timeIndex) { return -1; }else if (timeIndex > ((Ins_cell) o).timeIndex) { return 1; }else { if(position[1]+height/2 <((Ins_cell) o).position[1]+ ((Ins_cell) o).height/2){ return -1; }else if(position[1]+height/2 >((Ins_cell) o).position[1]+ ((Ins_cell) o).height/2){ return 1; }else { if(position[0] < ((Ins_cell) o).position[0]) return -1; else { return 1; } } } } } public void setError() { errorSegmentation = true; } public boolean getError(){ return errorSegmentation; } public boolean mergeCell3(Ins_cell cell2, int openNumber, String name,Ins_cellsVector[] cellsTimeIndex) { if(cell2==null || cell2.getRoi()==null) return false; ImageProcessor ip1 = roi.getMask(); ImageProcessor ip2 = cell2.getRoi().getMask(); int x1 = getPosition()[0]; int y1 = getPosition()[1]; int width1 = ip1.getWidth(); int height1 = ip1.getHeight(); int x2 = cell2.getPosition()[0]; int y2 = cell2.getPosition()[1]; int width2 = ip2.getWidth(); int height2 = ip2.getHeight(); int enlarge = 30; int width = Math.max(x1+width1, x2+width2) - Math.min(x1, x2); width = width + enlarge; int height = Math.max(y1+height1, y2+height2) - Math.min(y1, y2); height = height + enlarge; ImagePlus imp = IJ.createImage(getLabel(), "8-bit black", width, height, 1); ImageProcessor ip = imp.getProcessor(); int xloc1 = x1-x2>0?x1-x2:0; int yloc1 = y1-y2>0?y1-y2:0; ip.insert(ip1, xloc1+enlarge/2, yloc1+enlarge/2); int xloc2 = x2-x1>0?x2-x1:0; int yloc2 = y2-y1>0?y2-y1:0; ip.insert(ip2, xloc2+enlarge/2, yloc2+enlarge/2); ip.invert(); //imp.duplicate().show(); // first open process ip.erode(); ip.dilate(); for(int i=0;i<openNumber;i++) { ip.dilate(); } for(int i=0;i<openNumber;i++) { ip.erode(); } //imp.show(); //merging finished, change lineage map for(int i=enlarge/2;i<ip.getWidth();i++) for(int j=enlarge/2;j<ip.getHeight();j++) { if(ip.get(i, j)==0) { xloc1 = i; yloc1 = j; break; } } Wand wand = new Wand(ip); wand.autoOutline(xloc1, yloc1); int x_insert = x1<x2?x1:x2; int y_insert = y1<y2?y1:y2; int nPoints = wand.npoints; int[] X = new int[nPoints]; int[] Y = new int[nPoints]; for(int i=0;i<nPoints;i++) { X[i] = wand.xpoints[i]+x_insert - enlarge/2; Y[i] = wand.ypoints[i]+y_insert - enlarge/2; } try { PolygonRoi roi_merge = new PolygonRoi(X, Y, nPoints, roi.getType()); roi_merge.setPosition(this.slice); roi_merge.setStrokeColor(new Color(0,255,0)); this.setRoi(roi_merge); Ins_cellsVector currentVector = cellsTimeIndex[getTimeIndex()]; Vector<Ins_cell> cVector = currentVector.getCellVector(); cVector.remove(cell2); /* this.previousCell.nextTopCell = null; this.previousCell.nextBottomCell = null; this.previousCell.nextCell = this;*/ setName(name); return true; } catch (Exception e) { return false; } } public boolean mergeCell(Ins_cell cell2,Ins_cellsVector[] cellsTimeIndex,Color color) { if(cell2==null || cell2.getRoi()==null) return false; Roi nRoi = new Roi(roi.getBounds().x, roi.getBounds().y, roi.getBounds().width, cell2.getRoi().getBounds().y + cell2.getRoi().getBounds().height - roi.getBounds().y); nRoi.setPosition(this.slice); nRoi.setStrokeColor(color); nRoi.setName(label); this.setRoi(nRoi); Ins_cellsVector currentVector = cellsTimeIndex[getTimeIndex()]; Vector<Ins_cell> cVector = currentVector.getCellVector(); cVector.remove(cell2); return true; } // public boolean mergeCell(Ins_cell cell2, String name,Ins_cellsVector[] cellsTimeIndex,ImageProcessor ip) { // if(cell2==null || cell2.getRoi()==null) // return false; // ShapeRoi s1 = new ShapeRoi(roi); // ShapeRoi s2 = new ShapeRoi(cell2.roi); // s1.or(s2); // Roi s3 = Ins_seg_panel.refineRoi(s1, ip, s1.getBounds().x, false,false); // if(s3 == null) // s3 = s1; // System.out.println("merge roi and refinement"); // s3.setPosition(this.slice); // s3.setStrokeColor(new Color(0,255,0)); // this.setRoi(s3); // Ins_cellsVector currentVector = cellsTimeIndex[getTimeIndex()]; // Vector<Ins_cell> cVector = currentVector.getCellVector(); // cVector.remove(cell2); // /* this.previousCell.nextTopCell = null; // this.previousCell.nextBottomCell = null; // this.previousCell.nextCell = this;*/ // setName(name); // roi1 = (Roi)roi.clone(); // roi1.setName("split r1"); // roi2 = (Roi)cell2.getRoi().clone(); // roi2.setName("split r2"); // mergedByOr = true; // return true; // /*} catch (Exception e) { // return false; // }*/ // // } public void divideCell(ImageProcessor ip,Ins_cellsVector[] cellsTimeIndex) { BackgroundSubtracter bSubtracter = new BackgroundSubtracter(); bSubtracter.rollingBallBackground(ip, 40, false, false, false, false, false); ImagePlus[] eigenImp = (new featureJ.FJ_Structure()).getEigenImg(new ImagePlus("", ip),"1.0","3.0"); ImagePlus impPlotProfile = eigenImp[1]; //smallest Eigen Image impPlotProfile.getProcessor().convertToByte(true); double ratio = 0.3; int roi_width = this.getRoi().getBounds().width; int height = this.getRoi().getBounds().height; double[] profile = Lineage.getRowMedianProfile(new Rectangle((int)Math.ceil(roi_width*(1-ratio)*0.5), 0, (int)(roi_width*ratio), height), impPlotProfile.getProcessor()); double[] profile1 = new double[profile.length]; for(int p=0; p<profile.length; p++) { double sum = 0; for(int q=p-2; q<p+3; q++) { if(q<0 || q>=profile.length) continue; sum = sum + profile[q]; } profile1[p] = sum; } profile = profile1; int tolerance = 135; int minPeakDist = 12; int[] position = null; Ins_cellsVector currentVector = cellsTimeIndex[getTimeIndex()]; while (tolerance > 0) { Ins_find_peaks peakFinder = new Ins_find_peaks(tolerance, minPeakDist); Object[] out = peakFinder.findPeaks(profile, true, 6); position = (int[])out[0]; Arrays.sort(position); int[] newPos = new int[position.length]; int t=0; for(int j=0;j<position.length;j++) { if(position[j] < minPeakDist || position[j] > profile.length - minPeakDist) //if(position[j] > profile.length - minPeakDist) continue; newPos[t++] = position[j]; } int[] newPos2 = new int[t]; System.arraycopy(newPos, 0, newPos2, 0, t); position = newPos2; if(position.length == 0) { tolerance = tolerance - 1; }else{ if (position.length == 1) position = new int[]{position[0], height}; else { int[] position2 = new int[position.length+1]; System.arraycopy(position, 0, position2, 0, position.length); position2[position2.length-1] = height; position = position2; } for(int j=0;j < position.length;j++) { Roi roi2; int h = 0; if(j==0) { roi2 = new Roi(roi.getBounds().x, roi.getBounds().y, roi_width, position[j]); roi2.setPosition(roi.getPosition()); roi2.setStrokeColor(roi.getStrokeColor()); roi2.setName(roi.getName()); this.height = roi2.getBounds().height; this.roi = roi2; }else { h = position[j] - position[j-1]; roi2 = new Roi(roi.getBounds().x, roi.getBounds().y + position[j-1], roi_width, h); roi2.setPosition(roi.getPosition()); roi2.setStrokeColor(roi.getStrokeColor()); currentVector.insertCell(new Ins_cell(roi2)); } } break; } } } public void splitCell(double ratio, Ins_cellsVector[] cellsTimeIndex) { if(!mergedByOr) { ByteProcessor ip; try { if(roi instanceof PolygonRoi) ip = (ByteProcessor)((PolygonRoi)roi).getMask(); else if (roi instanceof ShapeRoi) { ip = (ByteProcessor)((ShapeRoi)roi).getMask(); }else if (roi.getType() == Roi.RECTANGLE ) { Roi roi2 = new PolygonRoi(roi.getPolygon(), Roi.POLYGON); ip = (ByteProcessor)((PolygonRoi)roi2).getMask(); }else { return; } } catch (Exception e) { System.out.println("label : " + getLabel()); return; } //ip = (ByteProcessor)roi.getMask(); int cutY = (int)(height*ratio); for(int i=0;i<ip.getWidth();i++) { ip.set(i, cutY, 0); } ip.invert(); Wand wand_upper = new Wand(ip); Wand wand_lower = new Wand(ip); wand_upper.autoOutline(ip.getWidth()/2,(int)(cutY/2)); wand_lower.autoOutline(ip.getWidth()/2,(int)(cutY+(height-cutY)*0.5)); int nPointsUpper = wand_upper.npoints; int[] upperX = new int[nPointsUpper]; int[] upperY = new int[nPointsUpper]; for(int i=0;i<nPointsUpper;i++) { upperX[i] = wand_upper.xpoints[i]+position[0]; upperY[i] = wand_upper.ypoints[i]+position[1]; } int nPointsLower = wand_lower.npoints; int[] lowerX = new int[nPointsLower]; int[] lowerY = new int[nPointsLower]; for(int i=0;i<nPointsLower;i++) { lowerX[i] = wand_lower.xpoints[i]+position[0]; lowerY[i] = wand_lower.ypoints[i]+position[1]; } PolygonRoi roi_upper = new PolygonRoi(upperX, upperY, nPointsUpper, Roi.POLYGON); PolygonRoi roi_lower = new PolygonRoi(lowerX, lowerY, nPointsLower, Roi.POLYGON); int pos = roi.getPosition(); roi_upper.setPosition(pos); roi_lower.setPosition(pos); roi_upper.setStrokeColor(new Color(255,72,170)); roi_lower.setStrokeColor(new Color(255,72,170)); this.setRoi(roi_upper); Ins_cell lowerCell = new Ins_cell(roi_lower); Ins_cellsVector currentCellsVector = cellsTimeIndex[getTimeIndex()]; currentCellsVector.insertCell(lowerCell); }else { if(roi1!=null) this.setRoi(roi1); if(roi2!=null) { Ins_cell lowerCell = new Ins_cell(roi2); Ins_cellsVector currentCellsVector = cellsTimeIndex[getTimeIndex()]; currentCellsVector.insertCell(lowerCell); } System.out.println("Split merged ShapeRoi cells : " + roi1.getName() + "-"+roi2.getName()); } this.split = true; mergedByOr = false; } public void changeRoiSlice(int slice) { this.roi.setPosition(slice); this.roi.setStrokeColor(new Color(255, 0, 255)); this.slice = roi.getPosition(); } public void setMinIntensity(double min) { this.min = min; } public void setMaxIntensity(double max) { this.max = max; } public void setBGMedian(double medianBG){ this.medianBG = medianBG; } public void setBGAggMedian(double medianBGAgg){ this.medianBGAgg = medianBGAgg; } public void setHist5(double h5) { // TODO Auto-generated method stub this.h5 = h5; } public void setHist25(double h25) { // TODO Auto-generated method stub this.h25 = h25; } public boolean filamentChecked() { return filamentChecked; } public void setFilamentState(boolean filament, Color color) { filamentation = filament; filamentChecked = true; if(filamentation) setColor(color); else { setColor(new Color(255, 255, 0)); } } public void setColor(Color color) { roi.setStrokeColor(color); } public boolean getFilamentState() { return filamentation; } public boolean regrouped() { if(cellID != 0) return true; else { return false; } } public void setCellID(int i) { this.cellID = i; } public int getCellID(){ return this.cellID; } public void addAggRoi(Roi aAggRoi) { if(aAggRoi instanceof PointRoi) { for(int i=0; i<pR;i++) { PointRoi p = pointRois[i]; if(p.getBounds().x == aAggRoi.getBounds().x && p.getBounds().y == aAggRoi.getBounds().y) return; } if(pR<pointRois.length) { pointRois[pR] = (PointRoi)aAggRoi; pR++; } } else { if(pR<pointRois.length) { aggRois[aR] = aAggRoi; aR++; } } } public void initializeAggRoi() { pR = 0; pointRois = new PointRoi[10]; } public PointRoi getAvPr() { if(pR <= 0) return null; double x = 0; double y = 0; for(int i=0; i<pR;i++) { PointRoi p = pointRois[i]; x = x + p.getBounds().x; y = y + p.getBounds().y; } PointRoi pRoi = new PointRoi(x/pR, y/pR); pRoi.setPosition(pointRois[0].getPosition()); return pRoi; } public PointRoi[] getPointRois() { if(pR == 0) return null; PointRoi[] pRois = new PointRoi[pR]; System.arraycopy(pointRois, 0, pRois, 0, pR); return pRois; } public Roi[] getAggRoisRegion1() { if(aR == 0) return null; Roi[] pRois = new Roi[aR]; System.arraycopy(aggRois, 0, pRois, 0, aR); aggInfo = new String[aR][5]; return pRois; } public PointRoi[] getAggRoisPoint() { if(pR == 0) return null; PointRoi[] pRois = new PointRoi[pR]; System.arraycopy(pointRois, 0, pRois, 0, pR); return pRois; } public void createAggregateInfo() { aggInfo = new String[pR][5]; } public void setAggregateInfo(double x, double y, double area2, double mean, double median,int i) { aggInfo[i][0] = String.valueOf(x); aggInfo[i][1] = String.valueOf(y); aggInfo[i][2] = String.valueOf(area2); aggInfo[i][3] = String.valueOf(mean); aggInfo[i][4] = String.valueOf(median); } public void setMeanGFP(double mean) { this.meanGFP = mean; } public void setMedianGFP(double median) { this.medianGFP = median; } // line to rectangular roi public void toRectangular() { // if(roi instanceof Line) // { // Line line = (Line)roi; // Roi nRoi = new Roi(timeIndex*(Lineage.roi_width+6), line.y1<line.y2?line.y1:line.y2, Lineage.roi_width, Math.abs(line.y2-line.y1)); // this.setRoi(nRoi); // } if(roi.getType() == Roi.FREELINE) { PolygonRoi fLine = (PolygonRoi) roi; Roi nRoi = new Roi(timeIndex*(Lineage.roi_width+6), fLine.getBounds().y, Lineage.roi_width, fLine.getBounds().height); this.setRoi(nRoi); } } public void toRectangular(int x, int width) { if(roi.getType() == Roi.FREELINE) { PolygonRoi fLine = (PolygonRoi) roi; Roi nRoi = new Roi(x, fLine.getBounds().y, width, fLine.getBounds().height); this.setRoi(nRoi); } } public void resizeHeadToZero() { Roi nRoi = new Roi(timeIndex*(Lineage.roi_width+6), 0, Lineage.roi_width, roi.getBounds().y + roi.getBounds().height); this.setRoi(nRoi); } public void setFociState(boolean state) { this.findFoci = state; } public boolean getFociState() { return findFoci; } public void setFociProperty(boolean b) { this.isFoci = b; } public boolean isFoci() { return isFoci; } public void addAttachedCell(Ins_cell actualCell) { if(attachedCell == null) { attachedCell = new Ins_cell[2]; attachedCell[0] = actualCell; return; } attachedCell[1] = actualCell; } public void addCorrectedAttachedCell(Ins_cell aCell) { attachedCell = new Ins_cell[2]; attachedCell[0] = aCell; } public Ins_cell[] getAttachedCell() { return attachedCell; } public boolean fociIsadded() { return roiAdded ; } public void setFociAdded(boolean b){ roiAdded = b; } public void setDivideNext(int divide) { divideNext = divide; } class Foci{ float area = 0; float sumIntensity = 0; double meanIntensity = 0; double[] center = new double[2]; double[] reletiveCenterToCell = new double[2]; double radius; String label; public Foci(Foci foci) { this.area = foci.area; this.sumIntensity = foci.sumIntensity; this.meanIntensity = foci.meanIntensity; this.center = foci.center; this.reletiveCenterToCell = foci.reletiveCenterToCell; this.radius = foci.radius; this.label = foci.label; } public Foci() { } } class Comet{ float area = 0; float sumIntensity = 0; double meanIntensity = 0; double[] center; double[] reletiveCenterToCell; double length; String label; public Comet(Comet comet) { this.area = comet.area; this.sumIntensity = comet.sumIntensity; this.meanIntensity = comet.meanIntensity; this.center = comet.center; this.reletiveCenterToCell = comet.reletiveCenterToCell; this.length = comet.length; this.label = comet.label; } public Comet() { } } public double[] getFourierDescriptor() { return fourierDesc; } public void setFourierDescriptor(double[] fourierDescriptor) { this.fourierDesc = fourierDescriptor; } public void setEndFlag(boolean b) { this.theEnd = b; } public boolean getEndFlag() { return theEnd; } public void divideCellByPoint(int y,Ins_cellsVector[] cellsTimeIndex,double ratio) { double height_u = y-this.position[1]; double ratio_u = height_u/this.height; double height_l = this.position[1]+this.height-y; double ratio_l = height_l/this.height; boolean changed = false; if(ratio_u >= ratio) { Roi roi_upper = new Roi(this.position[0], this.position[1], this.width, height_u); this.setRoi(roi_upper); changed = true; } //System.out.println(" ratio : " + height_/this.height + " height_ " + height_); if(ratio_l >= ratio) { Roi roi_lower = new Roi(this.position[0], y, this.width, height_l); if(changed) { Ins_cell lowerCell = new Ins_cell(roi_lower); Ins_cellsVector currentCellsVector = cellsTimeIndex[getTimeIndex()]; currentCellsVector.insertCell(lowerCell); }else { this.setRoi(roi_lower); } } } // public void setBackGroundIntensity(double intensity) { // this.bgIntensity = intensity; // } }
[ "songxiaohu@gmail.com" ]
songxiaohu@gmail.com
c33d6723aa4ebd9e5fbee9a2534d794612b333a6
0d5a98b63bdff65e587375663be9128ed5f20222
/src/main/java/com/datastructure/list/singlylist/SinglyLinkedList.java
df1b88d792edf9d09e8e38b1c1eaf67ba6f86af7
[]
no_license
bharateshwarpatil/DataStructure
88ef585a45b9a4a8b8a050c992cc94e24e993f3e
5bd5c1431c8e8933c1a141f0d7f87a487c16beb7
refs/heads/master
2021-06-29T21:24:30.801113
2020-09-21T01:35:17
2020-09-21T01:35:17
157,980,972
0
0
null
null
null
null
UTF-8
Java
false
false
5,151
java
package com.datastructure.list.singlylist; public class SinglyLinkedList<T extends Comparable> { private Node<T> headNode; /** * insert data * * @param data * @return */ public boolean add(T data) { Node currNode = headNode; if (currNode != null) { while (currNode.getNext() != null) { currNode = currNode.getNext(); } currNode.setNext(new Node(data)); } else { headNode = new Node<T>(null, data); } return true; } /** * if node exist and it is deleted then return true otherwise it will be false * * @param node * @return */ public boolean remove(Node node) { Node currNode = headNode; if (currNode != null) { if (currNode.equals(node)) { headNode = headNode.getNext(); return true; } while (currNode.getNext() != null) { if (currNode.getNext().equals(node)) { currNode.setNext(currNode.getNext().getNext()); return true; } currNode = currNode.getNext(); } } return false; } /** * this for the problem solving purpose * ### getNtheNode from the lastNode * Complexity=O(n) */ public Node<T> getNthElementfromLast(int n) { if (headNode == null) return null; Node fastPointer = headNode; Node slowPointer = headNode; int currentCursor = 0; while (fastPointer.getNext() != null) { currentCursor++; if (currentCursor > n) { slowPointer = slowPointer.getNext(); } fastPointer = fastPointer.getNext(); } return slowPointer; } /** * reverse SinglyNode * * @param */ public void reveseSinglyList() { Node currNode = headNode; Node prevNode = null; while (currNode != null) { Node nextNode = currNode.getNext();// Node tmpNode = nextNode.getNext(); nextNode.setNext(currNode); currNode.setNext(prevNode); prevNode = nextNode; currNode = tmpNode; } headNode = prevNode; } /** * reverse SinglyNode * * @param */ public Node reveseSinglyList(Node tnode) { if(tnode==null) return tnode; Node currNode = headNode; Node prevNode = null; while (currNode != null) { Node nextNode = currNode.getNext();// Node tmpNode = nextNode.getNext(); nextNode.setNext(currNode); currNode.setNext(prevNode); prevNode = nextNode; currNode = tmpNode; } headNode = prevNode; return headNode; } /** * reverse SinglyNode * * @param */ public T findMiddleOfList() { if(headNode==null) return null; Node<T> fastNode = headNode; Node<T> slowNode = headNode; while (fastNode.getNext() != null) { fastNode = fastNode.getNext(); if (fastNode.getNext() == null) { System.out.println("length of the List is odd :)"); return slowNode.getData(); } fastNode = fastNode.getNext(); slowNode = slowNode.getNext(); System.out.println(slowNode); } System.out.println("length of the List is even :)"); return slowNode.getData(); } public void sort(){ mergesort(headNode); } private Node mergesort(Node node){ if(node.getNext()==null) return node; Node secondHalf=getMidNode(node); Node second=mergesort(secondHalf);//sort second half ; Node first=mergesort(node);//sort first half Node currnode =merge(second,first); headNode=currnode; return currnode; } private Node merge(Node first,Node second){ if(first ==null ) return second; if(second ==null ) return first; Node tmp=null; if(first.getData().compareTo(second.getData()) >0){ second.setNext(merge(second.getNext(),first)); tmp=second; }else { first.setNext(merge(first.getNext(),second)); tmp=first; } return tmp; } private Node getMidNode(Node node) { Node fastNode=node; Node slowNode=node; while( fastNode.getNext()!=null){ fastNode= fastNode.getNext(); if( fastNode.getNext()== null ) break; fastNode= fastNode.getNext(); slowNode= slowNode.getNext(); } if(slowNode!=null){ Node tmp= slowNode; slowNode=slowNode.getNext(); tmp.setNext(null); } return slowNode; } public void printNode(){ Node tmp=headNode; if(tmp==null) return ; while (tmp!=null){ System.out.println(tmp); tmp=tmp.getNext(); } } }
[ "patilbharateshwar@gmail.com" ]
patilbharateshwar@gmail.com
d970f5a2d32281cd2bfed6e7011962757d21f49d
2a272ce7cdf0aa369ce0e3f8c7b63ee20c24fdf4
/hellowWord.java
77f87b45e438a26e3ebde924035d5eb0a06f0093
[]
no_license
xin2000xin2000/-github
ca131197c5bf1d3e2268006bdb08aa91dd3d8e2f
42664a04ec40acdefebb07f53f29b27d0a111bee
refs/heads/master
2020-09-13T04:56:57.818552
2019-11-21T05:29:55
2019-11-21T05:29:55
222,660,608
0
0
null
null
null
null
UTF-8
Java
false
false
98
java
class Main{ public static void main(String[] args){ System.out.println("HellowWorld"); } }
[ "noreply@github.com" ]
noreply@github.com
446cd5beea1d81238277230faa2ab4dfde394922
eb612e4e13f8df44e8dd45716e0fe0977ef4354b
/src/com/ibaguo/mqa/json/JsonWord.java
4273499600167d44938d140077acb69133c1285d
[ "Apache-2.0" ]
permissive
Growingluffy/mqa
295d3b2502363cc7b20961c34f5544783a6acb71
26c4254175ff0a626296f70fbdb57966e7924459
refs/heads/master
2020-05-04T17:52:04.734222
2016-01-22T08:57:44
2016-01-22T08:57:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package com.ibaguo.mqa.json; import java.util.List; public class JsonWord { Status status; List<String> word; public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public List<String> getWord() { return word; } public void setWord(List<String> word) { this.word = word; } public JsonWord(Status status, List<String> word) { super(); this.status = status; this.word = word; } }
[ "thyferny@thyferny-laptop" ]
thyferny@thyferny-laptop
d6f65c07924a58d36585409a11f8ee57045200fe
6568a9c6eb67ef9d722e44f49e77da92b5198d8f
/app/src/main/java/com/example/mohamedyasser/movieapp/ReviewsAdapter.java
26e504b8099942232e9dd62111c909ac54244c3b
[]
no_license
Yasserkhayyal/MovieApp
ef3b18ff64af2d644f318b31b34464a4583b5ac2
a69d2190d70946eee631f36773897b9a619c4989
refs/heads/master
2021-01-10T14:39:20.092201
2018-03-11T21:10:45
2018-03-11T21:10:45
43,542,095
1
0
null
null
null
null
UTF-8
Java
false
false
1,892
java
package com.example.mohamedyasser.movieapp; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import org.w3c.dom.Text; import java.util.ArrayList; /** * Created by Mohamed Yasser on 10/4/2015. */ public class ReviewsAdapter extends BaseAdapter{ Context context; ArrayList<String> authors; ArrayList<String> reviews; LayoutInflater layoutInflater; public ReviewsAdapter(Context context,ArrayList<String> authors,ArrayList<String> reviews){ this.context = context; this.authors = authors; this.reviews = reviews; layoutInflater = LayoutInflater.from(context); } @Override public int getCount() { return reviews.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } public static class ViewHolder{ TextView authorTV; TextView contentTV; public ViewHolder(View view){ authorTV = (TextView) view.findViewById(R.id.author_name_text_view); contentTV = (TextView) view.findViewById(R.id.content_text_view); } } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; ViewHolder viewHolder; if(view==null){ view = layoutInflater.inflate(R.layout.reviews_list_item,parent,false); viewHolder = new ViewHolder(view); view.setTag(viewHolder); }else{ viewHolder = (ViewHolder) view.getTag(); } viewHolder.authorTV.setText(authors.get(position)); viewHolder.contentTV.setText(reviews.get(position)); return view; } }
[ "yasser.khayal@gmail.com" ]
yasser.khayal@gmail.com
c8b33388c2d4df8bbb326c5232c6e57d89d8da96
9dbe08ab487637e690770e86961ed7e3f76a6714
/src/others/完全平方数组.java
bda6d4a2cbf4e41abe33f7cfa2482649e62714db
[]
no_license
TwilightFortress/Sword
55af7fde41fe6b5d38f49614112562ac167856c7
73b203ee0fcbf6aa3c991c5e94c6ed170336f871
refs/heads/master
2020-07-11T06:50:53.603262
2019-09-23T12:35:04
2019-09-23T12:35:04
204,470,325
0
0
null
null
null
null
UTF-8
Java
false
false
2,099
java
package others; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; /** * @author yuyang * @create 2019-08-19 20:08 */ public class 完全平方数组 { public static void main(String[] args) { int[] arr = {3,6,10}; ArrayList<String> list = Permutation(arr); int num = 0; for(int i = 0; i < list.size(); i++){ String[] ch = list.get(i).substring(1, list.get(i).length() - 1).split(","); int[] arr1 = new int[arr.length]; for (int j = 0; j < ch.length; j++) { arr1[j] = Integer.parseInt(ch[j].trim()); } if(check(arr1)){ num++; } } System.out.println(num); } private static boolean check(int[] arr1) { for(int i = 1; i < arr1.length; i++){ int tmp = arr1[i - 1] + arr1[i]; if(!isSquares(tmp)){ return false; } } return true; } public static boolean isSquares(int value) { if (value < 0) { return false; } double sqrtValue = Math.sqrt(value * 1.0); int sqrtSimiValue = (int) sqrtValue; if ((sqrtSimiValue * sqrtSimiValue) == value) { return true; } else { return false; } } public static ArrayList<String> Permutation(int[] str) { ArrayList<String> list = new ArrayList<>(); if (str == null || str.length == 0) return list; permutationCore(str, 0, list); return list; } private static void permutationCore(int[] chars, int l, ArrayList<String> list) { if (l == chars.length - 1) { list.add(Arrays.toString(chars)); } else { for (int i = l; i < chars.length; i++) { int tmp = chars[l]; chars[l] = chars[i]; chars[i] = tmp; permutationCore(chars, l + 1, list); chars[i] = chars[l]; chars[l] = tmp; } } } }
[ "1011528039@qq,com" ]
1011528039@qq,com
8ed3bcbc64c5a4e44f6f9a318909e452b176fdc3
347150ce0b0c88a9d1e46ab6973d684b0c0ea5e0
/src/main/java/me/muphy/tmp/Test.java
26de3a6182146143107e3cf65cb64a069a5aa1e3
[ "Apache-2.0" ]
permissive
liujie1008cn/RuphyRecorder
32dbf55041b5fc050f71886b00c9bae481563826
c117b6109f84ca4e9c189b0fe270b08c28dc1082
refs/heads/master
2023-01-13T23:05:26.834135
2020-11-14T18:23:48
2020-11-14T18:23:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,043
java
package me.muphy.tmp; import me.muphy.config.ApplicationConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.List; import java.util.Map; @RestController public class Test { @Autowired private JdbcTemplate jdbcTemplate; @RequestMapping("/test") public String test(String s) { String str = "s:" + s; System.out.println(str); return str; } @RequestMapping("/dbStatus") public List<Map<String, Object>> dbTest(String s) { String sql = StringUtils.isEmpty(s) ? "select 'up' status" : s; return jdbcTemplate.queryForList(sql); } public void CongigTest(){ Date date = new Date(); double d = 1.0; int i = 0; long l = 1l; String a = "ddd"; } }
[ "ymh19941112@outlook.com" ]
ymh19941112@outlook.com
07134bb6d165c66d57d2c77a109d24bf4980509e
f350797680399c6043893284811867f0dea04171
/src/java/controller/Controller.java
ac7eda15f3243c94a56e4774de24f4a69d95c713
[]
no_license
alexsander639/cadastro_matricula
25275a3d5fa770c316c56d440be1dedb7919dd8e
8104e270a5a475f0a347ce488c323b3a426a7d19
refs/heads/master
2023-06-04T20:37:06.385006
2021-06-26T11:46:48
2021-06-26T11:46:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,905
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import jakarta.servlet.RequestDispatcher; import java.io.IOException; import java.io.PrintWriter; import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.util.ArrayList; import model.DAO; import model.JavaBeans; import model.JavaBeansLogin; /** * * @author PICHAU */ @WebServlet(name = "Controller", urlPatterns = {"/Controller", "/main", "/insert", "/select", "/update", "/delete", "/login", "/insertLogin", "/buscaMat"}) public class Controller extends HttpServlet { DAO dao = new DAO(); JavaBeans matricula = new JavaBeans(); JavaBeansLogin login = new JavaBeansLogin(); protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet Controller</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet Controller at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getServletPath(); if(action.equals("/main")){ //matriculas(request, response); } else if(action.equals("/insert")){ //novaMatricula(request, response); } else if(action.equals("/select")){ //listarMatricula(request, response); } else if(action.equals("/update")){ //editarMatricula(request, response); } else if(action.equals("/delete")){ //removerMatricula(request, response); } else if(action.equals("/login")){ //login(request, response); } else if(action.equals("/insertLogin")){ //novoLogin(request, response); } else if(action.equals("/buscaMat")){ //buscaMatricula(request, response); } else { response.sendRedirect("index.html"); } } /*protected void buscaMatricula(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { matricula.setId_mat(request.getParameter("id_mat")); matricula.setNome_aluno(request.getParameter("nome_aluno")); JavaBeans matriculaReturn = dao.buscarMatricula(matricula); if (matriculaReturn == null) { try { response.sendRedirect("idMatriculaInvalid.html"); } catch (IOException ex) { throw new RuntimeException(ex); } }else { matriculaReturn = dao.selecionarNome(matricula); if (matriculaReturn == null) { try { response.sendRedirect("nomeMatriculaInvalid.html"); } catch (IOException ex) { throw new RuntimeException(ex); } }else { dao.selecionarMatricula(matriculaReturn); try { //setar os atributos do formulario com o conteudo JavaBeans request.setAttribute("id_mat", matriculaReturn.getId_mat()); request.setAttribute("nome", matriculaReturn.getNome_aluno()); request.setAttribute("fone", matriculaReturn.getFone()); request.setAttribute("email", matriculaReturn.getEmail()); request.setAttribute("curso", matriculaReturn.getCurso()); //encaminhar ao doc editar.jsp RequestDispatcher rd = request.getRequestDispatcher("exibeMatricula.jsp"); rd.forward(request, response); } catch (IOException ex) { throw new RuntimeException(ex); } } } }*/ //login /*protected void login(HttpServletRequest request, HttpServletResponse response) { login.setUsername(request.getParameter("username")); login.setSenha(request.getParameter("senha")); JavaBeansLogin loginReturn = dao.selecionarUser(login); if (loginReturn == null) { try { response.sendRedirect("loginFailUser.html"); } catch (IOException ex) { throw new RuntimeException(ex); } }else { loginReturn = dao.selecionarSenha(login); if (loginReturn == null) { try { response.sendRedirect("loginFailSenha.html"); } catch (IOException ex) { throw new RuntimeException(ex); } }else { try { response.sendRedirect("loginSucess.html"); } catch (IOException ex) { throw new RuntimeException(ex); } } } }*/ /*protected void novoLogin(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { login.setUsername(request.getParameter("username")); login.setSenha(request.getParameter("senha")); dao.inserirLogin(login); response.sendRedirect("index.html"); }*/ //listar matriculas /*protected void matriculas(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //criando obj para receber dados JavaBeans ArrayList<JavaBeans> lista = dao.listarMatriculas(); //encaminhar lista para doc matriculas_cadastradas.jsp request.setAttribute("matriculas", lista); RequestDispatcher rd = request.getRequestDispatcher("matriculas_cadastradas.jsp"); rd.forward(request, response); }*/ //Nova matricula /*protected void novaMatricula(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //setar as variaveis no JavaBeans matricula.setNome_aluno(request.getParameter("nome")); matricula.setFone(request.getParameter("fone")); matricula.setEmail(request.getParameter("email")); matricula.setCurso(request.getParameter("curso")); //invocar metodo inserirMatricula passando o objeto matricula dao.inserirMatricula(matricula); //redirecionar para o doc cadastro_matricula.jsp response.sendRedirect("main"); }*/ //Editar matricula /*protected void listarMatricula(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Id matricula a ser editado String id_mat = request.getParameter("id_mat"); //setar a variavel JavaBeans matricula.setId_mat(id_mat); //executar método selecionarMatricula (DAO) dao.selecionarMatricula(matricula); //setar os atributos do formulario com o conteudo JavaBeans request.setAttribute("id_mat", matricula.getId_mat()); request.setAttribute("nome", matricula.getNome_aluno()); request.setAttribute("fone", matricula.getFone()); request.setAttribute("email", matricula.getEmail()); request.setAttribute("curso", matricula.getCurso()); //encaminhar ao doc editar.jsp RequestDispatcher rd = request.getRequestDispatcher("editar.jsp"); rd.forward(request, response); }*/ /*protected void editarMatricula(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //setar variaveis JavaBeans matricula.setId_mat(request.getParameter("id_mat")); matricula.setNome_aluno(request.getParameter("nome")); matricula.setFone(request.getParameter("fone")); matricula.setEmail(request.getParameter("email")); matricula.setCurso(request.getParameter("curso")); //executar metodo alterarContato dao.alterarMatricula(matricula); //redirecionar para doc matriculas_cadastradas.jsp (att as alteraçoes) response.sendRedirect("main"); }*/ //remover uma matricula /*protected void removerMatricula(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Id matricula a ser removido String id_mat = request.getParameter("id_mat"); //setar variavel JavaBeans matricula.setId_mat(id_mat); //executar metodo deletarMatricula dao.deletarMatricula(matricula); //redirecionar para doc matriculas_cadastradas.jsp (att as alteraçoes) response.sendRedirect("main"); }*/ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } @Override public String getServletInfo() { return "Short description"; } }
[ "alex_572757@hotmail.com" ]
alex_572757@hotmail.com
4d6ef16d96cd6b6a3174a6355d5edef61889edec
75a285142e73ba9b232576b54bd18722e330997a
/src/com/bank/service/RepairTypeServiceDao.java
5eeec66607efc866ed82aff7e05f99f3c49e4a23
[]
no_license
CrazyBunQnQ/BankPatrol
94929f874e78009f8bd16976a809c6879e93da19
509b7b6a2c3a722ee71bc72eaa4c1a0f211b7aed
refs/heads/master
2021-01-20T09:21:55.349052
2017-05-31T06:05:34
2017-05-31T06:05:34
90,244,927
1
3
null
2017-05-17T01:10:36
2017-05-04T09:21:57
HTML
UTF-8
Java
false
false
1,174
java
package com.bank.service; import com.bank.entity.PageInfo; import com.bank.entity.RepairType; public interface RepairTypeServiceDao { /** * 分页查询设备报修问题 * @param pageNum * @param condition * @return */ public PageInfo<RepairType> queryRepairType(int pageNum,String PITYPE_Value); /** * 根据设备类型模糊查询 * @param pageNum * @param condition * @return */ public PageInfo<RepairType> queryRepairTypeByPiType_Value(int pageNum, String PITYPE_Value); /** * 添加设备报修问题 * @param RepairType * @return */ public boolean addRepairType(RepairType repairType); /** * 删除设备报修问题 * @param id * @return */ public boolean deleteRepairType(int id); /** * 更新设备报修问题 * @param piWorker * @return */ public boolean updateRepairType(RepairType repairType); /** * 根据id查询报修类型 * @param id * @return */ public RepairType repairType2Update(int id); /** * 添加时确认是否有该问题 * @param id * @return */ public boolean hasType(String PITYPE_Value); }
[ "572218017@qq.com" ]
572218017@qq.com
21fc72392370195c0f5741a432c19061c97d1d50
7b071e438c0748fb1fa314f5aa119a88b2afac1b
/Carmina/src/DAO/CancionDAO.java
3f3576160a69e51dadc175954a6dcf191a850fe9
[]
no_license
waterpolord/ProyectofinalBD2
7a4ace689450ef47d3cab08035e4b611d844cfc4
ecbab46cfffa3cbecf6d517de6e7fcfc3bcaa30a
refs/heads/master
2021-05-17T18:27:50.278933
2020-03-31T03:08:13
2020-03-31T03:08:13
250,918,209
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package DAO; import Logic.Cancion; import Logic.Usuario; public interface CancionDAO extends DAO<Cancion,String> { }
[ "48257861+waterpolord@users.noreply.github.com" ]
48257861+waterpolord@users.noreply.github.com
56d00c4ed08b5b6e10540715b48ee80fad1a040a
66d6bc97378ba3cb6549f6080e8f60f23482c25f
/sdk/src/test/java/com/tangdi/tdcloud/TestUtil.java
d420cb9e3e61f6ff779fa969a779df95419aff72
[ "MIT" ]
permissive
td-cloud/tdcloud-java
07c75eebbd00ad04afd2e00f8b4f368377a949b4
cb2883b49e955dca0f1608e8abbe5d91e9c0b074
refs/heads/master
2021-01-17T17:41:58.627958
2016-08-15T02:39:34
2016-08-15T02:50:44
61,689,842
0
1
null
null
null
null
UTF-8
Java
false
false
1,680
java
package com.tangdi.tdcloud; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.text.SimpleDateFormat; import java.util.Date; /** * 测试工具类 * * @author deng_wk * @Date 2016-06-29 * */ public class TestUtil { static String transferDateFromLongToString(long millisecond) { Date date = new Date(millisecond); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(date); } /** * 使用mock url生成mock html */ static String generateSandboxHtmlWithUrl(String url) { StringBuffer mockHtml = new StringBuffer(); String[] urlString = url.split("\\?"); String urlSection = urlString[0]; String[] paraSection = urlString[1].split("&"); mockHtml.append("<form id=\"tdcloudmock\" name=\"tdcloudmock\" action=\"" + urlSection + "\" method=\"get\">"); for (int i = 0; i < paraSection.length; i++) { String name = paraSection[i].split("=")[0]; String value = paraSection[i].split("=")[1]; try { mockHtml.append( "<input type=\"hidden\" name=\"" + name + "\" value=\"" + URLDecoder.decode(value, "UTF-8") + "\"/>"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } // submit按钮控件请不要含有name属性 mockHtml.append("<input type=\"submit\" value=\"确认\" style=\"display:none;\"></form>"); mockHtml.append("<script>document.forms['tdcloudmock'].submit();</script>"); return mockHtml.toString(); } }
[ "deng_wk@tangdi.com.cn" ]
deng_wk@tangdi.com.cn
19ddd4ecb3a6c3593a975e38cc159f8482442e4a
838a36ce99b34dc9cac58c08e5faf1cfd327b237
/dxz-backend/dxz-web-app/src/main/java/com/neusoft/dxz/web/security/WhiteItem.java
3403736a885f71fd73b160ed8515041b72e98540
[]
no_license
git741852963/why
c8437851530345a1de4d801c39681ef927897499
e0b4f9e7f0c63a1233ef86abdbc9c6f92b6b9f4d
refs/heads/master
2020-03-30T19:51:03.963139
2018-10-04T11:34:14
2018-10-04T11:34:14
151,561,749
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package com.neusoft.dxz.web.security; import java.util.Set; import java.util.regex.Pattern; /** * Created by Andy on 2016/6/27. */ public class WhiteItem { public final Pattern pattern; public final Set<String> httpMethods; public WhiteItem(Pattern pattern, Set<String> httpMethods) { this.pattern = pattern; this.httpMethods = httpMethods; } }
[ "1978046176@qq.com" ]
1978046176@qq.com
41c0c08a6890ac9818cff1f183f9c40c2affc5a9
e64535b03b14e5869a5d7e59eb7de58a3002ab4d
/ARK/src/main/java/kr/icia/domain/OrderDetailVO.java
7c0e04f2fb3e909d42ad38262a31cb44bc759a6a
[]
no_license
see5456998/ark
941a5fffaec7529fa291138cde2dcf186e194a1f
3049099988fd128e091a500f1eabff5296cdbe6f
refs/heads/master
2022-12-21T11:26:38.249984
2019-11-25T02:54:01
2019-11-25T02:54:01
223,846,223
0
0
null
2022-11-16T12:37:01
2019-11-25T02:29:23
CSS
UTF-8
Java
false
false
199
java
package kr.icia.domain; import lombok.Data; @Data public class OrderDetailVO { private int orderDetailsNum; private String orderId; private int gdsNum; private int cartStock; }
[ "see5456998@naver.com" ]
see5456998@naver.com
1582c46aa23552e09c409d662509b0a08867a804
433c91a1d9a1ab48983256262b9ad8abf21a4778
/app/src/test/java/com/example/menudecomidas/ExampleUnitTest.java
b732592ed59605005e81f48e6c0e629c4d74f7e3
[]
no_license
BetoVqzR/MenudeComidas
9e9bca401d1dcc99ed006c2efa25c1b4d6ff271d
6154d2c8598e6200766497b898fd14cac829aafb
refs/heads/master
2020-06-12T01:37:21.918941
2019-06-29T16:00:20
2019-06-29T16:00:20
194,153,698
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.example.menudecomidas; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "albertovazquez120.av@gmail.com" ]
albertovazquez120.av@gmail.com
65b067a6053a8504250166890a2e040d69edd3db
a1e024d5a43f2c26c504200de388e0981cd6b704
/src/main/java/br/com/mundodev/scd/api/service/impl/ApiAuthIntegrationImpl.java
353387ed09520e0d4e8d3f559ad7d102ff024c98
[]
no_license
IagoReis/scd-api
8c438f4a0edd39089f93c93a70f693a299ca8f37
d987a69c2d735bdd34ffcc3244a8b88a55c11fe6
refs/heads/master
2022-08-04T03:14:39.712052
2020-05-31T16:25:18
2020-05-31T16:25:18
265,889,027
0
0
null
null
null
null
UTF-8
Java
false
false
1,237
java
package br.com.mundodev.scd.api.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import br.com.mundodev.scd.api.domain.ApiAuthenticationRequest; import br.com.mundodev.scd.api.domain.ApiAuthenticationResponse; import br.com.mundodev.scd.api.service.ApiAuthIntegration; @Service public class ApiAuthIntegrationImpl implements ApiAuthIntegration { private final static String API_URL = "https://ereceb.herokuapp.com/api"; private final static String API_AUTHENTICATION_URL = API_URL.concat("/authenticate"); private RestTemplate restTemplate; @Autowired public ApiAuthIntegrationImpl(final RestTemplate restTemplate) { this.restTemplate = restTemplate; } @Override public ApiAuthenticationResponse getTokenAuthorization() { final var apiAuthenticationRequest = new ApiAuthenticationRequest("admin", "admin"); final ResponseEntity<ApiAuthenticationResponse> responseEntity = restTemplate.postForEntity(API_AUTHENTICATION_URL, apiAuthenticationRequest, ApiAuthenticationResponse.class); return responseEntity.getBody(); } }
[ "iagoidrs@gmail.com" ]
iagoidrs@gmail.com
ac7b2dbffbdfbd8ffb1a6fdc2bab661635039636
e6911480c867502c9c2e1c724dea2580078147cd
/src/com/institute_management/lecture_mgt/lectureBean.java
241a87d140ba9fa955aec6614a7cd834bce6cf0a
[]
no_license
alfaromio/Malpi_keleniya
382b40624cc1bd8f5ea8f6769cc6acfeb0d14bdc
d7808a3f9f43ebe80e53fd8a6c8ac2b8aaf4eda1
refs/heads/master
2023-01-20T11:31:27.885112
2019-07-30T09:54:35
2019-07-30T09:54:35
316,213,928
0
0
null
null
null
null
UTF-8
Java
false
false
4,046
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.institute_management.lecture_mgt; /** * * @author tharindu_m */ public class lectureBean { private String name; private String nic; private String gender; private String subjectName; private String email; private String contact; private String address; private String address1; private String address2; private String regDate; private String lecID; private String firstlName; private String tittle; /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the nic */ public String getNic() { return nic; } /** * @param nic the nic to set */ public void setNic(String nic) { this.nic = nic; } /** * @return the gender */ public String getGender() { return gender; } /** * @param gender the gender to set */ public void setGender(String gender) { this.gender = gender; } /** * @return the subjectName */ public String getSubjectName() { return subjectName; } /** * @param subjectCode the subjectName to set */ public void setSubjectName(String subjectName) { this.subjectName = subjectName; } /** * @return the email */ public String getEmail() { return email; } /** * @param email the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the contact */ public String getContact() { return contact; } /** * @param contact the contact to set */ public void setContact(String contact) { this.contact = contact; } /** * @return the address */ public String getAddress() { return address; } /** * @param address the address to set */ public void setAddress(String address) { this.address = address; } /** * @return the regDate */ public String getRegDate() { return regDate; } /** * @param regDate the regDate to set */ public void setRegDate(String regDate) { this.regDate = regDate; } /** * @return the lecID */ public String getLecID() { return lecID; } /** * @param lecID the lecID to set */ public void setLecID(String lecID) { this.lecID = lecID; } /** * @return the firstlName */ public String getFirstlName() { return firstlName; } /** * @param fullName the firstlName to set */ public void setFirstlName(String fullName) { this.firstlName = fullName; } /** * @return the tittle */ public String getTittle() { return tittle; } /** * @param tittle the tittle to set */ public void setTittle(String tittle) { this.tittle = tittle; } /** * @return the address1 */ public String getAddress1() { return address1; } /** * @param address1 the address1 to set */ public void setAddress1(String address1) { this.address1 = address1; } /** * @return the address2 */ public String getAddress2() { return address2; } /** * @param address2 the address2 to set */ public void setAddress2(String address2) { this.address2 = address2; } }
[ "malindad@HOISL_MALINDAD.mobitel.int" ]
malindad@HOISL_MALINDAD.mobitel.int
62e8d8489ba3fff70fa477639b1ca2830340a294
7c6da2009c921cae96b3465752820a817487c5a7
/hookah-static-server/src/main/java/com/jusfoun/hookah/staticserver/config/CrosFilter.java
1a938553e91b6c43a665642195f97e2591a86b74
[]
no_license
zhu18/hookahnew
b280948810a30f75249e4001bd9e216eadd42909
21cfc9d56c2a52f0c3cdc11ce840d84a6c6659c9
refs/heads/master
2020-03-26T13:36:55.928999
2017-05-08T03:17:27
2017-05-08T03:17:27
144,943,358
0
0
null
null
null
null
UTF-8
Java
false
false
2,666
java
package com.jusfoun.hookah.staticserver.config; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author huang lei * @date 2016/12/25 下午5:13 * @desc */ @Component() @Order(1) public class CrosFilter implements Filter { @Autowired private MyProps myProps; String domain; @Override public void init(FilterConfig filterConfig) throws ServletException { domain = myProps.getHost().get("domain"); } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; String origin = httpServletRequest.getHeader("Origin"); if (StringUtils.isNoneBlank(origin)) { Pattern pattern = Pattern.compile("([a-zA-z]+://){0,1}([^\\s]*)"); Matcher matcher = pattern.matcher(origin); if (matcher.find()) { String host = matcher.group(2); if (host.endsWith(domain) && !host.equals(domain) && StringUtils.isNoneBlank(getDomain(host))) { httpServletResponse.addHeader("Access-Control-Allow-Origin", httpServletRequest.getScheme() + "://" + getDomain(host) + "." + domain); httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,DELETE,HEAD,OPTIONS,PATCH,PUT"); httpServletResponse.setHeader("Access-Control-Max-Age", "3600"); httpServletResponse.setHeader("Access-Control-Allow-Headers", "X-Requested-With,X-Auth-Token,content-type"); httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true"); } } } filterChain.doFilter(servletRequest, servletResponse); } @Override public void destroy() { } private String getDomain(String host) { if (host.endsWith(domain)) { return host.substring(0, host.length() - (domain.length() + 1)); } else return null; } }
[ "elvis.huanglei@gmail.com" ]
elvis.huanglei@gmail.com
b0aef4a6696e6b89fd4392d20ddbeda711f2dd73
d5110395983e35f304381179668d686da436bd08
/src/Ex51.java
787d7897a64a0a3e82441ce1a2e4aa4fa9421fc2
[]
no_license
jnmendes-philips/ListaPGMII
3772d90438b7e5f48cd175712fcd19e862a428f8
f1a4ff0550299240be90b6285d5460b6f82917a1
refs/heads/master
2020-04-08T03:12:40.698606
2018-12-03T21:09:50
2018-12-03T21:09:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
import java.util.Scanner; public class Ex51 { int[][] matriz; public Ex51() { System.out.println("Informe as linhas e colunas da matriz respectivamente"); matriz = new int[new Scanner(System.in).nextInt()][new Scanner(System.in).nextInt()]; for (int i = 0; i < matriz.length; i++) { int[] is = matriz[i]; for (int j = 0; j < is.length; j++) { int k = is[j]; System.out.println("Informe valor a" + (i + 1) + "," + (j + 1)); k = new Scanner(System.in).nextInt(); } } } }
[ "jeffersonnazariomendes@gmail.com" ]
jeffersonnazariomendes@gmail.com
3a4cdb5547f2c43485d6234fb8f11226fb6fc55d
8d7ed82c4239f5bd2228465df5558c64c1c82b12
/GitHub/onvif/src/org/onvif/ver10/schema/IPv6ConfigurationExtension.java
2bf559fd26b6fd7822c9660375f0ed0d44149e89
[]
no_license
RinatB2017/Java_projects
401c45a6f494ad5cd542689a95d020f5ca68cd16
0709fea35029b483919499ba2683365d7d446655
refs/heads/master
2023-06-08T03:54:55.329766
2023-05-30T09:27:39
2023-05-30T09:27:39
101,397,023
0
0
null
2021-06-07T17:26:13
2017-08-25T11:21:38
Java
UTF-8
Java
false
false
1,899
java
package org.onvif.ver10.schema; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlType; import org.w3c.dom.Element; /** * <p>Java class for IPv6ConfigurationExtension complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="IPv6ConfigurationExtension"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;any processContents='lax' maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "IPv6ConfigurationExtension", propOrder = { "any" }) public class IPv6ConfigurationExtension { @XmlAnyElement(lax = true) protected List<java.lang.Object> any; /** * Gets the value of the any property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the any property. * * <p> * For example, to add a new item, do as follows: * <pre> * getAny().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link java.lang.Object } * {@link Element } * * */ public List<java.lang.Object> getAny() { if (any == null) { any = new ArrayList<java.lang.Object>(); } return this.any; } }
[ "tux4096@gmail.com" ]
tux4096@gmail.com
fd98709f5518ec61934f3d21a4b096978e3e39c0
2dc2b0f323b067437c60fd4555b4df030a35329a
/src/javaodin/Odin.java
3e5cd5c1732a0810a0e4282d74cf0f9b127ac0c9
[]
no_license
moonspiritacm/RootOdin
e796700986f524368842324eb1b2d84526a18b43
f8433f470b23b6aaf67fdfb2127240cc94daf812
refs/heads/master
2021-01-18T07:52:39.702173
2017-03-10T02:28:17
2017-03-10T02:28:17
84,294,582
0
0
null
null
null
null
UTF-8
Java
false
false
8,826
java
package javaodin; import java.math.BigInteger; import java.nio.ByteBuffer; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.PreparedStatement; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.json.JSONObject; class OdinInfo { public String fullOdin; public Integer shortOdin; public Integer txIndex; public String register; public String admin; public String txHash; public Integer blockIndex; public Integer blockTime; public Integer txSnInBlock; public String validity; public JSONObject odinSet; } public class Odin { static Logger logger = LoggerFactory.getLogger(Odin.class); public static Byte id = Config.FUNC_ID_ODIN_REGIST; //for registing new ODIN public static void init() { createTables(null); } public static void createTables(Database db) { if (db == null) { db = Database.getInstance(); } try { db.executeUpdate("CREATE TABLE IF NOT EXISTS odins (tx_index INTEGER PRIMARY KEY, tx_hash TEXT UNIQUE,block_index INTEGER,full_odin TEXT UNIQUE,short_odin INTEGER UNIQUE , register TEXT, admin TEXT,odin_set TEXT, validity TEXT)"); db.executeUpdate("CREATE INDEX IF NOT EXISTS block_index_idx ON odins (block_index)"); db.executeUpdate("CREATE INDEX IF NOT EXISTS tx_index ON odins (tx_index)"); db.executeUpdate("CREATE INDEX IF NOT EXISTS full_odin ON odins (full_odin)"); db.executeUpdate("CREATE INDEX IF NOT EXISTS short_odin ON odins (short_odin)"); db.executeUpdate("CREATE TABLE IF NOT EXISTS odin_update_logs (log_id TEXT, tx_index INTEGER PRIMARY KEY,block_index INTEGER,full_odin TEXT, updater TEXT,destination TEXT,update_set TEXT, validity TEXT,required_confirmer TEXT);"); db.executeUpdate("CREATE INDEX IF NOT EXISTS logid_idx ON odin_update_logs (log_id);"); db.executeUpdate("CREATE INDEX IF NOT EXISTS odin_idx ON odin_update_logs (full_odin);"); } catch (Exception e) { logger.error(e.toString()); } } public static void parse(Integer txIndex, List<Byte> message) { logger.info("\n=============================\n Parsing ODIN txIndex=" + txIndex.toString() + "\n=====================\n"); Database db = Database.getInstance(); ResultSet rs = db.executeQuery("SELECT * FROM transactions tx WHERE tx.tx_index=" + txIndex.toString()); try { if (rs.next()) { String source = rs.getString("source"); String destination = rs.getString("destination"); BigInteger btcAmount = BigInteger.valueOf(rs.getLong("btc_amount")); BigInteger fee = BigInteger.valueOf(rs.getLong("fee")); Integer blockIndex = rs.getInt("block_index"); Integer blockTime = rs.getInt("block_time"); String txHash = rs.getString("tx_hash"); Integer txSnInBlock = rs.getInt("sn_in_block"); String full_odin = blockIndex + "." + txSnInBlock; Integer short_odin = getLastShortOdin() + 1; ResultSet rsCheck = db.executeQuery("select * from odins where tx_index='" + txIndex.toString() + "'"); if (rsCheck.next()) { return; } String validity = "invalid"; JSONObject odin_set = new JSONObject(); String odin_set_admin = destination.length() == 0 ? source : destination; if (message.size() > 2) { ByteBuffer byteBuffer = ByteBuffer.allocate(message.size()); for (byte b : message) { byteBuffer.put(b); } Byte odin_set_data_type = byteBuffer.get(0); BitcoinVarint odin_set_len_varint = BitcoinVarint.getFromBuffer(byteBuffer, 1); int odin_set_length = odin_set_len_varint.intValue(); int odin_set_start = 1 + odin_set_len_varint.size(); logger.info("\n=============================\n message.size()=" + message.size() + ",odin_set_start=" + odin_set_start + ",odin_set_length=" + odin_set_length + "\n=====================\n"); if (!source.equals("") && message.size() == odin_set_start + odin_set_length) { validity = "valid"; byte[] odin_set_byte_array = new byte[odin_set_length]; for (int off = 0; off < odin_set_length; off++) { odin_set_byte_array[off] = byteBuffer.get(odin_set_start + off); } try { if (odin_set_data_type == Config.DATA_BIN_GZIP) { odin_set = new JSONObject(Util.uncompress(new String(odin_set_byte_array, Config.BINARY_DATA_CHARSET))); } else { odin_set = new JSONObject(new String(odin_set_byte_array, Config.PPK_TEXT_CHARSET)); } logger.info("\n=============================\n odin_set=" + odin_set.toString() + "\n=====================\n"); } catch (Exception e) { odin_set = new JSONObject(); logger.error(e.toString()); } } } PreparedStatement ps = db.connection.prepareStatement("insert into odins(tx_index, tx_hash, block_index, full_odin,short_odin,admin, register,odin_set,validity) values('" + txIndex.toString() + "','" + txHash + "','" + blockIndex.toString() + "','" + full_odin + "','" + short_odin.toString() + "',?,'" + source + "',?,'" + validity + "');"); ps.setString(1, odin_set_admin); ps.setString(2, odin_set.toString()); ps.execute(); } } catch (SQLException e) { logger.error(e.toString()); } } public static OdinInfo getOdinInfo(String odin) { Database db = Database.getInstance(); ResultSet rs = db.executeQuery("select cp.full_odin,cp.short_odin,cp.register,cp.admin ,cp.tx_hash ,cp.tx_index ,cp.block_index,transactions.block_time,cp.odin_set, cp.validity from odins cp,transactions where (cp.full_odin='" + odin + "' or cp.short_odin='" + odin + "') and cp.tx_index=transactions.tx_index;"); try { if (rs.next()) { OdinInfo odinInfo = new OdinInfo(); odinInfo.fullOdin = rs.getString("full_odin"); odinInfo.shortOdin = rs.getInt("short_odin"); odinInfo.register = rs.getString("register"); odinInfo.admin = rs.getString("admin"); odinInfo.txIndex = rs.getInt("tx_index"); odinInfo.txHash = rs.getString("tx_hash"); odinInfo.blockIndex = rs.getInt("block_index"); odinInfo.blockTime = rs.getInt("block_time"); odinInfo.validity = rs.getString("validity"); try { odinInfo.odinSet = new JSONObject(rs.getString("odin_set")); } catch (Exception e) { odinInfo.odinSet = new JSONObject(); logger.error(e.toString()); } return odinInfo; } } catch (SQLException e) { } return null; } public static Integer getShortOdin(String full_odin) { Database db = Database.getInstance(); ResultSet rs = db.executeQuery("select full_odin,short_odin from odins where full_odin='" + full_odin + "';"); try { if (rs.next()) { return rs.getInt("short_odin"); } } catch (SQLException e) { } return -1; } public static boolean checkUpdatable(String authSet, String updater, String register, String admin) { if (((authSet == null || authSet.length() == 0 || authSet.equals("1")) && updater.equals(admin)) || ((authSet.equals("0") || authSet.equals("2")) && (updater.equals(register) || updater.equals(admin)))) { return true; } else { return false; } } public static Integer getLastShortOdin() { Database db = Database.getInstance(); ResultSet rs = db.executeQuery("SELECT short_odin from odins order by short_odin DESC LIMIT 1;"); try { while (rs.next()) { return rs.getInt("short_odin"); } } catch (SQLException e) { } return -1; } }
[ "yefanbupt@gmail.com" ]
yefanbupt@gmail.com
b97576ddd160b7c9a15f01b2feb3185f62ce4c5b
404e099c339f0dc743fda4c15a397f1c1adab676
/src/main/java/br/edu/unoescsmo/cadastrotrilheiro/controller/MotoController.java
3701cfd506c3da79646db99ef74acb5f73e63b8b
[]
no_license
bravesoftdz/spring_cadastro_trilheiros
7d7e0a9cce6d619104fb0dfc5434fc50cb8767a3
4b43400959ebd9ce907b1d49fbe12bc124e3e8e6
refs/heads/master
2020-04-21T05:10:50.707525
2018-08-03T01:00:36
2018-08-03T01:00:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,894
java
package br.edu.unoescsmo.cadastrotrilheiro.controller; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import br.edu.unoescsmo.cadastrotrilheiro.model.Moto; import br.edu.unoescsmo.cadastrotrilheiro.regras.MotoRegra; @Controller @RequestMapping("/moto") public class MotoController { @Autowired private MotoRegra motoRegra; @PostMapping("/salvar") public String salvar(@Valid Moto moto, BindingResult erros) { if (erros.hasErrors()) { return "moto/novo"; } motoRegra.salvar(moto); return "redirect:/moto/listar"; } @PostMapping("/alterar") public String alterar(@Valid Moto moto, BindingResult erros) { if (erros.hasErrors()) { return "moto/visualizar"; } motoRegra.salvar(moto); return "redirect:/moto/listar"; } @GetMapping("/listar") public String listar(Model model) { // Torna a lista de motos acessível no JSP model.addAttribute("motos", motoRegra.listar()); // caminho + nome do JSP que será renderizado para a tela return "moto/lista"; } @GetMapping("/novo") public String novo() { return "moto/novo"; } @GetMapping("/deletar/{codigo}") public String deletar(@PathVariable("codigo") Long codigo) { motoRegra.excluir(new Moto(codigo)); return "redirect:/moto/listar"; } @GetMapping("/visualizar/{codigo}") public String visualizar(@PathVariable("codigo") Long codigo, Model model) { model.addAttribute("moto", motoRegra.buscarPorCodigo(codigo)); return "moto/visualizar"; } }
[ "edu02_rko@hotmail.com" ]
edu02_rko@hotmail.com
35ad048385166f09ed67621d5e1c72cbc4628050
e4b4702cf176aeba80fc16d90adba9b6872b940e
/gestorprograma/RuntimeScript.java
b4d3ffb34c2646a365d5c52176cafee183f84a8b
[]
no_license
samudm98/Test-Better-Code-Hub
41d380ebb40c7f4a536d8ddffe8e02696d30c491
93bd9d13204792a81705d299a2a2d0acd3e05330
refs/heads/master
2022-04-25T16:48:45.262846
2020-05-02T00:50:01
2020-05-02T00:50:01
260,587,672
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package co.gov.ugpp.parafiscales.servicios.liquidador.srvaplliquidacion.gestorprograma; public interface RuntimeScript { public Double ejecutarScript(String script) throws Exception; }
[ "samudm98@hotmail.com" ]
samudm98@hotmail.com
73e293fa652052ec1ffebcf0b2653c396fe80edc
bd363063a6de751577e7b9833744e5d7f6e1836f
/app/src/main/java/com/qzr/sevenplayer/utils/ThreadPoolProxy.java
1dd85894602f18ca4cbd7df55f479f38e8368450
[ "Apache-2.0" ]
permissive
qzhuorui/SevenPlayer
3187dcf2ad84b888c3342bee4363d657670fa064
0dc714307958ccf77cf4843f59016b869089f765
refs/heads/master
2023-03-12T18:12:54.703085
2021-02-28T03:49:29
2021-02-28T03:49:29
278,985,631
0
0
null
null
null
null
UTF-8
Java
false
false
3,466
java
package com.qzr.sevenplayer.utils; import java.util.HashMap; import java.util.Map; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * @ProjectName: SevenPlayer * @Package: com.qzr.sevenplayer.utils * @ClassName: ThreadPoolProxy * @Description: * @Author: qzhuorui * @CreateDate: 2020/7/11 9:58 */ public class ThreadPoolProxy { private static final String TAG = "ThreadPoolProxy"; private ThreadPoolExecutor mThreadPoolExecutor; private ScheduledThreadPoolExecutor mScheduledThreadPoolExecutor; private int mCorePoolSize; private int mMaxmumPoolSize; private Map<Runnable, ScheduledFuture> repeatTasks; public ThreadPoolProxy(int mCorePoolSize, int mMaxmumPoolSize) { this.mCorePoolSize = mCorePoolSize; this.mMaxmumPoolSize = mMaxmumPoolSize; } private void initThreadPoolExecutor() { if (mThreadPoolExecutor == null || mThreadPoolExecutor.isShutdown() || mThreadPoolExecutor.isTerminated()) { synchronized (ThreadPoolProxy.class) { if (mThreadPoolExecutor == null || mThreadPoolExecutor.isShutdown() || mThreadPoolExecutor.isTerminated()) { long keepAliveTime = 3000; TimeUnit timeUnit = TimeUnit.MILLISECONDS; BlockingQueue<Runnable> workQueue = new LinkedBlockingDeque<>(); ThreadFactory threadFactory = new SimpleThreadFactory(); RejectedExecutionHandler handler = new ThreadPoolExecutor.AbortPolicy(); mThreadPoolExecutor = new ThreadPoolExecutor(mCorePoolSize, mMaxmumPoolSize, keepAliveTime, timeUnit, workQueue, threadFactory, handler); if (mScheduledThreadPoolExecutor == null) { mScheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(mCorePoolSize, threadFactory, handler); repeatTasks = new HashMap<>(4); } } } } } public void execute(Runnable task) { initThreadPoolExecutor(); mThreadPoolExecutor.execute(task); } public void remove(Runnable task) { initThreadPoolExecutor(); mThreadPoolExecutor.remove(task); } public void executeRepeatTask(Runnable task, int delay, int period, TimeUnit timeUnit) { initThreadPoolExecutor(); ScheduledFuture future = mScheduledThreadPoolExecutor.scheduleAtFixedRate(task, delay, period, timeUnit); repeatTasks.put(task, future); } public void cancelRepeatTask(Runnable task) { if (task == null) { throw new RuntimeException("cancelRepeatTask task is null"); } initThreadPoolExecutor(); ScheduledFuture future = repeatTasks.get(task); if (future == null) { return; } future.cancel(true); repeatTasks.remove(task); mScheduledThreadPoolExecutor.remove(task); } class SimpleThreadFactory implements ThreadFactory { @Override public Thread newThread(Runnable r) { return new Thread(r, TAG); } } }
[ "qzhuorui@163.com" ]
qzhuorui@163.com
a6012f64630f20aa708b3a8c552e3f79051e28eb
e049d400d275409066091fce60d6ae6fdb030717
/src/main/java/com/justdo/system/quartzjob/dao/QuartzJobDao.java
e03c3bbb26cbdd713f45e930fffd0cb809ad3e00
[]
no_license
chenlinxp/JustDo-boot
06ce4b7063449800c4ea76da9df6b1a6e616bfa1
c3d49ec01570416bd6e0ec4086ac7e3bd9621b7a
refs/heads/dev
2022-09-12T05:23:18.401766
2020-05-08T09:02:35
2020-05-08T09:02:35
139,741,990
1
0
null
2022-09-01T22:51:26
2018-07-04T15:55:51
JavaScript
UTF-8
Java
false
false
1,127
java
package com.justdo.system.quartzjob.dao; import com.justdo.system.quartzjob.domain.QuartzJobTaskDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; import java.util.Map; /** * * 自动任务 * @author chenlin * @email 13233669915@qq.com * @date 2018-06-19 16:02:20 */ @Mapper public interface QuartzJobDao { /** * 返回实体 * @param schedulerTaskId * @return SchedulerTaskDO */ QuartzJobTaskDO get(String schedulerTaskId); /** * 返回实体list * @param map * @return list */ List<QuartzJobTaskDO> list(Map<String,Object> map); /** * 返回数量 * @param map * @return */ int count(Map<String,Object> map); /** * 保存实体 * @param schedulerTask * @return */ int save(QuartzJobTaskDO schedulerTask); /** * 更新实体 * @param schedulerTask * @return list */ int update(QuartzJobTaskDO schedulerTask); /** * 删除实体 * @param schedulerTaskId * @return list */ int del(String schedulerTaskId); /** * 批量删除实体 * @param schedulerTaskIds * @return list */ int batchDel(String[] schedulerTaskIds); }
[ "13233669915@qq.com" ]
13233669915@qq.com
b3e529414e07f830faa8a9a2e3126be09f677bd4
81e8fe44bb3cae1305dbcdc920fbb5ad2cece782
/src/englishlearning/presenter/Presenter.java
a5247a8c17e24a854c6cc5c6601801b589474b9d
[]
no_license
yuyuvn/OOP-Learning-English
75c0444bbdc646979ce4cb6670d71040ddcd9120
9b7b0ea077f280075b388f98aaf2bc86e929b2fd
refs/heads/master
2020-05-17T00:34:26.221405
2014-05-19T11:36:53
2014-05-19T11:36:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
786
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package englishlearning.presenter; import englishlearning.views.Controller; /** * * @author Clicia * @param <V> */ public abstract class Presenter<V extends Controller> { private V view; public Presenter() { } public Presenter(V view) { setView(view); } public final void setView(V view) { if (this.view != null) throw new RuntimeException("View had been set"); this.view = view; this.initialize(); } protected V getView() { return view; } protected abstract void initialize(); }
[ "yuyuvn@mac.com" ]
yuyuvn@mac.com
c49e7245f65480bdfeff87118474afa640c20ef1
ae7056bbdb6ad24fa5ffa0bb363b9d8975e78993
/app/src/main/java/jyq/readerwithmvp/api/retrofit/ZhihuApi.java
e38c1cfc38e26b4db30fb6f311e8fb3d0b9f7520
[]
no_license
echojiangyq/ReaderWithMVP
772e1d2e30c1c5951677bc722529fd7e64b4ddde
64119cea91ed2996bb43a342ced058b1aeb54dd5
refs/heads/master
2021-01-12T14:56:08.389720
2016-09-23T03:52:58
2016-09-23T03:52:58
68,918,077
0
0
null
null
null
null
UTF-8
Java
false
false
790
java
package jyq.readerwithmvp.api.retrofit; import jyq.readerwithmvp.bean.zhihu.NewsBefore; import jyq.readerwithmvp.bean.zhihu.NewsDetail; import jyq.readerwithmvp.bean.zhihu.NewsLatest; import jyq.readerwithmvp.bean.zhihu.SplarshImg; import retrofit2.http.GET; import retrofit2.http.Path; import rx.Observable; /** * 作者:EchoJ on 2016/9/23 10:35 <br> * 邮箱:echojiangyq@gmail.com <br> * 描述:知乎api */ public interface ZhihuApi { @GET("start-image/1080*1920") Observable<SplarshImg> getSplashImg(); @GET("news/latest") Observable<NewsLatest> getLastestNews(); @GET("news/before/{time}") Observable<NewsBefore> getBeforetNews(@Path("time") String time); @GET("news/{id}") Observable<NewsDetail> getDetailNews(@Path("id") String id); }
[ "echojiangyq@gmail.com" ]
echojiangyq@gmail.com
db61e774cc6a3fc6a14a816cdfe1d71240799484
181542de82c42020ffab8e4f926e04edb615494f
/src/services/BookingService.java
7a09178b5ebb1e9f3b948bb3b763d6bb45eb5590
[]
no_license
EnduranceA/hop_shop
a1d715731aeb0d0588d2a0381b79364c516b6a5d
232f3c693f29cce21cfad965ff2ad137e650528f
refs/heads/master
2020-08-12T06:49:58.514621
2019-11-17T16:20:06
2019-11-17T16:20:06
214,710,201
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
package services; import models.Booking; import models.Product; import repositories.BookingRepositoryImpl; import java.util.List; public class BookingService { private BookingRepositoryImpl bookingRepository; public BookingService() { this.bookingRepository = new BookingRepositoryImpl(); } public void addBooking(Booking booking) { bookingRepository.save(booking); } public void saveProducts(Booking booking, List<Product> basket) { for (int i = 0; i < basket.size(); i++) { bookingRepository.saveProduct(booking.getId(), basket.get(i).getId()); } } public List<Booking> findAllBookings(int id) { return bookingRepository.findBookingsBy(id); } }
[ "elanskaya.lina@inbox.ru" ]
elanskaya.lina@inbox.ru
8d42979fa8fa32a78fc7401db26a0b9f84013b97
7fc3d9b28f5aefab4b8406a2dc5a2530b69ddbb6
/app/src/main/java/com/retrofit/lk/retrofittest/listener/DownloadListener.java
a6977cb27255031ec403275c447208c1aee4b84d
[]
no_license
dengdailk/retrofitTest
3cb1107381353cd7e8b426a53cf170ec2e7510ee
1614d370a181987671ef1a6ae8d6f68902d46842
refs/heads/master
2020-04-10T04:28:43.724982
2018-12-07T09:10:40
2018-12-07T09:10:40
160,799,599
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package com.retrofit.lk.retrofittest.listener; public interface DownloadListener { void onStart(); void onProgress(int currentLength); void onFinish(String localPath); void onFailure(String erroInfo); }
[ "291996307@qq.com" ]
291996307@qq.com
7e19f71f858193fb05ef6a6494a924bbc4cca396
5fc68d75a8d81cb11732f7a28409ee7150d88baf
/Lab12/EvenIntergers.java
63cd1d7e2f4a1fec8d50db4e125b8af63970c5ea
[]
no_license
amandavenue/COMP160
18d99b68c4ab7965c4557511a0f213fb0dc27328
2f4f702c00ff4622d07e192ad021e89c09adaf9f
refs/heads/master
2020-03-08T01:51:36.285168
2018-04-03T03:04:33
2018-04-03T03:04:33
127,842,528
0
0
null
null
null
null
UTF-8
Java
false
false
809
java
import java.util.Scanner; /** EvenIntergers.java * Amanda Veldman August 2016 * prints all even numbers between 2 and a user entered value */ public class EvenIntergers{ public static void main(String[] args){ int sum = 0, count = 2; Scanner scan = new Scanner(System.in); System.out.println("Enter an interger larger than 1: "); int userInt = scan.nextInt(); if (userInt < 2){ System.out.println("Input value must not be less than 2"); } /* while loop to add all even values up to the user int */ while (count <= userInt){ if (count % 2 == 0){ sum += count; count ++; } else { count ++; } System.out.println("Sum of even numbers between 2 and " + userInt + " inclusive is: " + sum); } } }
[ "aveldman@oucs1509.otago.ac.nz" ]
aveldman@oucs1509.otago.ac.nz
5ac8beb22dc9bfcaf4074fbf434087c1cbd3fa34
6b5432c55588ae56ec0a0ea4c9a4b1e31756894b
/PentagoMVC_V1_Grit/SController.java
45765bb4d5e914cad73cda809cd97e194523d6da
[]
no_license
Friochips/Pentago
73578b483341d9c08d19961bd2a6500b4ea46585
359fce112ac295dbc3b95b0e90ed88ff4436bf32
refs/heads/master
2020-04-20T21:17:44.950506
2019-05-28T06:34:09
2019-05-28T06:34:09
166,442,109
2
1
null
null
null
null
UTF-8
Java
false
false
1,127
java
import java.awt.event.*; import java.awt.*; import javax.swing.JButton; /** * Title: Controller * Description: Dies ist der Controller dieses Spiels. * Der Controller hat das Spiel und kennt die View. */ public class SController implements ActionListener { private View myView; Spiel game = new Spiel(); int Spieler = 1; int ButtonCtrl = 1; public SController(View pView) { myView = pView; } public void actionPerformed (ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("Exit")) { System.exit(0); } JButton sourceButton = ((JButton)e.getSource()); if (sourceButton.getBackground() == Color.red || sourceButton.getBackground() == Color.blue) { return; } game.Press(Integer.parseInt(cmd.substring(5,6)), Integer.parseInt(cmd.substring(7))); if((Spieler % 2) == 1) { sourceButton.setBackground(Color.red); } else { sourceButton.setBackground(Color.blue); } Spieler++; } }
[ "noreply@github.com" ]
noreply@github.com
9d471c09f130b4a88ec772b83f2996142bdd349b
4b6404edfd7ee3bcd46dc4b250fcd1b15572e7e7
/algorithms/Sort.java
4c921029351785a55a9960d5b0f0f617adbfee16
[]
no_license
vineetkeshari/Java-practice
124c007a05fbc5c455ffbce8b3990a44d9426eed
ae524125e3177619fefa3872bfc8eb21a1dd912a
refs/heads/master
2021-01-01T15:55:08.462228
2013-10-07T10:05:58
2013-10-07T10:05:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,546
java
package algorithms; import java.util.ArrayList; import algorithms.Math; public class Sort { public static final int MAXVAL = 1000; public static void main (String[] args) { int[] smallArray, mediumArray, largeArray; System.out.println ("Test merge sort"); smallArray = generateRandomArray(MAXVAL); mediumArray = duplicateNTimes (smallArray, 10); largeArray = duplicateNTimes (mediumArray, 10); mergeSort(smallArray, true); mergeSort(mediumArray, true); mergeSort(largeArray, true); System.out.println (); System.out.println ("Test insertion sort"); smallArray = generateRandomArray(MAXVAL); mediumArray = duplicateNTimes (smallArray, 10); largeArray = duplicateNTimes (mediumArray, 10); insertionSort(smallArray, true); insertionSort(mediumArray, true); insertionSort(largeArray, true); System.out.println (); System.out.println ("Test quick sort"); smallArray = generateRandomArray(MAXVAL); mediumArray = duplicateNTimes (smallArray, 10); largeArray = duplicateNTimes (mediumArray, 10); quickSort(smallArray, true); quickSort(mediumArray, true); quickSort(largeArray, true); System.out.println (); System.out.println ("Test randomized quick sort"); smallArray = generateRandomArray(MAXVAL); mediumArray = duplicateNTimes (smallArray, 10); largeArray = duplicateNTimes (mediumArray, 10); randomizedQuickSort(smallArray, true); randomizedQuickSort(mediumArray, true); randomizedQuickSort(largeArray, true); System.out.println (); System.out.println ("Test counting sort"); smallArray = generateRandomArray(MAXVAL); mediumArray = duplicateNTimes (smallArray, 10); largeArray = duplicateNTimes (mediumArray, 10); countingSort(smallArray, true); countingSort(mediumArray, true); countingSort(largeArray, true); System.out.println (); System.out.println ("Test bucket sort"); smallArray = generateRandomArray(MAXVAL); mediumArray = duplicateNTimes (smallArray, 10); largeArray = duplicateNTimes (mediumArray, 10); bucketSort(smallArray, true); bucketSort(mediumArray, true); bucketSort(largeArray, true); System.out.println (); } private static int[] generateRandomArray (int size) { int[] array = new int[size]; for (int i=0; i<size; ++i) array[i] = (int)(Math.random()*MAXVAL); return array; } private static int[] duplicateNTimes (int[] array, int n) { int[] newArray = new int[array.length*n]; for (int i=0; i<n; ++i) for (int j=0; j<array.length; ++j) newArray[i*array.length+j] = array[j]; return newArray; } private static void printArray (int[] nums) { for (int i : nums) System.out.print (i + " "); System.out.println(); } public static void mergeSort (int[] nums, boolean showTiming) { long start = System.nanoTime( ); mergeSort (nums, 0, nums.length); long end = System.nanoTime( ); //printArray (nums); if (showTiming) System.out.println((end-start) + " nanos to sort " + nums.length + " elements."); } private static void mergeSort (int[] nums, int start, int end) { if (end-start < 2) return; int mid = (start + end) / 2; mergeSort (nums, start, mid); mergeSort (nums, mid, end); int[] temp = new int[end-start]; int p1 = start, p2 = mid, counter=0; while (p1 < mid && p2 < end) if (nums[p1] < nums[p2]) { temp[counter++] = nums[p1]; ++p1; } else { temp[counter++] = nums[p2]; ++p2; } if (p1<mid) for (; p1<mid; ++p1) temp[counter++] = nums[p1]; if (p2<end) for(; p2<end; ++p2) temp[counter++] = nums[p2]; for (int i=0; i<temp.length; ++i) nums[start+i] = temp[i]; } public static void insertionSort (int[] nums, boolean showTiming) { long start = System.nanoTime( ); for (int i=1; i<nums.length; ++i) for (int j=i; j>0 && nums[j-1]>nums[j]; --j) { int t = nums[j]; nums[j] = nums[j-1]; nums[j-1] = t; } long end = System.nanoTime( ); //printArray (nums); if (showTiming) System.out.println((end-start) + " nanos to sort " + nums.length + " elements."); } public static void quickSort (int[] nums, boolean showTiming) { long start = System.nanoTime( ); quickSort (nums, 0, nums.length, false); long end = System.nanoTime( ); //printArray (nums); if (showTiming) System.out.println((end-start) + " nanos to sort " + nums.length + " elements."); } public static void randomizedQuickSort (int[] nums, boolean showTiming) { long start = System.nanoTime( ); quickSort (nums, 0, nums.length, true); long end = System.nanoTime( ); //printArray (nums); if (showTiming) System.out.println((end-start) + " nanos to sort " + nums.length + " elements."); } private static void quickSort (int[] nums, int start, int end, boolean randomize) { if (end-start < 2) return; int pivot = partition (nums, start, end, randomize); quickSort (nums, start, pivot, randomize); quickSort (nums, pivot+1, end, randomize); } private static int partition (int[] nums, int start, int end, boolean randomize) { int t; if (randomize) { int randPivot = start + (int)(Math.random()*(end-start)); t = nums[end-1]; nums[end-1] = nums[randPivot]; nums[randPivot] = t; } int s=start; for (int i=start; i<end-1; ++i) if (nums[i] < nums[end-1]) { t = nums[s]; nums[s++] = nums[i]; nums[i] = t; } t = nums[s]; nums[s] = nums[end-1]; nums[end-1] = t; return s; } public static void countingSort (int[] nums, boolean showTiming) { long start = System.nanoTime( ); int[] counts = new int[MAXVAL]; for (int num : nums) { counts[num]++; } int index=0; for (int i=0; i<counts.length; ++i) for (int j=0; j<counts[i]; ++j) nums[index++] = i; long end = System.nanoTime( ); //printArray(nums); if (showTiming) System.out.println((end-start) + " nanos to sort " + nums.length + " elements."); } public static void bucketSort (int[] nums, boolean showTiming) { long start = System.nanoTime( ); final int BUCKETSIZE = (int)(Math.sqrt(MAXVAL)); Bucket[] buckets = new Bucket[MAXVAL/BUCKETSIZE+1]; for (int i=0; i<buckets.length; ++i) buckets[i] = new Bucket(); for (int i : nums) { int bucket = i/BUCKETSIZE; buckets[bucket].numbersList.add(i); } int base=0; for (int i=0; i<buckets.length; ++i) { arrayListToArray(buckets[i]); quickSort (buckets[i].numbers, false); addAll (nums, buckets[i].numbers, base); base += buckets[i].numbers.length; } long end = System.nanoTime( ); //printArray(nums); if (showTiming) System.out.println((end-start) + " nanos to sort " + nums.length + " elements."); } private static class Bucket { public ArrayList<Integer> numbersList = new ArrayList<Integer>(); public int[] numbers; } private static void arrayListToArray (Bucket b) { b.numbers = new int[b.numbersList.size()]; for (int i=0; i<b.numbers.length; ++i) b.numbers[i] = b.numbersList.get(i); b.numbersList = null; } private static void addAll (int[] nums, int[] bucket, int base) { for (int i=0; i<bucket.length; ++i) nums[base+i] = bucket[i]; } }
[ "vkeshari@ubuntu.(none)" ]
vkeshari@ubuntu.(none)
c750b866e37e65eedddfc52d7643e9177e1d4162
8ae60f619b1a74763155581abfdd548275267604
/src/main/java/com/common/grid/model/Column.java
8d536c60f3c87a92903285988b1a2d7e1e997902
[]
no_license
luopc/web_frame_learn
6f251a24a5a4e3fd18bf2ee85998ca37a17986a0
7dbc471621789e8039e0e522c39510dea02b6b31
refs/heads/master
2021-09-11T08:23:02.226716
2018-04-06T08:49:06
2018-04-06T08:49:06
66,146,205
0
0
null
null
null
null
UTF-8
Java
false
false
4,692
java
package com.common.grid.model; import java.util.Map; public class Column { /** * 编号 */ private String id; /** * 是否参与高级查询 */ private String search; /** * 是否作为导出列导出[default:true] */ private boolean export = true; /** * 是否作为打印列打印[default:true] */ private boolean print = true; /** * 是否作为扩展列隐藏备用[default:true(对于自定义的复选或相关操作内容,请设置为false以免数据冲突)] */ private boolean extra = true; /** * 显示的列名 */ private String title; /** * 列宽 */ private String width; /** * 数据类型 */ private String type; /** * 格式化 */ private String format; /** * 原始数据类型 */ private String otype; /** * 原始格式 */ private String oformat; /** * 码表映射,用于高级查询及显示 */ private Map<String, Object> codeTable; /** * 列样式 */ private String columnStyle; /** * 列样式表 */ private String columnClass; /** * 列头样式 */ private String headerStyle; /** * 列头样式表 */ private String headerClass; /** * 彻底隐藏 */ private boolean hide = false; /** * 隐藏类别 */ private String hideType; /** * 快速查询 */ private boolean fastQuery; /** * 快速查询类别 */ private String fastQueryType; /** * 高级查询 */ private boolean advanceQuery; /** * 回调方法,参数:record value */ private String resolution; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSearch() { return search; } public void setSearch(String search) { this.search = search; } public boolean isExport() { return export; } public void setExport(boolean export) { this.export = export; } public boolean isPrint() { return print; } public void setPrint(boolean print) { this.print = print; } public boolean isExtra() { return extra; } public void setExtra(boolean extra) { this.extra = extra; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getFormat() { return format; } public void setFormat(String format) { this.format = format; } public String getOtype() { return otype; } public void setOtype(String otype) { this.otype = otype; } public String getOformat() { return oformat; } public void setOformat(String oformat) { this.oformat = oformat; } public Map<String, Object> getCodeTable() { return codeTable; } public void setCodeTable(Map<String, Object> codeTable) { this.codeTable = codeTable; } public String getColumnStyle() { return columnStyle; } public void setColumnStyle(String columnStyle) { this.columnStyle = columnStyle; } public String getColumnClass() { return columnClass; } public void setColumnClass(String columnClass) { this.columnClass = columnClass; } public String getHeaderStyle() { return headerStyle; } public void setHeaderStyle(String headerStyle) { this.headerStyle = headerStyle; } public String getHeaderClass() { return headerClass; } public void setHeaderClass(String headerClass) { this.headerClass = headerClass; } public boolean isHide() { return hide; } public void setHide(boolean hide) { this.hide = hide; } public String getHideType() { return hideType; } public void setHideType(String hideType) { this.hideType = hideType; } public boolean isFastQuery() { return fastQuery; } public void setFastQuery(boolean fastQuery) { this.fastQuery = fastQuery; } public String getFastQueryType() { return fastQueryType; } public void setFastQueryType(String fastQueryType) { this.fastQueryType = fastQueryType; } public boolean isAdvanceQuery() { return advanceQuery; } public void setAdvanceQuery(boolean advanceQuery) { this.advanceQuery = advanceQuery; } public String getResolution() { return resolution; } public void setResolution(String resolution) { this.resolution = resolution; } }
[ "chengfeng00357@163.com" ]
chengfeng00357@163.com
74fb562ad2b85efb8daed56cd77e4d7e257b1e94
4069ccc0b30a75abeb46caa0c725756389afdb24
/src/main/java/com/crud/tasks/mapper/TrelloMapper.java
5502a8a353d88fa82590d5d03e5832ad9be5ad55
[]
no_license
zajacamadeusz/rest-tasks-app
3bbbd13d7176d21a7e270f27f1983b553f450e0f
f1834b50ad7df759c3569c142082c716de900999
refs/heads/master
2022-01-31T16:13:50.727739
2019-07-02T07:48:49
2019-07-02T07:48:49
110,605,147
0
0
null
null
null
null
UTF-8
Java
false
false
1,936
java
package com.crud.tasks.mapper; import com.crud.tasks.domain.*; import org.springframework.stereotype.Component; import java.util.List; import static java.util.stream.Collectors.toList; @Component public class TrelloMapper { public List<TrelloBoard> mapToBoards(final List<TrelloBoardDto> trelloBoardDto) { return trelloBoardDto.stream() .map(trelloBoard -> new TrelloBoard(trelloBoard.getId(), trelloBoard.getName(), maptoList(trelloBoard.getLists()))) .collect(toList()); } public List<TrelloBoardDto> mapToBoardsDto(final List<TrelloBoard> trelloBoards) { return trelloBoards.stream() .map(trelloBoard -> new TrelloBoardDto(trelloBoard.getId(), trelloBoard.getName(), maptoListDto(trelloBoard.getLists()))) .collect(toList()); } public List<TrelloList> maptoList(final List<TrelloListDto> trelloListDto) { return trelloListDto.stream() .map(trelloList -> new TrelloList(trelloList.getId(), trelloList.getName(), trelloList.isClosed())) .collect(toList()); } public List<TrelloListDto> maptoListDto(List<TrelloList> trelloLists) { return trelloLists.stream() .map(trelloList -> new TrelloListDto(trelloList.getId(), trelloList.getName(), trelloList.isClosed())) .collect(toList()); } public TrelloCard mapToCard(final TrelloCardDto trelloCardDto) { return new TrelloCard(trelloCardDto.getName(), trelloCardDto.getDescription(), trelloCardDto.getPos(), trelloCardDto.getListId()); } public TrelloCardDto mapToCardDto(final TrelloCard trelloCard) { return new TrelloCardDto(trelloCard.getName(), trelloCard.getDescription(), trelloCard.getPos(), trelloCard.getListId()); } }
[ "zajacamadeusz7@gmail.com" ]
zajacamadeusz7@gmail.com
297826a19cd710e3b0ffc13e784bb0994200e0b7
d60bd7144cb4428a6f7039387c3aaf7b295ecc77
/ScootAppSource/com/codetroopers/betterpickers/calendardatepicker/m.java
c81d26f4d9e060d61144546575a315389b50c2df
[]
no_license
vaquarkhan/Scoot-mobile-app
4f58f628e7e2de0480f7c41998cdc38100dfef12
befcfb58c1dccb047548f544dea2b2ee187da728
refs/heads/master
2020-06-10T19:14:25.985858
2016-12-08T04:39:10
2016-12-08T04:39:10
75,902,491
1
0
null
null
null
null
UTF-8
Java
false
false
11,456
java
package com.codetroopers.betterpickers.calendardatepicker; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Align; import android.graphics.Paint.Style; import android.graphics.Typeface; import android.os.Build.VERSION; import android.support.v4.view.cb; import android.text.format.DateUtils; import android.text.format.Time; import android.view.MotionEvent; import android.view.View; import android.view.View.AccessibilityDelegate; import android.view.View.MeasureSpec; import com.codetroopers.betterpickers.R.color; import com.codetroopers.betterpickers.R.dimen; import com.codetroopers.betterpickers.R.string; import com.codetroopers.betterpickers.R.styleable; import com.codetroopers.betterpickers.c; import java.security.InvalidParameterException; import java.util.Calendar; import java.util.Formatter; import java.util.HashMap; import java.util.Locale; public abstract class m extends View { protected static int a = 32; protected static int b = 10; protected static int c = 1; protected static int d; protected static int e; protected static int f; protected static int g; protected static int h; protected static float i = 0.0F; protected int A = 7; protected int B = this.A; protected int C = -1; protected int D = -1; protected int E = -1; protected int F = -1; protected int G; protected int H; protected int I; protected int J; protected int K; private String L; private String M; private final Formatter N; private final StringBuilder O; private final Calendar P; private final Calendar Q; private final n R; private int S = 6; private o T; private boolean U; private int V = 0; protected int j = 0; protected Paint k; protected Paint l; protected Paint m; protected Paint n; protected Paint o; protected int p = -1; protected int q = -1; protected int r = -1; protected int s; protected int t; protected int u; protected int v = a; protected boolean w = false; protected int x = -1; protected int y = -1; protected int z = 1; public m(Context paramContext) { super(paramContext); paramContext = paramContext.getResources(); this.Q = Calendar.getInstance(); this.P = Calendar.getInstance(); this.L = paramContext.getString(R.string.day_of_week_label_typeface); this.M = paramContext.getString(R.string.sans_serif); this.G = paramContext.getColor(R.color.date_picker_text_normal); this.H = paramContext.getColor(R.color.date_picker_text_disabled); this.I = paramContext.getColor(R.color.bpBlue); this.J = paramContext.getColor(R.color.date_picker_text_normal); this.K = paramContext.getColor(R.color.circle_background); this.O = new StringBuilder(50); this.N = new Formatter(this.O, Locale.getDefault()); d = paramContext.getDimensionPixelSize(R.dimen.day_number_size); e = paramContext.getDimensionPixelSize(R.dimen.month_label_size); f = paramContext.getDimensionPixelSize(R.dimen.month_day_label_text_size); g = paramContext.getDimensionPixelOffset(R.dimen.month_list_item_header_height); h = paramContext.getDimensionPixelSize(R.dimen.day_number_select_circle_radius); this.v = ((paramContext.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - g) / 6); this.R = new n(this, this); cb.a(this, this.R); cb.c(this, 1); this.U = true; a(); } private boolean a(int paramInt) { return ((this.F < 0) || (paramInt <= this.F)) && ((this.E < 0) || (paramInt >= this.E)); } private boolean a(int paramInt, Time paramTime) { return (this.t == paramTime.year) && (this.s == paramTime.month) && (paramInt == paramTime.monthDay); } private void b(int paramInt) { if (this.T != null) { this.T.a(this, new l(this.t, this.s, paramInt)); } this.R.a(paramInt, 1); } private void b(Canvas paramCanvas) { int i1 = (this.u + this.j * 2) / 2; int i2 = (g - f) / 2; int i3 = e / 3; paramCanvas.drawText(getMonthAndYearString(), i1, i2 + i3, this.l); } private void c(Canvas paramCanvas) { int i2 = g; int i3 = f / 2; int i4 = (this.u - this.j * 2) / (this.A * 2); int i1 = 0; while (i1 < this.A) { int i5 = this.z; int i6 = this.A; int i7 = this.j; this.Q.set(7, (i5 + i1) % i6); paramCanvas.drawText(this.Q.getDisplayName(7, 1, Locale.getDefault()).toUpperCase(Locale.getDefault()), (i1 * 2 + 1) * i4 + i7, i2 - i3, this.o); i1 += 1; } } private int d() { int i1 = e(); int i2 = (this.B + i1) / this.A; if ((i1 + this.B) % this.A > 0) {} for (i1 = 1;; i1 = 0) { return i1 + i2; } } private int e() { if (this.V < this.z) {} for (int i1 = this.V + this.A;; i1 = this.V) { return i1 - this.z; } } private String getMonthAndYearString() { this.O.setLength(0); long l1 = this.P.getTimeInMillis(); return DateUtils.formatDateRange(getContext(), this.N, l1, l1, 52, Time.getCurrentTimezone()).toString(); } public int a(float paramFloat1, float paramFloat2) { int i1 = this.j; if ((paramFloat1 < i1) || (paramFloat1 > this.u - this.j)) { i1 = -1; } int i2; do { return i1; i2 = (int)(paramFloat2 - g) / this.v; i2 = (int)((paramFloat1 - i1) * this.A / (this.u - i1 - this.j)) - e() + 1 + i2 * this.A; if (i2 < 1) { break; } i1 = i2; } while (i2 <= this.B); return -1; } protected void a() { this.l = new Paint(); this.l.setFakeBoldText(true); this.l.setAntiAlias(true); this.l.setTextSize(e); this.l.setTypeface(Typeface.create(this.M, 1)); this.l.setColor(this.G); this.l.setTextAlign(Paint.Align.CENTER); this.l.setStyle(Paint.Style.FILL); this.m = new Paint(); this.m.setFakeBoldText(true); this.m.setAntiAlias(true); this.m.setColor(this.K); this.m.setTextAlign(Paint.Align.CENTER); this.m.setStyle(Paint.Style.FILL); this.n = new Paint(); this.n.setFakeBoldText(true); this.n.setAntiAlias(true); this.n.setColor(this.I); this.n.setTextAlign(Paint.Align.CENTER); this.n.setStyle(Paint.Style.FILL); this.n.setAlpha(60); this.o = new Paint(); this.o.setAntiAlias(true); this.o.setTextSize(f); this.o.setColor(this.G); this.o.setTypeface(Typeface.create(this.L, 0)); this.o.setStyle(Paint.Style.FILL); this.o.setTextAlign(Paint.Align.CENTER); this.o.setFakeBoldText(true); this.k = new Paint(); this.k.setAntiAlias(true); this.k.setTextSize(d); this.k.setStyle(Paint.Style.FILL); this.k.setTextAlign(Paint.Align.CENTER); this.k.setFakeBoldText(false); } protected void a(Canvas paramCanvas) { int i3 = (this.v + d) / 2 - c + g; int i6 = (this.u - this.j * 2) / (this.A * 2); int i1 = e(); int i2 = 1; while (i2 <= this.B) { int i4 = (i1 * 2 + 1) * i6 + this.j; int i5 = i3 - ((this.v + d) / 2 - c); int i7 = this.v; a(paramCanvas, this.t, this.s, i2, i4, i3, i4 - i6, i4 + i6, i5, i5 + i7, a(i2)); i5 = i1 + 1; i1 = i5; i4 = i3; if (i5 == this.A) { i1 = 0; i4 = i3 + this.v; } i2 += 1; i3 = i4; } } public abstract void a(Canvas paramCanvas, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7, int paramInt8, int paramInt9, boolean paramBoolean); public boolean a(l paraml) { if ((paraml.a != this.t) || (paraml.b != this.s) || (paraml.c > this.B)) { return false; } this.R.b(paraml.c); return true; } public void b() { this.S = 6; requestLayout(); } public void c() { this.R.d(); } public l getAccessibilityFocus() { int i1 = this.R.c(); if (i1 >= 0) { return new l(this.t, this.s, i1); } return null; } protected void onDraw(Canvas paramCanvas) { b(paramCanvas); c(paramCanvas); a(paramCanvas); } protected void onMeasure(int paramInt1, int paramInt2) { setMeasuredDimension(View.MeasureSpec.getSize(paramInt1), this.v * this.S + g); } protected void onSizeChanged(int paramInt1, int paramInt2, int paramInt3, int paramInt4) { this.u = paramInt1; this.R.b(); } public boolean onTouchEvent(MotionEvent paramMotionEvent) { switch (paramMotionEvent.getAction()) { } for (;;) { return true; int i1 = a(paramMotionEvent.getX(), paramMotionEvent.getY()); if (i1 >= 0) { b(i1); } } } public void setAccessibilityDelegate(View.AccessibilityDelegate paramAccessibilityDelegate) { if ((!this.U) && (Build.VERSION.SDK_INT >= 14)) { super.setAccessibilityDelegate(paramAccessibilityDelegate); } } public void setMonthParams(HashMap<String, Integer> paramHashMap) { if ((!paramHashMap.containsKey("month")) && (!paramHashMap.containsKey("year"))) { throw new InvalidParameterException("You must specify month and year for this view"); } setTag(paramHashMap); if (paramHashMap.containsKey("height")) { this.v = ((Integer)paramHashMap.get("height")).intValue(); if (this.v < b) { this.v = b; } } if (paramHashMap.containsKey("selected_day")) { this.x = ((Integer)paramHashMap.get("selected_day")).intValue(); } if (paramHashMap.containsKey("range_min")) { this.E = ((Integer)paramHashMap.get("range_min")).intValue(); } if (paramHashMap.containsKey("range_max")) { this.F = ((Integer)paramHashMap.get("range_max")).intValue(); } this.s = ((Integer)paramHashMap.get("month")).intValue(); this.t = ((Integer)paramHashMap.get("year")).intValue(); Time localTime = new Time(Time.getCurrentTimezone()); localTime.setToNow(); this.w = false; this.y = -1; this.P.set(2, this.s); this.P.set(1, this.t); this.P.set(5, 1); this.V = this.P.get(7); if (paramHashMap.containsKey("week_start")) {} for (this.z = ((Integer)paramHashMap.get("week_start")).intValue();; this.z = this.P.getFirstDayOfWeek()) { this.B = c.a(this.s, this.t); int i1 = 0; while (i1 < this.B) { int i2 = i1 + 1; if (a(i2, localTime)) { this.w = true; this.y = i2; } i1 += 1; } } this.S = d(); this.R.b(); } public void setOnDayClickListener(o paramo) { this.T = paramo; } public void setTheme(TypedArray paramTypedArray) { this.K = paramTypedArray.getColor(R.styleable.BetterPickersDialog_bpMainColor2, R.color.circle_background); this.I = paramTypedArray.getColor(R.styleable.BetterPickersDialog_bpAccentColor, R.color.bpBlue); this.H = paramTypedArray.getColor(R.styleable.BetterPickersDialog_bpMainTextColor, R.color.ampm_text_color); this.J = paramTypedArray.getColor(R.styleable.BetterPickersDialog_bpMainTextColor, R.color.ampm_text_color); a(); } } /* Location: D:\Android\dex2jar-2.0\classes-dex2jar.jar!\com\codetroopers\betterpickers\calendardatepicker\m.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "vaquar.khan@gmail.com" ]
vaquar.khan@gmail.com
1d043ac54dcf4ce70304b669f4fe258fd73d622f
a6d047c56d1c7782e2957c679e57ea76956e1e5e
/src/main/java/org/pjgg/flightSearch/connector/pricingrules/PricingRulesConnector.java
7dedabbc5452b8e101363ebc6a66325397975277
[]
no_license
pjgg/flightSearchPOC
545ec06e3224256785d54c1119979c32e043d607
04d43ed556837f54e8feda473e01711cb27651fb
refs/heads/master
2020-03-16T15:01:04.356777
2018-05-09T08:08:20
2018-05-09T08:08:20
65,756,334
1
1
null
null
null
null
UTF-8
Java
false
false
246
java
package org.pjgg.flightSearch.connector.pricingrules; import org.pjgg.flightSearch.connector.CommonsConnector; import org.pjgg.flightSearch.model.PricingRules; public interface PricingRulesConnector extends CommonsConnector<PricingRules> { }
[ "pablo.gonzalez@bitmonlab.com" ]
pablo.gonzalez@bitmonlab.com
3db357e209d3af4271a8c4f0db5c7ef4c686ec11
d7769c483a1cb163dd9514c2ddc61a2b8d4b7396
/triple-triola/src/com/luke/tripletriola/screens/HostGameScreen.java
db364b0e326fe5b99ec9ca81e47d5c790fad467b
[]
no_license
wieczorek1990/TripleTriola
1009caa72abb26b20c52f402eb8891d15216005a
f697eb2e61fe83c8bea20df8a546f1060ab97c37
refs/heads/master
2020-06-12T09:06:21.239059
2013-06-17T11:30:34
2013-06-17T11:30:34
194,253,305
0
0
null
null
null
null
UTF-8
Java
false
false
1,814
java
package com.luke.tripletriola.screens; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.ui.TextField; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.luke.tripletriola.TripleTriola; import com.luke.tripletriola.networking.ServerThread; public class HostGameScreen extends AbstractScreen { public HostGameScreen(TripleTriola game) { super(game); } @Override public void resize(int width, int height) { super.resize(width, height); Skin skin = super.getSkin(); Label back = new Label(Messages.getString("goBack"), skin); //$NON-NLS-1$ back.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { game.setScreen(game.getConnectionScreen()); super.clicked(event, x, y); } }); Label gameName = new Label( Messages.getString("HostGameScreen.gameName"), skin); //$NON-NLS-1$ final TextField gameNameText = new TextField("TT", skin); //$NON-NLS-1$ Label hostGame = new Label( Messages.getString("HostGameScreen.hostGame"), skin); //$NON-NLS-1$ hostGame.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ServerThread serverThread = new ServerThread(game, gameNameText .getText()); game.setServerThread(serverThread); serverThread.start(); game.setScreen(game.getWaitScreen()); super.clicked(event, x, y); } }); Table table = new Table(); table.setSize(width, height); table.add(hostGame); table.row(); table.add(gameName); table.add(gameNameText); table.row(); table.add(back); stage.addActor(table); } }
[ "wieczorek1990@gmail.com" ]
wieczorek1990@gmail.com
65f07a1766bee9e979f6f2e6d76779041000d6d0
5eae683a6df0c4b97ab1ebcd4724a4bf062c1889
/bin/ext-addon/sapsubscriptionaddon/src/de/hybris/platform/sap/sapsubscriptionaddon/aspect/SapSubscriptionSwitchUIComponentsAspect.java
ac977cc8dda3687a0563654286287431049f9802
[]
no_license
sujanrimal/GiftCardProject
1c5e8fe494e5c59cca58bbc76a755b1b0c0333bb
e0398eec9f4ec436d20764898a0255f32aac3d0c
refs/heads/master
2020-12-11T18:05:17.413472
2020-01-17T18:23:44
2020-01-17T18:23:44
233,911,127
0
0
null
2020-06-18T15:26:11
2020-01-14T18:44:18
null
UTF-8
Java
false
false
3,795
java
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.sap.sapsubscriptionaddon.aspect; import org.apache.log4j.Logger; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.security.web.access.channel.ChannelDecisionManagerImpl; import org.springframework.security.web.access.channel.InsecureChannelProcessor; import org.springframework.security.web.access.channel.SecureChannelProcessor; import org.springframework.stereotype.Component; /** * * This aspect is used to apply the UI changes sap subscription is deployed. * */ @Aspect public class SapSubscriptionSwitchUIComponentsAspect { public static final Logger LOG = Logger.getLogger(SapSubscriptionSwitchUIComponentsAspect.class); public static final String SUBSCRIPTION_ADDON_PREFIX = "addon:/sapsubscriptionaddon/"; public static final String REDIRECT_PREFIX = "redirect:"; public static final String FORWARD_PREFIX = "forward:"; public static final String ADDON_PREFIX = "addon:"; public static final String REDIRECT_MY_ACCOUNT = "redirect:/my-account"; /** * For subscriptions add the add-on prefix to the UI component. * * @param pjp * @return the UI component name * @throws Throwable */ public String applyUIChanges(final ProceedingJoinPoint pjp) throws Throwable { String uiComponent = pjp.proceed().toString(); if (uiComponent.contains(REDIRECT_PREFIX) || uiComponent.contains(FORWARD_PREFIX) || uiComponent.contains(ADDON_PREFIX) || uiComponent.contains(SUBSCRIPTION_ADDON_PREFIX)) { return uiComponent; } final StringBuilder prefix = new StringBuilder( SUBSCRIPTION_ADDON_PREFIX); prefix.append(uiComponent); uiComponent = prefix.toString(); return uiComponent; } @Around("execution(public String de.hybris.platform.*.controllers.misc.*.rolloverMiniCartPopup(..))") public String rolloverMiniCartPopup(final ProceedingJoinPoint joinPoint) throws Throwable { return applyUIChanges(joinPoint); } @Around("execution(public String de.hybris.platform.*.controllers.misc.*.addGridToCart(..))") public String addGridToCart(final ProceedingJoinPoint joinPoint) throws Throwable { return applyUIChanges(joinPoint); } @Around("execution(public String de.hybris.platform.*.controllers.misc.*.addToCart(..))") public String addToCart(final ProceedingJoinPoint joinPoint) throws Throwable { return applyUIChanges(joinPoint); } @Around("execution(public String de.hybris.platform.*.controllers.pages.*.showCart(..))") public String showCart(final ProceedingJoinPoint joinPoint) throws Throwable { return applyUIChanges(joinPoint); } @Around("execution(public String de.hybris.platform.*.controllers.pages.*.productDetail(..))") public String productDetail(final ProceedingJoinPoint joinPoint) throws Throwable { return applyUIChanges(joinPoint); } @Around("execution(public String de.hybris.platform.*.controllers.pages.checkout.steps.*.enterStep(..))") public String enterStep(final ProceedingJoinPoint joinPoint) throws Throwable { return applyUIChanges(joinPoint); } @Around("execution(public String de.hybris.platform.*.controllers.pages.*.order(..))") public String order(final ProceedingJoinPoint joinPoint) throws Throwable { return applyUIChanges(joinPoint); } }
[ "travis.d.crawford@accenture.com" ]
travis.d.crawford@accenture.com
b7d6da3056b94601eb03414f80f4d6283c108742
0ae4a88a12540d91b0a48a7d6b2e3c38f0a48e5a
/V2/Code/企业进销存/src/view/dialog/UpdateSp.java
b098429db4381130add060b6e8e66ac1b0707f52
[]
no_license
lixiangzhe/IDCQ
26b8e491a6e96ae7c7b780a9d2457eaa1f61d28f
a13926b4f38ba08db0479005b51008d7b0c07a0a
refs/heads/master
2020-09-13T23:55:06.419306
2017-02-22T02:26:52
2017-02-22T02:26:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,425
java
package view.dialog; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Dialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import controller.UpdateSpListener; import dao.Dao; import item.Item; import org.eclipse.wb.swt.SWTResourceManager; public class UpdateSp extends Dialog { private Combo combo; private Text text_10; private Text text_9; private Text text_8; private Text text_7; private Text text_6; private Text text_5; private Text text_4; private Text text_3; private Text text_2; private Text text; List<Item> items = new ArrayList<Item>(); protected Object result; protected Shell shell; public UpdateSp(Shell parent, int style) { super(parent, style); } public UpdateSp(Shell parent) { this(parent, SWT.NONE); } public Object open() { createContents(); shell.open(); shell.layout(); Display display = getParent().getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return result; } protected void createContents() { shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setImage(SWTResourceManager.getImage(UpdateSp.class, "/picture/6.jpg")); shell.setSize(518, 474); Rectangle parentBounds = getParent().getShell().getBounds(); Rectangle shellBounds = shell.getBounds(); shell.setLocation(parentBounds.x + (parentBounds.width - shellBounds.width)/2, parentBounds.y + (parentBounds.height - shellBounds.height)/2); shell.setText("修改商品信息"); final Label label = new Label(shell, SWT.NONE); label.setText("商品名称"); label.setBounds(30, 20, 76, 20); final Label label_1 = new Label(shell, SWT.NONE); label_1.setBounds(30, 60, 76, 20); label_1.setText("简 称"); final Label label_2 = new Label(shell, SWT.NONE); label_2.setBounds(30, 100, 76, 20); label_2.setText("产 地"); final Label label_3 = new Label(shell, SWT.NONE); label_3.setBounds(30, 140, 76, 20); label_3.setText("单 位"); final Label label_4 = new Label(shell, SWT.NONE); label_4.setBounds(30, 180, 76, 20); label_4.setText("包 装"); final Label eMailLabel = new Label(shell, SWT.NONE); eMailLabel.setBounds(30, 220, 76, 20); eMailLabel.setText("批准文号"); final Label label_6 = new Label(shell, SWT.NONE); label_6.setBounds(30, 260, 76, 20); label_6.setText("供应商名"); final Label label_7 = new Label(shell, SWT.NONE); label_7.setBounds(261, 140, 76, 20); label_7.setText("规 格"); final Label label_8 = new Label(shell, SWT.NONE); label_8.setBounds(261, 180, 76, 20); label_8.setText("批 号"); text = new Text(shell, SWT.BORDER); text.setEditable(false); text.setBounds(115, 17, 360, 26); text_2 = new Text(shell, SWT.BORDER); text_2.setBounds(115, 57, 360, 26); text_3 = new Text(shell, SWT.BORDER); text_3.setBounds(115, 97, 360, 26); text_4 = new Text(shell, SWT.BORDER); text_4.setBounds(115, 137, 110, 26); text_5 = new Text(shell, SWT.BORDER); text_5.setBounds(115, 177, 110, 26); text_6 = new Text(shell, SWT.BORDER); text_6.setBounds(115, 217, 360, 26); text_7 = new Text(shell, SWT.BORDER); text_7.setBounds(115, 257, 360, 26); text_8 = new Text(shell, SWT.BORDER); text_8.setBounds(365, 137, 110, 26); text_9 = new Text(shell, SWT.BORDER); text_9.setBounds(365, 177, 110, 26); final Button button = new Button(shell, SWT.NONE); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { String message = new UpdateSpListener(UpdateSp.this,items).delete(); MessageDialog.openInformation(shell, "提示", message); clear(); initCombo(); } }); button.setText("删除"); button.setBounds(115, 390, 82, 30); final Button button_1 = new Button(shell, SWT.NONE); button_1.addSelectionListener(new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { String message = new UpdateSpListener(UpdateSp.this,items).update(); MessageDialog.openInformation(shell, "提示", message); } }); button_1.setText("修改"); button_1.setBounds(366, 390, 80, 30); final Label label_6_1 = new Label(shell, SWT.NONE); label_6_1.setBounds(30, 340, 76, 20); label_6_1.setText("备 注"); text_10 = new Text(shell, SWT.BORDER); text_10.setBounds(115, 301, 360, 26); final Label label_6_1_1 = new Label(shell, SWT.NONE); label_6_1_1.setBounds(30, 304, 76, 20); label_6_1_1.setText("选择商品"); combo = new Combo(shell, SWT.READ_ONLY); combo.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { new UpdateSpListener(UpdateSp.this,items).selectAction(); } }); combo.setBounds(115, 337, 360, 28); initCombo(); } public void clear() { this.getText_10().setText(""); this.getText_9().setText(""); this.getText_8().setText(""); this.getText_7().setText(""); this.getText_6().setText(""); this.getText_5().setText(""); this.getText_4().setText(""); this.getText_3().setText(""); this.getText_2().setText(""); this.getText_1().setText(""); this.getCombo().setText(""); } /*初始化combo*/ public void initCombo() { List<?> spInfo = Dao.getSpInfos(); this.getCombo().removeAll(); for (Iterator<?> iter = spInfo.iterator(); iter.hasNext();) { List<?> element = (List<?>) iter.next(); Item item = new Item(); item.setId(element.get(0).toString().trim()); item.setName(element.get(1).toString().trim()); if (items.contains(item)) continue; items.add(item); this.getCombo().add(item.getName()); } } public Combo getCombo() { return combo; } public void setCombo(Combo combo) { this.combo = combo; } public Text getText_1() { return text; } public void setText(Text text) { this.text = text; } public Text getText_10() { return text_10; } public void setText_10(Text text_10) { this.text_10 = text_10; } public Text getText_2() { return text_2; } public void setText_2(Text text_2) { this.text_2 = text_2; } public Text getText_3() { return text_3; } public void setText_3(Text text_3) { this.text_3 = text_3; } public Text getText_4() { return text_4; } public void setText_4(Text text_4) { this.text_4 = text_4; } public Text getText_5() { return text_5; } public void setText_5(Text text_5) { this.text_5 = text_5; } public Text getText_6() { return text_6; } public void setText_6(Text text_6) { this.text_6 = text_6; } public Text getText_7() { return text_7; } public void setText_7(Text text_7) { this.text_7 = text_7; } public Text getText_8() { return text_8; } public void setText_8(Text text_8) { this.text_8 = text_8; } public Text getText_9() { return text_9; } public void setText_9(Text text_9) { this.text_9 = text_9; } }
[ "917785909@qq.com" ]
917785909@qq.com
04db6bcc801033039d6c793fb3960bfb96950082
ef570dfdec85e0b1ea0538a25114da2c92018588
/cmps/12B/labs/lab7/Dictionary.java
aa245663ca990761c081beab54eba90ce791f999
[]
no_license
ilayraz/college_classes
952d92998927bd18d94cd667bec4bcc51b6606f4
9d244a64f54e1f2463134190b01e8b087dc244c8
refs/heads/master
2020-03-18T07:43:00.317635
2019-04-07T04:42:39
2019-04-07T04:42:39
134,469,412
0
0
null
null
null
null
UTF-8
Java
false
false
3,874
java
// Ilay Raz // CMPS12 // 03/16/18 // Dictionary.java class Dictionary implements DictionaryInterface { private class Node { public String key; public String value; public Node left, right; public Node(String myKey, String myValue) { key = myKey; value = myValue; } } private Node root; private int numPairs; public Dictionary() { numPairs = 0; } private Node findKey(Node R, String k) { if (R == null || k.equals(R.key)) return R; if (k.compareTo(R.key) < 0) return findKey(R.left, k); return findKey(R.right, k); } private Node findParent(Node N, Node R) { Node P = null; if (N != R) { P = R; while (P.left != N && P.right != N) { if (N.key.compareTo(P.key) < 0) P = P.left; else P = P.right; } } return P; } private Node findLeftmost(Node R){ Node L = R; if (L != null) for( ; L.left != null; L = L.left); return L; } private void printInOrder(Node R, StringBuilder builder) { if (R != null) { printInOrder(R.left, builder); builder.append(R.key + " " + R.value + "\n"); printInOrder(R.right, builder); } } public boolean isEmpty() { return numPairs == 0; } public int size() { return numPairs; } public String lookup(String k) { Node N = findKey(root, k); return N == null ? null : N.value; } public void insert(String k, String v) throws DuplicateKeyException { Node N, A, B; if (findKey(root, k) != null) throw new DuplicateKeyException("Dup key"); N = new Node(k, v); B = null; A = root; while (A != null) { B = A; if (k.compareTo(A.key) < 0) A = A.left; else A = A.right; } if (B == null) root = N; else if (k.compareTo(B.key) < 0) B.left = N; else B.right = N; numPairs++; } public void delete(String k) throws KeyNotFoundException { Node N, P, S; N = findKey(root, k); if (N == null) throw new KeyNotFoundException("k not found"); if (N.left == null && N.right == null) { if (N == root) { root = null; } else { P = findParent(N, root); if (P.right == N) P.right = null; } } else if (N.right == null) { if (N == root) { root = N.left; } else { P = findParent(N, root); if (P.right == N) P.right = N.left; else P.left = N.left; } } else if (N.left == null) { if (N == root) { root = N.right; } else { P = findParent(N, root); if (P.right == N) P.right = N.right; else P.left = N.right; } } else { S = findLeftmost(N.right); N.key = S.key; N.value = S.value; P = findParent(S, N); if (P.right == S) P.right = S.right; else P.left = S.right; } numPairs--; } public void makeEmpty() { root = null; numPairs = 0; } public String toString() { StringBuilder builder = new StringBuilder(); printInOrder(root, builder); return builder.toString(); } }
[ "ilay.raz@gmail.com" ]
ilay.raz@gmail.com
df2226f349f6a76c2602ea19de2268e064cad7e7
0ea420181221de818a762f9045d9d56a5e739bde
/week4-073.Product/src/Main.java
894cae16d77fd775c108f1c0ffa0feb82bd17f0f
[]
no_license
radix4/helsinki-oop-i
20b96afd70a60ebe9cc15d10ecc67026872d5a87
954bce737f34d9fd8c88e24e3aaef57425ce8d3e
refs/heads/master
2022-11-17T19:23:16.636478
2020-07-23T03:46:15
2020-07-23T03:46:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
274
java
/** * This program demonstrates how to create a class and access it. * @author Thang Cao * @since 07/05/2020 * */ public class Main { public static void main(String[] args) { Product t = new Product("Banana", 1.1, 13); t.printProduct(); } }
[ "shiyoline@gmail.com" ]
shiyoline@gmail.com
6671db21148d0277410c3ff32709b13cf34f2726
237c6750e81ff6dd718f6e6a6bf7233089ec299d
/src/Test38_StreamAPI.java
d6ec51e0b3cfb6c553de55e9dcb00d947c710165
[]
no_license
lievre95/Reviewing_JDK12
f850c9c661337891909572cc222028b042c8e303
dc78a4dfc9f377f4b53b655a676d44ee913922a8
refs/heads/master
2023-06-24T04:46:19.260448
2021-07-23T01:42:06
2021-07-23T01:42:06
262,161,031
0
0
null
null
null
null
UTF-8
Java
false
false
2,043
java
import java.util.stream.DoubleStream; import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.Stream; import java.util.*; class Test38_StreamAPI { public static void main(String[] args) { ArrayList<String> cities = new ArrayList<String>(); Collections.addAll(cities, "London", "Madrid", "Berlin"); cities.stream() //getting the stream .filter(s -> s.length() == 6) //applying the filter by length of string .forEach(s -> System.out.println(s));//outputting just filtered strings ArrayList<String> cities2 = new ArrayList<String>(); Collections.addAll(cities2, "Chisinau", "Minsk", "Kiev"); Stream<String> citiesStream = cities2.stream(); // getting the stream citiesStream = citiesStream.filter(s -> s.length() == 6); //applying the filter by length of string citiesStream.forEach(s -> System.out.println(s)); IntStream intStream = Arrays.stream(new int[]{1, 2, 3, 4, 6, 8}); intStream.forEach(i -> System.out.println(i)); LongStream longStream = Arrays.stream(new long[]{155, 156, 178, 788}); longStream.forEach(l -> System.out.println(l)); DoubleStream doubleStream = Arrays.stream(new double[]{4.1, 3.4, 55.33, 55}); doubleStream.forEach(d -> System.out.println(d)); Stream<String> citiesStream_ = Stream.of("London", "Madrid", "Berlin"); citiesStream_.forEach(s -> System.out.println(s)); // passing an array String[] cities_ = {"London", "Madrid", "Berlin"}; Stream<String> citiesStream2 = Stream.of(cities_); IntStream intStream1 = IntStream.of(1, 3, 4, 5, 6); intStream1.forEach(i -> System.out.println(i)); LongStream longStream1 = LongStream.of(111, 322, 433, 533, 446); longStream1.forEach(l -> System.out.println(l)); DoubleStream doubleStream1 = DoubleStream.of(1.2, 3, 4.5, 5.4, 6.3); doubleStream1.forEach(d -> System.out.println(d)); } }
[ "ivandoga95@gmail.com" ]
ivandoga95@gmail.com
2c0878b9afccdab712afad97884736419fd982a5
98e0f08d9393e438000421a7cdd44e21f9a7e1bb
/aegis_backend/device_management/src/main/java/com/aegis/devicemanagement/exception/user/DeviceUserMismatch.java
c5bba29b4b5df5f17a83fa07cc6244e376c2c026
[]
no_license
zemosolab/aegis
7ed3c08fc29f23dcc72ebbb502ba7229ec2bdf9f
32230d1e8f2837b04d0ff307ea73508671403f21
refs/heads/master
2023-06-03T23:56:29.677426
2021-04-28T17:28:19
2021-04-28T17:28:19
379,215,061
0
0
null
null
null
null
UTF-8
Java
false
false
179
java
package com.aegis.devicemanagement.exception.user; public class DeviceUserMismatch extends Exception { public DeviceUserMismatch(String error){ super(error); } }
[ "ajay.koppanathi@zemosolabs.com" ]
ajay.koppanathi@zemosolabs.com
37e7412855bb7c45136fe0ab87425442e0169578
3f71c856ba1722369e62e9eacea4dfeb08829636
/src/main/java/com/psych/game/model/User.java
2a33df27fcc6625efa7a5fdcb0d0b3b923c4df6c
[]
no_license
jhbhargav/jbh_psych
d20730ca46b589f00f22def5bd7545d65c15aa51
a7a19c6cf482645c18e04fc2c82f2911ed0865ee
refs/heads/master
2021-01-08T00:19:40.175619
2020-02-27T08:30:39
2020-02-27T08:30:39
241,860,677
0
0
null
null
null
null
UTF-8
Java
false
false
1,122
java
package com.psych.game.model; import lombok.Getter; import lombok.Setter; import org.springframework.data.repository.cdi.Eager; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import javax.persistence.*; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import java.util.HashSet; import java.util.Set; @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class User extends Auditable{ @Email @NotBlank @Column(unique = true) @Getter @Setter private String email; @NotBlank @Getter private String saltedHashedPassword; public void setSaltedHashedPassword(String value){ this.saltedHashedPassword = new BCryptPasswordEncoder(5).encode(value); } @ManyToMany(fetch = FetchType.EAGER) @Getter @Setter Set<Role> roles = new HashSet<>(); public User(){} public User(User user) { email = user.getEmail(); saltedHashedPassword = user.getSaltedHashedPassword(); roles = user.getRoles(); } }
[ "jhbhargav@gmail.com" ]
jhbhargav@gmail.com
cb05d5402f5495e6c5813c03b54448659b56aecc
7201aeac7050c364e7edb343b0c6d2b60f969722
/src/com/example/compoundbuttonview/view/SlideSwitchView.java
959711295b4b469deb4be6c01f695e3812acc917
[]
no_license
beyond667/CompoundButtonView
9b6bc483109ca0ac94d7619cb19764b1a28cab7b
0f61556511420a10897e07d1e915d979eede98c9
refs/heads/master
2016-09-06T11:58:26.878866
2015-06-15T08:59:06
2015-06-15T08:59:06
37,441,241
0
1
null
null
null
null
GB18030
Java
false
false
7,386
java
package com.example.compoundbuttonview.view; import com.example.compoundbuttonview.R; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.RectF; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; public class SlideSwitchView extends View{ /** Switch底部样式图片 */ private Bitmap mSwitchBottom; /** Switch 当前样式 */ private Bitmap mSwitchThumb; /** Switch无操作情况下的样式 */ private Bitmap mSwitchThumbNormal; /** Switch当前手指触摸式的样式 */ private Bitmap mSwitchThumbPressed; /** Switch 框架 */ private Bitmap mSwitchFrame; private Bitmap mSwitchMask; private float mCurrentX = 0; /** Switch 开关状态,默认是 开:true */ private boolean mSwitchOn = true; /** Switch 最大移动距离 */ private int mMoveLength; /** 第一次按下的有效区域 */ private float mLastX = 0; /** 绘制的目标区域大小 */ private Rect mDest = null; /** 截取源图片的大小 */ private Rect mSrc = null; /** Switch 移动的偏移量 */ private int mMoveDeltX = 0; /** 画笔工具 */ private Paint mPaint = null; /** Switch 状态监听接口 */ private OnSwitchChangedListener switchListener = null; private boolean mFlag = false; /** enabled 属性 为 true */ private boolean mEnabled = true; /** 最大透明度,就是不透明 */ private final int MAX_ALPHA = 255; /** 当前透明度,这里主要用于如果控件的enable属性为false时候设置半透明 ,即不可以点击 */ private int mAlpha = MAX_ALPHA; /** Switch 判断是否在拖动 */ private boolean mIsScrolled =false; public SlideSwitchView(Context context) { this(context, null); } public SlideSwitchView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SlideSwitchView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } /** * 初始化相关资源 */ public void init() { mSwitchThumbPressed = BitmapFactory.decodeResource(getResources(),R.drawable.checkswitch_btn_pressed); mSwitchThumbNormal = BitmapFactory.decodeResource(getResources(),R.drawable.checkswitch_btn_unpressed); mSwitchBottom = BitmapFactory.decodeResource(getResources(),R.drawable.checkswitch_bottom); mSwitchFrame = BitmapFactory.decodeResource(getResources(),R.drawable.checkswitch_frame); mSwitchMask = BitmapFactory.decodeResource(getResources(),R.drawable.checkswitch_mask); mSwitchThumb = mSwitchThumbNormal; mMoveLength = mSwitchBottom.getWidth() - mSwitchFrame.getWidth(); //绘制区域大小 mDest = new Rect(0, 0, mSwitchFrame.getWidth(),mSwitchFrame.getHeight()); mSrc = new Rect(); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setAlpha(255); mPaint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // TODO Auto-generated method stub setMeasuredDimension(mSwitchFrame.getWidth(), mSwitchFrame.getHeight()); } @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); if (mMoveDeltX > 0 || mMoveDeltX == 0 && mSwitchOn) { if (mSrc != null) { mSrc.set(mMoveLength - mMoveDeltX, 0, mSwitchBottom.getWidth() - mMoveDeltX, mSwitchFrame.getHeight()); } } else if (mMoveDeltX < 0 || mMoveDeltX == 0 && !mSwitchOn) { if (mSrc != null) { mSrc.set(-mMoveDeltX, 0, mSwitchFrame.getWidth() - mMoveDeltX, mSwitchFrame.getHeight()); } } Log.d("mAlpha", "mAlpha:" + mAlpha); canvas.saveLayerAlpha(new RectF(mDest), mAlpha, Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.FULL_COLOR_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG); canvas.drawBitmap(mSwitchBottom, mSrc, mDest, null); canvas.drawBitmap(mSwitchThumb, mSrc, mDest, null); canvas.drawBitmap(mSwitchFrame, 0, 0, null); canvas.drawBitmap(mSwitchMask, 0, 0, mPaint); canvas.restore(); } @Override public boolean onTouchEvent(MotionEvent event) { // TODO Auto-generated method stub //如果Enabled属性设定为true,触摸效果才有效 if(!mEnabled){ return true; } switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mSwitchThumb = mSwitchThumbPressed; mLastX = event.getX(); break; case MotionEvent.ACTION_MOVE: mCurrentX = event.getX(); mMoveDeltX = (int) (mCurrentX - mLastX); if(mMoveDeltX > 10){ //设置了10这个误差距离,可以更好的实现点击效果 mIsScrolled = true; } // 如果开关开着向左滑动,或者开关关着向右滑动(这时候是不需要处理的) if ((mSwitchOn && mMoveDeltX < 0) || (!mSwitchOn && mMoveDeltX > 0)) { mFlag = true; mMoveDeltX = 0; } if (Math.abs(mMoveDeltX) > mMoveLength) { mMoveDeltX = mMoveDeltX > 0 ? mMoveLength : -mMoveLength; } invalidate(); break; case MotionEvent.ACTION_UP: mSwitchThumb = mSwitchThumbNormal; //如果没有滑动过,就看作一次点击事件 if(!mIsScrolled){ mMoveDeltX = mSwitchOn ? mMoveLength : -mMoveLength; mSwitchOn = !mSwitchOn; if (switchListener != null) { switchListener.onSwitchChange(this, mSwitchOn); } invalidate(); mMoveDeltX = 0; break; } mIsScrolled = false; if (Math.abs(mMoveDeltX) > 0 && Math.abs(mMoveDeltX) < mMoveLength / 2) { mMoveDeltX = 0; invalidate(); } else if (Math.abs(mMoveDeltX) > mMoveLength / 2 && Math.abs(mMoveDeltX) <= mMoveLength) { mMoveDeltX = mMoveDeltX > 0 ? mMoveLength : -mMoveLength; mSwitchOn = !mSwitchOn; if (switchListener != null) { switchListener.onSwitchChange(this, mSwitchOn); } invalidate(); mMoveDeltX = 0; } else if (mMoveDeltX == 0 && mFlag) { // 这时候得到的是不需要进行处理的,因为已经move过了 mMoveDeltX = 0; mFlag = false; } default: break; } invalidate(); return true; } /** * 设置 switch 状态监听 * */ public void setOnChangeListener(OnSwitchChangedListener listener) { switchListener = listener; } /** * switch 开关监听接口 * */ public interface OnSwitchChangedListener{ public void onSwitchChange(SlideSwitchView switchView, boolean isChecked); } @Override public void setEnabled(boolean enabled) { // TODO Auto-generated method stub mEnabled = enabled; mAlpha = enabled ? MAX_ALPHA : MAX_ALPHA/2; Log.d("enabled",enabled ? "true": "false"); super.setEnabled(enabled); invalidate(); } /** 自动判断切换至相反的属性 : true -->false ;false -->true */ public void toggle() { setChecked(!mSwitchOn); } /** 设置选中的状态(选中:true 非选中: false) */ public void setChecked(boolean checked) { mSwitchOn = checked; invalidate(); } }
[ "552499041@qq.com" ]
552499041@qq.com
250e29d1fab3dd63e3c7de381518d0cddb6fd2b2
9ee734247827006ed2ef201de7999b6e7dca6390
/ibm.jdk8/src/javax/sql/RowSetListener.java
490e54e96cbd6678baa6cc7698c5c4eea6b895df
[ "MIT" ]
permissive
flyzsd/java-code-snippets
33341764176f9ea4d023eaa75d36fb8be9786b97
1202b941ec4686d157fbc8643b65d247c6cd2b27
refs/heads/master
2021-01-13T07:48:23.217223
2017-06-23T04:45:12
2017-06-23T04:45:12
95,096,070
0
0
null
null
null
null
UTF-8
Java
false
false
2,506
java
/*=========================================================================== * Licensed Materials - Property of IBM * "Restricted Materials of IBM" * * IBM SDK, Java(tm) Technology Edition, v8 * (C) Copyright IBM Corp. 2000, 2001. All Rights Reserved * * US Government Users Restricted Rights - Use, duplication or disclosure * restricted by GSA ADP Schedule Contract with IBM Corp. *=========================================================================== */ /* * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javax.sql; /** * An interface that must be implemented by a * component that wants to be notified when a significant * event happens in the life of a <code>RowSet</code> object. * A component becomes a listener by being registered with a * <code>RowSet</code> object via the method <code>RowSet.addRowSetListener</code>. * How a registered component implements this interface determines what it does * when it is notified of an event. * * @since 1.4 */ public interface RowSetListener extends java.util.EventListener { /** * Notifies registered listeners that a <code>RowSet</code> object * in the given <code>RowSetEvent</code> object has changed its entire contents. * <P> * The source of the event can be retrieved with the method * <code>event.getSource</code>. * * @param event a <code>RowSetEvent</code> object that contains * the <code>RowSet</code> object that is the source of the event */ void rowSetChanged(RowSetEvent event); /** * Notifies registered listeners that a <code>RowSet</code> object * has had a change in one of its rows. * <P> * The source of the event can be retrieved with the method * <code>event.getSource</code>. * * @param event a <code>RowSetEvent</code> object that contains * the <code>RowSet</code> object that is the source of the event */ void rowChanged(RowSetEvent event); /** * Notifies registered listeners that a <code>RowSet</code> object's * cursor has moved. * <P> * The source of the event can be retrieved with the method * <code>event.getSource</code>. * * @param event a <code>RowSetEvent</code> object that contains * the <code>RowSet</code> object that is the source of the event */ void cursorMoved(RowSetEvent event); }
[ "zhangshudong@gmail.com" ]
zhangshudong@gmail.com
bc274df0bc33faff702c529ff7e4f45b19a39fea
9ec681493bde5d123a595dbbb89897bf08958ad6
/Commons/saie-commons-utils/src/main/java/com/iecisa/sat/saie/audit/dto/DBSaieResult.java
262f0c8aa031b9f1e905d1a9421ae6bf56ac14ce
[]
no_license
alcortesacerta/visor
f3750c9c8cc2f345e2977a9a5b355a5f5edd45c1
7b5492e72cacc748674789ac92a9b153fe5c460a
refs/heads/master
2022-10-14T08:57:26.920254
2021-10-21T16:43:00
2021-10-21T16:43:00
207,658,878
0
0
null
2022-09-22T18:52:11
2019-09-10T20:38:58
Java
UTF-8
Java
false
false
2,711
java
/* */ package com.iecisa.sat.saie.audit.dto; /* */ /* */ import java.sql.Timestamp; /* */ import java.util.ArrayList; /* */ import java.util.List; /* */ import java.util.Map; /* */ /* */ public class DBSaieResult { /* */ public DBSaieResult(List<Map<String, Object>> resultSet) { /* 10 */ this.resultSet = new ArrayList(); /* */ /* */ /* */ /* 14 */ this.resultSet = resultSet; /* */ } /* */ private List<Map<String, Object>> resultSet; /* */ public String getString(int indice, String nombre) { /* 18 */ if (indice <= this.resultSet.size()) { /* 19 */ Map<String, Object> temp = (Map)this.resultSet.get(indice); /* 20 */ if (temp != null) { /* 21 */ return temp.get(nombre).toString(); /* */ } /* */ } /* 24 */ return null; /* */ } /* */ /* */ public int getInt(int indice, String nombre) { /* 28 */ if (indice <= this.resultSet.size()) { /* 29 */ Map<String, Object> temp = (Map)this.resultSet.get(indice); /* 30 */ if (temp != null) { /* */ try { /* 32 */ return Integer.parseInt(temp.get(nombre).toString()); /* 33 */ } catch (Exception e) { /* 34 */ return -1; /* */ } /* */ } /* */ } /* 38 */ return -1; /* */ } /* */ /* */ public boolean getBoolean(int indice, String nombre) { /* 42 */ if (indice <= this.resultSet.size()) { /* 43 */ Map<String, Object> temp = (Map)this.resultSet.get(indice); /* 44 */ if (temp != null) { /* */ try { /* 46 */ return Boolean.parseBoolean(temp.get(nombre).toString()); /* 47 */ } catch (Exception e) { /* 48 */ return false; /* */ } /* */ } /* */ } /* 52 */ return false; /* */ } /* */ /* */ public Timestamp getTimestamp(int indice, String nombre) { /* 56 */ if (indice <= this.resultSet.size()) { /* 57 */ Map<String, Object> temp = (Map)this.resultSet.get(indice); /* 58 */ if (temp != null) { /* */ try { /* 60 */ return (Timestamp)temp.get(nombre); /* 61 */ } catch (Exception e) { /* 62 */ return null; /* */ } /* */ } /* */ } /* 66 */ return null; /* */ } /* */ /* */ /* 70 */ public int size() { return this.resultSet.size(); } /* */ } /* Location: C:\Users\Alejandro Cortés\Desktop\VersionesVisor\saie-visor-2017ene17_1233.war!\WEB-INF\lib\saie-commons-utils-0.0.1-SNAPSHOT.jar!\com\iecisa\sat\saie\audit\dto\DBSaieResult.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.0.7 */
[ "alejandro.cortes@acerta.net" ]
alejandro.cortes@acerta.net
7a8f78654785ccd05ba87a9e621347c1f69d4037
c302dee75a97c1a437b1ecbf8347be3253d56a3b
/app/src/main/java/com/kamalpreet/shopifychallengesummer2019/model/schema/ShopifyProductDetails.java
f2380dd9627ed167fd486d462215bfccd1e7b610
[]
no_license
kamalJudge/ShopifyChallengeSummer2019
2fbcf8ee47ba9ea0fe95c563f9ad5e33ada636a4
d41be086f31b201d088ecf3ae0b206afa6047aba
refs/heads/master
2020-04-17T16:12:49.101118
2019-01-21T01:46:09
2019-01-21T01:46:09
166,731,437
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.kamalpreet.shopifychallengesummer2019.model.schema; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; public class ShopifyProductDetails { @SerializedName("products") private ArrayList<ShopifyProductDetailsObj> productDetailsObj = new ArrayList<>(); public ShopifyProductDetails(ArrayList<ShopifyProductDetailsObj> productDetailsObj) { this.productDetailsObj = productDetailsObj; } public ShopifyProductDetails() { } public ArrayList<ShopifyProductDetailsObj> getProductDetailsObj() { return productDetailsObj; } public void setProductDetailsObj(ArrayList<ShopifyProductDetailsObj> productDetailsObj) { this.productDetailsObj = productDetailsObj; } }
[ "kjudge707@gmail.com" ]
kjudge707@gmail.com
a054998df4d469824a4e1bf28315dffc7e2134c8
331a47c9fade199260120dd5c71810a999974905
/src/com/lyg/service/IDiaryService.java
d2fb89cfe5ffa47e6d0cd43f90613bccdffcde87
[]
no_license
Liaoyuangui/PersonWebsites
9b2daf58d5b1c87817c35da14e2d0408e285e083
fd129ee21daaadb95a8fbea5f94465dd7b1a1584
refs/heads/master
2021-01-24T17:49:27.868005
2018-03-01T01:53:12
2018-03-01T01:53:12
123,234,892
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
package com.lyg.service; import java.util.List; import org.springframework.stereotype.Service; import com.lyg.entitys.Diary; @Service public interface IDiaryService { //根据条件插入 public int insertSelective(Diary record); //根据id查询 public Diary selectByPrimaryKey(Integer id); //根据条件动态修改 public int updateByPrimaryKeySelective(Diary record); //查询所有的,根据添加时间排序 public List<Diary> queryAllDiary(Diary diary); //删除日记 public int deleteDiaryById(Integer diaryId); }
[ "Administrator@20180131-144644" ]
Administrator@20180131-144644
abe38521010a0d01f24653455562dbd2c60d39ef
34f37a5cd7bd2c8dc6080249338452442c894500
/SmartSemicolon/src/smartsemicolon/AbstractAddSemicolonCommand.java
6c1fb952f6f3c6ded4f0784dd391764c617165d9
[]
no_license
raphaeldore/smartsemicolon
4d0cdb71b2bf1398d80490c9ffd87e0af2789189
eccb8781dab06064aa93aad2950ce47af6380910
refs/heads/master
2021-01-13T02:27:57.700609
2015-09-05T15:21:09
2015-09-05T15:21:09
41,962,782
0
0
null
null
null
null
UTF-8
Java
false
false
2,378
java
package smartsemicolon; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.IHandler; import org.eclipse.core.commands.IHandlerListener; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditor; public abstract class AbstractAddSemicolonCommand implements IHandler { public void addHandlerListener(IHandlerListener handlerListener) { } public void dispose() { } public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); if (activeWorkbenchWindow == null) { return null; } IEditorPart activeEditor = activeWorkbenchWindow.getActivePage() .getActiveEditor(); if (activeEditor instanceof AbstractDecoratedTextEditor) { AbstractDecoratedTextEditor editor = (AbstractDecoratedTextEditor) activeEditor; Object adapter = (Control) editor.getAdapter(Control.class); if (adapter instanceof Control) { Control control = (Control) adapter; if (control instanceof StyledText) { StyledText styledText = (StyledText) control; doAddSemicolon(styledText); } } } return null; } public boolean isEnabled() { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); if (activeWorkbenchWindow == null) { return false; } IEditorPart activeEditor = activeWorkbenchWindow.getActivePage() .getActiveEditor(); if (activeEditor instanceof AbstractDecoratedTextEditor) { AbstractDecoratedTextEditor editor = (AbstractDecoratedTextEditor) activeEditor; Object adapter = (Control) editor.getAdapter(Control.class); if (adapter instanceof Control) { return true; } } return false; } public boolean isHandled() { return isEnabled(); } public void removeHandlerListener(IHandlerListener handlerListener) { } protected abstract void doAddSemicolon(StyledText styledText); protected boolean lineQualifies(String line) { return !line.matches(".*" + getDelimiter() + "[^" + getDelimiter() + ")]*" + "$"); } protected abstract String getDelimiter(); }
[ "sandipchitale@e3db8ebe-c94a-11dd-8ca8-e3ff79f713b6" ]
sandipchitale@e3db8ebe-c94a-11dd-8ca8-e3ff79f713b6
1ca8b7692ed6369ed5e9664ad3957e574e2511e3
b24f1c55b65c0855050b8ad5c80b40c9818860be
/app/src/main/java/com/zhou/book/ui/easyadapter/SubCategoryAdapter.java
24f44533575745a832aad37ef524d9d5bbd5b92f
[]
no_license
zhengjinzhou/Gusture
328c69b3a14c1de7860f47efd97e8adf22a6cffb
c26391fbc905a84ba41caa2d5d647694b7d4f38a
refs/heads/master
2021-01-15T14:19:35.823614
2018-01-19T07:09:39
2018-01-19T07:09:39
99,688,031
1
0
null
null
null
null
UTF-8
Java
false
false
2,558
java
/** * Copyright 2016 JustWayward Team * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.zhou.book.ui.easyadapter; import android.content.Context; import android.text.TextUtils; import android.view.ViewGroup; import com.zhou.book.R; import com.zhou.book.base.Constant; import com.zhou.book.bean.BooksByCats; import com.zhou.book.manager.SettingManager; import com.zhou.book.view.recyclerview.adapter.BaseViewHolder; import com.zhou.book.view.recyclerview.adapter.RecyclerArrayAdapter; /** * 二级排行榜 / 二级分类 * * @author yuyh. * @date 16/9/3. */ public class SubCategoryAdapter extends RecyclerArrayAdapter<BooksByCats.BooksBean> { public SubCategoryAdapter(Context context) { super(context); } @Override public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { return new BaseViewHolder<BooksByCats.BooksBean>(parent, R.layout.item_sub_category_list) { @Override public void setData(BooksByCats.BooksBean item) { super.setData(item); if (!SettingManager.getInstance().isNoneCover()) { holder.setRoundImageUrl(R.id.ivSubCateCover, Constant.IMG_BASE_URL + item.cover, R.drawable.cover_default); } else { holder.setImageResource(R.id.ivSubCateCover, R.drawable.cover_default); } holder.setText(R.id.tvSubCateTitle, item.title) .setText(R.id.tvSubCateAuthor, (item.author == null ? "未知" : item.author) + " | " + (item.majorCate == null ? "未知" : item.majorCate)) .setText(R.id.tvSubCateShort, item.shortIntro) .setText(R.id.tvSubCateMsg, String.format(mContext.getResources().getString(R.string.category_book_msg), item.latelyFollower, TextUtils.isEmpty(item.retentionRatio) ? "0" : item.retentionRatio)); } }; } }
[ "1457594845@qq.com" ]
1457594845@qq.com
69038b281a525a161cd7a9806b5e5b3f432aa4b0
d528fe4f3aa3a7eca7c5ba4e0aee43421e60857f
/main/com/zfsoft/xgxt/znxgl/fxbgl/FxbService.java
304710081c76bf3910116e44c6afd01955138db3
[]
no_license
gxlioper/xajd
81bd19a7c4b9f2d1a41a23295497b6de0dae4169
b7d4237acf7d6ffeca1c4a5a6717594ca55f1673
refs/heads/master
2022-03-06T15:49:34.004924
2019-11-19T07:43:25
2019-11-19T07:43:25
null
0
0
null
null
null
null
GB18030
Java
false
false
970
java
/** * @部门:学工产品事业部 * @日期:2015-8-29 上午09:57:37 */ package com.zfsoft.xgxt.znxgl.fxbgl; import com.zfsoft.xgxt.base.service.impl.SuperServiceImpl; /** * @系统名称: 学生工作管理系统 * @模块名称: XXXX管理模块 * @类功能描述: TODO(这里用一句话描述这个类的作用) * @作者: yxy[工号:1206] * @时间: 2015-8-29 上午09:57:37 * @版本: V1.0 * @修改记录: 类修改者-修改日期-修改说明 */ public class FxbService extends SuperServiceImpl<FxbForm, FxbDao> { /** * * @描述:保存 * @作者:喻鑫源[工号:1206] * @日期:2015-12-7 下午03:19:04 * @修改记录: 修改者名字-修改日期-修改内容 * @param sx * @return * @throws Exception * boolean 返回类型 * @throws */ public boolean save(FxbForm t) throws Exception{ return dao.save(t); } }
[ "1398796456@qq.com" ]
1398796456@qq.com
158250cc8b0b8a3f5f322457bf85dd2f38bb8c35
56445d7b4204c75790d08a91ee1f7a366ee7ebb6
/src/main/java/com/appsdeveloperblog/app/ws/mobileappws/security/AuthorizationFilter.java
cdce1be9bd515af23fb3714c1ac742c1a8285b73
[]
no_license
AnselmoPfeifer/trading101
5288f6ed7d9aa979bf63ee4924f97bc65f254b66
095b29e44e867ee75765b0430d3fa16fb0e5b278
refs/heads/master
2023-03-03T16:21:03.668348
2021-02-17T12:42:05
2021-02-17T12:42:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,151
java
package com.appsdeveloperblog.app.ws.mobileappws.security; import io.jsonwebtoken.Jwts; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; public class AuthorizationFilter extends BasicAuthenticationFilter { public AuthorizationFilter(AuthenticationManager authenticationManager) { super(authenticationManager); } @Override public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String header = request.getHeader(SecurityConstants.HEADER_STRING); if(header == null || !header.startsWith(SecurityConstants.TOKEN_PREFIX)){ chain.doFilter(request, response); return; } UsernamePasswordAuthenticationToken authenticationToken = getAuthentication(request); SecurityContextHolder.getContext().setAuthentication(authenticationToken); chain.doFilter(request, response); } private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request){ String token = request.getHeader(SecurityConstants.HEADER_STRING); if(token != null) { token = token.replace(SecurityConstants.TOKEN_PREFIX, ""); String user = Jwts.parser() .setSigningKey(SecurityConstants.getTokenSecret()) .parseClaimsJws(token) .getBody() .getSubject(); if(user != null){ return new UsernamePasswordAuthenticationToken(user, null, new ArrayList<>()); } return null; } return null; } }
[ "giresse.ashu@kuehne-nagel.com" ]
giresse.ashu@kuehne-nagel.com
e6161036f26612052154ddfe13be5a1628cbf8ca
0b44382945e836a5e9975fdac856157eea311fb2
/src/poo/interfaces/ejemplo/electrodomesticos/Hablador.java
c3e533b15a83e3e2574fa95f49cbf3149d8717b1
[]
no_license
hanconina/javaPOO
dc41b1f81af0a0b269c2d8921e2fdba3f5a16412
9c260f4c63eebdb28a93a08209ae1d7686badf6d
refs/heads/master
2023-01-03T19:09:07.587944
2020-10-23T21:46:58
2020-10-23T21:46:58
183,959,734
0
0
null
null
null
null
UTF-8
Java
false
false
113
java
package poo.interfaces.ejemplo.electrodomesticos; public interface Hablador { void hablar(); }
[ "user@teminal" ]
user@teminal
eb975546b060dc0eefc96e3fce3c0e5534100997
84db686827b51c273cd589cffbf39f9d08332a2a
/Armani/rpos/src/com/chelseasystems/cs/register/ICMSRegisterRMIServer.java
5fc5b6ec1393795d59ca92e01a95102dfd010701
[]
no_license
bchelli/armani
0ec55106135496e1dd0ebb20a359d2ccbd507210
d84baec9a4df9328ac0bd03c1141502eae601968
refs/heads/master
2020-03-28T20:20:36.813175
2018-09-06T07:23:58
2018-09-06T07:23:58
149,061,353
1
0
null
2018-09-17T03:02:15
2018-09-17T03:02:15
null
UTF-8
Java
false
false
2,311
java
/**Copyright 2001,chelseamarketsystem * * History: +------+------------+-----------+-----------+-------------------------------------------------+ | Ver# | Date | By | Defect # | Description | +------+------------+-----------+-----------+-------------------------------------------------+ | 2 | 04-28-2005 |Megha | | Added new method selectByStoreAndRegID | | | | | selectByStoreID | | | | | | | | | | | | | ----------------------------------------------------------------------------------------------- * * formatted with JxBeauty (c) johann.langhofer@nextra.at */ package com.chelseasystems.cs.register; import java.rmi.*; import com.igray.naming.*; import com.chelseasystems.cr.register.*; import java.lang.*; import com.chelseasystems.cr.store.*; import com.chelseasystems.cs.store.*; /** *Defines the customer services that are available remotely via RMI. **/ /** * * <p>Title: ICMSRegisterRMIServer</p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2005</p> * * <p>Company: </p> * * @author not attributable * @version 1.0 */ public interface ICMSRegisterRMIServer extends Remote, IPing { /** * This method is used to get the next register *@parm store store **/ public CMSRegister getNextRegister(CMSStore store) throws RemoteException; /** * This method is used to update a register * @param register register */ public void updateRegister(CMSRegister register) throws RemoteException; /** * This method is used to select by a RegisterID & StoreID * @param register String * @param store String * @return CMSRegister * @throws RemoteException */ public CMSRegister selectByStoreAndRegID(String register, String store) throws RemoteException; /** * This method is used to get all Registers by StoreID * @param store String * @return CMSRegister[] * @throws RemoteException */ public CMSRegister[] selectByStoreID(String store) throws RemoteException; }
[ "saptarshi.mukhaty@skillnetinc.com" ]
saptarshi.mukhaty@skillnetinc.com
534cb8a0b310393d84e844d3cd16e30452424cd3
883630c229f8fde338bf4b6e8515c125a5b3447d
/nsDH/src/com/mxgraph/layout/mxStackLayout.java
141b098aa8571904b02fee7f94121c6ae0b2fdb0
[]
no_license
vtq-pl/nsdh2
cfc933b91f798e005ad83016895d361e565e08e9
81590314bf840573c538e515f4a46857aa2b32f0
refs/heads/master
2021-03-22T01:12:05.056619
2019-05-28T09:17:57
2019-05-28T09:17:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,960
java
package com.mxgraph.layout; import com.mxgraph.model.mxGeometry; import com.mxgraph.model.mxICell; import com.mxgraph.model.mxIGraphModel; import com.mxgraph.util.mxRectangle; import com.mxgraph.view.mxCellState; import com.mxgraph.view.mxGraph; public class mxStackLayout extends mxGraphLayout { /** * Specifies the orientation of the layout. Default is true. */ protected boolean horizontal; /** * Specifies the spacing between the cells. Default is gridSize. */ protected int spacing; /** * Specifies the horizontal origin of the layout. Default is spacing. */ protected int x0; /** * Specifies the vertical origin of the layout. Default is spacing. */ protected int y0; /** * Boolean indicating if dimension should be changed to fill out the parent * cell. Default is false. */ protected boolean fill = false; /** * If the parent should be resized to match the width/height of the * stack. Default is false. */ protected boolean resizeParent = false; /** * Value at which a new column or row should be created. Default is 0. */ protected int wrap = 0; /** * Constructs a new stack layout layout for the specified graph, * spacing, orientation and offset. */ public mxStackLayout(mxGraph graph) { this(graph, true); } /** * Constructs a new stack layout layout for the specified graph, * spacing, orientation and offset. */ public mxStackLayout(mxGraph graph, boolean horizontal) { this(graph, horizontal, graph.getGridSize()); } /** * Constructs a new stack layout layout for the specified graph, * spacing, orientation and offset. */ public mxStackLayout(mxGraph graph, boolean horizontal, int spacing) { this(graph, horizontal, spacing, spacing, spacing); } /** * Constructs a new stack layout layout for the specified graph, * spacing, orientation and offset. */ public mxStackLayout(mxGraph graph, boolean horizontal, int spacing, int x0, int y0) { super(graph); this.horizontal = horizontal; this.spacing = spacing; this.x0 = x0; this.y0 = y0; } /** * */ public boolean isHorizontal() { return horizontal; } /* * (non-Javadoc) * @see com.mxgraph.layout.mxGraphLayout#move(java.lang.Object, double, double) */ public void moveCell(Object cell, double x, double y) { mxIGraphModel model = graph.getModel(); Object parent = model.getParent(cell); boolean horizontal = isHorizontal(); if (cell instanceof mxICell && parent instanceof mxICell) { int i = 0; double last = 0; int childCount = model.getChildCount(parent); double value = (horizontal) ? x : y; mxCellState pstate = graph.getView().getState(parent); if (pstate != null) { value -= (horizontal) ? pstate.getX() : pstate.getY(); } for (i = 0; i < childCount; i++) { Object child = model.getChildAt(parent, i); if (child != cell) { mxGeometry bounds = model.getGeometry(child); if (bounds != null) { double tmp = (horizontal) ? bounds.getX() + bounds.getWidth() / 2 : bounds.getY() + bounds.getHeight() / 2; if (last < value && tmp > value) { break; } last = tmp; } } } // Changes child order in parent int idx = ((mxICell) parent).getIndex((mxICell) cell); idx = Math.max(0, i - ((i > idx) ? 1 : 0)); model.add(parent, cell, idx); } } /** * Hook for subclassers to return the container size. */ public mxRectangle getContainerSize() { return new mxRectangle(); } /* * (non-Javadoc) * @see com.mxgraph.layout.mxIGraphLayout#execute(java.lang.Object) */ public void execute(Object parent) { if (parent != null) { double x0 = this.x0 + 1; double y0 = this.y0; boolean horizontal = isHorizontal(); mxIGraphModel model = graph.getModel(); mxGeometry pgeo = model.getGeometry(parent); // Handles special case where the parent is either a layer with no // geometry or the current root of the view in which case the size // of the graph's container will be used. if (pgeo == null && model.getParent(parent) == model.getRoot() || parent == graph.getView().getCurrentRoot()) { mxRectangle tmp = getContainerSize(); pgeo = new mxGeometry(0, 0, tmp.getWidth(), tmp.getHeight()); } double fillValue = 0; if (pgeo != null) { fillValue = (horizontal) ? pgeo.getHeight() : pgeo.getWidth(); } fillValue -= 2 * spacing; // Handles swimlane start size mxRectangle size = graph.getStartSize(parent); fillValue -= (horizontal) ? size.getHeight() : size.getWidth(); x0 = this.x0 + size.getWidth(); y0 = this.y0 + size.getHeight(); model.beginUpdate(); try { double tmp = 0; mxGeometry last = null; int childCount = model.getChildCount(parent); for (int i = 0; i < childCount; i++) { Object child = model.getChildAt(parent, i); if (!isVertexIgnored(child) && isVertexMovable(child)) { mxGeometry geo = model.getGeometry(child); if (geo != null) { geo = (mxGeometry) geo.clone(); if (wrap != 0 && last != null) { if ((horizontal && last.getX() + last.getWidth() + geo.getWidth() + 2 * spacing > wrap) || (!horizontal && last.getY() + last.getHeight() + geo.getHeight() + 2 * spacing > wrap)) { last = null; if (horizontal) { y0 += tmp + spacing; } else { x0 += tmp + spacing; } tmp = 0; } } tmp = Math.max(tmp, (horizontal) ? geo .getHeight() : geo.getWidth()); if (last != null) { if (horizontal) { geo.setX(last.getX() + last.getWidth() + spacing); } else { geo.setY(last.getY() + last.getHeight() + spacing); } } else { if (horizontal) { geo.setX(x0); } else { geo.setY(y0); } } if (horizontal) { geo.setY(y0); } else { geo.setX(x0); } if (fill && fillValue > 0) { if (horizontal) { geo.setHeight(fillValue); } else { geo.setWidth(fillValue); } } model.setGeometry(child, geo); last = geo; } } } if (resizeParent && pgeo != null && last != null && !graph.isCellCollapsed(parent)) { pgeo = (mxGeometry) pgeo.clone(); if (horizontal) { pgeo.setWidth(last.getX() + last.getWidth() + spacing); } else { pgeo .setHeight(last.getY() + last.getHeight() + spacing); } model.setGeometry(parent, pgeo); } } finally { model.endUpdate(); } } } }
[ "me@ee.com" ]
me@ee.com
33bdaf184240f4eca1f6b8f34ddd64caf959d8f3
e99e600ef4504e25a1def28f7a842a4a1d4afe15
/com.demo.msg.inbox/src/main/java/com/demo/msg/inbox/InboxInfo.java
737805f2ae38354e384e3b42923e6f7cbbbf7aaa
[]
no_license
liuyngchng/com.test.telecom
df1bbabdba3c2853a245d7f18d2268097b809879
9177449d629baf5894c40ef1615f572def14098d
refs/heads/master
2022-10-16T20:52:00.622266
2019-12-29T12:57:47
2019-12-29T12:57:47
197,525,895
0
0
null
2022-05-20T21:04:27
2019-07-18T06:30:22
JavaScript
UTF-8
Java
false
false
955
java
package com.demo.msg.inbox; import com.demo.common.model.Mail; import com.demo.common.orm.InboxDb; import com.demo.common.util.SQLiteUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.PriorityBlockingQueue; /** * Inbox info. * @author Richard Liu * @since 2019.07.18 */ public class InboxInfo { private static final Logger LOGGER = LoggerFactory.getLogger(InboxInfo.class); public static final Map<String, Map<Long, Mail>> mailIndex = new HashMap<>(8); public static final PriorityBlockingQueue<Mail> queue = new PriorityBlockingQueue(128); public static List<Mail> getMailByUid(int uid, int pageSize, int page) { return InboxDb.getMailByUid(uid,pageSize,page); } public static void main(String[] args) { queue.contains(null); } }
[ "liuyongcheng@rongcloud.cn" ]
liuyongcheng@rongcloud.cn
aa94f49f982b076ee04a50d327389a3ba769030e
f5081b12e6dc3c5d2f13e4956be6accef9a81ace
/src/java/ec/gob/senagua/implementacion/ImpServicio.java
7d387ee84c369f94c2226782000f894940a0b8f9
[]
no_license
alexgualli/Senagua
535924564e1bab644e2550d7a1584f69fd921651
a43df65a8bb0b624ea682ff3fe92f452ac0331fc
refs/heads/master
2020-03-22T04:37:57.329430
2018-07-25T01:27:32
2018-07-25T01:27:32
139,503,766
0
0
null
null
null
null
UTF-8
Java
false
false
4,845
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ec.gob.senagua.implementacion; import ec.gob.senagua.accesodatos.Coneccion; import ec.gob.senagua.accesodatos.Parametro; import ec.gob.senagua.dao.contrato.IntServicio; import ec.gob.senagua.entidades.Servicio; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * * @author paul */ public class ImpServicio implements IntServicio { Coneccion con = new Coneccion(); @Override public int insertar(Servicio servicio) throws Exception { int insert = 0; String sql = "INSERT INTO public.servicio(tipo_de_servicio, costo_minimo, minimo_m3, costo_excedente)\n" + " VALUES (?, ?, ?, ?);"; List<Parametro> prts = new ArrayList<>(); prts.add(new Parametro(1, servicio.getTipoSer())); prts.add(new Parametro(2, servicio.getCostoMin())); prts.add(new Parametro(3, servicio.getMinimoM3())); prts.add(new Parametro(4, servicio.getCostoExc())); if (servicio.getCodigo() != 0) { sql = "INSERT INTO public.servicio(tipo_de_servicio, costo_minimo, minimo_m3, costo_excedente, codigo)\n" + " VALUES (?, ?, ?, ?, ?);"; prts.add(new Parametro(5, servicio.getCodigo())); } try { insert = con.querySet(sql, prts); } catch (Exception e) { throw e; } return insert; } @Override public Servicio obtenerCodigo(int id) throws Exception { Servicio servicio = null; String sql = "SELECT codigo, tipo_de_servicio, costo_minimo, minimo_m3, costo_excedente\n" + " FROM public.servicio " + "WHERE codigo = ? "; List<Parametro> prts = new ArrayList<>(); prts.add(new Parametro(1, id)); try { ResultSet rst = con.queryGet(sql, prts); while (rst.next()) { servicio = new Servicio(); servicio.setCodigo(rst.getInt("codigo")); servicio.setTipoSer(rst.getString("tipo_de_servicio")); servicio.setCostoMin(rst.getDouble("costo_minimo")); servicio.setMinimoM3(rst.getDouble("minimo_m3")); servicio.setCostoExc(rst.getDouble("costo_excedente")); } } catch (Exception e) { throw e; } return servicio; } @Override public List<Servicio> obtenerTodos() throws Exception { List<Servicio> lista = new ArrayList<>(); String sql = "SELECT codigo, tipo_de_servicio, costo_minimo, minimo_m3, costo_excedente\n" + " FROM public.servicio;"; try { ResultSet rst = con.queryGet(sql); while (rst.next()) { Servicio servicio = new Servicio(); servicio.setCodigo(rst.getInt("codigo")); servicio.setTipoSer(rst.getString("tipo_de_servicio")); servicio.setCostoMin(rst.getDouble("costo_minimo")); servicio.setMinimoM3(rst.getDouble("minimo_m3")); servicio.setCostoExc(rst.getDouble("costo_excedente")); lista.add(servicio); } } catch (ClassNotFoundException | SQLException e) { throw e; } return lista; } @Override public int actualizar(Servicio servicio) throws Exception { int update = 0; String sql = "UPDATE public.servicio\n" + " SET tipo_de_servicio=?, costo_minimo=?, minimo_m3=?, costo_excedente=? " + "WHERE codigo=?;"; List<Parametro> prts = new ArrayList<>(); prts.add(new Parametro(1, servicio.getTipoSer())); prts.add(new Parametro(2, servicio.getCostoMin())); prts.add(new Parametro(3, servicio.getMinimoM3())); prts.add(new Parametro(4, servicio.getCostoExc())); prts.add(new Parametro(5, servicio.getCodigo())); try { update = con.querySet(sql, prts); } catch (Exception e) { throw e; } return update; } @Override public int eliminar(int id) throws Exception { int delete = 0; String sql = "DELETE FROM public.servicio " + "WHERE codigo = ?;"; List<Parametro> prts = new ArrayList<>(); prts.add(new Parametro(1, id)); try { delete = con.querySet(sql, prts); } catch (Exception e) { throw e; } return delete; } }
[ "paul@PANCHO" ]
paul@PANCHO
0bfb727ded82c62158954c3a7b10a35c514da17d
314014d5d434a7cdb94c1d3921060a53adfa2881
/Test2/src/com/test/Inherit.java
9b76fd784ff5c337178e13db705173bbb326191d
[]
no_license
dmsrud0514/BrainJava
68269c9881785a1f00c11636f7f2ca00515eb964
241294bdb9df02683f8add3cfbf9fb35e8ad1ee5
refs/heads/master
2020-03-14T15:04:31.234274
2018-05-25T04:12:45
2018-05-25T04:12:45
131,668,056
0
0
null
null
null
null
UHC
Java
false
false
976
java
package com.test; // 슈퍼클래스, 부모클래스 abstract class Person{ int money; public Person(){ // 기본 생성자 System.out.println("부모클래스에 기본생성자 Person() 호출"); this.money = 300000000; } public Person(int money) { this.money = money; System.out.println("부모클래스에 Person(int money)생성자 호출"); } public void displayMoney() { System.out.println("재산:" + money); } } // 서브클래스, 자식클래스 class Child extends Person{ public Child() { System.out.println("자식클래스에 기본생성자 Child 호출"); super.displayMoney(); // 부모 클래스에 } } public class Inherit { public static void main(String[] args) { //Person person = new Person(1000000000); //System.out.println("재산:" + person.money); Child child = new Child(); //child.displayMoney(); //System.out.println(child.money); } }
[ "Administrator@SEK" ]
Administrator@SEK
c1d62443afa265ff6775de6ee5165ac59e47831d
15a4492f5e42a3af470ff54da3d4328c3f0b7745
/src/main/java/com/linda/rpc/webui/servlet/ServletExceptionHandler.java
2316bc3afa9fc71f56cc74789413de5ad88a2d71
[]
no_license
hapream/rpc-webui
6d7a67408591614a9b92ea82cbed05eb22aa0b57
7cd8203f3cde467f6b9394a3a3dc4ea2a283e9c7
refs/heads/master
2021-01-19T04:46:11.794155
2017-02-16T07:20:56
2017-02-16T07:20:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package com.linda.rpc.webui.servlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public interface ServletExceptionHandler { public void handleException(HttpServletRequest request,HttpServletResponse response,Exception e); }
[ "linsony0@163.com" ]
linsony0@163.com
5f1a9c321f552ce214982af4a07b2122f70053f1
4fff4285330949b773e0b615484fb9c4562ff2cd
/vc-web/vc-web-front/src/main/java/com/ccclubs/admin/orm/mapper/CsStructMapper.java
9c41f515319c27ec6f6998afc7707c14ade5a474
[ "Apache-2.0" ]
permissive
soldiers1989/project-2
de21398f32f0e468e752381b99167223420728d5
dc670d7ba700887d951287ec7ff4a7db90ad9f8f
refs/heads/master
2020-03-29T08:48:58.549798
2018-07-24T03:28:08
2018-07-24T03:28:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
247
java
package com.ccclubs.admin.orm.mapper; import com.ccclubs.frm.base.BaseDAO; import com.ccclubs.admin.model.CsStruct; /** * 控制指令管理的Mapper实现 * @author Joel */ public interface CsStructMapper extends BaseDAO<CsStruct,Long>{ }
[ "niuge@ccclubs.com" ]
niuge@ccclubs.com
571c4789f5c8037620c5b762ff0ef4b2e3a5b28b
f960d46a5bd212a5b24e4d19ce9a491463cad3ac
/chess/ChessBoard.java
63f0bd8f4ef4675d3e7e7d0d1e4b193e77756e2d
[]
no_license
TOmas642/RP-Chess
c12725e7b92a43aceeb6fbcff6c02ab892e34776
841f33e8447334d0d8fae46669387c73f3ef7328
refs/heads/master
2020-09-12T10:23:37.406532
2020-01-06T06:19:37
2020-01-06T06:19:37
222,393,010
0
0
null
null
null
null
UTF-8
Java
false
false
3,270
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package chess; import java.io.InputStream; import java.util.ArrayList; import javafx.geometry.Pos; import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; /** * * @author Tomáš */ public class ChessBoard { VBox rootFinal = new VBox(); ArrayList<ImageView> tiles = new ArrayList(); // protected int[] tiles = new int[64]; ChessBoard(int size) { //ArrayList<ChessTile> tilesOccupants = new ArrayList(); // co na danem policku je VBox chessboard = new VBox(); Class<?> clazz = this.getClass(); InputStream inputTileWhite = clazz.getResourceAsStream("images/TileWhite.png"); Image imageTileWhite = new Image(inputTileWhite); InputStream inputTileBlack = clazz.getResourceAsStream("images/TileBlack.png"); Image image2 = new Image(inputTileBlack); for (int j = 0; j < 8; j++) { HBox boardLines = new HBox(); for (int k = 0; k < 8; k++) { ImageView tile; if ((k + j) % 2 == 0) { tile = new ImageView(imageTileWhite); boardLines.getChildren().add(tile); tiles.add(tile); } else { tile = new ImageView(image2); boardLines.getChildren().add(tile); tiles.add(tile); tile.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> { System.out.println("Tile pressed "); ImageView b = (ImageView) event.getSource(); b.setImage(imageTileWhite); event.consume(); }); } } chessboard.getChildren().add(boardLines); } HBox root = new HBox(); HBox columns = new HBox(42); HBox columns2 = new HBox(42); VBox lines = new VBox(33); VBox lines2 = new VBox(33); for (int k = 0; k < 8; k++) { lines.getChildren().add(new Label(Integer.toString(1 + k))); lines2.getChildren().add(new Label(Integer.toString(1 + k))); columns.getChildren().add(new Label(String.valueOf((char) (k + 65)))); columns2.getChildren().add(new Label(String.valueOf((char) (k + 65)))); } lines.setAlignment(Pos.CENTER); lines2.setAlignment(Pos.CENTER); root.setAlignment(Pos.CENTER); root.getChildren().add(lines); root.getChildren().add(chessboard); root.getChildren().add(lines2); columns.setAlignment(Pos.CENTER); columns2.setAlignment(Pos.CENTER); rootFinal.setAlignment(Pos.CENTER); rootFinal.getChildren().add(columns); rootFinal.getChildren().add(root); rootFinal.getChildren().add(columns2); } }
[ "noreply@github.com" ]
noreply@github.com
90e12ce1d098c93bb37d4d42d59f9c9b670db956
280ff32769216472f96287f10936a3122186c4da
/app/src/main/java/com/ntl/udacity/moviesapp/MainActivity.java
a5b63bcef9995863f7b42c743a4bb2380b9638bd
[]
no_license
AhmedEzzat12/MoviesAppNtl
3988c97010bfebe707b1a38e6ccd9a79dc664c1b
2dc0b9ef1f260249439fd8898b2d961fcc638bf6
refs/heads/master
2021-08-17T02:01:13.213339
2017-11-20T17:21:15
2017-11-20T17:21:15
106,697,224
1
0
null
null
null
null
UTF-8
Java
false
false
10,025
java
package com.ntl.udacity.moviesapp; import android.annotation.SuppressLint; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.os.Bundle; import android.os.Parcelable; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.v4.app.LoaderManager; import android.support.v4.content.AsyncTaskLoader; import android.support.v4.content.Loader; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.ntl.udacity.moviesapp.data.MovieContract; import com.ntl.udacity.moviesapp.dataModels.Movie; import com.ntl.udacity.moviesapp.dataModels.MoviesResponse; import java.util.ArrayList; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class MainActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener, CustomAdapter.ListItemClickListener , LoaderManager.LoaderCallbacks<Cursor> { //Api key is here public static final String API_KEY = ""; public static final String MOVIES_KEY = "movies"; private static final String TAG = MainActivity.class.getSimpleName(); private static final int MOVIE_LOADER_ID = 0; private List<Movie> movies = new ArrayList<>(); private CustomAdapter customAdapter; private String sortby; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences sharedPreference = PreferenceManager.getDefaultSharedPreferences(this); customAdapter = new CustomAdapter(this); RecyclerView gridView = findViewById(R.id.gridView); gridView.setLayoutManager(new GridLayoutManager(this, 2)); gridView.setHasFixedSize(true); gridView.setAdapter(customAdapter); if (savedInstanceState != null) { sortby = savedInstanceState.getString("setting"); movies = savedInstanceState.getParcelableArrayList(MOVIES_KEY); if (sortby.equals(getString(R.string.favourites))) customAdapter.setMovies(movies, true); else customAdapter.setMovies(movies, false); } else { sortby = sharedPreference.getString(getString(R.string.key_pref_movie_type), getString(R.string.popular)); if (Utility.isNetworkAvailable(MainActivity.this)) { if (sortby.equals(getString(R.string.favourites))) { getSupportLoaderManager().initLoader(MOVIE_LOADER_ID, null, MainActivity.this); } else getDataFromApi(sortby); } else { Toast.makeText(MainActivity.this, "Please connect to internet to get the latest data", Toast.LENGTH_LONG) .show(); } } sharedPreference.registerOnSharedPreferenceChangeListener(this); } private void getDataFromApi(String choice) { MovieNetworkInterface networkInterface = MovieNetworkClient.getClient().create(MovieNetworkInterface.class); Call<MoviesResponse> moviesResponseCall = null; if (choice.equals(getString(R.string.toprated))) { moviesResponseCall = networkInterface.getTopRatedMovies(API_KEY); } else if (choice.equals(getString(R.string.popular))) { moviesResponseCall = networkInterface.getPopularMovies(API_KEY); } if (moviesResponseCall != null) { moviesResponseCall.enqueue(new Callback<MoviesResponse>() { @Override public void onResponse(@NonNull Call<MoviesResponse> call, @NonNull Response<MoviesResponse> response) { movies.clear(); movies = response.body().getResults(); customAdapter.setMovies(movies, false); Log.d(TAG, "Number of movies received: " + movies.size()); } @Override public void onFailure(@NonNull Call<MoviesResponse> call, @NonNull Throwable t) { Log.e(TAG, t.toString()); } }); } } @Override public void onSaveInstanceState(Bundle savedInstanceState) { String sortby = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()) .getString(getString(R.string.key_pref_movie_type), getString(R.string.popular)); savedInstanceState.putString("setting", sortby); savedInstanceState.putParcelableArrayList(MOVIES_KEY, (ArrayList<? extends Parcelable>) movies); super.onSaveInstanceState(savedInstanceState); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.menu_item_settings) { Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); } return super.onOptionsItemSelected(item); } @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals(getString(R.string.key_pref_movie_type))) { movies.clear(); sortby = sharedPreferences.getString(key, getString(R.string.popular)); if (sortby.equals(getString(R.string.favourites))) getSupportLoaderManager().restartLoader(MOVIE_LOADER_ID, null, MainActivity.this); else { if (Utility.isNetworkAvailable(MainActivity.this)) getDataFromApi(sortby); else Toast.makeText(MainActivity.this, "Please connect to internet to get the latest data", Toast.LENGTH_LONG) .show(); } } } @Override protected void onDestroy() { super.onDestroy(); PreferenceManager.getDefaultSharedPreferences(this) .unregisterOnSharedPreferenceChangeListener(this); } @Override protected void onResume() { if (sortby.equals(getString(R.string.favourites))) getSupportLoaderManager().restartLoader(MOVIE_LOADER_ID, null, MainActivity.this); super.onResume(); } @Override public void onListItemClick(int clickedItemIndex) { Log.d(TAG, movies.get(clickedItemIndex).get_id()); startActivity(new Intent(MainActivity.this, MovieDetail.class) .putExtra(MOVIES_KEY, movies.get(clickedItemIndex))); } @SuppressLint("StaticFieldLeak") @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new AsyncTaskLoader<Cursor>(this) { Cursor mTaskData = null; @Override public Cursor loadInBackground() { try { return getContentResolver().query(MovieContract.MovieEntry.CONTENT_URI, null, null, null, null); } catch (Exception e) { Log.e(TAG, "Failed"); e.printStackTrace(); return null; } } @Override public void deliverResult(Cursor data) { mTaskData = data; super.deliverResult(data); } @Override protected void onStartLoading() { if (mTaskData != null) { deliverResult(mTaskData); } else { forceLoad(); } } }; } @Override public void onLoadFinished(android.support.v4.content.Loader<Cursor> loader, Cursor data) { movies.clear(); movies = parseCursorData(data); customAdapter.setMovies(movies, true); } @Override public void onLoaderReset(android.support.v4.content.Loader<Cursor> loader) { movies.clear(); } private List<Movie> parseCursorData(Cursor data) { List<Movie> movies_cursor = new ArrayList<>(); int idIndex = data.getColumnIndex(MovieContract.MovieEntry._ID); int titleIndex = data.getColumnIndex(MovieContract.MovieEntry.COLUMN_TITLE); int releaseDateIndex = data.getColumnIndex(MovieContract.MovieEntry.COLUMN_RELEASEDATE); int plotIndex = data.getColumnIndex(MovieContract.MovieEntry.COLUMN_PLOTSYNOPSIS); int imageIndex = data.getColumnIndex(MovieContract.MovieEntry.COLUMN_IMAGE); int rateIndex = data.getColumnIndex(MovieContract.MovieEntry.COLUMN_RATE); if (data.moveToFirst()) { do { Movie movie = new Movie(); movie.set_id(String.valueOf(data.getInt(idIndex))); movie.setTitle(data.getString(titleIndex)); movie.setPlotSynopsis(data.getString(plotIndex)); movie.setRate(data.getString(rateIndex)); movie.setReleaseDate(data.getString(releaseDateIndex)); movie.setImage(data.getBlob(imageIndex)); movies_cursor.add(movie); } while (data.moveToNext()); } return movies_cursor; } }
[ "ahmed.salama456@gmail.com" ]
ahmed.salama456@gmail.com
38146d03693dd66e59bd5e8d2b23291c9414fa52
678987ce1e3d9780d52b710d35c3a06556d75025
/app/src/main/java/aviaapplo/luke/notcrappychecker/UI/AppCompatPreferenceActivity.java
dad5db7f42cc792890f41adcf9233b7a6725cdcf
[]
no_license
gofirst2220/notcrappychecker
42979fdc7e4c217142f82c02b4be7d5044d6874e
1931a07e89670ac9d31ea04992bbae160b2bca34
refs/heads/master
2020-12-22T04:28:18.808894
2016-08-08T17:17:14
2016-08-08T17:17:14
59,497,973
2
0
null
null
null
null
UTF-8
Java
false
false
3,008
java
package aviaapplo.luke.notcrappychecker.ui; import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceActivity; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatDelegate; import android.support.v7.widget.Toolbar; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; /** * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls * to be used with AppCompat. */ public abstract class AppCompatPreferenceActivity extends PreferenceActivity { private AppCompatDelegate mDelegate; @Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getDelegate().onPostCreate(savedInstanceState); } public ActionBar getSupportActionBar() { return getDelegate().getSupportActionBar(); } public void setSupportActionBar(@Nullable Toolbar toolbar) { getDelegate().setSupportActionBar(toolbar); } @Override public MenuInflater getMenuInflater() { return getDelegate().getMenuInflater(); } @Override public void setContentView(@LayoutRes int layoutResID) { getDelegate().setContentView(layoutResID); } @Override public void setContentView(View view) { getDelegate().setContentView(view); } @Override public void setContentView(View view, ViewGroup.LayoutParams params) { getDelegate().setContentView(view, params); } @Override public void addContentView(View view, ViewGroup.LayoutParams params) { getDelegate().addContentView(view, params); } @Override protected void onPostResume() { super.onPostResume(); getDelegate().onPostResume(); } @Override protected void onTitleChanged(CharSequence title, int color) { super.onTitleChanged(title, color); getDelegate().setTitle(title); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); getDelegate().onConfigurationChanged(newConfig); } @Override protected void onStop() { super.onStop(); getDelegate().onStop(); } @Override protected void onDestroy() { super.onDestroy(); getDelegate().onDestroy(); } public void invalidateOptionsMenu() { getDelegate().invalidateOptionsMenu(); } private AppCompatDelegate getDelegate() { if (mDelegate == null) { mDelegate = AppCompatDelegate.create(this, null); } return mDelegate; } }
[ "ldbenkenobi359@gmail.com" ]
ldbenkenobi359@gmail.com
ccee585ef1dd1f46db2b833388a9965b2d8e39c9
6d39aeba51877658e72f4cf58148426fcfea8455
/Android/TheDailyNews/app/src/main/java/com/example/thedailynews/Subscribe.java
9567f99536cc43d61232f89031d27685ad736ef1
[]
no_license
monkidea/TheDailyNews
4b94c816864317dbffb331c2fdb35c27b7087e25
6f6a2aafe3a7368bbba63272e5d815d75f80d501
refs/heads/master
2022-11-13T11:51:40.848182
2020-06-23T07:03:57
2020-06-23T07:03:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,994
java
package com.example.thedailynews; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import static android.view.View.GONE; import static com.example.thedailynews.Login.getDefaults; public class Subscribe extends AppCompatActivity { LinearLayout ll; ArrayList<String> names; ArrayList<String> ids; CheckBox[] ch; Boolean ticked[]; Button done; ProgressBar progressBar; List<String> finallist; String finalString=""; String alreadySubscribed[]; private static String JSON_URL = Constants.base_url+"/api/suscribe"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_subscribe); ll = findViewById(R.id.ll); done=findViewById(R.id.done); progressBar=findViewById(R.id.progressBar); done.setOnClickListener(new View.OnClickListener() { @RequiresApi(api = Build.VERSION_CODES.O) @Override public void onClick(View v) { finallist=new ArrayList<>(); for(int k=0;k<ticked.length;k++){ if(ticked[k]){ finallist.add(ids.get(k)); } } if(finallist.size()<4){ Toast.makeText(Subscribe.this, "Select atleast 4 sources!", Toast.LENGTH_SHORT).show(); return; } done.setEnabled(false); finalString=String.join(",", finallist); Log.d("myapp","final String is : "+finalString); // Toast.makeText(Subscribe.this, finalString, Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.VISIBLE); StringRequest stringRequest2=new StringRequest(Request.Method.POST, JSON_URL, new Response.Listener<String>() { @Override public void onResponse(String response) { try { Log.d("myapp",response); done.setEnabled(true); progressBar.setVisibility(GONE); JSONObject jsonObject=new JSONObject(response); String status=jsonObject.getString("status"); if(status.equals("success")){ Toast.makeText(Subscribe.this, "Subscribed Successfully!", Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(Subscribe.this, "Fail", Toast.LENGTH_SHORT).show(); } } catch (JSONException error) { done.setEnabled(true); Log.d("myapp","Here1 "+error.getMessage().toString()); Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { done.setEnabled(true); Log.d("myapp","Here2: "+error.getMessage()); Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show(); } }) { @Override protected Map<String, String> getParams() { Map<String, String> params = new HashMap<String, String>(); params.put("selected_list", finalString); params.put("Android", "Android"); //params.put("password", passwordLogin.getText().toString()); return params; } @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> header = new HashMap<String, String>(); header.put("Authorization", "Bearer "+getDefaults("usertoken",getApplicationContext())); return header; } }; RequestQueue requestQueue = Volley.newRequestQueue(v.getContext()); requestQueue.add(stringRequest2); } }); ids=new ArrayList<>(); names=new ArrayList<>(); getSourceList(); } void getSourceList(){ String JSON_URL=Constants.base_url+"/api/currentUser"; StringRequest stringRequest=new StringRequest(Request.Method.POST, JSON_URL, new Response.Listener<String>() { @Override public void onResponse(String response) { try { progressBar = (ProgressBar) findViewById(R.id.progressBar); progressBar.setVisibility(GONE); done.setEnabled(true); JSONObject resp=new JSONObject(response); JSONObject currUser=resp.getJSONObject("user"); String suscribed_string=currUser.getString("suscribed"); Log.d("myapp","suscribed_string:"+suscribed_string); String aa[]; aa=suscribed_string.split(","); for(int w=0;w<aa.length;w++){ aa[w]=aa[w].replace("[",""); aa[w]=aa[w].replace("]",""); aa[w]=aa[w].replace("\\",""); aa[w]=aa[w].replace("\"",""); Log.d("myapp",aa[w]); } alreadySubscribed=aa; JSONObject jsonObject=new JSONObject(loadJSONFromAsset()); if(jsonObject.getString("status").equals("success")) { JSONArray articles = jsonObject.getJSONArray("sources"); Log.d("myapp", String.valueOf(articles.length())); Toast.makeText(Subscribe.this, String.valueOf(articles.length()), Toast.LENGTH_SHORT).show(); ids.clear(); names.clear(); for (int i = 0; i < articles.length(); i++) { JSONObject singleArticle = articles.getJSONObject(i); String author = singleArticle.getString("url");//IMP String source = singleArticle.getString("unique_id");//IMP ids.add(author); names.add(source); } aftervolley(); } else{ Toast.makeText(Subscribe.this, jsonObject.getString("status"), Toast.LENGTH_SHORT).show(); } } catch (JSONException error) { Log.d("myapp","JSONException "+error.toString()); Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.d("myapp","onErrorResponse "+error.toString()); Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show(); } }) { // @Override // protected Map<String, String> getParams() // { // Map<String, String> params = new HashMap<String, String>(); // params.put("main_urls", "http://www.huffingtonpost.com"); // // // return params; // } @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> header = new HashMap<String, String>(); header.put("Authorization", "Bearer "+getDefaults("usertoken",getApplicationContext())); return header; } }; RequestQueue requestQueue = Volley.newRequestQueue(this); stringRequest.setRetryPolicy(new DefaultRetryPolicy( 10000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); requestQueue.add(stringRequest); /// } public String loadJSONFromAsset() { String json = null; try { InputStream is = getApplicationContext().getAssets().open("source.json"); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; } void aftervolley(){ Log.d("myapp","names size: "+String.valueOf(names.size())); ch = new CheckBox[names.size()]; ticked=new Boolean[names.size()]; Arrays.fill(ticked,false); for(int i=0;i<alreadySubscribed.length;i++){ int index=ids.indexOf(alreadySubscribed[i]); if(index>-1){ ticked[index]=true; } } for(int i=0; i<names.size(); i++) { ch[i] = new CheckBox(this); ch[i].setId(i); ch[i].setText(names.get(i)); ch[i].setChecked(ticked[i]); ll.addView(ch[i]); Log.d("longlist",names.get(i)); } for (int i = 0; i < names.size(); i++) { final int j = i; ch[j].setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Log.d("myapp","Checked ID :: " + ch[j].getId() +isChecked); ticked[j]=isChecked; } }); } } }
[ "rugved.bongale@somaiya.edu" ]
rugved.bongale@somaiya.edu