hexsha stringlengths 40 40 | size int64 3 1.05M | ext stringclasses 1 value | lang stringclasses 1 value | max_stars_repo_path stringlengths 5 1.02k | max_stars_repo_name stringlengths 4 126 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses list | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 5 1.02k | max_issues_repo_name stringlengths 4 114 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses list | max_issues_count float64 1 92.2k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 5 1.02k | max_forks_repo_name stringlengths 4 136 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses list | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | avg_line_length float64 2.55 99.9 | max_line_length int64 3 1k | alphanum_fraction float64 0.25 1 | index int64 0 1M | content stringlengths 3 1.05M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3e105b3bd0e4745f8c7201f1bd0d1abcc7d87bfe | 269 | java | Java | src/sunit/xml/XmlExeption.java | 10usb/java-xml | 6c1849cc3905aeb23d01167676d3c79d232e6e20 | [
"MIT"
] | null | null | null | src/sunit/xml/XmlExeption.java | 10usb/java-xml | 6c1849cc3905aeb23d01167676d3c79d232e6e20 | [
"MIT"
] | null | null | null | src/sunit/xml/XmlExeption.java | 10usb/java-xml | 6c1849cc3905aeb23d01167676d3c79d232e6e20 | [
"MIT"
] | null | null | null | 17.933333 | 54 | 0.754647 | 6,932 | package sunit.xml;
import java.io.IOException;
@SuppressWarnings("serial")
public class XmlExeption extends IOException {
public XmlExeption(String message) {
super(message);
}
public XmlExeption(String message, Throwable cause) {
super(message, cause);
}
}
|
3e105bb028ceae9c106e27b5593ddb070f5b078b | 2,429 | java | Java | com/planet_ink/coffee_mud/Behaviors/AlignHelper.java | welterde/ewok | 6fce1fd0b8b1164eba79c17252708d3215bd90e9 | [
"Apache-2.0"
] | 1 | 2019-02-25T09:33:03.000Z | 2019-02-25T09:33:03.000Z | com/planet_ink/coffee_mud/Behaviors/AlignHelper.java | welterde/ewok | 6fce1fd0b8b1164eba79c17252708d3215bd90e9 | [
"Apache-2.0"
] | null | null | null | com/planet_ink/coffee_mud/Behaviors/AlignHelper.java | welterde/ewok | 6fce1fd0b8b1164eba79c17252708d3215bd90e9 | [
"Apache-2.0"
] | 2 | 2017-08-15T12:28:07.000Z | 2021-08-07T05:24:00.000Z | 38.555556 | 120 | 0.7324 | 6,933 | package com.planet_ink.coffee_mud.Behaviors;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2000-2010 Bo Zimmerman
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.
*/
public class AlignHelper extends StdBehavior
{
public String ID(){return "AlignHelper";}
public void executeMsg(Environmental affecting, CMMsg msg)
{
super.executeMsg(affecting,msg);
if((msg.target()==null)||(!(msg.target() instanceof MOB))) return;
MOB source=msg.source();
MOB observer=(MOB)affecting;
MOB target=(MOB)msg.target();
if((source!=observer)
&&(target!=observer)
&&(source!=target)
&&(CMath.bset(msg.targetCode(),CMMsg.MASK_MALICIOUS))
&&(!observer.isInCombat())
&&(CMLib.flags().canBeSeenBy(source,observer))
&&(CMLib.flags().canBeSeenBy(target,observer))
&&(!BrotherHelper.isBrother(source,observer,false))
&&( (CMLib.flags().isEvil(target)&&CMLib.flags().isEvil(observer))
||(CMLib.flags().isNeutral(target)&&CMLib.flags().isNeutral(observer))
||(CMLib.flags().isGood(target)&&CMLib.flags().isGood(observer))))
{
Aggressive.startFight(observer,source,true,false,CMLib.flags().getAlignmentName(observer)+" PEOPLE UNITE! CHARGE!");
}
}
}
|
3e105bbaca927418e4025012e901740f9301b0fa | 931 | java | Java | core/impl/main/java/org/directwebremoting/filter/LogAjaxFilter.java | burris/dwr | a8c6765f82266b738a030010b920d682edb6c348 | [
"Apache-2.0"
] | 23 | 2015-05-30T04:20:12.000Z | 2022-01-04T08:29:41.000Z | core/impl/main/java/org/directwebremoting/filter/LogAjaxFilter.java | xiaozhen1900/dwr | a8c6765f82266b738a030010b920d682edb6c348 | [
"Apache-2.0"
] | null | null | null | core/impl/main/java/org/directwebremoting/filter/LogAjaxFilter.java | xiaozhen1900/dwr | a8c6765f82266b738a030010b920d682edb6c348 | [
"Apache-2.0"
] | 11 | 2015-05-17T12:44:02.000Z | 2021-03-24T06:48:39.000Z | 34.481481 | 78 | 0.746509 | 6,934 | /*
* Copyright 2005 Joe Walker
*
* 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.directwebremoting.filter;
/**
* LogAjaxFilter is a marker interface to tell the AjaxFilter system that this
* filter is doing some logging, and therefore there should not be any default
* output at all if something goes wrong.
* @author Joe Walker [joe at getahead dot ltd dot uk]
*/
public interface LogAjaxFilter
{
}
|
3e105c2c154ac4df2677111e76d82ac7d218c0ef | 244 | java | Java | http-parser/src/main/java/primitive/collection/CharFunction.java | bharath12345/RealTimeDashboard | 428b28e9a782cb774927d3d0ccb971c1bd6e79c1 | [
"MIT"
] | 1 | 2015-04-03T22:36:23.000Z | 2015-04-03T22:36:23.000Z | http-parser/src/main/java/primitive/collection/CharFunction.java | bharath12345/RealTimeDashboard | 428b28e9a782cb774927d3d0ccb971c1bd6e79c1 | [
"MIT"
] | null | null | null | http-parser/src/main/java/primitive/collection/CharFunction.java | bharath12345/RealTimeDashboard | 428b28e9a782cb774927d3d0ccb971c1bd6e79c1 | [
"MIT"
] | null | null | null | 18.769231 | 51 | 0.651639 | 6,935 | package primitive.collection;
/* DO NOT EDIT THIS FILE, IT IS GENERATED! */
public abstract class CharFunction {
public void apply(char value) {
}
public char accumulate(char memo, char value) {
return '\u0000';
}
}
|
3e105c3713b4f0c17207e9eb5475d0885d3c83fc | 1,944 | java | Java | src/main/java/com/douglaswhitehead/model/digitaldata/privacy/AccessCategory.java | dsw9742/ceddl | 9ddff83d841a344764e8f907046a075ab67a27c5 | [
"MIT"
] | null | null | null | src/main/java/com/douglaswhitehead/model/digitaldata/privacy/AccessCategory.java | dsw9742/ceddl | 9ddff83d841a344764e8f907046a075ab67a27c5 | [
"MIT"
] | null | null | null | src/main/java/com/douglaswhitehead/model/digitaldata/privacy/AccessCategory.java | dsw9742/ceddl | 9ddff83d841a344764e8f907046a075ab67a27c5 | [
"MIT"
] | null | null | null | 23.707317 | 112 | 0.626029 | 6,936 | package com.douglaswhitehead.model.digitaldata.privacy;
/**
* <p>AccessCategory interface.</p>
*
* <p>From the W3C CEDDL specification:</p>
*
* <p>A list of privacy categories.</p>
*
* @author douglas.whitehead
*
*/
public interface AccessCategory {
/**
* <p>Returns the CategoryName object.</p>
*
* <p>From the W3C CEDDL specification:</p>
*
* <p>Definition of category names to be associated with <tt>security</tt> objects with the matching name.</p>
*
* <p>
* A <tt>categoryName</tt> of Default MUST be included for privacy enforcement. All other categories
* are custom. Common categories include Analytics, Recommendations, and Personalization.
* </p>
*
* @return String
*/
public String getCategoryName();
/**
* <p>Returns the Domains array.</p>
*
* <p>From the W3C CEDDL specification:</p>
*
* <p>
* Particular vendors associated with the particular category. This SHOULD be an array listing
* domains for vendors associated with the category.
* </p>
*
* <p>
* The Default category SHOULD contain all technologies which must be treated the same as first
* party for privacy purposes (e.g., a tag management technology).
* </p>
*
* @return String
*/
public String[] getDomains();
/**
* AccessCategory.Builder inner interface.
*
* @author douglas.whitehead
*
*/
public static interface Builder {
/**
* Builds the CategoryName object.
*
* @param String categoryName
* @return Builder
*/
public Builder categoryName(String categoryName);
/**
* Builds the Domains array.
*
* @param String[] domains
* @return Builder
*/
public Builder domains(String[] domains);
/**
* Builds and returns the AccessCategory object.
*
* @return AccessCategory
*/
public AccessCategory build();
}
}
|
3e105cc5dd7b84b12fc1b01306b5d918a3ca4c21 | 1,351 | java | Java | src/main/java/com/epam/reportportal/jbehave/RpJUnitStories.java | uarlouski/agent-java-jbehave | 195058027d4e8c7425c7792a97869c34b99f217e | [
"Apache-2.0"
] | null | null | null | src/main/java/com/epam/reportportal/jbehave/RpJUnitStories.java | uarlouski/agent-java-jbehave | 195058027d4e8c7425c7792a97869c34b99f217e | [
"Apache-2.0"
] | null | null | null | src/main/java/com/epam/reportportal/jbehave/RpJUnitStories.java | uarlouski/agent-java-jbehave | 195058027d4e8c7425c7792a97869c34b99f217e | [
"Apache-2.0"
] | 1 | 2019-02-28T07:43:02.000Z | 2019-02-28T07:43:02.000Z | 33.775 | 109 | 0.737232 | 6,937 | /*
* Copyright (C) 2019 EPAM Systems
*
* 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.epam.reportportal.jbehave;
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.junit.JUnitStories;
import org.jbehave.core.reporters.StoryReporterBuilder;
/**
* Wraps {@link JUnitStories} to be able to start and finish execution in
* ReportPortal
*
* @author Andrei Varabyeu
*/
public abstract class RpJUnitStories extends JUnitStories {
/**
* Adds ReportPortalFormat to be able to report results to ReportPortal
*/
@Override
public Configuration configuration() {
return super.configuration()
.useStoryReporterBuilder(new StoryReporterBuilder().withFormats(ReportPortalFormat.INSTANCE))
.useViewGenerator(new ReportPortalViewGenerator());
}
}
|
3e105ed2a42b98b2f024c75a52d558e76ced6138 | 387 | java | Java | anychart/src/main/java/com/anychart/enums/ScatterSeriesType.java | gitdevstar/FinanicalApp | b9d8af5c6fd17a8f3f5ae178f31b9c9325fca012 | [
"Apache-2.0"
] | null | null | null | anychart/src/main/java/com/anychart/enums/ScatterSeriesType.java | gitdevstar/FinanicalApp | b9d8af5c6fd17a8f3f5ae178f31b9c9325fca012 | [
"Apache-2.0"
] | null | null | null | anychart/src/main/java/com/anychart/enums/ScatterSeriesType.java | gitdevstar/FinanicalApp | b9d8af5c6fd17a8f3f5ae178f31b9c9325fca012 | [
"Apache-2.0"
] | null | null | null | 16.826087 | 57 | 0.614987 | 6,938 | package com.anychart.enums;
import java.util.Locale;
/**
* Scatter series types.
*/
public enum ScatterSeriesType {
BUBBLE("bubble"),
LINE("line"),
MARKER("marker");
private final String value;
ScatterSeriesType(String value) {
this.value = value;
}
public String getJsBase() {
return String.format(Locale.US, "\"%s\"", value);
}
} |
3e105f040467eead1008917459d24f01d35156de | 2,572 | java | Java | firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/RoboStartingIntent.java | sravanmedarapu/flank | 14c2f6400c62798ff25d6ca2a140ddbf29354cab | [
"MIT"
] | 2 | 2022-03-22T04:52:52.000Z | 2022-03-22T04:52:54.000Z | firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/RoboStartingIntent.java | sravanmedarapu/flank | 14c2f6400c62798ff25d6ca2a140ddbf29354cab | [
"MIT"
] | null | null | null | firebase_apis/test_api/src/main/java/com/google/api/services/testing/model/RoboStartingIntent.java | sravanmedarapu/flank | 14c2f6400c62798ff25d6ca2a140ddbf29354cab | [
"MIT"
] | null | null | null | 30.258824 | 182 | 0.727061 | 6,939 | /*
* 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.
*/
/*
* This code was generated by https://github.com/google/apis-client-generator/
* Modify at your own risk.
*/
package com.google.api.services.testing.model;
/**
* Message for specifying the start activities to crawl
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Testing API. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class RoboStartingIntent extends com.google.api.client.json.GenericJson {
/**
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private LauncherActivityIntent launcherActivity;
/**
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private StartActivityIntent startActivity;
/**
* @return value or {@code null} for none
*/
public LauncherActivityIntent getLauncherActivity() {
return launcherActivity;
}
/**
* @param launcherActivity launcherActivity or {@code null} for none
*/
public RoboStartingIntent setLauncherActivity(LauncherActivityIntent launcherActivity) {
this.launcherActivity = launcherActivity;
return this;
}
/**
* @return value or {@code null} for none
*/
public StartActivityIntent getStartActivity() {
return startActivity;
}
/**
* @param startActivity startActivity or {@code null} for none
*/
public RoboStartingIntent setStartActivity(StartActivityIntent startActivity) {
this.startActivity = startActivity;
return this;
}
@Override
public RoboStartingIntent set(String fieldName, Object value) {
return (RoboStartingIntent) super.set(fieldName, value);
}
@Override
public RoboStartingIntent clone() {
return (RoboStartingIntent) super.clone();
}
}
|
3e10600b0490658c2699f31e846ae389a3b04cd9 | 943 | java | Java | waiwidemo/mylibrary/src/main/java/com/waiwi/android/mylibrary/utils/MD5.java | laogong/wawiUtils | 84284b6e685cb3b6d8b8654b1c74b3abf1f6033c | [
"MIT"
] | null | null | null | waiwidemo/mylibrary/src/main/java/com/waiwi/android/mylibrary/utils/MD5.java | laogong/wawiUtils | 84284b6e685cb3b6d8b8654b1c74b3abf1f6033c | [
"MIT"
] | null | null | null | waiwidemo/mylibrary/src/main/java/com/waiwi/android/mylibrary/utils/MD5.java | laogong/wawiUtils | 84284b6e685cb3b6d8b8654b1c74b3abf1f6033c | [
"MIT"
] | null | null | null | 29.46875 | 78 | 0.45281 | 6,940 | package com.waiwi.android.mylibrary.utils;
import java.security.MessageDigest;
/**
* Created by Administrator on 2014/12/23.
*/
public class MD5 {
public final static String Md5(String s) {
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f' };
try {
byte[] strTemp = s.getBytes("UTF-8");
MessageDigest mdTemp = MessageDigest.getInstance("MD5");
mdTemp.update(strTemp);
byte[] md = mdTemp.digest();
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
return new String(str);
} catch (Exception e) {
return null;
}
}
}
|
3e10641f3b08948dccda5e13515420d728e2f18e | 3,074 | java | Java | egov-eauth/eauth-common-libs/eauth-soap-service/src/main/java/soap/clientregix/requests/av/tr/SubjectType.java | governmentbg/eAuth-v2 | 9fa502fc244c662d82a7edf0c41f3495e28e81f0 | [
"Apache-2.0"
] | null | null | null | egov-eauth/eauth-common-libs/eauth-soap-service/src/main/java/soap/clientregix/requests/av/tr/SubjectType.java | governmentbg/eAuth-v2 | 9fa502fc244c662d82a7edf0c41f3495e28e81f0 | [
"Apache-2.0"
] | 10 | 2021-05-09T00:45:25.000Z | 2022-02-27T10:53:10.000Z | egov-eauth/eauth-common-libs/eauth-soap-service/src/main/java/soap/clientregix/requests/av/tr/SubjectType.java | governmentbg/eAuth-v2 | 9fa502fc244c662d82a7edf0c41f3495e28e81f0 | [
"Apache-2.0"
] | 1 | 2020-09-18T08:13:22.000Z | 2020-09-18T08:13:22.000Z | 24.396825 | 111 | 0.588484 | 6,941 | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.05.03 at 11:48:44 PM EEST
//
package soap.clientregix.requests.av.tr;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for SubjectType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SubjectType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Indent" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="IndentType" type="{http://egov.bg/RegiX/AV/TR}IndentTypeType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SubjectType", propOrder = {
"indent",
"name",
"indentType"
})
public class SubjectType {
@XmlElement(name = "Indent")
protected String indent;
@XmlElement(name = "Name")
protected String name;
@XmlElement(name = "IndentType")
protected IndentTypeType indentType;
/**
* Gets the value of the indent property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIndent() {
return indent;
}
/**
* Sets the value of the indent property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIndent(String value) {
this.indent = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the indentType property.
*
* @return
* possible object is
* {@link IndentTypeType }
*
*/
public IndentTypeType getIndentType() {
return indentType;
}
/**
* Sets the value of the indentType property.
*
* @param value
* allowed object is
* {@link IndentTypeType }
*
*/
public void setIndentType(IndentTypeType value) {
this.indentType = value;
}
}
|
3e1065411959c60d2a6b29f3c6b2db1c69d418cb | 4,911 | java | Java | core/src/main/java/io/smallrye/openapi/runtime/io/tag/TagReader.java | rgmz/smallrye-open-api | b28a8595cf457244700c4568d8ef962e8feb9dc4 | [
"Apache-2.0"
] | 68 | 2018-05-27T23:12:12.000Z | 2022-03-03T08:43:59.000Z | core/src/main/java/io/smallrye/openapi/runtime/io/tag/TagReader.java | rgmz/smallrye-open-api | b28a8595cf457244700c4568d8ef962e8feb9dc4 | [
"Apache-2.0"
] | 599 | 2018-06-13T06:11:35.000Z | 2022-03-31T14:03:18.000Z | core/src/main/java/io/smallrye/openapi/runtime/io/tag/TagReader.java | phillip-kruger/smallrye-open-api | c64e47ef65f61290b46664ebe2649fa1fcc1dc8c | [
"Apache-2.0"
] | 72 | 2018-05-29T07:34:24.000Z | 2022-03-18T04:00:54.000Z | 37.884615 | 127 | 0.683452 | 6,942 | package io.smallrye.openapi.runtime.io.tag;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.microprofile.openapi.models.tags.Tag;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.AnnotationValue;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import io.smallrye.openapi.api.models.tags.TagImpl;
import io.smallrye.openapi.runtime.io.IoLogging;
import io.smallrye.openapi.runtime.io.JsonUtil;
import io.smallrye.openapi.runtime.io.extension.ExtensionReader;
import io.smallrye.openapi.runtime.io.externaldocs.ExternalDocsConstant;
import io.smallrye.openapi.runtime.io.externaldocs.ExternalDocsReader;
import io.smallrye.openapi.runtime.scanner.spi.AnnotationScannerContext;
import io.smallrye.openapi.runtime.util.JandexUtil;
import io.smallrye.openapi.runtime.util.TypeUtil;
/**
* Reading the Tag from annotation or json
*
* @see <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tagObject">tagObject</a>
*
* @author Phillip Kruger (upchh@example.com)
* @author Eric Wittmann (upchh@example.com)
*/
public class TagReader {
private TagReader() {
}
/**
* Reads any Tag annotations.The annotation
* value is an array of Tag annotations.
*
* @param context scanning context
* @param annotationValue an array of {@literal @}Tag annotations
* @return List of Tag models
*/
public static Optional<List<Tag>> readTags(final AnnotationScannerContext context, final AnnotationValue annotationValue) {
if (annotationValue != null) {
IoLogging.logger.annotationsArray("@Tag");
AnnotationInstance[] nestedArray = annotationValue.asNestedArray();
List<Tag> tags = new ArrayList<>();
for (AnnotationInstance tagAnno : nestedArray) {
if (!JandexUtil.isRef(tagAnno)) {
tags.add(readTag(context, tagAnno));
}
}
return Optional.of(tags);
}
return Optional.empty();
}
/**
* Reads a list of {@link Tag} OpenAPI nodes.
*
* @param node the json array node
* @return List of Tag models
*/
public static Optional<List<Tag>> readTags(final JsonNode node) {
if (node != null && node.isArray()) {
IoLogging.logger.jsonArray("Tag");
ArrayNode nodes = (ArrayNode) node;
List<Tag> rval = new ArrayList<>(nodes.size());
for (JsonNode tagNode : nodes) {
rval.add(readTag(tagNode));
}
return Optional.of(rval);
}
return Optional.empty();
}
/**
* Reads a single Tag annotation.
*
* @param context scanning context
* @param annotationInstance {@literal @}Tag annotation, must not be null
* @return Tag model
*/
public static Tag readTag(final AnnotationScannerContext context, final AnnotationInstance annotationInstance) {
Objects.requireNonNull(annotationInstance, "Tag annotation must not be null");
IoLogging.logger.singleAnnotation("@Tag");
Tag tag = new TagImpl();
tag.setName(JandexUtil.stringValue(annotationInstance, TagConstant.PROP_NAME));
tag.setDescription(JandexUtil.stringValue(annotationInstance, TagConstant.PROP_DESCRIPTION));
tag.setExternalDocs(
ExternalDocsReader.readExternalDocs(context,
annotationInstance.value(ExternalDocsConstant.PROP_EXTERNAL_DOCS)));
tag.setExtensions(ExtensionReader.readExtensions(context, annotationInstance));
return tag;
}
/**
* Reads a {@link Tag} OpenAPI node.
*
* @param node the json node
* @return Tag model
*/
private static Tag readTag(final JsonNode node) {
IoLogging.logger.singleJsonNode("Tag");
Tag tag = new TagImpl();
tag.setName(JsonUtil.stringProperty(node, TagConstant.PROP_NAME));
tag.setDescription(JsonUtil.stringProperty(node, TagConstant.PROP_DESCRIPTION));
tag.setExternalDocs(ExternalDocsReader.readExternalDocs(node.get(ExternalDocsConstant.PROP_EXTERNAL_DOCS)));
ExtensionReader.readExtensions(node, tag);
return tag;
}
// Helpers for scanner classes
public static boolean hasTagAnnotation(final AnnotationTarget target) {
return TypeUtil.hasAnnotation(target, TagConstant.DOTNAME_TAG) ||
TypeUtil.hasAnnotation(target, TagConstant.DOTNAME_TAGS);
}
public static List<AnnotationInstance> getTagAnnotations(final AnnotationTarget target) {
return JandexUtil.getRepeatableAnnotation(target,
TagConstant.DOTNAME_TAG,
TagConstant.DOTNAME_TAGS);
}
}
|
3e10658b964ab9df3e8e90bbe7338fc290f17dbe | 49,487 | java | Java | src/main/java/com/firecode/cqldesktop/style/AbstractTheme.java | chiangfire/cql-desktop | d75798ec78b6692ea2079bd209820020c479420b | [
"MIT"
] | 1 | 2018-12-10T12:52:59.000Z | 2018-12-10T12:52:59.000Z | src/main/java/com/firecode/cqldesktop/style/AbstractTheme.java | chiangfire/cql-desktop | d75798ec78b6692ea2079bd209820020c479420b | [
"MIT"
] | null | null | null | src/main/java/com/firecode/cqldesktop/style/AbstractTheme.java | chiangfire/cql-desktop | d75798ec78b6692ea2079bd209820020c479420b | [
"MIT"
] | null | null | null | 33.369521 | 113 | 0.758078 | 6,943 | /**
* MIT License
* Copyright (c) 2018 jiangcihuo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.firecode.cqldesktop.style;
import java.awt.Color;
import java.awt.Font;
import java.awt.RenderingHints;
import java.io.FileInputStream;
import java.util.Properties;
import javax.swing.Icon;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.metal.MetalTheme;
import com.firecode.cqldesktop.utils.StyleUtils;
public abstract class AbstractTheme extends MetalTheme {
public static final int TEXT_ANTIALIAS_DEFAULT = 0;
public static final int TEXT_ANTIALIAS_GRAY = 1;
public static final int TEXT_ANTIALIAS_HRGB = 2;
public static final int TEXT_ANTIALIAS_HBGR = 3;
public static final int TEXT_ANTIALIAS_VRGB = 4;
public static final int TEXT_ANTIALIAS_VBGR = 5;
public static final String DIALOG = "Dialog";
public static final ColorUIResource red = new ColorUIResource(255, 0, 0);
public static final ColorUIResource green = new ColorUIResource(0, 255, 255);
public static final ColorUIResource cyan = new ColorUIResource(0, 255, 255);
public static final ColorUIResource white = new ColorUIResource(255, 255, 255);
public static final ColorUIResource superLightGray = new ColorUIResource(248, 248, 248);
public static final ColorUIResource extraLightGray = new ColorUIResource(232, 232, 232);
public static final ColorUIResource lightGray = new ColorUIResource(196, 196, 196);
public static final ColorUIResource gray = new ColorUIResource(164, 164, 164);
public static final ColorUIResource darkGray = new ColorUIResource(148, 148, 148);
public static final ColorUIResource extraDarkGray = new ColorUIResource(96, 96, 96);
public static final ColorUIResource black = new ColorUIResource(0, 0, 0);
public static final ColorUIResource orange = new ColorUIResource(255, 200, 0);
public static final ColorUIResource lightOrange = new ColorUIResource(255, 220, 96);
public static final ColorUIResource yellow = new ColorUIResource(255, 255, 196);
public static final ColorUIResource blue = new ColorUIResource(0, 128, 255);
public static final ColorUIResource darkBlue = new ColorUIResource(0, 64, 128);
protected static String internalName = "Default";
protected static boolean windowDecoration = false;
protected static boolean macStyleWindowDecoration = false;
protected static boolean centerWindowTitle = false;
protected static boolean linuxStyleScrollBar = false;
protected static boolean macStyleScrollBar = false;
protected static boolean dynamicLayout = false;
protected static boolean textShadow = false;
protected static boolean textAntiAliasing = false;
protected static int textAntiAliasingMode = TEXT_ANTIALIAS_HRGB;
protected static boolean backgroundPattern = true;
protected static boolean brightMode = false;
protected static boolean showFocusFrame = false;
protected static boolean drawSquareButtons = false;
protected static boolean toolbarDecorated = true;
protected static boolean menuOpaque = true;
protected static float menuAlpha = 0.9f;
protected static String logoString = "CQL-Desktop";
protected static FontUIResource controlFont = null;
protected static FontUIResource systemFont = null;
protected static FontUIResource userFont = null;
protected static FontUIResource smallFont = null;
protected static FontUIResource menuFont = null;
protected static FontUIResource windowTitleFont = null;
protected static ColorUIResource foregroundColor = null;
protected static ColorUIResource backgroundColor = null;
protected static ColorUIResource backgroundColorLight = null;
protected static ColorUIResource backgroundColorDark = null;
protected static ColorUIResource alterBackgroundColor = null;
protected static ColorUIResource disabledForegroundColor = null;
protected static ColorUIResource disabledBackgroundColor = null;
protected static ColorUIResource inputBackgroundColor = null;
protected static ColorUIResource inputForegroundColor = null;
protected static ColorUIResource selectionForegroundColor = null;
protected static ColorUIResource selectionBackgroundColorLight = null;
protected static ColorUIResource selectionBackgroundColorDark = null;
protected static ColorUIResource selectionBackgroundColor = null;
protected static ColorUIResource rolloverForegroundColor = null;
protected static ColorUIResource rolloverColor = null;
protected static ColorUIResource rolloverColorLight = null;
protected static ColorUIResource rolloverColorDark = null;
protected static ColorUIResource pressedForegroundColor = null;
protected static ColorUIResource focusColor = null;
protected static ColorUIResource focusCellColor = null;
protected static ColorUIResource focusFrameColor = null;
protected static ColorUIResource focusBackgroundColor = null;
protected static ColorUIResource focusForegroundColor = null;
protected static ColorUIResource frameColor = null;
protected static ColorUIResource gridColor = null;
protected static ColorUIResource shadowColor = null;
protected static ColorUIResource buttonForegroundColor = null;
protected static ColorUIResource buttonBackgroundColor = null;
protected static ColorUIResource buttonColorLight = null;
protected static ColorUIResource buttonColorDark = null;
protected static ColorUIResource controlForegroundColor = null;
protected static ColorUIResource controlBackgroundColor = null;
protected static ColorUIResource controlHighlightColor = null;
protected static ColorUIResource controlShadowColor = null;
protected static ColorUIResource controlDarkShadowColor = null;
protected static ColorUIResource controlColorLight = null;
protected static ColorUIResource controlColorDark = null;
protected static ColorUIResource windowTitleForegroundColor = null;
protected static ColorUIResource windowTitleBackgroundColor = null;
protected static ColorUIResource windowTitleColorLight = null;
protected static ColorUIResource windowTitleColorDark = null;
protected static ColorUIResource windowBorderColor = null;
protected static ColorUIResource windowIconColor = null;
protected static ColorUIResource windowIconShadowColor = null;
protected static ColorUIResource windowIconRolloverColor = null;
protected static ColorUIResource windowInactiveTitleForegroundColor = null;
protected static ColorUIResource windowInactiveTitleBackgroundColor = null;
protected static ColorUIResource windowInactiveTitleColorLight = null;
protected static ColorUIResource windowInactiveTitleColorDark = null;
protected static ColorUIResource windowInactiveBorderColor = null;
protected static ColorUIResource menuForegroundColor = null;
protected static ColorUIResource menuBackgroundColor = null;
protected static ColorUIResource menuSelectionForegroundColor = null;
protected static ColorUIResource menuSelectionBackgroundColor = null;
protected static ColorUIResource menuSelectionBackgroundColorLight = null;
protected static ColorUIResource menuSelectionBackgroundColorDark = null;
protected static ColorUIResource menuColorLight = null;
protected static ColorUIResource menuColorDark = null;
protected static ColorUIResource toolbarForegroundColor = null;
protected static ColorUIResource toolbarBackgroundColor = null;
protected static ColorUIResource toolbarColorLight = null;
protected static ColorUIResource toolbarColorDark = null;
protected static ColorUIResource tabAreaBackgroundColor = null;
protected static ColorUIResource tabSelectionForegroundColor = null;
protected static ColorUIResource desktopColor = null;
protected static ColorUIResource tooltipForegroundColor = null;
protected static ColorUIResource tooltipBackgroundColor = null;
protected static int tooltipBorderSize = 6;
protected static int tooltipShadowSize = 6;
protected static boolean tooltipCastShadow = false;
protected static Color DEFAULT_COLORS[] = null;
protected static Color HIDEFAULT_COLORS[] = null;
protected static Color ACTIVE_COLORS[] = null;
protected static Color INACTIVE_COLORS[] = null;
protected static Color ROLLOVER_COLORS[] = null;
protected static Color SELECTED_COLORS[] = null;
protected static Color SELECTION_COLORS[] = null;
protected static Color FOCUS_COLORS[] = null;
protected static Color MENU_SELECTION_COLORS[] = null;
protected static Color PRESSED_COLORS[] = null;
protected static Color DISABLED_COLORS[] = null;
protected static Color WINDOW_TITLE_COLORS[] = null;
protected static Color WINDOW_INACTIVE_TITLE_COLORS[] = null;
protected static Color TOOLBAR_COLORS[] = null;
protected static Color MENUBAR_COLORS[] = null;
protected static Color BUTTON_COLORS[] = null;
protected static Color CHECKBOX_COLORS[] = null;
protected static Color TAB_COLORS[] = null;
protected static Color COL_HEADER_COLORS[] = null;
protected static Color TRACK_COLORS[] = null;
protected static Color THUMB_COLORS[] = null;
protected static Color SLIDER_COLORS[] = null;
protected static Color PROGRESSBAR_COLORS[] = null;
protected static String textureSet = "Default";
protected static boolean darkTexture = true;
protected static Icon windowTexture = null;
protected static Icon backgroundTexture = null;
protected static Icon alterBackgroundTexture = null;
protected static Icon selectedTexture = null;
protected static Icon rolloverTexture = null;
protected static Icon pressedTexture = null;
protected static Icon disabledTexture = null;
protected static Icon menubarTexture = null;
public AbstractTheme() {
super();
}
public String getName() {
return getInternalName();
}
public static String getInternalName() {
return internalName;
}
public static void setInternalName(String name) {
internalName = name;
}
public String getPropertyFileName() {
return "CQLDesktopTheme.properties";
}
public void setUpColor() {
windowDecoration = true;
macStyleWindowDecoration = StyleUtils.isMac();
centerWindowTitle = StyleUtils.isWindows() && StyleUtils.getOSVersion() >= 6.2;
linuxStyleScrollBar = !StyleUtils.isWindows();
macStyleScrollBar = StyleUtils.isMac();
dynamicLayout = true;
textShadow = false;
textAntiAliasing = false;
textAntiAliasingMode = TEXT_ANTIALIAS_HRGB;
backgroundPattern = true;
brightMode = false;
showFocusFrame = false;
drawSquareButtons = false;
toolbarDecorated = true;
menuOpaque = true;
menuAlpha = 0.9f;
logoString = "CQL-Desktop";
controlFont = null;
systemFont = null;
userFont = null;
smallFont = null;
menuFont = null;
windowTitleFont = null;
foregroundColor = black;
backgroundColor = extraLightGray;
backgroundColorLight = white;
backgroundColorDark = extraLightGray;
alterBackgroundColor = lightGray;
disabledForegroundColor = gray;
disabledBackgroundColor = superLightGray;
inputBackgroundColor = white;
inputForegroundColor = black;
selectionForegroundColor = black;
selectionBackgroundColor = lightGray;
selectionBackgroundColorLight = extraLightGray;
selectionBackgroundColorDark = lightGray;
focusColor = orange;
focusCellColor = orange;
focusFrameColor = new ColorUIResource(230, 191, 116);
focusBackgroundColor = new ColorUIResource(255, 250, 212);
focusForegroundColor = black;
frameColor = darkGray;
gridColor = gray;
shadowColor = new ColorUIResource(0, 24, 0);
rolloverForegroundColor = black;
rolloverColor = extraLightGray;
rolloverColorLight = white;
rolloverColorDark = extraLightGray;
pressedForegroundColor = black;
buttonForegroundColor = black;
buttonBackgroundColor = lightGray;
buttonColorLight = white;
buttonColorDark = lightGray;
controlForegroundColor = black;
controlBackgroundColor = lightGray;
controlHighlightColor = white;
controlShadowColor = lightGray;
controlDarkShadowColor = darkGray;
controlColorLight = white;
controlColorDark = lightGray;
windowTitleForegroundColor = black;
windowTitleBackgroundColor = blue;
windowTitleColorLight = extraLightGray;
windowTitleColorDark = lightGray;
windowBorderColor = lightGray;
windowIconColor = black;
windowIconShadowColor = white;
windowIconRolloverColor = red;
windowInactiveTitleForegroundColor = black;
windowInactiveTitleBackgroundColor = extraLightGray;
windowInactiveTitleColorLight = white;
windowInactiveTitleColorDark = extraLightGray;
windowInactiveBorderColor = extraLightGray;
menuForegroundColor = black;
menuBackgroundColor = extraLightGray;
menuSelectionForegroundColor = black;
menuSelectionBackgroundColor = lightGray;
menuSelectionBackgroundColorLight = extraLightGray;
menuSelectionBackgroundColorDark = lightGray;
menuColorLight = extraLightGray;
menuColorDark = lightGray;
toolbarForegroundColor = black;
toolbarBackgroundColor = lightGray;
toolbarColorLight = white;
toolbarColorDark = lightGray;
tabAreaBackgroundColor = backgroundColor;
tabSelectionForegroundColor = selectionForegroundColor;
desktopColor = darkBlue;
tooltipForegroundColor = black;
tooltipBackgroundColor = yellow;
tooltipBorderSize = 6;
tooltipShadowSize = 6;
tooltipCastShadow = false;
textureSet = "Default";
darkTexture = true;
}
public void setUpColorArrs() {
DEFAULT_COLORS = ColorHelper.createColorArr(controlColorLight, controlColorDark, 20);
HIDEFAULT_COLORS = ColorHelper.createColorArr(ColorHelper.brighter(controlColorLight, 40),
ColorHelper.brighter(controlColorDark, 40), 20);
ACTIVE_COLORS = DEFAULT_COLORS;
INACTIVE_COLORS = HIDEFAULT_COLORS;
ROLLOVER_COLORS = ColorHelper.createColorArr(rolloverColorLight, rolloverColorDark, 20);
SELECTED_COLORS = DEFAULT_COLORS;
SELECTION_COLORS = ColorHelper.createColorArr(selectionBackgroundColorLight, selectionBackgroundColorDark, 20);
FOCUS_COLORS = ColorHelper.createColorArr(ColorHelper.brighter(focusBackgroundColor, 20),
ColorHelper.darker(focusBackgroundColor, 10), 20);
MENU_SELECTION_COLORS = ColorHelper.createColorArr(menuSelectionBackgroundColorLight,
menuSelectionBackgroundColorDark, 20);
PRESSED_COLORS = DEFAULT_COLORS;
DISABLED_COLORS = HIDEFAULT_COLORS;
WINDOW_TITLE_COLORS = ColorHelper.createColorArr(windowTitleColorLight, windowTitleColorDark, 20);
WINDOW_INACTIVE_TITLE_COLORS = ColorHelper.createColorArr(windowInactiveTitleColorLight,
windowInactiveTitleColorDark, 20);
TOOLBAR_COLORS = ColorHelper.createColorArr(toolbarColorLight, toolbarColorDark, 20);
MENUBAR_COLORS = ColorHelper.createColorArr(menuColorLight, menuColorDark, 20);
BUTTON_COLORS = ColorHelper.createColorArr(buttonColorLight, buttonColorDark, 20);
CHECKBOX_COLORS = DEFAULT_COLORS;
TAB_COLORS = DEFAULT_COLORS;
COL_HEADER_COLORS = DEFAULT_COLORS;
TRACK_COLORS = ColorHelper.createColorArr(new Color(220, 220, 220), Color.white, 20);
THUMB_COLORS = DEFAULT_COLORS;
SLIDER_COLORS = DEFAULT_COLORS;
PROGRESSBAR_COLORS = DEFAULT_COLORS;
}
public void setProperties(Properties props) {
if (props != null) {
if (props.getProperty("windowDecoration") != null) {
windowDecoration = props.getProperty("windowDecoration").trim().equalsIgnoreCase("on");
}
if (props.getProperty("macStyleWindowDecoration") != null) {
macStyleWindowDecoration = props.getProperty("macStyleWindowDecoration").trim().equalsIgnoreCase("on");
}
if (props.getProperty("centerWindowTitle") != null) {
centerWindowTitle = props.getProperty("centerWindowTitle").trim().equalsIgnoreCase("on");
}
if (props.getProperty("linuxStyleScrollBar") != null) {
linuxStyleScrollBar = props.getProperty("linuxStyleScrollBar").trim().equalsIgnoreCase("on");
}
if (props.getProperty("macStyleScrollBar") != null) {
macStyleScrollBar = props.getProperty("macStyleScrollBar").trim().equalsIgnoreCase("on");
}
if (props.getProperty("dynamicLayout") != null) {
dynamicLayout = props.getProperty("dynamicLayout").trim().equalsIgnoreCase("on");
}
if (props.getProperty("textShadow") != null) {
textShadow = props.getProperty("textShadow").trim().equalsIgnoreCase("on");
}
if (props.getProperty("textAntiAliasing") != null) {
textAntiAliasing = props.getProperty("textAntiAliasing").trim().equalsIgnoreCase("on");
}
if (props.getProperty("textAntiAliasingMode") != null) {
String mode = props.getProperty("textAntiAliasingMode");
if (mode.equalsIgnoreCase("default")) {
textAntiAliasingMode = TEXT_ANTIALIAS_DEFAULT;
}
if (mode.equalsIgnoreCase("gray")) {
textAntiAliasingMode = TEXT_ANTIALIAS_GRAY;
}
if (mode.equalsIgnoreCase("hrgb")) {
textAntiAliasingMode = TEXT_ANTIALIAS_HRGB;
}
if (mode.equalsIgnoreCase("hbgr")) {
textAntiAliasingMode = TEXT_ANTIALIAS_HBGR;
}
if (mode.equalsIgnoreCase("vrgb")) {
textAntiAliasingMode = TEXT_ANTIALIAS_VRGB;
}
if (mode.equalsIgnoreCase("vbgr")) {
textAntiAliasingMode = TEXT_ANTIALIAS_VBGR;
}
}
if (props.getProperty("backgroundPattern") != null) {
backgroundPattern = props.getProperty("backgroundPattern").trim().equalsIgnoreCase("on");
}
if (props.getProperty("brightMode") != null) {
brightMode = props.getProperty("brightMode").trim().equalsIgnoreCase("on");
}
if (props.getProperty("showFocusFrame") != null) {
showFocusFrame = props.getProperty("showFocusFrame").trim().equalsIgnoreCase("on");
}
if (props.getProperty("drawSquareButtons") != null) {
drawSquareButtons = props.getProperty("drawSquareButtons").trim().equalsIgnoreCase("on");
}
if (props.getProperty("toolbarDecorated") != null) {
toolbarDecorated = props.getProperty("toolbarDecorated").trim().equalsIgnoreCase("on");
}
if (props.getProperty("menuOpaque") != null) {
menuOpaque = props.getProperty("menuOpaque").trim().equalsIgnoreCase("on");
}
if (props.getProperty("logoString") != null) {
logoString = props.getProperty("logoString").trim();
}
if (props.getProperty("controlTextFont") != null) {
controlFont = createFont(props.getProperty("controlTextFont"));
}
if (props.getProperty("systemTextFont") != null) {
systemFont = createFont(props.getProperty("systemTextFont"));
}
if (props.getProperty("userTextFont") != null) {
userFont = createFont(props.getProperty("userTextFont"));
}
if (props.getProperty("menuTextFont") != null) {
menuFont = createFont(props.getProperty("menuTextFont"));
}
if (props.getProperty("windowTitleFont") != null) {
windowTitleFont = createFont(props.getProperty("windowTitleFont"));
}
if (props.getProperty("subTextFont") != null) {
smallFont = createFont(props.getProperty("subTextFont"));
}
if (props.getProperty("foregroundColor") != null) {
foregroundColor = createColor(props.getProperty("foregroundColor"), foregroundColor);
}
if (props.getProperty("backgroundColor") != null) {
backgroundColor = createColor(props.getProperty("backgroundColor"), backgroundColor);
}
if (props.getProperty("backgroundColorLight") != null) {
backgroundColorLight = createColor(props.getProperty("backgroundColorLight"), backgroundColorLight);
}
if (props.getProperty("backgroundColorDark") != null) {
backgroundColorDark = createColor(props.getProperty("backgroundColorDark"), backgroundColorDark);
}
if (props.getProperty("alterBackgroundColor") != null) {
alterBackgroundColor = createColor(props.getProperty("alterBackgroundColor"), alterBackgroundColor);
}
if (props.getProperty("disabledForegroundColor") != null) {
disabledForegroundColor = createColor(props.getProperty("disabledForegroundColor"),
disabledForegroundColor);
}
if (props.getProperty("disabledBackgroundColor") != null) {
disabledBackgroundColor = createColor(props.getProperty("disabledBackgroundColor"),
disabledBackgroundColor);
}
if (props.getProperty("inputForegroundColor") != null) {
inputForegroundColor = createColor(props.getProperty("inputForegroundColor"), inputForegroundColor);
}
if (props.getProperty("inputBackgroundColor") != null) {
inputBackgroundColor = createColor(props.getProperty("inputBackgroundColor"), inputBackgroundColor);
}
if (props.getProperty("selectionForegroundColor") != null) {
selectionForegroundColor = createColor(props.getProperty("selectionForegroundColor"),
selectionForegroundColor);
}
if (props.getProperty("selectionBackgroundColor") != null) {
selectionBackgroundColor = createColor(props.getProperty("selectionBackgroundColor"),
selectionBackgroundColor);
}
if (props.getProperty("selectionBackgroundColorLight") != null) {
selectionBackgroundColorLight = createColor(props.getProperty("selectionBackgroundColorLight"),
selectionBackgroundColorLight);
}
if (props.getProperty("selectionBackgroundColorDark") != null) {
selectionBackgroundColorDark = createColor(props.getProperty("selectionBackgroundColorDark"),
selectionBackgroundColorDark);
}
if (props.getProperty("frameColor") != null) {
frameColor = createColor(props.getProperty("frameColor"), frameColor);
}
if (props.getProperty("gridColor") != null) {
gridColor = createColor(props.getProperty("gridColor"), gridColor);
}
if (props.getProperty("shadowColor") != null) {
shadowColor = createColor(props.getProperty("shadowColor"), shadowColor);
}
if (props.getProperty("focusColor") != null) {
focusColor = createColor(props.getProperty("focusColor"), focusColor);
}
if (props.getProperty("focusCellColor") != null) {
focusCellColor = createColor(props.getProperty("focusCellColor"), focusCellColor);
}
if (props.getProperty("focusFrameColor") != null) {
focusFrameColor = createColor(props.getProperty("focusFrameColor"), focusFrameColor);
}
if (props.getProperty("focusBackgroundColor") != null) {
focusBackgroundColor = createColor(props.getProperty("focusBackgroundColor"), focusBackgroundColor);
}
if (props.getProperty("focusForegroundColor") != null) {
focusForegroundColor = createColor(props.getProperty("focusForegroundColor"), focusForegroundColor);
}
if (props.getProperty("rolloverForegroundColor") != null) {
rolloverForegroundColor = createColor(props.getProperty("rolloverForegroundColor"),
rolloverForegroundColor);
}
if (props.getProperty("rolloverColor") != null) {
rolloverColor = createColor(props.getProperty("rolloverColor"), rolloverColor);
}
if (props.getProperty("rolloverColorLight") != null) {
rolloverColorLight = createColor(props.getProperty("rolloverColorLight"), rolloverColorLight);
}
if (props.getProperty("rolloverColorDark") != null) {
rolloverColorDark = createColor(props.getProperty("rolloverColorDark"), rolloverColorDark);
}
if (props.getProperty("pressedForegroundColor") != null) {
pressedForegroundColor = createColor(props.getProperty("pressedForegroundColor"),
pressedForegroundColor);
}
if (props.getProperty("buttonForegroundColor") != null) {
buttonForegroundColor = createColor(props.getProperty("buttonForegroundColor"), buttonForegroundColor);
}
if (props.getProperty("buttonBackgroundColor") != null) {
buttonBackgroundColor = createColor(props.getProperty("buttonBackgroundColor"), buttonBackgroundColor);
}
if (props.getProperty("buttonColorLight") != null) {
buttonColorLight = createColor(props.getProperty("buttonColorLight"), buttonColorLight);
}
if (props.getProperty("buttonColorDark") != null) {
buttonColorDark = createColor(props.getProperty("buttonColorDark"), buttonColorDark);
}
if (props.getProperty("controlForegroundColor") != null) {
controlForegroundColor = createColor(props.getProperty("controlForegroundColor"),
controlForegroundColor);
}
if (props.getProperty("controlBackgroundColor") != null) {
controlBackgroundColor = createColor(props.getProperty("controlBackgroundColor"),
controlBackgroundColor);
}
if (props.getProperty("controlColorLight") != null) {
controlColorLight = createColor(props.getProperty("controlColorLight"), controlColorLight);
}
if (props.getProperty("controlColorDark") != null) {
controlColorDark = createColor(props.getProperty("controlColorDark"), controlColorDark);
}
if (props.getProperty("controlHighlightColor") != null) {
controlHighlightColor = createColor(props.getProperty("controlHighlightColor"), controlHighlightColor);
}
if (props.getProperty("controlShadowColor") != null) {
controlShadowColor = createColor(props.getProperty("controlShadowColor"), controlShadowColor);
}
if (props.getProperty("controlDarkShadowColor") != null) {
controlDarkShadowColor = createColor(props.getProperty("controlDarkShadowColor"),
controlDarkShadowColor);
}
if (props.getProperty("windowTitleForegroundColor") != null) {
windowTitleForegroundColor = createColor(props.getProperty("windowTitleForegroundColor"),
windowTitleForegroundColor);
}
if (props.getProperty("windowTitleBackgroundColor") != null) {
windowTitleBackgroundColor = createColor(props.getProperty("windowTitleBackgroundColor"),
windowTitleBackgroundColor);
}
if (props.getProperty("windowTitleColorLight") != null) {
windowTitleColorLight = createColor(props.getProperty("windowTitleColorLight"), windowTitleColorLight);
}
if (props.getProperty("windowTitleColorDark") != null) {
windowTitleColorDark = createColor(props.getProperty("windowTitleColorDark"), windowTitleColorDark);
}
if (props.getProperty("windowBorderColor") != null) {
windowBorderColor = createColor(props.getProperty("windowBorderColor"), windowBorderColor);
}
if (props.getProperty("windowIconColor") != null) {
windowIconColor = createColor(props.getProperty("windowIconColor"), windowIconColor);
}
if (props.getProperty("windowIconShadowColor") != null) {
windowIconShadowColor = createColor(props.getProperty("windowIconShadowColor"), windowIconShadowColor);
}
if (props.getProperty("windowIconRolloverColor") != null) {
windowIconRolloverColor = createColor(props.getProperty("windowIconRolloverColor"),
windowIconRolloverColor);
}
if (props.getProperty("windowInactiveTitleForegroundColor") != null) {
windowInactiveTitleForegroundColor = createColor(
props.getProperty("windowInactiveTitleForegroundColor"), windowInactiveTitleForegroundColor);
}
if (props.getProperty("windowTitleBackgroundColor") != null) {
windowInactiveTitleBackgroundColor = createColor(
props.getProperty("windowInactiveTitleBackgroundColor"), windowInactiveTitleBackgroundColor);
}
if (props.getProperty("windowInactiveTitleColorLight") != null) {
windowInactiveTitleColorLight = createColor(props.getProperty("windowInactiveTitleColorLight"),
windowInactiveTitleColorLight);
}
if (props.getProperty("windowInactiveTitleColorDark") != null) {
windowInactiveTitleColorDark = createColor(props.getProperty("windowInactiveTitleColorDark"),
windowInactiveTitleColorDark);
}
if (props.getProperty("windowInactiveBorderColor") != null) {
windowInactiveBorderColor = createColor(props.getProperty("windowInactiveBorderColor"),
windowInactiveBorderColor);
}
if (props.getProperty("menuForegroundColor") != null) {
menuForegroundColor = createColor(props.getProperty("menuForegroundColor"), menuForegroundColor);
}
if (props.getProperty("menuBackgroundColor") != null) {
menuBackgroundColor = createColor(props.getProperty("menuBackgroundColor"), menuBackgroundColor);
}
if (props.getProperty("menuSelectionForegroundColor") != null) {
menuSelectionForegroundColor = createColor(props.getProperty("menuSelectionForegroundColor"),
menuSelectionForegroundColor);
}
if (props.getProperty("menuSelectionBackgroundColor") != null) {
menuSelectionBackgroundColor = createColor(props.getProperty("menuSelectionBackgroundColor"),
menuSelectionBackgroundColor);
}
if (props.getProperty("menuSelectionBackgroundColorLight") != null) {
menuSelectionBackgroundColorLight = createColor(props.getProperty("menuSelectionBackgroundColorLight"),
menuSelectionBackgroundColorLight);
}
if (props.getProperty("menuSelectionBackgroundColorDark") != null) {
menuSelectionBackgroundColorDark = createColor(props.getProperty("menuSelectionBackgroundColorDark"),
menuSelectionBackgroundColorDark);
}
if (props.getProperty("menuColorLight") != null) {
menuColorLight = createColor(props.getProperty("menuColorLight"), menuColorLight);
}
if (props.getProperty("menuColorDark") != null) {
menuColorDark = createColor(props.getProperty("menuColorDark"), menuColorDark);
}
if (props.getProperty("toolbarForegroundColor") != null) {
toolbarForegroundColor = createColor(props.getProperty("toolbarForegroundColor"),
toolbarForegroundColor);
}
if (props.getProperty("toolbarBackgroundColor") != null) {
toolbarBackgroundColor = createColor(props.getProperty("toolbarBackgroundColor"),
toolbarBackgroundColor);
}
if (props.getProperty("toolbarColorLight") != null) {
toolbarColorLight = createColor(props.getProperty("toolbarColorLight"), toolbarColorLight);
}
if (props.getProperty("toolbarColorDark") != null) {
toolbarColorDark = createColor(props.getProperty("toolbarColorDark"), toolbarColorDark);
}
if (props.getProperty("tabAreaBackgroundColor") != null) {
tabAreaBackgroundColor = createColor(props.getProperty("tabAreaBackgroundColor"),
tabAreaBackgroundColor);
} else {
tabAreaBackgroundColor = backgroundColor;
}
if (props.getProperty("tabSelectionForegroundColor") != null) {
tabSelectionForegroundColor = createColor(props.getProperty("tabSelectionForegroundColor"),
tabSelectionForegroundColor);
}
if (props.getProperty("desktopColor") != null) {
desktopColor = createColor(props.getProperty("desktopColor"), desktopColor);
}
if (props.getProperty("tooltipForegroundColor") != null) {
tooltipForegroundColor = createColor(props.getProperty("tooltipForegroundColor"),
tooltipForegroundColor);
}
if (props.getProperty("tooltipBackgroundColor") != null) {
tooltipBackgroundColor = createColor(props.getProperty("tooltipBackgroundColor"),
tooltipBackgroundColor);
}
if (props.getProperty("tooltipBorderSize") != null) {
tooltipBorderSize = createInt(props.getProperty("tooltipBorderSize"), tooltipBorderSize);
}
if (props.getProperty("tooltipShadowSize") != null) {
tooltipShadowSize = createInt(props.getProperty("tooltipShadowSize"), tooltipShadowSize);
}
if (props.getProperty("tooltipCastShadow") != null) {
tooltipCastShadow = props.getProperty("tooltipCastShadow").trim().equalsIgnoreCase("on");
}
if (props.getProperty("textureSet") != null) {
textureSet = props.getProperty("textureSet");
}
if (props.getProperty("darkTexture") != null) {
darkTexture = props.getProperty("darkTexture").trim().equalsIgnoreCase("on");
}
if (props.get("windowTexture") != null) {
Object texture = props.get("windowTexture");
if (texture instanceof Icon) {
windowTexture = (Icon) texture;
}
}
if (props.get("backgroundTexture") != null) {
Object texture = props.get("backgroundTexture");
if (texture instanceof Icon) {
backgroundTexture = (Icon) texture;
}
}
if (props.get("alterBackgroundTexture") != null) {
Object texture = props.get("alterBackgroundTexture");
if (texture instanceof Icon) {
alterBackgroundTexture = (Icon) texture;
}
}
if (props.get("selectedTexture") != null) {
Object texture = props.get("selectedTexture");
if (texture instanceof Icon) {
selectedTexture = (Icon) texture;
}
}
if (props.get("rolloverTexture") != null) {
Object texture = props.get("rolloverTexture");
if (texture instanceof Icon) {
rolloverTexture = (Icon) texture;
}
}
if (props.get("pressedTexture") != null) {
Object texture = props.get("pressedTexture");
if (texture instanceof Icon) {
pressedTexture = (Icon) texture;
}
}
if (props.get("disabledTexture") != null) {
Object texture = props.get("disabledTexture");
if (texture instanceof Icon) {
disabledTexture = (Icon) texture;
}
}
if (props.get("menubarTexture") != null) {
Object texture = props.get("menubarTexture");
if (texture instanceof Icon) {
menubarTexture = (Icon) texture;
}
}
}
}
public void loadProperties() {
FileInputStream in = null;
try {
String fileName = System.getProperty("user.home") + "/.cqldesktop/" + getPropertyFileName();
Properties props = new Properties();
in = new FileInputStream(fileName);
props.load(in);
setProperties(props);
} catch (Exception ex) {
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception ex) {
}
}
}
protected static FontUIResource createFont(String fontProp) {
if ((fontProp != null) && (fontProp.trim().length() > 5)) {
return new FontUIResource(Font.decode(fontProp));
}
return null;
}
protected static ColorUIResource createColor(String colorProp, ColorUIResource color) {
if ((colorProp != null) && (colorProp.trim().length() >= 5)) {
colorProp = colorProp.trim();
int r = color.getRed();
int g = color.getGreen();
int b = color.getBlue();
try {
int p1 = 0;
int p2 = colorProp.indexOf(' ');
if (p2 > 0) {
r = Integer.parseInt(colorProp.substring(p1, p2));
}
p1 = p2 + 1;
p2 = colorProp.indexOf(' ', p1);
if (p2 > 0) {
g = Integer.parseInt(colorProp.substring(p1, p2));
}
b = Integer.parseInt(colorProp.substring(p2 + 1));
return new ColorUIResource(r, g, b);
} catch (Exception ex) {
System.out.println("Exception while parsing color: " + colorProp);
}
}
return color;
}
protected static int createInt(String intProp, int defaultValue) {
int val = defaultValue;
try {
val = Integer.parseInt(intProp);
} catch (Exception ex) {
System.out.println("Exception while parsing color: " + intProp);
}
return val;
}
public boolean isTinyFontSize() {
return userFont.getSize() < 12;
}
public boolean isSmallFontSize() {
return userFont.getSize() < 14;
}
public boolean isMediumFontSize() {
return userFont.getSize() >= 14 && userFont.getSize() < 16;
}
public boolean isLargeFontSize() {
return userFont.getSize() >= 16;
}
public FontUIResource getControlTextFont() {
if (controlFont == null) {
if (StyleUtils.isLinux() && StyleUtils.isHiresScreen()) {
controlFont = new FontUIResource(DIALOG, Font.BOLD, 14);
} else {
controlFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
}
}
return controlFont;
}
public FontUIResource getSystemTextFont() {
if (systemFont == null) {
if (StyleUtils.isLinux() && StyleUtils.isHiresScreen()) {
systemFont = new FontUIResource(DIALOG, Font.BOLD, 14);
} else {
systemFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
}
}
return systemFont;
}
public FontUIResource getUserTextFont() {
if (userFont == null) {
if (StyleUtils.isLinux() && StyleUtils.isHiresScreen()) {
userFont = new FontUIResource(DIALOG, Font.BOLD, 14);
} else {
userFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
}
}
return userFont;
}
public FontUIResource getMenuTextFont() {
if (menuFont == null) {
if (StyleUtils.isLinux() && StyleUtils.isHiresScreen()) {
menuFont = new FontUIResource(DIALOG, Font.BOLD, 14);
} else {
menuFont = new FontUIResource(DIALOG, Font.PLAIN, 12);
}
}
return menuFont;
}
public FontUIResource getWindowTitleFont() {
if (windowTitleFont == null) {
if (StyleUtils.isLinux() && StyleUtils.isHiresScreen()) {
windowTitleFont = new FontUIResource(DIALOG, Font.BOLD, 14);
} else {
windowTitleFont = new FontUIResource(DIALOG, Font.BOLD, 12);
}
}
return windowTitleFont;
}
public FontUIResource getSubTextFont() {
if (smallFont == null) {
if (StyleUtils.isLinux() && StyleUtils.isHiresScreen()) {
smallFont = new FontUIResource(DIALOG, Font.BOLD, 12);
} else {
smallFont = new FontUIResource(DIALOG, Font.PLAIN, 10);
}
}
return smallFont;
}
// -----------------------------------------------------------------------------------
protected ColorUIResource getPrimary1() {
return foregroundColor;
}
protected ColorUIResource getPrimary2() {
return desktopColor;
}
protected ColorUIResource getPrimary3() {
return selectionBackgroundColor;
}
protected ColorUIResource getSecondary1() {
return frameColor;
}
protected ColorUIResource getSecondary2() {
return controlBackgroundColor;
}
protected ColorUIResource getSecondary3() {
return backgroundColor;
}
public ColorUIResource getControl() {
return controlBackgroundColor;
}
public ColorUIResource getControlShadow() {
return controlShadowColor;
}
public ColorUIResource getControlDarkShadow() {
return controlDarkShadowColor;
}
public ColorUIResource getControlInfo() {
return controlForegroundColor;
}
public ColorUIResource getControlHighlight() {
return controlHighlightColor;
}
public ColorUIResource getControlDisabled() {
return controlShadowColor;
}
public ColorUIResource getPrimaryControl() {
return extraLightGray;
}
public ColorUIResource getPrimaryControlShadow() {
return lightGray;
}
public ColorUIResource getPrimaryControlDarkShadow() {
return gray;
}
public ColorUIResource getPrimaryControlInfo() {
return darkGray;
}
public ColorUIResource getPrimaryControlHighlight() {
return white;
}
public ColorUIResource getControlTextColor() {
return controlForegroundColor;
}
public ColorUIResource getSystemTextColor() {
return foregroundColor;
}
public String getLogoString() {
if (logoString != null) {
if (logoString.trim().length() == 0) {
return null;
}
}
return logoString;
}
public boolean isWindowDecorationOn() {
return windowDecoration;
}
public boolean isCenterWindowTitleOn() {
return centerWindowTitle;
}
public boolean isMacStyleWindowDecorationOn() {
return macStyleWindowDecoration;
}
public boolean isLinuxStyleScrollBarOn() {
return linuxStyleScrollBar;
}
public boolean isMacStyleScrollBarOn() {
return macStyleScrollBar;
}
public boolean isDynamicLayout() {
return dynamicLayout;
}
public boolean isTextShadowOn() {
return textShadow;
}
public boolean isTextAntiAliasingOn() {
if (StyleUtils.getJavaVersion() < 1.4) {
return false;
}
return textAntiAliasing;
}
public int getTextAntiAliasingMode() {
return textAntiAliasingMode;
}
public Object getTextAntiAliasingHint() {
if (isTextAntiAliasingOn()) {
if (StyleUtils.getJavaVersion() >= 1.6) {
switch (textAntiAliasingMode) {
case TEXT_ANTIALIAS_DEFAULT:
return RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT;
case TEXT_ANTIALIAS_HRGB:
return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB;
case TEXT_ANTIALIAS_HBGR:
return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR;
case TEXT_ANTIALIAS_VRGB:
return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB;
case TEXT_ANTIALIAS_VBGR:
return RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VBGR;
default:
return RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
}
}
return RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
}
return RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
}
public boolean isBackgroundPatternOn() {
return backgroundPattern;
}
public boolean isBrightMode() {
return brightMode;
}
public boolean doShowFocusFrame() {
return showFocusFrame;
}
public boolean doDrawSquareButtons() {
return drawSquareButtons;
}
public boolean isToolbarDecorated() {
return toolbarDecorated;
}
public boolean isMenuOpaque() {
return menuOpaque;
}
public float getMenuAlpha() {
return menuAlpha;
}
public ColorUIResource getForegroundColor() {
return foregroundColor;
}
public ColorUIResource getDisabledForegroundColor() {
return disabledForegroundColor;
}
public ColorUIResource getBackgroundColor() {
return backgroundColor;
}
public ColorUIResource getDisabledBackgroundColor() {
return disabledBackgroundColor;
}
public ColorUIResource getBackgroundColorLight() {
return backgroundColorLight;
}
public ColorUIResource getBackgroundColorDark() {
return backgroundColorDark;
}
public ColorUIResource getAlterBackgroundColor() {
return alterBackgroundColor;
}
public ColorUIResource getInputForegroundColor() {
return inputForegroundColor;
}
public ColorUIResource getInputBackgroundColor() {
return inputBackgroundColor;
}
public ColorUIResource getSelectionForegroundColor() {
return selectionForegroundColor;
}
public ColorUIResource getSelectionBackgroundColorLight() {
return selectionBackgroundColorLight;
}
public ColorUIResource getSelectionBackgroundColorDark() {
return selectionBackgroundColorDark;
}
public ColorUIResource getSelectionBackgroundColor() {
return selectionBackgroundColor;
}
public ColorUIResource getFrameColor() {
return frameColor;
}
public ColorUIResource getGridColor() {
return gridColor;
}
public ColorUIResource getShadowColor() {
return shadowColor;
}
public ColorUIResource getFocusColor() {
return focusColor;
}
public ColorUIResource getFocusCellColor() {
return focusCellColor;
}
public ColorUIResource getFocusFrameColor() {
return focusFrameColor;
}
public ColorUIResource getFocusBackgroundColor() {
return focusBackgroundColor;
}
public ColorUIResource getFocusForegroundColor() {
return focusForegroundColor;
}
public ColorUIResource getRolloverForegroundColor() {
return rolloverForegroundColor;
}
public ColorUIResource getRolloverColor() {
return rolloverColor;
}
public ColorUIResource getRolloverColorLight() {
return rolloverColorLight;
}
public ColorUIResource getRolloverColorDark() {
return rolloverColorDark;
}
public ColorUIResource getPressedForegroundColor() {
return pressedForegroundColor;
}
public ColorUIResource getButtonForegroundColor() {
return buttonForegroundColor;
}
public ColorUIResource getButtonBackgroundColor() {
return buttonBackgroundColor;
}
public ColorUIResource getButtonColorLight() {
return buttonColorLight;
}
public ColorUIResource getButtonColorDark() {
return buttonColorDark;
}
public ColorUIResource getControlForegroundColor() {
return controlForegroundColor;
}
public ColorUIResource getControlBackgroundColor() {
return controlBackgroundColor;
}
public ColorUIResource getControlHighlightColor() {
return controlHighlightColor;
}
public ColorUIResource getControlShadowColor() {
return controlShadowColor;
}
public ColorUIResource getControlDarkShadowColor() {
return controlDarkShadowColor;
}
public ColorUIResource getControlColorLight() {
return controlColorLight;
}
public ColorUIResource getControlColorDark() {
return controlColorDark;
}
public ColorUIResource getWindowTitleForegroundColor() {
return windowTitleForegroundColor;
}
public ColorUIResource getWindowTitleBackgroundColor() {
return windowTitleBackgroundColor;
}
public ColorUIResource getWindowTitleColorLight() {
return windowTitleColorLight;
}
public ColorUIResource getWindowTitleColorDark() {
return windowTitleColorDark;
}
public ColorUIResource getWindowBorderColor() {
return windowBorderColor;
}
public ColorUIResource getWindowIconColor() {
return windowIconColor;
}
public ColorUIResource getWindowIconShadowColor() {
return windowIconShadowColor;
}
public ColorUIResource getWindowIconRolloverColor() {
return windowIconRolloverColor;
}
public ColorUIResource getWindowInactiveTitleForegroundColor() {
return windowInactiveTitleForegroundColor;
}
public ColorUIResource getWindowInactiveTitleBackgroundColor() {
return windowInactiveTitleBackgroundColor;
}
public ColorUIResource getWindowInactiveTitleColorLight() {
return windowInactiveTitleColorLight;
}
public ColorUIResource getWindowInactiveTitleColorDark() {
return windowInactiveTitleColorDark;
}
public ColorUIResource getWindowInactiveBorderColor() {
return windowInactiveBorderColor;
}
public ColorUIResource getMenuForegroundColor() {
return menuForegroundColor;
}
public ColorUIResource getMenuBackgroundColor() {
return menuBackgroundColor;
}
public ColorUIResource getMenuSelectionForegroundColor() {
return menuSelectionForegroundColor;
}
public ColorUIResource getMenuSelectionBackgroundColor() {
return menuSelectionBackgroundColor;
}
public ColorUIResource getMenuSelectionBackgroundColorLight() {
return menuSelectionBackgroundColorLight;
}
public ColorUIResource getMenuSelectionBackgroundColorDark() {
return menuSelectionBackgroundColorDark;
}
public ColorUIResource getMenuColorLight() {
return menuColorLight;
}
public ColorUIResource getMenuColorDark() {
return menuColorDark;
}
public ColorUIResource getToolbarForegroundColor() {
return toolbarForegroundColor;
}
public ColorUIResource getToolbarBackgroundColor() {
return toolbarBackgroundColor;
}
public ColorUIResource getToolbarColorLight() {
return toolbarColorLight;
}
public ColorUIResource getToolbarColorDark() {
return toolbarColorDark;
}
public ColorUIResource getTabAreaBackgroundColor() {
return tabAreaBackgroundColor;
}
public ColorUIResource getTabSelectionForegroundColor() {
return tabSelectionForegroundColor;
}
public ColorUIResource getDesktopColor() {
return desktopColor;
}
public ColorUIResource getTooltipForegroundColor() {
return tooltipForegroundColor;
}
public ColorUIResource getTooltipBackgroundColor() {
return tooltipBackgroundColor;
}
public int getTooltipBorderSize() {
return Math.max(0, Math.min(8, tooltipBorderSize));
}
public int getTooltipShadowSize() {
return Math.max(0, Math.min(8, tooltipShadowSize));
}
public boolean isTooltipCastShadow() {
return tooltipCastShadow;
}
public Color[] getDefaultColors() {
return DEFAULT_COLORS;
}
public Color[] getHiDefaultColors() {
return HIDEFAULT_COLORS;
}
public Color[] getActiveColors() {
return ACTIVE_COLORS;
}
public Color[] getInActiveColors() {
return INACTIVE_COLORS;
}
public Color[] getRolloverColors() {
return ROLLOVER_COLORS;
}
public Color[] getSelectedColors() {
return SELECTED_COLORS;
}
public Color[] getSelectionColors() {
return SELECTION_COLORS;
}
public Color[] getFocusColors() {
return FOCUS_COLORS;
}
public Color[] getMenuSelectionColors() {
return MENU_SELECTION_COLORS;
}
public Color[] getPressedColors() {
return PRESSED_COLORS;
}
public Color[] getDisabledColors() {
return DISABLED_COLORS;
}
public Color[] getWindowTitleColors() {
return WINDOW_TITLE_COLORS;
}
public Color[] getWindowInactiveTitleColors() {
return WINDOW_INACTIVE_TITLE_COLORS;
}
public Color[] getToolBarColors() {
return TOOLBAR_COLORS;
}
public Color[] getMenuBarColors() {
return MENUBAR_COLORS;
}
public Color[] getButtonColors() {
return BUTTON_COLORS;
}
public Color[] getCheckBoxColors() {
return CHECKBOX_COLORS;
}
public Color[] getTabColors() {
return TAB_COLORS;
}
public Color[] getColHeaderColors() {
return COL_HEADER_COLORS;
}
public Color[] getTrackColors() {
return TRACK_COLORS;
}
public Color[] getThumbColors() {
return THUMB_COLORS;
}
public Color[] getSliderColors() {
return SLIDER_COLORS;
}
public Color[] getProgressBarColors() {
return PROGRESSBAR_COLORS;
}
public String getTextureSet() {
return textureSet;
}
public boolean isDarkTexture() {
return darkTexture;
}
public Icon getWindowTexture() {
return windowTexture;
}
public Icon getBackgroundTexture() {
return backgroundTexture;
}
public Icon getAlterBackgroundTexture() {
return alterBackgroundTexture;
}
public Icon getSelectedTexture() {
return selectedTexture;
}
public Icon getRolloverTexture() {
return rolloverTexture;
}
public Icon getPressedTexture() {
return pressedTexture;
}
public Icon getDisabledTexture() {
return disabledTexture;
}
public Icon getMenubarTexture() {
return menubarTexture;
}
}
|
3e1065a50f3f52e5c85fa90d008f158819f644be | 9,321 | java | Java | app/src/main/java/camera/chayon/com/androidcustomcamera/camera/EditSavePhotoFragment.java | Tornedo/Androi-rectangle-Camera | 5f31700f8d7cc5a37b6e3c3a61972c6ef97d8182 | [
"Apache-2.0"
] | 1 | 2019-01-07T11:59:27.000Z | 2019-01-07T11:59:27.000Z | app/src/main/java/camera/chayon/com/androidcustomcamera/camera/EditSavePhotoFragment.java | Tornedo/Androi-rectangle-Camera | 5f31700f8d7cc5a37b6e3c3a61972c6ef97d8182 | [
"Apache-2.0"
] | 1 | 2019-01-07T11:11:49.000Z | 2019-01-07T11:11:49.000Z | app/src/main/java/camera/chayon/com/androidcustomcamera/camera/EditSavePhotoFragment.java | Tornedo/Androi-rectangle-Camera | 5f31700f8d7cc5a37b6e3c3a61972c6ef97d8182 | [
"Apache-2.0"
] | null | null | null | 38.358025 | 131 | 0.621285 | 6,944 | package camera.chayon.com.androidcustomcamera.camera;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Random;
import camera.chayon.com.androidcustomcamera.R;
/**
*
*/
public class EditSavePhotoFragment extends Fragment {
public static final String TAG = EditSavePhotoFragment.class.getSimpleName();
public static final String BITMAP_KEY = "bitmap_byte_array";
public static final String ROTATION_KEY = "rotation";
public static final String IMAGE_INFO = "image_info";
public static final String ORIENTATION_DEGREE = "orientation_degree";
public Bitmap finalBitmap;
public String imgPath;
private static final int REQUEST_STORAGE = 1;
public static Fragment newInstance(byte[] bitmapByteArray, int rotation,
@NonNull ImageParameters parameters, int orientationDegree) {
Fragment fragment = new EditSavePhotoFragment();
Bundle args = new Bundle();
args.putByteArray(BITMAP_KEY, bitmapByteArray);
args.putInt(ROTATION_KEY, rotation);
args.putParcelable(IMAGE_INFO, parameters);
args.putInt(ORIENTATION_DEGREE, orientationDegree);
fragment.setArguments(args);
return fragment;
}
public EditSavePhotoFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.squarecamera__fragment_edit_save_photo, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int rotation = getArguments().getInt(ROTATION_KEY);
byte[] data = getArguments().getByteArray(BITMAP_KEY);
ImageParameters imageParameters = getArguments().getParcelable(IMAGE_INFO);
int mCurrentNormalizedOrientation = getArguments().getInt(ORIENTATION_DEGREE);
if (imageParameters == null) {
return;
}
final ImageView photoImageView = (ImageView) view.findViewById(R.id.photo);
Rect drar = new Rect();
drar.set((int) TouchView.getmLeftTopPosX(), (int) TouchView.getmLeftTopPosY(),
(int) TouchView.getmRightBottomPosX(), (int) TouchView.getmRightBottomPosY());
Bitmap bmp;
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
Bitmap mutableBitmap = bmp.copy(Bitmap.Config.ARGB_8888, true);
// mutableBitmap = Bitmap.createBitmap(mutableBitmap, (int) TouchView.getmLeftTopPosX(), (int) TouchView.getmLeftTopPosY(),
// 300, 600);
// Bitmap croppedBmp = Bitmap.createBitmap(bmp, (int) TouchView.getmLeftTopPosX(), (int) TouchView.getmLeftTopPosY(),
// (int)TouchView.getmRightBottomPosX(), (int)TouchView.getmRightBottomPosY());
Log.e("left", String.valueOf((int) TouchView.getmLeftTopPosX()));
Log.e("left", String.valueOf((int) TouchView.getmLeftTopPosY()));
Log.e("wid", String.valueOf(drar.width()));
Log.e("hei", String.valueOf(drar.height()));
//photoImageView.setImageBitmap(croppedBmp);
imageParameters.mIsPortrait =
getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;// always true
final View topView = view.findViewById(R.id.topView);
if (imageParameters.mIsPortrait) {
topView.getLayoutParams().height = imageParameters.mCoverHeight;
} else {
topView.getLayoutParams().width = imageParameters.mCoverWidth;
}
finalBitmap = ImageUtility.decodeSampledBitmapFromByte(getActivity(), data);
rotatePicture(rotation, data, photoImageView, mCurrentNormalizedOrientation);
savePicture();
/* view.findViewById(R.id.save_photo).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
savePicture();
}
});*/
}
private void rotatePicture(int rotation, byte[] data, ImageView photoImageView, int degreeForRotate) {
Bitmap bitmap = ImageUtility.decodeSampledBitmapFromByte(getActivity(), data);
// Log.d(TAG, "original bitmap width " + bitmap.getWidth() + " height " + bitmap.getHeight());
Log.e("dads2", String.valueOf(bitmap.getWidth()));
Log.e("dads2", String.valueOf(bitmap.getHeight()));
Rect drar = new Rect();
drar.set((int) TouchView.getmLeftTopPosX(), (int) TouchView.getmLeftTopPosY(),
(int) TouchView.getmRightBottomPosX(), (int) TouchView.getmRightBottomPosY());
Bitmap oldBitmap = bitmap;
// if(degreeForRotate == 90){
// oldBitmap = rotateImage(bitmap, 90);
// }
// else if(degreeForRotate == 270){
// oldBitmap = rotateImage(bitmap, 270);
// }
// else if(degreeForRotate == 0){
// oldBitmap = rotateImage(bitmap, -90);
// }
// else
// {
// oldBitmap = bitmap;
// }
Matrix matrix = new Matrix();
matrix.postRotate(0);
bitmap = Bitmap.createBitmap(
oldBitmap, (int) TouchView.getmLeftTopPosY(), (int) TouchView.getmLeftTopPosX(),
oldBitmap.getWidth() - (int) TouchView.getmLeftTopPosY(),
oldBitmap.getHeight() - (int) TouchView.getmLeftTopPosX(), matrix, false
);
oldBitmap.recycle();
// }
Log.e("dads11", String.valueOf(bitmap.getWidth()));
Log.e("dads11", String.valueOf(bitmap.getHeight()));
bitmap= rotateImage(bitmap, 90);
finalBitmap = rotateImage(bitmap, 180);
photoImageView.setImageBitmap(bitmap);
}
public Bitmap rotateImage(Bitmap source, float angle) {
Matrix matrix = new Matrix();
matrix.postRotate(angle);
return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(),
matrix, true);
}
private void savePicture() {
Log.e("save", "picture");
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/saved_images");
myDir.mkdirs();
Random generator = new Random();
int n = 10000;
n = generator.nextInt(n);
String fname = "Image-" + String.valueOf(n) + ".jpg";
File file = new File(myDir, fname);
if (file.exists()) file.delete();
try {
FileOutputStream out = new FileOutputStream(file);
finalBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
out.close();
((CameraActivity) getActivity()).returnPhotoUri(Uri.fromFile(file));
} catch (Exception e) {
e.printStackTrace();
}
}
private void requestForPermission() {
RuntimePermissionActivity.startActivity(EditSavePhotoFragment.this,
REQUEST_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (Activity.RESULT_OK != resultCode) return;
if (REQUEST_STORAGE == requestCode && data != null) {
final boolean isGranted = data.getBooleanExtra(RuntimePermissionActivity.REQUESTED_PERMISSION, false);
final View view = getView();
if (isGranted && view != null) {
ImageView photoImageView = (ImageView) view.findViewById(R.id.photo);
Bitmap bitmap = ((BitmapDrawable) photoImageView.getDrawable()).getBitmap();
// Uri photoUri = ImageUtility.savePicture(getActivity(), bitmap);
// ((CameraActivity) getActivity()).returnPhotoUri(photoUri);
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
// @Override
// public void onClick(View v) {
// switch (v.getId()) {
//
// case R.id.closeBtn:
// Log.e("close","img");
// break;
// case R.id.retakeImage:
// Log.e("close", "retake");
// break;
// case R.id.confirmImage:
// Log.e("close", "confirm");
// break;
// }
// }
}
|
3e1066f55060f790e7e57a886c9a7595c0298aa9 | 1,331 | java | Java | src/edu/virginia/vcgr/genii/container/db/ServerDatabaseConnectionPool.java | genesis-2/trunk | 9a6b34e8531ef0a1614ee48802b037df6e4fa2d7 | [
"Apache-2.0"
] | 1 | 2022-03-16T16:36:00.000Z | 2022-03-16T16:36:00.000Z | src/edu/virginia/vcgr/genii/container/db/ServerDatabaseConnectionPool.java | genesis-2/trunk | 9a6b34e8531ef0a1614ee48802b037df6e4fa2d7 | [
"Apache-2.0"
] | 1 | 2021-06-04T02:05:42.000Z | 2021-06-04T02:05:42.000Z | src/edu/virginia/vcgr/genii/container/db/ServerDatabaseConnectionPool.java | genesis-2/trunk | 9a6b34e8531ef0a1614ee48802b037df6e4fa2d7 | [
"Apache-2.0"
] | null | null | null | 32.463415 | 101 | 0.782119 | 6,945 | package edu.virginia.vcgr.genii.container.db;
import java.sql.Connection;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.virginia.vcgr.genii.client.db.DatabaseConnectionPool;
import edu.virginia.vcgr.genii.container.cleanup.CleanupManager;
public class ServerDatabaseConnectionPool extends DatabaseConnectionPool
{
static private Log _logger = LogFactory.getLog(ServerDatabaseConnectionPool.class);
static private final String _SERVER_SPECIAL_STRING = "${server-dir}";
static private int _poolInstances = 0;
public ServerDatabaseConnectionPool(Properties connectionProperties)
throws IllegalAccessException, ClassNotFoundException, InstantiationException
{
super(new DBPropertyNames(), connectionProperties, _SERVER_SPECIAL_STRING);
synchronized (ServerDatabaseConnectionPool.class) {
_poolInstances++;
if (_poolInstances != 1) {
_logger.error("We don't have exactly one connection pool instance -- we have " + _poolInstances);
System.exit(1);
}
}
Connection connection = null;
try {
connection = acquire(false);
CleanupManager.doCleanups(connection);
} catch (Throwable cause) {
_logger.error("Unable to create connection for cleanup handlers.", cause);
} finally {
release(connection);
}
}
}
|
3e10673f3797f755cde34c147f8a9be66d026bb7 | 1,684 | java | Java | app/src/main/gen/com/realvnc/sdktest/BuildConfig.java | SkyCloudSystems/skycloud-client-android | 3571dc4841f1a8b69bad25a425548693381d2c74 | [
"BSD-3-Clause"
] | null | null | null | app/src/main/gen/com/realvnc/sdktest/BuildConfig.java | SkyCloudSystems/skycloud-client-android | 3571dc4841f1a8b69bad25a425548693381d2c74 | [
"BSD-3-Clause"
] | null | null | null | app/src/main/gen/com/realvnc/sdktest/BuildConfig.java | SkyCloudSystems/skycloud-client-android | 3571dc4841f1a8b69bad25a425548693381d2c74 | [
"BSD-3-Clause"
] | null | null | null | 48.114286 | 78 | 0.809382 | 6,946 | /*
Copyright (C) 2016-2017 RealVNC Limited. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** Automatically generated file. DO NOT MODIFY */
package com.realvnc.vncsdk.sample.basicViewerAndroid;
public final class BuildConfig {
public final static boolean DEBUG = true;
} |
3e10689b5329fde717689e56188988967d22cd4c | 4,635 | java | Java | kie-wb-common-stunner/kie-wb-common-stunner-extensions/kie-wb-common-stunner-lienzo-extensions/src/main/java/org/kie/workbench/common/stunner/lienzo/toolbox/builder/AbstractBuilder.java | kiereleaseuser/kie-wb-common | af1e5946052b17628cbe687e850e59ec5ca8a4ac | [
"Apache-2.0"
] | null | null | null | kie-wb-common-stunner/kie-wb-common-stunner-extensions/kie-wb-common-stunner-lienzo-extensions/src/main/java/org/kie/workbench/common/stunner/lienzo/toolbox/builder/AbstractBuilder.java | kiereleaseuser/kie-wb-common | af1e5946052b17628cbe687e850e59ec5ca8a4ac | [
"Apache-2.0"
] | null | null | null | kie-wb-common-stunner/kie-wb-common-stunner-extensions/kie-wb-common-stunner-lienzo-extensions/src/main/java/org/kie/workbench/common/stunner/lienzo/toolbox/builder/AbstractBuilder.java | kiereleaseuser/kie-wb-common | af1e5946052b17628cbe687e850e59ec5ca8a4ac | [
"Apache-2.0"
] | null | null | null | 31.107383 | 93 | 0.66343 | 6,947 | /*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.kie.workbench.common.stunner.lienzo.toolbox.builder;
import com.ait.lienzo.client.core.shape.IPrimitive;
import com.ait.lienzo.client.core.shape.Layer;
import com.ait.lienzo.client.core.shape.Shape;
import com.ait.lienzo.client.core.shape.wires.WiresShape;
import com.ait.lienzo.shared.core.types.Direction;
import org.kie.workbench.common.stunner.lienzo.toolbox.ToolboxButton;
import org.kie.workbench.common.stunner.lienzo.toolbox.event.ToolboxButtonEventHandler;
import org.kie.workbench.common.stunner.lienzo.toolbox.grid.GridToolbox;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractBuilder implements On, Towards, ButtonsOrRegister, ButtonGrid {
protected final Layer layer;
protected final WiresShape shape;
protected Shape<?> attachTo;
protected Direction anchor;
protected Direction towards;
protected List<ToolboxButton> buttons = new ArrayList<>();
protected int cols;
protected int rows;
protected int padding;
protected int iconSize;
public AbstractBuilder( Layer layer, WiresShape shape ) {
this.layer = layer;
this.shape = shape;
}
@Override
public Towards on( Direction anchor ) {
this.anchor = anchor;
return this;
}
@Override
public On attachTo( Shape<?> shape ) {
this.attachTo = shape;
return this;
}
@Override
public ButtonGrid towards( Direction towards ) {
this.towards = towards;
return this;
}
@Override
public ButtonsOrRegister add( ToolboxButton button ) {
this.buttons.add( button );
return this;
}
@Override
public ButtonsOrRegister grid( int padding, int iconSize, int rows, int cols ) {
this.rows = rows;
this.cols = cols;
this.padding = padding;
this.iconSize = iconSize;
return this;
}
@Override
public Button add( IPrimitive<?> iconShape ) {
return new ButtonBuilder( this, iconShape );
}
@Override
public abstract GridToolbox register();
public static class ButtonBuilder implements Button {
private final AbstractBuilder builder;
private final IPrimitive<?> shape;
private int padding;
private int iconSize;
private ToolboxButtonEventHandler clickHandler;
private ToolboxButtonEventHandler moveDownHandler;
private ToolboxButtonEventHandler mouseEnterHandler;
private ToolboxButtonEventHandler mouseExitHandler;
public ButtonBuilder( final AbstractBuilder builder,
final IPrimitive<?> shape ) {
this.builder = builder;
this.shape = shape;
}
public ButtonBuilder setPadding( final int padding ) {
this.padding = padding;
return this;
}
public ButtonBuilder setIconSize( final int size ) {
this.iconSize = size;
return this;
}
@Override
public Button setClickHandler( final ToolboxButtonEventHandler handler ) {
this.clickHandler = handler;
return this;
}
@Override
public Button setMouseDownHandler( final ToolboxButtonEventHandler handler ) {
this.moveDownHandler = handler;
return this;
}
@Override
public Button setMouseEnterHandler( final ToolboxButtonEventHandler handler ) {
this.mouseEnterHandler = handler;
return this;
}
@Override
public Button setMouseExitHandler( final ToolboxButtonEventHandler handler ) {
this.mouseExitHandler = handler;
return this;
}
@Override
public ButtonsOrRegister end() {
builder.add( new ToolboxButton( builder.layer, shape, padding, iconSize,
clickHandler, moveDownHandler, mouseEnterHandler, mouseExitHandler ) );
return builder;
}
}
}
|
3e10698f273ddc0ad03409326ab2c0429626559c | 3,141 | java | Java | src/main/java/org/iton/jssi/wallet/model/Tag.java | ITON-Solutions/indy-wallet | 5e2d2368d7caba99711518eddcb7e48517961a4d | [
"MIT"
] | null | null | null | src/main/java/org/iton/jssi/wallet/model/Tag.java | ITON-Solutions/indy-wallet | 5e2d2368d7caba99711518eddcb7e48517961a4d | [
"MIT"
] | null | null | null | src/main/java/org/iton/jssi/wallet/model/Tag.java | ITON-Solutions/indy-wallet | 5e2d2368d7caba99711518eddcb7e48517961a4d | [
"MIT"
] | 1 | 2022-02-25T18:36:00.000Z | 2022-02-25T18:36:00.000Z | 30.201923 | 99 | 0.641515 | 6,948 | /*
* The MIT License
*
* Copyright 2019 ITON Solutions.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.iton.jssi.wallet.model;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.misc.BaseDaoEnabled;
import com.j256.ormlite.table.DatabaseTable;
import java.util.Arrays;
public class Tag extends BaseDaoEnabled {
@DatabaseField(columnName = "name", uniqueCombo=true, dataType = DataType.BYTE_ARRAY)
byte[] name;
@DatabaseField(columnName = "value", uniqueCombo=true, dataType = DataType.BYTE_ARRAY)
byte[] value;
@DatabaseField(columnName = "item_id",
foreign = true,
foreignAutoRefresh = true,
foreignAutoCreate = true,
canBeNull = false,
index = true,
columnDefinition = "INTEGER CONSTRAINT item_id REFERENCES items(id) ON DELETE CASCADE")
Item item;
public Tag() {
}
public Tag(Item item, byte[] name, byte[] value) {
this.item = item;
this.name = name;
this.value = value;
}
public byte[] getName() {
return name;
}
public void setName(byte[] name) {
this.name = name;
}
public byte[] getValue() {
return value;
}
public void setValue(byte[] value) {
this.value = value;
}
public Item getItem() {
return item;
}
public void setItem(Item item) {
this.item = item;
}
@Override
public int hashCode() {
int hash = 0;
hash += (item != null ? item.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof Tag)) {
return false;
}
Tag other = (Tag) object;
if ((this.item == null && other.item != null)
|| (this.item != null && !this.item.equals(other.item))
|| !Arrays.equals(this.name, other.name)
|| !Arrays.equals(this.value, other.value)) {
return false;
}
return true;
}
}
|
3e106a200e6554170bba4f962baeb7f97877d8b8 | 94 | java | Java | Variant Programs/1-3/18/grower/FilmmakerSay.java | hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism | a42ced1d5a92963207e3565860cac0946312e1b3 | [
"MIT"
] | null | null | null | Variant Programs/1-3/18/grower/FilmmakerSay.java | hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism | a42ced1d5a92963207e3565860cac0946312e1b3 | [
"MIT"
] | null | null | null | Variant Programs/1-3/18/grower/FilmmakerSay.java | hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism | a42ced1d5a92963207e3565860cac0946312e1b3 | [
"MIT"
] | null | null | null | 10.444444 | 26 | 0.712766 | 6,949 | package grower;
public enum FilmmakerSay {
emaciated,
blockading,
dealing,
sleepy;
}
|
3e106af2c85ebf4f316b95771c731a0ddd944205 | 4,029 | java | Java | src/org/pepstock/charba/client/impl/plugins/ChartBackgroundColorOptionsBuilder.java | pepstock-org/Charba | cf6964a04bf88c77019634c4d701397560392e58 | [
"Apache-2.0"
] | 48 | 2018-02-01T09:11:02.000Z | 2022-03-17T12:47:01.000Z | src/org/pepstock/charba/client/impl/plugins/ChartBackgroundColorOptionsBuilder.java | pepstock-org/Charba | cf6964a04bf88c77019634c4d701397560392e58 | [
"Apache-2.0"
] | 61 | 2018-05-03T13:38:47.000Z | 2022-03-10T13:00:25.000Z | src/org/pepstock/charba/client/impl/plugins/ChartBackgroundColorOptionsBuilder.java | pepstock-org/Charba | cf6964a04bf88c77019634c4d701397560392e58 | [
"Apache-2.0"
] | 7 | 2018-02-03T10:18:00.000Z | 2021-06-18T18:16:05.000Z | 30.293233 | 124 | 0.736907 | 6,950 | /**
Copyright 2017 Andrea "Stock" Stocchero
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.pepstock.charba.client.impl.plugins;
import org.pepstock.charba.client.IsChart;
import org.pepstock.charba.client.colors.Gradient;
import org.pepstock.charba.client.colors.IsColor;
import org.pepstock.charba.client.colors.Pattern;
import org.pepstock.charba.client.commons.AbstractBaseBuilder;
import org.pepstock.charba.client.commons.IsBuilder;
import org.pepstock.charba.client.dom.enums.GlobalCompositeOperation;
/**
* Comfortable object to create {@link ChartBackgroundColor#ID} plugin options by a builder.
*
* @author Andrea "Stock" Stocchero
*
*/
public final class ChartBackgroundColorOptionsBuilder extends AbstractBaseBuilder {
// plugin options instance
private ChartBackgroundColorOptions options;
/**
* To avoid any instantiation
*
* @param chart chart instance related to the plugin options
*/
private ChartBackgroundColorOptionsBuilder(IsChart chart) {
this.options = new ChartBackgroundColorOptions(chart);
}
/**
* Returns new builder instance.
*
* @return new builder instance
*/
public static ChartBackgroundColorOptionsBuilder create() {
return create(null);
}
/**
* Returns new builder instance using the chart global options.
*
* @param chart chart instance related to the plugin options
* @return new builder instance
*/
public static ChartBackgroundColorOptionsBuilder create(IsChart chart) {
return new ChartBackgroundColorOptionsBuilder(chart);
}
/**
* Returns a configured plugin options.
*
* @return a configured plugin options.
*/
public ChartBackgroundColorOptions build() {
// sets built status
setBuilt(true);
// returns options
return options;
}
/**
* Sets the background color.
*
* @param color the background color.
* @return new builder instance
*/
public ChartBackgroundColorOptionsBuilder setBackgroundColor(String color) {
options.setBackgroundColor(color);
return IsBuilder.checkAndGetIfValid(this);
}
/**
* Sets the background color.
*
* @param color the background color.
* @return new builder instance
*/
public ChartBackgroundColorOptionsBuilder setBackgroundColor(IsColor color) {
options.setBackgroundColor(color);
return IsBuilder.checkAndGetIfValid(this);
}
/**
* Sets the background gradient.
*
* @param gradient the background gradient.
* @return new builder instance
*/
public ChartBackgroundColorOptionsBuilder setBackgroundColor(Gradient gradient) {
options.setBackgroundColor(gradient);
return IsBuilder.checkAndGetIfValid(this);
}
/**
* Sets the background pattern.
*
* @param pattern the background pattern.
* @return new builder instance
*/
public ChartBackgroundColorOptionsBuilder setBackgroundColor(Pattern pattern) {
options.setBackgroundColor(pattern);
return IsBuilder.checkAndGetIfValid(this);
}
/**
* Sets the type of compositing operation to apply when drawing new shapes.
*
* @param globalCompositeOperation which of the compositing or blending mode operations to use
* @return new builder instance
*/
public ChartBackgroundColorOptionsBuilder setGlobalCompositeOperation(GlobalCompositeOperation globalCompositeOperation) {
options.setGlobalCompositeOperation(globalCompositeOperation);
return IsBuilder.checkAndGetIfValid(this);
}
}
|
3e106b0b5586c3de2a37d24453037c669ce7af1b | 25,403 | java | Java | src/main/java/net/script/view/MainController.java | adinef/KSR-2 | 5d02bd2fa086897ffd28e854e5a676401eaae799 | [
"MIT"
] | null | null | null | src/main/java/net/script/view/MainController.java | adinef/KSR-2 | 5d02bd2fa086897ffd28e854e5a676401eaae799 | [
"MIT"
] | null | null | null | src/main/java/net/script/view/MainController.java | adinef/KSR-2 | 5d02bd2fa086897ffd28e854e5a676401eaae799 | [
"MIT"
] | null | null | null | 39.081538 | 143 | 0.565406 | 6,951 | package net.script.view;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXListView;
import com.jfoenix.controls.JFXSpinner;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;
import net.script.Main;
import net.script.data.FieldColumnTuple;
import net.script.data.Named;
import net.script.data.Tuple;
import net.script.data.annotations.Column;
import net.script.data.repositories.CachingRepository;
import net.script.logic.access.FuzzyData;
import net.script.logic.access.WorkingData;
import net.script.logic.fuzzy.linguistic.LinguisticVariable;
import net.script.logic.qualifier.Qualifier;
import net.script.logic.quantifier.Quantifier;
import net.script.logic.summarizer.Summarizer;
import net.script.logic.summary.SummarizationState;
import net.script.logic.summary.SummaryGenerator;
import net.script.utils.*;
import net.script.utils.functional.ConsumerWithException;
import net.script.utils.functional.RunnableWithException;
import net.script.utils.functional.SupplierWithException;
import net.script.utils.tasking.EntityReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import static net.script.data.annotations.enums.Author.*;
@Controller
@Slf4j
public class MainController implements Initializable {
private final CachingRepository repository;
private final FuzzyData fuzzyData;
private final WorkingData workingData;
private final SettingsUI settingsUI;
private boolean isFullscreen;
@FXML
private HBox summaryDataChosenBox;
@FXML
private Tab tab1;
@FXML
private MenuItem saveQualifiersOption;
@FXML
private MenuItem saveQuantifiersOption;
@FXML
private MenuItem saveSummarizersOption;
// ************** DATA ****************
private SelectionState selectionState = new SelectionState();
private SummaryGenerator summaryGenerator;
// ************************************
// ************** TableView to class mapping ****************
private Map<String, TableView> tableViewMap = new HashMap<>();
// **********************************************************
//*************** Selected data elems mapping ***************
private Map<Class, List<Node>> nodesMapping = new HashMap<>();
// **********************************************************
@Autowired
public MainController(
FuzzyData fuzzyData,
WorkingData workingData,
CachingRepository repository, SettingsUI settingsUI) {
this.repository = repository;
this.fuzzyData = fuzzyData;
this.workingData = workingData;
this.settingsUI = settingsUI;
}
@FXML
public void initialize() {
// initialize your data here
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
this.initialize();
}
@FXML
private void restoreWindow() {
Main.getCurrentStage().setFullScreen(!isFullscreen);
isFullscreen = !isFullscreen;
}
@FXML
private void minimizeWindow() {
Main.getCurrentStage().setIconified(true);
}
@FXML
private void closeWindow() {
Main.getCurrentStage().close();
Platform.exit();
}
public void barClicked(MouseEvent mouseEvent) {
if (mouseEvent.getClickCount() == 2) {
restoreWindow();
}
}
@FXML
private void about() {
CommonFXUtils.noDataPopup(
"Autorzy",
String.format("Projekt zrealizowany przez %s (%s), %s (%s) ",
AdrianFijalkowski.fullName(), AdrianFijalkowski.indexNumber(),
BartoszGoss.fullName(), BartoszGoss.indexNumber()),
Main.getCurrentStage().getScene()
);
}
@FXML
@SuppressWarnings("unchecked")
private void loadData() {
this.newTabWithContent(
repository.getItemClass(),
"Dane",
repository::findAll,
false,
false,
null);
}
public void showQuantifiers() {
VBox vBox = this.showLinguisticData(
Quantifier.class,
"Kwantyfikatory",
workingData::workingQuantifiers
);
JFXButton saveButton = new JFXButton("Zapisz do CSV");
saveButton.setOnAction((e) -> CSVSaveUtils.exportToCsv(this.workingData.workingQuantifiers(), settingsUI.separator, Quantifier.class));
vBox.getChildren().add(0, saveButton);
this.saveQuantifiersOption.setDisable(false);
}
public void showQualifiers() {
VBox vBox = this.showLinguisticData(Qualifier.class,
"Kwalifikatory",
workingData::workingQualifiers
);
JFXButton saveButton = new JFXButton("Zapisz do CSV");
saveButton.setOnAction((e) -> CSVSaveUtils.exportToCsv(this.workingData.workingQualifiers(), settingsUI.separator, Qualifier.class));
vBox.getChildren().add(0, saveButton);
this.saveQualifiersOption.setDisable(false);
}
public void showSummarizers() {
VBox vBox = this.showLinguisticData(Summarizer.class,
"Summaryzatory",
workingData::workingSummarizers
);
JFXButton saveButton = new JFXButton("Zapisz do CSV");
saveButton.setOnAction((e) -> CSVSaveUtils.exportToCsv(this.workingData.workingSummarizers(), settingsUI.separator, Summarizer.class));
vBox.getChildren().add(0, saveButton);
this.saveSummarizersOption.setDisable(false);
}
@FXML
private void saveQualifiers() {
CommonFXUtils.longTaskWithMessages(
fuzzyData::saveQualifiers,
"Pomyślnie zapisano kwalifikatory",
"Wystąpił błąd zapisu",
Main.getCurrentStage().getScene());
}
@FXML
private void saveQuantifiers() {
CommonFXUtils.longTaskWithMessages(
fuzzyData::saveQuantifiers,
"Pomyślnie zapisano kwantyfikatory",
"Wystąpił błąd zapisu",
Main.getCurrentStage().getScene());
}
@FXML
private void saveSummarizers() {
CommonFXUtils.longTaskWithMessages(
fuzzyData::saveSummarizers,
"Pomyślnie zapisano saummaryzatory",
"Wystąpił błąd zapisu",
Main.getCurrentStage().getScene());
}
private double prefTabContentHeight() {
return Main.getCurrentStage().getHeight() - 100;
}
@FXML
private void selectQuantifiers(ActionEvent actionEvent) {
this.selectData(
() -> this.workingData.setWorkingQuantifiers(this.fuzzyData.quantifiers()),
Quantifier.class,
(in) -> selectionState.setQuantifiers(in.getSecond()),
this.workingData::workingQuantifiers,
() -> new Tuple<>(new OperatorChoice(false), selectionState.getQuantifiers()),
false
);
this.setListView(
Quantifier.class,
"Wybrane kwantyfikatory",
() -> selectionState.getQuantifiers().stream().map(Quantifier::getName).collect(Collectors.toList())
);
}
@FXML
private void selectQualifiers(ActionEvent actionEvent) {
this.selectData(
() -> this.workingData.setWorkingQualifiers(this.fuzzyData.qualifiers()),
Qualifier.class,
(in) -> {
Tuple<OperatorChoice, ObservableList<Qualifier>> tuple = in;
selectionState.setQualifiers(tuple.getSecond());
selectionState.setQualifierAndOperation(tuple.getFirst().isAndChosen());
},
() -> this.workingData.workingQualifiers(selectionState.getAllowedFields()),
() -> new Tuple<>(
new OperatorChoice(selectionState.isQualifierAndOperation()),
selectionState.getQualifiers()
),
true
);
this.setListView(
Qualifier.class,
"Wybrane kwalifikatory",
() -> selectionState.getQualifiers().stream().map(Qualifier::getName).collect(Collectors.toList())
);
}
@FXML
private void selectSummarizers(ActionEvent actionEvent) {
this.selectData(
() -> this.workingData.setWorkingSummarizers(this.fuzzyData.summarizers()),
Summarizer.class,
(in) -> {
Tuple<OperatorChoice, ObservableList<Summarizer>> tuple = in;
selectionState.setSummarizers(tuple.getSecond());
selectionState.setSummarizerAndOperation(tuple.getFirst().isAndChosen());
},
() -> this.workingData.workingSummarizers(selectionState.getAllowedFields()),
() -> new Tuple<>(
new OperatorChoice(selectionState.isSummarizerAndOperation()),
selectionState.getSummarizers()
),
true
);
this.setListView(
Summarizer.class,
"Wybrane sumaryzatory",
() -> selectionState.getSummarizers().stream().map(Summarizer::getName).collect(Collectors.toList())
);
}
private void setListView(Class<?> elemClass,
String title,
Supplier<List<String>> valuesSupplier) {
List<Node> nodes;
if (this.nodesMapping.containsKey(elemClass)) {
nodes = this.nodesMapping.get(elemClass);
nodes.clear();
} else {
nodes = new ArrayList<>();
this.nodesMapping.put(elemClass, nodes);
}
VBox vBox = new VBox();
Label label = new Label(title);
JFXListView<String> list = new JFXListView<>();
list.setMinHeight(500);
List<String> data = valuesSupplier.get();
if (!data.isEmpty()) {
list.getItems().addAll(
data
);
vBox.getChildren().addAll(label, list);
nodes.add(vBox);
} else {
this.nodesMapping.remove(elemClass);
}
this.summaryDataChosenBox.getChildren().clear();
for (List<Node> valList : this.nodesMapping.values()) {
this.summaryDataChosenBox.getChildren().addAll(valList);
}
}
private <T extends Named> void selectData(RunnableWithException initializer,
Class<T> objClass,
Consumer<Tuple<OperatorChoice, ObservableList<T>>> selectionConsumer,
Supplier<List<T>> workingDataSupplier,
Supplier<Tuple<OperatorChoice, List<T>>> currentStateSupplier,
boolean withOperators) {
try {
initializer.run();
} catch (Exception e) {
CommonFXUtils.noDataPopup(
"Błąd",
"Błąd w trakcie wyboru " + objClass.getName() + ". " + e.getLocalizedMessage(),
Main.getCurrentStage().getScene()
);
e.printStackTrace();
return;
}
selectionConsumer.accept(
FuzzyFXUtils
.checkBoxSelectAlert(
workingDataSupplier.get(),
Main.getCurrentStage().getScene(),
currentStateSupplier.get(),
withOperators
)
);
}
@FXML
private void selectAcceptableFields(ActionEvent actionEvent) {
selectionState.setAllowedFields(
FuzzyFXUtils
.selectFieldByClassPopup(
(Class<?>) repository.getItemClass(),
Main.getCurrentStage().getScene(),
selectionState.getAllowedFields(),
true
)
);
this.setListView(
FieldColumnTuple.class,
"Wybrane pola",
() -> selectionState.getAllowedFields().stream().map(FieldColumnTuple::name).collect(Collectors.toList())
);
}
@FXML
private void newQualifier(ActionEvent actionEvent) {
this.newElement(
() -> FuzzyFXUtils.newLinguisticVariablePopup(
Qualifier.class,
Main.getCurrentStage().getScene(),
this.repository.getItemClass()),
(e) -> this.fuzzyData.qualifiers().add(e),
this.saveQualifiersOption,
Qualifier.class
);
}
@FXML
private void newSummarizer(ActionEvent actionEvent) {
this.newElement(
() -> FuzzyFXUtils.newLinguisticVariablePopup(
Summarizer.class,
Main.getCurrentStage().getScene(),
this.repository.getItemClass()),
(e) -> this.fuzzyData.summarizers().add(e),
this.saveSummarizersOption,
Summarizer.class
);
}
@FXML
private void newQuantifier(ActionEvent actionEvent) {
this.newElement(
() -> FuzzyFXUtils.newQuantifierPopup(Main.getCurrentStage().getScene()),
(e) -> this.fuzzyData.quantifiers().add(e),
this.saveQuantifiersOption,
Quantifier.class
);
}
private <T> void newElement(Supplier<Optional<T>> elemSupplier,
ConsumerWithException<T> consumer,
MenuItem option,
Class<T> objectClass) {
Optional<T> elem = elemSupplier.get();
elem.ifPresent(
(e) -> {
try {
consumer.consume(e);
option.setDisable(false);
TableView tableViewOrNull = this.tableViewMap
.getOrDefault(objectClass.getName(), null);
if (tableViewOrNull != null) {
log.info("updating tab for " + objectClass.getName());
tableViewOrNull.refresh();
}
} catch (Exception ex) {
CommonFXUtils.noDataPopup(
"Błąd",
"Wystapił błąd przy odczycie. " + ex.getLocalizedMessage(),
Main.getCurrentStage().getScene()
);
}
}
);
}
@FXML
private void proceedWithSummarization(ActionEvent actionEvent) {
List<Tuple<Summary, SummarizationState>> summaries = new ArrayList<>();
// TEMPORARILY
if (selectionState.firstTypeReady()) {
//this.newTabWithContent(repository.getItemClass(), "Dane", repository::findAll);
//FIRST TYPE SUMMARIZATION
//List<Summary> summaries = new ArrayList<>();
summaries.clear();
summaries.addAll(
summarizer().createSummary(
repository.findAll(),
selectionState.getQuantifiers(),
selectionState.getQualifiers(),
selectionState.getSummarizers(),
selectionState.isQualifierAndOperation(),
selectionState.isSummarizerAndOperation()
)
);
VBox vBox = this.newTabWithContent(
Summary.class,
"Podsumowania",
() -> FXCollections.observableList(
summaries.stream().map(Tuple::getFirst).collect(Collectors.toList())
),
true,
false,
null
);
JFXButton saveButton = new JFXButton("Zapisz podsumowania");
saveButton.setOnAction((e) -> this.saveSummaries(summaries));
vBox.getChildren().add(0, saveButton);
} else {
CommonFXUtils.noDataPopup("Dane",
"Proszę wybierz wszystkie potrzebne dane do wygenerowania podsumowania.",
Main.getCurrentStage().getScene()
);
}
}
private void saveSummaries(List<Tuple<Summary, SummarizationState>> summaries) {
CSVSaveUtils.exportToCsv(
summaries.stream().map(Tuple::getFirst).collect(Collectors.toList()),
settingsUI.separator,
Summary.class);
}
private SummaryGenerator summarizer() {
if (this.summaryGenerator == null) {
this.summaryGenerator = new SummaryGenerator("budynków");
}
return this.summaryGenerator;
}
// HELPER METHODS
private <T> VBox showLinguisticData(Class<T> tClass, String tabname, SupplierWithException<List<T>> listSupplier) {
ObservableList<T> read = FXCollections.observableArrayList();
try {
read = FXCollections.observableList(listSupplier.get());
} catch (Exception e) {
CommonFXUtils.noDataPopup("Wystapił błąd", e.getLocalizedMessage(), Main.getCurrentStage().getScene());
e.printStackTrace();
}
ObservableList<T> finalRead = read;
VBox vBox = this.newTabWithContent(tClass, tabname, () -> finalRead, true, true, (deletedElem) -> {
System.out.println(deletedElem);
if (Qualifier.class.equals(tClass)) {
this.workingData.workingQualifiers().remove(deletedElem);
this.selectionState.getQualifiers().remove(deletedElem);
} else if (Quantifier.class.equals(tClass)) {
this.workingData.workingQuantifiers().remove(deletedElem);
this.selectionState.getQuantifiers().remove(deletedElem);
} else if (Summarizer.class.equals(tClass)) {
this.workingData.workingSummarizers().remove(deletedElem);
this.selectionState.getSummarizers().remove(deletedElem);
}
});
return vBox;
}
@SuppressWarnings("unchecked")
private <T> VBox newTabWithContent(Class<T> tClass,
String name,
Supplier<Iterable<T>> dataSupplier,
boolean editable,
boolean deletable,
Consumer<T> deleteConsumer) {
EntityReadService<T> task = new EntityReadService<>(dataSupplier);
VBox vBox = new VBox();
vBox.setSpacing(10);
StackPane stackPane = new StackPane();
JFXSpinner jfxSpinner = new JFXSpinner();
jfxSpinner.setRadius(50);
TableView tableView = new TableView();
vBox.getChildren().add(stackPane);
stackPane.getChildren().addAll(tableView, jfxSpinner);
tableView.setPrefHeight(prefTabContentHeight());
List<TableColumn<String, T>> simpleColumns =
CommonFXUtils.getSimpleColumnsForClass(tClass, false);
setColumnToolTipIfAvailible(tClass, simpleColumns);
tableView.getColumns().addAll(simpleColumns);
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
ContextMenu contextMenu = null;
if (editable) {
contextMenu = new ContextMenu();
MenuItem menuItem = new MenuItem("Edytuj");
contextMenu.getItems().add(menuItem);
menuItem.setOnAction((e) -> this.editContext(tableView));
tableView.setOnMouseClicked((e) -> this.listenForTableDoubleClick(e, tableView));
}
if (deletable) {
if (contextMenu == null) {
contextMenu = new ContextMenu();
}
MenuItem menuItem = new MenuItem("Usuń");
menuItem.setOnAction((e) -> this.deleteContext(deleteConsumer, tableView));
contextMenu.getItems().add(menuItem);
tableView.setOnKeyPressed((e) -> this.askForDelete(e, tableView, deleteConsumer));
}
if (contextMenu != null) {
tableView.setContextMenu(contextMenu);
}
Tab e1 = new Tab(name, vBox);
tab1.getTabPane().getTabs().add(e1);
HBox hBox = new HBox();
Label quantityLabel = new Label("Ilość elementów: ");
Label actualQuantity = new Label("0");
hBox.getChildren().addAll(quantityLabel, actualQuantity);
vBox.getChildren().add(hBox);
task.setOnSucceeded(
e -> {
Collection data = (Collection) e.getSource().getValue();
tableView.setItems(FXCollections.observableList(new ArrayList<>(data)));
actualQuantity.setText(String.valueOf(data.size()));
stackPane.getChildren().remove(jfxSpinner);
}
);
task.start();
this.tableViewMap.put(tClass.getName(), tableView);
return vBox;
}
private <T> void askForDelete(KeyEvent e, TableView<T> tableView, Consumer<T> deleteConsumer) {
if (e.getCode() == KeyCode.DELETE) {
this.deleteContext(deleteConsumer, tableView);
}
}
private <T> void setColumnToolTipIfAvailible(Class<T> tClass, List<TableColumn<String, T>> simpleColumns) {
for (TableColumn col : simpleColumns) {
for (Field field : tClass.getDeclaredFields()) {
Column colAnn = field.getAnnotation(Column.class);
if (colAnn != null && !colAnn.tooltip().isEmpty()) {
if (colAnn.value().equals(col.getText())) {
Label label = new Label(col.getText());
label.setTooltip(new Tooltip(colAnn.tooltip()));
col.setGraphic(label);
col.setText("");
}
}
}
}
}
private void listenForTableDoubleClick(MouseEvent mouseEvent, TableView tableView) {
if (mouseEvent.getClickCount() == 2) {
editContext(tableView);
}
}
private <T> void deleteContext(Consumer<T> deleteConsumer, TableView<T> tableView) {
boolean delete = CommonFXUtils
.yesNoPopup("Usuwanie",
"Czy na pewno usunąć element?",
Main.getCurrentStage().getScene()
);
if (delete) {
T selectedItem = tableView.getSelectionModel().getSelectedItem();
deleteConsumer.accept(selectedItem);
tableView.getItems().remove(selectedItem);
tableView.refresh();
}
}
private void editContext(TableView tableView) {
Object selectedItem = tableView.getSelectionModel().getSelectedItem();
if (selectedItem instanceof LinguisticVariable) {
LinguisticVariable lv = (LinguisticVariable) selectedItem;
Optional<?> editQualifierOptional =
FuzzyFXUtils.editLVPopup(
"Edytuj kwalifikator",
lv,
Main.getCurrentStage().getScene(),
this.repository.getItemClass()
);
editQualifierOptional.ifPresent((e) -> tableView.refresh());
}
if (selectedItem instanceof Quantifier) {
Quantifier quantifier = (Quantifier) selectedItem;
Optional<?> editQuantifierOptional =
FuzzyFXUtils.editQuantifierPopup(
"Edytuj kwantyfikator",
quantifier,
Main.getCurrentStage().getScene()
);
editQuantifierOptional.ifPresent((e) -> tableView.refresh());
}
if (selectedItem instanceof Summary) {
Summary summary = (Summary) selectedItem;
SummaryDetailsUtils.showDetailsOf(summary, tab1.getTabPane().getScene());
}
}
@FXML
private void settings(ActionEvent actionEvent) {
settingsUI.show(Main.getCurrentStage().getScene());
}
}
|
3e106b0ba141974dfdb6dd42936367944ed7d486 | 2,589 | java | Java | app/src/main/java/com/bakerframework/baker/view/ShelfView.java | victororsi/baker-android-Hotrods | 66190bfb8626e7e1a729d8d007e59cf97ebf014a | [
"BSD-3-Clause"
] | null | null | null | app/src/main/java/com/bakerframework/baker/view/ShelfView.java | victororsi/baker-android-Hotrods | 66190bfb8626e7e1a729d8d007e59cf97ebf014a | [
"BSD-3-Clause"
] | null | null | null | app/src/main/java/com/bakerframework/baker/view/ShelfView.java | victororsi/baker-android-Hotrods | 66190bfb8626e7e1a729d8d007e59cf97ebf014a | [
"BSD-3-Clause"
] | null | null | null | 41.095238 | 91 | 0.753959 | 6,952 | /**
* Copyright (c) 2013-2014. Francisco Contreras, Holland Salazar.
* Copyright (c) 2015. Tobias Strebitzer, Francisco Contreras, Holland Salazar.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the Baker Framework nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/
package com.bakerframework.baker.view;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.widget.GridView;
public class ShelfView extends GridView {
public ShelfView(Context context, AttributeSet attrs) {
super(context, attrs);
updateColumnCount();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
updateColumnCount();
super.onConfigurationChanged(newConfig);
}
private void updateColumnCount() {
// Get metrics information
DisplayMetrics metrics = getResources().getDisplayMetrics();
int width = metrics.widthPixels;
// Each issue card needs at lease 550px width to display correctly
int columnCount = ((int) Math.max(Math.floor(width / 550), 1));
setNumColumns(columnCount);
}
}
|
3e106d036efeaede68c70022700a8eebfe76f5db | 23,128 | java | Java | server/src/main/java/io/seata/server/storage/redis/store/RedisTransactionStoreManager.java | weitanx/seata | 2bc5bf3c35c17562d6a561edcc0537629b85d5b0 | [
"Apache-2.0"
] | 16,483 | 2019-04-01T07:06:31.000Z | 2022-03-31T15:29:42.000Z | server/src/main/java/io/seata/server/storage/redis/store/RedisTransactionStoreManager.java | jameslcj/seata | 2bc5bf3c35c17562d6a561edcc0537629b85d5b0 | [
"Apache-2.0"
] | 3,755 | 2019-04-01T07:48:21.000Z | 2022-03-31T12:25:44.000Z | server/src/main/java/io/seata/server/storage/redis/store/RedisTransactionStoreManager.java | jameslcj/seata | 2bc5bf3c35c17562d6a561edcc0537629b85d5b0 | [
"Apache-2.0"
] | 6,811 | 2019-04-01T08:07:53.000Z | 2022-03-31T14:25:07.000Z | 41.672072 | 153 | 0.648175 | 6,953 | /*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.server.storage.redis.store;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;
import redis.clients.jedis.Transaction;
import io.seata.common.exception.StoreException;
import io.seata.common.util.CollectionUtils;
import io.seata.common.util.StringUtils;
import io.seata.common.exception.RedisException;
import io.seata.common.util.BeanUtils;
import io.seata.common.XID;
import io.seata.core.model.GlobalStatus;
import io.seata.core.store.BranchTransactionDO;
import io.seata.core.store.GlobalTransactionDO;
import io.seata.server.session.GlobalSession;
import io.seata.server.session.SessionCondition;
import io.seata.server.storage.SessionConverter;
import io.seata.server.storage.redis.JedisPooledFactory;
import io.seata.server.store.AbstractTransactionStoreManager;
import io.seata.server.store.SessionStorable;
import io.seata.server.store.TransactionStoreManager;
import static io.seata.core.constants.RedisKeyConstants.REDIS_KEY_BRANCH_GMT_MODIFIED;
import static io.seata.core.constants.RedisKeyConstants.REDIS_KEY_BRANCH_STATUS;
import static io.seata.core.constants.RedisKeyConstants.REDIS_KEY_BRANCH_XID;
import static io.seata.core.constants.RedisKeyConstants.REDIS_KEY_GLOBAL_GMT_MODIFIED;
import static io.seata.core.constants.RedisKeyConstants.REDIS_KEY_GLOBAL_STATUS;
import static io.seata.core.constants.RedisKeyConstants.REDIS_KEY_GLOBAL_XID;
import static io.seata.core.constants.RedisKeyConstants.REDIS_KEY_BRANCH_APPLICATION_DATA;
/**
* The redis transaction store manager
*
* @author funkye
* @author wangzhongxiang
*/
public class RedisTransactionStoreManager extends AbstractTransactionStoreManager implements TransactionStoreManager {
private static final Logger LOGGER = LoggerFactory.getLogger(RedisTransactionStoreManager.class);
/**the prefix of the branch transactions*/
private static final String REDIS_SEATA_BRANCHES_PREFIX = "SEATA_BRANCHES_";
/**the prefix of the branch transaction*/
private static final String REDIS_SEATA_BRANCH_PREFIX = "SEATA_BRANCH_";
/**the prefix of the global transaction*/
private static final String REDIS_SEATA_GLOBAL_PREFIX = "SEATA_GLOBAL_";
/**the prefix of the global transaction status*/
private static final String REDIS_SEATA_STATUS_PREFIX = "SEATA_STATUS_";
private static volatile RedisTransactionStoreManager instance;
private static final String OK = "OK";
/**
* Get the instance.
*/
public static RedisTransactionStoreManager getInstance() {
if (instance == null) {
synchronized (RedisTransactionStoreManager.class) {
if (instance == null) {
instance = new RedisTransactionStoreManager();
}
}
}
return instance;
}
/*
init map to constructor
*/
public RedisTransactionStoreManager() {
super();
initGlobalMap();
initBranchMap();
}
/*
Map for LogOperation Global Operation
*/
public static volatile ImmutableMap<LogOperation, Function<GlobalTransactionDO, Boolean>> globalMap;
/*
Map for LogOperation Branch Operation
*/
public static volatile ImmutableMap<LogOperation, Function<BranchTransactionDO, Boolean>> branchMap;
/**
* init globalMap
*
* @return void
*/
public void initGlobalMap() {
if (CollectionUtils.isEmpty(branchMap)) {
globalMap = ImmutableMap.<LogOperation, Function<GlobalTransactionDO, Boolean>>builder()
.put(LogOperation.GLOBAL_ADD, this::insertGlobalTransactionDO)
.put(LogOperation.GLOBAL_UPDATE, this::updateGlobalTransactionDO)
.put(LogOperation.GLOBAL_REMOVE, this::deleteGlobalTransactionDO)
.build();
}
}
/**
* init branchMap
*
* @return void
*/
public void initBranchMap() {
if (CollectionUtils.isEmpty(branchMap)) {
branchMap = ImmutableMap.<LogOperation, Function<BranchTransactionDO, Boolean>>builder()
.put(LogOperation.BRANCH_ADD, this::insertBranchTransactionDO)
.put(LogOperation.BRANCH_UPDATE, this::updateBranchTransactionDO)
.put(LogOperation.BRANCH_REMOVE, this::deleteBranchTransactionDO)
.build();
}
}
@Override
public boolean writeSession(LogOperation logOperation, SessionStorable session) {
if (globalMap.containsKey(logOperation) || branchMap.containsKey(logOperation)) {
return globalMap.containsKey(logOperation) ?
globalMap.get(logOperation).apply(SessionConverter.convertGlobalTransactionDO(session)) :
branchMap.get(logOperation).apply(SessionConverter.convertBranchTransactionDO(session));
} else {
throw new StoreException("Unknown LogOperation:" + logOperation.name());
}
}
/**
* Insert branch transaction
* @param branchTransactionDO
* @return the boolean
*/
private boolean insertBranchTransactionDO(BranchTransactionDO branchTransactionDO) {
String branchKey = buildBranchKey(branchTransactionDO.getBranchId());
String branchListKey = buildBranchListKeyByXid(branchTransactionDO.getXid());
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
Date now = new Date();
branchTransactionDO.setGmtCreate(now);
branchTransactionDO.setGmtModified(now);
Pipeline pipelined = jedis.pipelined();
pipelined.hmset(branchKey, BeanUtils.objectToMap(branchTransactionDO));
pipelined.rpush(branchListKey, branchKey);
pipelined.sync();
return true;
} catch (Exception ex) {
throw new RedisException(ex);
}
}
/**
* Delete the branch transaction
* @param branchTransactionDO
* @return
*/
private boolean deleteBranchTransactionDO(BranchTransactionDO branchTransactionDO) {
String branchKey = buildBranchKey(branchTransactionDO.getBranchId());
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
String xid = jedis.hget(branchKey, REDIS_KEY_BRANCH_XID);
if (StringUtils.isEmpty(xid)) {
return true;
}
String branchListKey = buildBranchListKeyByXid(branchTransactionDO.getXid());
Pipeline pipelined = jedis.pipelined();
pipelined.lrem(branchListKey, 0, branchKey);
pipelined.del(branchKey);
pipelined.sync();
return true;
} catch (Exception ex) {
throw new RedisException(ex);
}
}
/**
* Update the branch transaction
* @param branchTransactionDO
* @return
*/
private boolean updateBranchTransactionDO(BranchTransactionDO branchTransactionDO) {
String branchKey = buildBranchKey(branchTransactionDO.getBranchId());
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
String previousBranchStatus = jedis.hget(branchKey, REDIS_KEY_BRANCH_STATUS);
if (StringUtils.isEmpty(previousBranchStatus)) {
throw new StoreException("Branch transaction is not exist, update branch transaction failed.");
}
Map<String, String> map = new HashMap<>(3, 1);
map.put(REDIS_KEY_BRANCH_STATUS, String.valueOf(branchTransactionDO.getStatus()));
map.put(REDIS_KEY_BRANCH_GMT_MODIFIED, String.valueOf((new Date()).getTime()));
if (StringUtils.isNotBlank(branchTransactionDO.getApplicationData())) {
map.put(REDIS_KEY_BRANCH_APPLICATION_DATA, String.valueOf(branchTransactionDO.getApplicationData()));
}
jedis.hmset(branchKey, map);
return true;
} catch (Exception ex) {
throw new RedisException(ex);
}
}
/**
* Insert the global transaction.
* @param globalTransactionDO
* @return
*/
private boolean insertGlobalTransactionDO(GlobalTransactionDO globalTransactionDO) {
String globalKey = buildGlobalKeyByTransactionId(globalTransactionDO.getTransactionId());
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
Date now = new Date();
globalTransactionDO.setGmtCreate(now);
globalTransactionDO.setGmtModified(now);
Pipeline pipelined = jedis.pipelined();
pipelined.hmset(globalKey, BeanUtils.objectToMap(globalTransactionDO));
pipelined.rpush(buildGlobalStatus(globalTransactionDO.getStatus()), globalTransactionDO.getXid());
pipelined.sync();
return true;
} catch (Exception ex) {
throw new RedisException(ex);
}
}
/**
* Delete the global transaction.
* It will operate two parts:
* 1.delete the global session map
* 2.remove the xid from the global status list
* If the operate failed,the succeed operates will rollback
* @param globalTransactionDO
* @return
*/
private boolean deleteGlobalTransactionDO(GlobalTransactionDO globalTransactionDO) {
String globalKey = buildGlobalKeyByTransactionId(globalTransactionDO.getTransactionId());
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
String xid = jedis.hget(globalKey, REDIS_KEY_GLOBAL_XID);
if (StringUtils.isEmpty(xid)) {
LOGGER.warn("Global transaction is not exist,xid = {}.Maybe has been deleted by another tc server",
globalTransactionDO.getXid());
return true;
}
Pipeline pipelined = jedis.pipelined();
pipelined.lrem(buildGlobalStatus(globalTransactionDO.getStatus()), 0, globalTransactionDO.getXid());
pipelined.del(globalKey);
pipelined.sync();
return true;
} catch (Exception ex) {
throw new RedisException(ex);
}
}
/**
* Update the global transaction.
* It will update two parts:
* 1.the global session map
* 2.the global status list
* If the update failed,the succeed operates will rollback
* @param globalTransactionDO
* @return
*/
private boolean updateGlobalTransactionDO(GlobalTransactionDO globalTransactionDO) {
String xid = globalTransactionDO.getXid();
String globalKey = buildGlobalKeyByTransactionId(globalTransactionDO.getTransactionId());
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
// Defensive watch to prevent other TC server operating concurrently,Fail fast
jedis.watch(globalKey);
List<String> statusAndGmtModified = jedis.hmget(globalKey, REDIS_KEY_GLOBAL_STATUS, REDIS_KEY_GLOBAL_GMT_MODIFIED);
String previousStatus = statusAndGmtModified.get(0);
if (StringUtils.isEmpty(previousStatus)) {
jedis.unwatch();
throw new StoreException("Global transaction is not exist, update global transaction failed.");
}
if (previousStatus.equals(String.valueOf(globalTransactionDO.getStatus()))) {
jedis.unwatch();
return true;
}
String previousGmtModified = statusAndGmtModified.get(1);
Transaction multi = jedis.multi();
Map<String,String> map = new HashMap<>(2);
map.put(REDIS_KEY_GLOBAL_STATUS,String.valueOf(globalTransactionDO.getStatus()));
map.put(REDIS_KEY_GLOBAL_GMT_MODIFIED,String.valueOf((new Date()).getTime()));
multi.hmset(globalKey,map);
multi.lrem(buildGlobalStatus(Integer.valueOf(previousStatus)),0, xid);
multi.rpush(buildGlobalStatus(globalTransactionDO.getStatus()), xid);
List<Object> exec = multi.exec();
if (CollectionUtils.isEmpty(exec)) {
//The data has changed by another tc, so we still think the modification is successful.
LOGGER.warn("The global transaction xid = {}, maybe changed by another TC. It does not affect the results",globalTransactionDO.getXid());
return true;
}
String hmset = exec.get(0).toString();
long lrem = (long)exec.get(1);
long rpush = (long)exec.get(2);
if (OK.equalsIgnoreCase(hmset) && lrem > 0 && rpush > 0) {
return true;
} else {
// If someone failed, the succeed operations need rollback
if (OK.equalsIgnoreCase(hmset)) {
// Defensive watch to prevent other TC server operating concurrently,give up this operate
jedis.watch(globalKey);
String xid2 = jedis.hget(globalKey, REDIS_KEY_GLOBAL_XID);
if (StringUtils.isNotEmpty(xid2)) {
Map<String,String> mapPrevious = new HashMap<>(2,1);
mapPrevious.put(REDIS_KEY_GLOBAL_STATUS,previousStatus);
mapPrevious.put(REDIS_KEY_GLOBAL_GMT_MODIFIED,previousGmtModified);
Transaction multi2 = jedis.multi();
multi2.hmset(globalKey,mapPrevious);
multi2.exec();
}
}
if (lrem > 0) {
jedis.rpush(buildGlobalStatus(Integer.valueOf(previousStatus)),xid);
}
if (rpush > 0) {
jedis.lrem(buildGlobalStatus(globalTransactionDO.getStatus()),0,xid);
}
return false;
}
} catch (Exception ex) {
throw new RedisException(ex);
}
}
/**
* Read session global session.
*
* @param xid the xid
* @param withBranchSessions the withBranchSessions
* @return the global session
*/
@Override
public GlobalSession readSession(String xid, boolean withBranchSessions) {
String transactionId = String.valueOf(XID.getTransactionId(xid));
String globalKey = buildGlobalKeyByTransactionId(transactionId);
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
Map<String, String> map = jedis.hgetAll(globalKey);
if (CollectionUtils.isEmpty(map)) {
return null;
}
GlobalTransactionDO globalTransactionDO = (GlobalTransactionDO)BeanUtils.mapToObject(map, GlobalTransactionDO.class);
List<BranchTransactionDO> branchTransactionDOs = null;
if (withBranchSessions) {
branchTransactionDOs = this.readBranchSessionByXid(jedis,xid);
}
return getGlobalSession(globalTransactionDO,branchTransactionDOs);
}
}
/**
* Read session global session.
*
* @param xid
* the xid
* @return the global session
*/
@Override
public GlobalSession readSession(String xid) {
return this.readSession(xid, true);
}
/**
* Read globalSession list by global status
*
* @param statuses the statuses
* @return the list
*/
public List<GlobalSession> readSession(GlobalStatus[] statuses) {
List<String> statusKeys = new ArrayList<>();
for (int i = 0; i < statuses.length; i++) {
statusKeys.add(buildGlobalStatus(statuses[i].getCode()));
}
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
Pipeline pipelined = jedis.pipelined();
statusKeys.stream().forEach(statusKey -> pipelined.lrange(statusKey, 0, -1));
List<List<String>> list = (List<List<String>>)(List)pipelined.syncAndReturnAll();
List<GlobalSession> globalSessions = Collections.synchronizedList(new ArrayList<>());
if (CollectionUtils.isNotEmpty(list)) {
List<String> xids = list.stream().flatMap(ll -> ll.stream()).collect(Collectors.toList());
xids.parallelStream().forEach(xid -> {
GlobalSession globalSession = this.readSession(xid, true);
if (globalSession != null) {
globalSessions.add(globalSession);
}
});
}
return globalSessions;
}
}
/**
* read the global session list by different condition
* @param sessionCondition the session condition
* @return the global sessions
*/
@Override
public List<GlobalSession> readSession(SessionCondition sessionCondition) {
List<GlobalSession> globalSessions = new ArrayList<>();
if (StringUtils.isNotEmpty(sessionCondition.getXid())) {
GlobalSession globalSession = this.readSession(sessionCondition.getXid(), true);
if (globalSession != null) {
globalSessions.add(globalSession);
}
return globalSessions;
} else if (sessionCondition.getTransactionId() != null) {
GlobalSession globalSession = this
.readSessionByTransactionId(sessionCondition.getTransactionId().toString(), true);
if (globalSession != null) {
globalSessions.add(globalSession);
}
return globalSessions;
} else if (CollectionUtils.isNotEmpty(sessionCondition.getStatuses())) {
return readSession(sessionCondition.getStatuses());
} else if (sessionCondition.getStatus() != null) {
return readSession(new GlobalStatus[]{sessionCondition.getStatus()});
}
return null;
}
/**
* assemble the global session and branch session
* @param globalTransactionDO the global transactionDo
* @param branchTransactionDOs the branch transactionDos
* @return the global session with branch session
*/
private GlobalSession getGlobalSession(GlobalTransactionDO globalTransactionDO,
List<BranchTransactionDO> branchTransactionDOs) {
GlobalSession globalSession = SessionConverter.convertGlobalSession(globalTransactionDO);
if (CollectionUtils.isNotEmpty(branchTransactionDOs)) {
for (BranchTransactionDO branchTransactionDO : branchTransactionDOs) {
globalSession.add(SessionConverter.convertBranchSession(branchTransactionDO));
}
}
return globalSession;
}
/**
* read the global session by transactionId
* @param transactionId the transaction id
* @param withBranchSessions if read branch sessions
* @return the global session
*/
private GlobalSession readSessionByTransactionId(String transactionId, boolean withBranchSessions) {
String globalKey = buildGlobalKeyByTransactionId(transactionId);
String xid = null;
try (Jedis jedis = JedisPooledFactory.getJedisInstance()) {
Map<String, String> map = jedis.hgetAll(globalKey);
if (CollectionUtils.isEmpty(map)) {
return null;
}
GlobalTransactionDO globalTransactionDO = (GlobalTransactionDO)BeanUtils.mapToObject(map, GlobalTransactionDO.class);
if (globalTransactionDO != null) {
xid = globalTransactionDO.getXid();
}
List<BranchTransactionDO> branchTransactionDOs = new ArrayList<>();
if (withBranchSessions) {
branchTransactionDOs = this.readBranchSessionByXid(jedis,xid);
}
return getGlobalSession(globalTransactionDO,branchTransactionDOs);
}
}
/**
* Read the branch session list by xid
* @param jedis
* @param xid the xid
* @return the branch transactionDo list
*/
private List<BranchTransactionDO> readBranchSessionByXid(Jedis jedis,String xid) {
List<BranchTransactionDO> branchTransactionDOs = new ArrayList<>();
String branchListKey = buildBranchListKeyByXid(xid);
List<String> branchKeys = lRange(jedis, branchListKey);
Pipeline pipeline = jedis.pipelined();
if (CollectionUtils.isNotEmpty(branchKeys)) {
branchKeys.stream().forEach(branchKey -> pipeline.hgetAll(branchKey));
List<Object> branchInfos = pipeline.syncAndReturnAll();
for (Object branchInfo : branchInfos) {
if (branchInfo != null) {
Map<String, String> branchInfoMap = (Map<String, String>) branchInfo;
Optional<BranchTransactionDO> branchTransactionDO =
Optional.ofNullable((BranchTransactionDO) BeanUtils.mapToObject(branchInfoMap, BranchTransactionDO.class));
branchTransactionDO.ifPresent(branchTransactionDOs::add);
}
}
}
if (CollectionUtils.isNotEmpty(branchTransactionDOs)) {
Collections.sort(branchTransactionDOs);
}
return branchTransactionDOs;
}
private List<String> lRange(Jedis jedis, String key) {
List<String> keys = new ArrayList<>();
List<String> values;
int limit = 20;
int start = 0;
int stop = limit;
for (;;) {
values = jedis.lrange(key, start, stop);
keys.addAll(values);
if (CollectionUtils.isEmpty(values) || values.size() < limit) {
break;
}
start = keys.size();
stop = start + limit;
}
return keys;
}
private String buildBranchListKeyByXid(String xid) {
return REDIS_SEATA_BRANCHES_PREFIX + xid;
}
private String buildGlobalKeyByTransactionId(Object transactionId) {
return REDIS_SEATA_GLOBAL_PREFIX + transactionId;
}
private String buildBranchKey(Long branchId) {
return REDIS_SEATA_BRANCH_PREFIX + branchId;
}
private String buildGlobalStatus(Integer status) {
return REDIS_SEATA_STATUS_PREFIX + status;
}
}
|
3e106d988f73b78c5ada089a2aeb578d8e245da9 | 31,309 | java | Java | platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java | myvyang/intellij-community | 8b5734173a6c2ae0e3c8627e884d8476692a6576 | [
"Apache-2.0"
] | null | null | null | platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java | myvyang/intellij-community | 8b5734173a6c2ae0e3c8627e884d8476692a6576 | [
"Apache-2.0"
] | null | null | null | platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java | myvyang/intellij-community | 8b5734173a6c2ae0e3c8627e884d8476692a6576 | [
"Apache-2.0"
] | 1 | 2020-11-27T10:36:50.000Z | 2020-11-27T10:36:50.000Z | 35.377401 | 134 | 0.709445 | 6,954 | /*
* Copyright 2000-2015 JetBrains s.r.o.
*
* 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.intellij.openapi.editor.impl;
import com.intellij.diagnostic.Dumpable;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Attachment;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.FontPreferences;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.ex.*;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.editor.impl.softwrap.*;
import com.intellij.openapi.editor.impl.softwrap.mapping.CachingSoftWrapDataMapper;
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager;
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareDocumentParsingListenerAdapter;
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareVisualSizeManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.reference.SoftReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Default {@link SoftWrapModelEx} implementation.
* <p/>
* Works as a mix of <code>GoF Facade and Bridge</code>, i.e. delegates the processing to the target sub-components and provides
* utility methods built on top of sub-components API.
* <p/>
* Not thread-safe.
*
* @author Denis Zhdanov
* @since Jun 8, 2010 12:47:32 PM
*/
public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedInternalDocumentListener, FoldingListener,
PropertyChangeListener, Dumpable, Disposable
{
/**
* Holds name of JVM property which presence should trigger debug-aware soft wraps processing.
*/
private static final String DEBUG_PROPERTY_NAME = "idea.editor.wrap.soft.debug";
private static final Logger LOG = Logger.getInstance("#" + SoftWrapModelImpl.class.getName());
private final LogicalPositionToOffsetTask myLogicalToOffsetTask = new LogicalPositionToOffsetTask();
private final OffsetToLogicalTask myOffsetToLogicalTask = new OffsetToLogicalTask();
private final VisualToLogicalTask myVisualToLogicalTask = new VisualToLogicalTask();
private final LogicalToVisualTask myLogicalToVisualTask = new LogicalToVisualTask();
private final FoldProcessingEndTask myFoldProcessingEndTask = new FoldProcessingEndTask();
private final List<SoftWrapChangeListener> mySoftWrapListeners = new ArrayList<SoftWrapChangeListener>();
/**
* There is a possible case that particular activity performs batch fold regions operations (addition, removal etc).
* We don't want to process them at the same time we get notifications about that because there is a big chance that
* we see inconsistent state (e.g. there was a problem with {@link FoldingModel#getCollapsedRegionAtOffset(int)} because that
* method uses caching internally and cached data becomes inconsistent if, for example, the top region is removed).
* <p/>
* So, our strategy is to collect information about changed fold regions and process it only when batch folding processing ends.
*/
private final List<TextRange> myDeferredFoldRegions = new ArrayList<TextRange>();
private final CachingSoftWrapDataMapper myDataMapper;
private final SoftWrapsStorage myStorage;
private SoftWrapPainter myPainter;
private final SoftWrapApplianceManager myApplianceManager;
private final SoftWrapAwareVisualSizeManager myVisualSizeManager;
private EditorTextRepresentationHelper myEditorTextRepresentationHelper;
@NotNull
private final EditorImpl myEditor;
/**
* We don't want to use soft wraps-aware processing from non-EDT and profiling shows that 'is EDT' check that is called too
* often is rather expensive. Hence, we use caching here for performance improvement.
*/
private SoftReference<Thread> myLastEdt = new SoftReference<Thread>(null);
/** Holds number of 'active' calls, i.e. number of methods calls of the current object within the current call stack. */
private int myActive;
private boolean myUseSoftWraps;
private int myTabWidth = -1;
private final FontPreferences myFontPreferences = new FontPreferences();
/**
* Soft wraps need to be kept up-to-date on all editor modification (changing text, adding/removing/expanding/collapsing fold
* regions etc). Hence, we need to react to all types of target changes. However, soft wraps processing uses various information
* provided by editor and there is a possible case that that information is inconsistent during update time (e.g. fold model
* advances fold region offsets when end-user types before it, hence, fold regions data is inconsistent between the moment
* when text changes are applied to the document and fold data is actually updated).
* <p/>
* Current field serves as a flag that indicates if all preliminary actions necessary for successful soft wraps processing is done.
*/
private boolean myUpdateInProgress;
private boolean myBulkUpdateInProgress;
/**
* There is a possible case that target document is changed while its editor is inactive (e.g. user opens two editors for classes
* <code>'Part'</code> and <code>'Whole'</code>; activates editor for the class <code>'Whole'</code> and performs 'rename class'
* for <code>'Part'</code> from it). Soft wraps cache is not recalculated during that because corresponding editor is not shown
* and we lack information about visible area width. Hence, we will need to recalculate the whole soft wraps cache as soon
* as target editor becomes visible.
* <p/>
* Current field serves as a flag for that <code>'dirty document, need complete soft wraps cache recalculation'</code> state.
*/
private boolean myDirty;
private boolean myForceAdditionalColumns;
public SoftWrapModelImpl(@NotNull EditorImpl editor) {
myEditor = editor;
myStorage = new SoftWrapsStorage();
myPainter = new CompositeSoftWrapPainter(editor);
myEditorTextRepresentationHelper = new DefaultEditorTextRepresentationHelper(editor);
myDataMapper = new CachingSoftWrapDataMapper(editor, myStorage);
myApplianceManager = new SoftWrapApplianceManager(myStorage, editor, myPainter, myDataMapper);
myVisualSizeManager = new SoftWrapAwareVisualSizeManager(myPainter);
myApplianceManager.addListener(myVisualSizeManager);
myApplianceManager.addListener(new SoftWrapAwareDocumentParsingListenerAdapter() {
@Override
public void recalculationEnds() {
for (SoftWrapChangeListener listener : mySoftWrapListeners) {
listener.recalculationEnds();
}
}
});
myUseSoftWraps = areSoftWrapsEnabledInEditor();
myEditor.getColorsScheme().getFontPreferences().copyTo(myFontPreferences);
editor.addPropertyChangeListener(this, this);
myApplianceManager.addListener(myDataMapper);
}
private boolean areSoftWrapsEnabledInEditor() {
return myEditor.getSettings().isUseSoftWraps() && (!myEditor.myUseNewRendering || !myEditor.isOneLineMode())
&& (!(myEditor.getDocument() instanceof DocumentImpl) || !((DocumentImpl)myEditor.getDocument()).acceptsSlashR());
}
/**
* Called on editor settings change. Current model is expected to drop all cached information about the settings if any.
*/
public void reinitSettings() {
boolean softWrapsUsedBefore = myUseSoftWraps;
myUseSoftWraps = areSoftWrapsEnabledInEditor();
int tabWidthBefore = myTabWidth;
myTabWidth = EditorUtil.getTabSize(myEditor);
boolean fontsChanged = false;
if (!myFontPreferences.equals(myEditor.getColorsScheme().getFontPreferences())
&& myEditorTextRepresentationHelper instanceof DefaultEditorTextRepresentationHelper) {
fontsChanged = true;
myEditor.getColorsScheme().getFontPreferences().copyTo(myFontPreferences);
((DefaultEditorTextRepresentationHelper)myEditorTextRepresentationHelper).clearSymbolWidthCache();
myPainter.reinit();
}
if ((myUseSoftWraps ^ softWrapsUsedBefore) || (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore) || fontsChanged) {
myApplianceManager.reset();
myDeferredFoldRegions.clear();
myStorage.removeAll();
if (myEditor.myUseNewRendering) {
myEditor.myView.reinitSettings();
}
myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
}
}
@Override
public boolean isRespectAdditionalColumns() {
return myForceAdditionalColumns;
}
@Override
public void forceAdditionalColumnsUsage() {
myForceAdditionalColumns = true;
}
@Override
public boolean isSoftWrappingEnabled() {
if (!myUseSoftWraps || (!myEditor.myUseNewRendering && myEditor.isOneLineMode()) || myEditor.isPurePaintingMode()) {
return false;
}
// We check that current thread is EDT because attempt to retrieve information about visible area width may fail otherwise
Application application = ApplicationManager.getApplication();
Thread lastEdt = myLastEdt.get();
Thread currentThread = Thread.currentThread();
if (lastEdt != currentThread) {
if (application.isDispatchThread()) {
myLastEdt = new SoftReference<Thread>(currentThread);
}
else {
myLastEdt = new SoftReference<Thread>(null);
return false;
}
}
return !myApplianceManager.getAvailableArea().isEmpty();
}
@Override
@Nullable
public SoftWrap getSoftWrap(int offset) {
if (!isSoftWrappingEnabled()) {
return null;
}
return myStorage.getSoftWrap(offset);
}
@Override
public int getSoftWrapIndex(int offset) {
if (myEditor.myUseNewRendering && !isSoftWrappingEnabled()) {
return -1;
}
return myStorage.getSoftWrapIndex(offset);
}
@NotNull
@Override
public List<? extends SoftWrap> getSoftWrapsForRange(int start, int end) {
if (!isSoftWrappingEnabled() || end < start) {
return Collections.emptyList();
}
List<? extends SoftWrap> softWraps = myStorage.getSoftWraps();
int startIndex = myStorage.getSoftWrapIndex(start);
if (startIndex < 0) {
startIndex = -startIndex - 1;
if (startIndex >= softWraps.size() || softWraps.get(startIndex).getStart() > end) {
return Collections.emptyList();
}
}
int endIndex = myStorage.getSoftWrapIndex(end);
if (endIndex >= 0) {
return softWraps.subList(startIndex, endIndex + 1);
}
else {
endIndex = -endIndex - 1;
return softWraps.subList(startIndex, endIndex);
}
}
@Override
@NotNull
public List<? extends SoftWrap> getSoftWrapsForLine(int documentLine) {
if (!isSoftWrappingEnabled() || documentLine < 0) {
return Collections.emptyList();
}
Document document = myEditor.getDocument();
if (documentLine >= document.getLineCount()) {
return Collections.emptyList();
}
int start = document.getLineStartOffset(documentLine);
int end = document.getLineEndOffset(documentLine);
return getSoftWrapsForRange(start, end + 1/* it's theoretically possible that soft wrap is registered just before the line feed,
* hence, we add '1' here assuming that end line offset points to line feed symbol */
);
}
/**
* @return total number of soft wrap-introduced new visual lines
*/
public int getSoftWrapsIntroducedLinesNumber() {
return myStorage.getSoftWraps().size(); // Assuming that soft wrap has single line feed all the time
}
/**
* Callback method that is expected to be invoked before editor painting.
* <p/>
* It's primary purpose is to recalculate soft wraps at least for the painted area if necessary.
*/
public void registerSoftWrapsIfNecessary() {
if (!isSoftWrappingEnabled()) {
return;
}
myActive++;
try {
myApplianceManager.registerSoftWrapIfNecessary();
}
finally {
myActive--;
}
}
@Override
public List<? extends SoftWrap> getRegisteredSoftWraps() {
if (!isSoftWrappingEnabled()) {
return Collections.emptyList();
}
List<SoftWrapImpl> softWraps = myStorage.getSoftWraps();
if (!softWraps.isEmpty() && softWraps.get(softWraps.size() - 1).getStart() >= myEditor.getDocument().getTextLength()) {
LOG.error("Unexpected soft wrap location", new Attachment("editorState.txt", myEditor.dumpState()));
}
return softWraps;
}
@Override
public boolean isVisible(SoftWrap softWrap) {
FoldingModel foldingModel = myEditor.getFoldingModel();
int start = softWrap.getStart();
if (foldingModel.isOffsetCollapsed(start)) {
return false;
}
// There is a possible case that soft wrap and collapsed folding region share the same offset, i.e. soft wrap is represented
// before the folding. We need to return 'true' in such situation. Hence, we check if offset just before the soft wrap
// is collapsed as well.
return start <= 0 || !foldingModel.isOffsetCollapsed(start - 1);
}
@Override
public int paint(@NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) {
if (!isSoftWrappingEnabled()) {
return 0;
}
if (!myEditor.getSettings().isAllSoftWrapsShown()) {
int visualLine = y / lineHeight;
LogicalPosition position = myEditor.visualToLogicalPosition(new VisualPosition(visualLine, 0));
if (position.line != myEditor.getCaretModel().getLogicalPosition().line) {
return myPainter.getDrawingHorizontalOffset(g, drawingType, x, y, lineHeight);
}
}
return doPaint(g, drawingType, x, y, lineHeight);
}
public int doPaint(@NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) {
return myPainter.paint(g, drawingType, x, y, lineHeight);
}
@Override
public int getMinDrawingWidthInPixels(@NotNull SoftWrapDrawingType drawingType) {
return myPainter.getMinDrawingWidth(drawingType);
}
@NotNull
@Override
public LogicalPosition visualToLogicalPosition(@NotNull VisualPosition visual) {
if (!prepareToMapping()) {
return myEditor.visualToLogicalPosition(visual, false);
}
myActive++;
try {
myVisualToLogicalTask.input = visual;
executeSafely(myVisualToLogicalTask);
return myVisualToLogicalTask.output;
} finally {
myActive--;
}
}
@NotNull
@Override
public LogicalPosition offsetToLogicalPosition(int offset) {
if (!prepareToMapping()) {
return myEditor.offsetToLogicalPosition(offset, false);
}
myActive++;
try {
myOffsetToLogicalTask.input = offset;
executeSafely(myOffsetToLogicalTask);
return myOffsetToLogicalTask.output;
} finally {
myActive--;
}
}
@Override
public int logicalPositionToOffset(@NotNull LogicalPosition logicalPosition) {
if (!prepareToMapping()) {
return myEditor.logicalPositionToOffset(logicalPosition, false);
}
myActive++;
try {
myLogicalToOffsetTask.input = logicalPosition;
executeSafely(myLogicalToOffsetTask);
return myLogicalToOffsetTask.output;
} finally {
myActive--;
}
}
@NotNull
public LogicalPosition adjustLogicalPosition(LogicalPosition defaultLogical, int offset) {
if (!prepareToMapping()) {
return defaultLogical;
}
myActive++;
try {
myOffsetToLogicalTask.input = offset;
executeSafely(myOffsetToLogicalTask);
return myOffsetToLogicalTask.output;
} finally {
myActive--;
}
}
@Override
@NotNull
public VisualPosition adjustVisualPosition(@NotNull LogicalPosition logical, @NotNull VisualPosition defaultVisual) {
if (!prepareToMapping()) {
return defaultVisual;
}
myActive++;
try {
myLogicalToVisualTask.input = logical;
myLogicalToVisualTask.defaultOutput = defaultVisual;
executeSafely(myLogicalToVisualTask);
return myLogicalToVisualTask.output;
}
finally {
myActive--;
}
}
/**
* Encapsulates preparations for performing document dimension mapping (e.g. visual to logical position) and answers
* if soft wraps-aware processing should be used (e.g. there is no need to consider soft wraps if user configured them
* not to be used).
*
* @return <code>true</code> if soft wraps-aware processing should be used; <code>false</code> otherwise
*/
public boolean prepareToMapping() {
if (myUpdateInProgress || myBulkUpdateInProgress ||
myActive > 0 || !isSoftWrappingEnabled() || myEditor.getDocument().getTextLength() <= 0) {
return false;
}
if (myDirty) {
myStorage.removeAll();
myApplianceManager.reset();
myDeferredFoldRegions.clear();
myDirty = false;
}
return myApplianceManager.recalculateIfNecessary();
}
/**
* Allows to answer if given visual position points to soft wrap-introduced virtual space.
*
* @param visual target visual position to check
* @return <code>true</code> if given visual position points to soft wrap-introduced virtual space;
* <code>false</code> otherwise
*/
@Override
public boolean isInsideSoftWrap(@NotNull VisualPosition visual) {
return isInsideSoftWrap(visual, false);
}
/**
* Allows to answer if given visual position points to soft wrap-introduced virtual space or points just before soft wrap.
*
* @param visual target visual position to check
* @return <code>true</code> if given visual position points to soft wrap-introduced virtual space;
* <code>false</code> otherwise
*/
@Override
public boolean isInsideOrBeforeSoftWrap(@NotNull VisualPosition visual) {
return isInsideSoftWrap(visual, true);
}
private boolean isInsideSoftWrap(@NotNull VisualPosition visual, boolean countBeforeSoftWrap) {
if (!isSoftWrappingEnabled()) {
return false;
}
SoftWrapModel model = myEditor.getSoftWrapModel();
if (!model.isSoftWrappingEnabled()) {
return false;
}
LogicalPosition logical = myEditor.visualToLogicalPosition(visual);
int offset = myEditor.logicalPositionToOffset(logical);
if (offset <= 0) {
// Never expect to be here, just a defensive programming.
return false;
}
SoftWrap softWrap = model.getSoftWrap(offset);
if (softWrap == null) {
return false;
}
// We consider visual positions that point after the last symbol before soft wrap and the first symbol after soft wrap to not
// belong to soft wrap-introduced virtual space.
VisualPosition visualAfterSoftWrap = myEditor.offsetToVisualPosition(offset);
if (visualAfterSoftWrap.line == visual.line && visualAfterSoftWrap.column <= visual.column) {
return false;
}
if (myEditor.myUseNewRendering) {
VisualPosition beforeSoftWrap = myEditor.offsetToVisualPosition(offset, true, true);
return visual.line > beforeSoftWrap.line ||
visual.column > beforeSoftWrap.column || visual.column == beforeSoftWrap.column && countBeforeSoftWrap;
}
else {
VisualPosition visualBeforeSoftWrap = myEditor.offsetToVisualPosition(offset - 1);
int x = 0;
LogicalPosition logLineStart = myEditor.visualToLogicalPosition(new VisualPosition(visualBeforeSoftWrap.line, 0));
if (logLineStart.softWrapLinesOnCurrentLogicalLine > 0) {
int offsetLineStart = myEditor.logicalPositionToOffset(logLineStart);
softWrap = model.getSoftWrap(offsetLineStart);
if (softWrap != null) {
x = softWrap.getIndentInPixels();
}
}
int width = EditorUtil.textWidthInColumns(myEditor, myEditor.getDocument().getCharsSequence(), offset - 1, offset, x);
int softWrapStartColumn = visualBeforeSoftWrap.column + width;
if (visual.line > visualBeforeSoftWrap.line) {
return true;
}
return countBeforeSoftWrap ? visual.column >= softWrapStartColumn : visual.column > softWrapStartColumn;
}
}
@Override
public void beforeDocumentChangeAtCaret() {
CaretModel caretModel = myEditor.getCaretModel();
VisualPosition visualCaretPosition = caretModel.getVisualPosition();
if (!isInsideSoftWrap(visualCaretPosition)) {
return;
}
SoftWrap softWrap = myStorage.getSoftWrap(caretModel.getOffset());
if (softWrap == null) {
return;
}
myEditor.getDocument().replaceString(softWrap.getStart(), softWrap.getEnd(), softWrap.getText());
caretModel.moveToVisualPosition(visualCaretPosition);
}
@Override
public boolean addSoftWrapChangeListener(@NotNull SoftWrapChangeListener listener) {
mySoftWrapListeners.add(listener);
return myStorage.addSoftWrapChangeListener(listener);
}
public boolean addVisualSizeChangeListener(@NotNull VisualSizeChangeListener listener) {
return myVisualSizeManager.addVisualSizeChangeListener(listener);
}
@Override
public int getPriority() {
return EditorDocumentPriorities.SOFT_WRAP_MODEL;
}
@Override
public void beforeDocumentChange(DocumentEvent event) {
if (myBulkUpdateInProgress) {
return;
}
myUpdateInProgress = true;
if (!isSoftWrappingEnabled()) {
myDirty = true;
return;
}
myApplianceManager.beforeDocumentChange(event);
}
@Override
public void documentChanged(DocumentEvent event) {
if (myBulkUpdateInProgress) {
return;
}
myUpdateInProgress = false;
if (!isSoftWrappingEnabled()) {
return;
}
myApplianceManager.documentChanged(event);
}
@Override
public void moveTextHappened(int start, int end, int base) {
if (myBulkUpdateInProgress) {
return;
}
if (!isSoftWrappingEnabled()) {
myDirty = true;
return;
}
myApplianceManager.recalculate(Arrays.asList(new TextRange(start, end), new TextRange(base, base + end - start)));
}
void onBulkDocumentUpdateStarted() {
myBulkUpdateInProgress = true;
}
void onBulkDocumentUpdateFinished() {
myBulkUpdateInProgress = false;
if (!isSoftWrappingEnabled()) {
myDirty = true;
return;
}
recalculate();
}
@Override
public void onFoldRegionStateChange(@NotNull FoldRegion region) {
myUpdateInProgress = true;
if (!isSoftWrappingEnabled() || !region.isValid()) {
myDirty = true;
return;
}
// We delay processing of changed fold regions till the invocation of onFoldProcessingEnd(), as
// FoldingModel can return inconsistent data before that moment.
myDeferredFoldRegions.add(new TextRange(region.getStartOffset(), region.getEndOffset()));
}
@Override
public void onFoldProcessingEnd() {
myUpdateInProgress = false;
if (!isSoftWrappingEnabled()) {
return;
}
if (myEditor.myUseNewRendering) {
myFoldProcessingEndTask.run(true);
}
else {
executeSafely(myFoldProcessingEndTask);
}
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (EditorEx.PROP_FONT_SIZE.equals(evt.getPropertyName())) {
myDirty = true;
}
}
@NotNull
public CachingSoftWrapDataMapper getDataMapper() {
return myDataMapper;
}
@Override
public void dispose() {
release();
}
@Override
public void release() {
myDataMapper.release();
myApplianceManager.release();
myStorage.removeAll();
myDeferredFoldRegions.clear();
}
public void recalculate() {
myApplianceManager.reset();
myStorage.removeAll();
myDeferredFoldRegions.clear();
myApplianceManager.recalculateIfNecessary();
}
public SoftWrapApplianceManager getApplianceManager() {
return myApplianceManager;
}
/**
* We know that there are problems with incremental soft wraps cache update at the moment. Hence, we may implement full cache
* reconstruction when the problem is encountered in order to avoid customer annoyance.
* <p/>
* However, the problems still should be fixed, hence, we report them only if dedicated flag is set.
* <p/>
* Current method encapsulates the logic mentioned above.
*
* @param task command object that which execution may trigger incremental update of update soft wraps cache
*/
@SuppressWarnings({"UseOfArchaicSystemPropertyAccessors"})
private void executeSafely(SoftWrapAwareTask task) {
try {
task.run(true);
} catch (Throwable e) {
if (Boolean.getBoolean(DEBUG_PROPERTY_NAME) || ApplicationManager.getApplication().isUnitTestMode()) {
String info = myEditor.dumpState();
LOG.error(String.format("Unexpected exception occurred during performing '%s'", task), e, info);
}
myEditor.getFoldingModel().rebuild();
myDataMapper.release();
myApplianceManager.reset();
myStorage.removeAll();
myApplianceManager.recalculateIfNecessary();
try {
task.run(true);
}
catch (Throwable e1) {
String info = myEditor.dumpState();
LOG.error(String.format("Can't perform %s even with complete soft wraps cache re-parsing", task), e1, info);
myEditor.getSettings().setUseSoftWraps(false);
task.run(false);
}
}
}
@TestOnly
public void setSoftWrapPainter(SoftWrapPainter painter) {
myPainter = painter;
myApplianceManager.setSoftWrapPainter(painter);
myVisualSizeManager.setSoftWrapPainter(painter);
}
public static EditorTextRepresentationHelper getEditorTextRepresentationHelper(@NotNull Editor editor) {
return ((SoftWrapModelEx)editor.getSoftWrapModel()).getEditorTextRepresentationHelper();
}
public EditorTextRepresentationHelper getEditorTextRepresentationHelper() {
return myEditorTextRepresentationHelper;
}
@TestOnly
public void setEditorTextRepresentationHelper(EditorTextRepresentationHelper editorTextRepresentationHelper) {
myEditorTextRepresentationHelper = editorTextRepresentationHelper;
myApplianceManager.reset();
}
@NotNull
@Override
public String dumpState() {
return String.format("\nuse soft wraps: %b, tab width: %d, additional columns: %b, " +
"update in progress: %b, bulk update in progress: %b, active: %b, dirty: %b, deferred regions: %s" +
"\nappliance manager state: %s\nsoft wraps mapping info: %s\nsoft wraps: %s",
myUseSoftWraps, myTabWidth, myForceAdditionalColumns, myUpdateInProgress, myBulkUpdateInProgress, myActive,
myDirty, myDeferredFoldRegions.toString(),
myApplianceManager.dumpState(), myDataMapper.dumpState(), myStorage.dumpState());
}
@Override
public String toString() {
return dumpState();
}
public boolean isDirty() {
return myUseSoftWraps && myDirty;
}
/**
* Defines generic interface for the command that may be proceeded in both <code>'soft wraps aware'</code> and
* <code>'soft wraps unaware'</code> modes.
*/
private interface SoftWrapAwareTask {
/**
* Asks current task to do the job.
* <p/>
* It's assumed that input data (if any) is already stored at the task object. Processing result (if any) is assumed
* to be stored there as well for further retrieval in implementation-specific manner.
*
* @param softWrapAware flag that indicates if soft wraps-aware processing should be performed
* @throws IllegalStateException in case of inability to do the job
*/
void run(boolean softWrapAware) throws IllegalStateException;
}
private class OffsetToLogicalTask implements SoftWrapAwareTask {
public int input;
public LogicalPosition output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
if (softWrapAware) {
output = myDataMapper.offsetToLogicalPosition(input);
}
else {
output = myEditor.offsetToLogicalPosition(input, false);
}
}
@Override
public String toString() {
return "mapping from offset (" + input + ") to logical position";
}
}
private class VisualToLogicalTask implements SoftWrapAwareTask {
public VisualPosition input;
public LogicalPosition output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
if (softWrapAware) {
output = myDataMapper.visualToLogical(input);
}
else {
output = myEditor.visualToLogicalPosition(input, false);
}
}
@Override
public String toString() {
return "mapping from visual position (" + input + ") to logical position";
}
}
private class LogicalToVisualTask implements SoftWrapAwareTask {
public LogicalPosition input;
private VisualPosition defaultOutput;
public VisualPosition output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
output = softWrapAware ? myDataMapper.logicalToVisualPosition(input, defaultOutput) : defaultOutput;
}
@Override
public String toString() {
return "mapping from logical position (" + input + ") to visual position";
}
}
private class LogicalPositionToOffsetTask implements SoftWrapAwareTask {
public LogicalPosition input;
public int output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
output = softWrapAware ? myDataMapper.logicalPositionToOffset(input) : myEditor.logicalPositionToOffset(input, false);
}
@Override
public String toString() {
return "mapping from logical position (" + input + ") to offset";
}
}
private class FoldProcessingEndTask implements SoftWrapAwareTask {
@Override
public void run(boolean softWrapAware) {
if (!softWrapAware) {
return;
}
try {
if (!myDirty) { // no need to recalculate specific areas if the whole document will be reprocessed
myApplianceManager.recalculate(myDeferredFoldRegions);
}
}
finally {
myDeferredFoldRegions.clear();
}
}
@Override
public String toString() {
return "fold regions state change processing";
}
}
}
|
3e106dc2bc1127a3da09e8352bcb9a71396df8c3 | 1,539 | java | Java | amzKit/src/main/java/amz/kit/entity/response/TransactionBroadcast.java | AmzDevelopmentTeam/amzkit4j | 36be70d6ec56362ae04eaa8a49fa87dc9ab22c19 | [
"Apache-2.0"
] | null | null | null | amzKit/src/main/java/amz/kit/entity/response/TransactionBroadcast.java | AmzDevelopmentTeam/amzkit4j | 36be70d6ec56362ae04eaa8a49fa87dc9ab22c19 | [
"Apache-2.0"
] | null | null | null | amzKit/src/main/java/amz/kit/entity/response/TransactionBroadcast.java | AmzDevelopmentTeam/amzkit4j | 36be70d6ec56362ae04eaa8a49fa87dc9ab22c19 | [
"Apache-2.0"
] | 1 | 2021-08-06T20:47:20.000Z | 2021-08-06T20:47:20.000Z | 34.2 | 120 | 0.735543 | 6,955 | package amz.kit.entity.response;
import amz.kit.crypto.AmzCrypto;
import amz.kit.entity.AmzID;
import amz.kit.entity.response.http.BroadcastTransactionResponse;
import amz.kit.service.impl.grpc.BrsApi;
import org.bouncycastle.util.encoders.Hex;
public class TransactionBroadcast {
private final byte[] fullHash;
private final AmzID transactionId;
private final int numberPeersSentTo;
public TransactionBroadcast(byte[] fullHash, AmzID transactionId, int numberPeersSentTo) {
this.fullHash = fullHash;
this.transactionId = transactionId;
this.numberPeersSentTo = numberPeersSentTo;
}
public TransactionBroadcast(BroadcastTransactionResponse response) {
this.fullHash = Hex.decode(response.getFullHash());
this.transactionId = AmzID.fromLong(response.getTransactionID());
this.numberPeersSentTo = response.getNumberPeersSentTo();
}
public TransactionBroadcast(BrsApi.TransactionBroadcastResult transactionBroadcastResult, byte[] transactionBytes) {
AmzCrypto amzCrypto = AmzCrypto.getInstance();
this.fullHash = amzCrypto.getSha256().digest(transactionBytes);
this.transactionId = amzCrypto.hashToId(this.fullHash);
this.numberPeersSentTo = transactionBroadcastResult.getNumberOfPeersSentTo();
}
public byte[] getFullHash() {
return fullHash;
}
public AmzID getTransactionId() {
return transactionId;
}
public int getNumberPeersSentTo() {
return numberPeersSentTo;
}
}
|
3e106e03a352165ae392d1e3e772c5c403a2dea2 | 3,784 | java | Java | plugins/org.jkiss.dbeaver.ext.postgresql.ui/src/org/jkiss/dbeaver/ext/postgresql/ui/editors/PostgreSourceViewEditor.java | Cynyard999/dbeaver | 29b44b16cfb5291c96fdec1a1a50e6b76e1c1d68 | [
"Apache-2.0"
] | 22,779 | 2017-12-23T15:47:03.000Z | 2022-03-31T15:48:15.000Z | plugins/org.jkiss.dbeaver.ext.postgresql.ui/src/org/jkiss/dbeaver/ext/postgresql/ui/editors/PostgreSourceViewEditor.java | Cynyard999/dbeaver | 29b44b16cfb5291c96fdec1a1a50e6b76e1c1d68 | [
"Apache-2.0"
] | 10,922 | 2017-12-23T12:01:39.000Z | 2022-03-31T23:52:18.000Z | plugins/org.jkiss.dbeaver.ext.postgresql.ui/src/org/jkiss/dbeaver/ext/postgresql/ui/editors/PostgreSourceViewEditor.java | Cynyard999/dbeaver | 29b44b16cfb5291c96fdec1a1a50e6b76e1c1d68 | [
"Apache-2.0"
] | 2,552 | 2017-12-26T21:31:27.000Z | 2022-03-31T09:05:03.000Z | 36.384615 | 140 | 0.703224 | 6,956 | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.postgresql.ui.editors;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.Separator;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreProcedure;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreScriptObject;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreTrigger;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreViewBase;
import org.jkiss.dbeaver.model.DBIcon;
import org.jkiss.dbeaver.model.DBPScriptObject;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.ui.ActionUtils;
import org.jkiss.dbeaver.ui.DBeaverIcons;
import org.jkiss.dbeaver.ui.editors.sql.SQLSourceViewer;
import org.jkiss.utils.CommonUtils;
import java.util.Map;
/**
* PostgreSourceViewEditor
*/
public class PostgreSourceViewEditor extends SQLSourceViewer<PostgreScriptObject> {
public PostgreSourceViewEditor() {
}
@Override
protected boolean isReadOnly()
{
PostgreScriptObject sourceObject = getSourceObject();
if (sourceObject instanceof PostgreProcedure || sourceObject instanceof PostgreTrigger || sourceObject instanceof PostgreViewBase) {
return false;
}
return true;
}
@Override
protected boolean isAnnotationRulerVisible() {
return getSourceObject() instanceof PostgreProcedure;
}
@Override
protected void setSourceText(DBRProgressMonitor monitor, String sourceText)
{
getInputPropertySource().setPropertyValue(monitor, "objectDefinitionText", sourceText);
}
@Override
protected void contributeEditorCommands(IContributionManager contributionManager)
{
super.contributeEditorCommands(contributionManager);
PostgreScriptObject sourceObject = getSourceObject();
if (sourceObject instanceof PostgreProcedure) {
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeActionContribution(
new Action("Show header", Action.AS_CHECK_BOX) {
{
setImageDescriptor(DBeaverIcons.getImageDescriptor(DBIcon.TREE_PROCEDURE));
setToolTipText("Shows auto-generated function header");
setChecked(!isInDebugMode());
}
@Override
public void run() {
getDatabaseEditorInput().setAttribute(DBPScriptObject.OPTION_DEBUGGER_SOURCE, !isChecked());
refreshPart(PostgreSourceViewEditor.this, true);
}
}, true));
}
}
@Override
protected Map<String, Object> getSourceOptions() {
Map<String, Object> options = super.getSourceOptions();
options.put(DBPScriptObject.OPTION_DEBUGGER_SOURCE, isInDebugMode());
return options;
}
private boolean isInDebugMode() {
return CommonUtils.getBoolean(
getDatabaseEditorInput().getAttribute(DBPScriptObject.OPTION_DEBUGGER_SOURCE), false);
}
}
|
3e106f66eb9754f2390e28cf634093d2e2d2c04c | 1,390 | java | Java | W_eclipse1_1/Project2_2_3/gen/org/crazyit/uiProject2_2_3/R.java | 00wendi00/MyProject | 204a659c2d535d8ff588f6d926bf0edc7f417661 | [
"Apache-2.0"
] | 1 | 2019-04-28T11:57:07.000Z | 2019-04-28T11:57:07.000Z | W_eclipse1_1/Project2_2_3/gen/org/crazyit/uiProject2_2_3/R.java | 00wendi00/MyProject | 204a659c2d535d8ff588f6d926bf0edc7f417661 | [
"Apache-2.0"
] | null | null | null | W_eclipse1_1/Project2_2_3/gen/org/crazyit/uiProject2_2_3/R.java | 00wendi00/MyProject | 204a659c2d535d8ff588f6d926bf0edc7f417661 | [
"Apache-2.0"
] | null | null | null | 33.902439 | 60 | 0.694245 | 6,957 | /* 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 org.crazyit.uiProject2_2_3;
public final class R {
public static final class attr {
}
public static final class color {
public static final int color1=0x7f040000;
public static final int color2=0x7f040001;
public static final int color3=0x7f040002;
public static final int color4=0x7f040003;
public static final int color5=0x7f040004;
public static final int color6=0x7f040005;
}
public static final class drawable {
public static final int ic_action_search=0x7f020000;
public static final int ic_launcher=0x7f020001;
}
public static final class id {
public static final int view01=0x7f060000;
public static final int view02=0x7f060001;
public static final int view03=0x7f060002;
public static final int view04=0x7f060003;
public static final int view05=0x7f060004;
public static final int view06=0x7f060005;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f050001;
public static final int hello=0x7f050000;
}
}
|
3e106f951efd7a46ea077956fe063cdee913d005 | 373 | java | Java | src/de/dimm/vsm/vaadin/GuiElems/Fields/JPAPasswordField.java | markymarkmk2/VSMGui | 43e3e16b131865975c5574048155e12d9e757dd7 | [
"Apache-2.0"
] | null | null | null | src/de/dimm/vsm/vaadin/GuiElems/Fields/JPAPasswordField.java | markymarkmk2/VSMGui | 43e3e16b131865975c5574048155e12d9e757dd7 | [
"Apache-2.0"
] | null | null | null | src/de/dimm/vsm/vaadin/GuiElems/Fields/JPAPasswordField.java | markymarkmk2/VSMGui | 43e3e16b131865975c5574048155e12d9e757dd7 | [
"Apache-2.0"
] | null | null | null | 18.65 | 61 | 0.678284 | 6,958 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package de.dimm.vsm.vaadin.GuiElems.Fields;
/**
*
* @author Administrator
*/
public class JPAPasswordField extends JPATextField
{
public JPAPasswordField(String caption, String fieldName)
{
super( caption, fieldName );
password = true;
}
}
|
3e10701beead751aeb5121cbb9202746a20e7fc9 | 1,541 | java | Java | Ex_Files_SpringBoot2_EssT/Exercise Files/Chapter 5/05_03/05_03_End/room-web-app/src/main/java/com/frankmoley/boot/landon/roomwebapp/SecurityConfiguration.java | cinthiatengan/Spring-LinkedinLearning | 864af19891601432bf66c6addada61e248380170 | [
"MIT"
] | null | null | null | Ex_Files_SpringBoot2_EssT/Exercise Files/Chapter 5/05_03/05_03_End/room-web-app/src/main/java/com/frankmoley/boot/landon/roomwebapp/SecurityConfiguration.java | cinthiatengan/Spring-LinkedinLearning | 864af19891601432bf66c6addada61e248380170 | [
"MIT"
] | null | null | null | Ex_Files_SpringBoot2_EssT/Exercise Files/Chapter 5/05_03/05_03_End/room-web-app/src/main/java/com/frankmoley/boot/landon/roomwebapp/SecurityConfiguration.java | cinthiatengan/Spring-LinkedinLearning | 864af19891601432bf66c6addada61e248380170 | [
"MIT"
] | null | null | null | 41.648649 | 107 | 0.730694 | 6,959 | package com.frankmoley.boot.landon.roomwebapp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.proxy.NoOp;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter{
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/", "/api/*").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception{
auth.inMemoryAuthentication()
.passwordEncoder(NoOpPasswordEncoder.getInstance())
.withUser("user").password("password").roles("USER");
}
}
|
3e1070ced4e62c4ca90502007834410509565bf2 | 478 | java | Java | Lab5/src/Business/ProductDirectory.java | SaurabhGujare/LawyerFinder | 91e1e7be42ee32f4274a19feaa981f07ac599ad3 | [
"MIT"
] | null | null | null | Lab5/src/Business/ProductDirectory.java | SaurabhGujare/LawyerFinder | 91e1e7be42ee32f4274a19feaa981f07ac599ad3 | [
"MIT"
] | null | null | null | Lab5/src/Business/ProductDirectory.java | SaurabhGujare/LawyerFinder | 91e1e7be42ee32f4274a19feaa981f07ac599ad3 | [
"MIT"
] | null | null | null | 16.482759 | 59 | 0.629707 | 6,960 | package Business;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Ninad, Akshay, Saurabh
*/
public class ProductDirectory {
private List<Product> productList;
public ProductDirectory(){
productList = new ArrayList<>();
}
public List<Product> getProductList() {
return productList;
}
public void setProductList(List<Product> productList) {
this.productList = productList;
}
}
|
3e1070e69ae3aa1aa714f3224bc211878fd20ebc | 3,757 | java | Java | wb-misc/src/main/java/org/limewire/cef/CefBrowser_N.java | dvoytenko/WB | aca3d382a861811c14e419eb089da5f6e11c5caf | [
"MIT"
] | null | null | null | wb-misc/src/main/java/org/limewire/cef/CefBrowser_N.java | dvoytenko/WB | aca3d382a861811c14e419eb089da5f6e11c5caf | [
"MIT"
] | null | null | null | wb-misc/src/main/java/org/limewire/cef/CefBrowser_N.java | dvoytenko/WB | aca3d382a861811c14e419eb089da5f6e11c5caf | [
"MIT"
] | null | null | null | 24.555556 | 81 | 0.616183 | 6,961 | // Copyright (c) 2010 Lime Wire, LLC. All rights reserved. Use of this source
// code is governed by a BSD-style license that can be found in the LICENSE file.
package org.limewire.cef;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
@SuppressWarnings("serial")
class CefBrowser_N extends CefBrowser {
// The value of these members will be retrieved when the CEF browser
// is actually created.
private String load_url = null;
private CefHandler handler = null;
// Used internally to track if the browser has been created.
private boolean N_CefCreated = false;
// Used internally to store a pointer to the CEF object.
private long N_CefHandle = 0;
// Constructor used for already existing browser instances.
CefBrowser_N() {
N_CefCreated = true;
}
// Constructor used for pending browser instances.
CefBrowser_N(CefHandler handler, String url) {
this.load_url = url;
this.handler = handler;
}
@Override
protected void finalize() throws Throwable
{
try {
N_Destroy();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
super.finalize();
}
@Override
public void goBack() {
try {
N_GoBack();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public void goForward() {
try {
N_GoForward();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public long getWindowHandle() {
try {
return N_GetWindowHandle();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return 0;
}
@Override
public boolean isPopup() {
try {
return N_IsPopup();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return false;
}
@Override
public CefFrame getMainFrame() {
try {
return N_GetMainFrame();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return null;
}
@Override
public CefFrame getFocusedFrame() {
try {
return N_GetFocusedFrame();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return null;
}
@Override
public void paint(Graphics g) {
try {
N_Paint(getWidth(), getHeight());
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public void setBounds(int x, int y, int width, int height) {
try {
N_SetWindowSize(width, height);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
super.setBounds(x, y, width, height);
}
@Override
public void setBounds(Rectangle r) {
setBounds(r.x, r.y, r.width, r.height);
}
@Override
public void setSize(int width, int height) {
try {
N_SetWindowSize(width, height);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
super.setSize(width, height);
}
@Override
public void setSize(Dimension d) {
setSize(d.width, d.height);
}
private final native void N_Destroy();
private final native void N_GoBack();
private final native void N_GoForward();
private final native long N_GetWindowHandle();
private final native boolean N_IsPopup();
private final native CefFrame N_GetMainFrame();
private final native CefFrame N_GetFocusedFrame();
private final native void N_Paint(int width, int height);
private final native void N_SetWindowSize(int width, int height);
}
|
3e1070f471dcb4234321e80320739947dcbcfca3 | 14,680 | java | Java | code2doc-core/src/main/java/de/jcup/code2doc/core/internal/define/GroupDefinitionImpl.java | hexadez/code2doc | fd02f528bc148122da32c4be63953a7737c5b291 | [
"Apache-2.0"
] | 2 | 2015-03-27T23:58:50.000Z | 2019-12-11T12:01:05.000Z | code2doc-core/src/main/java/de/jcup/code2doc/core/internal/define/GroupDefinitionImpl.java | hexadez/code2doc | fd02f528bc148122da32c4be63953a7737c5b291 | [
"Apache-2.0"
] | 37 | 2015-03-30T12:40:28.000Z | 2016-07-13T09:52:03.000Z | code2doc-core/src/main/java/de/jcup/code2doc/core/internal/define/GroupDefinitionImpl.java | hexadez/code2doc | fd02f528bc148122da32c4be63953a7737c5b291 | [
"Apache-2.0"
] | 1 | 2017-07-30T07:26:52.000Z | 2017-07-30T07:26:52.000Z | 37.835052 | 222 | 0.778883 | 6,962 | /*
* 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 de.jcup.code2doc.core.internal.define;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.jcup.code2doc.api.Architecture;
import de.jcup.code2doc.api.Concept;
import de.jcup.code2doc.api.Constraint;
import de.jcup.code2doc.api.Element;
import de.jcup.code2doc.api.Role;
import de.jcup.code2doc.api.UseCase;
import de.jcup.code2doc.core.define.ArchitectureDefinition;
import de.jcup.code2doc.core.define.ConceptDefinition;
import de.jcup.code2doc.core.define.ConstraintDefinition;
import de.jcup.code2doc.core.define.GroupDefinition;
import de.jcup.code2doc.core.define.RoleDefinition;
import de.jcup.code2doc.core.define.Specification;
import de.jcup.code2doc.core.define.UseCaseDefinition;
import de.jcup.code2doc.core.internal.sort.ElementDefinitionImplByClassNameComparator;
import de.jcup.code2doc.core.internal.util.Validation;
public class GroupDefinitionImpl implements GroupDefinition, Comparable<GroupDefinitionImpl> {
private static final ElementDefinitionImplByClassNameComparator SHARED_COMPARATOR = new ElementDefinitionImplByClassNameComparator();
private static final Logger LOG = LoggerFactory.getLogger(GroupDefinitionImpl.class);
private static final GroupDefinitionImpl typeInstanceDummyParentGroup = new GroupDefinitionImpl(null, null);
SpecificationImpl specification;
@SuppressWarnings("rawtypes")
/**
* Used only to have a mapping for already created element definitions
*/
private Map<Class<Element>, AbstractElementDefinitionImpl> elementToelementDefininitionMap = new HashMap<Class<Element>, AbstractElementDefinitionImpl>();
List<UseCaseDefinitionImpl> useCaseDefinitions = new ArrayList<UseCaseDefinitionImpl>();
List<ArchitectureDefinitionImpl> architectureDefinitions = new ArrayList<ArchitectureDefinitionImpl>();
List<ConceptDefinitionImpl> conceptDefinitions = new ArrayList<ConceptDefinitionImpl>();
List<RoleDefinitionImpl> roleDefinitions = new ArrayList<RoleDefinitionImpl>();
List<ConstraintDefinitionImpl> constraintDefinitions = new ArrayList<ConstraintDefinitionImpl>();
private Group group;
private static ConceptDefinitionCreator CONCEPT_DEF_CREATOR = new ConceptDefinitionCreator();
private static UseCaseDefinitionCreator USECASE_DEF_CREATOR = new UseCaseDefinitionCreator();
private static RoleDefinitionCreator ROLE_DEF_CREATOR = new RoleDefinitionCreator();
private static ConstraintDefinitionCreator CONSTRAINT_DEF_CREATOR = new ConstraintDefinitionCreator();
private static ArchitectureDefinitionCreator ARCHITECTURE_DEF_CREATOR = new ArchitectureDefinitionCreator();
/**
* Do not call this constructor from outside - only
* specification.addGroup(..) is valid - because the type is registered to
* the spec!
*
* @param specification
* @param type
*/
GroupDefinitionImpl(SpecificationImpl specification, Group group) {
this.specification = specification;
this.group = group;
}
public GroupDefinition addUseCase(Class<? extends UseCase> useCase) {
addUseCaseAndDefine(useCase);
return this;
}
public UseCaseDefinition addUseCaseAndDefine(Class<? extends UseCase> useCase) {
return (UseCaseDefinition) internalAddElement(useCase, USECASE_DEF_CREATOR,this);
}
@Override
public GroupDefinition addArchitecture(Class<? extends Architecture> architecture) {
addArchitectureAndDefine(architecture);
return this;
}
@Override
public ArchitectureDefinition addArchitectureAndDefine(Class<? extends Architecture> architecture) {
return (ArchitectureDefinition) internalAddElement(architecture, ARCHITECTURE_DEF_CREATOR,this);
}
@Override
public GroupDefinition addConcept(Class<? extends Concept> concept) {
addConceptAndDefine(concept);
return this;
}
@Override
public ConceptDefinition addConceptAndDefine(Class<? extends Concept> concept) {
return (ConceptDefinition) internalAddElement(concept, CONCEPT_DEF_CREATOR,this);
}
@Override
public GroupDefinition addConstraint(Class<? extends Constraint> concept) {
addConstraintAndDefine(concept);
return this;
}
@Override
public ConstraintDefinition addConstraintAndDefine(Class<? extends Constraint> concept) {
return (ConstraintDefinition) internalAddElement(concept, CONSTRAINT_DEF_CREATOR,this);
}
@Override
public GroupDefinition addRole(Class<? extends Role> concept) {
addRoleAndDefine(concept);
return this;
}
@Override
public RoleDefinition addRoleAndDefine(Class<? extends Role> concept) {
return (RoleDefinition) internalAddElement(concept, ROLE_DEF_CREATOR,this);
}
@Override
public Specification endDefinition() {
return specification;
}
/**
* Get all element definitions sorted
* @param definitionType
* @return collection with all element definitions
* @throws IllegalArgumentException when definition type not supported on not in enum
* @throws IllegalArgumentException when definition type is null
*/
public Collection<? extends AbstractElementDefinitionImpl<?,?,?>> getDefinitionsSorted(String definitionType) {
Validation.notNull(definitionType, "Definition may not be null");
DefinitionType resolvedDefinitionType = DefinitionType.valueOf(definitionType);
List<? extends AbstractElementDefinitionImpl<?, ?, ?>> list = internalFindCorrectList(resolvedDefinitionType);
return createSortedList(list);
}
/**
* Get all element definitions
* @param definitionType - must be one of the names defined in {@link DefinitionType}
* @return collection with all element definitions
* @throws IllegalArgumentException when definition type not supported on not in enum
* @throws IllegalArgumentException when definition type is null
*/
public Collection<? extends AbstractElementDefinitionImpl<?,?,?>> getDefinitions(String definitionType) {
Validation.notNull(definitionType, "Definition may not be null");
DefinitionType type = DefinitionType.valueOf(definitionType);
return getDefinitions(type);
}
/**
* Get all element definitions - for every definition type
* @return unmodifiable list of all element definitions
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<? extends AbstractElementDefinitionImpl<?, ?, ?>> getDefinitions(){
/* simply add every definition type to fetch all */
List<? extends AbstractElementDefinitionImpl<?, ?, ?>> result = new ArrayList<AbstractElementDefinitionImpl<?,?,?>>();
for (DefinitionType type: DefinitionType.values()){
List<? extends AbstractElementDefinitionImpl<?, ?, ?>> allOfType = internalFindCorrectList(type);
result.addAll((Collection)(allOfType)); /* without cast to raw type not working ... */
}
return Collections.unmodifiableList(result);
}
/**
* Get all definitions for given definition type - not sorted
* @param definitionType - may not be null
* @return unmodifiable list for given definition type - never null
* @throws IllegalArgumentException when unsupported definition type
*/
public List<? extends AbstractElementDefinitionImpl<?,?,?>> getDefinitions(DefinitionType definitionType) {
Validation.notNull(definitionType, "Defintion type must be set - or use getDefinitions() instead!");
List<? extends AbstractElementDefinitionImpl<?, ?, ?>> list = internalFindCorrectList(definitionType);
return Collections.unmodifiableList(list);
}
public Group getGroup() {
return group;
}
@Override
public int compareTo(GroupDefinitionImpl other) {
if (other == null) {
return 1;
}
if (other == this) {
return 0;
}
return group.compareTo(other.group);
}
@Override
public String toString() {
return "GroupDefinitionImpl:"+ getGroup().toString();
}
/**
* Returns all children of current type
* @return
*/
public Collection<GroupDefinitionImpl> getChildrenSorted() {
Collection<GroupDefinitionImpl> allGroupDefinitions = specification.getGroupDefinitions();
List<GroupDefinitionImpl> children = new ArrayList<GroupDefinitionImpl>();
Group pgp = getGroup();
for (GroupDefinitionImpl impl : allGroupDefinitions) {
if (impl == this) {
continue;
}
Group igp = impl.getGroup().getParent();
if (pgp == igp) {
children.add(impl);
}
}
/*
* return children in same sort order as defined in Groups by Factory
* calls
*/
Collections.sort(children);
return children;
}
/* @formatter:on*/
List<? extends AbstractElementDefinitionImpl<?,?,?>> createSortedList(List<? extends AbstractElementDefinitionImpl<?,?,?>>list ){
List<? extends AbstractElementDefinitionImpl<?,?,?>> sortedList = new ArrayList<AbstractElementDefinitionImpl<?,?,?>>(list);
Collections.sort(sortedList,SHARED_COMPARATOR);
return sortedList;
}
/*
* Internal method to fetch correct list - will return the real list - public caller methods should always return a unmodifiable version...
*
*/
private List<? extends AbstractElementDefinitionImpl<?, ?, ?>> internalFindCorrectList(DefinitionType definitionType) {
List<? extends AbstractElementDefinitionImpl<?,?,?>> list = null;
if (definitionType==DefinitionType.USECASE){
list= useCaseDefinitions;
}else if (definitionType==DefinitionType.ARCHITECTURE){
list= architectureDefinitions;
}else if (definitionType==DefinitionType.CONCEPT){
list= conceptDefinitions;
}else if (definitionType==DefinitionType.ROLE){
list= roleDefinitions;
}else if (definitionType==DefinitionType.CONSTRAINT){
list= constraintDefinitions;
}
assertListAvailable(definitionType, list);
return list;
}
private void assertListAvailable(DefinitionType definitionType, List<? extends AbstractElementDefinitionImpl<?, ?, ?>> list) {
if (list==null){
throw new IllegalArgumentException("definition type unsupported - no list found for::"+definitionType);
}
}
/* hmm... currently no generics are used here - but we know what we do here. so normally not necessary. effort with generic approach too great */
@SuppressWarnings({"unchecked","rawtypes"})
/* @formatter:off*/
private AbstractElementDefinitionImpl internalAddElement(
Class<? extends Element> elementClazz,
ElementDefinitionCreator definitionCreator,
GroupDefinitionImpl parentContainer) {
DefinitionType defType = definitionCreator.getType();
List list = (List) internalFindCorrectList(defType);
if (elementToelementDefininitionMap.containsKey(elementClazz)) {
LOG.debug("key already exists. So reuse it.");
return elementToelementDefininitionMap.get(elementClazz);
}
/* create instance*/
Element elementInstance = specification.transformer.transformToInstance(elementClazz);
AbstractElementDefinitionImpl elementDef = definitionCreator.createDefinitionFor(elementInstance, parentContainer);
list.add(elementDef);
elementToelementDefininitionMap.put((Class)elementClazz, elementDef);
if (LOG.isDebugEnabled()){
String listName = null;
if (list ==architectureDefinitions){
listName="architecture";
}else if (list ==conceptDefinitions){
listName="concept";
}else if (list ==useCaseDefinitions){
listName="usecase";
}else if (list ==roleDefinitions){
listName="role";
}else if (list ==constraintDefinitions){
listName="constraint";
}else{
listName="unknown-list";
}
LOG.debug("Group '"+parentContainer.getGroup().getName()+"'+="+elementDef.getDefinitionType()+"("+elementClazz.getSimpleName()+"). map("+elementToelementDefininitionMap.size()+"), list("+listName+","+list.size()+")");
}
return elementDef;
}
private interface ElementDefinitionCreator{
public AbstractElementDefinitionImpl<?, ?, ?> createDefinitionFor(Element element, GroupDefinitionImpl parentContainerOfDefinition);
public DefinitionType getType();
}
private static abstract class AbstractElementDefinitionCreator implements ElementDefinitionCreator{
/*
* An internal instance only for fetching type...
*/
private AbstractElementDefinitionImpl<?, ?, ?> typeInstance;
@Override
public DefinitionType getType() {
if (typeInstance==null){
/* typeInstanceDummyParentGroup - avoids NPEs...*/
typeInstance=createDefinitionFor(null,typeInstanceDummyParentGroup);
}
return typeInstance.getDefinitionType();
}
}
private static class UseCaseDefinitionCreator extends AbstractElementDefinitionCreator{
@Override
public UseCaseDefinitionImpl createDefinitionFor(Element element, GroupDefinitionImpl parentContainerOfDefinition) {
return new UseCaseDefinitionImpl(parentContainerOfDefinition, (UseCase)element);
}
}
private static class ConceptDefinitionCreator extends AbstractElementDefinitionCreator{
@Override
public ConceptDefinitionImpl createDefinitionFor(Element element, GroupDefinitionImpl parentContainerOfDefinition) {
return new ConceptDefinitionImpl(parentContainerOfDefinition, (Concept)element);
}
}
private static class ArchitectureDefinitionCreator extends AbstractElementDefinitionCreator{
@Override
public ArchitectureDefinitionImpl createDefinitionFor(Element element, GroupDefinitionImpl parentContainerOfDefinition) {
return new ArchitectureDefinitionImpl(parentContainerOfDefinition, (Architecture)element);
}
}
private static class RoleDefinitionCreator extends AbstractElementDefinitionCreator{
@Override
public RoleDefinitionImpl createDefinitionFor(Element element, GroupDefinitionImpl parentContainerOfDefinition) {
return new RoleDefinitionImpl(parentContainerOfDefinition, (Role)element);
}
}
private static class ConstraintDefinitionCreator extends AbstractElementDefinitionCreator{
@Override
public ConstraintDefinitionImpl createDefinitionFor(Element element, GroupDefinitionImpl parentContainerOfDefinition) {
return new ConstraintDefinitionImpl(parentContainerOfDefinition, (Constraint)element);
}
}
} |
3e107127c92709cf556ac06e4a14909b8aaef1f0 | 287 | java | Java | x7-core/src/main/java/x7/core/config/ConfigAdapter.java | rolyer/x7 | 857aaf97c9a6ff4ac94375a58219fc352b2423a8 | [
"Apache-2.0"
] | 1 | 2019-06-21T01:49:40.000Z | 2019-06-21T01:49:40.000Z | x7-core/src/main/java/x7/core/config/ConfigAdapter.java | JavaMrYang/x7 | 40d2ad4c73eb5f3df820dad306a6ba8413c4b950 | [
"Apache-2.0"
] | null | null | null | x7-core/src/main/java/x7/core/config/ConfigAdapter.java | JavaMrYang/x7 | 40d2ad4c73eb5f3df820dad306a6ba8413c4b950 | [
"Apache-2.0"
] | null | null | null | 19.133333 | 56 | 0.686411 | 6,963 | package x7.core.config;
public class ConfigAdapter {
private static boolean isShowSql = false;
public static boolean isIsShowSql() {
return isShowSql;
}
public static void setIsShowSql(boolean isShowSql) {
ConfigAdapter.isShowSql = isShowSql;
}
}
|
3e10719ecb1849425cc5db672b113cc719b393a0 | 518 | java | Java | ios-moe/src/com/lwgame/gdx/ios/bindings/googlemobileads/enums/GADNativeAdImageAdLoaderOptionsOrientation.java | sjov-l/lwgame-gdx | 92aec3adc3564176b9e4d9faeae2e3809f6faec3 | [
"Apache-2.0"
] | 2 | 2020-08-06T03:01:46.000Z | 2020-11-25T06:32:12.000Z | ios-moe/src/com/lwgame/gdx/ios/bindings/googlemobileads/enums/GADNativeAdImageAdLoaderOptionsOrientation.java | ocoao/lwgame-gdx | 92aec3adc3564176b9e4d9faeae2e3809f6faec3 | [
"Apache-2.0"
] | null | null | null | ios-moe/src/com/lwgame/gdx/ios/bindings/googlemobileads/enums/GADNativeAdImageAdLoaderOptionsOrientation.java | ocoao/lwgame-gdx | 92aec3adc3564176b9e4d9faeae2e3809f6faec3 | [
"Apache-2.0"
] | null | null | null | 23.545455 | 63 | 0.80888 | 6,964 | package com.lwgame.gdx.ios.bindings.googlemobileads.enums;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.NInt;
@Generated
public final class GADNativeAdImageAdLoaderOptionsOrientation {
@Generated
private GADNativeAdImageAdLoaderOptionsOrientation() {
}
@Generated
@NInt
public static final long Any = 0x0000000000000001L;
@Generated
@NInt
public static final long Portrait = 0x0000000000000002L;
@Generated
@NInt
public static final long Landscape = 0x0000000000000003L;
} |
3e10721873f42c974a1443c9de2540b847c84838 | 913 | java | Java | magic-api/src/main/java/org/ssssssss/magicapi/logging/MagicLoggerContext.java | mytimes/magic-api | aaef4198b5a423c9d5781f67f8d90fa1cfa1e945 | [
"MIT"
] | null | null | null | magic-api/src/main/java/org/ssssssss/magicapi/logging/MagicLoggerContext.java | mytimes/magic-api | aaef4198b5a423c9d5781f67f8d90fa1cfa1e945 | [
"MIT"
] | null | null | null | magic-api/src/main/java/org/ssssssss/magicapi/logging/MagicLoggerContext.java | mytimes/magic-api | aaef4198b5a423c9d5781f67f8d90fa1cfa1e945 | [
"MIT"
] | null | null | null | 23.410256 | 80 | 0.768894 | 6,965 | package org.ssssssss.magicapi.logging;
import org.slf4j.MDC;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import org.ssssssss.magicapi.config.MessageType;
import org.ssssssss.magicapi.config.WebSocketSessionManager;
import org.ssssssss.script.MagicScriptContext;
import org.ssssssss.script.MagicScriptDebugContext;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
public interface MagicLoggerContext {
String LOGGER_NAME = "magic";
ThreadLocal<String> SESSION = new InheritableThreadLocal<>();
/**
* 打印日志
*
* @param logInfo 日志信息
*/
static void println(LogInfo logInfo) {
// 获取SessionId
String sessionId = SESSION.get();
if (sessionId != null) {
WebSocketSessionManager.sendBySessionId(sessionId, MessageType.LOG, logInfo);
}
}
/**
* 生成appender
*/
void generateAppender();
}
|
3e1072484c8116272e70efe6fcd2838561c9c77d | 201 | java | Java | secux-paymentdevicekit/src/main/java/com/secuxtech/paymentdevicekit/BLEDevice.java | secuxtech/secuxtech-secux-paymentdevicekit-v2-android | ac64b3fd98dfa0fac550ee756fc46885c260bf2a | [
"MIT"
] | null | null | null | secux-paymentdevicekit/src/main/java/com/secuxtech/paymentdevicekit/BLEDevice.java | secuxtech/secuxtech-secux-paymentdevicekit-v2-android | ac64b3fd98dfa0fac550ee756fc46885c260bf2a | [
"MIT"
] | null | null | null | secux-paymentdevicekit/src/main/java/com/secuxtech/paymentdevicekit/BLEDevice.java | secuxtech/secuxtech-secux-paymentdevicekit-v2-android | ac64b3fd98dfa0fac550ee756fc46885c260bf2a | [
"MIT"
] | null | null | null | 18.272727 | 41 | 0.756219 | 6,966 | package com.secuxtech.paymentdevicekit;
import android.bluetooth.BluetoothDevice;
public class BLEDevice {
public BluetoothDevice device;
public int Rssi;
public String deviceID = "";
}
|
3e1072d55a2cb5739c46136a4368a80f849944fb | 570 | java | Java | exercises/guice/simple/src/test/java/nl/oose/dea/orderservice/withdip/PaymentProcessorTest.java | bartvanderwal/dea-code-examples | 2794149ef61b24d70f2ed443f877186661c9f0e5 | [
"MIT"
] | 14 | 2015-02-05T15:20:41.000Z | 2020-02-12T16:40:32.000Z | exercises/guice/simple/src/test/java/nl/oose/dea/orderservice/withdip/PaymentProcessorTest.java | bartvanderwal/dea-code-examples | 2794149ef61b24d70f2ed443f877186661c9f0e5 | [
"MIT"
] | 1 | 2017-09-07T15:05:48.000Z | 2017-12-06T15:02:08.000Z | exercises/guice/simple/src/test/java/nl/oose/dea/orderservice/withdip/PaymentProcessorTest.java | bartvanderwal/dea-code-examples | 2794149ef61b24d70f2ed443f877186661c9f0e5 | [
"MIT"
] | 80 | 2015-02-05T15:20:44.000Z | 2019-05-02T23:12:40.000Z | 24.782609 | 85 | 0.710526 | 6,967 | package nl.oose.dea.orderservice.withdip;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
public class PaymentProcessorTest {
@Test
public void testCharge() throws Exception {
PaymentProcessor paymentProcessor = new LoggingPaymentProcessor();
assertTrue(paymentProcessor.chargeCard(createPaymentDetails(),createCart()));
}
private Cart createCart() {
return new CartProvider().get();
}
private PaymentDetails createPaymentDetails()
{
return new PaymentDetailsFactory().create();
}
} |
3e1074099e92fd2e627d7f54e33c5fc5aef7f177 | 646 | java | Java | testprojects/java/benchmark/presentation/gui/linkedin/ProfileGUI.java | senkz/HUSACCT | 4888062b1a933c5e8458a6d087a3c6f3781207e7 | [
"MIT"
] | null | null | null | testprojects/java/benchmark/presentation/gui/linkedin/ProfileGUI.java | senkz/HUSACCT | 4888062b1a933c5e8458a6d087a3c6f3781207e7 | [
"MIT"
] | null | null | null | testprojects/java/benchmark/presentation/gui/linkedin/ProfileGUI.java | senkz/HUSACCT | 4888062b1a933c5e8458a6d087a3c6f3781207e7 | [
"MIT"
] | 1 | 2021-02-02T12:58:55.000Z | 2021-02-02T12:58:55.000Z | 28.086957 | 132 | 0.780186 | 6,968 | package presentation.gui.linkedin;
import javax.swing.JFrame;
import presentation.exception.LinkedInException;
import domain.linkedin.LinkedInDTO;
//Functional requirement 4.4
//Test case 199: Exceptions in class presentation.gui.linkedin.ProfileGUI are only allowed when data is exchanged in datatype String
//Result: FALSE
public class ProfileGUI extends JFrame {
public ProfileGUI(){
LinkedInDTO transferAccount = new LinkedInDTO();
transferAccount.setName("Mathew");
transferAccount.setPassword("Schilke");
try {
throw new LinkedInException(transferAccount);
} catch (LinkedInException e) {
e.printStackTrace();
}
}
} |
3e1074710fcbeab1fce7647d7c9efc4220d8ab5c | 2,594 | java | Java | azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/implementation/MetricDefinitionInner.java | AutorestCI/azure-libraries-for-java | e9b6d3f111856cb8509a5cfffcdb3366eb9f36c5 | [
"MIT"
] | 1 | 2022-03-30T22:38:11.000Z | 2022-03-30T22:38:11.000Z | azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/implementation/MetricDefinitionInner.java | AutorestCI/azure-libraries-for-java | e9b6d3f111856cb8509a5cfffcdb3366eb9f36c5 | [
"MIT"
] | 107 | 2018-03-23T19:17:53.000Z | 2018-07-18T21:37:19.000Z | azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/implementation/MetricDefinitionInner.java | AutorestCI/azure-libraries-for-java | e9b6d3f111856cb8509a5cfffcdb3366eb9f36c5 | [
"MIT"
] | null | null | null | 26.20202 | 103 | 0.680031 | 6,969 | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.appservice.implementation;
import java.util.List;
import com.microsoft.azure.management.appservice.MetricAvailabilily;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.serializer.JsonFlatten;
import com.microsoft.azure.management.appservice.ProxyOnlyResource;
/**
* Metadata for a metric.
*/
@JsonFlatten
public class MetricDefinitionInner extends ProxyOnlyResource {
/**
* Name of the metric.
*/
@JsonProperty(value = "properties.name", access = JsonProperty.Access.WRITE_ONLY)
private String metricDefinitionName;
/**
* Unit of the metric.
*/
@JsonProperty(value = "properties.unit", access = JsonProperty.Access.WRITE_ONLY)
private String unit;
/**
* Primary aggregation type.
*/
@JsonProperty(value = "properties.primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY)
private String primaryAggregationType;
/**
* List of time grains supported for the metric together with retention
* period.
*/
@JsonProperty(value = "properties.metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY)
private List<MetricAvailabilily> metricAvailabilities;
/**
* Friendly name shown in the UI.
*/
@JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY)
private String displayName;
/**
* Get the metricDefinitionName value.
*
* @return the metricDefinitionName value
*/
public String metricDefinitionName() {
return this.metricDefinitionName;
}
/**
* Get the unit value.
*
* @return the unit value
*/
public String unit() {
return this.unit;
}
/**
* Get the primaryAggregationType value.
*
* @return the primaryAggregationType value
*/
public String primaryAggregationType() {
return this.primaryAggregationType;
}
/**
* Get the metricAvailabilities value.
*
* @return the metricAvailabilities value
*/
public List<MetricAvailabilily> metricAvailabilities() {
return this.metricAvailabilities;
}
/**
* Get the displayName value.
*
* @return the displayName value
*/
public String displayName() {
return this.displayName;
}
}
|
3e1074941b4475300dac9688790f216c2c4fca5e | 3,816 | java | Java | collection-kotlin/src/main/java/com/youngmanster/collection_kotlin/theme/res/SkinCompatVectorResources.java | usernameyangyan/Collection-Android-kotlin | bc7ed916e676075b35f719ec2d41e63f4ae6d9dd | [
"MIT"
] | 17 | 2020-03-01T05:21:30.000Z | 2021-08-10T01:42:16.000Z | collection-kotlin/src/main/java/com/youngmanster/collection_kotlin/theme/res/SkinCompatVectorResources.java | usernameyangyan/Collection-Android-kotlin | bc7ed916e676075b35f719ec2d41e63f4ae6d9dd | [
"MIT"
] | null | null | null | collection-kotlin/src/main/java/com/youngmanster/collection_kotlin/theme/res/SkinCompatVectorResources.java | usernameyangyan/Collection-Android-kotlin | bc7ed916e676075b35f719ec2d41e63f4ae6d9dd | [
"MIT"
] | 2 | 2020-03-12T00:48:23.000Z | 2020-05-24T14:40:54.000Z | 41.032258 | 106 | 0.607442 | 6,970 | package com.youngmanster.collection_kotlin.theme.res;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.content.res.AppCompatResources;
public class SkinCompatVectorResources implements SkinResources {
private static SkinCompatVectorResources sInstance;
private SkinCompatVectorResources() {
SkinCompatResources.getInstance().addSkinResources(this);
}
public static SkinCompatVectorResources getInstance() {
if (sInstance == null) {
synchronized (SkinCompatVectorResources.class) {
if (sInstance == null) {
sInstance = new SkinCompatVectorResources();
}
}
}
return sInstance;
}
@Override
public void clear() {
SkinCompatDrawableManager.get().clearCaches();
}
private Drawable getSkinDrawableCompat(Context context, int resId) {
if (AppCompatDelegate.isCompatVectorFromResourcesEnabled()) {
if (!SkinCompatResources.getInstance().isDefaultSkin()) {
try {
return SkinCompatDrawableManager.get().getDrawable(context, resId);
} catch (Exception e) {
e.printStackTrace();
}
}
// SkinCompatDrawableManager.get().getDrawable(context, resId) 中会调用getSkinDrawable等方法。
// 这里只需要拦截使用默认皮肤的情况。
if (!SkinCompatUserThemeManager.get().isColorEmpty()) {
ColorStateList colorStateList = SkinCompatUserThemeManager.get().getColorStateList(resId);
if (colorStateList != null) {
return new ColorDrawable(colorStateList.getDefaultColor());
}
}
if (!SkinCompatUserThemeManager.get().isDrawableEmpty()) {
Drawable drawable = SkinCompatUserThemeManager.get().getDrawable(resId);
if (drawable != null) {
return drawable;
}
}
Drawable drawable = SkinCompatResources.getInstance().getStrategyDrawable(context, resId);
if (drawable != null) {
return drawable;
}
return AppCompatResources.getDrawable(context, resId);
} else {
if (!SkinCompatUserThemeManager.get().isColorEmpty()) {
ColorStateList colorStateList = SkinCompatUserThemeManager.get().getColorStateList(resId);
if (colorStateList != null) {
return new ColorDrawable(colorStateList.getDefaultColor());
}
}
if (!SkinCompatUserThemeManager.get().isDrawableEmpty()) {
Drawable drawable = SkinCompatUserThemeManager.get().getDrawable(resId);
if (drawable != null) {
return drawable;
}
}
Drawable drawable = SkinCompatResources.getInstance().getStrategyDrawable(context, resId);
if (drawable != null) {
return drawable;
}
if (!SkinCompatResources.getInstance().isDefaultSkin()) {
int targetResId = SkinCompatResources.getInstance().getTargetResId(context, resId);
if (targetResId != 0) {
return SkinCompatResources.getInstance().getSkinResources().getDrawable(targetResId);
}
}
return AppCompatResources.getDrawable(context, resId);
}
}
public static Drawable getDrawableCompat(Context context, int resId) {
return getInstance().getSkinDrawableCompat(context, resId);
}
}
|
3e107527b29f6fd9b1a6e46e416d86a81d1dfb50 | 520 | java | Java | Monolit/src/main/java/portal/education/Monolit/aspect/LogExecutionTime.java | Mixel2142/Java-pet-project | 4ea2f258377bd128826ca183f681efe3b2caef13 | [
"MIT"
] | null | null | null | Monolit/src/main/java/portal/education/Monolit/aspect/LogExecutionTime.java | Mixel2142/Java-pet-project | 4ea2f258377bd128826ca183f681efe3b2caef13 | [
"MIT"
] | 5 | 2021-12-14T20:53:31.000Z | 2022-01-04T16:40:15.000Z | Monolit/src/main/java/portal/education/Monolit/aspect/LogExecutionTime.java | Mixel2142/Java-pet-project | 4ea2f258377bd128826ca183f681efe3b2caef13 | [
"MIT"
] | null | null | null | 20 | 48 | 0.767308 | 6,971 | package portal.education.Monolit.aspect;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/*
Пишет время работы функции
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LogExecutionTime {
// ms
long writeErrorIfTimeLess() default 3000L;
long value() default 0L;
// log info if writeErrorIfTimeLess the time
boolean logAnyway() default true;
}
|
3e1075891c631f10399517d87382473739998a58 | 3,814 | java | Java | src/main/java/ch/botwat/Botwatch.java | botwatch/bot-api | 1e5de05f41b362b2490303bdf77ceaab06b9eeb5 | [
"Apache-2.0"
] | null | null | null | src/main/java/ch/botwat/Botwatch.java | botwatch/bot-api | 1e5de05f41b362b2490303bdf77ceaab06b9eeb5 | [
"Apache-2.0"
] | 2 | 2020-04-01T19:43:18.000Z | 2020-04-01T19:44:17.000Z | src/main/java/ch/botwat/Botwatch.java | botwatch/bot-api | 1e5de05f41b362b2490303bdf77ceaab06b9eeb5 | [
"Apache-2.0"
] | null | null | null | 41.021505 | 105 | 0.456881 | 6,972 | package ch.botwat;
import ch.botwat.api.*;
import ch.botwat.data.BotClient;
import ch.botwat.data.OldSchoolAccount;
import ch.botwat.data.Session;
import ch.botwat.data.User;
import com.sun.javafx.applet.ExperimentalExtensions;
import java.io.IOException;
import java.util.Random;
public class Botwatch {
public static void main(String[] args) throws IOException {
new Thread(() -> {
int times = 0;
User me = Users.create("testacc", "upchh@example.com", "MyTest123");
//login if account already exists
if(me == null) me = Users.authenticate("testacc","MyTest123");
BotClient client = Clients.create("testxD123", "Tests shit", "test43.com", "swipe,qosmiof2");
if(client == null){
client = new BotClient();
client.name = "testxD123";
}
OldSchoolAccount acc1 = Accounts.create("abc");
if(acc1 == null){
acc1 = new OldSchoolAccount();
acc1.alias = "abc";
}
OldSchoolAccount acc2 = Accounts.create("efg");
if(acc2 == null){
acc2 = new OldSchoolAccount();
acc2.alias = "efg";
}
Session s1 = Sessions.create(client.name, acc1.alias);
Session s2 = Sessions.create(client.name, acc2.alias);
System.out.println(s1.id + " " + s2.id);
Random random = new Random();
while (true) {
switch (random.nextInt(30)) {
case 0:
Interactions.create(random.nextInt(600), random.nextInt(600),
random.nextInt(600), random.nextInt(600), random.nextInt(600),
random.nextInt(600), random.nextInt(600), random.nextInt(600),
random.nextInt(5000), random.nextInt(5000), s1.id);
System.out.println("interaction - s1");
break;
case 1:
Interactions.create(random.nextInt(600), random.nextInt(600),
random.nextInt(600), random.nextInt(600), random.nextInt(600),
random.nextInt(600), random.nextInt(600), random.nextInt(600),
random.nextInt(5000), random.nextInt(5000), s2.id);
System.out.println("interaction - s2");
break;
case 2:
if (times > 1200) {
s1 = Sessions.create(client.name, acc1.alias);
System.out.println("session 1 redone");
times = 0;
}
break;
case 3:
if (times > 1200) {
s2 = Sessions.create(client.name, acc2.alias);
System.out.println("session 2 redone");
times = 0;
}
break;
case 4:
Experiences.create(random.nextInt(2000), random.nextInt(3000), s1.id);
System.out.println("exp - s1");
break;
case 5:
Experiences.create(random.nextInt(2000), random.nextInt(3000), s2.id);
System.out.println("exp - s2");
break;
}
try {
Thread.sleep(100);
times++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
}
|
3e1075a3c4e4e63bb68bd4b05ab9557652fb2b2c | 1,220 | java | Java | android/src/main/java/com/reactnative/samsunghealth/PermissionListener.java | ravishankar3961/rn-samsung-health | 29d21a47473f796e282d827f4fd3ac7ccd1fd8a2 | [
"Unlicense"
] | 24 | 2018-11-15T08:41:36.000Z | 2022-03-05T17:43:39.000Z | android/src/main/java/com/reactnative/samsunghealth/PermissionListener.java | ravishankar3961/rn-samsung-health | 29d21a47473f796e282d827f4fd3ac7ccd1fd8a2 | [
"Unlicense"
] | 10 | 2019-02-20T10:25:16.000Z | 2022-01-07T12:10:48.000Z | android/src/main/java/com/reactnative/samsunghealth/PermissionListener.java | ravishankar3961/rn-samsung-health | 29d21a47473f796e282d827f4fd3ac7ccd1fd8a2 | [
"Unlicense"
] | 16 | 2018-12-09T04:35:02.000Z | 2021-11-04T01:42:00.000Z | 32.972973 | 96 | 0.72377 | 6,973 | package com.reactnative.samsunghealth;
import android.util.Log;
import com.samsung.android.sdk.healthdata.HealthPermissionManager.PermissionKey;
import com.samsung.android.sdk.healthdata.HealthPermissionManager.PermissionResult;
import com.samsung.android.sdk.healthdata.HealthResultHolder;
import com.facebook.react.bridge.Promise;
import java.util.Map;
public class PermissionListener implements HealthResultHolder.ResultListener<PermissionResult> {
private SamsungHealthModule mModule;
private Promise mPromise;
private static final String REACT_MODULE = "RNSamsungHealth";
public PermissionListener(SamsungHealthModule module, Promise promise) {
mModule = module;
mPromise = promise;
}
@Override
public void onResult(PermissionResult result) {
Log.d(REACT_MODULE, "Permission callback is received.");
Map<PermissionKey, Boolean> resultMap = result.getResultMap();
if (resultMap.containsValue(Boolean.FALSE)) {
Log.e(REACT_MODULE, "NOT CONNECTED YET");
mPromise.reject("Permisson canceled");
} else {
Log.d(REACT_MODULE, "COUNT THE STEPS!");
mPromise.resolve(true);
}
}
};
|
3e10761bcba619652e1efdf51a3f1382104b23e0 | 308 | java | Java | src/corejava/oopbasics/Square.java | mdnu/core | 38968b670690ce33cd60961eb616ecf29a127bdb | [
"MIT"
] | 1 | 2016-05-16T00:35:20.000Z | 2016-05-16T00:35:20.000Z | src/corejava/oopbasics/Square.java | mdnu/core | 38968b670690ce33cd60961eb616ecf29a127bdb | [
"MIT"
] | null | null | null | src/corejava/oopbasics/Square.java | mdnu/core | 38968b670690ce33cd60961eb616ecf29a127bdb | [
"MIT"
] | null | null | null | 14 | 35 | 0.665584 | 6,974 | package corejava.oopbasics;
public class Square {
public double width;
public Square(double width) {
this.width = width;
}
public double getWidth() {
return width;
}
public double getArea() {
return (width * width);
}
public void setArea(double area) {
width = Math.sqrt(area);
}
}
|
3e1077425445e0533bb4052b07c853eecf00352f | 1,068 | java | Java | EdgeDiagnosticsApp/DiagnosticsClient/src/main/java/DiagnosticsClient/Load/TCP/TCPClientSocketOptions.java | EdgeLab-FHDO/Edge-Diagnostic-Platform | 49f1d55f57678c62d3af1f5c307b25e41856f14c | [
"MIT"
] | 1 | 2020-08-05T23:30:00.000Z | 2020-08-05T23:30:00.000Z | EdgeDiagnosticsApp/DiagnosticsClient/src/main/java/DiagnosticsClient/Load/TCP/TCPClientSocketOptions.java | EdgeLab-FHDO/Edge-Diagnostic-Platform | 49f1d55f57678c62d3af1f5c307b25e41856f14c | [
"MIT"
] | 90 | 2020-07-26T08:22:44.000Z | 2021-04-30T14:29:51.000Z | EdgeDiagnosticsApp/DiagnosticsClient/src/main/java/DiagnosticsClient/Load/TCP/TCPClientSocketOptions.java | EdgeLab-FHDO/Edge-Diagnostic-Platform | 49f1d55f57678c62d3af1f5c307b25e41856f14c | [
"MIT"
] | 2 | 2020-11-23T17:22:04.000Z | 2021-04-17T17:27:03.000Z | 23.217391 | 65 | 0.675094 | 6,975 | package DiagnosticsClient.Load.TCP;
import DiagnosticsClient.Load.ClientSocketOptions;
import com.fasterxml.jackson.annotation.JsonGetter;
public class TCPClientSocketOptions extends ClientSocketOptions {
private boolean keepAlive;
private boolean nagleAlgorithm;
private int linger;
public TCPClientSocketOptions() {
//Default values from the java doc and local run test
super();
this.keepAlive = false;
this.nagleAlgorithm=true;
this.linger=-1;
}
@JsonGetter("keepAlive")
public boolean getKeepAlive() {
return keepAlive;
}
public void setKeepAlive(boolean keepAlive) {
this.keepAlive = keepAlive;
}
@JsonGetter("nagleAlgorithm")
public boolean getNagleAlgorithm() {
return nagleAlgorithm;
}
public void setNagleAlgorithm(boolean nagleAlgorithm) {
this.nagleAlgorithm = nagleAlgorithm;
}
public int getLinger() {
return linger;
}
public void setLinger(int linger) {
this.linger = linger;
}
}
|
3e1079c6cdc3bbcf83414046ab71233eadfb00ea | 1,838 | java | Java | libraries/GeniiJSDL/trunk/src/edu/virginia/vcgr/jsdl/CPUArchitecture.java | genesis-2/trunk | 9a6b34e8531ef0a1614ee48802b037df6e4fa2d7 | [
"Apache-2.0"
] | 1 | 2022-03-16T16:36:00.000Z | 2022-03-16T16:36:00.000Z | libraries/GeniiJSDL/trunk/src/edu/virginia/vcgr/jsdl/CPUArchitecture.java | genesis-2/trunk | 9a6b34e8531ef0a1614ee48802b037df6e4fa2d7 | [
"Apache-2.0"
] | 1 | 2021-06-04T02:05:42.000Z | 2021-06-04T02:05:42.000Z | libraries/GeniiJSDL/trunk/src/edu/virginia/vcgr/jsdl/CPUArchitecture.java | genesis-2/trunk | 9a6b34e8531ef0a1614ee48802b037df6e4fa2d7 | [
"Apache-2.0"
] | null | null | null | 32.280702 | 139 | 0.778804 | 6,976 | /*
* This code was developed by Mark Morgan (kenaa@example.com) at the University of Virginia and is an implementation of JSDL, JSDL
* ParameterSweep and other JSDL related specifications from the OGF.
*
* Copyright 2010 University of Virginia
*
* 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 edu.virginia.vcgr.jsdl;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
/**
* @author Mark Morgan (kenaa@example.com)
*/
public class CPUArchitecture extends CommonJSDLElement implements Serializable
{
static final long serialVersionUID = 0L;
@XmlElement(namespace = JSDLConstants.JSDL_NS, name = "CPUArchitectureName", required = true)
private ProcessorArchitecture _processorArchitecture;
/**
* Only to be used by XML unmarshalling.
*/
@SuppressWarnings("unused")
private CPUArchitecture()
{
}
public CPUArchitecture(ProcessorArchitecture processorArchitecture)
{
if (processorArchitecture == null)
throw new IllegalArgumentException("ProcessorArchitecture cannot be null.");
_processorArchitecture = processorArchitecture;
}
final public void processorArchitecture(ProcessorArchitecture processorArchitecture)
{
_processorArchitecture = processorArchitecture;
}
final public ProcessorArchitecture processorArchitecture()
{
return _processorArchitecture;
}
}
|
3e107b2b9845db629826fc6a122490bbdb093f8a | 309 | java | Java | mobile_app1/module888/src/main/java/module888packageJava0/Foo12.java | HiWong/android-build-eval | d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6 | [
"Apache-2.0"
] | 70 | 2021-01-22T16:48:06.000Z | 2022-02-16T10:37:33.000Z | mobile_app1/module888/src/main/java/module888packageJava0/Foo12.java | HiWong/android-build-eval | d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6 | [
"Apache-2.0"
] | 16 | 2021-01-22T20:52:52.000Z | 2021-08-09T17:51:24.000Z | mobile_app1/module888/src/main/java/module888packageJava0/Foo12.java | HiWong/android-build-eval | d909ab37bc8d5d3a188ba9c9f0855f846f6f3af6 | [
"Apache-2.0"
] | 5 | 2021-01-26T13:53:49.000Z | 2021-08-11T20:10:57.000Z | 11.884615 | 45 | 0.608414 | 6,977 | package module888packageJava0;
import java.lang.Integer;
public class Foo12 {
Integer int0;
Integer int1;
public void foo0() {
new module888packageJava0.Foo11().foo3();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
}
|
3e107cde5c7ace97e83e582a3874e26ca0b0ae40 | 416 | java | Java | src/main/java/com/alc/itautwitter/controller/base/AbstractItauTwitterController.java | andreluiscorrea85/itau-twitter | 7c24b2c5d3163d84fbabeb5b3dfbaef0c59f9817 | [
"MIT"
] | null | null | null | src/main/java/com/alc/itautwitter/controller/base/AbstractItauTwitterController.java | andreluiscorrea85/itau-twitter | 7c24b2c5d3163d84fbabeb5b3dfbaef0c59f9817 | [
"MIT"
] | null | null | null | src/main/java/com/alc/itautwitter/controller/base/AbstractItauTwitterController.java | andreluiscorrea85/itau-twitter | 7c24b2c5d3163d84fbabeb5b3dfbaef0c59f9817 | [
"MIT"
] | null | null | null | 15.407407 | 56 | 0.716346 | 6,978 | package com.alc.itautwitter.controller.base;
/**
* The type Abstract itau twitter controller.
*/
public abstract class AbstractItauTwitterController
extends Object
implements ItauTwitterController {
/**
* Instantiates a new Abstract itau twitter controller.
*/
public AbstractItauTwitterController() {
super();
this.initObject();
}
/**
* Init object.
*/
protected void initObject() {
}
}
|
3e107d0f79609ba960765d7e8b54d38383a5258a | 8,430 | java | Java | tl/src/main/java/com/github/badoualy/telegram/tl/api/request/TLRequestMessagesSendMedia.java | J0s3f/kotlogram | 562d713691c02f6f3084746167e2e2051def4505 | [
"MIT"
] | 1 | 2020-05-26T19:14:26.000Z | 2020-05-26T19:14:26.000Z | tl/src/main/java/com/github/badoualy/telegram/tl/api/request/TLRequestMessagesSendMedia.java | NekoX-Dev/kotlogram | 562d713691c02f6f3084746167e2e2051def4505 | [
"MIT"
] | null | null | null | tl/src/main/java/com/github/badoualy/telegram/tl/api/request/TLRequestMessagesSendMedia.java | NekoX-Dev/kotlogram | 562d713691c02f6f3084746167e2e2051def4505 | [
"MIT"
] | 1 | 2020-10-30T13:41:15.000Z | 2020-10-30T13:41:15.000Z | 31.473881 | 283 | 0.643154 | 6,979 | package com.github.badoualy.telegram.tl.api.request;
import static com.github.badoualy.telegram.tl.StreamUtils.*;
import static com.github.badoualy.telegram.tl.TLObjectUtils.*;
import com.github.badoualy.telegram.tl.TLContext;
import com.github.badoualy.telegram.tl.api.TLAbsInputMedia;
import com.github.badoualy.telegram.tl.api.TLAbsInputPeer;
import com.github.badoualy.telegram.tl.api.TLAbsMessageEntity;
import com.github.badoualy.telegram.tl.api.TLAbsReplyMarkup;
import com.github.badoualy.telegram.tl.api.TLAbsUpdates;
import com.github.badoualy.telegram.tl.core.TLMethod;
import com.github.badoualy.telegram.tl.core.TLObject;
import com.github.badoualy.telegram.tl.core.TLVector;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
/**
* @author Yannick Badoual upchh@example.com
* @see <a href="http://github.com/badoualy/kotlogram">http://github.com/badoualy/kotlogram</a>
*/
public class TLRequestMessagesSendMedia extends TLMethod<TLAbsUpdates> {
public static final int CONSTRUCTOR_ID = 0x3491eba9;
protected int flags;
protected boolean silent;
protected boolean background;
protected boolean clearDraft;
protected TLAbsInputPeer peer;
protected Integer replyToMsgId;
protected TLAbsInputMedia media;
protected String message;
protected long randomId;
protected TLAbsReplyMarkup replyMarkup;
protected TLVector<TLAbsMessageEntity> entities;
protected Integer scheduleDate;
private final String _constructor = "messages.sendMedia#3491eba9";
public TLRequestMessagesSendMedia() {
}
public TLRequestMessagesSendMedia(boolean silent, boolean background, boolean clearDraft, TLAbsInputPeer peer, Integer replyToMsgId, TLAbsInputMedia media, String message, long randomId, TLAbsReplyMarkup replyMarkup, TLVector<TLAbsMessageEntity> entities, Integer scheduleDate) {
this.silent = silent;
this.background = background;
this.clearDraft = clearDraft;
this.peer = peer;
this.replyToMsgId = replyToMsgId;
this.media = media;
this.message = message;
this.randomId = randomId;
this.replyMarkup = replyMarkup;
this.entities = entities;
this.scheduleDate = scheduleDate;
}
@Override
@SuppressWarnings({"unchecked", "SimplifiableConditionalExpression"})
public TLAbsUpdates deserializeResponse(InputStream stream, TLContext context) throws IOException {
final TLObject response = readTLObject(stream, context);
if (response == null) {
throw new IOException("Unable to parse response");
}
if (!(response instanceof TLAbsUpdates)) {
throw new IOException("Incorrect response type, expected " + getClass().getCanonicalName() + ", found " + response.getClass().getCanonicalName());
}
return (TLAbsUpdates) response;
}
private void computeFlags() {
flags = 0;
flags = silent ? (flags | 32) : (flags & ~32);
flags = background ? (flags | 64) : (flags & ~64);
flags = clearDraft ? (flags | 128) : (flags & ~128);
flags = replyToMsgId != null ? (flags | 1) : (flags & ~1);
flags = replyMarkup != null ? (flags | 4) : (flags & ~4);
flags = entities != null ? (flags | 8) : (flags & ~8);
flags = scheduleDate != null ? (flags | 1024) : (flags & ~1024);
}
@Override
public void serializeBody(OutputStream stream) throws IOException {
computeFlags();
writeInt(flags, stream);
writeTLObject(peer, stream);
if ((flags & 1) != 0) {
if (replyToMsgId == null) throwNullFieldException("replyToMsgId", flags);
writeInt(replyToMsgId, stream);
}
writeTLObject(media, stream);
writeString(message, stream);
writeLong(randomId, stream);
if ((flags & 4) != 0) {
if (replyMarkup == null) throwNullFieldException("replyMarkup", flags);
writeTLObject(replyMarkup, stream);
}
if ((flags & 8) != 0) {
if (entities == null) throwNullFieldException("entities", flags);
writeTLVector(entities, stream);
}
if ((flags & 1024) != 0) {
if (scheduleDate == null) throwNullFieldException("scheduleDate", flags);
writeInt(scheduleDate, stream);
}
}
@Override
@SuppressWarnings({"unchecked", "SimplifiableConditionalExpression"})
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
flags = readInt(stream);
silent = (flags & 32) != 0;
background = (flags & 64) != 0;
clearDraft = (flags & 128) != 0;
peer = readTLObject(stream, context, TLAbsInputPeer.class, -1);
replyToMsgId = (flags & 1) != 0 ? readInt(stream) : null;
media = readTLObject(stream, context, TLAbsInputMedia.class, -1);
message = readTLString(stream);
randomId = readLong(stream);
replyMarkup = (flags & 4) != 0 ? readTLObject(stream, context, TLAbsReplyMarkup.class, -1) : null;
entities = (flags & 8) != 0 ? readTLVector(stream, context) : null;
scheduleDate = (flags & 1024) != 0 ? readInt(stream) : null;
}
@Override
public int computeSerializedSize() {
computeFlags();
int size = SIZE_CONSTRUCTOR_ID;
size += SIZE_INT32;
size += peer.computeSerializedSize();
if ((flags & 1) != 0) {
if (replyToMsgId == null) throwNullFieldException("replyToMsgId", flags);
size += SIZE_INT32;
}
size += media.computeSerializedSize();
size += computeTLStringSerializedSize(message);
size += SIZE_INT64;
if ((flags & 4) != 0) {
if (replyMarkup == null) throwNullFieldException("replyMarkup", flags);
size += replyMarkup.computeSerializedSize();
}
if ((flags & 8) != 0) {
if (entities == null) throwNullFieldException("entities", flags);
size += entities.computeSerializedSize();
}
if ((flags & 1024) != 0) {
if (scheduleDate == null) throwNullFieldException("scheduleDate", flags);
size += SIZE_INT32;
}
return size;
}
@Override
public String toString() {
return _constructor;
}
@Override
public int getConstructorId() {
return CONSTRUCTOR_ID;
}
public boolean getSilent() {
return silent;
}
public void setSilent(boolean silent) {
this.silent = silent;
}
public boolean getBackground() {
return background;
}
public void setBackground(boolean background) {
this.background = background;
}
public boolean getClearDraft() {
return clearDraft;
}
public void setClearDraft(boolean clearDraft) {
this.clearDraft = clearDraft;
}
public TLAbsInputPeer getPeer() {
return peer;
}
public void setPeer(TLAbsInputPeer peer) {
this.peer = peer;
}
public Integer getReplyToMsgId() {
return replyToMsgId;
}
public void setReplyToMsgId(Integer replyToMsgId) {
this.replyToMsgId = replyToMsgId;
}
public TLAbsInputMedia getMedia() {
return media;
}
public void setMedia(TLAbsInputMedia media) {
this.media = media;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public long getRandomId() {
return randomId;
}
public void setRandomId(long randomId) {
this.randomId = randomId;
}
public TLAbsReplyMarkup getReplyMarkup() {
return replyMarkup;
}
public void setReplyMarkup(TLAbsReplyMarkup replyMarkup) {
this.replyMarkup = replyMarkup;
}
public TLVector<TLAbsMessageEntity> getEntities() {
return entities;
}
public void setEntities(TLVector<TLAbsMessageEntity> entities) {
this.entities = entities;
}
public Integer getScheduleDate() {
return scheduleDate;
}
public void setScheduleDate(Integer scheduleDate) {
this.scheduleDate = scheduleDate;
}
}
|
3e107d429903f22735dc3a612d06dd52437e0dca | 7,024 | java | Java | source/Muki/generated/muki/tool/model/GetOperationType.java | 97bytes/Muki | ccba0961bd4516639f819aca8bb14605abd23fd7 | [
"Apache-2.0"
] | 1 | 2015-08-12T19:17:18.000Z | 2015-08-12T19:17:18.000Z | source/Muki/generated/muki/tool/model/GetOperationType.java | 97bytes/Muki | ccba0961bd4516639f819aca8bb14605abd23fd7 | [
"Apache-2.0"
] | null | null | null | source/Muki/generated/muki/tool/model/GetOperationType.java | 97bytes/Muki | ccba0961bd4516639f819aca8bb14605abd23fd7 | [
"Apache-2.0"
] | null | null | null | 27.873016 | 140 | 0.59496 | 6,980 | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.02.24 at 02:46:52 PM CET
//
package muki.tool.model;
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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for get-operationType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="get-operationType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="path-param" type="{http://muki/service-description/}path-paramType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="query-param" type="{http://muki/service-description/}query-paramType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="context-param" type="{http://muki/service-description/}context-paramType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="return-type" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="http-path" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="serialization-type" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "get-operationType", propOrder = {
"pathParam",
"queryParam",
"contextParam"
})
public class GetOperationType {
@XmlElement(name = "path-param")
protected List<PathParamType> pathParam;
@XmlElement(name = "query-param")
protected List<QueryParamType> queryParam;
@XmlElement(name = "context-param")
protected List<ContextParamType> contextParam;
@XmlAttribute
protected String name;
@XmlAttribute(name = "return-type")
protected String returnType;
@XmlAttribute(name = "http-path")
protected String httpPath;
@XmlAttribute(name = "serialization-type")
protected String serializationType;
/**
* Gets the value of the pathParam 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 pathParam property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPathParam().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PathParamType }
*
*
*/
public List<PathParamType> getPathParam() {
if (pathParam == null) {
pathParam = new ArrayList<PathParamType>();
}
return this.pathParam;
}
/**
* Gets the value of the queryParam 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 queryParam property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getQueryParam().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link QueryParamType }
*
*
*/
public List<QueryParamType> getQueryParam() {
if (queryParam == null) {
queryParam = new ArrayList<QueryParamType>();
}
return this.queryParam;
}
/**
* Gets the value of the contextParam 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 contextParam property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getContextParam().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ContextParamType }
*
*
*/
public List<ContextParamType> getContextParam() {
if (contextParam == null) {
contextParam = new ArrayList<ContextParamType>();
}
return this.contextParam;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the returnType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReturnType() {
return returnType;
}
/**
* Sets the value of the returnType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReturnType(String value) {
this.returnType = value;
}
/**
* Gets the value of the httpPath property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHttpPath() {
return httpPath;
}
/**
* Sets the value of the httpPath property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHttpPath(String value) {
this.httpPath = value;
}
/**
* Gets the value of the serializationType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSerializationType() {
return serializationType;
}
/**
* Sets the value of the serializationType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSerializationType(String value) {
this.serializationType = value;
}
}
|
3e10804cdefff299828d61bf98f0c5b2fae3a385 | 10,344 | java | Java | jtransc-rt/src/java/lang/System.java | jayvdb/jtransc | 960f6bf22cbb0a6be830bf2622385995b20a85b8 | [
"Apache-2.0"
] | 625 | 2016-02-08T21:20:19.000Z | 2022-03-28T13:03:16.000Z | jtransc-rt/src/java/lang/System.java | jayvdb/jtransc | 960f6bf22cbb0a6be830bf2622385995b20a85b8 | [
"Apache-2.0"
] | 257 | 2016-02-10T13:33:14.000Z | 2021-09-13T12:12:30.000Z | jtransc-rt/src/java/lang/System.java | jayvdb/jtransc | 960f6bf22cbb0a6be830bf2622385995b20a85b8 | [
"Apache-2.0"
] | 78 | 2016-02-24T14:11:08.000Z | 2021-08-13T12:47:00.000Z | 34.945946 | 125 | 0.684358 | 6,981 | /*
* Copyright 2016 Carlos Ballesteros Velasco
*
* 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 java.lang;
import com.jtransc.JTranscSystem;
import com.jtransc.JTranscSystemProperties;
import com.jtransc.JTranscVersion;
import com.jtransc.annotation.JTranscMethodBody;
import com.jtransc.io.JTranscConsolePrintStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@SuppressWarnings("ManualArrayCopy")
public class System {
static public InputStream in = new InputStream() {
@Override
public int read() throws IOException {
throw new Error("Not implemented System.in.read()!");
}
};
static public PrintStream out = new JTranscConsolePrintStream(false);
static public PrintStream err = new JTranscConsolePrintStream(true);
public static void setIn(InputStream in) {
System.in = in;
}
public static void setOut(PrintStream out) {
System.out = out;
}
public static void setErr(PrintStream err) {
System.err = err;
}
public static long currentTimeMillis() {
return (long) JTranscSystem.fastTime();
}
public static long nanoTime() {
return JTranscSystem.nanoTime();
}
@JTranscMethodBody(target = "js", value = "N.arraycopy(p0, p1, p2, p3, p4);")
@JTranscMethodBody(target = "cpp", value = "JA_0::copy((JA_0*)p0, p1, (JA_0*)p2, p3, p4);")
@JTranscMethodBody(target = "cs", value = "N.arraycopy(p0, p1, p2, p3, p4);")
@JTranscMethodBody(target = "dart", value = "N.arraycopy(p0, p1, p2, p3, p4);")
public static void arraycopy(Object src, int srcPos, Object dst, int dstPos, int length) {
boolean overlapping = (src == dst && dstPos > srcPos);
if (src instanceof boolean[])
arraycopy((boolean[]) src, srcPos, (boolean[]) dst, dstPos, length, overlapping);
else if (src instanceof byte[]) arraycopy((byte[]) src, srcPos, (byte[]) dst, dstPos, length, overlapping);
else if (src instanceof char[]) arraycopy((char[]) src, srcPos, (char[]) dst, dstPos, length, overlapping);
else if (src instanceof short[]) arraycopy((short[]) src, srcPos, (short[]) dst, dstPos, length, overlapping);
else if (src instanceof int[]) arraycopy((int[]) src, srcPos, (int[]) dst, dstPos, length, overlapping);
else if (src instanceof long[]) arraycopy((long[]) src, srcPos, (long[]) dst, dstPos, length, overlapping);
else if (src instanceof float[]) arraycopy((float[]) src, srcPos, (float[]) dst, dstPos, length, overlapping);
else if (src instanceof double[])
arraycopy((double[]) src, srcPos, (double[]) dst, dstPos, length, overlapping);
else arraycopy((Object[]) src, srcPos, (Object[]) dst, dstPos, length, overlapping);
}
static private void arraycopy(boolean[] src, int srcPos, boolean[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(byte[] src, int srcPos, byte[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(char[] src, int srcPos, char[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(short[] src, int srcPos, short[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(int[] src, int srcPos, int[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(long[] src, int srcPos, long[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(float[] src, int srcPos, float[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(double[] src, int srcPos, double[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
static private void arraycopy(Object[] src, int srcPos, Object[] dst, int dstPos, int length, boolean overlapping) {
if (overlapping) {
int n = length;
while (--n >= 0) dst[dstPos + n] = src[srcPos + n];
} else {
for (int n = 0; n < length; n++) dst[dstPos + n] = src[srcPos + n];
}
}
public static int identityHashCode(Object x) {
return SystemInt.identityHashCode(x);
}
public static Properties getProperties() {
return getProps();
}
public static void setProperties(Properties props) {
Properties myprops = getProps();
for (Map.Entry<Object, Object> entry : props.entrySet()) {
myprops.put(entry.getKey(), entry.getValue());
}
}
public static String getProperty(String prop) {
return getProps().getProperty(prop);
}
public static String getProperty(String key, String def) {
return getProps().getProperty(key, def);
}
static private Properties _props;
static private void _setProperty(String key, String value) {
_setProperty(key, value, "");
}
static private void _setProperty(String key, String value, String defaultValue) {
if (key == null) key = "";
if (value == null) value = defaultValue;
getProps().put(key, value);
}
static private Properties getProps() {
if (_props == null) {
_props = new Properties();
_setProperty("os.arch", JTranscSystem.getArch(), "unknown");
_setProperty("os.name", JTranscSystem.getOS(), "unknown");
_setProperty("os.version", "0.1");
_setProperty("java.runtime.name", JTranscSystem.getRuntimeName(), "jtransc-unknown");
_setProperty("java.version", "1.8.0_51");
_setProperty("java.vm.version", "25.51-b03");
_setProperty("java.runtime.version", "1.8.0_51-b16");
_setProperty("file.separator", JTranscSystem.fileSeparator(), "/");
_setProperty("line.separator", JTranscSystem.lineSeparator(), "\n");
_setProperty("path.separator", JTranscSystem.pathSeparator(), ":");
_setProperty("file.encoding", JTranscSystemProperties.fileEncoding());
_setProperty("java.home", JTranscSystem.getJavaHome(), "/");
_setProperty("java.specification.name", JTranscSystem.getRuntimeName(), "jtransc-unknown");
_setProperty("java.specification.vendor", "jtransc");
_setProperty("java.specification.version", "1.7");
_setProperty("java.vendor", "jtransc");
_setProperty("java.vendor.url", "http://github.com/jtransc/jtransc");
_setProperty("java.vm.name", "jtransc");
_setProperty("java.vm.specification.name", "Jtransc JVM emulator");
_setProperty("java.vm.specification.vendor", "jtransc");
_setProperty("java.vm.specification.version", JTranscVersion.getVersion());
_setProperty("java.io.tmpdir", JTranscSystemProperties.tmpdir());
_setProperty("user.home", JTranscSystemProperties.userHome());
_setProperty("user.dir", JTranscSystemProperties.userDir());
_setProperty("user.name", JTranscSystemProperties.userName());
_setProperty("user.language", JTranscSystemProperties.userLanguage());
_setProperty("user.region", JTranscSystemProperties.userRegion());
_setProperty("user.variant", JTranscSystemProperties.userVariant());
}
return _props;
}
public static String setProperty(String key, String value) {
return (String) getProps().setProperty(key, value);
}
public static String clearProperty(String key) {
String old = getProperty(key);
getProps().remove(key);
return old;
}
@JTranscMethodBody(target = "js", value = "return N.str((typeof process != 'undefined') ? process.env[N.istr(p0)] : null);")
@JTranscMethodBody(target = "cpp", value = "return N::str(std::getenv(N::istr3(p0).c_str()));")
@JTranscMethodBody(target = "cs", value = "return N.str(Environment.GetEnvironmentVariable(N.istr(p0)));")
@JTranscMethodBody(target = "dart", value = "return N.str(Platform.environment[N.istr(p0)]);")
public static String getenv(String name) {
return getenv().get(name);
}
public static java.util.Map<String, String> getenv() {
return new HashMap<>();
}
public static void exit(int status) {
Runtime.getRuntime().exit(status);
}
public static void gc() {
Runtime.getRuntime().gc();
}
public static void runFinalization() {
Runtime.getRuntime().runFinalization();
}
@Deprecated
public static void runFinalizersOnExit(boolean value) {
Runtime.runFinalizersOnExit(value);
}
public static void load(String filename) {
Runtime.getRuntime().load(filename);
}
public static void loadLibrary(String libname) {
Runtime.getRuntime().loadLibrary(libname);
}
public static String mapLibraryName(String libname) {
return libname;
}
public static SecurityManager getSecurityManager() {
return null;
}
public static String lineSeparator() {
return JTranscSystem.lineSeparator();
}
}
|
3e1080848200427a935fe9ab9ef97962ba95df1f | 1,008 | java | Java | java/unclassified/algorithms/1496.path-crossing.java | fengbaoheng/leetcode | 2b6ec9adea383503acc23622ca5623161f7ca520 | [
"MIT"
] | 1 | 2019-04-11T12:34:55.000Z | 2019-04-11T12:34:55.000Z | java/unclassified/algorithms/1496.path-crossing.java | fengbaoheng/leetcode | 2b6ec9adea383503acc23622ca5623161f7ca520 | [
"MIT"
] | null | null | null | java/unclassified/algorithms/1496.path-crossing.java | fengbaoheng/leetcode | 2b6ec9adea383503acc23622ca5623161f7ca520 | [
"MIT"
] | null | null | null | 21.913043 | 76 | 0.412698 | 6,982 | /*
* @lc app=leetcode.cn id=1496 lang=java
*
* [1496] 判断路径是否相交
*/
// @lc code=start
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
class Solution {
public boolean isPathCrossing(String path) {
Map<Integer, Set<Integer>> visitMap = new HashMap<>();
visitMap.put(0, new HashSet<>());
visitMap.get(0).add(0);
int x = 0, y = 0;
for (char move : path.toCharArray()) {
switch (move) {
case 'N':
y += 1;
break;
case 'S':
y -= 1;
break;
case 'E':
x += 1;
break;
case 'W':
x -= 1;
break;
}
if (!visitMap.computeIfAbsent(x, k -> new HashSet<>()).add(y)) {
return true;
}
}
return false;
}
}
// @lc code=end
|
3e108195c3772a8fb2dba9ec9223526071193d72 | 926 | java | Java | lib/src/main/java/vclient/GeneralClientOptions.java | nintha/vproxy | 5ff73aefe4637fcf28754c10b4f53096f97095cd | [
"MIT"
] | null | null | null | lib/src/main/java/vclient/GeneralClientOptions.java | nintha/vproxy | 5ff73aefe4637fcf28754c10b4f53096f97095cd | [
"MIT"
] | null | null | null | lib/src/main/java/vclient/GeneralClientOptions.java | nintha/vproxy | 5ff73aefe4637fcf28754c10b4f53096f97095cd | [
"MIT"
] | null | null | null | 24.368421 | 76 | 0.659827 | 6,983 | package vclient;
import javax.net.ssl.SSLContext;
public class GeneralClientOptions<REAL extends GeneralClientOptions<REAL>> {
public int timeout = 10_000;
public ClientContext clientContext = new ClientContext(null);
public GeneralClientOptions() {
}
public GeneralClientOptions(REAL that) {
this.timeout = that.timeout;
this.clientContext = that.clientContext;
}
protected REAL toReal() {
//noinspection unchecked
return (REAL) this;
}
public REAL fill(GeneralClientOptions<?> opts) {
this.timeout = opts.timeout;
this.clientContext = opts.clientContext;
return toReal();
}
public REAL setTimeout(int timeout) {
this.timeout = timeout;
return toReal();
}
public REAL setClientContext(ClientContext clientContext) {
this.clientContext = clientContext;
return toReal();
}
}
|
3e1081f9135bb640656a729e1161ccbea2cd2334 | 518 | java | Java | fiat-web/src/test/groovy/com/netflix/spinnaker/fiat/MainSpec.java | deverton/fiat | 09668629f2cf7504955f762f99eb5098fd42b70d | [
"Apache-2.0"
] | 64 | 2016-07-08T15:06:36.000Z | 2022-03-03T03:02:48.000Z | fiat-web/src/test/groovy/com/netflix/spinnaker/fiat/MainSpec.java | deverton/fiat | 09668629f2cf7504955f762f99eb5098fd42b70d | [
"Apache-2.0"
] | 310 | 2016-07-11T18:52:50.000Z | 2022-03-23T22:03:02.000Z | fiat-web/src/test/groovy/com/netflix/spinnaker/fiat/MainSpec.java | deverton/fiat | 09668629f2cf7504955f762f99eb5098fd42b70d | [
"Apache-2.0"
] | 714 | 2016-07-06T16:06:49.000Z | 2022-03-28T18:33:29.000Z | 30.470588 | 84 | 0.814672 | 6,984 | package com.netflix.spinnaker.fiat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {Main.class})
@TestPropertySource(properties = {"spring.config.location=classpath:fiat-test.yml"})
public class MainSpec {
@Test
public void startupTest() {}
}
|
3e1082301e75cfed8e6f43af4129d5ecc5213f07 | 2,160 | java | Java | service-api/src/main/java/com/java110/api/smo/payment/impl/ToPayInGoOutSMOImpl.java | yingxx26/MicroCommunity | 8f33010207f58aca006b29bcd226813521639fbf | [
"Apache-2.0"
] | null | null | null | service-api/src/main/java/com/java110/api/smo/payment/impl/ToPayInGoOutSMOImpl.java | yingxx26/MicroCommunity | 8f33010207f58aca006b29bcd226813521639fbf | [
"Apache-2.0"
] | null | null | null | service-api/src/main/java/com/java110/api/smo/payment/impl/ToPayInGoOutSMOImpl.java | yingxx26/MicroCommunity | 8f33010207f58aca006b29bcd226813521639fbf | [
"Apache-2.0"
] | 1 | 2022-02-26T07:45:16.000Z | 2022-02-26T07:45:16.000Z | 31.764706 | 107 | 0.750926 | 6,985 | package com.java110.api.smo.payment.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.context.IPageData;
import com.java110.api.properties.WechatAuthProperties;
import com.java110.api.smo.AppAbstractComponentSMO;
import com.java110.api.smo.payment.IToPayInGoOutSMO;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.util.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
@Service("toPayInGoOutSMOImpl")
public class ToPayInGoOutSMOImpl extends AppAbstractComponentSMO implements IToPayInGoOutSMO {
private static final Logger logger = LoggerFactory.getLogger( ToPayInGoOutSMOImpl.class);
@Autowired
private RestTemplate restTemplate;
@Autowired
private RestTemplate outRestTemplate;
@Autowired
private WechatAuthProperties wechatAuthProperties;
@Override
public ResponseEntity<String> toPay(IPageData pd) {
return super.businessProcess(pd);
}
@Override
protected void validate(IPageData pd, JSONObject paramIn) {
Assert.jsonObjectHaveKey(paramIn, "settingId", "请求报文中未包含communityId节点");
Assert.jsonObjectHaveKey(paramIn, "communityId", "请求报文中未包含settingId节点");
}
@Override
protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) throws Exception {
ResponseEntity responseEntity = null;
String ownerUrl = MappingCache.getValue("OWNER_WECHAT_URL")
+ "/#/pages/reportInfoDetail/reportInfoDetail?settingId=" +
paramIn.getString( "settingId" ) +
"&communityId=" + paramIn.getString( "communityId" ) ;
Map result = new HashMap( );
result.put( "codeUrl", ownerUrl);
responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK);
return responseEntity;
}
}
|
3e1083ca32227a6879b118e598be01930ae54ad3 | 2,232 | java | Java | DarkOrbit 9.0/DarkOrbit 9.0 Emulator/src/simulator/system/clans/Clan.java | yusufsahinhamza/darkorbit-emulators | fb4e4564d1b3a6b6a32d75acd0e59a38771b8c9e | [
"MIT"
] | 15 | 2020-02-26T18:18:17.000Z | 2022-03-18T23:42:24.000Z | DarkOrbit 9.0/DarkOrbit 9.0 Emulator/src/simulator/system/clans/Clan.java | yusufsahinhamza/darkorbit-emulators | fb4e4564d1b3a6b6a32d75acd0e59a38771b8c9e | [
"MIT"
] | 4 | 2020-03-26T19:08:07.000Z | 2021-05-18T23:50:08.000Z | DarkOrbit 9.0/DarkOrbit 9.0 Emulator/src/simulator/system/clans/Clan.java | yusufsahinhamza/darkorbit-emulators | fb4e4564d1b3a6b6a32d75acd0e59a38771b8c9e | [
"MIT"
] | 21 | 2020-02-16T10:23:39.000Z | 2022-03-10T23:02:21.000Z | 26.571429 | 128 | 0.655914 | 6,986 | package simulator.system.clans;
import java.util.ArrayList;
import java.util.List;
/**
Clan representation
*/
public class Clan {
private int mClanId;
private int mRankPoints;
private short mFactionId;
private String mClanName;
private String mClanTag;
private final List<Diplomacy> mDiplomacies;
private final List<simulator.map_entities.stationary.stations.BattleStation> mBattleStations;
public Clan(final int pClanId, final int pRankPoints, final String pClanName, final String pClanTag, final short pFactionId,
final String pClanMembersJson, final List<Diplomacy> pDiplomacies,
final ArrayList<simulator.map_entities.stationary.stations.BattleStation> arrayList) {
this.mClanId = pClanId;
this.mRankPoints = pRankPoints;
this.mClanName = pClanName;
this.mClanTag = pClanTag;
this.mFactionId = pFactionId;
this.mDiplomacies = pDiplomacies;
this.mBattleStations = arrayList;
}
public Clan(final int pClanId, final String pClanName, final String pClanTag, final short pFactionId,
final int pFounderId) {
this.mClanId = pClanId;
this.mClanName = pClanName;
this.mClanTag = pClanTag;
this.mFactionId = pFactionId;
this.mDiplomacies = new ArrayList<>();
this.mBattleStations = new ArrayList<>();
}
public List<Diplomacy> getDiplomacies(){
return this.mDiplomacies;
}
public int getRankPoints() {
return this.mRankPoints;
}
public int getClanId() {
return this.mClanId;
}
public void setClanId(final int pClanId) {
this.mClanId = pClanId;
}
public String getClanName() {
return this.mClanName;
}
public void setClanName(final String pClanName) {
this.mClanName = pClanName;
}
public String getClanTag() {
return this.mClanTag;
}
public void setClanTag(final String pClanTag) {
this.mClanTag = pClanTag;
}
public short getFactionId() {
return this.mFactionId;
}
public void setFactionId(final short pClanTag) {
this.mFactionId = pClanTag;
}
}
|
3e1083d60156e59245ae8850be98d067dccd12c1 | 3,212 | java | Java | app/src/main/java/com/ke2g/cued_recall/SignupActivity.java | fxkjd/cuedRecall | 713ea3a8b0e0651bc2c8748f09260994f136fb04 | [
"MIT"
] | 1 | 2015-05-10T19:53:09.000Z | 2015-05-10T19:53:09.000Z | app/src/main/java/com/ke2g/cued_recall/SignupActivity.java | ke2g/cuedRecall | 713ea3a8b0e0651bc2c8748f09260994f136fb04 | [
"MIT"
] | null | null | null | app/src/main/java/com/ke2g/cued_recall/SignupActivity.java | ke2g/cuedRecall | 713ea3a8b0e0651bc2c8748f09260994f136fb04 | [
"MIT"
] | null | null | null | 32.444444 | 95 | 0.678394 | 6,987 | package com.ke2g.cued_recall;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.google.gson.Gson;
import java.util.ArrayList;
public class SignupActivity extends ActionBarActivity {
public static final String TAG = SignupActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void doSignup(View V){
if(!getUsername().equals("")) {
Intent i = new Intent(this, returnIntent.class);
startActivityForResult(i, 1);
}
}
private int getTolerance(){
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
return Integer.parseInt(SP.getString("tolerance", "75"));
}
private void saveUserPoints(String username, ArrayList<Point> points){
SharedPreferences appSharedPrefs = PreferenceManager
.getDefaultSharedPreferences(this.getApplicationContext());
SharedPreferences.Editor prefsEditor = appSharedPrefs.edit();
String hash = CuedRecallIntent.createHash(points, getTolerance());
User u = new User(points, hash, username);
Gson gson = new Gson();
String json = gson.toJson(u);
prefsEditor.putString(username, json);
prefsEditor.commit();
}
private String getUsername() {
EditText et = (EditText) findViewById(R.id.editText_signup);
return et.getText().toString().trim();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
//get points from returnIntent
ArrayList<Point> points = data.getParcelableArrayListExtra("RESULT_CLICKS");
//save to shared preferences username and points
saveUserPoints(getUsername(), points);
Toast.makeText(this, "Correct sign up", Toast.LENGTH_LONG).show();
Intent i = new Intent(this, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
}
}
|
3e1083f204cab395b236467078961c4d4f940eb5 | 2,268 | java | Java | hazelcast/src/test/java/com/hazelcast/internal/management/ClearWanQueuesTest.java | tufangorel/hazelcast | e63f8f5f67b002ff0b9b88532fe332e9767f909d | [
"Apache-2.0"
] | 1 | 2018-10-31T18:37:58.000Z | 2018-10-31T18:37:58.000Z | hazelcast/src/test/java/com/hazelcast/internal/management/ClearWanQueuesTest.java | tufangorel/hazelcast | e63f8f5f67b002ff0b9b88532fe332e9767f909d | [
"Apache-2.0"
] | null | null | null | hazelcast/src/test/java/com/hazelcast/internal/management/ClearWanQueuesTest.java | tufangorel/hazelcast | e63f8f5f67b002ff0b9b88532fe332e9767f909d | [
"Apache-2.0"
] | null | null | null | 38.440678 | 103 | 0.77866 | 6,988 | /*
* Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
*
* 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.hazelcast.internal.management;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.instance.Node;
import com.hazelcast.internal.management.request.ChangeWanStateRequest;
import com.hazelcast.internal.management.request.ClearWanQueuesRequest;
import com.hazelcast.internal.json.JsonObject;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.ParallelTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import static com.hazelcast.util.JsonUtil.getString;
import static org.junit.Assert.assertNotEquals;
@RunWith(HazelcastParallelClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class ClearWanQueuesTest extends HazelcastTestSupport {
private ManagementCenterService managementCenterService;
@Before
public void setUp() {
HazelcastInstance hz = createHazelcastInstance();
Node node = getNode(hz);
managementCenterService = node.getManagementCenterService();
}
@Test
public void testClearWanQueue() throws Exception {
ClearWanQueuesRequest clearWanQueuesRequest = new ClearWanQueuesRequest("schema", "publisher");
JsonObject jsonObject = new JsonObject();
clearWanQueuesRequest.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
assertNotEquals(ChangeWanStateRequest.SUCCESS, getString(result, "result"));
}
}
|
3e10842a872f98f2be7229aacec16f3671969a3e | 557 | java | Java | cashmachine/src/main/java/es/udc/fic/acs/infmsb01/atm/atm/model/processor/action/instance/RequestAccountMovementsATMAction.java | marcos-sb/distributed-banking-system | e5130c1ea82fc69a43b236bc6dcff41309b9f86e | [
"Apache-2.0"
] | null | null | null | cashmachine/src/main/java/es/udc/fic/acs/infmsb01/atm/atm/model/processor/action/instance/RequestAccountMovementsATMAction.java | marcos-sb/distributed-banking-system | e5130c1ea82fc69a43b236bc6dcff41309b9f86e | [
"Apache-2.0"
] | 2 | 2017-12-28T03:46:53.000Z | 2018-10-29T04:09:59.000Z | cashmachine/src/main/java/es/udc/fic/acs/infmsb01/atm/atm/model/processor/action/instance/RequestAccountMovementsATMAction.java | marcos-sb/distributed-banking-system | e5130c1ea82fc69a43b236bc6dcff41309b9f86e | [
"Apache-2.0"
] | 3 | 2017-02-19T23:34:20.000Z | 2021-08-28T09:01:13.000Z | 23.208333 | 109 | 0.786355 | 6,989 | package es.udc.fic.acs.infmsb01.atm.atm.model.processor.action.instance;
import java.io.IOException;
import java.text.ParseException;
import es.udc.fic.acs.infmsb01.atm.common.model.processor.action.NetAction;
public final class RequestAccountMovementsATMAction extends NetAction {
public RequestAccountMovementsATMAction() {
super();
}
@Override
public Object execute() throws IOException, InstantiationException, IllegalAccessException, ParseException {
this.getTransportProcessor().send(getMessage());
return getMessage();
}
}
|
3e1084f3ae513a9db943e1860338e7c9c8a3fd89 | 768 | java | Java | src/main/java/com/sap/exercise/builder/fields/TitleFieldInfo.java | radito3/TaskManager | 5cac9b42ba2927f39016bc9e00d7cf40771bf017 | [
"MIT"
] | 2 | 2018-09-04T10:18:16.000Z | 2018-09-23T11:48:18.000Z | src/main/java/com/sap/exercise/builder/fields/TitleFieldInfo.java | radito3/TaskManager | 5cac9b42ba2927f39016bc9e00d7cf40771bf017 | [
"MIT"
] | null | null | null | src/main/java/com/sap/exercise/builder/fields/TitleFieldInfo.java | radito3/TaskManager | 5cac9b42ba2927f39016bc9e00d7cf40771bf017 | [
"MIT"
] | 2 | 2018-09-11T22:27:18.000Z | 2019-05-08T17:35:22.000Z | 21.333333 | 63 | 0.682292 | 6,990 | package com.sap.exercise.builder.fields;
import com.sap.exercise.builder.FieldInfo;
import com.sap.exercise.builder.FieldValueUtils;
import com.sap.exercise.model.Event;
import org.apache.commons.lang3.StringUtils;
public class TitleFieldInfo implements FieldInfo {
private Event event;
public TitleFieldInfo(Event event) {
this.event = event;
}
@Override
public String getName() {
return "title";
}
@Override
public boolean isMandatory() {
return true;
}
@Override
public String getNameToDisplay() {
return StringUtils.capitalize(this.getName());
}
@Override
public void parseArgument(String arg) {
event.setTitle(FieldValueUtils.valueOfStr(arg.trim()));
}
}
|
3e10850305e4b55154cb838f6ebad5a82dc25099 | 894 | java | Java | base/src/main/java/tv/mechjack/mechjackbot/chatbot/kicl/KiclChatBotListener.java | mechjacktv/mechjackbot | 67eae2b3459436036096c9196074fe84b36008d7 | [
"MIT"
] | 1 | 2019-02-13T02:00:01.000Z | 2019-02-13T02:00:01.000Z | base/src/main/java/tv/mechjack/mechjackbot/chatbot/kicl/KiclChatBotListener.java | mechjacktv/mechjackbot | 67eae2b3459436036096c9196074fe84b36008d7 | [
"MIT"
] | 59 | 2018-10-20T20:44:52.000Z | 2019-03-04T01:36:43.000Z | base/src/main/java/tv/mechjack/mechjackbot/chatbot/kicl/KiclChatBotListener.java | mechjacktv/mechjackbot | 67eae2b3459436036096c9196074fe84b36008d7 | [
"MIT"
] | 1 | 2019-02-20T15:46:54.000Z | 2019-02-20T15:46:54.000Z | 30.827586 | 96 | 0.83557 | 6,991 | package tv.mechjack.mechjackbot.chatbot.kicl;
import javax.inject.Inject;
import org.kitteh.irc.client.library.event.channel.ChannelMessageEvent;
import net.engio.mbassy.listener.Handler;
import tv.mechjack.mechjackbot.api.ChatMessageEventHandler;
final class KiclChatBotListener {
private final KiclChatMessageEventFactory chatMessageEventFactory;
private final ChatMessageEventHandler chatMessageEventHandler;
@Inject
KiclChatBotListener(final KiclChatMessageEventFactory chatMessageEventFactory,
final ChatMessageEventHandler chatMessageEventHandler) {
this.chatMessageEventFactory = chatMessageEventFactory;
this.chatMessageEventHandler = chatMessageEventHandler;
}
@Handler
public final void onChannelMessageEvent(final ChannelMessageEvent event) {
this.chatMessageEventHandler.handleMessageEvent(this.chatMessageEventFactory.create(event));
}
}
|
3e10857a502eeb45b07bfd82a8400b3780e5d5a2 | 221 | java | Java | 2A/S7/IDM/TP/TP7/fr.n7.simplepdl.txt.pdl/src-gen/fr/n7/simplepdl/txt/scoping/AbstractPDLScopeProvider.java | MOUDDENEHamza/ENSEEIHT | a90b1dee0c8d18a9578153a357278d99405bb534 | [
"Apache-2.0"
] | 4 | 2020-05-02T12:32:32.000Z | 2022-01-12T20:20:35.000Z | 2A/S7/IDM/TP/TP7/fr.n7.simplepdl.txt.pdl/src-gen/fr/n7/simplepdl/txt/scoping/AbstractPDLScopeProvider.java | MOUDDENEHamza/ENSEEIHT | a90b1dee0c8d18a9578153a357278d99405bb534 | [
"Apache-2.0"
] | 2 | 2021-01-14T20:03:26.000Z | 2022-01-30T01:10:00.000Z | 2A/S7/IDM/TP/TP7/fr.n7.simplepdl.txt.pdl/src-gen/fr/n7/simplepdl/txt/scoping/AbstractPDLScopeProvider.java | MOUDDENEHamza/ENSEEIHT | a90b1dee0c8d18a9578153a357278d99405bb534 | [
"Apache-2.0"
] | 13 | 2020-11-11T21:28:11.000Z | 2022-02-19T13:54:22.000Z | 22.1 | 80 | 0.80543 | 6,992 | /*
* generated by Xtext 2.17.1
*/
package fr.n7.simplepdl.txt.scoping;
import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider;
public abstract class AbstractPDLScopeProvider extends DelegatingScopeProvider {
}
|
3e10858854b479532dc8d35859fe6f2a1841a06c | 9,467 | java | Java | threatconnect-sdk/threatconnect-sdk-core/src/main/java/com/threatconnect/sdk/client/reader/ReaderAdapterFactory.java | ThreatConnect-Inc/threatconnect-java | af1397e9e9d49c4391e321cbd627340bfd3003bc | [
"Apache-2.0"
] | 4 | 2015-07-09T20:53:08.000Z | 2018-06-12T21:47:42.000Z | threatconnect-sdk/threatconnect-sdk-core/src/main/java/com/threatconnect/sdk/client/reader/ReaderAdapterFactory.java | ThreatConnect-Inc/threatconnect-java | af1397e9e9d49c4391e321cbd627340bfd3003bc | [
"Apache-2.0"
] | 6 | 2017-03-08T20:42:53.000Z | 2020-03-10T14:02:11.000Z | threatconnect-sdk/threatconnect-sdk-core/src/main/java/com/threatconnect/sdk/client/reader/ReaderAdapterFactory.java | ThreatConnect-Inc/threatconnect-java | af1397e9e9d49c4391e321cbd627340bfd3003bc | [
"Apache-2.0"
] | 2 | 2016-07-27T16:37:18.000Z | 2017-03-08T19:43:57.000Z | 29.309598 | 126 | 0.783881 | 6,993 | /*
* 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.threatconnect.sdk.client.reader;
import com.threatconnect.sdk.conn.Connection;
import com.threatconnect.sdk.server.entity.Address;
import com.threatconnect.sdk.server.entity.Adversary;
import com.threatconnect.sdk.server.entity.Campaign;
import com.threatconnect.sdk.server.entity.CustomIndicator;
import com.threatconnect.sdk.server.entity.Email;
import com.threatconnect.sdk.server.entity.EmailAddress;
import com.threatconnect.sdk.server.entity.Group;
import com.threatconnect.sdk.server.entity.Host;
import com.threatconnect.sdk.server.entity.Incident;
import com.threatconnect.sdk.server.entity.Indicator;
import com.threatconnect.sdk.server.entity.Signature;
import com.threatconnect.sdk.server.entity.Threat;
import com.threatconnect.sdk.server.entity.Url;
import com.threatconnect.sdk.server.response.entity.AddressListResponse;
import com.threatconnect.sdk.server.response.entity.AddressResponse;
import com.threatconnect.sdk.server.response.entity.AdversaryListResponse;
import com.threatconnect.sdk.server.response.entity.AdversaryResponse;
import com.threatconnect.sdk.server.response.entity.CampaignListResponse;
import com.threatconnect.sdk.server.response.entity.CampaignResponse;
import com.threatconnect.sdk.server.response.entity.CustomIndicatorListResponse;
import com.threatconnect.sdk.server.response.entity.CustomIndicatorResponse;
import com.threatconnect.sdk.server.response.entity.EmailAddressListResponse;
import com.threatconnect.sdk.server.response.entity.EmailAddressResponse;
import com.threatconnect.sdk.server.response.entity.EmailListResponse;
import com.threatconnect.sdk.server.response.entity.EmailResponse;
import com.threatconnect.sdk.server.response.entity.HostListResponse;
import com.threatconnect.sdk.server.response.entity.HostResponse;
import com.threatconnect.sdk.server.response.entity.IncidentListResponse;
import com.threatconnect.sdk.server.response.entity.IncidentResponse;
import com.threatconnect.sdk.server.response.entity.SignatureListResponse;
import com.threatconnect.sdk.server.response.entity.SignatureResponse;
import com.threatconnect.sdk.server.response.entity.ThreatListResponse;
import com.threatconnect.sdk.server.response.entity.ThreatResponse;
import com.threatconnect.sdk.server.response.entity.UrlListResponse;
import com.threatconnect.sdk.server.response.entity.UrlResponse;
/**
* @author dtineo
*/
public class ReaderAdapterFactory
{
public static AbstractGroupReaderAdapter<Adversary> createAdversaryGroupReader(Connection conn)
{
return new AbstractGroupReaderAdapter<Adversary>(conn, AdversaryResponse.class, Adversary.class,
AdversaryListResponse.class)
{
@Override
public String getUrlType()
{
return "adversaries";
}
};
}
public static AbstractGroupReaderAdapter<Campaign> createCampaignGroupReader(Connection conn)
{
return new AbstractGroupReaderAdapter<Campaign>(conn, CampaignResponse.class, Campaign.class,
CampaignListResponse.class)
{
@Override
public String getUrlType()
{
return "campaigns";
}
};
}
public static AbstractGroupReaderAdapter<Email> createEmailGroupReader(Connection conn)
{
return new AbstractGroupReaderAdapter<Email>(conn, EmailResponse.class, Email.class, EmailListResponse.class)
{
@Override
public String getUrlType()
{
return "emails";
}
};
}
public static AbstractGroupReaderAdapter<Incident> createIncidentGroupReader(Connection conn)
{
return new AbstractGroupReaderAdapter<Incident>(conn, IncidentResponse.class, Incident.class,
IncidentListResponse.class)
{
@Override
public String getUrlType()
{
return "incidents";
}
};
}
public static AbstractGroupReaderAdapter<Signature> createSignatureGroupReader(Connection conn)
{
return new AbstractGroupReaderAdapter<Signature>(conn, SignatureResponse.class, Signature.class,
SignatureListResponse.class)
{
@Override
public String getUrlType()
{
return "signatures";
}
};
}
public static AbstractGroupReaderAdapter<Threat> createThreatGroupReader(Connection conn)
{
return new AbstractGroupReaderAdapter<Threat>(conn, ThreatResponse.class, Threat.class,
ThreatListResponse.class)
{
@Override
public String getUrlType()
{
return "threats";
}
};
}
public static AbstractIndicatorReaderAdapter<Address> createAddressIndicatorReader(Connection conn)
{
return new AbstractIndicatorReaderAdapter<Address>(conn, AddressResponse.class, Address.class,
AddressListResponse.class)
{
@Override
public String getUrlType()
{
return "addresses";
}
};
}
public static AbstractIndicatorReaderAdapter<EmailAddress> createEmailAddressIndicatorReader(Connection conn)
{
return new AbstractIndicatorReaderAdapter<EmailAddress>(conn, EmailAddressResponse.class, EmailAddress.class,
EmailAddressListResponse.class)
{
@Override
public String getUrlType()
{
return "emailAddresses";
}
};
}
public static AbstractIndicatorReaderAdapter<CustomIndicator> createCustomIndicatorReader(Connection conn, final String type)
{
return new AbstractIndicatorReaderAdapter<CustomIndicator>(conn, CustomIndicatorResponse.class, CustomIndicator.class,
CustomIndicatorListResponse.class)
{
@Override
public String getUrlType()
{
return type;
}
};
}
public static FileIndicatorReaderAdapter createFileIndicatorReader(Connection conn)
{
return new FileIndicatorReaderAdapter(conn);
}
public static AbstractIndicatorReaderAdapter<Host> createHostIndicatorReader(Connection conn)
{
return new AbstractIndicatorReaderAdapter<Host>(conn, HostResponse.class, Host.class, HostListResponse.class)
{
@Override
public String getUrlType()
{
return "hosts";
}
};
}
public static AbstractIndicatorReaderAdapter<Url> createUrlIndicatorReader(Connection conn)
{
return new AbstractIndicatorReaderAdapter<Url>(conn, UrlResponse.class, Url.class, UrlListResponse.class)
{
@Override
public String getUrlType()
{
return "urls";
}
};
}
public static OwnerReaderAdapter createOwnerReader(Connection conn)
{
return new OwnerReaderAdapter(conn);
}
public static IndicatorTypeReaderAdapter createIndicatorTypeReaderAdapter(Connection conn)
{
return new IndicatorTypeReaderAdapter(conn);
}
public static SecurityLabelReaderAdapter createSecurityLabelReader(Connection conn)
{
return new SecurityLabelReaderAdapter(conn);
}
public static TagReaderAdapter createTagReader(Connection conn)
{
return new TagReaderAdapter(conn);
}
public static VictimReaderAdapter createVictimReader(Connection conn)
{
return new VictimReaderAdapter(conn);
}
public static AbstractGroupReaderAdapter createGroupReader(String type, Connection conn)
{
return createGroupReader(Group.Type.valueOf(type), conn);
}
public static AbstractGroupReaderAdapter createGroupReader(Group.Type type, Connection conn)
{
switch (type)
{
case Adversary:
return createAdversaryGroupReader(conn);
case Campaign:
return createCampaignGroupReader(conn);
case Document:
return createDocumentReader(conn);
case Email:
return createEmailGroupReader(conn);
case Incident:
return createIncidentGroupReader(conn);
case Signature:
return createSignatureGroupReader(conn);
case Threat:
return createThreatGroupReader(conn);
case Task:
return createTaskReader(conn);
default:
throw new IllegalArgumentException(type + " is not a vaild GroupType");
}
}
public static AbstractIndicatorReaderAdapter createIndicatorReader(String type, Connection conn)
{
if (Character.isLowerCase(type.charAt(0)))
{
String indType = Character.toLowerCase(type.charAt(0)) + type.substring(1);
return createIndicatorReader(Indicator.Type.valueOf(indType), conn);
}
else
{
return createIndicatorReader(Indicator.Type.valueOf(type), conn);
}
}
public static AbstractIndicatorReaderAdapter createIndicatorReader(Indicator.Type type, Connection conn)
{
if (type == null)
{
return null;
}
switch (type)
{
case Address:
return createAddressIndicatorReader(conn);
case EmailAddress:
return createEmailAddressIndicatorReader(conn);
case File:
return createFileIndicatorReader(conn);
case Host:
return createHostIndicatorReader(conn);
case Url:
return createUrlIndicatorReader(conn);
default:
return null;
}
}
/**
* Creates an instance of {@link DocumentReaderAdapter}.
*
* @param conn
* connection defining api urls
* @return and instance of DocumentReaderAdapter
*/
public static DocumentReaderAdapter createDocumentReader(Connection conn)
{
return new DocumentReaderAdapter(conn);
}
public static BatchReaderAdapter<Indicator> createIndicatorBatchReader(Connection conn)
{
return new BatchReaderAdapter<>(conn);
}
public static ExchangeReaderAdapter createExchangeReader(Connection conn)
{
return new ExchangeReaderAdapter(conn);
}
public static TaskReaderAdapter createTaskReader(Connection conn)
{
return new TaskReaderAdapter(conn);
}
public static DataStoreReaderAdapter createDataStoreReaderAdapter(Connection conn)
{
return new DataStoreReaderAdapter(conn);
}
}
|
3e1085ac781e13890160666e16d6474c42767e91 | 2,305 | java | Java | src/ooga/display/communication/DisplayComm.java | williamconvertino/Monopoly | 267a724ffd67638944be92780b8b87b18ff13e7b | [
"MIT"
] | null | null | null | src/ooga/display/communication/DisplayComm.java | williamconvertino/Monopoly | 267a724ffd67638944be92780b8b87b18ff13e7b | [
"MIT"
] | null | null | null | src/ooga/display/communication/DisplayComm.java | williamconvertino/Monopoly | 267a724ffd67638944be92780b8b87b18ff13e7b | [
"MIT"
] | null | null | null | 26.193182 | 95 | 0.701518 | 6,994 | package ooga.display.communication;
import javafx.scene.control.Alert.AlertType;
import ooga.display.DisplayManager;
import ooga.display.communication.DisplayStateSignaler.State;
import ooga.exceptions.PlayerWarning;
import ooga.model.data.cards.Card;
import ooga.model.data.player.Player;
import ooga.model.data.tilemodels.ActionTileModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* The display communication which shows exceptions
*
* @author William Convertino
*/
public class DisplayComm {
private static final Logger LOG = LogManager.getLogger(DisplayComm.class);
private final DisplayManager displayManager;
private final DisplayStateSignaler signaler;
/**
* The constructor to make a exception handler in DisplayComm
*/
public DisplayComm(DisplayManager dm) {
this.displayManager = dm;
this.signaler = new DisplayStateSignaler(dm);
}
/**
* Handles showing the exception passed in
*
* @param e
*/
public void showException(Exception e) {
if (e instanceof PlayerWarning) {
displayManager.showAlert(((PlayerWarning) e).getDescription(), AlertType.ERROR);
} else {
LOG.error(String.format("%s", e.toString()));
}
}
/**
* Signals the display that a new state has been reached.
*
* @param state the state that has been reached.
*/
public void signalState(State state) {
signaler.signalDisplay(state);
}
/**
* Displays the specified card.
*
* @param card the card to display.
*/
public void displayCard(Card card) {
displayManager.showAlert(
String.format("You have drawn the following card:\n\n %s", card.getDescription()),
AlertType.INFORMATION);
}
/**
* Displays the specified tile.
*
* @param tile the tile to display.
*/
public void displayActionTile(ActionTileModel tile) {
displayManager.showAlert(String.format("[%s] - %s", tile.getName(), tile.getDescription()),
AlertType.INFORMATION);
}
/**
* Shows an alert that a player has lost.
*
* @param player the player who has lost.
*/
public void displayPlayerLose(Player player) {
displayManager.showAlert(String.format("Player: %s has lost the game", player.getName()),
AlertType.INFORMATION);
}
}
|
3e1085bb29c34fda0eb7bd65d23d6aa6b5446ae3 | 1,689 | java | Java | src/main/java/org/iton/jssi/ursa/anoncred/CredentialPrivateKey.java | ITON-Solutions/Revocable-Anonymous-Credentials | b416a5baaf9c9c0cd89541f0307e1985fbe31437 | [
"MIT"
] | 1 | 2021-11-13T02:22:29.000Z | 2021-11-13T02:22:29.000Z | src/main/java/org/iton/jssi/ursa/anoncred/CredentialPrivateKey.java | ITON-Solutions/revocable-anonymous-credentials | b416a5baaf9c9c0cd89541f0307e1985fbe31437 | [
"MIT"
] | null | null | null | src/main/java/org/iton/jssi/ursa/anoncred/CredentialPrivateKey.java | ITON-Solutions/revocable-anonymous-credentials | b416a5baaf9c9c0cd89541f0307e1985fbe31437 | [
"MIT"
] | null | null | null | 41.195122 | 107 | 0.732978 | 6,995 | /*
*
* The MIT License
*
* Copyright 2019 ITON Solutions.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.iton.jssi.ursa.anoncred;
/**
* Issuer Private Key`: contains 2 internal parts.
* One for signing primary credentials and second for signing non-revocation credentials.
*/
public class CredentialPrivateKey {
public CredentialPrimaryPrivateKey p_key;
public CredentialRevocationPrivateKey r_key;
public CredentialPrivateKey( CredentialPrimaryPrivateKey p_key, CredentialRevocationPrivateKey r_key){
this.p_key = p_key;
this.r_key = r_key;
}
}
|
3e108619afc9376bfe7c4a1059211e7da3958259 | 83 | java | Java | src/Priority2.java | JayneGale/SearchAndCompress | 8d6b4e47a146aae78bd7df808da61a7cbac9a638 | [
"MIT"
] | null | null | null | src/Priority2.java | JayneGale/SearchAndCompress | 8d6b4e47a146aae78bd7df808da61a7cbac9a638 | [
"MIT"
] | null | null | null | src/Priority2.java | JayneGale/SearchAndCompress | 8d6b4e47a146aae78bd7df808da61a7cbac9a638 | [
"MIT"
] | null | null | null | 16.6 | 56 | 0.710843 | 6,996 | public enum Priority2 {
space, lowercase, uppercase, digit, other, control }
|
3e10861be9ca0f9de4f9553481274ba51f901fd4 | 1,308 | java | Java | src/main/java/org/jnosql/polyglot/graph/GraphProducer.java | carlosepdsJava/polyglot-persistence | d71a71842d3a490e75a47dd8a78c0658c344ab62 | [
"Apache-2.0"
] | 7 | 2018-02-17T16:19:05.000Z | 2021-11-11T17:53:50.000Z | src/main/java/org/jnosql/polyglot/graph/GraphProducer.java | carlosepdsJava/polyglot-persistence | d71a71842d3a490e75a47dd8a78c0658c344ab62 | [
"Apache-2.0"
] | 1 | 2021-05-13T14:06:58.000Z | 2021-05-13T14:06:58.000Z | src/main/java/org/jnosql/polyglot/graph/GraphProducer.java | carlosepdsJava/polyglot-persistence | d71a71842d3a490e75a47dd8a78c0658c344ab62 | [
"Apache-2.0"
] | 5 | 2018-02-22T14:48:33.000Z | 2021-05-12T22:09:51.000Z | 29.727273 | 106 | 0.750765 | 6,997 | /*
* Copyright (c) 2017 Otávio Santana and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana (@otaviojava)
* Carlos Santos (@carlosepdsJava)
*/
package org.jnosql.polyglot.graph;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
@ApplicationScoped
class GraphProducer {
@Inject
@ConfigProperty(name = "graph") //switch to NoSQL that is configured in microprofile-config.properties
private Graph graph;
@Produces
@ApplicationScoped
public Graph getGraph() {
return graph;
}
public void destroy(@Disposes Graph graph) throws Exception {
graph.close();
}
}
|
3e10862cbb321eb44a5c261c25be6fc7336b8a4e | 4,577 | java | Java | src/main/java/ml/shifu/shifu/udf/stats/AbstractVarStats.java | yexiao2016z/shifu_tensorflow | 8bc6a69657099077de8bedc7cd893ed737afe326 | [
"Apache-2.0"
] | 200 | 2015-01-08T15:15:28.000Z | 2022-01-07T12:24:09.000Z | src/main/java/ml/shifu/shifu/udf/stats/AbstractVarStats.java | yexiao2016z/shifu_tensorflow | 8bc6a69657099077de8bedc7cd893ed737afe326 | [
"Apache-2.0"
] | 457 | 2015-01-05T02:07:35.000Z | 2021-11-12T12:29:14.000Z | src/main/java/ml/shifu/shifu/udf/stats/AbstractVarStats.java | yexiao2016z/shifu_tensorflow | 8bc6a69657099077de8bedc7cd893ed737afe326 | [
"Apache-2.0"
] | 128 | 2015-01-06T08:26:44.000Z | 2022-03-23T07:32:34.000Z | 36.03937 | 127 | 0.655233 | 6,998 | /*
* 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 ml.shifu.shifu.udf.stats;
import java.util.ArrayList;
import java.util.List;
import ml.shifu.shifu.container.obj.ColumnConfig;
import ml.shifu.shifu.container.obj.ModelConfig;
import ml.shifu.shifu.core.StreamStatsCalculator;
import ml.shifu.shifu.core.binning.EqualPopulationBinning;
import org.apache.pig.backend.executionengine.ExecException;
import org.apache.pig.data.DataBag;
/**
* AbstractVarStats class
*/
public abstract class AbstractVarStats {
protected ModelConfig modelConfig;
protected ColumnConfig columnConfig;
protected Double valueThreshold;
protected StreamStatsCalculator streamStatsCalculator;
protected EqualPopulationBinning binning;
protected long missingValueCnt = 0;
protected long invalidValueCnt = 0;
protected long totalValueCnt = 0;
public AbstractVarStats(ModelConfig modelConfig, ColumnConfig columnConfig, Double valueThreshold) {
this.modelConfig = modelConfig;
this.columnConfig = columnConfig;
this.valueThreshold = valueThreshold;
this.streamStatsCalculator = new StreamStatsCalculator(valueThreshold);
this.binning = new EqualPopulationBinning(modelConfig.getStats().getMaxNumBin());
}
protected void initializeZeroArr(Integer[] arr) {
for ( int i = 0; i < arr.length; i ++ ) {
arr[i] = Integer.valueOf(0);
}
}
protected void initializeZeroArr(Double[] arr) {
for ( int i = 0; i < arr.length; i ++ ) {
arr[i] = Double.valueOf(0.0);
}
}
protected void increaseInstCnt(Integer[] binCountArr, int binNum) {
Integer cnt = binCountArr[binNum];
if ( cnt == null ) {
cnt = Integer.valueOf(1);
} else {
cnt = Integer.valueOf(cnt.intValue() + 1);
}
binCountArr[binNum] = cnt;
}
protected void increaseInstCnt(Double[] binWeightCountArr, int binNum, double weight) {
Double weightCount = binWeightCountArr[binNum];
if ( weightCount == null ) {
weightCount = Double.valueOf(weight);
} else {
weightCount = Double.valueOf(weightCount.doubleValue() + weight);
}
binWeightCountArr[binNum] = weightCount;
}
protected void calculateBinPosRateAndAvgScore() {
List<Double> binPositiveRate = new ArrayList<Double>();
for (int i = 0; i < columnConfig.getBinCountPos().size(); i++) {
int binPosCount = columnConfig.getBinCountPos().get(i);
int binNegCount = columnConfig.getBinCountNeg().get(i);
if ( binPosCount + binNegCount == 0 ) {
binPositiveRate.add(0.0);
} else {
binPositiveRate.add( ((double)binPosCount) / (binPosCount + binNegCount) );
}
}
columnConfig.setBinPosCaseRate(binPositiveRate);
List<Integer> binAvgScore = new ArrayList<Integer>();
for ( int i = 0; i < columnConfig.getBinCountPos().size(); i++ ) {
binAvgScore.add(0);
}
columnConfig.setBinAvgScore(binAvgScore);
}
public abstract void runVarStats(String binningInfo, DataBag databag) throws ExecException;
public static AbstractVarStats getVarStatsInst(ModelConfig modelConfig, ColumnConfig columnConfig, Double valueThreshold) {
if ( columnConfig == null ) {
return null;
}
if ( columnConfig.isCategorical() ) {
return new CategoricalVarStats(modelConfig, columnConfig, valueThreshold);
} else {
return new NumericalVarStats(modelConfig, columnConfig, valueThreshold);
}
}
}
|
3e10865555555a43a9325f05a2c0946f081b670e | 166 | java | Java | spring-content-commons/src/main/java/org/springframework/content/commons/repository/factory/StoreFactory.java | bowl-of-petunias/spring-content | 7117d35c6981af8a01d634b776a4a9ac0ad13059 | [
"Apache-2.0"
] | 214 | 2016-07-18T13:17:00.000Z | 2022-03-31T17:21:06.000Z | spring-content-commons/src/main/java/org/springframework/content/commons/repository/factory/StoreFactory.java | bowl-of-petunias/spring-content | 7117d35c6981af8a01d634b776a4a9ac0ad13059 | [
"Apache-2.0"
] | 781 | 2017-02-10T16:41:51.000Z | 2022-03-31T08:04:52.000Z | spring-content-commons/src/main/java/org/springframework/content/commons/repository/factory/StoreFactory.java | bowl-of-petunias/spring-content | 7117d35c6981af8a01d634b776a4a9ac0ad13059 | [
"Apache-2.0"
] | 68 | 2017-02-08T08:50:06.000Z | 2022-03-23T19:17:38.000Z | 16.6 | 63 | 0.76506 | 6,999 | package org.springframework.content.commons.repository.factory;
public interface StoreFactory {
public Class<?> getStoreInterface();
public <T> T getStore();
}
|
3e1086a59b3d63487c0711194c9245a6cdf519a4 | 3,097 | java | Java | src/test/java/io/ous/justconfig/sources/ConfigurationSourceChainUnitTest.java | asafh/justconfig | 599add1804317ba838816d5652ceb0221c7d43c6 | [
"Apache-2.0"
] | 1 | 2017-06-14T19:27:10.000Z | 2017-06-14T19:27:10.000Z | src/test/java/io/ous/justconfig/sources/ConfigurationSourceChainUnitTest.java | asafh/justconfig | 599add1804317ba838816d5652ceb0221c7d43c6 | [
"Apache-2.0"
] | null | null | null | src/test/java/io/ous/justconfig/sources/ConfigurationSourceChainUnitTest.java | asafh/justconfig | 599add1804317ba838816d5652ceb0221c7d43c6 | [
"Apache-2.0"
] | 1 | 2019-04-23T03:56:00.000Z | 2019-04-23T03:56:00.000Z | 28.154545 | 110 | 0.703261 | 7,000 | package io.ous.justconfig.sources;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import io.ous.justconfig.testutil.SimpleMock;
import io.ous.justconfig.testutil.TestHelper;
import io.ous.justconfig.util.Primitives;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class ConfigurationSourceChainUnitTest {
@Parameters(name="{index}: Size={0}, Type={1}")
public static Collection<Object[]> data() {
int[] sizes = {0,1,2,3,16,13,75};
Set<Class<?>> primitives = Primitives.getPrimitives();
primitives.remove(Void.TYPE);
List<Object[]> ret = new ArrayList<Object[]>();
for(int size : sizes) {
for(Class<?> prim : primitives) {
ret.add(new Object[] {size, prim});
}
}
return ret;
}
private static class ConfigurationSourceMock extends SimpleMock<ConfigurationSource> {
public ConfigurationSourceMock() {
super(ConfigurationSource.class);
}
}
private ConfigurationSourceChain config;
private Random random;
private final ConfigurationSourceMock[] mocks;
private final Class<?> type;
public ConfigurationSourceChainUnitTest(int size, Class<?> type) {
mocks = new ConfigurationSourceMock[size];
this.type = type;
}
@Before
public void init() {
random = TestHelper.getRandom();
ConfigurationSource[] sources = new ConfigurationSource[mocks.length];
for(int i = 0 ; i < mocks.length; ++i) {
mocks[i] = new ConfigurationSourceMock();
sources[i] = mocks[i].getMock();
}
config = new ConfigurationSourceChain(sources);
}
@Test
public void testGetObject() {
if(mocks.length == 0) {
Object[] nulls = new Object[] {
config.getByte("x"),
config.getShort("x"),
config.getLong("x"),
config.getDouble("x"),
config.getFloat("x"),
config.getInteger("x"),
config.getBoolean("x"),
config.getCharacter("x")
};
for(Object obj : nulls) {
assertNull(obj);
}
return;
}
Object val = TestHelper.getBasicValue(random, type);
ConfigurationSourceMock randMock = getRandomSource();
randMock.always(val);
assertEquals(val, TestHelper.getBasicValue(config, type));
int times = 1;
for(ConfigurationSourceMock mock : mocks) {
TestHelper.getBasicValue(verify(mock.getMock(),times(times)), type);
if(mock == randMock) { //hard equality ok, from here onwards no invocations should have occurred
times = 0;
}
for(Class<?> primitive : Primitives.getPrimitives()) {
if(Void.TYPE.equals(primitive) || type.equals(primitive)) { //For any other type except this one and Void
continue;
}
TestHelper.getBasicValue(verify(mock.getMock(), never()), primitive); //should never be retreived
}
}
}
private ConfigurationSourceMock getRandomSource() {
int target = random.nextInt(mocks.length);
return mocks[target];
}
}
|
3e108706a19e080c688d617ed9219d729f0ef707 | 614 | java | Java | src/de/gurkenlabs/litiengine/graphics/emitters/particles/RectangleOutlineParticle.java | bdelozier23/litiengine | 3fc443b9ea8073c3ee363a600ea662e8c177e19c | [
"MIT"
] | null | null | null | src/de/gurkenlabs/litiengine/graphics/emitters/particles/RectangleOutlineParticle.java | bdelozier23/litiengine | 3fc443b9ea8073c3ee363a600ea662e8c177e19c | [
"MIT"
] | 69 | 2019-02-12T16:31:33.000Z | 2019-04-13T10:38:58.000Z | src/de/gurkenlabs/litiengine/graphics/emitters/particles/RectangleOutlineParticle.java | sashahe/litiengine | 6c52169ec90aa544568b5de21ff26ae02201ef18 | [
"MIT"
] | null | null | null | 34.111111 | 137 | 0.762215 | 7,001 | package de.gurkenlabs.litiengine.graphics.emitters.particles;
import java.awt.Color;
import java.awt.Shape;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
public class RectangleOutlineParticle extends OutlineParticle {
public RectangleOutlineParticle(final float width, final float height, final Color color, final int ttl) {
super(width, height, color, ttl);
}
@Override
protected Shape getShape(Point2D emitterOrigin) {
return new Rectangle2D.Float(this.getAbsoluteX(emitterOrigin), this.getAbsoluteY(emitterOrigin), this.getWidth(), this.getHeight());
}
}
|
3e10870d75fddc9997c40b4219da2f2e0368759b | 2,845 | java | Java | src/test/java/test/CollectionAsValueTest.java | ashr123/jcypher | d1191cb1e485220829f5f631ed3fd7820e4aeafb | [
"Apache-2.0"
] | 91 | 2015-03-05T15:54:23.000Z | 2021-10-29T19:18:37.000Z | src/test/java/test/CollectionAsValueTest.java | ashr123/jcypher | d1191cb1e485220829f5f631ed3fd7820e4aeafb | [
"Apache-2.0"
] | 58 | 2015-07-07T11:35:13.000Z | 2020-05-27T08:53:39.000Z | src/test/java/test/CollectionAsValueTest.java | ashr123/jcypher | d1191cb1e485220829f5f631ed3fd7820e4aeafb | [
"Apache-2.0"
] | 23 | 2015-08-12T19:06:15.000Z | 2021-06-10T08:50:51.000Z | 33.869048 | 129 | 0.684007 | 7,002 | /************************************************************************
* Copyright (c) 2016 IoT-Solutions e.U.
*
* 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 test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import iot.jcypher.query.JcQuery;
import iot.jcypher.query.api.IClause;
import iot.jcypher.query.factories.JC;
import iot.jcypher.query.factories.clause.DO;
import iot.jcypher.query.factories.clause.MATCH;
import iot.jcypher.query.factories.clause.SEPARATE;
import iot.jcypher.query.values.JcCollection;
import iot.jcypher.query.values.JcNode;
import iot.jcypher.query.values.ValueElement;
import iot.jcypher.query.writer.Format;
import util.TestDataReader;
public class CollectionAsValueTest extends AbstractTestSuite {
@Test
public void testAsValue_01() {
String result;
String testId;
setDoPrint(true);
setDoAssert(true);
TestDataReader tdr = new TestDataReader("/test/Test_COLLECTION_AS_VALUE_01.txt");
ValueElement xpr;
JcCollection empty = new JcCollection("empty");
List<Object> myVals = new ArrayList<>();
myVals.add(1);
myVals.add("Hallo");
myVals.add(true);
JcCollection primList = new JcCollection(myVals);
JcCollection emptyVal = new JcCollection(Collections.emptyList());
/*******************************/
xpr = JC.coalesce(emptyVal, empty);
result = print(xpr, Format.PRETTY_1);
testId = "CAV_01";
assertQuery(testId, result, tdr.getTestData(testId));
xpr = JC.coalesce(primList, empty);
result = print(xpr, Format.PRETTY_1);
testId = "CAV_02";
assertQuery(testId, result, tdr.getTestData(testId));
/*******************************/
JcNode activeIn = new JcNode("a");
JcQuery q = new JcQuery();
q.setClauses(new IClause[]{
// MATCH.node(activeIn).label("ActiveIn"),
DO.SET(activeIn.property("ratings")).byExpression(JC.coalesce(activeIn.property("ratings"), primList).asCollection().add(3)),
SEPARATE.nextClause(),
DO.SET(activeIn.property("ratings")).byExpression(JC.coalesce(activeIn.property("ratings"), empty).asCollection().add(3))
});
result = print(q, Format.PRETTY_1);
testId = "CAV_03";
assertQuery(testId, result, tdr.getTestData(testId));
return;
}
}
|
3e1087d07e9234a5fe6c3ae4621bb6edd671fc4a | 939 | java | Java | forum/src/main/java/br/com/alura/forum/controller/dto/TopicoDto.java | fabianojp06/projElastic | 00cf4d1a8d2fed1e0edbfeccecabf9e4806d6766 | [
"MIT"
] | null | null | null | forum/src/main/java/br/com/alura/forum/controller/dto/TopicoDto.java | fabianojp06/projElastic | 00cf4d1a8d2fed1e0edbfeccecabf9e4806d6766 | [
"MIT"
] | null | null | null | forum/src/main/java/br/com/alura/forum/controller/dto/TopicoDto.java | fabianojp06/projElastic | 00cf4d1a8d2fed1e0edbfeccecabf9e4806d6766 | [
"MIT"
] | null | null | null | 21.340909 | 76 | 0.700745 | 7,003 | package br.com.alura.forum.controller.dto;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import br.com.alura.forum.modelo.Topico;
public class TopicoDto {
private Long id;
private String titulo;
private String mensagem;
private LocalDateTime dataCriacao;
public TopicoDto(Topico topico) {
this.id = topico.getId();
this.titulo = topico.getTitulo();
this.mensagem = topico.getMensagem();
this.dataCriacao = topico.getDataCriacao();
}
public Long getId() {
return id;
}
public String getTitulo() {
return titulo;
}
public String getMensagem() {
return mensagem;
}
public LocalDateTime getDataCriacao() {
return dataCriacao;
}
public static List<TopicoDto> converter(List<Topico> topicos) {
// TODO Auto-generated method stub
return topicos.stream().map(TopicoDto::new).collect(Collectors.toList());
}
}
|
3e1088024187878ff0c9f9030881e065cfd2ce13 | 1,789 | java | Java | com/planet_ink/coffee_mud/Exits/Gate.java | count-infinity/CoffeeMud | df458b8721af831f53d7f3275ab32c8c378c2241 | [
"Apache-2.0"
] | 149 | 2015-01-11T12:55:39.000Z | 2022-03-03T16:14:48.000Z | com/planet_ink/coffee_mud/Exits/Gate.java | count-infinity/CoffeeMud | df458b8721af831f53d7f3275ab32c8c378c2241 | [
"Apache-2.0"
] | 42 | 2015-02-08T03:44:01.000Z | 2022-02-10T08:52:43.000Z | com/planet_ink/coffee_mud/Exits/Gate.java | count-infinity/CoffeeMud | df458b8721af831f53d7f3275ab32c8c378c2241 | [
"Apache-2.0"
] | 104 | 2015-01-21T20:20:55.000Z | 2022-03-24T05:01:20.000Z | 30.322034 | 76 | 0.749022 | 7,004 | package com.planet_ink.coffee_mud.Exits;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
/*
Copyright 2001-2021 Bo Zimmerman
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.
*/
public class Gate extends StdClosedDoorway
{
@Override
public String ID()
{
return "Gate";
}
@Override
public String Name()
{
return "a gate";
}
@Override
public String doorName()
{
return "gate";
}
@Override
public String closedText()
{
return "a closed gate";
}
}
|
3e108816a08986f26a4b945ba86ec5bcb77f1108 | 414 | java | Java | src/main/java/de/lukweb/twitchchat/twitch/messages/WhisperAttributes.java | LukWebsForge/TwitchChat | 9f481b48b2e4fb80f254d9dd01c400ddca828f15 | [
"MIT"
] | 1 | 2016-12-20T18:57:12.000Z | 2016-12-20T18:57:12.000Z | src/main/java/de/lukweb/twitchchat/twitch/messages/WhisperAttributes.java | LukWebsForge/TwitchChat | 9f481b48b2e4fb80f254d9dd01c400ddca828f15 | [
"MIT"
] | 1 | 2016-12-20T16:01:06.000Z | 2016-12-20T16:01:06.000Z | src/main/java/de/lukweb/twitchchat/twitch/messages/WhisperAttributes.java | lukweb-de/twitch-chat | 9f481b48b2e4fb80f254d9dd01c400ddca828f15 | [
"MIT"
] | null | null | null | 19.714286 | 58 | 0.640097 | 7,005 | package de.lukweb.twitchchat.twitch.messages;
import java.util.Map;
public class WhisperAttributes extends MessageAttributes {
private String threadId;
public WhisperAttributes(Map<String, String> tags) {
super(tags);
if (tags.containsKey("thread-id")) {
threadId = tags.get("thread-id");
}
}
public String getThreadId() {
return threadId;
}
}
|
3e10890422886470d678d45d389a26459067468a | 1,755 | java | Java | service/src/test/java/uk/nhs/adaptors/gp2gp/common/task/TaskConsumerTest.java | nhsconnect/integration-adaptor-gp2gp | b4b28a190ec1deefd0b55bda12c59c747ef2b64b | [
"MIT"
] | 2 | 2020-11-23T11:40:58.000Z | 2021-03-16T09:54:45.000Z | service/src/test/java/uk/nhs/adaptors/gp2gp/common/task/TaskConsumerTest.java | nhsconnect/integration-adaptor-gp2gp | b4b28a190ec1deefd0b55bda12c59c747ef2b64b | [
"MIT"
] | 61 | 2020-11-24T16:16:06.000Z | 2022-01-04T09:28:00.000Z | service/src/test/java/uk/nhs/adaptors/gp2gp/common/task/TaskConsumerTest.java | nhsconnect/integration-adaptor-gp2gp | b4b28a190ec1deefd0b55bda12c59c747ef2b64b | [
"MIT"
] | 5 | 2021-02-02T19:15:23.000Z | 2022-03-31T15:27:03.000Z | 25.808824 | 81 | 0.736752 | 7,006 | package uk.nhs.adaptors.gp2gp.common.task;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import javax.jms.Message;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import lombok.SneakyThrows;
import uk.nhs.adaptors.gp2gp.common.service.MDCService;
@ExtendWith(MockitoExtension.class)
public class TaskConsumerTest {
@Mock
private TaskHandler taskHandler;
@InjectMocks
private TaskConsumer taskConsumer;
@Mock
private MDCService mdcService;
@Mock
private Message message;
@Test
@SneakyThrows
public void When_TaskHandlerReturnsTrue_Expect_MessageAcknowledged() {
when(taskHandler.handle(any())).thenReturn(true);
taskConsumer.receive(message);
verify(taskHandler).handle(message);
verify(message).acknowledge();
}
@Test
@SneakyThrows
public void When_TaskHandlerReturnsFalse_Expect_MessageNotAcknowledged() {
when(taskHandler.handle(any())).thenReturn(false);
taskConsumer.receive(message);
verify(taskHandler).handle(message);
verify(message, times(0)).acknowledge();
}
@Test
@SneakyThrows
public void When_TaskHandlerThrowsException_Expect_MessageNotAcknowledged() {
doThrow(RuntimeException.class).when(taskHandler).handle(message);
taskConsumer.receive(message);
verify(taskHandler).handle(message);
verify(message, times(0)).acknowledge();
}
}
|
3e10896196086c0b0a51f2df12fc863263d50501 | 753 | java | Java | src/main/java/com/isz/model/PostDayModel.java | hahahzh/isz | 9d08c87b621efd01cdb8037dc3d5df099aa65462 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/isz/model/PostDayModel.java | hahahzh/isz | 9d08c87b621efd01cdb8037dc3d5df099aa65462 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/isz/model/PostDayModel.java | hahahzh/isz | 9d08c87b621efd01cdb8037dc3d5df099aa65462 | [
"Apache-2.0"
] | null | null | null | 13.690909 | 59 | 0.7251 | 7,007 | package com.isz.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "user_postday")
public class PostDayModel {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long id;
private String postday_name;
public PostDayModel() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPostday_name() {
return postday_name;
}
public void setPostday_name(String postday_name) {
this.postday_name = postday_name;
}
public String toString() {
return String.format("postday[name='%s']", postday_name);
}
}
|
3e10904ecbf290379575a70a24d16880bccff678 | 5,813 | java | Java | src/test/java/com/bernardomg/velocity/tool/test/unit/html/TestHtmlToolRemoveClass.java | Bernardo-MG/maven-site-fixer | 899ef1fe8e6bd263741beda31a8e9d3e11149437 | [
"MIT"
] | 4 | 2016-04-16T15:54:39.000Z | 2020-12-10T06:36:04.000Z | src/test/java/com/bernardomg/velocity/tool/test/unit/html/TestHtmlToolRemoveClass.java | Bernardo-MG/maven-site-fixer | 899ef1fe8e6bd263741beda31a8e9d3e11149437 | [
"MIT"
] | 7 | 2016-03-09T08:44:35.000Z | 2017-11-08T14:45:40.000Z | src/test/java/com/bernardomg/velocity/tool/test/unit/html/TestHtmlToolRemoveClass.java | Bernardo-MG/maven-site-fixer | 899ef1fe8e6bd263741beda31a8e9d3e11149437 | [
"MIT"
] | 1 | 2016-03-09T08:21:09.000Z | 2016-03-09T08:21:09.000Z | 37.025478 | 114 | 0.659556 | 7,008 | /**
* The MIT License (MIT)
* <p>
* Copyright (c) 2015-2019 the original author or authors.
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.bernardomg.velocity.tool.test.unit.html;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import com.bernardomg.velocity.tool.HtmlTool;
/**
* Unit tests for {@link HtmlTool} testing the {@code removeClass} method.
*
* @author Bernardo Martínez Garrido
* @see HtmlTool
*/
@RunWith(JUnitPlatform.class)
@DisplayName("HtmlTool.removeClass")
public final class TestHtmlToolRemoveClass {
/**
* Instance of the utils class being tested.
*/
private final HtmlTool util = new HtmlTool();
/**
* Default constructor.
*/
public TestHtmlToolRemoveClass() {
super();
}
@Test
@DisplayName("If the class is duplicated all the instances are removed")
public final void testDuplicated() {
final String html; // HTML code to edit
final String htmlExpected; // Expected result
final String selector; // CSS selector
final String cssClass; // Removed class
final Element element; // Parsed HTML
html = "<a class=\"externalLink someClass externalLink\" href=\"https://somewhere.com/\">A link</a>";
htmlExpected = "<a class=\"someClass\" href=\"https://somewhere.com/\">A link</a>";
selector = "a.externalLink";
cssClass = "externalLink";
element = Jsoup.parse(html).body();
util.removeClass(element, selector, cssClass);
Assertions.assertEquals(htmlExpected, element.html());
}
@Test
@DisplayName("Removes a class when there are multiple other classes")
public final void testMultipleClasses() {
final String html; // HTML code to edit
final String htmlExpected; // Expected result
final String selector; // CSS selector
final String cssClass; // Removed class
final Element element; // Parsed HTML
html = "<a class=\"externalLink class1\" href=\"https://somewhere.com/\">A link</a>";
htmlExpected = "<a class=\"class1\" href=\"https://somewhere.com/\">A link</a>";
selector = "a.externalLink";
cssClass = "externalLink";
element = Jsoup.parse(html).body();
util.removeClass(element, selector, cssClass);
Assertions.assertEquals(htmlExpected, element.html());
}
@Test
@DisplayName("When there are no more classes are left after removing then the class attribute is removed too")
public final void testNoClassLeft() {
final String html; // HTML code to edit
final String htmlExpected; // Expected result
final String selector; // CSS selector
final String cssClass; // Removed class
final Element element; // Parsed HTML
html = "<a class=\"externalLink\" href=\"https://somewhere.com/\">A link</a>";
htmlExpected = "<a href=\"https://somewhere.com/\">A link</a>";
selector = "a.externalLink";
cssClass = "externalLink";
element = Jsoup.parse(html).body();
util.removeClass(element, selector, cssClass);
Assertions.assertEquals(htmlExpected, element.html());
}
@Test
@DisplayName("Removing a not existing class does nothing")
public final void testNotExistingClass_Untouched() {
final String html; // HTML code to edit
final String htmlExpected; // Expected result
final String selector; // CSS selector
final String cssClass; // Removed class
final Element element; // Parsed HTML
html = "<a href=\"https://somewhere.com/\">A link</a>";
htmlExpected = "<a href=\"https://somewhere.com/\">A link</a>";
selector = "a.externalLink";
cssClass = "externalLink";
element = Jsoup.parse(html).body();
util.removeClass(element, selector, cssClass);
Assertions.assertEquals(htmlExpected, element.html());
}
@Test
@DisplayName("Removing from an empty string does nothing")
public final void testRemoveClass_EmptyString() {
final String html; // HTML code to edit
final String htmlExpected; // Expected result
final Element element; // Parsed HTML
html = "";
element = Jsoup.parse(html).body();
util.removeClass(element, "a.externalLink", "externalLink");
htmlExpected = "";
Assertions.assertEquals(htmlExpected, element.html());
}
}
|
3e109200ce302d74b871159c109702864b6ea465 | 701 | java | Java | src/main/java/com/ocdsoft/bacta/swg/server/message/login/GameServerStatus.java | bacta/pre-cu-archive | 4758c181da9ba774a08f9e8f3810cca34360b732 | [
"MIT"
] | 1 | 2021-09-20T23:01:54.000Z | 2021-09-20T23:01:54.000Z | src/main/java/com/ocdsoft/bacta/swg/server/message/login/GameServerStatus.java | bacta/pre-cu-archive | 4758c181da9ba774a08f9e8f3810cca34360b732 | [
"MIT"
] | null | null | null | src/main/java/com/ocdsoft/bacta/swg/server/message/login/GameServerStatus.java | bacta/pre-cu-archive | 4758c181da9ba774a08f9e8f3810cca34360b732 | [
"MIT"
] | 1 | 2021-09-20T23:01:42.000Z | 2021-09-20T23:01:42.000Z | 25.035714 | 64 | 0.778887 | 7,009 | package com.ocdsoft.bacta.swg.server.message.login;
import com.ocdsoft.bacta.soe.message.GameNetworkMessage;
import com.ocdsoft.bacta.soe.message.Priority;
import com.ocdsoft.bacta.swg.server.object.login.ClusterEntry;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.nio.ByteBuffer;
@AllArgsConstructor
@Getter
@Priority(0x4)
public final class GameServerStatus extends GameNetworkMessage {
private final ClusterEntry clusterEntry;
public GameServerStatus(final ByteBuffer buffer) {
this.clusterEntry = new ClusterEntry(buffer);
}
@Override
public void writeToBuffer(final ByteBuffer buffer) {
clusterEntry.writeToBuffer(buffer);
}
}
|
3e109264bce7999da3ef24f4f7e736ac2ad7f482 | 516 | java | Java | src/main/java/com/funnysec/richardtang/funnytools/service/ITaskService.java | Richard-Tang/funnytools | 019f194e6d66f5350ff0d6d21bd1ad8a6bad2a0e | [
"Apache-2.0"
] | 3 | 2020-04-07T05:36:42.000Z | 2021-03-29T06:14:15.000Z | src/main/java/com/funnysec/richardtang/funnytools/service/ITaskService.java | Richard-Tang/funnytools | 019f194e6d66f5350ff0d6d21bd1ad8a6bad2a0e | [
"Apache-2.0"
] | null | null | null | src/main/java/com/funnysec/richardtang/funnytools/service/ITaskService.java | Richard-Tang/funnytools | 019f194e6d66f5350ff0d6d21bd1ad8a6bad2a0e | [
"Apache-2.0"
] | null | null | null | 20.64 | 61 | 0.705426 | 7,010 | package com.funnysec.richardtang.funnytools.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.funnysec.richardtang.funnytools.entity.Task;
import java.util.List;
/**
* 任务业务接口
*
* @author RichardTang
* @date 2020年3月15日21:44:05
*/
public interface ITaskService extends IService<Task> {
/**
* 批量添加任务,不会添加已经存在的任务
*
* @param target 目标集合
* @param type 任务类型
* @return boolean 是否操作成功
*/
boolean saveBatchTask(List<String> target, Integer type);
}
|
3e1093094cb2e572dcdaf3459ea37a74a13852ab | 4,478 | java | Java | configsource-etcd/src/main/java/org/microprofileext/config/source/etcd/EtcdConfigSource.java | derekm/config-ext | 24ebbca7afa4ede0e95c9b74836f55d3bbb06591 | [
"Apache-2.0"
] | null | null | null | configsource-etcd/src/main/java/org/microprofileext/config/source/etcd/EtcdConfigSource.java | derekm/config-ext | 24ebbca7afa4ede0e95c9b74836f55d3bbb06591 | [
"Apache-2.0"
] | null | null | null | configsource-etcd/src/main/java/org/microprofileext/config/source/etcd/EtcdConfigSource.java | derekm/config-ext | 24ebbca7afa4ede0e95c9b74836f55d3bbb06591 | [
"Apache-2.0"
] | null | null | null | 34.837209 | 141 | 0.635514 | 7,011 | package org.microprofileext.config.source.etcd;
import com.coreos.jetcd.Client;
import com.coreos.jetcd.data.ByteSequence;
import com.coreos.jetcd.data.KeyValue;
import com.coreos.jetcd.kv.GetResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import lombok.NoArgsConstructor;
import lombok.extern.java.Log;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.spi.ConfigSource;
/**
* Etcd config source
* @author Phillip Kruger (nnheo@example.com)
*/
@Log
@NoArgsConstructor
public class EtcdConfigSource implements ConfigSource {
public static final String NAME = "EtcdConfigSource";
private static final String KEY_PREFIX = "configsource.etcd.";
private static final String KEY_ENABLED = KEY_PREFIX + "enabled";
private static final boolean DEFAULT_ENABLED = false;
private static final String KEY_SCHEME = KEY_PREFIX + "scheme";
private static final String DEFAULT_SCHEME = "http";
private static final String KEY_HOST = KEY_PREFIX + "host";
private static final String DEFAULT_HOST = "localhost";
private static final String KEY_PORT = KEY_PREFIX + "port";
private static final String DEFAULT_PORT = "2379";
private Client client = null;
@Override
public int getOrdinal() {
return 320;
}
@Override
public Map<String, String> getProperties() {
Map<String,String> m = new HashMap<>();
if(isEnabled()){
ByteSequence bsKey = ByteSequence.fromString("");
CompletableFuture<GetResponse> getFuture = getClient().getKVClient().get(bsKey);
try {
GetResponse response = getFuture.get();
List<KeyValue> kvs = response.getKvs();
for(KeyValue kv:kvs){
String key = kv.getKey().toStringUtf8();
String value = kv.getValue().toStringUtf8();
m.put(key, value);
}
} catch (InterruptedException | ExecutionException ex) {
log.log(Level.FINEST, "Can not get all config keys and values from etcd Config source: {1}", new Object[]{ex.getMessage()});
}
}
return m;
}
@Override
public String getValue(String key) {
if (key.startsWith(KEY_PREFIX)) {
// in case we are about to configure ourselves we simply ignore that key
return null;
}
if(isEnabled()){
ByteSequence bsKey = ByteSequence.fromString(key);
CompletableFuture<GetResponse> getFuture = getClient().getKVClient().get(bsKey);
try {
GetResponse response = getFuture.get();
String value = toString(response);
return value;
} catch (InterruptedException | ExecutionException ex) {
log.log(Level.FINEST, "Can not get config value for [{0}] from etcd Config source: {1}", new Object[]{key, ex.getMessage()});
}
}
return null;
}
@Override
public String getName() {
return NAME;
}
private String toString(GetResponse response){
if(response.getCount()>0){
return response.getKvs().get(0).getValue().toStringUtf8();
}
return null;
}
private boolean isEnabled(){
Config cfg = ConfigProvider.getConfig();
return cfg.getOptionalValue(KEY_ENABLED, Boolean.class).orElse(DEFAULT_ENABLED);
}
private Client getClient(){
if(this.client == null ){
log.info("Loading [etcd] MicroProfile ConfigSource");
Config cfg = ConfigProvider.getConfig();
String scheme = cfg.getOptionalValue(KEY_SCHEME, String.class).orElse(DEFAULT_SCHEME);
String host = cfg.getOptionalValue(KEY_HOST, String.class).orElse(DEFAULT_HOST);
String port = cfg.getOptionalValue(KEY_PORT, String.class).orElse(DEFAULT_PORT);
String endpoint = String.format("%s://%s:%s",scheme,host,port);
log.log(Level.INFO, "Using [{0}] as etcd server endpoint", endpoint);
this.client = Client.builder().endpoints(endpoint).build();
}
return this.client;
}
}
|
3e109426656ab20872afa2bfdf47baca7d2dd069 | 2,472 | java | Java | src/test/java/com/n26/challenge/domain/model/statistics/StatisticsTest.java | brunoLNCosta/statistics-challenge | 15f1ee9adb3e99703382f5af87ccadbe1bd5e88b | [
"Apache-2.0"
] | null | null | null | src/test/java/com/n26/challenge/domain/model/statistics/StatisticsTest.java | brunoLNCosta/statistics-challenge | 15f1ee9adb3e99703382f5af87ccadbe1bd5e88b | [
"Apache-2.0"
] | null | null | null | src/test/java/com/n26/challenge/domain/model/statistics/StatisticsTest.java | brunoLNCosta/statistics-challenge | 15f1ee9adb3e99703382f5af87ccadbe1bd5e88b | [
"Apache-2.0"
] | null | null | null | 23.769231 | 85 | 0.634709 | 7,012 | package com.n26.challenge.domain.model.statistics;
import static com.n26.challenge.test.TransactionGenerator.generateRandomTransactions;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import com.n26.challenge.domain.model.transaction.Transaction;
public class StatisticsTest {
@Test
public void emptyStatisticTest() {
Statistics s = new Statistics();
assertEquals(new Double(0.0), s.getSum(), 0.01);
assertEquals(new Double(0.0), s.getAvg(), 0.01);
assertEquals(null, s.getMax());
assertEquals(null, s.getMin());
assertEquals(new Long(0L), s.getCount());
}
@Test
public void updateStatisticTest() {
Statistics s = new Statistics();
List<Transaction> transactions = generateRandomTransactions();
transactions.forEach(t -> {
Double sum = s.getSum() + t.getAmmount();
Double max = t.getAmmount();
if(s.getMax() != null && s.getMax() > t.getAmmount()) {
max = s.getMax();
}
Double min = t.getAmmount();
if(s.getMin() != null && s.getMin() < t.getAmmount()) {
min = s.getMin();
}
Long count = s.getCount() +1;
Double avg = sum / count;
s.update(t);
// assertEquals(sum, s.getSum(), 0.01);
// assertEquals(avg, s.getAvg(), 0.01);
// assertEquals(max, s.getMax(), 0.01);
// assertEquals(min, s.getMin(), 0.01);
assertEquals(count, s.getCount());
});
}
@Test
public void mergeStatisticTest() {
List<Statistics> statistics = generateRandomStatistics();
Double sum = 0.0;
Long count = 0L;
Double max = 0.0;
Double min = 0.0;
for(Statistics s : statistics) {
sum += s.getSum();
if(s.getMax() != null && s.getMax() > max) {
max = s.getMax();
}
if(s.getMin() != null && s.getMin() < min) {
min = s.getMin();
}
count += s.getCount();
};
Double avg = sum / count;
Statistics s = new Statistics();
statistics.forEach(s::merge);
// assertEquals(sum, s.getSum(), 0.01);
// assertEquals(avg, s.getAvg(), 0.01);
// assertEquals(max, s.getMax(), 0.01);
// assertEquals(min, s.getMin(), 0.01);
assertEquals(count, s.getCount());
}
private List<Statistics> generateRandomStatistics() {
List<Statistics> statistics = new ArrayList<>();
final Long quant = Math.round(Math.random() * 1);
for(int i = 0; i < quant; i++) {
statistics.add(new Statistics(generateRandomTransactions()));
}
return statistics;
}
}
|
3e109540c72001985d4554f5c4e1fdd69a2d591e | 569 | java | Java | src/main/java/com/lyle/jvm/example/LongLivedObj.java | lyle8341/jvm | 92be48ca58821bb4cb7583e457ac738aef2d80e1 | [
"MIT"
] | null | null | null | src/main/java/com/lyle/jvm/example/LongLivedObj.java | lyle8341/jvm | 92be48ca58821bb4cb7583e457ac738aef2d80e1 | [
"MIT"
] | 1 | 2019-01-14T15:46:37.000Z | 2019-01-14T15:48:31.000Z | src/main/java/com/lyle/jvm/example/LongLivedObj.java | lyle8341/jvm | 92be48ca58821bb4cb7583e457ac738aef2d80e1 | [
"MIT"
] | null | null | null | 28.45 | 150 | 0.678383 | 7,013 | package com.lyle.jvm.example;
/**
* 长期存活对象进入老年代
* @author Lyle
* @version v1.0
* @since 1.8
*/
public class LongLivedObj {
//java -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 -XX:+UseSerialGC -XX:MaxTenuringThreshold=1 com.lyle.jvm.example.LongLivedObj
public static void main(String[] args) {
byte[] allocation1, allocation2, allocation3;
allocation1 = new byte[Unit.MB / 4];
allocation2 = new byte[4 * Unit.MB];
allocation3 = new byte[4 * Unit.MB];
allocation3 = null;
allocation3 = new byte[4 * Unit.MB];
}
} |
3e1096ec6d775ba67af0cadb60f6472dba6bc87e | 783 | java | Java | modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/v201405/LineItemCreativeAssociationService.java | david-gorisse/googleads-java-lib | 03b8c7e83bc5a361e374d345afdd93290d143c34 | [
"Apache-2.0"
] | null | null | null | modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/v201405/LineItemCreativeAssociationService.java | david-gorisse/googleads-java-lib | 03b8c7e83bc5a361e374d345afdd93290d143c34 | [
"Apache-2.0"
] | null | null | null | modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/v201405/LineItemCreativeAssociationService.java | david-gorisse/googleads-java-lib | 03b8c7e83bc5a361e374d345afdd93290d143c34 | [
"Apache-2.0"
] | null | null | null | 46.058824 | 206 | 0.831418 | 7,015 | /**
* LineItemCreativeAssociationService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.dfp.axis.v201405;
public interface LineItemCreativeAssociationService extends javax.xml.rpc.Service {
public java.lang.String getLineItemCreativeAssociationServiceInterfacePortAddress();
public com.google.api.ads.dfp.axis.v201405.LineItemCreativeAssociationServiceInterface getLineItemCreativeAssociationServiceInterfacePort() throws javax.xml.rpc.ServiceException;
public com.google.api.ads.dfp.axis.v201405.LineItemCreativeAssociationServiceInterface getLineItemCreativeAssociationServiceInterfacePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
|
3e1097393f540d199b05e45b61514a00bf277eba | 2,167 | java | Java | src/main/java/com/gazbert/patterns/creational/factorymethod/package-info.java | gazbert/java-design-patterns | 78ac810c2310259e42bd4f698db6ee94eb544f8b | [
"MIT"
] | 45 | 2015-01-30T12:43:19.000Z | 2022-03-15T19:35:25.000Z | src/main/java/com/gazbert/patterns/creational/factorymethod/package-info.java | ramazansakin/java-design-patterns-1 | b15f7c40cd6bb1582f4936a443deb77c56db55d2 | [
"MIT"
] | 2 | 2020-10-12T17:51:48.000Z | 2021-06-25T15:42:36.000Z | src/main/java/com/gazbert/patterns/creational/factorymethod/package-info.java | ramazansakin/java-design-patterns-1 | b15f7c40cd6bb1582f4936a443deb77c56db55d2 | [
"MIT"
] | 37 | 2015-01-11T16:27:39.000Z | 2022-03-12T12:11:23.000Z | 55.564103 | 119 | 0.731426 | 7,016 | /**
* <h2>Factory Method</h2>
* The Factory Method provides an interface for creating an object (Product), but it relies on the Concrete Factory
* implementation class to create (instantiate) the actual Product.
* <p>
* The abstract factory does this by providing a protected createXXX method and which is only visible to the Concrete
* Factory subclasses; this is the 'Factory Method'.
* <p>
* The pattern encapsulates object creation and keeps it one place. If the way the object is created needs to be
* changed in the future, the Client is protected from this by the Concrete Factory interface.
* <p>
* Be careful not to confuse the Abstract Factory <em>actor</em> in this pattern with the <em>name</em> of the
* Abstract Factory pattern.
* <p>
* The difference between this pattern and the Abstract Factory pattern is that Abstract Factory pattern requires
* you to know in advance exactly which Product you want to build. The Abstract Factory pattern is also used for
* creating 'families' of related/dependent Product; the Factory Method typically only creates one Product per factory.
*
* <h2>Actors</h2>
* <ul>
* <li>Abstract Factory - an abstract class for defining the types of Product to built, and provides the Client facing
* business method for building Products.</li>
* <li>Concrete Factory - provides an implementation of the Abstract Factory's 'Factory Method' for creating
* Concrete Products </li>
* <li>Product - the interface of the object we are creating/instantiating</li>
* <li>Concrete Product - the actual object we create/instantiate</li>
* <li>Client - the code that uses the pattern to build Products.</li>
* </ul>
*
* <h2>Usages</h2>
* When you cannot know in advance the type of object (Product) to create - you let the concrete factory decide for you
* based on some information you pass it. Also stops client code from using 'new' all over the place by encapsulating
* the point of object creation; it keeps knowledge of how to create an object localised.
*
* <p>
* @author gazbert
*
*/
package com.gazbert.patterns.creational.factorymethod; |
3e10977709d7ad4706837cd8a779fe3ab67f7183 | 1,966 | java | Java | src/main/java/jpaul/DataStructs/MapSetRelationFactory.java | protegeproject/jpaul | db579ffb16faaa4b0c577ec82c246f7349427714 | [
"BSD-3-Clause"
] | 2 | 2016-10-14T09:56:44.000Z | 2017-10-24T16:39:04.000Z | analyzed_libs/jpaul-2.5.1/src/jpaul/DataStructs/MapSetRelationFactory.java | jgaltidor/VarJ | 3a25102f8a1a406f5e458cb7d8945cc33b6a4fea | [
"MIT"
] | null | null | null | analyzed_libs/jpaul-2.5.1/src/jpaul/DataStructs/MapSetRelationFactory.java | jgaltidor/VarJ | 3a25102f8a1a406f5e458cb7d8945cc33b6a4fea | [
"MIT"
] | null | null | null | 34.631579 | 87 | 0.696555 | 7,017 | // MapSetRelationFactory.java, created Mon Jul 4 09:24:08 2005 by salcianu
// Copyright (C) 2005 Alexandru Salcianu <dycjh@example.com>
// Licensed under the Modified BSD Licence; see COPYING for details.
package jpaul.DataStructs;
import java.util.Set;
/**
* <code>MapSetRelationFactory</code> generates
* <code>MapSetRelation</code>s that use a specific
* <code>MapFactory</code> and a specific <code>SetFactory</code>.
*
* @see MapSetRelation
*
* @author Alexandru Salcianu - dycjh@example.com
* @version $Id: MapSetRelationFactory.java,v 1.9 2006/03/14 02:29:31 salcianu Exp $ */
class MapSetRelationFactory<K,V> extends RelationFactory<K,V> {
/** Default constructor: creates a
<code>MapSetRelationFactory</code> based on a
<code>HashMap</code> factory and a
<code>HashSet</code> factory.
@see #MapSetRelationFactory(MapFactory, SetFactory)
@see jpaul.DataStructs.SetFacts#hash() SetFacts.hash()
@see jpaul.DataStructs.MapFacts#hash() MapFacts.hash() */
public MapSetRelationFactory() {
this(MapFacts.<K,Set<V>>hash(), SetFacts.<V>hash());
}
/** Creates a <code>MapSetRelationFactory</code> that will
generate <code>MapSetRelation</code>s that use the map factory
<code>mapFact</code> and the set factory <code>setFact</code>.
This constructor allows the programmer to finely tune the kind
of relation that he wants. */
public MapSetRelationFactory(MapFactory<K,Set<V>> mapFact, SetFactory<V> setFact) {
this.mapFact = mapFact;
this.setFact = setFact;
}
private final MapFactory<K,Set<V>> mapFact;
private final SetFactory<V> setFact;
public Relation<K,V> create() {
return new MapSetRelation<K,V>(mapFact, setFact);
}
public Relation<K,V> create(Relation<K,V> r) {
if(r instanceof MapSetRelation/*<K,V>*/) {
MapSetRelation<K,V> msr = (MapSetRelation<K,V>) r;
return msr.clone();
}
return super.create(r);
}
}
|
3e109b06b5cc7be1476790155bf62c39c2034e0d | 1,075 | java | Java | reader-osm/src/main/java/com/graphhopper/reader/osm/OSMInput.java | congcongfu/graphhopper | 193569bad8e7334bc42eedc0bbafb5ad2220badf | [
"Apache-2.0"
] | 3,427 | 2015-01-01T05:24:12.000Z | 2022-03-31T17:09:03.000Z | reader-osm/src/main/java/com/graphhopper/reader/osm/OSMInput.java | tourlane/graphhopper | 04d6a44aabea03418c7cdc54a01aeee624111d86 | [
"Apache-2.0"
] | 2,010 | 2015-01-06T12:43:07.000Z | 2022-03-31T08:54:39.000Z | reader-osm/src/main/java/com/graphhopper/reader/osm/OSMInput.java | tourlane/graphhopper | 04d6a44aabea03418c7cdc54a01aeee624111d86 | [
"Apache-2.0"
] | 1,432 | 2015-01-02T01:17:00.000Z | 2022-03-30T08:52:36.000Z | 37.068966 | 76 | 0.762791 | 7,018 | /*
* Licensed to GraphHopper GmbH under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* GraphHopper GmbH 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 com.graphhopper.reader.osm;
import com.graphhopper.reader.ReaderElement;
import javax.xml.stream.XMLStreamException;
public interface OSMInput extends AutoCloseable {
ReaderElement getNext() throws XMLStreamException;
int getUnprocessedElements();
}
|
3e109b6adcfc07dcec90fb3930753426207634f2 | 3,662 | java | Java | triana-core/src/main/java/org/trianacode/taskgraph/service/OutOfRangeException.java | CSCSI/Triana | da48ffaa0183f59e3fe7c6dc59d9f91234e65809 | [
"Apache-2.0"
] | 8 | 2015-11-02T10:12:13.000Z | 2019-01-15T21:45:38.000Z | triana-core/src/main/java/org/trianacode/taskgraph/service/OutOfRangeException.java | CSCSI/Triana | da48ffaa0183f59e3fe7c6dc59d9f91234e65809 | [
"Apache-2.0"
] | 1 | 2015-08-28T13:52:42.000Z | 2016-01-22T13:06:00.000Z | triana-core/src/main/java/org/trianacode/taskgraph/service/OutOfRangeException.java | CSCSI/Triana | da48ffaa0183f59e3fe7c6dc59d9f91234e65809 | [
"Apache-2.0"
] | 2 | 2022-03-08T14:04:52.000Z | 2022-03-09T05:30:21.000Z | 37.030303 | 119 | 0.716858 | 7,019 | /*
* The University of Wales, Cardiff Triana Project Software License (Based
* on the Apache Software License Version 1.1)
*
* Copyright (c) 2007 University of Wales, Cardiff. All rights reserved.
*
* Redistribution and use of the software in source and binary forms, with
* or without modification, are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The end-user documentation included with the redistribution, if any,
* must include the following acknowledgment: "This product includes
* software developed by the University of Wales, Cardiff for the Triana
* Project (http://www.trianacode.org)." Alternately, this
* acknowledgment may appear in the software itself, if and wherever
* such third-party acknowledgments normally appear.
*
* 4. The names "Triana" and "University of Wales, Cardiff" must not be
* used to endorse or promote products derived from this software
* without prior written permission. For written permission, please
* contact dycjh@example.com.
*
* 5. Products derived from this software may not be called "Triana," nor
* may Triana appear in their name, without prior written permission of
* the University of Wales, Cardiff.
*
* 6. This software may not be sold, used or incorporated into any product
* for sale to third parties.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL UNIVERSITY OF WALES, CARDIFF OR ITS CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* ------------------------------------------------------------------------
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Triana Project. For more information on the
* Triana Project, please see. http://www.trianacode.org.
*
* This license is based on the BSD license as adopted by the Apache
* Foundation and is governed by the laws of England and Wales.
*
*/
package org.trianacode.taskgraph.service;
/**
* Thrown when a unit requests a node which doesn't exist.
*
* @author Ian Taylor
* @version $Revision: 4048 $
*/
public class OutOfRangeException extends RuntimeException {
/**
* Constructs an OutOfRangeException with no detail message. A detail message is a String that describes this
* particular exception.
*/
public OutOfRangeException() {
super();
}
/**
* Constructs an OutOfRangeException with the specified detail message. A detail message is a String that describes
* this particular exception.
*
* @param s the String that contains a detailed message
*/
public OutOfRangeException(String s) {
super(s);
}
}
|
3e109ef0d6fb95cb3d126b38b3c63f99f5817403 | 2,690 | java | Java | main/src/main/java/io/novaordis/databot/configuration/DefaultConfiguration.java | NovaOrdis/os-stats | 74a8ef1315d47fdd2d6ab9e5537fea8fdc51d64a | [
"Apache-2.0"
] | null | null | null | main/src/main/java/io/novaordis/databot/configuration/DefaultConfiguration.java | NovaOrdis/os-stats | 74a8ef1315d47fdd2d6ab9e5537fea8fdc51d64a | [
"Apache-2.0"
] | null | null | null | main/src/main/java/io/novaordis/databot/configuration/DefaultConfiguration.java | NovaOrdis/os-stats | 74a8ef1315d47fdd2d6ab9e5537fea8fdc51d64a | [
"Apache-2.0"
] | null | null | null | 33.246914 | 120 | 0.430004 | 7,020 | /*
* Copyright (c) 2017 Nova Ordis 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.novaordis.databot.configuration;
import io.novaordis.utilities.UserErrorException;
import io.novaordis.utilities.logging.LoggerConfiguration;
import java.io.File;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;
/**
* Used for testing.
*
* @author Ovidiu Feodorov <efpyi@example.com>
* @since 6/11/17
*/
public class DefaultConfiguration extends ConfigurationBase {
// Constants -------------------------------------------------------------------------------------------------------
// Static ----------------------------------------------------------------------------------------------------------
// Attributes ------------------------------------------------------------------------------------------------------
// Constructors ----------------------------------------------------------------------------------------------------
public DefaultConfiguration() throws UserErrorException {
super(true, null);
}
// ConfigurationBase overrides -------------------------------------------------------------------------------------
@Override
protected void load(InputStream is) throws UserErrorException {
//
// noop, we preserve the defaults
//
}
@Override
public List<LoggerConfiguration> getLoggerConfiguration() {
return Collections.emptyList();
}
@Override
public File getFile() {
return null;
}
// Public ----------------------------------------------------------------------------------------------------------
// Package protected -----------------------------------------------------------------------------------------------
// Protected -------------------------------------------------------------------------------------------------------
// Private ---------------------------------------------------------------------------------------------------------
// Inner classes ---------------------------------------------------------------------------------------------------
}
|
3e109f3a6d788132b05dd025ddf27baa3b37dc4d | 2,700 | java | Java | core/server/worker/src/main/java/alluxio/worker/block/FuseManager.java | Haoning-Sun/alluxio | d2dc74d57c8b00e3f8b3082bdcfb58fae4d6c9ed | [
"Apache-2.0"
] | null | null | null | core/server/worker/src/main/java/alluxio/worker/block/FuseManager.java | Haoning-Sun/alluxio | d2dc74d57c8b00e3f8b3082bdcfb58fae4d6c9ed | [
"Apache-2.0"
] | null | null | null | core/server/worker/src/main/java/alluxio/worker/block/FuseManager.java | Haoning-Sun/alluxio | d2dc74d57c8b00e3f8b3082bdcfb58fae4d6c9ed | [
"Apache-2.0"
] | null | null | null | 34.177215 | 98 | 0.737037 | 7,021 | /*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.worker.block;
import alluxio.client.file.FileSystem;
import alluxio.client.file.FileSystemContext;
import alluxio.conf.AlluxioConfiguration;
import alluxio.conf.Configuration;
import alluxio.fuse.AlluxioFuse;
import alluxio.fuse.FuseMountConfig;
import alluxio.fuse.FuseUmountable;
import com.google.common.io.Closer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
/**
* The Fuse manager that is responsible for managing the Fuse application lifecycle.
*/
public class FuseManager implements Closeable {
private static final Logger LOG = LoggerFactory.getLogger(FuseManager.class);
private final FileSystemContext mFsContext;
/** Use to umount Fuse application during stop. */
private FuseUmountable mFuseUmountable;
/** Use to close resources during stop. */
private final Closer mResourceCloser;
/**
* Constructs a new {@link FuseManager}.
*
* @param fsContext fs context
*/
public FuseManager(FileSystemContext fsContext) {
mFsContext = fsContext;
mResourceCloser = Closer.create();
}
/**
* Starts mounting the internal Fuse applications.
*/
public void start() {
AlluxioConfiguration conf = Configuration.global();
try {
FuseMountConfig config = FuseMountConfig.create(conf);
// TODO(lu) consider launching fuse in a separate thread as blocking operation
// so that we can know about the fuse application status
FileSystem fileSystem = mResourceCloser.register(FileSystem.Factory.create(mFsContext));
mFuseUmountable = AlluxioFuse.launchFuse(mFsContext, fileSystem, conf, config, false);
} catch (Throwable throwable) {
// TODO(lu) for already mounted application, unmount first and then remount
LOG.error("Failed to launch worker internal Fuse application", throwable);
}
}
@Override
public void close() throws IOException {
if (mFuseUmountable != null) {
try {
mFuseUmountable.umount(true);
} catch (Throwable throwable) {
LOG.error("Failed to umount worker internal Fuse application", throwable);
}
}
mResourceCloser.close();
}
}
|
3e109f84f4045f8bf57054be1dd9c07929c834f7 | 1,606 | java | Java | effective-java/chapter06/item30/Operation.java | dantin/java-by-example | d5d9a1424da04bc2163286eea670c327fd04be27 | [
"BSD-3-Clause"
] | null | null | null | effective-java/chapter06/item30/Operation.java | dantin/java-by-example | d5d9a1424da04bc2163286eea670c327fd04be27 | [
"BSD-3-Clause"
] | null | null | null | effective-java/chapter06/item30/Operation.java | dantin/java-by-example | d5d9a1424da04bc2163286eea670c327fd04be27 | [
"BSD-3-Clause"
] | null | null | null | 26.327869 | 96 | 0.577833 | 7,022 | // Enum type with constant-specific class bodies and data
package item30;
import java.util.HashMap;
import java.util.Map;
public enum Operation {
PLUS("+") {
double apply(double x, double y) {
return x + y;
}
},
MINUS("-") {
double apply(double x, double y) {
return x - y;
}
},
TIMES("*") {
double apply(double x, double y) {
return x * y;
}
},
DEVIDE("/") {
double apply(double x, double y) {
return x / y;
}
};
private final String symbol;
Operation(String symbol) {
this.symbol = symbol;
}
@Override
public String toString() {
return symbol;
}
abstract double apply(double x, double y);
// Implementing a fromString method on an enmu type
private static final Map<String, Operation> stringToEnum = new HashMap<String, Operation>();
static { // Initialize map from constant name to enum constant
for (Operation op : values())
stringToEnum.put(op.toString(), op);
}
// Returns Operation for string, or null if string is invalid
public static Operation fromString(String symbol) {
return stringToEnum.get(symbol);
}
// Test program to perform all operations on given operands
public static void main(String[] args) {
double x = Double.parseDouble(args[0]);
double y = Double.parseDouble(args[1]);
for (Operation op : Operation.values())
System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y));
}
}
|
3e109ff8cd5886bb390c2bd99208be6f7df187ca | 858 | java | Java | app/src/main/java/com/example/user/coolweather/db/County.java | YYYDharma/coolweather | caba58e17315088414b149960411290b7c45e505 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/user/coolweather/db/County.java | YYYDharma/coolweather | caba58e17315088414b149960411290b7c45e505 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/user/coolweather/db/County.java | YYYDharma/coolweather | caba58e17315088414b149960411290b7c45e505 | [
"Apache-2.0"
] | null | null | null | 18.255319 | 50 | 0.615385 | 7,023 | package com.example.user.coolweather.db;
import org.litepal.crud.DataSupport;
/**
* 表3:区县
* @author
*/
public class County extends DataSupport {
private int id;//实体对象id
private String countyName;//区县名
private String weatherId;//天气id
private int cityId;//所属市的id
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public String getWeatherId() {
return weatherId;
}
public void setWeatherId(String weatherId) {
this.weatherId = weatherId;
}
public int getCityId() {
return cityId;
}
public void setCityId(int cityId) {
this.cityId = cityId;
}
}
|
3e10a02a96efe83d7b7ad4061becec81435c5ef7 | 851 | java | Java | src/main/java/edu/harvard/iq/policymodelssummary/ConsoleOut.java | codeworth-gh/PolicyModelsSummary | 5643356b89277d9cce371861f1465a925409711d | [
"MIT"
] | null | null | null | src/main/java/edu/harvard/iq/policymodelssummary/ConsoleOut.java | codeworth-gh/PolicyModelsSummary | 5643356b89277d9cce371861f1465a925409711d | [
"MIT"
] | null | null | null | src/main/java/edu/harvard/iq/policymodelssummary/ConsoleOut.java | codeworth-gh/PolicyModelsSummary | 5643356b89277d9cce371861f1465a925409711d | [
"MIT"
] | null | null | null | 18.5 | 48 | 0.542891 | 7,024 | package edu.harvard.iq.policymodelssummary;
import java.io.PrintStream;
/**
*
* @author michael
*/
public class ConsoleOut {
private String stage;
private final PrintStream out;
boolean continuingLine = false;
public ConsoleOut(PrintStream out) {
this.out = out;
}
public ConsoleOut() {
this(System.out);
}
public ConsoleOut println( String msg ) {
out.println( "[" + stage + "] " + msg );
continuingLine = false;
return this;
}
public void setStage(String stage) {
this.stage = stage;
}
public ConsoleOut print(String msg) {
if ( ! continuingLine ) {
out.print("[" + stage + "] ");
}
out.print(msg);
continuingLine = !msg.endsWith("\n");
return this;
}
}
|
3e10a04df5d74217954e4b9ad573a6fe2e6ae4e4 | 4,386 | java | Java | src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java | githubmathushiva/ci-project | a5b000c507edbfb77317ea589bebcfbb5970582f | [
"Apache-2.0"
] | 300 | 2015-01-06T19:13:49.000Z | 2022-03-27T05:06:12.000Z | src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java | githubmathushiva/ci-project | a5b000c507edbfb77317ea589bebcfbb5970582f | [
"Apache-2.0"
] | 163 | 2015-01-06T21:04:06.000Z | 2022-03-31T19:53:56.000Z | src/test/java/org/apache/commons/imaging/ImagingGuessFormatTest.java | ci-fuzz/commons-imaging-master | 5588fa6bb79dd3281c801f3c53dae7f5e0af9e27 | [
"Apache-2.0"
] | 202 | 2015-01-03T00:51:41.000Z | 2022-03-20T13:27:41.000Z | 54.825 | 114 | 0.700866 | 7,025 | /*
* 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.commons.imaging;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import java.util.Arrays;
import java.util.stream.Stream;
import org.apache.commons.io.FilenameUtils;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
public class ImagingGuessFormatTest extends ImagingTest {
public static final String BMP_IMAGE_FILE = "bmp\\1\\Oregon Scientific DS6639 - DSC_0307 - small.bmp";
public static final String PNG_IMAGE_FILE = "png\\1\\Oregon Scientific DS6639 - DSC_0307 - small.png";
public static final String GIF_IMAGE_FILE = "gif\\single\\1\\Oregon Scientific DS6639 - DSC_0307 - small.gif";
public static final String ICNS_IMAGE_FILE = "icns\\1\\poedit48x48.icns";
public static final String ICO_IMAGE_FILE = "ico\\1\\Oregon Scientific DS6639 - DSC_0307 - small.ico";
public static final String TIFF_IMAGE_FILE = "tiff\\1\\Oregon Scientific DS6639 - DSC_0307 - small.tif";
public static final String JPEG_IMAGE_FILE = "jpg\\1\\Oregon Scientific DS6639 - DSC_0307 - small.jpg";
public static final String PSD_IMAGE_FILE = "psd\\1\\Oregon Scientific DS6639 - DSC_0307 - small.psd";
public static final String PBM_IMAGE_FILE = "pbm\\1\\Oregon Scientific DS6639 - DSC_0307 - small.pbm";
public static final String PGM_IMAGE_FILE = "pbm\\1\\Oregon Scientific DS6639 - DSC_0307 - small.pgm";
public static final String PPM_IMAGE_FILE = "pbm\\1\\Oregon Scientific DS6639 - DSC_0307 - small.ppm";
public static final String TGA_IMAGE_FILE = "tga\\1\\Oregon Scientific DS6639 - DSC_0307 - small.tga";
public static final String UNKNOWN_IMAGE_FILE = "info.txt";
public static Stream<Object[]> data() {
return Arrays.asList(
new Object[] { ImageFormats.PNG, PNG_IMAGE_FILE },
new Object[] { ImageFormats.GIF, GIF_IMAGE_FILE },
new Object[] { ImageFormats.ICNS, ICNS_IMAGE_FILE },
// TODO(cmchen): add ability to sniff ICOs if possible.
// new Object[] { ImageFormat.IMAGE_FORMAT_ICO, ICO_IMAGE_FILE },
new Object[] { ImageFormats.TIFF, TIFF_IMAGE_FILE },
new Object[] { ImageFormats.JPEG, JPEG_IMAGE_FILE },
new Object[] { ImageFormats.BMP, BMP_IMAGE_FILE },
new Object[] { ImageFormats.PSD, PSD_IMAGE_FILE },
new Object[] { ImageFormats.PBM, PBM_IMAGE_FILE },
new Object[] { ImageFormats.PGM, PGM_IMAGE_FILE },
new Object[] { ImageFormats.PPM, PPM_IMAGE_FILE },
// TODO(cmchen): add ability to sniff TGAs if possible.
// new Object[] { ImageFormat.IMAGE_FORMAT_TGA, TGA_IMAGE_FILE },
// TODO(cmchen): Add test images for these formats.
// new Object[] { ImageFormat.IMAGE_FORMAT_PNM, PNM_IMAGE_FILE },
// new Object[] { ImageFormat.IMAGE_FORMAT_JBIG2, JBIG2_IMAGE_FILE },
new Object[] { ImageFormats.UNKNOWN, UNKNOWN_IMAGE_FILE }
).stream();
}
@ParameterizedTest
@MethodSource("data")
public void testGuessFormat(final ImageFormats expectedFormat, final String pathToFile) throws Exception {
final String imagePath = FilenameUtils.separatorsToSystem(pathToFile);
final File imageFile = new File(ImagingTestConstants.TEST_IMAGE_FOLDER, imagePath);
final ImageFormat guessedFormat = Imaging.guessFormat(imageFile);
assertEquals(expectedFormat, guessedFormat);
}
}
|
3e10a1fe176c72fd0e21ae55b6026225bf177c2d | 3,198 | java | Java | exec/vector/src/main/java/org/apache/drill/exec/record/metadata/AbstractPropertied.java | drewctate/drill | 755529f3ac7ca77797f68b60e1d0713ad126e227 | [
"Apache-2.0"
] | 35 | 2016-09-22T22:53:14.000Z | 2020-02-13T15:12:21.000Z | exec/vector/src/main/java/org/apache/drill/exec/record/metadata/AbstractPropertied.java | drewctate/drill | 755529f3ac7ca77797f68b60e1d0713ad126e227 | [
"Apache-2.0"
] | 15 | 2020-03-05T00:32:48.000Z | 2022-02-16T00:55:24.000Z | exec/vector/src/main/java/org/apache/drill/exec/record/metadata/AbstractPropertied.java | drewctate/drill | 755529f3ac7ca77797f68b60e1d0713ad126e227 | [
"Apache-2.0"
] | 88 | 2016-11-27T02:16:11.000Z | 2020-02-28T05:10:26.000Z | 26.65 | 75 | 0.69606 | 7,026 | /*
* 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.drill.exec.record.metadata;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Base class for an object with properties. Defers property map creation
* until needed, since most instances may not need properties.
*/
public class AbstractPropertied implements Propertied {
private Map<String, String> properties;
protected AbstractPropertied() { }
protected AbstractPropertied(AbstractPropertied from) {
setProperties(from.properties);
}
protected boolean hasProperties() {
return properties != null && ! properties.isEmpty();
}
@Override
public void setProperties(Map<String, String> properties) {
if (properties != null && ! properties.isEmpty()) {
properties().putAll(properties);
}
}
@Override
public Map<String, String> properties() {
if (properties == null) {
properties = new LinkedHashMap<>();
}
return properties;
}
@Override
public String property(String key) {
return property(key, null);
}
@Override
public String property(String key, String defValue) {
if (properties == null) {
return defValue;
}
String value = properties.get(key);
return value == null ? defValue : value;
}
@Override
public void setProperty(String key, String value) {
if (value != null) {
properties().put(key, value);
} else if (properties != null) {
properties.remove(key);
}
}
@Override
public boolean booleanProperty(String key) {
return booleanProperty(key, false);
}
@Override
public boolean booleanProperty(String key, boolean defaultValue) {
String value = property(key);
return value == null ? defaultValue : Boolean.parseBoolean(value);
}
@Override
public void setBooleanProperty(String key, boolean value) {
if (value) {
setProperty(key, Boolean.toString(value));
} else {
setProperty(key, null);
}
}
@Override
public int intProperty(String key) {
return intProperty(key, 0);
}
@Override
public int intProperty(String key, int defaultValue) {
String value = property(key);
return value == null ? defaultValue : Integer.parseInt(value);
}
@Override
public void setIntProperty(String key, int value) {
setProperty(key, Integer.toString(value));
}
@Override
public void removeProperty(String key) {
setProperty(key, null);
}
}
|
3e10a22ea9b5542a72dfa445e9528b9360e8b66e | 5,889 | java | Java | dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/AbstractExecutorInstrumentation.java | mauroarias/dd-trace-java | e5f0e2e3895cb4bcdf0dd141d3e8630876e529ac | [
"Apache-2.0"
] | null | null | null | dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/AbstractExecutorInstrumentation.java | mauroarias/dd-trace-java | e5f0e2e3895cb4bcdf0dd141d3e8630876e529ac | [
"Apache-2.0"
] | null | null | null | dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/AbstractExecutorInstrumentation.java | mauroarias/dd-trace-java | e5f0e2e3895cb4bcdf0dd141d3e8630876e529ac | [
"Apache-2.0"
] | null | null | null | 44.278195 | 100 | 0.700119 | 7,027 | package datadog.trace.instrumentation.java.concurrent;
import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.implementsInterface;
import static net.bytebuddy.matcher.ElementMatchers.any;
import static net.bytebuddy.matcher.ElementMatchers.named;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.api.Config;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Executor;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@Slf4j
public abstract class AbstractExecutorInstrumentation extends Instrumenter.Default {
public static final String EXEC_NAME = "java_concurrent";
private final boolean TRACE_ALL_EXECUTORS = Config.get().isTraceExecutorsAll();
/**
* Only apply executor instrumentation to whitelisted executors. To apply to all executors, use
* override setting above.
*/
private final Collection<String> PERMITTED_EXECUTORS;
/**
* Some frameworks have their executors defined as anon classes inside other classes. Referencing
* anon classes by name would be fragile, so instead we will use list of class prefix names. Since
* checking this list is more expensive (O(n)) we should try to keep it short.
*/
private final Collection<String> PERMITTED_EXECUTORS_PREFIXES;
public AbstractExecutorInstrumentation(final String... additionalNames) {
super(EXEC_NAME, additionalNames);
if (TRACE_ALL_EXECUTORS) {
log.warn("Tracing all executors enabled. This is not a recommended setting.");
PERMITTED_EXECUTORS = Collections.emptyList();
PERMITTED_EXECUTORS_PREFIXES = Collections.emptyList();
} else {
final String[] whitelist = {
"akka.actor.ActorSystemImpl$$anon$1",
"akka.dispatch.BalancingDispatcher",
"akka.dispatch.Dispatcher",
"akka.dispatch.Dispatcher$LazyExecutorServiceDelegate",
"akka.dispatch.ExecutionContexts$sameThreadExecutionContext$",
"akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinPool",
"akka.dispatch.MessageDispatcher",
"akka.dispatch.PinnedDispatcher",
"com.google.common.util.concurrent.AbstractListeningExecutorService",
"com.google.common.util.concurrent.MoreExecutors$ListeningDecorator",
"com.google.common.util.concurrent.MoreExecutors$ScheduledListeningDecorator",
"io.netty.channel.epoll.EpollEventLoop",
"io.netty.channel.epoll.EpollEventLoopGroup",
"io.netty.channel.MultithreadEventLoopGroup",
"io.netty.channel.nio.NioEventLoop",
"io.netty.channel.nio.NioEventLoopGroup",
"io.netty.channel.SingleThreadEventLoop",
"io.netty.util.concurrent.AbstractEventExecutor",
"io.netty.util.concurrent.AbstractEventExecutorGroup",
"io.netty.util.concurrent.AbstractScheduledEventExecutor",
"io.netty.util.concurrent.DefaultEventExecutor",
"io.netty.util.concurrent.DefaultEventExecutorGroup",
"io.netty.util.concurrent.GlobalEventExecutor",
"io.netty.util.concurrent.MultithreadEventExecutorGroup",
"io.netty.util.concurrent.SingleThreadEventExecutor",
"java.util.concurrent.AbstractExecutorService",
"java.util.concurrent.CompletableFuture$ThreadPerTaskExecutor",
"java.util.concurrent.Executors$DelegatedExecutorService",
"java.util.concurrent.Executors$FinalizableDelegatedExecutorService",
"java.util.concurrent.ThreadPoolExecutor",
"kotlinx.coroutines.scheduling.CoroutineScheduler",
"org.eclipse.jetty.util.thread.QueuedThreadPool",
"org.eclipse.jetty.util.thread.ReservedThreadExecutor",
"org.glassfish.grizzly.threadpool.GrizzlyExecutorService",
"play.api.libs.streams.Execution$trampoline$",
"scala.concurrent.Future$InternalCallbackExecutor$",
"scala.concurrent.impl.ExecutionContextImpl",
};
final Set<String> executors = new HashSet<>(Config.get().getTraceExecutors());
executors.addAll(Arrays.asList(whitelist));
PERMITTED_EXECUTORS = Collections.unmodifiableSet(executors);
final String[] whitelistPrefixes = {"slick.util.AsyncExecutor$"};
PERMITTED_EXECUTORS_PREFIXES =
Collections.unmodifiableCollection(Arrays.asList(whitelistPrefixes));
}
}
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
ElementMatcher.Junction<TypeDescription> matcher = any();
final ElementMatcher.Junction<TypeDescription> hasExecutorInterfaceMatcher =
implementsInterface(named(Executor.class.getName()));
if (!TRACE_ALL_EXECUTORS) {
matcher =
matcher.and(
new ElementMatcher<TypeDescription>() {
@Override
public boolean matches(final TypeDescription target) {
boolean whitelisted = PERMITTED_EXECUTORS.contains(target.getName());
// Check for possible prefixes match only if not whitelisted already
if (!whitelisted) {
for (final String name : PERMITTED_EXECUTORS_PREFIXES) {
if (target.getName().startsWith(name)) {
whitelisted = true;
break;
}
}
}
if (!whitelisted
&& log.isDebugEnabled()
&& hasExecutorInterfaceMatcher.matches(target)) {
log.debug("Skipping executor instrumentation for {}", target.getName());
}
return whitelisted;
}
});
}
return matcher.and(hasExecutorInterfaceMatcher); // Apply expensive matcher last.
}
}
|
3e10a38455141a16b4913eeffb85b8e564a963fc | 847 | java | Java | rd-service-generator/src/main/resources/archetype-resources/__rootArtifactId__-api/src/main/java/api/SystemProperties.java | rajeshGavvala-reThink/radien-ce | 5c21feefb17928b76e67b6efddc0e984ac9dfadf | [
"Apache-2.0"
] | null | null | null | rd-service-generator/src/main/resources/archetype-resources/__rootArtifactId__-api/src/main/java/api/SystemProperties.java | rajeshGavvala-reThink/radien-ce | 5c21feefb17928b76e67b6efddc0e984ac9dfadf | [
"Apache-2.0"
] | null | null | null | rd-service-generator/src/main/resources/archetype-resources/__rootArtifactId__-api/src/main/java/api/SystemProperties.java | rajeshGavvala-reThink/radien-ce | 5c21feefb17928b76e67b6efddc0e984ac9dfadf | [
"Apache-2.0"
] | null | null | null | 33.88 | 75 | 0.728453 | 7,028 | /*
* Copyright (c) 2021-present radien GmbH. All rights reserved.
* <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 ${package}.api;
/**
* Enum class that contains the keys of the properties used in OAF
* @author Rajesh Gavvala
* @author Marco Weiland
*/
public interface SystemProperties {
String propKey();
} |
3e10a39f8f535248b390288646dada9aba7d7b3b | 2,032 | java | Java | service/fling/src/test/java/net/friedl/fling/model/ArtifactDtoTest.java | arminfriedl/fling | 909606a9960fede8951436748c20a9600819b93a | [
"MIT"
] | null | null | null | service/fling/src/test/java/net/friedl/fling/model/ArtifactDtoTest.java | arminfriedl/fling | 909606a9960fede8951436748c20a9600819b93a | [
"MIT"
] | null | null | null | service/fling/src/test/java/net/friedl/fling/model/ArtifactDtoTest.java | arminfriedl/fling | 909606a9960fede8951436748c20a9600819b93a | [
"MIT"
] | null | null | null | 31.261538 | 97 | 0.755906 | 7,029 | package net.friedl.fling.model;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.Paths;
import java.util.Set;
import java.util.UUID;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import net.friedl.fling.model.dto.ArtifactDto;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = ModelTestConfiguration.class)
public class ArtifactDtoTest {
@Autowired
private Validator validator;
@Test
void testSetId_null_validationOk() {
ArtifactDto artifactDto = ArtifactDto.builder()
.id(null)
.path(Paths.get("test"))
.build();
Set<ConstraintViolation<ArtifactDto>> constraintViolations = validator.validate(artifactDto);
assertThat(constraintViolations).hasSize(0);
}
@Test
void testSetPath_null_validationFails() {
ArtifactDto artifactDto = ArtifactDto.builder()
.id(new UUID(0L, 0L))
.path(null)
.build();
Set<ConstraintViolation<ArtifactDto>> constraintViolations = validator.validate(artifactDto);
assertThat(constraintViolations).hasSize(1);
ConstraintViolation<ArtifactDto> violation = constraintViolations.iterator().next();
assertThat(violation.getPropertyPath().toString()).isEqualTo("path");
assertThat(violation.getMessage()).isEqualTo("must not be null");
}
@Test
void testMandatoryFieldsSet_validationOk() {
ArtifactDto artifactDto = ArtifactDto.builder()
.id(new UUID(0L, 0L))
.path(Paths.get("test"))
.build();
Set<ConstraintViolation<ArtifactDto>> constraintViolations = validator.validate(artifactDto);
assertTrue(constraintViolations.isEmpty());
}
}
|
3e10a47342060cbcffd157795fefe9f6a124e988 | 1,750 | java | Java | journalkeeper-core-api/src/main/java/io/journalkeeper/core/api/SnapshotEntry.java | HuangHaifeng1991/journalkeeper | 5ebf0ecdf4dd9ff29bb46b84dc8907bbd2cb61a8 | [
"Apache-2.0"
] | 77 | 2019-09-06T09:12:41.000Z | 2022-03-19T08:04:39.000Z | journalkeeper-core-api/src/main/java/io/journalkeeper/core/api/SnapshotEntry.java | HuangHaifeng1991/journalkeeper | 5ebf0ecdf4dd9ff29bb46b84dc8907bbd2cb61a8 | [
"Apache-2.0"
] | 8 | 2019-12-11T02:05:27.000Z | 2022-01-21T23:29:19.000Z | journalkeeper-core-api/src/main/java/io/journalkeeper/core/api/SnapshotEntry.java | HuangHaifeng1991/journalkeeper | 5ebf0ecdf4dd9ff29bb46b84dc8907bbd2cb61a8 | [
"Apache-2.0"
] | 32 | 2019-09-06T09:09:52.000Z | 2022-01-30T03:40:46.000Z | 23.972603 | 75 | 0.622286 | 7,030 | /**
* 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 io.journalkeeper.core.api;
import java.util.Objects;
/**
* SnapshotEntry
* author: gaohaoxiang
* date: 2019/12/13
*/
public class SnapshotEntry {
private long index;
private long timestamp;
public SnapshotEntry() {
}
public SnapshotEntry(long index, long timestamp) {
this.index = index;
this.timestamp = timestamp;
}
public long getIndex() {
return index;
}
public void setIndex(long index) {
this.index = index;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SnapshotEntry that = (SnapshotEntry) o;
return index == that.index;
}
@Override
public int hashCode() {
return Objects.hash(index);
}
@Override
public String toString() {
return "SnapshotEntry{" +
"index=" + index +
", timestamp=" + timestamp +
'}';
}
} |
3e10a5413bac36c923a03af106e03712893cf30d | 1,464 | java | Java | server/src/main/java/com/coincoinche/engine/Move.java | CatanaA/coincoinche | 8b209a35ac41153291cdfc49dd6fd64b107e2dc0 | [
"MIT"
] | 5 | 2019-09-20T16:03:36.000Z | 2019-11-28T13:59:58.000Z | server/src/main/java/com/coincoinche/engine/Move.java | CatanaA/coincoinche | 8b209a35ac41153291cdfc49dd6fd64b107e2dc0 | [
"MIT"
] | 12 | 2019-09-20T11:55:33.000Z | 2022-02-26T18:29:30.000Z | server/src/main/java/com/coincoinche/engine/Move.java | CatanaA/coincoinche | 8b209a35ac41153291cdfc49dd6fd64b107e2dc0 | [
"MIT"
] | 3 | 2019-10-04T11:45:45.000Z | 2022-01-05T08:51:29.000Z | 37.538462 | 100 | 0.732923 | 7,031 | package com.coincoinche.engine;
import com.coincoinche.engine.game.GameResult;
import com.coincoinche.engine.teams.Player;
import com.coincoinche.engine.teams.Team;
/** Move represents a move which can be applied on a game. */
public abstract class Move {
/**
* Apply the move to a coinche game, changing its round or its state depending on what the move is
* supposed to do.
*
* @param game is the game where to move should be applied.
* @return the result of the game (finished or unfinished).
* @throws IllegalMoveException if the move can't be applied to the game.
*/
public GameResult<Team> applyOnGame(CoincheGame game) throws IllegalMoveException {
CoincheGameRound round = game.getCurrentRound();
Player player = round.getCurrentPlayer();
GameState state = round.getState();
applyOnRoundState(state, player);
return game.moveWasApplied();
}
/**
* Apply the move to a round state. This method is called by applyOnGame on the state of the
* game's current round. It changes the state according to what the move is supposed to do.
*
* @param state is the state of the round where the move will be applied.
* @param player is the player making the move.
* @throws IllegalMoveException if the move can't be applied to the state.
*/
protected abstract void applyOnRoundState(GameState state, Player player)
throws IllegalMoveException;
public abstract String getShortName();
}
|
3e10a654c0c6cce03be54d574e01b89a9bc39788 | 1,821 | java | Java | runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java | ejedev/runelite | a8de2b6d2465987cbd8f1962579dfdbb6ea81ef4 | [
"BSD-2-Clause"
] | 13 | 2019-02-14T14:27:34.000Z | 2019-05-16T23:51:33.000Z | runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java | ejedev/runelite | a8de2b6d2465987cbd8f1962579dfdbb6ea81ef4 | [
"BSD-2-Clause"
] | 9 | 2019-10-26T00:25:52.000Z | 2019-12-12T19:41:24.000Z | runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java | ejedev/runelite | a8de2b6d2465987cbd8f1962579dfdbb6ea81ef4 | [
"BSD-2-Clause"
] | 15 | 2019-01-23T06:52:01.000Z | 2022-01-30T22:43:33.000Z | 40.466667 | 82 | 0.767161 | 7,032 | /*
* Copyright (c) 2018, TheLonelyDev <https://github.com/TheLonelyDev>
* Copyright (c) 2018, Adam <envkt@example.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.groundmarkers;
import java.awt.Color;
import lombok.EqualsAndHashCode;
import lombok.Value;
/**
* Used for serialization of ground marker points.
*/
@Value
@EqualsAndHashCode(exclude = { "color" })
class GroundMarkerPoint
{
private int regionId;
private int regionX;
private int regionY;
private int z;
private Color color;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.