Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
6
99.5k
meta
dict
/* * 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.stanbol.entityhub.web.reader; import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.servlet.ServletContext; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.apache.clerezza.commons.rdf.Graph; import org.apache.clerezza.commons.rdf.BlankNodeOrIRI; import org.apache.clerezza.commons.rdf.Triple; import org.apache.clerezza.commons.rdf.IRI; import org.apache.clerezza.rdf.core.serializedform.Parser; import org.apache.clerezza.rdf.core.serializedform.SupportedFormat; import org.apache.clerezza.rdf.core.serializedform.UnsupportedParsingFormatException; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Service; import org.apache.stanbol.commons.indexedgraph.IndexedGraph; import org.apache.stanbol.entityhub.jersey.utils.JerseyUtils; import org.apache.stanbol.entityhub.jersey.utils.MessageBodyReaderUtils; import org.apache.stanbol.entityhub.jersey.utils.MessageBodyReaderUtils.RequestData; import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory; import org.apache.stanbol.entityhub.servicesapi.model.Representation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Provides support for reading Representation form Requests. This implementation * supports all RDF supports as well as {@link MediaType#APPLICATION_FORM_URLENCODED} * - in case the data are sent from an HTML form - and * {@link MediaType#MULTIPART_FORM_DATA} - mime encoded data. * In case of an HTML form the encoding need to be specified by the parameter * "encoding" for the entity data the parameters "entity" or "content" can be * used. * @author Rupert Westenthaler * */ @Component @Service(Object.class) @Property(name="javax.ws.rs", boolValue=true) @Provider @Consumes({ //First the data types directly supported for parsing representations MediaType.APPLICATION_JSON, SupportedFormat.N3, SupportedFormat.N_TRIPLE, SupportedFormat.RDF_XML, SupportedFormat.TURTLE, SupportedFormat.X_TURTLE, SupportedFormat.RDF_JSON, //finally this also supports sending the data as form and mime multipart MediaType.APPLICATION_FORM_URLENCODED, MediaType.MULTIPART_FORM_DATA}) public class RepresentationReader implements MessageBodyReader<Map<String,Representation>> { private static final Logger log = LoggerFactory.getLogger(RepresentationReader.class); public static final Set<String> supportedMediaTypes; private static final MediaType DEFAULT_ACCEPTED_MEDIA_TYPE = MediaType.TEXT_PLAIN_TYPE; static { Set<String> types = new HashSet<String>(); //ensure everything is lower case types.add(MediaType.APPLICATION_JSON.toLowerCase()); types.add(SupportedFormat.N3.toLowerCase()); types.add(SupportedFormat.N_TRIPLE.toLowerCase()); types.add(SupportedFormat.RDF_JSON.toLowerCase()); types.add(SupportedFormat.RDF_XML.toLowerCase()); types.add(SupportedFormat.TURTLE.toLowerCase()); types.add(SupportedFormat.X_TURTLE.toLowerCase()); supportedMediaTypes = Collections.unmodifiableSet(types); } @Reference private Parser parser; @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { String mediaTypeWithoutParameter = mediaType.getType().toLowerCase()+'/'+ mediaType.getSubtype().toLowerCase(); log.debug("isreadable: [genericType: {}| mediaType {}]", genericType,mediaTypeWithoutParameter); //second the media type boolean mediaTypeOK = (//the MimeTypes of Representations supportedMediaTypes.contains(mediaTypeWithoutParameter) || //as well as URL encoded MediaType.APPLICATION_FORM_URLENCODED.equals(mediaTypeWithoutParameter) || //and mime multipart MediaType.MULTIPART_FORM_DATA.equals(mediaTypeWithoutParameter)); boolean typeOk = JerseyUtils.testParameterizedType(Map.class, new Class[]{String.class,Representation.class}, genericType); log.debug("type is {} for {} against Map<String,Representation>", typeOk ? "compatible" : "incompatible" ,genericType); return typeOk && mediaTypeOK; } @Override public Map<String,Representation> readFrom(Class<Map<String,Representation>> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { log.info("Read Representations from Request Data"); long start = System.currentTimeMillis(); //(1) get the charset and the acceptedMediaType String charset = "UTF-8"; if(mediaType.getParameters().containsKey("charset")){ charset = mediaType.getParameters().get("charset"); } MediaType acceptedMediaType = getAcceptedMediaType(httpHeaders); log.info("readFrom: mediaType {} | accepted {} | charset {}", new Object[]{mediaType,acceptedMediaType,charset}); // (2) read the Content from the request (this needs to deal with // MediaType.APPLICATION_FORM_URLENCODED_TYPE and // MediaType.MULTIPART_FORM_DATA_TYPE requests! RequestData content; if(mediaType.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) { try { content = MessageBodyReaderUtils.formForm(entityStream, charset, "encoding",Arrays.asList("entity","content")); } catch (IllegalArgumentException e) { log.info("Bad Request: {}",e); throw new WebApplicationException( Response.status(Status.BAD_REQUEST).entity(e.toString()). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } if(content.getMediaType() == null){ String message = String.format( "Missing parameter %s used to specify the media type" + "(supported values: %s", "encoding",supportedMediaTypes); log.info("Bad Request: {}",message); throw new WebApplicationException( Response.status(Status.BAD_REQUEST).entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } if(!isSupported(content.getMediaType())){ String message = String.format( "Unsupported Content-Type specified by parameter " + "encoding=%s (supported: %s)", content.getMediaType().toString(),supportedMediaTypes); log.info("Bad Request: {}",message); throw new WebApplicationException( Response.status(Status.BAD_REQUEST). entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } } else if(mediaType.isCompatible(MediaType.MULTIPART_FORM_DATA_TYPE)){ log.info("read from MimeMultipart"); List<RequestData> contents; try { contents = MessageBodyReaderUtils.fromMultipart(entityStream, mediaType); } catch (IllegalArgumentException e) { log.info("Bad Request: {}",e.toString()); throw new WebApplicationException( Response.status(Status.BAD_REQUEST).entity(e.toString()). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } if(contents.isEmpty()){ String message = "Request does not contain any Mime BodyParts."; log.info("Bad Request: {}",message); throw new WebApplicationException( Response.status(Status.BAD_REQUEST).entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } else if(contents.size()>1){ //print warnings about ignored parts log.warn("{} Request contains more than one Parts: others than " + "the first will be ignored", MediaType.MULTIPART_FORM_DATA_TYPE); for(int i=1;i<contents.size();i++){ RequestData ignored = contents.get(i); log.warn(" ignore Content {}: Name {}| MediaType {}", new Object[] {i+1,ignored.getName(),ignored.getMediaType()}); } } content = contents.get(0); if(content.getMediaType() == null){ String message = String.format( "MediaType not specified for mime body part for file %s. " + "The media type must be one of the supported values: %s", content.getName(), supportedMediaTypes); log.info("Bad Request: {}",message); throw new WebApplicationException( Response.status(Status.BAD_REQUEST).entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } if(!isSupported(content.getMediaType())){ String message = String.format( "Unsupported Content-Type %s specified for mime body part " + "for file %s (supported: %s)", content.getMediaType(),content.getName(),supportedMediaTypes); log.info("Bad Request: {}",message); throw new WebApplicationException( Response.status(Status.BAD_REQUEST). entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } } else { content = new RequestData(mediaType, null, entityStream); } long readingCompleted = System.currentTimeMillis(); log.info(" ... reading request data {}ms",readingCompleted-start); Map<String,Representation> parsed = parseFromContent(content,acceptedMediaType); long parsingCompleted = System.currentTimeMillis(); log.info(" ... parsing data {}ms",parsingCompleted-readingCompleted); return parsed; } public Map<String,Representation> parseFromContent(RequestData content, MediaType acceptedMediaType){ // (3) Parse the Representtion(s) form the entity stream if(content.getMediaType().isCompatible(MediaType.APPLICATION_JSON_TYPE)){ //parse from json throw new UnsupportedOperationException("Parsing of JSON not yet implemented :("); } else if(isSupported(content.getMediaType())){ //from RDF serialisation RdfValueFactory valueFactory = RdfValueFactory.getInstance(); Map<String,Representation> representations = new HashMap<String,Representation>(); Set<BlankNodeOrIRI> processed = new HashSet<BlankNodeOrIRI>(); Graph graph = new IndexedGraph(); try { parser.parse(graph,content.getEntityStream(), content.getMediaType().toString()); } catch (UnsupportedParsingFormatException e) { //String acceptedMediaType = httpHeaders.getFirst("Accept"); //throw an internal server Error, because we check in //isReadable(..) for supported types and still we get here a //unsupported format -> therefore it looks like an configuration //error the server (e.g. a missing Bundle with the required bundle) String message = "Unable to create the Parser for the supported format" +content.getMediaType()+" ("+e+")"; log.error(message,e); throw new WebApplicationException( Response.status(Status.INTERNAL_SERVER_ERROR). entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } catch (RuntimeException e){ //NOTE: Clerezza seams not to provide specific exceptions on // parsing errors. Hence the catch for all RuntimeException String message = "Unable to parse the provided RDF data (format: " +content.getMediaType()+", message: "+e.getMessage()+")"; log.error(message,e); throw new WebApplicationException( Response.status(Status.BAD_REQUEST). entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } for(Iterator<Triple> st = graph.iterator();st.hasNext();){ BlankNodeOrIRI resource = st.next().getSubject(); if(resource instanceof IRI && processed.add(resource)){ //build a new representation representations.put(((IRI)resource).getUnicodeString(), valueFactory.createRdfRepresentation((IRI)resource, graph)); } } return representations; } else { //unsupported media type String message = String.format( "Parsed Content-Type '%s' is not one of the supported %s", content.getMediaType(),supportedMediaTypes); log.info("Bad Request: {}",message); throw new WebApplicationException( Response.status(Status.BAD_REQUEST). entity(message). header(HttpHeaders.ACCEPT, acceptedMediaType).build()); } } /** * Internally used to get the accepted media type used when returning * {@link WebApplicationException}s. * @param httpHeaders * @param acceptedMediaType * @return */ private static MediaType getAcceptedMediaType(MultivaluedMap<String,String> httpHeaders) { MediaType acceptedMediaType; String acceptedMediaTypeString = httpHeaders.getFirst("Accept"); if(acceptedMediaTypeString != null){ try { acceptedMediaType = MediaType.valueOf(acceptedMediaTypeString); if(acceptedMediaType.isWildcardType()){ acceptedMediaType = DEFAULT_ACCEPTED_MEDIA_TYPE; } } catch (IllegalArgumentException e) { acceptedMediaType = DEFAULT_ACCEPTED_MEDIA_TYPE; } } else { acceptedMediaType = DEFAULT_ACCEPTED_MEDIA_TYPE; } return acceptedMediaType; } /** * Converts the type and the subtype of the parsed media type to the * string representation as stored in {@link #supportedMediaTypes} and than * checks if the parsed media type is contained in this list. * @param mediaType the MediaType instance to check * @return <code>true</code> if the parsed media type is not * <code>null</code> and supported. */ private boolean isSupported(MediaType mediaType){ return mediaType == null ? false : supportedMediaTypes.contains( mediaType.getType().toLowerCase()+'/'+ mediaType.getSubtype().toLowerCase()); } }
{ "pile_set_name": "Github" }
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.impl import com.intellij.ProjectTopics import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.service import com.intellij.openapi.extensions.ExtensionNotApplicableException import com.intellij.openapi.module.Module import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.project.ModuleListener import com.intellij.openapi.project.Project import com.intellij.openapi.project.rootManager import com.intellij.openapi.roots.ModuleRootEvent import com.intellij.openapi.roots.ModuleRootListener import com.intellij.openapi.startup.StartupActivity import com.intellij.openapi.vcs.AbstractVcs import com.intellij.openapi.vcs.ProjectLevelVcsManager import com.intellij.openapi.vcs.VcsDirectoryMapping import com.intellij.openapi.vfs.VirtualFile internal class ModuleVcsDetector(private val project: Project) { private val vcsManager by lazy(LazyThreadSafetyMode.NONE) { (ProjectLevelVcsManager.getInstance(project) as ProjectLevelVcsManagerImpl) } internal class MyPostStartUpActivity : StartupActivity.DumbAware { init { if (ApplicationManager.getApplication().isUnitTestMode) { throw ExtensionNotApplicableException.INSTANCE } } override fun runActivity(project: Project) { val vcsDetector = project.service<ModuleVcsDetector>() val listener = vcsDetector.MyModulesListener() val busConnection = project.messageBus.connect() busConnection.subscribe(ProjectTopics.MODULES, listener) busConnection.subscribe(ProjectTopics.PROJECT_ROOTS, listener) if (vcsDetector.vcsManager.needAutodetectMappings()) { vcsDetector.autoDetectVcsMappings(true) } } } private inner class MyModulesListener : ModuleRootListener, ModuleListener { private val myMappingsForRemovedModules: MutableList<VcsDirectoryMapping> = mutableListOf() override fun beforeRootsChange(event: ModuleRootEvent) { myMappingsForRemovedModules.clear() } override fun rootsChanged(event: ModuleRootEvent) { myMappingsForRemovedModules.forEach { mapping -> vcsManager.removeDirectoryMapping(mapping) } // the check calculates to true only before user has done any change to mappings, i.e. in case modules are detected/added automatically // on start etc (look inside) if (vcsManager.needAutodetectMappings()) { autoDetectVcsMappings(false) } } override fun moduleAdded(project: Project, module: Module) { myMappingsForRemovedModules.removeAll(getMappings(module)) autoDetectModuleVcsMapping(module) } override fun beforeModuleRemoved(project: Project, module: Module) { myMappingsForRemovedModules.addAll(getMappings(module)) } } private fun autoDetectVcsMappings(tryMapPieces: Boolean) { if (vcsManager.haveDefaultMapping() != null) return val usedVcses = mutableSetOf<AbstractVcs?>() val detectedRoots = mutableSetOf<Pair<VirtualFile, AbstractVcs>>() val roots = ModuleManager.getInstance(project).modules.flatMap { it.rootManager.contentRoots.asIterable() }.distinct() for (root in roots) { val moduleVcs = vcsManager.findVersioningVcs(root) if (moduleVcs != null) { detectedRoots.add(Pair(root, moduleVcs)) } usedVcses.add(moduleVcs) // put 'null' for unmapped module } val commonVcs = usedVcses.singleOrNull() if (commonVcs != null) { // Remove existing mappings that will duplicate added <Project> mapping. val rootPaths = roots.map { it.path }.toSet() val additionalMappings = vcsManager.directoryMappings.filter { it.directory !in rootPaths } vcsManager.setAutoDirectoryMappings(additionalMappings + VcsDirectoryMapping.createDefault(commonVcs.name)) } else if (tryMapPieces) { val newMappings = detectedRoots.map { (root, vcs) -> VcsDirectoryMapping(root.path, vcs.name) } vcsManager.setAutoDirectoryMappings(vcsManager.directoryMappings + newMappings) } } private fun autoDetectModuleVcsMapping(module: Module) { if (vcsManager.haveDefaultMapping() != null) return val newMappings = mutableListOf<VcsDirectoryMapping>() for (file in module.rootManager.contentRoots) { val vcs = vcsManager.findVersioningVcs(file) if (vcs != null && vcs !== vcsManager.getVcsFor(file)) { newMappings.add(VcsDirectoryMapping(file.path, vcs.name)) } } if (newMappings.isNotEmpty()) { vcsManager.setAutoDirectoryMappings(vcsManager.directoryMappings + newMappings) } } private fun getMappings(module: Module): List<VcsDirectoryMapping> { return module.rootManager.contentRoots .mapNotNull { root -> vcsManager.directoryMappings.firstOrNull { it.directory == root.path } } } }
{ "pile_set_name": "Github" }
package io.gitlab.arturbosch.detekt.generator.collection import io.gitlab.arturbosch.detekt.api.DetektVisitor import io.gitlab.arturbosch.detekt.generator.collection.exception.InvalidDocumentationException import io.gitlab.arturbosch.detekt.rules.isOverride import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtReferenceExpression import org.jetbrains.kotlin.psi.KtSuperTypeList import org.jetbrains.kotlin.psi.KtValueArgumentList import org.jetbrains.kotlin.psi.psiUtil.containingClass import org.jetbrains.kotlin.psi.psiUtil.referenceExpression data class MultiRule( val name: String, val rules: List<String> = listOf() ) { operator fun contains(ruleName: String) = ruleName in this.rules } private val multiRule = io.gitlab.arturbosch.detekt.api.MultiRule::class.simpleName ?: "" class MultiRuleCollector : Collector<MultiRule> { override val items = mutableListOf<MultiRule>() override fun visit(file: KtFile) { val visitor = MultiRuleVisitor() file.accept(visitor) if (visitor.containsMultiRule) { items.add(visitor.getMultiRule()) } } } class MultiRuleVisitor : DetektVisitor() { val containsMultiRule get() = classesMap.any { it.value } private var classesMap = mutableMapOf<String, Boolean>() private var name = "" private val rulesVisitor = RuleListVisitor() private val properties: MutableMap<String, String> = mutableMapOf() fun getMultiRule(): MultiRule { val rules = mutableListOf<String>() val ruleProperties = rulesVisitor.ruleProperties .mapNotNull { properties[it] } rules.addAll(ruleProperties) rules.addAll(rulesVisitor.ruleNames) if (name.isEmpty()) { throw InvalidDocumentationException("MultiRule without name found.") } if (rules.isEmpty()) { throw InvalidDocumentationException("MultiRule $name contains no rules.") } return MultiRule(name, rules) } override fun visitSuperTypeList(list: KtSuperTypeList) { val isMultiRule = list.entries ?.mapNotNull { it.typeAsUserType?.referencedName } ?.any { it == multiRule } ?: false val containingClass = list.containingClass() val className = containingClass?.name if (containingClass != null && className != null && !classesMap.containsKey(className)) { classesMap[className] = isMultiRule } super.visitSuperTypeList(list) } override fun visitClassOrObject(classOrObject: KtClassOrObject) { super.visitClassOrObject(classOrObject) if (classesMap[classOrObject.name] != true) { return } name = classOrObject.name?.trim() ?: "" } override fun visitProperty(property: KtProperty) { super.visitProperty(property) if (classesMap[property.containingClass()?.name] != true) { return } if (property.isOverride() && property.name != null && property.name == "rules") { property.accept(rulesVisitor) } else { val name = property.name val initializer = property.initializer?.referenceExpression()?.text if (name != null && initializer != null) { properties[name] = initializer } } } } class RuleListVisitor : DetektVisitor() { var ruleNames: MutableSet<String> = mutableSetOf() private set var ruleProperties: MutableSet<String> = mutableSetOf() private set override fun visitValueArgumentList(list: KtValueArgumentList) { super.visitValueArgumentList(list) val argumentExpressions = list.arguments.map { it.getArgumentExpression() } // Call Expression = Constructor of rule ruleNames.addAll(argumentExpressions .filterIsInstance<KtCallExpression>() .map { it.calleeExpression?.text ?: "" }) // Reference Expression = variable we need to search for ruleProperties.addAll(argumentExpressions .filterIsInstance<KtReferenceExpression>() .map { it.text ?: "" }) } }
{ "pile_set_name": "Github" }
# Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1024m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true
{ "pile_set_name": "Github" }
<html> <body> <h1>Directory listing</h1> <hr/> <pre> <a href="management-core-3.0.4-javadoc.jar">management-core-3.0.4-javadoc.jar</a> <a href="management-core-3.0.4-javadoc.jar.md5">management-core-3.0.4-javadoc.jar.md5</a> <a href="management-core-3.0.4-javadoc.jar.sha1">management-core-3.0.4-javadoc.jar.sha1</a> <a href="management-core-3.0.4-sources.jar">management-core-3.0.4-sources.jar</a> <a href="management-core-3.0.4-sources.jar.md5">management-core-3.0.4-sources.jar.md5</a> <a href="management-core-3.0.4-sources.jar.sha1">management-core-3.0.4-sources.jar.sha1</a> <a href="management-core-3.0.4.jar">management-core-3.0.4.jar</a> <a href="management-core-3.0.4.jar.md5">management-core-3.0.4.jar.md5</a> <a href="management-core-3.0.4.jar.sha1">management-core-3.0.4.jar.sha1</a> <a href="management-core-3.0.4.pom">management-core-3.0.4.pom</a> <a href="management-core-3.0.4.pom.md5">management-core-3.0.4.pom.md5</a> <a href="management-core-3.0.4.pom.sha1">management-core-3.0.4.pom.sha1</a> </pre> </body> </html>
{ "pile_set_name": "Github" }
package com.android.inputmethodcommon; class InputMethodSettingsInterface { } class InputMethodSettingsImpl { int mContext; int mImi; int mImm; int mSubtypeEnablerIcon; int mSubtypeEnablerIconRes; int mSubtypeEnablerTitle; int mSubtypeEnablerTitleRes; int mInputMethodSettingsCategoryTitle; int mInputMethodSettingsCategoryTitleRes; int mSubtypeEnablerPreference; } class InputMethodSettingsFragment { int mSettings; } class InputMethodSettingsActivity { int mSettings; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/appBackground" android:foreground="?android:attr/selectableItemBackground" android:gravity="center_vertical" android:orientation="horizontal" android:paddingBottom="15dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="15dp"> <ImageView android:id="@+id/song_item_img" android:layout_width="50dp" android:layout_height="50dp" android:layout_weight="0" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="15dp" android:layout_weight="1" android:orientation="vertical"> <TextView android:id="@+id/song_item_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:textColor="#000" android:textSize="16sp" /> <TextView android:id="@+id/song_item_artist" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:textColor="#989898" android:textSize="14sp" /> </LinearLayout> <ImageView android:id="@+id/song_item_menu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:layout_weight="0" android:background="@drawable/unbounded_ripple" android:foregroundTint="#434343" android:padding="5dp" android:src="@drawable/abc_ic_menu_moreoverflow_mtrl_alpha" android:theme="@style/Theme.AppCompat.Light" /> </LinearLayout>
{ "pile_set_name": "Github" }
/*####################################################### * Copyright (c) 2014 Jeff Martin * Copyright (c) 2015 Pedro Lafuente * Copyright (c) 2017-2019 Gregor Santner * * Licensed under the MIT license. * You can get a copy of the license text here: * https://opensource.org/licenses/MIT ###########################################################*/ package other.writeily.ui; import android.app.Dialog; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.text.TextUtils; import net.gsantner.markor.R; import net.gsantner.markor.util.AppSettings; import java.io.Serializable; public class WrConfirmDialog extends DialogFragment { public static final String FRAGMENT_TAG = "WrConfirmDialog"; private static final String EXTRA_TITLE = "EXTRA_TITLE"; private static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; public static final String EXTRA_DATA = "EXTRA_DATA"; private Serializable _data; private ConfirmDialogCallback[] _callbacks; private String _summary; public static WrConfirmDialog newInstance(String title, String message, Serializable data, ConfirmDialogCallback... callbacks) { WrConfirmDialog confirmDialog = new WrConfirmDialog(); Bundle args = new Bundle(); args.putSerializable(EXTRA_DATA, data); args.putString(EXTRA_TITLE, title); args.putString(EXTRA_MESSAGE, message); confirmDialog.setArguments(args); confirmDialog.setCallbacks(callbacks); return confirmDialog; } public void setCallbacks(ConfirmDialogCallback[] callbacks) { _callbacks = callbacks; } @Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { String title = getArguments().getString(EXTRA_TITLE); String message = getArguments().getString(EXTRA_MESSAGE); _data = getArguments().getSerializable(EXTRA_DATA); AlertDialog.Builder dialogBuilder; boolean darkTheme = AppSettings.get().isDarkThemeEnabled(); dialogBuilder = new AlertDialog.Builder(getActivity(), darkTheme ? R.style.Theme_AppCompat_Dialog : R.style.Theme_AppCompat_Light_Dialog); dialogBuilder.setTitle(title); if (!TextUtils.isEmpty(message)) { dialogBuilder.setMessage(message); } dialogBuilder.setPositiveButton(getString(android.R.string.ok), (dialog, which) -> { if (_callbacks != null) { for (ConfirmDialogCallback cdc : _callbacks) { if (cdc != null) { cdc.onConfirmDialogAnswer(true, _data); } } } }); dialogBuilder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> { dialog.dismiss(); for (ConfirmDialogCallback cdc : _callbacks) { cdc.onConfirmDialogAnswer(false, _data); } }); return dialogBuilder.show(); } public interface ConfirmDialogCallback { void onConfirmDialogAnswer(boolean confirmed, Serializable data); } }
{ "pile_set_name": "Github" }
// Copyright 2004-present Facebook. All Rights Reserved. #include "SamplingProfilerJniMethod.h" #include <JavaScriptCore/JSProfilerPrivate.h> #include <jschelpers/JSCHelpers.h> #include <jni.h> #include <string> using namespace facebook::jni; namespace facebook { namespace react { /* static */ jni::local_ref<SamplingProfilerJniMethod::jhybriddata> SamplingProfilerJniMethod::initHybrid(jni::alias_ref<jclass>, jlong javaScriptContext) { return makeCxxInstance(javaScriptContext); } /* static */ void SamplingProfilerJniMethod::registerNatives() { registerHybrid( {makeNativeMethod("initHybrid", SamplingProfilerJniMethod::initHybrid), makeNativeMethod("poke", SamplingProfilerJniMethod::poke)}); } SamplingProfilerJniMethod::SamplingProfilerJniMethod(jlong javaScriptContext) { context_ = reinterpret_cast<JSGlobalContextRef>(javaScriptContext); } void SamplingProfilerJniMethod::poke( jni::alias_ref<JSPackagerClientResponder::javaobject> responder) { if (!JSC_JSSamplingProfilerEnabled(context_)) { responder->error("The JSSamplingProfiler is disabled. See this " "https://fburl.com/u4lw7xeq for some help"); return; } JSValueRef jsResult = JSC_JSPokeSamplingProfiler(context_); if (JSC_JSValueGetType(context_, jsResult) == kJSTypeNull) { responder->respond("started"); } else { JSStringRef resultStrRef = JSValueToStringCopy(context_, jsResult, nullptr); size_t length = JSStringGetLength(resultStrRef); char buffer[length + 1]; JSStringGetUTF8CString(resultStrRef, buffer, length + 1); JSStringRelease(resultStrRef); responder->respond(buffer); } } } }
{ "pile_set_name": "Github" }
package org.basex.query.func.validate; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Function implementation. * * @author BaseX Team 2005-20, BSD License * @author Christian Gruen */ public final class ValidateXsdProcessor extends StandardFunc { @Override public Item item(final QueryContext qc, final InputInfo ii) { return Str.get(ValidateXsd.IMPL[ValidateXsd.OFFSET + 1]); } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <Button android:id="@+id/btn_crash_restart" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="重启App" android:layout_alignParentTop="true" /> <TextView android:id="@+id/tv_crash_info" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="false" android:ellipsize="none" android:gravity="left" android:inputType="textMultiLine" android:layout_below="@id/btn_crash_restart" /> </RelativeLayout>
{ "pile_set_name": "Github" }
package org.jetbrains.dokka.base.transformers.documentables import org.jetbrains.dokka.model.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer import org.jetbrains.dokka.transformers.documentation.perPackageOptions import org.jetbrains.dokka.transformers.documentation.source import org.jetbrains.dokka.transformers.documentation.sourceSet import java.io.File class SuppressedDocumentableFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer { override fun invoke(modules: List<DModule>): List<DModule> { return modules.mapNotNull(::filterModule) } private fun filterModule(module: DModule): DModule? { val packages = module.packages.mapNotNull { pkg -> filterPackage(pkg) } return when { packages == module.packages -> module packages.isEmpty() -> null else -> module.copy(packages = packages) } } private fun filterPackage(pkg: DPackage): DPackage? { val options = perPackageOptions(pkg) if (options?.suppress == true) { return null } val filteredChildren = pkg.children.filterNot(::isSuppressed) return when { filteredChildren == pkg.children -> pkg filteredChildren.isEmpty() -> null else -> pkg.copy( functions = filteredChildren.filterIsInstance<DFunction>(), classlikes = filteredChildren.filterIsInstance<DClasslike>(), typealiases = filteredChildren.filterIsInstance<DTypeAlias>(), properties = filteredChildren.filterIsInstance<DProperty>() ) } } private fun isSuppressed(documentable: Documentable): Boolean { if (documentable !is WithSources) return false val sourceFile = File(source(documentable).path).absoluteFile return sourceSet(documentable).suppressedFiles.any { suppressedFile -> sourceFile.startsWith(suppressedFile.absoluteFile) } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "group:Runner.xcodeproj"> </FileRef> </Workspace>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Dapper" version="1.50.4-alpha1-00070" targetFramework="net452" /> <package id="Dapper.Contrib" version="1.50.0" targetFramework="net452" /> <package id="Dapper.Extension" version="1.0.0.1" targetFramework="net452" /> <package id="EntityFramework" version="6.1.3" targetFramework="net452" /> <package id="SyntacticSugar" version="2.4.1" targetFramework="net452" /> </packages>
{ "pile_set_name": "Github" }
/* * TupleTypeUtil.java * * This source file is part of the FoundationDB open source project * * Copyright 2015-2019 Apple Inc. and the FoundationDB project authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.apple.foundationdb.record.metadata; import com.apple.foundationdb.record.provider.foundationdb.FDBRecordVersion; import com.apple.foundationdb.tuple.Tuple; import com.google.protobuf.ByteString; import com.google.protobuf.Descriptors; import com.google.protobuf.ProtocolMessageEnum; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; /** * Utility class for dealing with {@link Tuple} types. In theory, these methods should live in * {@link com.apple.foundationdb.tuple.TupleHelpers TupleHelpers} except that they use some Protobuf specific things * like the {@link ByteString} class, and {@code TupleHelpers} is defined in the * <a href="https://javadoc.io/doc/org.foundationdb/fdb-extensions/">fdb-extensions</a> sub-project * which does not (and probably should not) take Protobuf as a dependency. */ class TupleTypeUtil { @Nonnull private static final BigInteger BIG_INT_MAX_LONG = BigInteger.valueOf(Long.MAX_VALUE); @Nonnull private static final BigInteger BIG_INT_MIN_LONG = BigInteger.valueOf(Long.MIN_VALUE); /** * Normalize a list of values so that it can be checked for equality with other lists sharing * the same {@link Tuple} representation. In other words, it should be the case that: * * <pre> {@code * toTupleEquivalentValue(list1).equals(toTupleEquivalentValue) * == Arrays.equals(Tuple.fromList(toTupleAppropriateList(list1)).pack(), Tuple.fromList(toTupleAppropriateList(list2)).pack()) * }</pre> * * <p> * for any two lists {@code list1} and {@code list2}. * </p> * * @param values the list of values to normalized * @return a new list containing the normalized elements of {@code values} */ @Nonnull static List<Object> toTupleEquivalentList(@Nonnull List<?> values) { List<Object> tupleEquivalentList = new ArrayList<>(values.size()); for (Object o : values) { tupleEquivalentList.add(toTupleEquivalentValue(o)); } return tupleEquivalentList; } /** * Normalize a value so that it compares equal to anything with the same {@link Tuple} representation. * The value that is returned cannot necessarily be packed by a {@code Tuple} (for example, * a <code>byte[]</code> is returned as a {@link ByteString}), but it does implement {@link Object#equals(Object)} * and {@link Object#hashCode()}, so the value can be used in hash-based data structures like * {@link java.util.HashSet HashSet}s and {@link java.util.HashMap HashMap}s. In other words, it should * bethe case that: * * <pre> {@code * Objects.equals(toTupleEquivalentValue(value1), toTupleEquivalentValue(value2)) * == Arrays.equals(Tuple.from(value1).pack(), Tuple.from(value2).pack()) * }</pre> * * <p> * for any two values {@code value1} and {@code value2}. * </p> * * <p> * This will only return {@code null} if {@link #toTupleAppropriateValue(Object)} would return {@code null} * on the same input. If the object is already in * </p> * * @param obj the value to normalize * @return a value that has the same representation when {@link Tuple}-encoded */ @Nullable static Object toTupleEquivalentValue(@Nullable Object obj) { if (obj == null || obj instanceof Key.Evaluated.NullStandin) { return null; } else if (obj instanceof List<?>) { List<?> list = (List<?>)obj; return toTupleEquivalentList(list); } else if (obj instanceof Tuple) { return toTupleEquivalentList(((Tuple)obj).getItems()); } else if (obj instanceof byte[]) { return ByteString.copyFrom((byte[]) obj); } else if ((obj instanceof Byte) || (obj instanceof Short) || (obj instanceof Integer)) { return ((Number)obj).longValue(); } else if (obj instanceof BigInteger) { BigInteger bigInt = (BigInteger)obj; if (bigInt.compareTo(BIG_INT_MIN_LONG) > 0 && bigInt.compareTo(BIG_INT_MAX_LONG) < 0) { return bigInt.longValue(); } else { return bigInt; } } else if (obj instanceof ProtocolMessageEnum) { return (long)((ProtocolMessageEnum)obj).getNumber(); } else if (obj instanceof Descriptors.EnumValueDescriptor) { return (long)((Descriptors.EnumValueDescriptor)obj).getNumber(); } else if (obj instanceof FDBRecordVersion) { return ((FDBRecordVersion)obj).toVersionstamp(false); } else { return obj; } } /** * Convert a list of values into items that can all be stored within a {@link Tuple}. * * @param values a list of values * @return a new list with {@link Tuple}-encodable versions of the elements of {@code values} */ @Nonnull static List<Object> toTupleAppropriateList(@Nonnull List<?> values) { List<Object> tupleAppropriateList = new ArrayList<>(values.size()); for (Object o : values) { tupleAppropriateList.add(toTupleAppropriateValue(o)); } return tupleAppropriateList; } /** * Convert a value into a type that can be stored within a {@link Tuple}. * * @param obj the value to convert * @return the value converted to some {@link Tuple}-encodable type */ @Nullable static Object toTupleAppropriateValue(@Nullable Object obj) { if (obj instanceof Key.Evaluated.NullStandin) { return null; } else if (obj instanceof ByteString) { return ((ByteString) obj).toByteArray(); } else if (obj instanceof List) { return toTupleAppropriateList((List<?>) obj); // Following two are both Internal.EnumLite, so could use that, too. } else if (obj instanceof ProtocolMessageEnum) { return ((ProtocolMessageEnum) obj).getNumber(); } else if (obj instanceof Descriptors.EnumValueDescriptor) { return ((Descriptors.EnumValueDescriptor) obj).getNumber(); } else if (obj instanceof FDBRecordVersion) { return ((FDBRecordVersion) obj).toVersionstamp(false); } else { return obj; } } private TupleTypeUtil() { } }
{ "pile_set_name": "Github" }
package de.peeeq.wurstscript.utils; import de.peeeq.wurstscript.WLogger; public class ExecutiontimeMeasure implements AutoCloseable { private String message; private long startTime; public ExecutiontimeMeasure(String message) { this.message = message; this.startTime = System.currentTimeMillis(); } @Override public void close() { long time = System.currentTimeMillis() - startTime; WLogger.info("Executed " + message + " in " + time + "ms."); } }
{ "pile_set_name": "Github" }
<?xml version="1.0" ?> <component id="root" name="root"> <component id="system" name="system"> <!--McPAT will skip the components if number is set to 0 --> <param name="number_of_cores" value="64"/> <param name="number_of_L1Directories" value="0"/> <param name="number_of_L2Directories" value="0"/> <param name="number_of_L2s" value="64"/> <!-- This number means how many L2 clusters in each cluster there can be multiple banks/ports --> <param name="number_of_L3s" value="0"/> <!-- This number means how many L3 clusters --> <param name="number_of_NoCs" value="1"/> <param name="homogeneous_cores" value="1"/><!--1 means homo --> <param name="homogeneous_L2s" value="1"/> <param name="homogeneous_L1Directorys" value="1"/> <param name="homogeneous_L2Directorys" value="1"/> <param name="homogeneous_L3s" value="1"/> <param name="homogeneous_ccs" value="1"/><!--cache coherece hardware --> <param name="homogeneous_NoCs" value="1"/> <param name="core_tech_node" value="22"/><!-- nm --> <param name="target_core_clockrate" value="3500"/><!--MHz --> <param name="temperature" value="360"/> <!-- Kelvin --> <param name="number_cache_levels" value="2"/> <param name="interconnect_projection_type" value="0"/><!--0: agressive wire technology; 1: conservative wire technology --> <param name="device_type" value="0"/><!--0: HP(High Performance Type); 1: LSTP(Low standby power) 2: LOP (Low Operating Power) --> <param name="longer_channel_device" value="1"/><!-- 0 no use; 1 use when possible --> <param name="machine_bits" value="64"/> <param name="virtual_address_width" value="64"/> <param name="physical_address_width" value="52"/> <param name="virtual_memory_page_size" value="4096"/> <stat name="total_cycles" value="100000"/> <stat name="idle_cycles" value="0"/> <stat name="busy_cycles" value="100000"/> <!--This page size(B) is complete different from the page size in Main memo secction. this page size is the size of virtual memory from OS/Archi perspective; the page size in Main memo secction is the actuall physical line in a DRAM bank --> <!-- *********************** cores ******************* --> <component id="system.core0" name="core0"> <!-- Core property --> <param name="clock_rate" value="3500"/> <param name="instruction_length" value="32"/> <param name="opcode_width" value="9"/> <!-- address width determins the tag_width in Cache, LSQ and buffers in cache controller default value is machine_bits, if not set --> <param name="machine_type" value="1"/><!-- 1 inorder; 0 OOO--> <!-- inorder/OoO --> <param name="number_hardware_threads" value="4"/> <!-- number_instruction_fetch_ports(icache ports) is always 1 in single-thread processor, it only may be more than one in SMT processors. BTB ports always equals to fetch ports since branch information in consective branch instructions in the same fetch group can be read out from BTB once.--> <param name="fetch_width" value="1"/> <!-- fetch_width determins the size of cachelines of L1 cache block --> <param name="number_instruction_fetch_ports" value="1"/> <param name="decode_width" value="1"/> <!-- decode_width determins the number of ports of the renaming table (both RAM and CAM) scheme --> <param name="issue_width" value="1"/> <!-- issue_width determins the number of ports of Issue window and other logic as in the complexity effective proccessors paper; issue_width==dispatch_width --> <param name="commit_width" value="1"/> <!-- commit_width determins the number of ports of register files --> <param name="fp_issue_width" value="1"/> <param name="prediction_width" value="0"/> <!-- number of branch instructions can be predicted simultannouesl--> <!-- Current version of McPAT does not distinguish int and floating point pipelines Theses parameters are reserved for future use.--> <param name="pipelines_per_core" value="1,1"/> <!--integer_pipeline and floating_pipelines, if the floating_pipelines is 0, then the pipeline is shared--> <param name="pipeline_depth" value="6,6"/> <!-- pipeline depth of int and fp, if pipeline is shared, the second number is the average cycles of fp ops --> <!-- issue and exe unit--> <param name="ALU_per_core" value="1"/> <!-- contains an adder, a shifter, and a logical unit --> <param name="MUL_per_core" value="1"/> <!-- For MUL and Div --> <param name="FPU_per_core" value="0.125"/> <!-- buffer between IF and ID stage --> <param name="instruction_buffer_size" value="16"/> <!-- buffer between ID and sche/exe stage --> <param name="decoded_stream_buffer_size" value="16"/> <param name="instruction_window_scheme" value="0"/><!-- 0 PHYREG based, 1 RSBASED--> <!-- McPAT support 2 types of OoO cores, RS based and physical reg based--> <param name="instruction_window_size" value="16"/> <param name="fp_instruction_window_size" value="16"/> <!-- the instruction issue Q as in Alpha 21264; The RS as in Intel P6 --> <param name="ROB_size" value="80"/> <!-- each in-flight instruction has an entry in ROB --> <!-- registers --> <param name="archi_Regs_IRF_size" value="32"/> <param name="archi_Regs_FRF_size" value="32"/> <!-- if OoO processor, phy_reg number is needed for renaming logic, renaming logic is for both integer and floating point insts. --> <param name="phy_Regs_IRF_size" value="80"/> <param name="phy_Regs_FRF_size" value="80"/> <!-- rename logic --> <param name="rename_scheme" value="0"/> <!-- can be RAM based(0) or CAM based(1) rename scheme RAM-based scheme will have free list, status table; CAM-based scheme have the valid bit in the data field of the CAM both RAM and CAM need RAM-based checkpoint table, checkpoint_depth=# of in_flight instructions; Detailed RAT Implementation see TR --> <param name="register_windows_size" value="8"/> <!-- how many windows in the windowed register file, sun processors; no register windowing is used when this number is 0 --> <!-- In OoO cores, loads and stores can be issued whether inorder(Pentium Pro) or (OoO)out-of-order(Alpha), They will always try to exeute out-of-order though. --> <param name="LSU_order" value="inorder"/> <param name="store_buffer_size" value="32"/> <!-- By default, in-order cores do not have load buffers --> <param name="load_buffer_size" value="32"/> <!-- number of ports refer to sustainable concurrent memory accesses --> <param name="memory_ports" value="1"/> <!-- max_allowed_in_flight_memo_instructions determins the # of ports of load and store buffer as well as the ports of Dcache which is connected to LSU --> <!-- dual-pumped Dcache can be used to save the extra read/write ports --> <param name="RAS_size" value="32"/> <!-- general stats, defines simulation periods;require total, idle, and busy cycles for senity check --> <!-- please note: if target architecture is X86, then all the instrucions refer to (fused) micro-ops --> <stat name="total_instructions" value="800000"/> <stat name="int_instructions" value="600000"/> <stat name="fp_instructions" value="20000"/> <stat name="branch_instructions" value="0"/> <stat name="branch_mispredictions" value="0"/> <stat name="load_instructions" value="100000"/> <stat name="store_instructions" value="100000"/> <stat name="committed_instructions" value="800000"/> <stat name="committed_int_instructions" value="600000"/> <stat name="committed_fp_instructions" value="20000"/> <stat name="pipeline_duty_cycle" value="0.6"/><!--<=1, runtime_ipc/peak_ipc; averaged for all cores if homogenous --> <!-- the following cycle stats are used for heterogeneouse cores only, please ignore them if homogeneouse cores --> <stat name="total_cycles" value="100000"/> <stat name="idle_cycles" value="0"/> <stat name="busy_cycles" value="100000"/> <!-- instruction buffer stats --> <!-- ROB stats, both RS and Phy based OoOs have ROB performance simulator should capture the difference on accesses, otherwise, McPAT has to guess based on number of commited instructions. --> <stat name="ROB_reads" value="263886"/> <stat name="ROB_writes" value="263886"/> <!-- RAT accesses --> <stat name="rename_accesses" value="263886"/> <stat name="fp_rename_accesses" value="263886"/> <!-- decode and rename stage use this, should be total ic - nop --> <!-- Inst window stats --> <stat name="inst_window_reads" value="263886"/> <stat name="inst_window_writes" value="263886"/> <stat name="inst_window_wakeup_accesses" value="263886"/> <stat name="fp_inst_window_reads" value="263886"/> <stat name="fp_inst_window_writes" value="263886"/> <stat name="fp_inst_window_wakeup_accesses" value="263886"/> <!-- RF accesses --> <stat name="int_regfile_reads" value="1600000"/> <stat name="float_regfile_reads" value="40000"/> <stat name="int_regfile_writes" value="800000"/> <stat name="float_regfile_writes" value="20000"/> <!-- accesses to the working reg --> <stat name="function_calls" value="5"/> <stat name="context_switches" value="260343"/> <!-- Number of Windowes switches (number of function calls and returns)--> <!-- Alu stats by default, the processor has one FPU that includes the divider and multiplier. The fpu accesses should include accesses to multiplier and divider --> <stat name="ialu_accesses" value="800000"/> <stat name="fpu_accesses" value="10000"/> <stat name="mul_accesses" value="100000"/> <stat name="cdb_alu_accesses" value="1000000"/> <stat name="cdb_mul_accesses" value="0"/> <stat name="cdb_fpu_accesses" value="0"/> <!-- multiple cycle accesses should be counted multiple times, otherwise, McPAT can use internal counter for different floating point instructions to get final accesses. But that needs detailed info for floating point inst mix --> <!-- currently the performance simulator should make sure all the numbers are final numbers, including the explicit read/write accesses, and the implicite accesses such as replacements and etc. Future versions of McPAT may be able to reason the implicite access based on param and stats of last level cache The same rule applies to all cache access stats too! --> <!-- following is AF for max power computation. Do not change them, unless you understand them--> <stat name="IFU_duty_cycle" value="0.25"/> <stat name="LSU_duty_cycle" value="0.25"/> <stat name="MemManU_I_duty_cycle" value="1"/> <stat name="MemManU_D_duty_cycle" value="0.25"/> <stat name="ALU_duty_cycle" value="0.9"/> <stat name="MUL_duty_cycle" value="0.5"/> <stat name="FPU_duty_cycle" value="0.4"/> <stat name="ALU_cdb_duty_cycle" value="0.9"/> <stat name="MUL_cdb_duty_cycle" value="0.5"/> <stat name="FPU_cdb_duty_cycle" value="0.4"/> <component id="system.core0.predictor" name="PBT"> <!-- branch predictor; tournament predictor see Alpha implementation --> <param name="local_predictor_size" value="10,3"/> <param name="local_predictor_entries" value="1024"/> <param name="global_predictor_entries" value="4096"/> <param name="global_predictor_bits" value="2"/> <param name="chooser_predictor_entries" value="4096"/> <param name="chooser_predictor_bits" value="2"/> <!-- These parameters can be combined like below in next version <param name="load_predictor" value="10,3,1024"/> <param name="global_predictor" value="4096,2"/> <param name="predictor_chooser" value="4096,2"/> --> </component> <component id="system.core0.itlb" name="itlb"> <param name="number_entries" value="64"/> <stat name="total_accesses" value="800000"/> <stat name="total_misses" value="4"/> <stat name="conflicts" value="0"/> <!-- there is no write requests to itlb although writes happen to itlb after miss, which is actually a replacement --> </component> <component id="system.core0.icache" name="icache"> <!-- there is no write requests to itlb although writes happen to it after miss, which is actually a replacement --> <param name="icache_config" value="16384,32,4,1,1,3,8,0"/> <!-- the parameters are capacity,block_width, associativity, bank, throughput w.r.t. core clock, latency w.r.t. core clock,output_width, cache policy --> <!-- cache_policy;//0 no write or write-though with non-write allocate;1 write-back with write-allocate --> <param name="buffer_sizes" value="16, 16, 16,0"/> <!-- cache controller buffer sizes: miss_buffer_size(MSHR),fill_buffer_size,prefetch_buffer_size,wb_buffer_size--> <stat name="read_accesses" value="200000"/> <stat name="read_misses" value="0"/> <stat name="conflicts" value="0"/> </component> <component id="system.core0.dtlb" name="dtlb"> <param name="number_entries" value="64"/> <stat name="total_accesses" value="200000"/> <stat name="total_misses" value="4"/> <stat name="conflicts" value="0"/> </component> <component id="system.core0.dcache" name="dcache"> <!-- all the buffer related are optional --> <param name="dcache_config" value="8192,16,4,1,1,3,16,0"/> <param name="buffer_sizes" value="16, 16, 16, 16"/> <!-- cache controller buffer sizes: miss_buffer_size(MSHR),fill_buffer_size,prefetch_buffer_size,wb_buffer_size--> <stat name="read_accesses" value="200000"/> <stat name="write_accesses" value="27276"/> <stat name="read_misses" value="1632"/> <stat name="write_misses" value="183"/> <stat name="conflicts" value="0"/> </component> <component id="system.core0.BTB" name="BTB"> <!-- all the buffer related are optional --> <param name="BTB_config" value="8192,4,2,1, 1,3"/> <!-- the parameters are capacity,block_width,associativity,bank, throughput w.r.t. core clock, latency w.r.t. core clock,--> </component> </component> <component id="system.L1Directory0" name="L1Directory0"> <param name="Directory_type" value="0"/> <!--0 cam based shadowed tag. 1 directory cache --> <param name="Dir_config" value="2048,1,0,1, 4, 4,8"/> <!-- the parameters are capacity,block_width, associativity,bank, throughput w.r.t. core clock, latency w.r.t. core clock,--> <param name="buffer_sizes" value="8, 8, 8, 8"/> <!-- all the buffer related are optional --> <param name="clockrate" value="3500"/> <param name="ports" value="1,1,1"/> <!-- number of r, w, and rw search ports --> <param name="device_type" value="0"/> <!-- altough there are multiple access types, Performance simulator needs to cast them into reads or writes e.g. the invalidates can be considered as writes --> <stat name="read_accesses" value="800000"/> <stat name="write_accesses" value="27276"/> <stat name="read_misses" value="1632"/> <stat name="write_misses" value="183"/> <stat name="conflicts" value="20"/> <stat name="duty_cycle" value="0.45"/> </component> <component id="system.L2Directory0" name="L2Directory0"> <param name="Directory_type" value="1"/> <!--0 cam based shadowed tag. 1 directory cache --> <param name="Dir_config" value="1048576,16,16,1,2, 100"/> <!-- the parameters are capacity,block_width, associativity,bank, throughput w.r.t. core clock, latency w.r.t. core clock,--> <param name="buffer_sizes" value="8, 8, 8, 8"/> <!-- all the buffer related are optional --> <param name="clockrate" value="3500"/> <param name="ports" value="1,1,1"/> <!-- number of r, w, and rw search ports --> <param name="device_type" value="0"/> <!-- altough there are multiple access types, Performance simulator needs to cast them into reads or writes e.g. the invalidates can be considered as writes --> <stat name="read_accesses" value="58824"/> <stat name="write_accesses" value="27276"/> <stat name="read_misses" value="1632"/> <stat name="write_misses" value="183"/> <stat name="conflicts" value="100"/> <stat name="duty_cycle" value="0.45"/> </component> <component id="system.L20" name="L20"> <!-- all the buffer related are optional --> <param name="L2_config" value="1048576,64,16,1, 4,23, 64, 1"/> <!-- consider 4-way bank interleaving for Niagara 1 --> <!-- the parameters are capacity,block_width, associativity, bank, throughput w.r.t. core clock, latency w.r.t. core clock,output_width, cache policy --> <param name="buffer_sizes" value="16, 16, 16, 16"/> <!-- cache controller buffer sizes: miss_buffer_size(MSHR),fill_buffer_size,prefetch_buffer_size,wb_buffer_size--> <param name="clockrate" value="3500"/> <param name="ports" value="1,1,1"/> <!-- number of r, w, and rw ports --> <param name="device_type" value="0"/> <stat name="read_accesses" value="200000"/> <stat name="write_accesses" value="0"/> <stat name="read_misses" value="0"/> <stat name="write_misses" value="0"/> <stat name="conflicts" value="0"/> <stat name="duty_cycle" value="0.5"/> </component> <!--**********************************************************************--> <component id="system.L30" name="L30"> <param name="L3_config" value="1048576,64,16,1, 2,100, 64,1"/> <!-- the parameters are capacity,block_width, associativity, bank, throughput w.r.t. core clock, latency w.r.t. core clock,output_width, cache policy --> <param name="clockrate" value="3500"/> <param name="ports" value="1,1,1"/> <!-- number of r, w, and rw ports --> <param name="device_type" value="0"/> <param name="buffer_sizes" value="16, 16, 16, 16"/> <!-- cache controller buffer sizes: miss_buffer_size(MSHR),fill_buffer_size,prefetch_buffer_size,wb_buffer_size--> <stat name="read_accesses" value="58824"/> <stat name="write_accesses" value="27276"/> <stat name="read_misses" value="1632"/> <stat name="write_misses" value="183"/> <stat name="conflicts" value="0"/> <stat name="duty_cycle" value="0.35"/> </component> <!--**********************************************************************--> <component id="system.NoC0" name="noc0"> <param name="clockrate" value="3500"/> <param name="type" value="1"/> <!-- 1 NoC, O bus --> <param name="horizontal_nodes" value="8"/> <param name="vertical_nodes" value="8"/> <param name="has_global_link" value="1"/> <!-- 1 has global link, 0 does not have global link --> <param name="link_throughput" value="1"/><!--w.r.t clock --> <param name="link_latency" value="1"/><!--w.r.t clock --> <!-- througput >= latency --> <!-- Router architecture --> <param name="input_ports" value="5"/> <param name="output_ports" value="5"/> <param name="virtual_channel_per_port" value="1"/> <!-- input buffer; in classic routers only input ports need buffers --> <param name="flit_bits" value="256"/> <param name="input_buffer_entries_per_vc" value="4"/><!--VCs within the same ports share input buffers whose size is propotional to the number of VCs--> <param name="chip_coverage" value="1"/> <!-- When multiple NOC present, one NOC will cover part of the whole chip. chip_coverage <=1 --> <stat name="total_accesses" value="360000"/> <!-- This is the number of total accesses within the whole network not for each router --> <stat name="duty_cycle" value="0.1"/> </component> <!--**********************************************************************--> <component id="system.mem" name="mem"> <!-- Main memory property --> <param name="mem_tech_node" value="32"/> <param name="device_clock" value="200"/><!--MHz, this is clock rate of the actual memory device, not the FSB --> <param name="peak_transfer_rate" value="3200"/><!--MB/S--> <param name="internal_prefetch_of_DRAM_chip" value="4"/> <!-- 2 for DDR, 4 for DDR2, 8 for DDR3...--> <!-- the device clock, peak_transfer_rate, and the internal prefetch decide the DIMM property --> <!-- above numbers can be easily found from Wikipedia --> <param name="capacity_per_channel" value="4096"/> <!-- MB --> <!-- capacity_per_Dram_chip=capacity_per_channel/number_of_dimms/number_ranks/Dram_chips_per_rank Current McPAT assumes single DIMMs are used.--> <param name="number_ranks" value="2"/> <param name="num_banks_of_DRAM_chip" value="8"/> <param name="Block_width_of_DRAM_chip" value="64"/> <!-- B --> <param name="output_width_of_DRAM_chip" value="8"/> <!--number of Dram_chips_per_rank=" 72/output_width_of_DRAM_chip--> <!--number of Dram_chips_per_rank=" 72/output_width_of_DRAM_chip--> <param name="page_size_of_DRAM_chip" value="8"/> <!-- 8 or 16 --> <param name="burstlength_of_DRAM_chip" value="8"/> <stat name="memory_accesses" value="1052"/> <stat name="memory_reads" value="1052"/> <stat name="memory_writes" value="1052"/> </component> <component id="system.mc" name="mc"> <!-- Memeory controllers are for DDR(2,3...) DIMMs --> <!-- current version of McPAT uses published values for base parameters of memory controller improvments on MC will be added in later versions. --> <param name="mc_clock" value="200"/><!--DIMM IO bus clock rate MHz DDR2-400 for Niagara 1--> <param name="peak_transfer_rate" value="3200"/><!--MB/S--> <param name="llc_line_length" value="64"/><!--B--> <param name="number_mcs" value="4"/> <!-- current McPAT only supports homogeneous memory controllers --> <param name="memory_channels_per_mc" value="1"/> <param name="number_ranks" value="2"/> <!-- # of ranks of each channel--> <param name="req_window_size_per_channel" value="32"/> <param name="IO_buffer_size_per_channel" value="32"/> <param name="databus_width" value="128"/> <param name="addressbus_width" value="51"/> <!-- McPAT will add the control bus width to the addressbus width automatically --> <stat name="memory_accesses" value="33333"/> <stat name="memory_reads" value="16667"/> <stat name="memory_writes" value="16667"/> <!-- McPAT does not track individual mc, instead, it takes the total accesses and calculate the average power per MC or per channel. This is sufficent for most application. Further trackdown can be easily added in later versions. --> </component> <!--**********************************************************************--> </component> </component>
{ "pile_set_name": "Github" }
log.level=${log.level} log.path=${log.path} dubbo.registry.address=${dubbo.registry.address} dubbo.protocal.port=${dubbo.protocal.port} dubbo.service.version=${dubbo.service.version} ws.connect.path=${ws.connect.path} ws.connect.port=${ws.connect.port} ws.connect.bus.port=${ws.connect.bus.port} service.name=ws_server service.version=1.0 service.bus.name=bus_ws_server service.bus.version=1.0 consul.host=${consul.host} consul.port=${consul.port}
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="it.tiwiz.rxjavacrunch.part9.Part9Activity"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Retain configuration instance (value)" /> <TextView android:id="@+id/currentValue" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:textAppearanceLarge" android:padding="@dimen/activity_vertical_margin" android:gravity="center" tools:text="10"/> </LinearLayout>
{ "pile_set_name": "Github" }
package example.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Customer1390 { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; private String firstName; private String lastName; protected Customer1390() {} public Customer1390(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } @Override public String toString() { return String.format("Customer1390[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName); } }
{ "pile_set_name": "Github" }
/** * 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.activiti.designer.validation.bpmn20.bundle; /** * Plugin constants for the org.activiti.designer.validation.bpmn20 bundle. * * @author Tiese Barrell * @version 1 * @since 5.6 * */ public final class PluginConstants { public static final String VALIDATOR_ID = "com.atosorigin.esuite.editor.process.validation.ESuiteProcessValidator"; public static final String VALIDATOR_NAME = "E-Suite Process Validator"; public static final String FORMAT_NAME = "E-Suite ZaakType jPDL"; public static final String MARKER_MESSAGE_PATTERN = "[%s] %s"; public static final int WORK_CLEAR_MARKERS = 5; public static final int WORK_EXTRACT_CONSTRUCTS = 20; public static final int WORK_USER_TASK = 10; public static final int WORK_SCRIPT_TASK = 10; public static final int WORK_SERVICE_TASK = 10; public static final int WORK_SEQUENCE_FLOW = 10; public static final int WORK_SUB_PROCESS = 10; public static final int WORK_TOTAL = WORK_CLEAR_MARKERS + WORK_EXTRACT_CONSTRUCTS + WORK_USER_TASK + WORK_SCRIPT_TASK + WORK_SERVICE_TASK + WORK_SEQUENCE_FLOW + WORK_SUB_PROCESS; }
{ "pile_set_name": "Github" }
package io.quarkus.it.panache; import java.io.Serializable; import java.util.Objects; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; @Entity @IdClass(ObjectWithCompositeId.ObjectKey.class) public class ObjectWithCompositeId extends PanacheEntityBase { @Id public String part1; @Id public String part2; public String description; static class ObjectKey implements Serializable { private String part1; private String part2; public ObjectKey() { } public ObjectKey(String part1, String part2) { this.part1 = part1; this.part2 = part2; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ObjectKey objectKey = (ObjectKey) o; return part1.equals(objectKey.part1) && part2.equals(objectKey.part2); } @Override public int hashCode() { return Objects.hash(part1, part2); } } }
{ "pile_set_name": "Github" }
/** * Copyright (c) Rich Hickey. All rights reserved. * The use and distribution terms for this software are covered by the * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) * which can be found in the file epl-v10.html at the root of this distribution. * By using this software in any fashion, you are agreeing to be bound by * the terms of this license. * You must not remove this notice, or any other, from this software. **/ using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Clojure")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Clojure")] [assembly: AssemblyCopyright("Copyright © 2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("92a6be2b-759d-4d62-8912-9dde0052bc33")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.3")] [assembly: System.Resources.NeutralResourcesLanguage("en-US")]
{ "pile_set_name": "Github" }
/* * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.tools.jconsole; import java.awt.*; import java.awt.event.*; import java.io.*; import java.lang.management.*; import java.lang.reflect.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; import java.util.*; import java.util.concurrent.*; import java.util.List; import static sun.tools.jconsole.Utilities.*; @SuppressWarnings("serial") class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSelectionListener { PlotterPanel threadMeter; TimeComboBox timeComboBox; JTabbedPane threadListTabbedPane; DefaultListModel<Long> listModel; JTextField filterTF; JLabel messageLabel; JSplitPane threadsSplitPane; HashMap<Long, String> nameCache = new HashMap<Long, String>(); private ThreadOverviewPanel overviewPanel; private boolean plotterListening = false; private static final String threadCountKey = "threadCount"; private static final String peakKey = "peak"; private static final Color threadCountColor = Plotter.defaultColor; private static final Color peakColor = Color.red; private static final Border thinEmptyBorder = new EmptyBorder(2, 2, 2, 2); /* Hierarchy of panels and layouts for this tab: ThreadTab (BorderLayout) North: topPanel (BorderLayout) Center: controlPanel (FlowLayout) timeComboBox Center: plotterPanel (BorderLayout) Center: plotter */ public static String getTabName() { return Messages.THREADS; } public ThreadTab(VMPanel vmPanel) { super(vmPanel, getTabName()); setLayout(new BorderLayout(0, 0)); setBorder(new EmptyBorder(4, 4, 3, 4)); JPanel topPanel = new JPanel(new BorderLayout()); JPanel plotterPanel = new JPanel(new VariableGridLayout(0, 1, 4, 4, true, true)); add(topPanel, BorderLayout.NORTH); add(plotterPanel, BorderLayout.CENTER); JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5)); topPanel.add(controlPanel, BorderLayout.CENTER); threadMeter = new PlotterPanel(Messages.NUMBER_OF_THREADS, Plotter.Unit.NONE, true); threadMeter.plotter.createSequence(threadCountKey, Messages.LIVE_THREADS, threadCountColor, true); threadMeter.plotter.createSequence(peakKey, Messages.PEAK, peakColor, true); setAccessibleName(threadMeter.plotter, Messages.THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME); plotterPanel.add(threadMeter); timeComboBox = new TimeComboBox(threadMeter.plotter); controlPanel.add(new LabeledComponent(Messages.TIME_RANGE_COLON, Resources.getMnemonicInt(Messages.TIME_RANGE_COLON), timeComboBox)); listModel = new DefaultListModel<Long>(); JTextArea textArea = new JTextArea(); textArea.setBorder(thinEmptyBorder); textArea.setEditable(false); setAccessibleName(textArea, Messages.THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME); ThreadJList list = new ThreadJList(listModel, textArea); Dimension di = new Dimension(super.getPreferredSize()); di.width = Math.min(di.width, 200); JScrollPane threadlistSP = new JScrollPane(list); threadlistSP.setPreferredSize(di); threadlistSP.setBorder(null); JScrollPane textAreaSP = new JScrollPane(textArea); textAreaSP.setBorder(null); threadListTabbedPane = new JTabbedPane(JTabbedPane.TOP); threadsSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, threadlistSP, textAreaSP); threadsSplitPane.setOneTouchExpandable(true); threadsSplitPane.setBorder(null); JPanel firstTabPanel = new JPanel(new BorderLayout()); firstTabPanel.setOpaque(false); JPanel firstTabToolPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 2)); firstTabToolPanel.setOpaque(false); filterTF = new PromptingTextField("Filter", 20); filterTF.getDocument().addDocumentListener(this); firstTabToolPanel.add(filterTF); JSeparator separator = new JSeparator(JSeparator.VERTICAL); separator.setPreferredSize(new Dimension(separator.getPreferredSize().width, filterTF.getPreferredSize().height)); firstTabToolPanel.add(separator); JButton detectDeadlockButton = new JButton(Messages.DETECT_DEADLOCK); detectDeadlockButton.setMnemonic(Resources.getMnemonicInt(Messages.DETECT_DEADLOCK)); detectDeadlockButton.setActionCommand("detectDeadlock"); detectDeadlockButton.addActionListener(this); detectDeadlockButton.setToolTipText(Messages.DETECT_DEADLOCK_TOOLTIP); firstTabToolPanel.add(detectDeadlockButton); messageLabel = new JLabel(); firstTabToolPanel.add(messageLabel); firstTabPanel.add(threadsSplitPane, BorderLayout.CENTER); firstTabPanel.add(firstTabToolPanel, BorderLayout.SOUTH); threadListTabbedPane.addTab(Messages.THREADS, firstTabPanel); plotterPanel.add(threadListTabbedPane); } private long oldThreads[] = new long[0]; public SwingWorker<?, ?> newSwingWorker() { final ProxyClient proxyClient = vmPanel.getProxyClient(); if (!plotterListening) { proxyClient.addWeakPropertyChangeListener(threadMeter.plotter); plotterListening = true; } return new SwingWorker<Boolean, Object>() { private int tlCount; private int tpCount; private long ttCount; private long[] threads; private long timeStamp; public Boolean doInBackground() { try { ThreadMXBean threadMBean = proxyClient.getThreadMXBean(); tlCount = threadMBean.getThreadCount(); tpCount = threadMBean.getPeakThreadCount(); if (overviewPanel != null) { ttCount = threadMBean.getTotalStartedThreadCount(); } else { ttCount = 0L; } threads = threadMBean.getAllThreadIds(); for (long newThread : threads) { if (nameCache.get(newThread) == null) { ThreadInfo ti = threadMBean.getThreadInfo(newThread); if (ti != null) { String name = ti.getThreadName(); if (name != null) { nameCache.put(newThread, name); } } } } timeStamp = System.currentTimeMillis(); return true; } catch (IOException e) { return false; } catch (UndeclaredThrowableException e) { return false; } } protected void done() { try { if (!get()) { return; } } catch (InterruptedException ex) { return; } catch (ExecutionException ex) { if (JConsole.isDebug()) { ex.printStackTrace(); } return; } threadMeter.plotter.addValues(timeStamp, tlCount, tpCount); threadMeter.setValueLabel(tlCount+""); if (overviewPanel != null) { overviewPanel.updateThreadsInfo(tlCount, tpCount, ttCount, timeStamp); } String filter = filterTF.getText().toLowerCase(Locale.ENGLISH); boolean doFilter = (filter.length() > 0); ArrayList<Long> l = new ArrayList<Long>(); for (long t : threads) { l.add(t); } Iterator<Long> iterator = l.iterator(); while (iterator.hasNext()) { long newThread = iterator.next(); String name = nameCache.get(newThread); if (doFilter && name != null && name.toLowerCase(Locale.ENGLISH).indexOf(filter) < 0) { iterator.remove(); } } long[] newThreads = threads; if (l.size() < threads.length) { newThreads = new long[l.size()]; for (int i = 0; i < newThreads.length; i++) { newThreads[i] = l.get(i); } } for (long oldThread : oldThreads) { boolean found = false; for (long newThread : newThreads) { if (newThread == oldThread) { found = true; break; } } if (!found) { listModel.removeElement(oldThread); if (!doFilter) { nameCache.remove(oldThread); } } } // Threads are in reverse chronological order for (int i = newThreads.length - 1; i >= 0; i--) { long newThread = newThreads[i]; boolean found = false; for (long oldThread : oldThreads) { if (newThread == oldThread) { found = true; break; } } if (!found) { listModel.addElement(newThread); } } oldThreads = newThreads; } }; } long lastSelected = -1; public void valueChanged(ListSelectionEvent ev) { ThreadJList list = (ThreadJList)ev.getSource(); final JTextArea textArea = list.textArea; Long selected = list.getSelectedValue(); if (selected == null) { if (lastSelected != -1) { selected = lastSelected; } } else { lastSelected = selected; } textArea.setText(""); if (selected != null) { final long threadID = selected; workerAdd(new Runnable() { public void run() { ProxyClient proxyClient = vmPanel.getProxyClient(); StringBuilder sb = new StringBuilder(); try { ThreadMXBean threadMBean = proxyClient.getThreadMXBean(); ThreadInfo ti = null; MonitorInfo[] monitors = null; if (proxyClient.isLockUsageSupported() && threadMBean.isObjectMonitorUsageSupported()) { // VMs that support the monitor usage monitoring ThreadInfo[] infos = threadMBean.dumpAllThreads(true, false); for (ThreadInfo info : infos) { if (info.getThreadId() == threadID) { ti = info; monitors = info.getLockedMonitors(); break; } } } else { // VM doesn't support monitor usage monitoring ti = threadMBean.getThreadInfo(threadID, Integer.MAX_VALUE); } if (ti != null) { if (ti.getLockName() == null) { sb.append(Resources.format(Messages.NAME_STATE, ti.getThreadName(), ti.getThreadState().toString())); } else if (ti.getLockOwnerName() == null) { sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME, ti.getThreadName(), ti.getThreadState().toString(), ti.getLockName())); } else { sb.append(Resources.format(Messages.NAME_STATE_LOCK_NAME_LOCK_OWNER, ti.getThreadName(), ti.getThreadState().toString(), ti.getLockName(), ti.getLockOwnerName())); } sb.append(Resources.format(Messages.BLOCKED_COUNT_WAITED_COUNT, ti.getBlockedCount(), ti.getWaitedCount())); sb.append(Messages.STACK_TRACE); int index = 0; for (StackTraceElement e : ti.getStackTrace()) { sb.append(e).append('\n'); if (monitors != null) { for (MonitorInfo mi : monitors) { if (mi.getLockedStackDepth() == index) { sb.append(Resources.format(Messages.MONITOR_LOCKED, mi.toString())); } } } index++; } } } catch (IOException ex) { // Ignore } catch (UndeclaredThrowableException e) { proxyClient.markAsDead(); } final String text = sb.toString(); SwingUtilities.invokeLater(new Runnable() { public void run() { textArea.setText(text); textArea.setCaretPosition(0); } }); } }); } } private void doUpdate() { workerAdd(new Runnable() { public void run() { update(); } }); } private void detectDeadlock() { workerAdd(new Runnable() { public void run() { try { final Long[][] deadlockedThreads = getDeadlockedThreadIds(); if (deadlockedThreads == null || deadlockedThreads.length == 0) { // Display message for 30 seconds. Do it on a separate thread so // the sleep won't hold up the worker queue. // This will be replaced later by separate statusbar logic. new Thread() { public void run() { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { String msg = Messages.NO_DEADLOCK_DETECTED; messageLabel.setText(msg); threadListTabbedPane.revalidate(); } }); sleep(30 * 1000); } catch (InterruptedException ex) { // Ignore } catch (InvocationTargetException ex) { // Ignore } SwingUtilities.invokeLater(new Runnable() { public void run() { messageLabel.setText(""); } }); } }.start(); return; } SwingUtilities.invokeLater(new Runnable() { public void run() { // Remove old deadlock tabs while (threadListTabbedPane.getTabCount() > 1) { threadListTabbedPane.removeTabAt(1); } if (deadlockedThreads != null) { for (int i = 0; i < deadlockedThreads.length; i++) { DefaultListModel<Long> listModel = new DefaultListModel<Long>(); JTextArea textArea = new JTextArea(); textArea.setBorder(thinEmptyBorder); textArea.setEditable(false); setAccessibleName(textArea, Messages.THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME); ThreadJList list = new ThreadJList(listModel, textArea); JScrollPane threadlistSP = new JScrollPane(list); JScrollPane textAreaSP = new JScrollPane(textArea); threadlistSP.setBorder(null); textAreaSP.setBorder(null); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, threadlistSP, textAreaSP); splitPane.setOneTouchExpandable(true); splitPane.setBorder(null); splitPane.setDividerLocation(threadsSplitPane.getDividerLocation()); String tabName; if (deadlockedThreads.length > 1) { tabName = Resources.format(Messages.DEADLOCK_TAB_N, i+1); } else { tabName = Messages.DEADLOCK_TAB; } threadListTabbedPane.addTab(tabName, splitPane); for (long t : deadlockedThreads[i]) { listModel.addElement(t); } } threadListTabbedPane.setSelectedIndex(1); } } }); } catch (IOException e) { // Ignore } catch (UndeclaredThrowableException e) { vmPanel.getProxyClient().markAsDead(); } } }); } // Return deadlocked threads or null public Long[][] getDeadlockedThreadIds() throws IOException { ProxyClient proxyClient = vmPanel.getProxyClient(); ThreadMXBean threadMBean = proxyClient.getThreadMXBean(); long[] ids = proxyClient.findDeadlockedThreads(); if (ids == null) { return null; } ThreadInfo[] infos = threadMBean.getThreadInfo(ids, Integer.MAX_VALUE); List<Long[]> dcycles = new ArrayList<Long[]>(); List<Long> cycle = new ArrayList<Long>(); // keep track of which thread is visited // one thread can only be in one cycle boolean[] visited = new boolean[ids.length]; int deadlockedThread = -1; // Index into arrays while (true) { if (deadlockedThread < 0) { if (cycle.size() > 0) { // a cycle found dcycles.add(cycle.toArray(new Long[0])); cycle = new ArrayList<Long>(); } // start a new cycle from a non-visited thread for (int j = 0; j < ids.length; j++) { if (!visited[j]) { deadlockedThread = j; visited[j] = true; break; } } if (deadlockedThread < 0) { // done break; } } cycle.add(ids[deadlockedThread]); long nextThreadId = infos[deadlockedThread].getLockOwnerId(); for (int j = 0; j < ids.length; j++) { ThreadInfo ti = infos[j]; if (ti.getThreadId() == nextThreadId) { if (visited[j]) { deadlockedThread = -1; } else { deadlockedThread = j; visited[j] = true; } break; } } } return dcycles.toArray(new Long[0][0]); } // ActionListener interface public void actionPerformed(ActionEvent evt) { String cmd = ((AbstractButton)evt.getSource()).getActionCommand(); if (cmd == "detectDeadlock") { messageLabel.setText(""); detectDeadlock(); } } // DocumentListener interface public void insertUpdate(DocumentEvent e) { doUpdate(); } public void removeUpdate(DocumentEvent e) { doUpdate(); } public void changedUpdate(DocumentEvent e) { doUpdate(); } private class ThreadJList extends JList<Long> { private JTextArea textArea; ThreadJList(DefaultListModel<Long> listModel, JTextArea textArea) { super(listModel); this.textArea = textArea; setBorder(thinEmptyBorder); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); textArea.setText(Messages.THREAD_TAB_INITIAL_STACK_TRACE_MESSAGE); addListSelectionListener(ThreadTab.this); setCellRenderer(new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value != null) { String name = nameCache.get(value); if (name == null) { name = value.toString(); } setText(name); } return this; } }); } public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width = Math.max(d.width, 100); return d; } } private class PromptingTextField extends JTextField implements FocusListener { private String prompt; boolean promptRemoved = false; Color fg; public PromptingTextField(String prompt, int columns) { super(prompt, columns); this.prompt = prompt; updateForeground(); addFocusListener(this); setAccessibleName(this, prompt); } @Override public void revalidate() { super.revalidate(); updateForeground(); } private void updateForeground() { this.fg = UIManager.getColor("TextField.foreground"); if (promptRemoved) { setForeground(fg); } else { setForeground(Color.gray); } } public String getText() { if (!promptRemoved) { return ""; } else { return super.getText(); } } public void focusGained(FocusEvent e) { if (!promptRemoved) { setText(""); setForeground(fg); promptRemoved = true; } } public void focusLost(FocusEvent e) { if (promptRemoved && getText().isEmpty()) { setText(prompt); setForeground(Color.gray); promptRemoved = false; } } } OverviewPanel[] getOverviewPanels() { if (overviewPanel == null) { overviewPanel = new ThreadOverviewPanel(); } return new OverviewPanel[] { overviewPanel }; } private static class ThreadOverviewPanel extends OverviewPanel { ThreadOverviewPanel() { super(Messages.THREADS, threadCountKey, Messages.LIVE_THREADS, null); } private void updateThreadsInfo(long tlCount, long tpCount, long ttCount, long timeStamp) { getPlotter().addValues(timeStamp, tlCount); getInfoLabel().setText(Resources.format(Messages.THREAD_TAB_INFO_LABEL_FORMAT, tlCount, tpCount, ttCount)); } } }
{ "pile_set_name": "Github" }
File.open(${1:path_to_yml}, "w") { |${2:file}| YAML.dump(${3:obj}, ${4:$2}) }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2014 Saravan Pantham * * 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.psaravan.filebrowserview.lib.AsyncTasks; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.AsyncTask; import android.widget.Toast; import com.psaravan.filebrowserview.lib.Interfaces.MoveInterface; import com.psaravan.filebrowserview.lib.R; import org.apache.commons.io.FileUtils; import java.io.File; /** * AsyncTask that moves the specified file/folder recursively to a new location. * * @author Saravan Pantham */ public class AsyncMoveTask extends AsyncTask<String, Void, Boolean> { private Context mContext; private ProgressDialog pd; private File mSourceFile; private File mDestDirFile; private boolean mShowProgress = true; private MoveInterface mMoveInterface; public AsyncMoveTask(Context context, File source, File destDir, boolean showProgress) { mContext = context; mSourceFile = source; mShowProgress = showProgress; mDestDirFile = destDir; } @Override protected void onPreExecute() { if (mSourceFile==null) return; //Skip the rest of this method if the user doesn't want a progress dialog. if (!mShowProgress) return; pd = new ProgressDialog(mContext); pd.setCancelable(false); pd.setIndeterminate(false); pd.setTitle(R.string.move); pd.setMessage(mContext.getResources().getString(R.string.moving) + " " + mSourceFile.getName()); pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources() .getString(R.string.run_in_background), new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { pd.dismiss(); } }); pd.show(); if (mMoveInterface!=null) mMoveInterface.preMoveStartSync(); } @Override protected Boolean doInBackground(String... params) { if (mMoveInterface!=null) mMoveInterface.preMoveStartAsync(); if (mSourceFile==null || mDestDirFile==null) { if (mMoveInterface!=null) mMoveInterface.onMoveCompleteAsync(false); return false; } if (mSourceFile.isDirectory()) { try { FileUtils.moveDirectory(mSourceFile, mDestDirFile); } catch (Exception e) { if (mMoveInterface!=null) mMoveInterface.onMoveCompleteAsync(false); return false; } } else { try { FileUtils.moveFile(mSourceFile, mDestDirFile); } catch (Exception e) { if (mMoveInterface!=null) mMoveInterface.onMoveCompleteAsync(false); return false; } } if (mMoveInterface!=null) mMoveInterface.onMoveCompleteAsync(true); return true; } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); if (mMoveInterface!=null) mMoveInterface.onMoveCompleteSync(result); if (pd!=null) pd.dismiss(); if (result==true) { String message = mSourceFile.getName() + " " + mContext.getResources().getString(R.string.moved); Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); } else { String message = mSourceFile.getName() + " " + mContext.getResources().getString(R.string.could_not_be_moved); Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); } } /** * @param moveInterface The move interface instance to attach to this * AsyncTask. */ public void setMoveInterface(MoveInterface moveInterface) { mMoveInterface = moveInterface; } }
{ "pile_set_name": "Github" }
/* This repository is no longer actively maintained. To find all solutions to this problem (and practice coding more problems) at: ~~~~~~~~~~~~~~~~~~~~~~~~~ https://backtobackswe.com ~~~~~~~~~~~~~~~~~~~~~~~~~ */ public class Solution { public static void main(String args[]) { /* Here you are given the adjacency list, but even if you were given the raw edges and vertices (remember: G = (V, E)), you'd still be able to build the adjacency list in O(|E|) time. Just loop over the edges and build what you see below. */ Map<Integer, List<Integer>> originalNodeToAdjacents = new HashMap<>(); originalNodeToAdjacents.put(0, Arrays.asList(1)); originalNodeToAdjacents.put(1, Arrays.asList(2)); originalNodeToAdjacents.put(2, Arrays.asList(3, 4)); originalNodeToAdjacents.put(3, Arrays.asList(0)); originalNodeToAdjacents.put(4, Arrays.asList(2)); /* The graph above: 0 ---> 1 ---> 2 <---> 4 ^ / \ / \ / \ ⌄ 3 */ /* If we reverse each edge: 0 <--- 1 <--- 2 <---> 4 \ ^ \ / \ / ⌄ / 3 */ System.out.println(isStronglyConnected(originalNodeToAdjacents)); } private static boolean isStronglyConnected(Map<Integer, List<Integer>> originalNodeToAdjacents) { boolean allNodesReached = allNodesReachedViaBFS(originalNodeToAdjacents); if (!allNodesReached) { return false; } Map<Integer, List<Integer>> reversedNodeToAdjacents = reverseGraph(originalNodeToAdjacents); boolean allNodesReachedWithReverseGraph = allNodesReachedViaBFS(reversedNodeToAdjacents); return allNodesReachedWithReverseGraph; } private static boolean allNodesReachedViaBFS(Map<Integer, List<Integer>> originalNodeToAdjacents) { Set<Integer> visited = new HashSet<>(); Queue<Integer> queue = new LinkedList<>(); queue.add(0); visited.add(0); while (!queue.isEmpty()) { int node = queue.poll(); List<Integer> adjacents = originalNodeToAdjacents.get(node); if (adjacents != null) { for (int adjacent: adjacents) { if (!visited.contains(adjacent)) { visited.add(adjacent); queue.add(adjacent); } } } } return visited.size() == originalNodeToAdjacents.size(); } private static Map<Integer, List<Integer>> reverseGraph(Map<Integer, List<Integer>> originalNodeToAdjacents) { Map<Integer, List<Integer>> reversedNodeToAdjacents = new HashMap<>(); for (Map.Entry<Integer, List<Integer>> entry: originalNodeToAdjacents.entrySet()) { int nodeValue = entry.getKey(); List<Integer> adjacents = entry.getValue(); // Reverse each edge for (int adjacent: adjacents) { List<Integer> reversedAdjacents; if (!reversedNodeToAdjacents.containsKey(adjacent)) { reversedAdjacents = new ArrayList<>(); } else { reversedAdjacents = reversedNodeToAdjacents.get(adjacent); } // Reverse edge, before node went to adjacent, now adjacent maps to the node reversedAdjacents.add(nodeValue); reversedNodeToAdjacents.put(adjacent, reversedAdjacents); } } return reversedNodeToAdjacents; } }
{ "pile_set_name": "Github" }
/* * 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. */ drop dataverse test if exists; create dataverse test; use test; create type test.MyRecord as { id : bigint, point : point, kwds : string }; create external dataset MyData(MyRecord) using localfs((`path`=`asterix_nc1://data/spatial/spatialData.json`),(`format`=`adm`));
{ "pile_set_name": "Github" }
<!-- ~ Copyright 2019. Google LLC ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ https://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/bg_blue" android:orientation="vertical" android:padding="20dp" tools:context="com.google.android.apps.santatracker.dasherdancer.CharacterActivity" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" > <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" /> <ImageButton android:id="@+id/btn_character_santa" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:adjustViewBounds="true" android:background="@drawable/dasher_ripple" android:onClick="onCharacterClick" android:scaleType="fitCenter" android:layout_gravity="bottom" android:src="@drawable/santa" /> <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" > <ImageButton android:id="@+id/btn_character_elf" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:adjustViewBounds="true" android:background="@drawable/dasher_ripple" android:onClick="onCharacterClick" android:scaleType="fitCenter" android:layout_gravity="center" android:src="@drawable/elf" /> <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" /> <ImageButton android:id="@+id/btn_character_reindeer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:adjustViewBounds="true" android:background="@drawable/dasher_ripple" android:onClick="onCharacterClick" android:scaleType="fitCenter" android:layout_gravity="center" android:src="@drawable/reindeer" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:orientation="horizontal" > <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" /> <ImageButton android:id="@+id/btn_character_snowman" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:adjustViewBounds="true" android:background="@drawable/dasher_ripple" android:onClick="onCharacterClick" android:scaleType="fitCenter" android:layout_gravity="top" android:src="@drawable/snowman" /> <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:visibility="invisible" /> </LinearLayout> </LinearLayout>
{ "pile_set_name": "Github" }
package net.sgoliver.android.controlpers2; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; public class ControlLogin extends LinearLayout { private EditText txtUsuario; private EditText txtPassword; private Button btnLogin; private TextView lblMensaje; private OnLoginListener listener; public ControlLogin(Context context) { super(context); inicializar(); } public ControlLogin(Context context, AttributeSet attrs) { super(context, attrs); inicializar(); // Procesamos los atributos XML personalizados TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ControlLogin); String textoBoton = a.getString( R.styleable.ControlLogin_login_text); btnLogin.setText(textoBoton); a.recycle(); } private void inicializar() { //Utilizamos el layout 'control_login' como interfaz del control String infService = Context.LAYOUT_INFLATER_SERVICE; LayoutInflater li = (LayoutInflater)getContext().getSystemService(infService); li.inflate(R.layout.control_login, this, true); //Obtenemoslas referencias a los distintos control txtUsuario = (EditText)findViewById(R.id.TxtUsuario); txtPassword = (EditText)findViewById(R.id.TxtPassword); btnLogin = (Button)findViewById(R.id.BtnAceptar); lblMensaje = (TextView)findViewById(R.id.LblMensaje); //Asociamos los eventos necesarios asignarEventos(); } public void setOnLoginListener(OnLoginListener l) { listener = l; } private void asignarEventos() { btnLogin.setOnClickListener(new OnClickListener() { public void onClick(View v) { listener.onLogin(txtUsuario.getText().toString(), txtPassword.getText().toString()); } }); } public void setMensaje(String msg) { lblMensaje.setText(msg); } }
{ "pile_set_name": "Github" }
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TupleSections #-} -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html module Stratosphere.ResourceProperties.DLMLifecyclePolicySchedule where import Stratosphere.ResourceImports import Stratosphere.ResourceProperties.DLMLifecyclePolicyCreateRule import Stratosphere.ResourceProperties.DLMLifecyclePolicyCrossRegionCopyRule import Stratosphere.ResourceProperties.DLMLifecyclePolicyFastRestoreRule import Stratosphere.ResourceProperties.DLMLifecyclePolicyRetainRule import Stratosphere.ResourceProperties.Tag -- | Full data type definition for DLMLifecyclePolicySchedule. See -- 'dlmLifecyclePolicySchedule' for a more convenient constructor. data DLMLifecyclePolicySchedule = DLMLifecyclePolicySchedule { _dLMLifecyclePolicyScheduleCopyTags :: Maybe (Val Bool) , _dLMLifecyclePolicyScheduleCreateRule :: Maybe DLMLifecyclePolicyCreateRule , _dLMLifecyclePolicyScheduleCrossRegionCopyRules :: Maybe [DLMLifecyclePolicyCrossRegionCopyRule] , _dLMLifecyclePolicyScheduleFastRestoreRule :: Maybe DLMLifecyclePolicyFastRestoreRule , _dLMLifecyclePolicyScheduleName :: Maybe (Val Text) , _dLMLifecyclePolicyScheduleRetainRule :: Maybe DLMLifecyclePolicyRetainRule , _dLMLifecyclePolicyScheduleTagsToAdd :: Maybe [Tag] , _dLMLifecyclePolicyScheduleVariableTags :: Maybe [Tag] } deriving (Show, Eq) instance ToJSON DLMLifecyclePolicySchedule where toJSON DLMLifecyclePolicySchedule{..} = object $ catMaybes [ fmap (("CopyTags",) . toJSON) _dLMLifecyclePolicyScheduleCopyTags , fmap (("CreateRule",) . toJSON) _dLMLifecyclePolicyScheduleCreateRule , fmap (("CrossRegionCopyRules",) . toJSON) _dLMLifecyclePolicyScheduleCrossRegionCopyRules , fmap (("FastRestoreRule",) . toJSON) _dLMLifecyclePolicyScheduleFastRestoreRule , fmap (("Name",) . toJSON) _dLMLifecyclePolicyScheduleName , fmap (("RetainRule",) . toJSON) _dLMLifecyclePolicyScheduleRetainRule , fmap (("TagsToAdd",) . toJSON) _dLMLifecyclePolicyScheduleTagsToAdd , fmap (("VariableTags",) . toJSON) _dLMLifecyclePolicyScheduleVariableTags ] -- | Constructor for 'DLMLifecyclePolicySchedule' containing required fields -- as arguments. dlmLifecyclePolicySchedule :: DLMLifecyclePolicySchedule dlmLifecyclePolicySchedule = DLMLifecyclePolicySchedule { _dLMLifecyclePolicyScheduleCopyTags = Nothing , _dLMLifecyclePolicyScheduleCreateRule = Nothing , _dLMLifecyclePolicyScheduleCrossRegionCopyRules = Nothing , _dLMLifecyclePolicyScheduleFastRestoreRule = Nothing , _dLMLifecyclePolicyScheduleName = Nothing , _dLMLifecyclePolicyScheduleRetainRule = Nothing , _dLMLifecyclePolicyScheduleTagsToAdd = Nothing , _dLMLifecyclePolicyScheduleVariableTags = Nothing } -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-copytags dlmlpsCopyTags :: Lens' DLMLifecyclePolicySchedule (Maybe (Val Bool)) dlmlpsCopyTags = lens _dLMLifecyclePolicyScheduleCopyTags (\s a -> s { _dLMLifecyclePolicyScheduleCopyTags = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-createrule dlmlpsCreateRule :: Lens' DLMLifecyclePolicySchedule (Maybe DLMLifecyclePolicyCreateRule) dlmlpsCreateRule = lens _dLMLifecyclePolicyScheduleCreateRule (\s a -> s { _dLMLifecyclePolicyScheduleCreateRule = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-crossregioncopyrules dlmlpsCrossRegionCopyRules :: Lens' DLMLifecyclePolicySchedule (Maybe [DLMLifecyclePolicyCrossRegionCopyRule]) dlmlpsCrossRegionCopyRules = lens _dLMLifecyclePolicyScheduleCrossRegionCopyRules (\s a -> s { _dLMLifecyclePolicyScheduleCrossRegionCopyRules = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-fastrestorerule dlmlpsFastRestoreRule :: Lens' DLMLifecyclePolicySchedule (Maybe DLMLifecyclePolicyFastRestoreRule) dlmlpsFastRestoreRule = lens _dLMLifecyclePolicyScheduleFastRestoreRule (\s a -> s { _dLMLifecyclePolicyScheduleFastRestoreRule = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-name dlmlpsName :: Lens' DLMLifecyclePolicySchedule (Maybe (Val Text)) dlmlpsName = lens _dLMLifecyclePolicyScheduleName (\s a -> s { _dLMLifecyclePolicyScheduleName = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-retainrule dlmlpsRetainRule :: Lens' DLMLifecyclePolicySchedule (Maybe DLMLifecyclePolicyRetainRule) dlmlpsRetainRule = lens _dLMLifecyclePolicyScheduleRetainRule (\s a -> s { _dLMLifecyclePolicyScheduleRetainRule = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-tagstoadd dlmlpsTagsToAdd :: Lens' DLMLifecyclePolicySchedule (Maybe [Tag]) dlmlpsTagsToAdd = lens _dLMLifecyclePolicyScheduleTagsToAdd (\s a -> s { _dLMLifecyclePolicyScheduleTagsToAdd = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-variabletags dlmlpsVariableTags :: Lens' DLMLifecyclePolicySchedule (Maybe [Tag]) dlmlpsVariableTags = lens _dLMLifecyclePolicyScheduleVariableTags (\s a -> s { _dLMLifecyclePolicyScheduleVariableTags = a })
{ "pile_set_name": "Github" }
# GENERATED VERSION FILE # TIME: Sun May 24 21:24:18 2020 __version__ = '1.0.rc0' short_version = '1.0.rc0'
{ "pile_set_name": "Github" }
<!DOCTYPE HTML> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc --> <title>JTabbedPane.ModelListener (Java SE 12 &amp; JDK 12 )</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="keywords" content="javax.swing.JTabbedPane.ModelListener class"> <meta name="keywords" content="stateChanged()"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> <script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script> <script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> <!--[if IE]> <script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> <![endif]--> <script type="text/javascript" src="../../../jquery/jquery-3.3.1.js"></script> <script type="text/javascript" src="../../../jquery/jquery-migrate-3.0.1.js"></script> <script type="text/javascript" src="../../../jquery/jquery-ui.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="JTabbedPane.ModelListener (Java SE 12 & JDK 12 )"; } } catch(err) { } //--> var pathtoroot = "../../../"; var useModuleDirectories = true; loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <header role="banner"> <nav role="navigation"> <div class="fixedNav"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a id="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../index.html">Overview</a></li> <li><a href="../../module-summary.html">Module</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/JTabbedPane.ModelListener.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><div style="margin-top: 14px;"><strong>Java SE 12 &amp; JDK 12</strong> </div></div> </div> <div class="subNav"> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> <ul class="navListSearch"> <li><label for="search">SEARCH:</label> <input type="text" id="search" value="search" disabled="disabled"> <input type="reset" id="reset" value="reset" disabled="disabled"> </li> </ul> </div> <a id="skip.navbar.top"> <!-- --> </a> <!-- ========= END OF TOP NAVBAR ========= --> </div> <div class="navPadding">&nbsp;</div> <script type="text/javascript"><!-- $('.navPadding').css('padding-top', $('.fixedNav').css("height")); //--> </script> </nav> </header> <!-- ======== START OF CLASS DATA ======== --> <main role="main"> <div class="header"> <div class="subTitle"><span class="moduleLabelInType">Module</span>&nbsp;<a href="../../module-summary.html">java.desktop</a></div> <div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">javax.swing</a></div> <h2 title="Class JTabbedPane.ModelListener" class="title">Class JTabbedPane.ModelListener</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li><a href="../../../java.base/java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li> <li> <ul class="inheritance"> <li>javax.swing.JTabbedPane.ModelListener</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd><code><a href="../../../java.base/java/io/Serializable.html" title="interface in java.io">Serializable</a></code>, <code><a href="../../../java.base/java/util/EventListener.html" title="interface in java.util">EventListener</a></code>, <code><a href="event/ChangeListener.html" title="interface in javax.swing.event">ChangeListener</a></code></dd> </dl> <dl> <dt>Enclosing class:</dt> <dd><a href="JTabbedPane.html" title="class in javax.swing">JTabbedPane</a></dd> </dl> <hr> <pre>protected class <span class="typeNameLabel">JTabbedPane.ModelListener</span> extends <a href="../../../java.base/java/lang/Object.html" title="class in java.lang">Object</a> implements <a href="event/ChangeListener.html" title="interface in javax.swing.event">ChangeListener</a>, <a href="../../../java.base/java/io/Serializable.html" title="interface in java.io">Serializable</a></pre> <div class="block">We pass <code>ModelChanged</code> events along to the listeners with the tabbedpane (instead of the model itself) as the event source.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <section role="region"> <ul class="blockList"> <li class="blockList"><a id="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <div class="memberSummary"> <table> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier</th> <th class="colSecond" scope="col">Constructor</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected </code></td> <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">ModelListener</a></span>()</code></th> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </div> </li> </ul> </section> <!-- ========== METHOD SUMMARY =========== --> <section role="region"> <ul class="blockList"> <li class="blockList"><a id="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <ul class="blockList"> <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods declared in class&nbsp;java.lang.<a href="../../../java.base/java/lang/Object.html" title="class in java.lang">Object</a></h3> <code><a href="../../../java.base/java/lang/Object.html#clone()">clone</a>, <a href="../../../java.base/java/lang/Object.html#equals(java.lang.Object)">equals</a>, <a href="../../../java.base/java/lang/Object.html#finalize()">finalize</a>, <a href="../../../java.base/java/lang/Object.html#getClass()">getClass</a>, <a href="../../../java.base/java/lang/Object.html#hashCode()">hashCode</a>, <a href="../../../java.base/java/lang/Object.html#notify()">notify</a>, <a href="../../../java.base/java/lang/Object.html#notifyAll()">notifyAll</a>, <a href="../../../java.base/java/lang/Object.html#toString()">toString</a>, <a href="../../../java.base/java/lang/Object.html#wait()">wait</a>, <a href="../../../java.base/java/lang/Object.html#wait(long)">wait</a>, <a href="../../../java.base/java/lang/Object.html#wait(long,int)">wait</a></code></li> </ul> <ul class="blockList"> <li class="blockList"><a id="methods.inherited.from.class.javax.swing.event.ChangeListener"> <!-- --> </a> <h3>Methods declared in interface&nbsp;javax.swing.event.<a href="event/ChangeListener.html" title="interface in javax.swing.event">ChangeListener</a></h3> <code><a href="event/ChangeListener.html#stateChanged(javax.swing.event.ChangeEvent)">stateChanged</a></code></li> </ul> </li> </ul> </section> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <section role="region"> <ul class="blockList"> <li class="blockList"><a id="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a id="&lt;init&gt;()"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>ModelListener</h4> <pre>protected&nbsp;ModelListener()</pre> </li> </ul> </li> </ul> </section> </li> </ul> </div> </div> </main> <!-- ========= END OF CLASS DATA ========= --> <footer role="contentinfo"> <nav role="navigation"> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a id="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../index.html">Overview</a></li> <li><a href="../../module-summary.html">Module</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/JTabbedPane.ModelListener.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-files/index-1.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><div style="margin-top: 14px;"><strong>Java SE 12 &amp; JDK 12</strong> </div></div> </div> <div class="subNav"> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> </div> <a id="skip.navbar.bottom"> <!-- --> </a> <!-- ======== END OF BOTTOM NAVBAR ======= --> </nav> <p class="legalCopy"><small><a href="https://bugreport.java.com/bugreport/">Report a bug or suggest an enhancement</a><br> For further API reference and developer documentation see the <a href="https://docs.oracle.com/pls/topic/lookup?ctx=javase12.0.2&amp;id=homepage" target="_blank">Java SE Documentation</a>, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.<br> <a href="../../../../legal/copyright.html">Copyright</a> &copy; 1993, 2019, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.<br>All rights reserved. Use is subject to <a href="https://www.oracle.com/technetwork/java/javase/terms/license/java12.0.2speclicense.html">license terms</a> and the <a href="https://www.oracle.com/technetwork/java/redist-137594.html">documentation redistribution policy</a>. <!-- Version 12.0.2+10 --></small></p> </footer> </body> </html>
{ "pile_set_name": "Github" }
package plugins.core.combat; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import akka.actor.ActorRef; import akka.actor.ActorSelection; import akka.actor.Props; import akka.actor.UntypedActor; import io.gamemachine.chat.ChatSubscriptions; import io.gamemachine.core.ActorUtil; import io.gamemachine.core.GameEntityManager; import io.gamemachine.core.GameEntityManagerService; import io.gamemachine.core.GameMachineLoader; import io.gamemachine.core.PlayerMessage; import io.gamemachine.grid.Grid; import io.gamemachine.grid.GridService; import io.gamemachine.messages.CombatLog; import io.gamemachine.messages.GameMessage; import io.gamemachine.messages.PlayerSkill; import io.gamemachine.messages.RegionInfo; import io.gamemachine.messages.StatusEffect; import io.gamemachine.messages.StatusEffectTarget; import io.gamemachine.messages.TrackData; import io.gamemachine.messages.Zone; import io.gamemachine.regions.ZoneService; public class StatusEffectManager extends UntypedActor { private static final Logger logger = LoggerFactory.getLogger(StatusEffectManager.class); public static String name = StatusEffectManager.class.getSimpleName(); public static boolean combatLogEnabled = true; public static List<GridSet> gridsets = new ArrayList<GridSet>(); public static Set<String> handlerZones = new HashSet<String>(); public static void tell(String gridName, String zone, StatusEffectTarget statusEffectTarget, ActorRef sender) { String actorName = null; if (!hasEffects(statusEffectTarget)) { logger.warn("No effects found for skill " + statusEffectTarget.skillRequest.playerSkill.id); return; } if (activeEffectCount(statusEffectTarget) > 0) { actorName = ActiveEffectHandler.actorName(gridName, zone); ActorSelection sel = ActorUtil.getSelectionByName(actorName); sel.tell(statusEffectTarget.clone(), sender); } if (passiveEffectCount(statusEffectTarget) > 0) { actorName = PassiveEffectHandler.actorName(gridName, zone); ActorSelection sel = ActorUtil.getSelectionByName(actorName); sel.tell(statusEffectTarget.clone(), sender); } } private static boolean hasEffects(StatusEffectTarget statusEffectTarget) { if (StatusEffectData.skillEffects.containsKey(statusEffectTarget.skillRequest.playerSkill.id)) { return true; } else { return false; } } private static int passiveEffectCount(StatusEffectTarget statusEffectTarget) { int count = 0; for (StatusEffect statusEffect : StatusEffectData.skillEffects.get(statusEffectTarget.skillRequest.playerSkill.id)) { if (statusEffect.type == StatusEffect.Type.AttributeMaxDecrease || statusEffect.type == StatusEffect.Type.AttributeMaxIncrease) { count++; } } return count; } private static int activeEffectCount(StatusEffectTarget statusEffectTarget) { int count = 0; for (StatusEffect statusEffect : StatusEffectData.skillEffects.get(statusEffectTarget.skillRequest.playerSkill.id)) { if (statusEffect.type == StatusEffect.Type.AttributeDecrease || statusEffect.type == StatusEffect.Type.AttributeIncrease) { count++; } } return count; } public static int getEffectValue(StatusEffect statusEffect, PlayerSkill playerSkill, String characterId) { GameEntityManager gameEntityManager = GameEntityManagerService.instance().getGameEntityManager(); return gameEntityManager.getEffectValue(statusEffect, playerSkill.id, characterId); } public static boolean inGroup(String playerId) { String playerGroup = ChatSubscriptions.playerGroup(playerId); if (playerGroup.equals("nogroup")) { return false; } else { return true; } } public static void skillUsed(PlayerSkill playerSkill, String characterId) { GameEntityManager gameEntityManager = GameEntityManagerService.instance().getGameEntityManager(); gameEntityManager.skillUsed(playerSkill.id, characterId); } public static String playerGroup(String playerId) { return ChatSubscriptions.playerGroup(playerId); } public static boolean inSameGroup(String playerId, String otherId) { if (!inGroup(playerId)) { return false; } String otherGroup = ChatSubscriptions.playerGroup(otherId); if (playerGroup(playerId).equals(otherGroup)) { return true; } else { return false; } } public static boolean DeductCost(VitalsProxy vitalsProxy, StatusEffect statusEffect) { if (statusEffect.resourceCost == 0) { return true; } if (statusEffect.resource == StatusEffect.Resource.ResourceStamina) { if (vitalsProxy.get("stamina") < statusEffect.resourceCost) { //logger.warn("Insufficient stamina needed " + statusEffect.resourceCost); return false; } vitalsProxy.subtract("stamina", statusEffect.resourceCost); } else if (statusEffect.resource == StatusEffect.Resource.ResourceMagic) { if (vitalsProxy.get("magic") < statusEffect.resourceCost) { //logger.warn("Insufficient magic needed " + statusEffect.resourceCost); return false; } vitalsProxy.subtract("magic", statusEffect.resourceCost); } return true; } public static void sendCombatDamage(VitalsProxy origin, VitalsProxy target, int value, CombatLog.Type type, String zone) { GameEntityManager gameEntityManager = GameEntityManagerService.instance().getGameEntityManager(); gameEntityManager.combatDamage(origin, target, value, type); if (!combatLogEnabled) { return; } GameMessage msg = new GameMessage(); msg.combatLog = new CombatLog(); msg.combatLog.origin = origin.getEntityId(); msg.combatLog.target = target.getEntityId(); msg.combatLog.value = value; msg.combatLog.type = type; Grid grid = GridService.getInstance().getGrid(zone, "default"); TrackData trackData = grid.get(msg.combatLog.origin); if (trackData != null) { PlayerMessage.tell(msg, trackData.id); } trackData = grid.get(msg.combatLog.target); if (trackData != null) { PlayerMessage.tell(msg, trackData.id); } } public StatusEffectManager() { createDefaultEffectHandlers(); } private void createDefaultEffectHandlers() { int zoneCount = RegionInfo.db().findAll().size(); if (zoneCount == 0) { logger.warn("Combat system requires at least one zone configured"); return; } for (Zone zone : ZoneService.staticZones()) { createEffectHandler(zone.name); } } public static void createEffectHandler(String zone) { if (handlerZones.contains(zone)) { logger.warn("effect handler already created for zone " + zone); return; } GridSet gridSet = new GridSet(); gridSet.zone = zone; GridService.getInstance().createForZone(zone); gridSet.playerGrid = GridService.getInstance().getGrid(zone, "default"); gridSet.objectGrid = GridService.getInstance().getGrid(zone, "build_objects"); gridsets.add(gridSet); GameMachineLoader.getActorSystem().actorOf(Props.create(ActiveEffectHandler.class, "default", zone), ActiveEffectHandler.actorName("default", zone)); GameMachineLoader.getActorSystem().actorOf(Props.create(ActiveEffectHandler.class, "build_objects", zone), ActiveEffectHandler.actorName("build_objects", zone)); GameMachineLoader.getActorSystem().actorOf(Props.create(PassiveEffectHandler.class, "default", zone), PassiveEffectHandler.actorName("default", zone)); GameMachineLoader.getActorSystem().actorOf(Props.create(PassiveEffectHandler.class, "build_objects", zone), PassiveEffectHandler.actorName("build_objects", zone)); GameMachineLoader.getActorSystem().actorOf(Props.create(VitalsRegen.class, zone), VitalsRegen.actorName(zone)); handlerZones.add(zone); } @Override public void onReceive(Object arg0) throws Exception { // TODO Auto-generated method stub } }
{ "pile_set_name": "Github" }
package com.trinity.sample.view.foucs enum class AutoFocusTrigger { GESTURE, METHOD }
{ "pile_set_name": "Github" }
/* Copyright 2012 Yaqiang Wang, * yaqiang.wang@gmail.com * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * General Public License for more details. */ package org.meteoinfo.data.mapdata.geotiff; import java.util.HashMap; /** * * @author yaqiang */ public class Tag implements Comparable { // <editor-fold desc="Variables"> private static HashMap map = new HashMap(); public static final Tag NewSubfileType = new Tag("NewSubfileType", 254); public static final Tag ImageWidth = new Tag("ImageWidth", 256); public static final Tag ImageLength = new Tag("ImageLength", 257); public static final Tag BitsPerSample = new Tag("BitsPerSample", 258); public static final Tag Compression = new Tag("Compression", 259); public static final Tag PhotometricInterpretation = new Tag("PhotometricInterpretation", 262); public static final Tag FillOrder = new Tag("FillOrder", 266); public static final Tag DocumentName = new Tag("DocumentName", 269); public static final Tag ImageDescription = new Tag("ImageDescription", 270); public static final Tag StripOffsets = new Tag("StripOffsets", 273); public static final Tag Orientation = new Tag("Orientation", 274); public static final Tag SamplesPerPixel = new Tag("SamplesPerPixel", 277); public static final Tag RowsPerStrip = new Tag("RowsPerStrip", 278); public static final Tag StripByteCounts = new Tag("StripByteCounts", 279); public static final Tag XResolution = new Tag("XResolution", 282); public static final Tag YResolution = new Tag("YResolution", 283); public static final Tag PlanarConfiguration = new Tag("PlanarConfiguration", 284); public static final Tag ResolutionUnit = new Tag("ResolutionUnit", 296); public static final Tag PageNumber = new Tag("PageNumber", 297); public static final Tag Software = new Tag("Software", 305); public static final Tag ColorMap = new Tag("ColorMap", 320); public static final Tag TileWidth = new Tag("TileWidth", 322); public static final Tag TileLength = new Tag("TileLength", 323); public static final Tag TileOffsets = new Tag("TileOffsets", 324); public static final Tag TileByteCounts = new Tag("TileByteCounts", 325); public static final Tag SampleFormat = new Tag("SampleFormat", 339); public static final Tag SMinSampleValue = new Tag("SMinSampleValue", 340); public static final Tag SMaxSampleValue = new Tag("SMaxSampleValue", 341); public static final Tag ModelPixelScaleTag = new Tag("ModelPixelScaleTag", 33550); public static final Tag IntergraphMatrixTag = new Tag("IntergraphMatrixTag", 33920); public static final Tag ModelTiepointTag = new Tag("ModelTiepointTag", 33922); public static final Tag ModelTransformationTag = new Tag("ModelTransformationTag", 34264); public static final Tag GeoKeyDirectoryTag = new Tag("GeoKeyDirectoryTag", 34735); public static final Tag GeoDoubleParamsTag = new Tag("GeoDoubleParamsTag", 34736); public static final Tag GeoAsciiParamsTag = new Tag("GeoAsciiParamsTag", 34737); public static final Tag GDALNoData = new Tag("GDALNoDataTag", 42113); private String name; private int code; // </editor-fold> // <editor-fold desc="Constructor"> static Tag get(int code) { return (Tag) map.get(new Integer(code)); } private Tag(String name, int code) { this.name = name; this.code = code; map.put(new Integer(code), this); } Tag(int code) { this.code = code; } // </editor-fold> // <editor-fold desc="Get Set Methods"> /** * Get name * * @return Name */ public String getName() { return this.name; } /** * Get code * * @return Code */ public int getCode() { return this.code; } // </editor-fold> // <editor-fold desc="Methods"> /** * To string * * @return String */ @Override public String toString() { return this.code + " (" + this.name + ")"; } /** * Compare to * * @param o Object * @return Int */ @Override public int compareTo(Object o) { return this.code - ((Tag) o).getCode(); } // </editor-fold> }
{ "pile_set_name": "Github" }
/* * 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. */ using System; using System.Collections.Generic; using Aliyun.Acs.Core.Transform; using Aliyun.Acs.Iot.Model.V20180120; namespace Aliyun.Acs.Iot.Transform.V20180120 { public class CreateProductTagsResponseUnmarshaller { public static CreateProductTagsResponse Unmarshall(UnmarshallerContext context) { CreateProductTagsResponse createProductTagsResponse = new CreateProductTagsResponse(); createProductTagsResponse.HttpResponse = context.HttpResponse; createProductTagsResponse.RequestId = context.StringValue("CreateProductTags.RequestId"); createProductTagsResponse.Success = context.BooleanValue("CreateProductTags.Success"); createProductTagsResponse.ErrorMessage = context.StringValue("CreateProductTags.ErrorMessage"); createProductTagsResponse.Code = context.StringValue("CreateProductTags.Code"); List<CreateProductTagsResponse.CreateProductTags_ProductTag> createProductTagsResponse_invalidProductTags = new List<CreateProductTagsResponse.CreateProductTags_ProductTag>(); for (int i = 0; i < context.Length("CreateProductTags.InvalidProductTags.Length"); i++) { CreateProductTagsResponse.CreateProductTags_ProductTag productTag = new CreateProductTagsResponse.CreateProductTags_ProductTag(); productTag.TagKey = context.StringValue("CreateProductTags.InvalidProductTags["+ i +"].TagKey"); productTag.TagValue = context.StringValue("CreateProductTags.InvalidProductTags["+ i +"].TagValue"); createProductTagsResponse_invalidProductTags.Add(productTag); } createProductTagsResponse.InvalidProductTags = createProductTagsResponse_invalidProductTags; return createProductTagsResponse; } } }
{ "pile_set_name": "Github" }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
5