code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
package com.sandwich.util.io; import java.io.File; import java.io.IOException; public abstract class ForEachFileAction extends ExistingFileAction { public ForEachFileAction(String... strings) { super(strings); } public void onDirectory(File dir) throws IOException { for (String fileName : dir.list()) { operate(new File(dir, fileName)); } } }
matyb/java-koans
lib/src/main/java/com/sandwich/util/io/ForEachFileAction.java
Java
apache-2.0
362
/* * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.compiler.server; import com.intellij.ide.highlighter.JavaFileType; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.util.ProgressIndicatorUtils; import com.intellij.openapi.progress.util.ReadTask; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.search.*; import com.intellij.util.SmartList; import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.SequentialTaskExecutor; import io.netty.channel.Channel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.api.CmdlineProtoUtil; import org.jetbrains.jps.api.CmdlineRemoteProto; import org.jetbrains.org.objectweb.asm.Opcodes; import java.util.*; import java.util.concurrent.ExecutorService; /** * @author Eugene Zhuravlev */ public abstract class DefaultMessageHandler implements BuilderMessageHandler { private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.server.DefaultMessageHandler"); public static final long CONSTANT_SEARCH_TIME_LIMIT = 60 * 1000L; // one minute private final Project myProject; private final ExecutorService myTaskExecutor = SequentialTaskExecutor.createSequentialApplicationPoolExecutor("DefaultMessageHandler pool"); private volatile long myConstantSearchTime = 0L; protected DefaultMessageHandler(Project project) { myProject = project; } @Override public void buildStarted(UUID sessionId) { } @Override public final void handleBuildMessage(final Channel channel, final UUID sessionId, final CmdlineRemoteProto.Message.BuilderMessage msg) { //noinspection EnumSwitchStatementWhichMissesCases switch (msg.getType()) { case BUILD_EVENT: final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent event = msg.getBuildEvent(); if (event.getEventType() == CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type.CUSTOM_BUILDER_MESSAGE && event.hasCustomBuilderMessage()) { final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.CustomBuilderMessage message = event.getCustomBuilderMessage(); if (!myProject.isDisposed()) { myProject.getMessageBus().syncPublisher(CustomBuilderMessageHandler.TOPIC).messageReceived( message.getBuilderId(), message.getMessageType(), message.getMessageText() ); } } handleBuildEvent(sessionId, event); break; case COMPILE_MESSAGE: handleCompileMessage(sessionId, msg.getCompileMessage()); break; case CONSTANT_SEARCH_TASK: final CmdlineRemoteProto.Message.BuilderMessage.ConstantSearchTask task = msg.getConstantSearchTask(); handleConstantSearchTask(channel, sessionId, task); break; } } protected abstract void handleCompileMessage(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message); protected abstract void handleBuildEvent(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.BuildEvent event); private void handleConstantSearchTask(final Channel channel, final UUID sessionId, final CmdlineRemoteProto.Message.BuilderMessage.ConstantSearchTask task) { ProgressIndicatorUtils.scheduleWithWriteActionPriority(myTaskExecutor, new ReadTask() { @Override public Continuation runBackgroundProcess(@NotNull ProgressIndicator indicator) throws ProcessCanceledException { return DumbService.getInstance(myProject).runReadActionInSmartMode(() -> { doHandleConstantSearchTask(channel, sessionId, task); return null; }); } @Override public void onCanceled(@NotNull ProgressIndicator indicator) { DumbService.getInstance(myProject).runWhenSmart(() -> handleConstantSearchTask(channel, sessionId, task)); } }); } private void doHandleConstantSearchTask(Channel channel, UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.ConstantSearchTask task) { final String ownerClassName = task.getOwnerClassName(); final String fieldName = task.getFieldName(); final int accessFlags = task.getAccessFlags(); final boolean accessChanged = task.getIsAccessChanged(); final boolean isRemoved = task.getIsFieldRemoved(); boolean canceled = false; final Ref<Boolean> isSuccess = Ref.create(Boolean.TRUE); final Set<String> affectedPaths = Collections.synchronizedSet(new HashSet<String>()); // PsiSearchHelper runs multiple threads final long searchStart = System.currentTimeMillis(); try { if (myConstantSearchTime > CONSTANT_SEARCH_TIME_LIMIT) { // skipping constant search and letting the build rebuild dependent modules isSuccess.set(Boolean.FALSE); LOG.debug("Total constant search time exceeded time limit for this build session"); } else if(isDumbMode()) { // do not wait until dumb mode finishes isSuccess.set(Boolean.FALSE); LOG.debug("Constant search task: cannot search in dumb mode"); } else { final String qualifiedName = ownerClassName.replace('$', '.'); handleCompileMessage(sessionId, CmdlineProtoUtil.createCompileProgressMessageResponse( "Searching for usages of changed/removed constants for class " + qualifiedName ).getCompileMessage()); final PsiClass[] classes = ReadAction .compute(() -> JavaPsiFacade.getInstance(myProject).findClasses(qualifiedName, GlobalSearchScope.allScope(myProject))); try { if (isRemoved) { ApplicationManager.getApplication().runReadAction(() -> { if (classes.length > 0) { for (PsiClass aClass : classes) { final boolean success = aClass.isValid() && performRemovedConstantSearch(aClass, fieldName, accessFlags, affectedPaths); if (!success) { isSuccess.set(Boolean.FALSE); break; } } } else { isSuccess.set( performRemovedConstantSearch(null, fieldName, accessFlags, affectedPaths) ); } }); } else { if (classes.length > 0) { final Collection<PsiField> changedFields = ReadAction.compute(() -> { final List<PsiField> fields = new SmartList<>(); for (PsiClass aClass : classes) { if (!aClass.isValid()) { return Collections.emptyList(); } final PsiField changedField = aClass.findFieldByName(fieldName, false); if (changedField != null) { fields.add(changedField); } } return fields; }); if (changedFields.isEmpty()) { isSuccess.set(Boolean.FALSE); LOG.debug("Constant search task: field " + fieldName + " not found in classes " + qualifiedName); } else { for (final PsiField changedField : changedFields) { if (!accessChanged && isPrivate(accessFlags)) { // optimization: don't need to search, cause may be used only in this class continue; } if (!affectDirectUsages(changedField, accessChanged, affectedPaths)) { isSuccess.set(Boolean.FALSE); break; } } } } else { isSuccess.set(Boolean.FALSE); LOG.debug("Constant search task: class " + qualifiedName + " not found"); } } } catch (Throwable e) { isSuccess.set(Boolean.FALSE); LOG.debug("Constant search task: failed with message " + e.getMessage()); } } } catch (ProcessCanceledException e) { canceled = true; throw e; } finally { myConstantSearchTime += (System.currentTimeMillis() - searchStart); if (!canceled) { notifyConstantSearchFinished(channel, sessionId, ownerClassName, fieldName, isSuccess, affectedPaths); } } } private static void notifyConstantSearchFinished(Channel channel, UUID sessionId, String ownerClassName, String fieldName, Ref<Boolean> isSuccess, Set<String> affectedPaths) { final CmdlineRemoteProto.Message.ControllerMessage.ConstantSearchResult.Builder builder = CmdlineRemoteProto.Message.ControllerMessage.ConstantSearchResult.newBuilder(); builder.setOwnerClassName(ownerClassName); builder.setFieldName(fieldName); if (isSuccess.get()) { builder.setIsSuccess(true); builder.addAllPath(affectedPaths); LOG.debug("Constant search task: " + affectedPaths.size() + " affected files found"); } else { builder.setIsSuccess(false); LOG.debug("Constant search task: unsuccessful"); } channel.writeAndFlush(CmdlineProtoUtil.toMessage(sessionId, CmdlineRemoteProto.Message.ControllerMessage.newBuilder().setType( CmdlineRemoteProto.Message.ControllerMessage.Type.CONSTANT_SEARCH_RESULT).setConstantSearchResult(builder.build()).build() )); } private boolean isDumbMode() { final DumbService dumbService = DumbService.getInstance(myProject); boolean isDumb = dumbService.isDumb(); if (isDumb) { // wait some time for (int idx = 0; idx < 5; idx++) { TimeoutUtil.sleep(10L); isDumb = dumbService.isDumb(); if (!isDumb) { break; } } } return isDumb; } private boolean performRemovedConstantSearch(@Nullable final PsiClass aClass, String fieldName, int fieldAccessFlags, final Set<String> affectedPaths) { final PsiSearchHelper psiSearchHelper = PsiSearchHelper.SERVICE.getInstance(myProject); final Ref<Boolean> result = new Ref<>(Boolean.TRUE); final PsiFile fieldContainingFile = aClass != null? aClass.getContainingFile() : null; SearchScope searchScope = getSearchScope(aClass, fieldAccessFlags); if (containsUnloadedModules(searchScope)) { LOG.debug("Constant search tasks: there may be usages of " + (aClass!= null ? aClass.getQualifiedName() + "::": "") + fieldName + " in unloaded modules"); return false; } processIdentifiers(psiSearchHelper, new PsiElementProcessor<PsiIdentifier>() { @Override public boolean execute(@NotNull PsiIdentifier identifier) { try { final PsiElement parent = identifier.getParent(); if (parent instanceof PsiReferenceExpression) { final PsiClass ownerClass = getOwnerClass(parent); if (ownerClass != null && ownerClass.getQualifiedName() != null) { final PsiFile usageFile = ownerClass.getContainingFile(); if (usageFile != null && !usageFile.equals(fieldContainingFile)) { final VirtualFile vFile = usageFile.getOriginalFile().getVirtualFile(); if (vFile != null) { affectedPaths.add(vFile.getPath()); } } } } return true; } catch (PsiInvalidElementAccessException ignored) { result.set(Boolean.FALSE); LOG.debug("Constant search task: PIEAE thrown while searching of usages of removed constant"); return false; } } }, fieldName, searchScope, UsageSearchContext.IN_CODE); return result.get(); } private SearchScope getSearchScope(PsiClass aClass, int fieldAccessFlags) { SearchScope searchScope = GlobalSearchScope.projectScope(myProject); if (aClass != null && isPackageLocal(fieldAccessFlags)) { final PsiFile containingFile = aClass.getContainingFile(); if (containingFile instanceof PsiJavaFile) { final String packageName = ((PsiJavaFile)containingFile).getPackageName(); final PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName); if (aPackage != null) { searchScope = PackageScope.packageScope(aPackage, false); searchScope = searchScope.intersectWith(aClass.getUseScope()); } } } return searchScope; } private static boolean processIdentifiers(PsiSearchHelper helper, @NotNull final PsiElementProcessor<PsiIdentifier> processor, @NotNull final String identifier, @NotNull SearchScope searchScope, short searchContext) { TextOccurenceProcessor processor1 = (element, offsetInElement) -> !(element instanceof PsiIdentifier) || processor.execute((PsiIdentifier)element); SearchScope javaScope = searchScope instanceof GlobalSearchScope ? GlobalSearchScope.getScopeRestrictedByFileTypes((GlobalSearchScope)searchScope, JavaFileType.INSTANCE) : searchScope; return helper.processElementsWithWord(processor1, javaScope, identifier, searchContext, true, false); } private boolean affectDirectUsages(final PsiField psiField, final boolean ignoreAccessScope, final Set<String> affectedPaths) throws ProcessCanceledException { return ReadAction.compute(() -> { if (psiField.isValid()) { final PsiFile fieldContainingFile = psiField.getContainingFile(); final Set<PsiFile> processedFiles = new HashSet<>(); if (fieldContainingFile != null) { processedFiles.add(fieldContainingFile); } // if field is invalid, the file might be changed, so next time it is compiled, // the constant value change, if any, will be processed final Collection<PsiReferenceExpression> references = doFindReferences(psiField, ignoreAccessScope); if (references == null) { return false; } for (final PsiReferenceExpression ref : references) { final PsiElement usage = ref.getElement(); final PsiFile containingPsi = usage.getContainingFile(); if (containingPsi != null && processedFiles.add(containingPsi)) { final VirtualFile vFile = containingPsi.getOriginalFile().getVirtualFile(); if (vFile != null) { affectedPaths.add(vFile.getPath()); } } } } return true; }); } @Nullable("returns null if search failed") private Collection<PsiReferenceExpression> doFindReferences(final PsiField psiField, boolean ignoreAccessScope) { final SmartList<PsiReferenceExpression> result = new SmartList<>(); final SearchScope searchScope = (ignoreAccessScope? psiField.getContainingFile() : psiField).getUseScope(); if (containsUnloadedModules(searchScope)) { PsiClass aClass = psiField.getContainingClass(); LOG.debug("Constant search tasks: there may be usages of " + (aClass != null ? aClass.getQualifiedName() + "::" : "") + psiField.getName() + " in unloaded modules"); return null; } processIdentifiers(PsiSearchHelper.SERVICE.getInstance(myProject), new PsiElementProcessor<PsiIdentifier>() { @Override public boolean execute(@NotNull PsiIdentifier identifier) { final PsiElement parent = identifier.getParent(); if (parent instanceof PsiReferenceExpression) { final PsiReferenceExpression refExpression = (PsiReferenceExpression)parent; if (refExpression.isReferenceTo(psiField)) { synchronized (result) { // processor's code may be invoked from multiple threads result.add(refExpression); } } } return true; } }, psiField.getName(), searchScope, UsageSearchContext.IN_CODE); return result; } @Nullable private static PsiClass getOwnerClass(PsiElement element) { while (!(element instanceof PsiFile)) { if (element instanceof PsiClass && element.getParent() instanceof PsiJavaFile) { // top-level class final PsiClass psiClass = (PsiClass)element; if (JspPsiUtil.isInJspFile(psiClass)) { return null; } final PsiFile containingFile = psiClass.getContainingFile(); if (containingFile == null) { return null; } return JavaLanguage.INSTANCE.equals(containingFile.getLanguage())? psiClass : null; } element = element.getParent(); } return null; } private static boolean containsUnloadedModules(SearchScope scope) { if (scope instanceof LocalSearchScope) { return false; } else if (scope instanceof GlobalSearchScope) { return !((GlobalSearchScope)scope).getUnloadedModulesBelongingToScope().isEmpty(); } else { //cannot happen now, every SearchScope's implementation extends either LocalSearchScope or GlobalSearchScope return true; } } private static boolean isPackageLocal(int flags) { return (Opcodes.ACC_PUBLIC & flags) == 0 && (Opcodes.ACC_PROTECTED & flags) == 0 && (Opcodes.ACC_PRIVATE & flags) == 0; } private static boolean isPrivate(int flags) { return (Opcodes.ACC_PRIVATE & flags) != 0; } }
ThiagoGarciaAlves/intellij-community
java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java
Java
apache-2.0
18,505
package org.xbib.elasticsearch.action.ingest; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.DocumentRequest; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.xbib.elasticsearch.action.ingest.leader.IngestLeaderShardRequest; import org.xbib.elasticsearch.action.ingest.leader.IngestLeaderShardResponse; import org.xbib.elasticsearch.action.ingest.leader.TransportLeaderShardIngestAction; import org.xbib.elasticsearch.action.ingest.replica.IngestReplicaShardRequest; import org.xbib.elasticsearch.action.ingest.replica.TransportReplicaShardIngestAction; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; public class TransportIngestAction extends HandledTransportAction<IngestRequest, IngestResponse> { private final boolean allowIdGeneration; private final ClusterService clusterService; private final TransportLeaderShardIngestAction leaderShardIngestAction; private final TransportReplicaShardIngestAction replicaShardIngestAction; @Inject public TransportIngestAction(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, TransportLeaderShardIngestAction leaderShardIngestAction, TransportReplicaShardIngestAction replicaShardIngestAction, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) { super(settings, IngestAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, IngestRequest.class); this.clusterService = clusterService; this.leaderShardIngestAction = leaderShardIngestAction; this.replicaShardIngestAction = replicaShardIngestAction; this.allowIdGeneration = this.settings.getAsBoolean("action.allow_id_generation", true); } @Override protected void doExecute(final IngestRequest ingestRequest, final ActionListener<IngestResponse> listener) { final long startTime = System.currentTimeMillis(); final IngestResponse ingestResponse = new IngestResponse(); ingestResponse.setIngestId(ingestRequest.ingestId()); ClusterState clusterState = clusterService.state(); try { clusterState.blocks().globalBlockedRaiseException(ClusterBlockLevel.WRITE); } catch (ClusterBlockException e) { listener.onFailure(e); return; } final ConcreteIndices concreteIndices = new ConcreteIndices(clusterState, indexNameExpressionResolver); MetaData metaData = clusterState.metaData(); final List<ActionRequest<?>> requests = new LinkedList<>(); for (ActionRequest<?> request : ingestRequest.requests()) { String concreteIndex = concreteIndices.resolveIfAbsent((DocumentRequest)request); if (request instanceof IndexRequest) { try { IndexRequest indexRequest = (IndexRequest) request; indexRequest.routing(metaData.resolveIndexRouting(indexRequest.routing(), concreteIndex)); indexRequest.index(concreteIndex); MappingMetaData mappingMd = null; if (metaData.hasIndex(concreteIndex)) { mappingMd = metaData.index(concreteIndex).mappingOrDefault(indexRequest.type()); } indexRequest.process(metaData, mappingMd, allowIdGeneration, concreteIndex); requests.add(indexRequest); } catch (Throwable e) { logger.error(e.getMessage(), e); ingestResponse.addFailure(new IngestActionFailure(-1L, null, ExceptionsHelper.detailedMessage(e))); } } else if (request instanceof DeleteRequest) { DeleteRequest deleteRequest = (DeleteRequest) request; deleteRequest.routing(metaData.resolveIndexRouting(deleteRequest.routing(), concreteIndex)); deleteRequest.index(concreteIndex); requests.add(deleteRequest); } else { throw new ElasticsearchException("action request not known: " + request.getClass().getName()); } } // second, go over all the requests and create a shard request map Map<ShardId, List<ActionRequest<?>>> requestsByShard = new HashMap<>(); for (ActionRequest<?> request : requests) { if (request instanceof IndexRequest) { IndexRequest indexRequest = (IndexRequest) request; String concreteIndex = concreteIndices.getConcreteIndex(indexRequest.index()); ShardId shardId = clusterService.operationRouting().indexShards(clusterState, concreteIndex, indexRequest.type(), indexRequest.id(), indexRequest.routing()).shardId(); List<ActionRequest<?>> list = requestsByShard.get(shardId); if (list == null) { list = new LinkedList<>(); requestsByShard.put(shardId, list); } list.add(request); } else if (request instanceof DeleteRequest) { DeleteRequest deleteRequest = (DeleteRequest) request; String concreteIndex = concreteIndices.getConcreteIndex(deleteRequest.index()); ShardId shardId = clusterService.operationRouting().indexShards(clusterState, concreteIndex, deleteRequest.type(), deleteRequest.id(), deleteRequest.routing()).shardId(); List<ActionRequest<?>> list = requestsByShard.get(shardId); if (list == null) { list = new LinkedList<>(); requestsByShard.put(shardId, list); } list.add(deleteRequest); } } if (requestsByShard.isEmpty()) { logger.error("no shards to execute ingest"); ingestResponse.setSuccessSize(0) .addFailure(new IngestActionFailure(-1L, null, "no shards to execute ingest")) .setTookInMillis(System.currentTimeMillis() - startTime); listener.onResponse(ingestResponse); return; } // third, for each shard, execute leader/replica action final AtomicInteger successCount = new AtomicInteger(0); final AtomicInteger responseCounter = new AtomicInteger(requestsByShard.size()); for (Map.Entry<ShardId, List<ActionRequest<?>>> entry : requestsByShard.entrySet()) { final ShardId shardId = entry.getKey(); final List<ActionRequest<?>> actionRequests = entry.getValue(); final IngestLeaderShardRequest ingestLeaderShardRequest = new IngestLeaderShardRequest() .setIngestId(ingestRequest.ingestId()) .setShardId(shardId) .setActionRequests(actionRequests) .timeout(ingestRequest.timeout()) .requiredConsistency(ingestRequest.requiredConsistency()); leaderShardIngestAction.execute(ingestLeaderShardRequest, new ActionListener<IngestLeaderShardResponse>() { @Override public void onResponse(IngestLeaderShardResponse ingestLeaderShardResponse) { long millis = System.currentTimeMillis() - startTime; ingestResponse.setIngestId(ingestRequest.ingestId()); ingestResponse.setLeaderResponse(ingestLeaderShardResponse); successCount.addAndGet(ingestLeaderShardResponse.getSuccessCount()); int quorumShards = ingestLeaderShardResponse.getQuorumShards(); if (quorumShards < 0) { ingestResponse.addFailure(new IngestActionFailure(ingestRequest.ingestId(), shardId, "quorum not reached for shard " + shardId)); } else if (quorumShards > 0) { responseCounter.incrementAndGet(); final IngestReplicaShardRequest ingestReplicaShardRequest = new IngestReplicaShardRequest(ingestLeaderShardRequest.getIngestId(), ingestLeaderShardRequest.getShardId(), ingestLeaderShardRequest.getActionRequests()); ingestReplicaShardRequest.timeout(ingestRequest.timeout()); replicaShardIngestAction.execute(ingestReplicaShardRequest, new ActionListener<TransportReplicaShardIngestAction.ReplicaOperationResponse>() { @Override public void onResponse(TransportReplicaShardIngestAction.ReplicaOperationResponse response) { long millis = Math.max(1, System.currentTimeMillis() - startTime); ingestResponse.addReplicaResponses(response.responses()); if (responseCounter.decrementAndGet() == 0) { ingestResponse.setSuccessSize(successCount.get()) .setTookInMillis(millis); listener.onResponse(ingestResponse); } } @Override public void onFailure(Throwable e) { long millis = Math.max(1, System.currentTimeMillis() - startTime); logger.error(e.getMessage(), e); ingestResponse.addFailure(new IngestActionFailure(ingestRequest.ingestId(), shardId, ExceptionsHelper.detailedMessage(e))); if (responseCounter.decrementAndGet() == 0) { ingestResponse.setSuccessSize(successCount.get()) .setTookInMillis(millis); listener.onResponse(ingestResponse); } } }); } if (responseCounter.decrementAndGet() == 0) { ingestResponse.setSuccessSize(successCount.get()).setTookInMillis(millis); listener.onResponse(ingestResponse); } } @Override public void onFailure(Throwable e) { long millis = System.currentTimeMillis() - startTime; logger.error(e.getMessage(), e); ingestResponse.addFailure(new IngestActionFailure(-1L, shardId, ExceptionsHelper.detailedMessage(e))); if (responseCounter.decrementAndGet() == 0) { ingestResponse.setSuccessSize(successCount.get()).setTookInMillis(millis); listener.onResponse(ingestResponse); } } }); } } private static class ConcreteIndices { private final ClusterState state; private final IndexNameExpressionResolver indexNameExpressionResolver; private final Map<String, String> indices = new HashMap<>(); ConcreteIndices(ClusterState state, IndexNameExpressionResolver indexNameExpressionResolver) { this.state = state; this.indexNameExpressionResolver = indexNameExpressionResolver; } String getConcreteIndex(String indexOrAlias) { return indices.get(indexOrAlias); } String resolveIfAbsent(DocumentRequest<?> request) { String concreteIndex = indices.get(request.index()); if (concreteIndex == null) { concreteIndex = indexNameExpressionResolver.concreteSingleIndex(state, request); indices.put(request.index(), concreteIndex); } return concreteIndex; } } }
jprante/elasticsearch-helper
src/main/java/org/xbib/elasticsearch/action/ingest/TransportIngestAction.java
Java
apache-2.0
13,193
/* * 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.google.devtools.j2objc.translate; import com.google.devtools.j2objc.GenerationTest; import com.google.devtools.j2objc.Options; import java.io.IOException; /** * Unit tests for {@link Rewriter}. * * @author Keith Stanger */ public class GwtConverterTest extends GenerationTest { @Override protected void setUp() throws IOException { super.setUp(); addSourceFile( "package com.google.gwt.core.client;" + "public class GWT { public static <T> T create(Class<T> classLiteral) { return null; } " + " public static boolean isClient() { return false; }" + " public static boolean isScript() { return false; } }", "com/google/gwt/core/client/GWT.java"); addSourceFile( "package com.google.common.annotations; " + "import java.lang.annotation.*; " + "@Retention(RetentionPolicy.CLASS) " + "@Target({ ElementType.METHOD }) " + "public @interface GwtIncompatible { " + " String value(); }", "com/google/common/annotations/GwtIncompatible.java"); } @Override protected void tearDown() throws Exception { Options.setStripGwtIncompatibleMethods(false); super.tearDown(); } public void testGwtCreate() throws IOException { String translation = translateSourceFile( "import com.google.gwt.core.client.GWT;" + "class Test { " + " Test INSTANCE = GWT.create(Test.class);" + " String FOO = foo();" // Regression requires subsequent non-mapped method invocation. + " static String foo() { return \"foo\"; } }", "Test", "Test.m"); assertTranslation(translation, "Test_set_INSTANCE_(self, [Test_class_() newInstance]);"); } public void testGwtIsScript() throws IOException { String translation = translateSourceFile( "import com.google.gwt.core.client.GWT;" + "class Test { boolean test() { " + " if (GWT.isClient() || GWT.isScript()) { return true; } return false; }}", "Test", "Test.m"); assertTranslatedLines(translation, "- (jboolean)test {", "return NO;", "}"); } // Verify GwtIncompatible method is not stripped by default. public void testGwtIncompatibleStrip() throws IOException { Options.setStripGwtIncompatibleMethods(true); String translation = translateSourceFile( "import com.google.common.annotations.GwtIncompatible;" + "class Test { " + " @GwtIncompatible(\"don't use\") boolean test() { return false; }}", "Test", "Test.h"); assertNotInTranslation(translation, "- (BOOL)test;"); } // Verify GwtIncompatible method is stripped with flag. public void testGwtIncompatibleNoStrip() throws IOException { String translation = translateSourceFile( "import com.google.common.annotations.GwtIncompatible;" + "class Test { " + " @GwtIncompatible(\"don't use\") boolean test() { return false; }}", "Test", "Test.h"); assertTranslation(translation, "- (jboolean)test;"); } // Verify GwtIncompatible method is not stripped with flag, if // value is in GwtConverter.compatibleAPIs list. public void testGwtIncompatibleNoStripKnownValue() throws IOException { Options.setStripGwtIncompatibleMethods(true); String translation = translateSourceFile( "import com.google.common.annotations.GwtIncompatible;" + "class Test { " + " @GwtIncompatible(\"reflection\") boolean test() { return false; }}", "Test", "Test.h"); assertTranslation(translation, "- (jboolean)test;"); } }
Sellegit/j2objc
translator/src/test/java/com/google/devtools/j2objc/translate/GwtConverterTest.java
Java
apache-2.0
4,120
# Copyright (c) 2007-2019 UShareSoft, All rights reserved # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from texttable import Texttable from ussclicore.utils import generics_utils def scan_status(scan): if (scan.status.complete and not scan.status.error and not scan.status.cancelled): return "Done" elif(not scan.status.complete and not scan.status.error and not scan.status.cancelled): return str(scan.status.percentage)+"%" else: return "Error" def scan_table(scanInstances, scan = None): table = Texttable(800) table.set_cols_dtype(["t", "t", "t", "t", "t"]) table.set_cols_align(["c", "l", "c", "c", "c"]) table.header(["Id", "Name", "Status", "Distribution", "With overlay"]) if scan: table.add_row([scan.dbId, "\t"+scan.name, scan_status(scan), "", ""]) return table for myScannedInstance in scanInstances: withOverlayStr = '' if myScannedInstance.overlayIncluded: withOverlayStr = 'X' table.add_row([myScannedInstance.dbId, myScannedInstance.name, "", myScannedInstance.distribution.name + " "+ myScannedInstance.distribution.version + " " + myScannedInstance.distribution.arch, withOverlayStr]) scans = generics_utils.order_list_object_by(myScannedInstance.scans.scan, "name") for lscan in scans: table.add_row([lscan.dbId, "\t"+lscan.name, scan_status(lscan), "", ""]) return table
emuus/hammr
hammr/utils/scan_utils.py
Python
apache-2.0
1,969
/** * 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.apache.aurora.scheduler.state; import org.apache.aurora.scheduler.storage.entities.ILock; import org.apache.aurora.scheduler.storage.entities.ILockKey; /** * Defines all {@link ILock} primitives like: acquire, release, validate. */ public interface LockManager { /** * Creates, saves and returns a new {@link ILock} with the specified {@link ILockKey}. * This method is not re-entrant, i.e. attempting to acquire a lock with the * same key would throw a {@link LockException}. * * @param lockKey A key uniquely identify the lock to be created. * @param user Name of the user requesting a lock. * @return A new ILock instance. * @throws LockException In case the lock with specified key already exists. */ ILock acquireLock(ILockKey lockKey, String user) throws LockException; /** * Releases (removes) the specified {@link ILock} from the system. * * @param lock {@link ILock} to remove from the system. */ void releaseLock(ILock lock); /** * Asserts that an entity is not locked. * * @param context Operation context to validate with the provided lock. * @throws LockException If provided context is locked. */ void assertNotLocked(ILockKey context) throws LockException; /** * Returns all available locks stored. * * @return Set of {@link ILock} instances. */ Iterable<ILock> getLocks(); /** * Thrown when {@link ILock} related operation failed. */ class LockException extends Exception { public LockException(String msg) { super(msg); } } }
protochron/aurora
src/main/java/org/apache/aurora/scheduler/state/LockManager.java
Java
apache-2.0
2,134
(function() { 'use strict'; angular.module('newplayer.service', []); })();
thenewgroup/elx-newplayer
app/scripts/service/service.module.js
JavaScript
apache-2.0
80
<?php /** * @file * Contains \Drupal\Component\Utility\SortArray. */ namespace Drupal\Component\Utility; /** * Provides generic array sorting helper methods. */ class SortArray { /** * Sorts a structured array by the 'weight' element. * * Note that the sorting is by the 'weight' array element, not by the render * element property '#weight'. * * Callback for uasort() used in various functions. * * @param array $a * First item for comparison. The compared items should be associative * arrays that optionally include a 'weight' element. For items without a * 'weight' element, a default value of 0 will be used. * @param array $b * Second item for comparison. * * @return int * The comparison result for uasort(). */ public static function sortByWeightElement(array $a, array $b) { return static::sortByKeyInt($a, $b, 'weight'); } /** * Sorts a structured array by '#weight' property. * * Callback for uasort() within element_children(). * * @param array $a * First item for comparison. The compared items should be associative * arrays that optionally include a '#weight' key. * @param array $b * Second item for comparison. * * @return int * The comparison result for uasort(). */ public static function sortByWeightProperty($a, $b) { return static::sortByKeyInt($a, $b, '#weight'); } /** * Sorts a structured array by 'title' key (no # prefix). * * Callback for uasort() within system_admin_index(). * * @param array $a * First item for comparison. The compared items should be associative arrays * that optionally include a 'title' key. * @param array $b * Second item for comparison. * * @return int * The comparison result for uasort(). */ public static function sortByTitleElement($a, $b) { return static::sortByKeyString($a, $b, 'title'); } /** * Sorts a structured array by '#title' property. * * Callback for uasort() within: * - system_modules() * - theme_simpletest_test_table() * * @param array $a * First item for comparison. The compared items should be associative arrays * that optionally include a '#title' key. * @param array $b * Second item for comparison. * * @return int * The comparison result for uasort(). */ public static function sortByTitleProperty($a, $b) { return static::sortByKeyString($a, $b, '#title'); } /** * Sorts a string array item by an arbitrary key. * * @param array $a * First item for comparison. * @param array $b * Second item for comparison. * @param string $key * The key to use in the comparison. * * @return int * The comparison result for uasort(). */ public static function sortByKeyString($a, $b, $key) { $a_title = (is_array($a) && isset($a[$key])) ? $a[$key] : ''; $b_title = (is_array($b) && isset($b[$key])) ? $b[$key] : ''; return strnatcasecmp($a_title, $b_title); } /** * Sorts an integer array item by an arbitrary key. * * @param array $a * First item for comparison. * @param array $b * Second item for comparison. * @param string $key * The key to use in the comparison. * * @return int * The comparison result for uasort(). */ public static function sortByKeyInt($a, $b, $key) { $a_weight = (is_array($a) && isset($a[$key])) ? $a[$key] : 0; $b_weight = (is_array($b) && isset($b[$key])) ? $b[$key] : 0; if ($a_weight == $b_weight) { return 0; } return ($a_weight < $b_weight) ? -1 : 1; } }
nickopris/musicapp
www/core/lib/Drupal/Component/Utility/SortArray.php
PHP
apache-2.0
3,665
namespace Xilium.CefGlue { using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; using Xilium.CefGlue.Interop; /// <summary> /// Callback interface for CefBrowserHost::GetNavigationEntries. The methods of /// this class will be called on the browser process UI thread. /// </summary> public abstract unsafe partial class CefNavigationEntryVisitor { private int visit(cef_navigation_entry_visitor_t* self, cef_navigation_entry_t* entry, int current, int index, int total) { CheckSelf(self); var m_entry = CefNavigationEntry.FromNative(entry); var m_result = Visit(m_entry, current != 0, index, total); m_entry.Dispose(); return m_result ? 1 : 0; } /// <summary> /// Method that will be executed. Do not keep a reference to |entry| outside of /// this callback. Return true to continue visiting entries or false to stop. /// |current| is true if this entry is the currently loaded navigation entry. /// |index| is the 0-based index of this entry and |total| is the total number /// of entries. /// </summary> protected abstract bool Visit(CefNavigationEntry entry, bool current, int index, int total); } }
mindthegab/SFE-Minuet-DesktopClient
minuet/CefGlue/Classes.Handlers/CefNavigationEntryVisitor.cs
C#
apache-2.0
1,363
/* * 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 javax.el; /** * */ public abstract class ValueExpression extends Expression { public abstract Class<?> getExpectedType(); public abstract Class<?> getType(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException; public abstract boolean isReadOnly(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException; public abstract void setValue(ELContext context, Object value) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException; public abstract Object getValue(ELContext context) throws NullPointerException, PropertyNotFoundException, ELException; public ValueReference getValueReference(ELContext context){ return null; } }
salyh/javamailspec
geronimo-el_2.2_spec/src/main/java/javax/el/ValueExpression.java
Java
apache-2.0
1,582
/* * Copyright 2014 The Netty Project * * The Netty Project 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 io.netty.handler.codec.http2; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import io.netty.channel.DefaultChannelPromise; import io.netty.handler.ssl.ApplicationProtocolNames; import io.netty.util.AsciiString; import io.netty.util.concurrent.EventExecutor; import io.netty.util.internal.UnstableApi; import static io.netty.buffer.Unpooled.directBuffer; import static io.netty.buffer.Unpooled.unreleasableBuffer; import static io.netty.handler.codec.http2.Http2Error.PROTOCOL_ERROR; import static io.netty.handler.codec.http2.Http2Exception.connectionError; import static io.netty.handler.codec.http2.Http2Exception.headerListSizeError; import static io.netty.util.CharsetUtil.UTF_8; import static java.lang.Math.max; import static java.lang.Math.min; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; /** * Constants and utility method used for encoding/decoding HTTP2 frames. */ @UnstableApi public final class Http2CodecUtil { public static final int CONNECTION_STREAM_ID = 0; public static final int HTTP_UPGRADE_STREAM_ID = 1; public static final CharSequence HTTP_UPGRADE_SETTINGS_HEADER = AsciiString.cached("HTTP2-Settings"); public static final CharSequence HTTP_UPGRADE_PROTOCOL_NAME = "h2c"; public static final CharSequence TLS_UPGRADE_PROTOCOL_NAME = ApplicationProtocolNames.HTTP_2; public static final int PING_FRAME_PAYLOAD_LENGTH = 8; public static final short MAX_UNSIGNED_BYTE = 0xff; /** * The maximum number of padding bytes. That is the 255 padding bytes appended to the end of a frame and the 1 byte * pad length field. */ public static final int MAX_PADDING = 256; public static final long MAX_UNSIGNED_INT = 0xffffffffL; public static final int FRAME_HEADER_LENGTH = 9; public static final int SETTING_ENTRY_LENGTH = 6; public static final int PRIORITY_ENTRY_LENGTH = 5; public static final int INT_FIELD_LENGTH = 4; public static final short MAX_WEIGHT = 256; public static final short MIN_WEIGHT = 1; private static final ByteBuf CONNECTION_PREFACE = unreleasableBuffer(directBuffer(24).writeBytes("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".getBytes(UTF_8))) .asReadOnly(); private static final int MAX_PADDING_LENGTH_LENGTH = 1; public static final int DATA_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH + MAX_PADDING_LENGTH_LENGTH; public static final int HEADERS_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH + MAX_PADDING_LENGTH_LENGTH + INT_FIELD_LENGTH + 1; public static final int PRIORITY_FRAME_LENGTH = FRAME_HEADER_LENGTH + PRIORITY_ENTRY_LENGTH; public static final int RST_STREAM_FRAME_LENGTH = FRAME_HEADER_LENGTH + INT_FIELD_LENGTH; public static final int PUSH_PROMISE_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH + MAX_PADDING_LENGTH_LENGTH + INT_FIELD_LENGTH; public static final int GO_AWAY_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH + 2 * INT_FIELD_LENGTH; public static final int WINDOW_UPDATE_FRAME_LENGTH = FRAME_HEADER_LENGTH + INT_FIELD_LENGTH; public static final int CONTINUATION_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH + MAX_PADDING_LENGTH_LENGTH; public static final char SETTINGS_HEADER_TABLE_SIZE = 1; public static final char SETTINGS_ENABLE_PUSH = 2; public static final char SETTINGS_MAX_CONCURRENT_STREAMS = 3; public static final char SETTINGS_INITIAL_WINDOW_SIZE = 4; public static final char SETTINGS_MAX_FRAME_SIZE = 5; public static final char SETTINGS_MAX_HEADER_LIST_SIZE = 6; public static final int NUM_STANDARD_SETTINGS = 6; public static final long MAX_HEADER_TABLE_SIZE = MAX_UNSIGNED_INT; public static final long MAX_CONCURRENT_STREAMS = MAX_UNSIGNED_INT; public static final int MAX_INITIAL_WINDOW_SIZE = Integer.MAX_VALUE; public static final int MAX_FRAME_SIZE_LOWER_BOUND = 0x4000; public static final int MAX_FRAME_SIZE_UPPER_BOUND = 0xffffff; public static final long MAX_HEADER_LIST_SIZE = MAX_UNSIGNED_INT; public static final long MIN_HEADER_TABLE_SIZE = 0; public static final long MIN_CONCURRENT_STREAMS = 0; public static final int MIN_INITIAL_WINDOW_SIZE = 0; public static final long MIN_HEADER_LIST_SIZE = 0; public static final int DEFAULT_WINDOW_SIZE = 65535; public static final short DEFAULT_PRIORITY_WEIGHT = 16; public static final int DEFAULT_HEADER_TABLE_SIZE = 4096; /** * <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">The initial value of this setting is unlimited</a>. * However in practice we don't want to allow our peers to use unlimited memory by default. So we take advantage * of the <q>For any given request, a lower limit than what is advertised MAY be enforced.</q> loophole. */ public static final long DEFAULT_HEADER_LIST_SIZE = 8192; public static final int DEFAULT_MAX_FRAME_SIZE = MAX_FRAME_SIZE_LOWER_BOUND; /** * The assumed minimum value for {@code SETTINGS_MAX_CONCURRENT_STREAMS} as * recommended by the <a herf="https://tools.ietf.org/html/rfc7540#section-6.5.2">HTTP/2 spec</a>. */ public static final int SMALLEST_MAX_CONCURRENT_STREAMS = 100; static final int DEFAULT_MAX_RESERVED_STREAMS = SMALLEST_MAX_CONCURRENT_STREAMS; static final int DEFAULT_MIN_ALLOCATION_CHUNK = 1024; /** * Calculate the threshold in bytes which should trigger a {@code GO_AWAY} if a set of headers exceeds this amount. * @param maxHeaderListSize * <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a> for the local * endpoint. * @return the threshold in bytes which should trigger a {@code GO_AWAY} if a set of headers exceeds this amount. */ public static long calculateMaxHeaderListSizeGoAway(long maxHeaderListSize) { // This is equivalent to `maxHeaderListSize * 1.25` but we avoid floating point multiplication. return maxHeaderListSize + (maxHeaderListSize >>> 2); } public static final long DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT_MILLIS = MILLISECONDS.convert(30, SECONDS); public static final int DEFAULT_MAX_QUEUED_CONTROL_FRAMES = 10000; /** * Returns {@code true} if the stream is an outbound stream. * * @param server {@code true} if the endpoint is a server, {@code false} otherwise. * @param streamId the stream identifier */ public static boolean isOutboundStream(boolean server, int streamId) { boolean even = (streamId & 1) == 0; return streamId > 0 && server == even; } /** * Returns true if the {@code streamId} is a valid HTTP/2 stream identifier. */ public static boolean isStreamIdValid(int streamId) { return streamId >= 0; } static boolean isStreamIdValid(int streamId, boolean server) { return isStreamIdValid(streamId) && server == ((streamId & 1) == 0); } /** * Indicates whether or not the given value for max frame size falls within the valid range. */ public static boolean isMaxFrameSizeValid(int maxFrameSize) { return maxFrameSize >= MAX_FRAME_SIZE_LOWER_BOUND && maxFrameSize <= MAX_FRAME_SIZE_UPPER_BOUND; } /** * Returns a buffer containing the {@link #CONNECTION_PREFACE}. */ public static ByteBuf connectionPrefaceBuf() { // Return a duplicate so that modifications to the reader index will not affect the original buffer. return CONNECTION_PREFACE.retainedDuplicate(); } /** * Iteratively looks through the causality chain for the given exception and returns the first * {@link Http2Exception} or {@code null} if none. */ public static Http2Exception getEmbeddedHttp2Exception(Throwable cause) { while (cause != null) { if (cause instanceof Http2Exception) { return (Http2Exception) cause; } cause = cause.getCause(); } return null; } /** * Creates a buffer containing the error message from the given exception. If the cause is * {@code null} returns an empty buffer. */ public static ByteBuf toByteBuf(ChannelHandlerContext ctx, Throwable cause) { if (cause == null || cause.getMessage() == null) { return Unpooled.EMPTY_BUFFER; } return ByteBufUtil.writeUtf8(ctx.alloc(), cause.getMessage()); } /** * Reads a big-endian (31-bit) integer from the buffer. */ public static int readUnsignedInt(ByteBuf buf) { return buf.readInt() & 0x7fffffff; } /** * Writes an HTTP/2 frame header to the output buffer. */ public static void writeFrameHeader(ByteBuf out, int payloadLength, byte type, Http2Flags flags, int streamId) { out.ensureWritable(FRAME_HEADER_LENGTH + payloadLength); writeFrameHeaderInternal(out, payloadLength, type, flags, streamId); } /** * Calculate the amount of bytes that can be sent by {@code state}. The lower bound is {@code 0}. */ public static int streamableBytes(StreamByteDistributor.StreamState state) { return max(0, (int) min(state.pendingBytes(), state.windowSize())); } /** * Results in a RST_STREAM being sent for {@code streamId} due to violating * <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a>. * @param streamId The stream ID that was being processed when the exceptional condition occurred. * @param maxHeaderListSize The max allowed size for a list of headers in bytes which was exceeded. * @param onDecode {@code true} if the exception was encountered during decoder. {@code false} for encode. * @throws Http2Exception a stream error. */ public static void headerListSizeExceeded(int streamId, long maxHeaderListSize, boolean onDecode) throws Http2Exception { throw headerListSizeError(streamId, PROTOCOL_ERROR, onDecode, "Header size exceeded max " + "allowed size (%d)", maxHeaderListSize); } /** * Results in a GO_AWAY being sent due to violating * <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a> in an unrecoverable * manner. * @param maxHeaderListSize The max allowed size for a list of headers in bytes which was exceeded. * @throws Http2Exception a connection error. */ public static void headerListSizeExceeded(long maxHeaderListSize) throws Http2Exception { throw connectionError(PROTOCOL_ERROR, "Header size exceeded max " + "allowed size (%d)", maxHeaderListSize); } static void writeFrameHeaderInternal(ByteBuf out, int payloadLength, byte type, Http2Flags flags, int streamId) { out.writeMedium(payloadLength); out.writeByte(type); out.writeByte(flags.value()); out.writeInt(streamId); } /** * Provides the ability to associate the outcome of multiple {@link ChannelPromise} * objects into a single {@link ChannelPromise} object. */ static final class SimpleChannelPromiseAggregator extends DefaultChannelPromise { private final ChannelPromise promise; private int expectedCount; private int doneCount; private Throwable lastFailure; private boolean doneAllocating; SimpleChannelPromiseAggregator(ChannelPromise promise, Channel c, EventExecutor e) { super(c, e); assert promise != null && !promise.isDone(); this.promise = promise; } /** * Allocate a new promise which will be used to aggregate the overall success of this promise aggregator. * @return A new promise which will be aggregated. * {@code null} if {@link #doneAllocatingPromises()} was previously called. */ public ChannelPromise newPromise() { assert !doneAllocating : "Done allocating. No more promises can be allocated."; ++expectedCount; return this; } /** * Signify that no more {@link #newPromise()} allocations will be made. * The aggregation can not be successful until this method is called. * @return The promise that is the aggregation of all promises allocated with {@link #newPromise()}. */ public ChannelPromise doneAllocatingPromises() { if (!doneAllocating) { doneAllocating = true; if (doneCount == expectedCount || expectedCount == 0) { return setPromise(); } } return this; } @Override public boolean tryFailure(Throwable cause) { if (allowFailure()) { ++doneCount; lastFailure = cause; if (allPromisesDone()) { return tryPromise(); } // TODO: We break the interface a bit here. // Multiple failure events can be processed without issue because this is an aggregation. return true; } return false; } /** * Fail this object if it has not already been failed. * <p> * This method will NOT throw an {@link IllegalStateException} if called multiple times * because that may be expected. */ @Override public ChannelPromise setFailure(Throwable cause) { if (allowFailure()) { ++doneCount; lastFailure = cause; if (allPromisesDone()) { return setPromise(); } } return this; } @Override public ChannelPromise setSuccess(Void result) { if (awaitingPromises()) { ++doneCount; if (allPromisesDone()) { setPromise(); } } return this; } @Override public boolean trySuccess(Void result) { if (awaitingPromises()) { ++doneCount; if (allPromisesDone()) { return tryPromise(); } // TODO: We break the interface a bit here. // Multiple success events can be processed without issue because this is an aggregation. return true; } return false; } private boolean allowFailure() { return awaitingPromises() || expectedCount == 0; } private boolean awaitingPromises() { return doneCount < expectedCount; } private boolean allPromisesDone() { return doneCount == expectedCount && doneAllocating; } private ChannelPromise setPromise() { if (lastFailure == null) { promise.setSuccess(); return super.setSuccess(null); } else { promise.setFailure(lastFailure); return super.setFailure(lastFailure); } } private boolean tryPromise() { if (lastFailure == null) { promise.trySuccess(); return super.trySuccess(null); } else { promise.tryFailure(lastFailure); return super.tryFailure(lastFailure); } } } public static void verifyPadding(int padding) { if (padding < 0 || padding > MAX_PADDING) { throw new IllegalArgumentException(String.format("Invalid padding '%d'. Padding must be between 0 and " + "%d (inclusive).", padding, MAX_PADDING)); } } private Http2CodecUtil() { } }
gerdriesselmann/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2CodecUtil.java
Java
apache-2.0
16,850
/* * 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.kylin.cube.kv; public class RowConstants { public static final int ROWKEY_COL_DEFAULT_LENGTH = 256; // row key lower bound public static final byte ROWKEY_LOWER_BYTE = 0; // row key upper bound public static final byte ROWKEY_UPPER_BYTE = (byte) 0xff; // row key cuboid id length public static final int ROWKEY_CUBOIDID_LEN = 8; // row key shard length public static final int ROWKEY_SHARDID_LEN = 2; public static final int ROWKEY_SHARD_AND_CUBOID_LEN = ROWKEY_CUBOIDID_LEN + ROWKEY_SHARDID_LEN; public static final byte BYTE_ZERO = 0; public static final byte BYTE_ONE = 1; // row value delimiter public static final byte ROWVALUE_DELIMITER_BYTE = 7; public static final String ROWVALUE_DELIMITER_STRING = String.valueOf((char) 7); public static final byte[] ROWVALUE_DELIMITER_BYTES = { 7 }; public static final int ROWKEY_BUFFER_SIZE = 65 * 256;// a little more than 64 dimensions * 256 bytes each }
apache/kylin
core-cube/src/main/java/org/apache/kylin/cube/kv/RowConstants.java
Java
apache-2.0
1,808
/* * Copyright © 2012-2014 Cask Data, Inc. * * 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 co.cask.coopr.http.guice; import co.cask.coopr.common.conf.Constants; import co.cask.coopr.http.handler.AdminHandler; import co.cask.coopr.http.handler.ClusterHandler; import co.cask.coopr.http.handler.MetricHandler; import co.cask.coopr.http.handler.NodeHandler; import co.cask.coopr.http.handler.PluginHandler; import co.cask.coopr.http.handler.ProvisionerHandler; import co.cask.coopr.http.handler.RPCHandler; import co.cask.coopr.http.handler.StatusHandler; import co.cask.coopr.http.handler.SuperadminHandler; import co.cask.coopr.http.handler.TaskHandler; import co.cask.coopr.http.handler.UserHandler; import co.cask.http.HttpHandler; import com.google.inject.AbstractModule; import com.google.inject.multibindings.Multibinder; import com.google.inject.name.Names; /** * Guice bindings for http related classes. */ public class HttpModule extends AbstractModule { @Override protected void configure() { Multibinder<HttpHandler> externalHandlerBinder = Multibinder.newSetBinder(binder(), HttpHandler.class, Names.named(Constants.HandlersNames.EXTERNAL)); externalHandlerBinder.addBinding().to(AdminHandler.class); externalHandlerBinder.addBinding().to(ClusterHandler.class); externalHandlerBinder.addBinding().to(NodeHandler.class); externalHandlerBinder.addBinding().to(StatusHandler.class); externalHandlerBinder.addBinding().to(RPCHandler.class); externalHandlerBinder.addBinding().to(SuperadminHandler.class); externalHandlerBinder.addBinding().to(PluginHandler.class); externalHandlerBinder.addBinding().to(UserHandler.class); externalHandlerBinder.addBinding().to(MetricHandler.class); Multibinder<HttpHandler> internalHandlerBinder = Multibinder.newSetBinder(binder(), HttpHandler.class, Names.named(Constants.HandlersNames.INTERNAL)); internalHandlerBinder.addBinding().to(TaskHandler.class); internalHandlerBinder.addBinding().to(ProvisionerHandler.class); } }
caskdata/coopr
coopr-server/src/main/java/co/cask/coopr/http/guice/HttpModule.java
Java
apache-2.0
2,568
/** * Copyright 2005-2016 Red Hat, Inc. * <p> * Red Hat 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package org.arquillian.cube.kubernetes.impl.event; import org.arquillian.cube.kubernetes.impl.DefaultSession; import org.arquillian.cube.kubernetes.impl.SessionCreatedEvent; public class Stop extends SessionCreatedEvent { public Stop(DefaultSession session) { super(session); } }
arquillian/arquillian-cube
kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/event/Stop.java
Java
apache-2.0
937
// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: combos/unmarshaler/theproto3.proto package theproto3 import ( bytes "bytes" compress_gzip "compress/gzip" encoding_binary "encoding/binary" fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_protoc_gen_gogo_descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" both "github.com/gogo/protobuf/test/combos/both" github_com_gogo_protobuf_test_custom "github.com/gogo/protobuf/test/custom" io "io" io_ioutil "io/ioutil" math "math" math_bits "math/bits" reflect "reflect" strconv "strconv" strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MapEnum int32 const ( MA MapEnum = 0 MB MapEnum = 1 MC MapEnum = 2 ) var MapEnum_name = map[int32]string{ 0: "MA", 1: "MB", 2: "MC", } var MapEnum_value = map[string]int32{ "MA": 0, "MB": 1, "MC": 2, } func (MapEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{0} } type Message_Humour int32 const ( UNKNOWN Message_Humour = 0 PUNS Message_Humour = 1 SLAPSTICK Message_Humour = 2 BILL_BAILEY Message_Humour = 3 ) var Message_Humour_name = map[int32]string{ 0: "UNKNOWN", 1: "PUNS", 2: "SLAPSTICK", 3: "BILL_BAILEY", } var Message_Humour_value = map[string]int32{ "UNKNOWN": 0, "PUNS": 1, "SLAPSTICK": 2, "BILL_BAILEY": 3, } func (Message_Humour) EnumDescriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{0, 0} } type Message struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,proto3,enum=theproto3.Message_Humour" json:"hilarity,omitempty"` HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm,proto3" json:"height_in_cm,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount,proto3" json:"result_count,omitempty"` TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman,proto3" json:"true_scotsman,omitempty"` Score float32 `protobuf:"fixed32,9,opt,name=score,proto3" json:"score,omitempty"` Key []uint64 `protobuf:"varint,5,rep,packed,name=key,proto3" json:"key,omitempty"` Nested *Nested `protobuf:"bytes,6,opt,name=nested,proto3" json:"nested,omitempty"` Terrain map[int64]*Nested `protobuf:"bytes,10,rep,name=terrain,proto3" json:"terrain,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Proto2Field *both.NinOptNative `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field,proto3" json:"proto2_field,omitempty"` Proto2Value map[int64]*both.NinOptEnum `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value,proto3" json:"proto2_value,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *Message) Reset() { *m = Message{} } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{0} } func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Message.Marshal(b, m, deterministic) } func (m *Message) XXX_Merge(src proto.Message) { xxx_messageInfo_Message.Merge(m, src) } func (m *Message) XXX_Size() int { return xxx_messageInfo_Message.Size(m) } func (m *Message) XXX_DiscardUnknown() { xxx_messageInfo_Message.DiscardUnknown(m) } var xxx_messageInfo_Message proto.InternalMessageInfo type Nested struct { Bunny string `protobuf:"bytes,1,opt,name=bunny,proto3" json:"bunny,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *Nested) Reset() { *m = Nested{} } func (*Nested) ProtoMessage() {} func (*Nested) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{1} } func (m *Nested) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Nested.Marshal(b, m, deterministic) } func (m *Nested) XXX_Merge(src proto.Message) { xxx_messageInfo_Nested.Merge(m, src) } func (m *Nested) XXX_Size() int { return xxx_messageInfo_Nested.Size(m) } func (m *Nested) XXX_DiscardUnknown() { xxx_messageInfo_Nested.DiscardUnknown(m) } var xxx_messageInfo_Nested proto.InternalMessageInfo type AllMaps struct { StringToDoubleMap map[string]float64 `protobuf:"bytes,1,rep,name=StringToDoubleMap,proto3" json:"StringToDoubleMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` StringToFloatMap map[string]float32 `protobuf:"bytes,2,rep,name=StringToFloatMap,proto3" json:"StringToFloatMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` Int32Map map[int32]int32 `protobuf:"bytes,3,rep,name=Int32Map,proto3" json:"Int32Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Int64Map map[int64]int64 `protobuf:"bytes,4,rep,name=Int64Map,proto3" json:"Int64Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Uint32Map map[uint32]uint32 `protobuf:"bytes,5,rep,name=Uint32Map,proto3" json:"Uint32Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Uint64Map map[uint64]uint64 `protobuf:"bytes,6,rep,name=Uint64Map,proto3" json:"Uint64Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Sint32Map map[int32]int32 `protobuf:"bytes,7,rep,name=Sint32Map,proto3" json:"Sint32Map,omitempty" protobuf_key:"zigzag32,1,opt,name=key,proto3" protobuf_val:"zigzag32,2,opt,name=value,proto3"` Sint64Map map[int64]int64 `protobuf:"bytes,8,rep,name=Sint64Map,proto3" json:"Sint64Map,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"zigzag64,2,opt,name=value,proto3"` Fixed32Map map[uint32]uint32 `protobuf:"bytes,9,rep,name=Fixed32Map,proto3" json:"Fixed32Map,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` Sfixed32Map map[int32]int32 `protobuf:"bytes,10,rep,name=Sfixed32Map,proto3" json:"Sfixed32Map,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` Fixed64Map map[uint64]uint64 `protobuf:"bytes,11,rep,name=Fixed64Map,proto3" json:"Fixed64Map,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` Sfixed64Map map[int64]int64 `protobuf:"bytes,12,rep,name=Sfixed64Map,proto3" json:"Sfixed64Map,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` BoolMap map[bool]bool `protobuf:"bytes,13,rep,name=BoolMap,proto3" json:"BoolMap,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` StringMap map[string]string `protobuf:"bytes,14,rep,name=StringMap,proto3" json:"StringMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` StringToBytesMap map[string][]byte `protobuf:"bytes,15,rep,name=StringToBytesMap,proto3" json:"StringToBytesMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` StringToEnumMap map[string]MapEnum `protobuf:"bytes,16,rep,name=StringToEnumMap,proto3" json:"StringToEnumMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=theproto3.MapEnum"` StringToMsgMap map[string]*FloatingPoint `protobuf:"bytes,17,rep,name=StringToMsgMap,proto3" json:"StringToMsgMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *AllMaps) Reset() { *m = AllMaps{} } func (*AllMaps) ProtoMessage() {} func (*AllMaps) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{2} } func (m *AllMaps) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *AllMaps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_AllMaps.Marshal(b, m, deterministic) } func (m *AllMaps) XXX_Merge(src proto.Message) { xxx_messageInfo_AllMaps.Merge(m, src) } func (m *AllMaps) XXX_Size() int { return xxx_messageInfo_AllMaps.Size(m) } func (m *AllMaps) XXX_DiscardUnknown() { xxx_messageInfo_AllMaps.DiscardUnknown(m) } var xxx_messageInfo_AllMaps proto.InternalMessageInfo type AllMapsOrdered struct { StringToDoubleMap map[string]float64 `protobuf:"bytes,1,rep,name=StringToDoubleMap,proto3" json:"StringToDoubleMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` StringToFloatMap map[string]float32 `protobuf:"bytes,2,rep,name=StringToFloatMap,proto3" json:"StringToFloatMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` Int32Map map[int32]int32 `protobuf:"bytes,3,rep,name=Int32Map,proto3" json:"Int32Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Int64Map map[int64]int64 `protobuf:"bytes,4,rep,name=Int64Map,proto3" json:"Int64Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Uint32Map map[uint32]uint32 `protobuf:"bytes,5,rep,name=Uint32Map,proto3" json:"Uint32Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Uint64Map map[uint64]uint64 `protobuf:"bytes,6,rep,name=Uint64Map,proto3" json:"Uint64Map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Sint32Map map[int32]int32 `protobuf:"bytes,7,rep,name=Sint32Map,proto3" json:"Sint32Map,omitempty" protobuf_key:"zigzag32,1,opt,name=key,proto3" protobuf_val:"zigzag32,2,opt,name=value,proto3"` Sint64Map map[int64]int64 `protobuf:"bytes,8,rep,name=Sint64Map,proto3" json:"Sint64Map,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"zigzag64,2,opt,name=value,proto3"` Fixed32Map map[uint32]uint32 `protobuf:"bytes,9,rep,name=Fixed32Map,proto3" json:"Fixed32Map,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` Sfixed32Map map[int32]int32 `protobuf:"bytes,10,rep,name=Sfixed32Map,proto3" json:"Sfixed32Map,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"` Fixed64Map map[uint64]uint64 `protobuf:"bytes,11,rep,name=Fixed64Map,proto3" json:"Fixed64Map,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` Sfixed64Map map[int64]int64 `protobuf:"bytes,12,rep,name=Sfixed64Map,proto3" json:"Sfixed64Map,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` BoolMap map[bool]bool `protobuf:"bytes,13,rep,name=BoolMap,proto3" json:"BoolMap,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` StringMap map[string]string `protobuf:"bytes,14,rep,name=StringMap,proto3" json:"StringMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` StringToBytesMap map[string][]byte `protobuf:"bytes,15,rep,name=StringToBytesMap,proto3" json:"StringToBytesMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` StringToEnumMap map[string]MapEnum `protobuf:"bytes,16,rep,name=StringToEnumMap,proto3" json:"StringToEnumMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=theproto3.MapEnum"` StringToMsgMap map[string]*FloatingPoint `protobuf:"bytes,17,rep,name=StringToMsgMap,proto3" json:"StringToMsgMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *AllMapsOrdered) Reset() { *m = AllMapsOrdered{} } func (*AllMapsOrdered) ProtoMessage() {} func (*AllMapsOrdered) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{3} } func (m *AllMapsOrdered) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *AllMapsOrdered) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_AllMapsOrdered.Marshal(b, m, deterministic) } func (m *AllMapsOrdered) XXX_Merge(src proto.Message) { xxx_messageInfo_AllMapsOrdered.Merge(m, src) } func (m *AllMapsOrdered) XXX_Size() int { return xxx_messageInfo_AllMapsOrdered.Size(m) } func (m *AllMapsOrdered) XXX_DiscardUnknown() { xxx_messageInfo_AllMapsOrdered.DiscardUnknown(m) } var xxx_messageInfo_AllMapsOrdered proto.InternalMessageInfo type MessageWithMap struct { NameMapping map[int32]string `protobuf:"bytes,1,rep,name=name_mapping,json=nameMapping,proto3" json:"name_mapping,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` MsgMapping map[int64]*FloatingPoint `protobuf:"bytes,2,rep,name=msg_mapping,json=msgMapping,proto3" json:"msg_mapping,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` ByteMapping map[bool][]byte `protobuf:"bytes,3,rep,name=byte_mapping,json=byteMapping,proto3" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{4} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic) } func (m *MessageWithMap) XXX_Merge(src proto.Message) { xxx_messageInfo_MessageWithMap.Merge(m, src) } func (m *MessageWithMap) XXX_Size() int { return xxx_messageInfo_MessageWithMap.Size(m) } func (m *MessageWithMap) XXX_DiscardUnknown() { xxx_messageInfo_MessageWithMap.DiscardUnknown(m) } var xxx_messageInfo_MessageWithMap proto.InternalMessageInfo type FloatingPoint struct { F float64 `protobuf:"fixed64,1,opt,name=f,proto3" json:"f,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } func (*FloatingPoint) ProtoMessage() {} func (*FloatingPoint) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{5} } func (m *FloatingPoint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic) } func (m *FloatingPoint) XXX_Merge(src proto.Message) { xxx_messageInfo_FloatingPoint.Merge(m, src) } func (m *FloatingPoint) XXX_Size() int { return xxx_messageInfo_FloatingPoint.Size(m) } func (m *FloatingPoint) XXX_DiscardUnknown() { xxx_messageInfo_FloatingPoint.DiscardUnknown(m) } var xxx_messageInfo_FloatingPoint proto.InternalMessageInfo type Uint128Pair struct { Left github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,1,opt,name=left,proto3,customtype=github.com/gogo/protobuf/test/custom.Uint128" json:"left"` Right *github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,2,opt,name=right,proto3,customtype=github.com/gogo/protobuf/test/custom.Uint128" json:"right,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *Uint128Pair) Reset() { *m = Uint128Pair{} } func (*Uint128Pair) ProtoMessage() {} func (*Uint128Pair) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{6} } func (m *Uint128Pair) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Uint128Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Uint128Pair.Marshal(b, m, deterministic) } func (m *Uint128Pair) XXX_Merge(src proto.Message) { xxx_messageInfo_Uint128Pair.Merge(m, src) } func (m *Uint128Pair) XXX_Size() int { return xxx_messageInfo_Uint128Pair.Size(m) } func (m *Uint128Pair) XXX_DiscardUnknown() { xxx_messageInfo_Uint128Pair.DiscardUnknown(m) } var xxx_messageInfo_Uint128Pair proto.InternalMessageInfo type ContainsNestedMap struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *ContainsNestedMap) Reset() { *m = ContainsNestedMap{} } func (*ContainsNestedMap) ProtoMessage() {} func (*ContainsNestedMap) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{7} } func (m *ContainsNestedMap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ContainsNestedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ContainsNestedMap.Marshal(b, m, deterministic) } func (m *ContainsNestedMap) XXX_Merge(src proto.Message) { xxx_messageInfo_ContainsNestedMap.Merge(m, src) } func (m *ContainsNestedMap) XXX_Size() int { return xxx_messageInfo_ContainsNestedMap.Size(m) } func (m *ContainsNestedMap) XXX_DiscardUnknown() { xxx_messageInfo_ContainsNestedMap.DiscardUnknown(m) } var xxx_messageInfo_ContainsNestedMap proto.InternalMessageInfo type ContainsNestedMap_NestedMap struct { NestedMapField map[string]float64 `protobuf:"bytes,1,rep,name=NestedMapField,proto3" json:"NestedMapField,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *ContainsNestedMap_NestedMap) Reset() { *m = ContainsNestedMap_NestedMap{} } func (*ContainsNestedMap_NestedMap) ProtoMessage() {} func (*ContainsNestedMap_NestedMap) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{7, 0} } func (m *ContainsNestedMap_NestedMap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *ContainsNestedMap_NestedMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ContainsNestedMap_NestedMap.Marshal(b, m, deterministic) } func (m *ContainsNestedMap_NestedMap) XXX_Merge(src proto.Message) { xxx_messageInfo_ContainsNestedMap_NestedMap.Merge(m, src) } func (m *ContainsNestedMap_NestedMap) XXX_Size() int { return xxx_messageInfo_ContainsNestedMap_NestedMap.Size(m) } func (m *ContainsNestedMap_NestedMap) XXX_DiscardUnknown() { xxx_messageInfo_ContainsNestedMap_NestedMap.DiscardUnknown(m) } var xxx_messageInfo_ContainsNestedMap_NestedMap proto.InternalMessageInfo type NotPacked struct { Key []uint64 `protobuf:"varint,5,rep,name=key,proto3" json:"key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *NotPacked) Reset() { *m = NotPacked{} } func (*NotPacked) ProtoMessage() {} func (*NotPacked) Descriptor() ([]byte, []int) { return fileDescriptor_e24bba79c1e35a1f, []int{8} } func (m *NotPacked) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *NotPacked) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NotPacked.Marshal(b, m, deterministic) } func (m *NotPacked) XXX_Merge(src proto.Message) { xxx_messageInfo_NotPacked.Merge(m, src) } func (m *NotPacked) XXX_Size() int { return xxx_messageInfo_NotPacked.Size(m) } func (m *NotPacked) XXX_DiscardUnknown() { xxx_messageInfo_NotPacked.DiscardUnknown(m) } var xxx_messageInfo_NotPacked proto.InternalMessageInfo func init() { proto.RegisterEnum("theproto3.MapEnum", MapEnum_name, MapEnum_value) proto.RegisterEnum("theproto3.Message_Humour", Message_Humour_name, Message_Humour_value) proto.RegisterType((*Message)(nil), "theproto3.Message") proto.RegisterMapType((map[int64]*both.NinOptEnum)(nil), "theproto3.Message.Proto2ValueEntry") proto.RegisterMapType((map[int64]*Nested)(nil), "theproto3.Message.TerrainEntry") proto.RegisterType((*Nested)(nil), "theproto3.Nested") proto.RegisterType((*AllMaps)(nil), "theproto3.AllMaps") proto.RegisterMapType((map[bool]bool)(nil), "theproto3.AllMaps.BoolMapEntry") proto.RegisterMapType((map[uint32]uint32)(nil), "theproto3.AllMaps.Fixed32MapEntry") proto.RegisterMapType((map[uint64]uint64)(nil), "theproto3.AllMaps.Fixed64MapEntry") proto.RegisterMapType((map[int32]int32)(nil), "theproto3.AllMaps.Int32MapEntry") proto.RegisterMapType((map[int64]int64)(nil), "theproto3.AllMaps.Int64MapEntry") proto.RegisterMapType((map[int32]int32)(nil), "theproto3.AllMaps.Sfixed32MapEntry") proto.RegisterMapType((map[int64]int64)(nil), "theproto3.AllMaps.Sfixed64MapEntry") proto.RegisterMapType((map[int32]int32)(nil), "theproto3.AllMaps.Sint32MapEntry") proto.RegisterMapType((map[int64]int64)(nil), "theproto3.AllMaps.Sint64MapEntry") proto.RegisterMapType((map[string]string)(nil), "theproto3.AllMaps.StringMapEntry") proto.RegisterMapType((map[string][]byte)(nil), "theproto3.AllMaps.StringToBytesMapEntry") proto.RegisterMapType((map[string]float64)(nil), "theproto3.AllMaps.StringToDoubleMapEntry") proto.RegisterMapType((map[string]MapEnum)(nil), "theproto3.AllMaps.StringToEnumMapEntry") proto.RegisterMapType((map[string]float32)(nil), "theproto3.AllMaps.StringToFloatMapEntry") proto.RegisterMapType((map[string]*FloatingPoint)(nil), "theproto3.AllMaps.StringToMsgMapEntry") proto.RegisterMapType((map[uint32]uint32)(nil), "theproto3.AllMaps.Uint32MapEntry") proto.RegisterMapType((map[uint64]uint64)(nil), "theproto3.AllMaps.Uint64MapEntry") proto.RegisterType((*AllMapsOrdered)(nil), "theproto3.AllMapsOrdered") proto.RegisterMapType((map[bool]bool)(nil), "theproto3.AllMapsOrdered.BoolMapEntry") proto.RegisterMapType((map[uint32]uint32)(nil), "theproto3.AllMapsOrdered.Fixed32MapEntry") proto.RegisterMapType((map[uint64]uint64)(nil), "theproto3.AllMapsOrdered.Fixed64MapEntry") proto.RegisterMapType((map[int32]int32)(nil), "theproto3.AllMapsOrdered.Int32MapEntry") proto.RegisterMapType((map[int64]int64)(nil), "theproto3.AllMapsOrdered.Int64MapEntry") proto.RegisterMapType((map[int32]int32)(nil), "theproto3.AllMapsOrdered.Sfixed32MapEntry") proto.RegisterMapType((map[int64]int64)(nil), "theproto3.AllMapsOrdered.Sfixed64MapEntry") proto.RegisterMapType((map[int32]int32)(nil), "theproto3.AllMapsOrdered.Sint32MapEntry") proto.RegisterMapType((map[int64]int64)(nil), "theproto3.AllMapsOrdered.Sint64MapEntry") proto.RegisterMapType((map[string]string)(nil), "theproto3.AllMapsOrdered.StringMapEntry") proto.RegisterMapType((map[string][]byte)(nil), "theproto3.AllMapsOrdered.StringToBytesMapEntry") proto.RegisterMapType((map[string]float64)(nil), "theproto3.AllMapsOrdered.StringToDoubleMapEntry") proto.RegisterMapType((map[string]MapEnum)(nil), "theproto3.AllMapsOrdered.StringToEnumMapEntry") proto.RegisterMapType((map[string]float32)(nil), "theproto3.AllMapsOrdered.StringToFloatMapEntry") proto.RegisterMapType((map[string]*FloatingPoint)(nil), "theproto3.AllMapsOrdered.StringToMsgMapEntry") proto.RegisterMapType((map[uint32]uint32)(nil), "theproto3.AllMapsOrdered.Uint32MapEntry") proto.RegisterMapType((map[uint64]uint64)(nil), "theproto3.AllMapsOrdered.Uint64MapEntry") proto.RegisterType((*MessageWithMap)(nil), "theproto3.MessageWithMap") proto.RegisterMapType((map[bool][]byte)(nil), "theproto3.MessageWithMap.ByteMappingEntry") proto.RegisterMapType((map[int64]*FloatingPoint)(nil), "theproto3.MessageWithMap.MsgMappingEntry") proto.RegisterMapType((map[int32]string)(nil), "theproto3.MessageWithMap.NameMappingEntry") proto.RegisterType((*FloatingPoint)(nil), "theproto3.FloatingPoint") proto.RegisterType((*Uint128Pair)(nil), "theproto3.Uint128Pair") proto.RegisterType((*ContainsNestedMap)(nil), "theproto3.ContainsNestedMap") proto.RegisterType((*ContainsNestedMap_NestedMap)(nil), "theproto3.ContainsNestedMap.NestedMap") proto.RegisterMapType((map[string]float64)(nil), "theproto3.ContainsNestedMap.NestedMap.NestedMapFieldEntry") proto.RegisterType((*NotPacked)(nil), "theproto3.NotPacked") } func init() { proto.RegisterFile("combos/unmarshaler/theproto3.proto", fileDescriptor_e24bba79c1e35a1f) } var fileDescriptor_e24bba79c1e35a1f = []byte{ // 1612 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x99, 0xcf, 0x6f, 0xdb, 0x46, 0x16, 0xc7, 0x35, 0xfa, 0xad, 0xa7, 0x1f, 0xa6, 0x27, 0xd9, 0x85, 0xd6, 0xc0, 0xd2, 0xb2, 0x02, 0x24, 0x4a, 0xb0, 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5b, 0x82, 0x84, 0x7b, 0xfa, 0x71, 0x1c, 0xc2, 0x5b, 0x6b, 0x4a, 0x88, 0xfd, 0x56, 0x14, 0xc4, 0x7e, 0xab, 0x4a, 0xb8, 0xb2, 0x79, 0x7a, 0xa6, 0x86, 0x5e, 0x9e, 0xa9, 0xa1, 0x5f, 0xcf, 0xd4, 0xd0, 0xeb, 0x33, 0x15, 0xbd, 0x39, 0x53, 0xd1, 0xdb, 0x33, 0x15, 0xbd, 0x3b, 0x53, 0xd1, 0xf3, 0x81, 0x8a, 0xbe, 0x1b, 0xa8, 0xe8, 0xfb, 0x81, 0x8a, 0x7e, 0x1c, 0xa8, 0xe8, 0xa7, 0x81, 0x8a, 0x4e, 0x07, 0x6a, 0xe8, 0xe5, 0x40, 0x45, 0xaf, 0x07, 0x2a, 0x7a, 0x33, 0x50, 0x43, 0x6f, 0x07, 0x2a, 0x7a, 0x37, 0x50, 0x43, 0xcf, 0x7f, 0x57, 0x43, 0xad, 0x38, 0x5f, 0x9e, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xda, 0xba, 0x48, 0xa4, 0x67, 0x1a, 0x00, 0x00, } func (this *Message) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *Nested) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *AllMaps) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *AllMapsOrdered) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *MessageWithMap) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *FloatingPoint) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *Uint128Pair) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *ContainsNestedMap) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *ContainsNestedMap_NestedMap) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func (this *NotPacked) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { return Theproto3Description() } func Theproto3Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { d := &github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet{} var gzipped = []byte{ // 8097 bytes of a gzipped FileDescriptorSet 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x7d, 0x5b, 0x70, 0x23, 0xd7, 0x99, 0x1e, 0x1b, 0x0d, 0x90, 0xc0, 0x0f, 0x90, 0x6c, 0x36, 0x67, 0x28, 0x88, 0x1a, 0x91, 0x33, 0xd0, 0x68, 0x44, 0xd1, 0x12, 0x67, 0x86, 0xc3, 0xb9, 0x61, 0x2c, 0x69, 0x01, 0x10, 0x1c, 0x71, 0x4c, 0x82, 0x74, 0x93, 0xb4, 0x34, 0x56, 0x12, 0x54, 0x13, 0x38, 0x24, 0x21, 0x01, 0xdd, 0x58, 0x74, 0x43, 0x12, 0x55, 0xa9, 0x94, 0xb2, 0x4e, 0x36, 0xde, 0xdc, 0x93, 0x4d, 0x2a, 0x5e, 0xc7, 0x17, 0x79, 0xb7, 0x76, 0xed, 0xdd, 0xdc, 0xbc, 0xce, 0xc6, 0xd9, 0x75, 0x52, 0x59, 0xe5, 0xc1, 0xc9, 0xe4, 0x25, 0xe5, 0x4d, 0x5e, 0x52, 0xae, 0x94, 0xca, 0x1a, 0x3b, 0xb5, 0x4e, 0xe2, 0x24, 0xce, 0x46, 0x55, 0x71, 0x95, 0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, 0xd3, 0x21, 0x62, 0x27, 0x99, 0x90, 0x73, 0xe7, 0x20, 0x55, 0xb1, 0x5d, 0xfa, 0xcb, 0x39, 0xfa, 0x29, 0x61, 0x57, 0xa1, 0x18, 0xd3, 0x46, 0x08, 0x78, 0xf1, 0x1c, 0x8c, 0xb1, 0xec, 0xd7, 0x47, 0x21, 0xb6, 0x59, 0xd0, 0x46, 0xc8, 0xff, 0x45, 0x4d, 0x21, 0xff, 0x97, 0xb4, 0x58, 0x71, 0xe3, 0x01, 0x76, 0x9a, 0x46, 0xfa, 0xed, 0x34, 0xed, 0x8f, 0x52, 0xf3, 0xfc, 0x49, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x79, 0x7c, 0xa8, 0xc6, 0x83, 0x00, 0x00, } r := bytes.NewReader(gzipped) gzipr, err := compress_gzip.NewReader(r) if err != nil { panic(err) } ungzipped, err := io_ioutil.ReadAll(gzipr) if err != nil { panic(err) } if err := github_com_gogo_protobuf_proto.Unmarshal(ungzipped, d); err != nil { panic(err) } return d } func (x MapEnum) String() string { s, ok := MapEnum_name[int32(x)] if ok { return s } return strconv.Itoa(int(x)) } func (x Message_Humour) String() string { s, ok := Message_Humour_name[int32(x)] if ok { return s } return strconv.Itoa(int(x)) } func (this *Message) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Message) if !ok { that2, ok := that.(Message) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *Message") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Message but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Message but is not nil && this == nil") } if this.Name != that1.Name { return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name) } if this.Hilarity != that1.Hilarity { return fmt.Errorf("Hilarity this(%v) Not Equal that(%v)", this.Hilarity, that1.Hilarity) } if this.HeightInCm != that1.HeightInCm { return fmt.Errorf("HeightInCm this(%v) Not Equal that(%v)", this.HeightInCm, that1.HeightInCm) } if !bytes.Equal(this.Data, that1.Data) { return fmt.Errorf("Data this(%v) Not Equal that(%v)", this.Data, that1.Data) } if this.ResultCount != that1.ResultCount { return fmt.Errorf("ResultCount this(%v) Not Equal that(%v)", this.ResultCount, that1.ResultCount) } if this.TrueScotsman != that1.TrueScotsman { return fmt.Errorf("TrueScotsman this(%v) Not Equal that(%v)", this.TrueScotsman, that1.TrueScotsman) } if this.Score != that1.Score { return fmt.Errorf("Score this(%v) Not Equal that(%v)", this.Score, that1.Score) } if len(this.Key) != len(that1.Key) { return fmt.Errorf("Key this(%v) Not Equal that(%v)", len(this.Key), len(that1.Key)) } for i := range this.Key { if this.Key[i] != that1.Key[i] { return fmt.Errorf("Key this[%v](%v) Not Equal that[%v](%v)", i, this.Key[i], i, that1.Key[i]) } } if !this.Nested.Equal(that1.Nested) { return fmt.Errorf("Nested this(%v) Not Equal that(%v)", this.Nested, that1.Nested) } if len(this.Terrain) != len(that1.Terrain) { return fmt.Errorf("Terrain this(%v) Not Equal that(%v)", len(this.Terrain), len(that1.Terrain)) } for i := range this.Terrain { if !this.Terrain[i].Equal(that1.Terrain[i]) { return fmt.Errorf("Terrain this[%v](%v) Not Equal that[%v](%v)", i, this.Terrain[i], i, that1.Terrain[i]) } } if !this.Proto2Field.Equal(that1.Proto2Field) { return fmt.Errorf("Proto2Field this(%v) Not Equal that(%v)", this.Proto2Field, that1.Proto2Field) } if len(this.Proto2Value) != len(that1.Proto2Value) { return fmt.Errorf("Proto2Value this(%v) Not Equal that(%v)", len(this.Proto2Value), len(that1.Proto2Value)) } for i := range this.Proto2Value { if !this.Proto2Value[i].Equal(that1.Proto2Value[i]) { return fmt.Errorf("Proto2Value this[%v](%v) Not Equal that[%v](%v)", i, this.Proto2Value[i], i, that1.Proto2Value[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Message) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*Message) if !ok { that2, ok := that.(Message) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if this.Name != that1.Name { return false } if this.Hilarity != that1.Hilarity { return false } if this.HeightInCm != that1.HeightInCm { return false } if !bytes.Equal(this.Data, that1.Data) { return false } if this.ResultCount != that1.ResultCount { return false } if this.TrueScotsman != that1.TrueScotsman { return false } if this.Score != that1.Score { return false } if len(this.Key) != len(that1.Key) { return false } for i := range this.Key { if this.Key[i] != that1.Key[i] { return false } } if !this.Nested.Equal(that1.Nested) { return false } if len(this.Terrain) != len(that1.Terrain) { return false } for i := range this.Terrain { if !this.Terrain[i].Equal(that1.Terrain[i]) { return false } } if !this.Proto2Field.Equal(that1.Proto2Field) { return false } if len(this.Proto2Value) != len(that1.Proto2Value) { return false } for i := range this.Proto2Value { if !this.Proto2Value[i].Equal(that1.Proto2Value[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Nested) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Nested) if !ok { that2, ok := that.(Nested) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *Nested") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Nested but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Nested but is not nil && this == nil") } if this.Bunny != that1.Bunny { return fmt.Errorf("Bunny this(%v) Not Equal that(%v)", this.Bunny, that1.Bunny) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Nested) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*Nested) if !ok { that2, ok := that.(Nested) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if this.Bunny != that1.Bunny { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *AllMaps) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*AllMaps) if !ok { that2, ok := that.(AllMaps) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *AllMaps") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *AllMaps but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *AllMaps but is not nil && this == nil") } if len(this.StringToDoubleMap) != len(that1.StringToDoubleMap) { return fmt.Errorf("StringToDoubleMap this(%v) Not Equal that(%v)", len(this.StringToDoubleMap), len(that1.StringToDoubleMap)) } for i := range this.StringToDoubleMap { if this.StringToDoubleMap[i] != that1.StringToDoubleMap[i] { return fmt.Errorf("StringToDoubleMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToDoubleMap[i], i, that1.StringToDoubleMap[i]) } } if len(this.StringToFloatMap) != len(that1.StringToFloatMap) { return fmt.Errorf("StringToFloatMap this(%v) Not Equal that(%v)", len(this.StringToFloatMap), len(that1.StringToFloatMap)) } for i := range this.StringToFloatMap { if this.StringToFloatMap[i] != that1.StringToFloatMap[i] { return fmt.Errorf("StringToFloatMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToFloatMap[i], i, that1.StringToFloatMap[i]) } } if len(this.Int32Map) != len(that1.Int32Map) { return fmt.Errorf("Int32Map this(%v) Not Equal that(%v)", len(this.Int32Map), len(that1.Int32Map)) } for i := range this.Int32Map { if this.Int32Map[i] != that1.Int32Map[i] { return fmt.Errorf("Int32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Int32Map[i], i, that1.Int32Map[i]) } } if len(this.Int64Map) != len(that1.Int64Map) { return fmt.Errorf("Int64Map this(%v) Not Equal that(%v)", len(this.Int64Map), len(that1.Int64Map)) } for i := range this.Int64Map { if this.Int64Map[i] != that1.Int64Map[i] { return fmt.Errorf("Int64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Int64Map[i], i, that1.Int64Map[i]) } } if len(this.Uint32Map) != len(that1.Uint32Map) { return fmt.Errorf("Uint32Map this(%v) Not Equal that(%v)", len(this.Uint32Map), len(that1.Uint32Map)) } for i := range this.Uint32Map { if this.Uint32Map[i] != that1.Uint32Map[i] { return fmt.Errorf("Uint32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Uint32Map[i], i, that1.Uint32Map[i]) } } if len(this.Uint64Map) != len(that1.Uint64Map) { return fmt.Errorf("Uint64Map this(%v) Not Equal that(%v)", len(this.Uint64Map), len(that1.Uint64Map)) } for i := range this.Uint64Map { if this.Uint64Map[i] != that1.Uint64Map[i] { return fmt.Errorf("Uint64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Uint64Map[i], i, that1.Uint64Map[i]) } } if len(this.Sint32Map) != len(that1.Sint32Map) { return fmt.Errorf("Sint32Map this(%v) Not Equal that(%v)", len(this.Sint32Map), len(that1.Sint32Map)) } for i := range this.Sint32Map { if this.Sint32Map[i] != that1.Sint32Map[i] { return fmt.Errorf("Sint32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sint32Map[i], i, that1.Sint32Map[i]) } } if len(this.Sint64Map) != len(that1.Sint64Map) { return fmt.Errorf("Sint64Map this(%v) Not Equal that(%v)", len(this.Sint64Map), len(that1.Sint64Map)) } for i := range this.Sint64Map { if this.Sint64Map[i] != that1.Sint64Map[i] { return fmt.Errorf("Sint64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sint64Map[i], i, that1.Sint64Map[i]) } } if len(this.Fixed32Map) != len(that1.Fixed32Map) { return fmt.Errorf("Fixed32Map this(%v) Not Equal that(%v)", len(this.Fixed32Map), len(that1.Fixed32Map)) } for i := range this.Fixed32Map { if this.Fixed32Map[i] != that1.Fixed32Map[i] { return fmt.Errorf("Fixed32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Fixed32Map[i], i, that1.Fixed32Map[i]) } } if len(this.Sfixed32Map) != len(that1.Sfixed32Map) { return fmt.Errorf("Sfixed32Map this(%v) Not Equal that(%v)", len(this.Sfixed32Map), len(that1.Sfixed32Map)) } for i := range this.Sfixed32Map { if this.Sfixed32Map[i] != that1.Sfixed32Map[i] { return fmt.Errorf("Sfixed32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sfixed32Map[i], i, that1.Sfixed32Map[i]) } } if len(this.Fixed64Map) != len(that1.Fixed64Map) { return fmt.Errorf("Fixed64Map this(%v) Not Equal that(%v)", len(this.Fixed64Map), len(that1.Fixed64Map)) } for i := range this.Fixed64Map { if this.Fixed64Map[i] != that1.Fixed64Map[i] { return fmt.Errorf("Fixed64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Fixed64Map[i], i, that1.Fixed64Map[i]) } } if len(this.Sfixed64Map) != len(that1.Sfixed64Map) { return fmt.Errorf("Sfixed64Map this(%v) Not Equal that(%v)", len(this.Sfixed64Map), len(that1.Sfixed64Map)) } for i := range this.Sfixed64Map { if this.Sfixed64Map[i] != that1.Sfixed64Map[i] { return fmt.Errorf("Sfixed64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sfixed64Map[i], i, that1.Sfixed64Map[i]) } } if len(this.BoolMap) != len(that1.BoolMap) { return fmt.Errorf("BoolMap this(%v) Not Equal that(%v)", len(this.BoolMap), len(that1.BoolMap)) } for i := range this.BoolMap { if this.BoolMap[i] != that1.BoolMap[i] { return fmt.Errorf("BoolMap this[%v](%v) Not Equal that[%v](%v)", i, this.BoolMap[i], i, that1.BoolMap[i]) } } if len(this.StringMap) != len(that1.StringMap) { return fmt.Errorf("StringMap this(%v) Not Equal that(%v)", len(this.StringMap), len(that1.StringMap)) } for i := range this.StringMap { if this.StringMap[i] != that1.StringMap[i] { return fmt.Errorf("StringMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringMap[i], i, that1.StringMap[i]) } } if len(this.StringToBytesMap) != len(that1.StringToBytesMap) { return fmt.Errorf("StringToBytesMap this(%v) Not Equal that(%v)", len(this.StringToBytesMap), len(that1.StringToBytesMap)) } for i := range this.StringToBytesMap { if !bytes.Equal(this.StringToBytesMap[i], that1.StringToBytesMap[i]) { return fmt.Errorf("StringToBytesMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToBytesMap[i], i, that1.StringToBytesMap[i]) } } if len(this.StringToEnumMap) != len(that1.StringToEnumMap) { return fmt.Errorf("StringToEnumMap this(%v) Not Equal that(%v)", len(this.StringToEnumMap), len(that1.StringToEnumMap)) } for i := range this.StringToEnumMap { if this.StringToEnumMap[i] != that1.StringToEnumMap[i] { return fmt.Errorf("StringToEnumMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToEnumMap[i], i, that1.StringToEnumMap[i]) } } if len(this.StringToMsgMap) != len(that1.StringToMsgMap) { return fmt.Errorf("StringToMsgMap this(%v) Not Equal that(%v)", len(this.StringToMsgMap), len(that1.StringToMsgMap)) } for i := range this.StringToMsgMap { if !this.StringToMsgMap[i].Equal(that1.StringToMsgMap[i]) { return fmt.Errorf("StringToMsgMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToMsgMap[i], i, that1.StringToMsgMap[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *AllMaps) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*AllMaps) if !ok { that2, ok := that.(AllMaps) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if len(this.StringToDoubleMap) != len(that1.StringToDoubleMap) { return false } for i := range this.StringToDoubleMap { if this.StringToDoubleMap[i] != that1.StringToDoubleMap[i] { return false } } if len(this.StringToFloatMap) != len(that1.StringToFloatMap) { return false } for i := range this.StringToFloatMap { if this.StringToFloatMap[i] != that1.StringToFloatMap[i] { return false } } if len(this.Int32Map) != len(that1.Int32Map) { return false } for i := range this.Int32Map { if this.Int32Map[i] != that1.Int32Map[i] { return false } } if len(this.Int64Map) != len(that1.Int64Map) { return false } for i := range this.Int64Map { if this.Int64Map[i] != that1.Int64Map[i] { return false } } if len(this.Uint32Map) != len(that1.Uint32Map) { return false } for i := range this.Uint32Map { if this.Uint32Map[i] != that1.Uint32Map[i] { return false } } if len(this.Uint64Map) != len(that1.Uint64Map) { return false } for i := range this.Uint64Map { if this.Uint64Map[i] != that1.Uint64Map[i] { return false } } if len(this.Sint32Map) != len(that1.Sint32Map) { return false } for i := range this.Sint32Map { if this.Sint32Map[i] != that1.Sint32Map[i] { return false } } if len(this.Sint64Map) != len(that1.Sint64Map) { return false } for i := range this.Sint64Map { if this.Sint64Map[i] != that1.Sint64Map[i] { return false } } if len(this.Fixed32Map) != len(that1.Fixed32Map) { return false } for i := range this.Fixed32Map { if this.Fixed32Map[i] != that1.Fixed32Map[i] { return false } } if len(this.Sfixed32Map) != len(that1.Sfixed32Map) { return false } for i := range this.Sfixed32Map { if this.Sfixed32Map[i] != that1.Sfixed32Map[i] { return false } } if len(this.Fixed64Map) != len(that1.Fixed64Map) { return false } for i := range this.Fixed64Map { if this.Fixed64Map[i] != that1.Fixed64Map[i] { return false } } if len(this.Sfixed64Map) != len(that1.Sfixed64Map) { return false } for i := range this.Sfixed64Map { if this.Sfixed64Map[i] != that1.Sfixed64Map[i] { return false } } if len(this.BoolMap) != len(that1.BoolMap) { return false } for i := range this.BoolMap { if this.BoolMap[i] != that1.BoolMap[i] { return false } } if len(this.StringMap) != len(that1.StringMap) { return false } for i := range this.StringMap { if this.StringMap[i] != that1.StringMap[i] { return false } } if len(this.StringToBytesMap) != len(that1.StringToBytesMap) { return false } for i := range this.StringToBytesMap { if !bytes.Equal(this.StringToBytesMap[i], that1.StringToBytesMap[i]) { return false } } if len(this.StringToEnumMap) != len(that1.StringToEnumMap) { return false } for i := range this.StringToEnumMap { if this.StringToEnumMap[i] != that1.StringToEnumMap[i] { return false } } if len(this.StringToMsgMap) != len(that1.StringToMsgMap) { return false } for i := range this.StringToMsgMap { if !this.StringToMsgMap[i].Equal(that1.StringToMsgMap[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *AllMapsOrdered) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*AllMapsOrdered) if !ok { that2, ok := that.(AllMapsOrdered) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *AllMapsOrdered") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *AllMapsOrdered but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *AllMapsOrdered but is not nil && this == nil") } if len(this.StringToDoubleMap) != len(that1.StringToDoubleMap) { return fmt.Errorf("StringToDoubleMap this(%v) Not Equal that(%v)", len(this.StringToDoubleMap), len(that1.StringToDoubleMap)) } for i := range this.StringToDoubleMap { if this.StringToDoubleMap[i] != that1.StringToDoubleMap[i] { return fmt.Errorf("StringToDoubleMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToDoubleMap[i], i, that1.StringToDoubleMap[i]) } } if len(this.StringToFloatMap) != len(that1.StringToFloatMap) { return fmt.Errorf("StringToFloatMap this(%v) Not Equal that(%v)", len(this.StringToFloatMap), len(that1.StringToFloatMap)) } for i := range this.StringToFloatMap { if this.StringToFloatMap[i] != that1.StringToFloatMap[i] { return fmt.Errorf("StringToFloatMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToFloatMap[i], i, that1.StringToFloatMap[i]) } } if len(this.Int32Map) != len(that1.Int32Map) { return fmt.Errorf("Int32Map this(%v) Not Equal that(%v)", len(this.Int32Map), len(that1.Int32Map)) } for i := range this.Int32Map { if this.Int32Map[i] != that1.Int32Map[i] { return fmt.Errorf("Int32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Int32Map[i], i, that1.Int32Map[i]) } } if len(this.Int64Map) != len(that1.Int64Map) { return fmt.Errorf("Int64Map this(%v) Not Equal that(%v)", len(this.Int64Map), len(that1.Int64Map)) } for i := range this.Int64Map { if this.Int64Map[i] != that1.Int64Map[i] { return fmt.Errorf("Int64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Int64Map[i], i, that1.Int64Map[i]) } } if len(this.Uint32Map) != len(that1.Uint32Map) { return fmt.Errorf("Uint32Map this(%v) Not Equal that(%v)", len(this.Uint32Map), len(that1.Uint32Map)) } for i := range this.Uint32Map { if this.Uint32Map[i] != that1.Uint32Map[i] { return fmt.Errorf("Uint32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Uint32Map[i], i, that1.Uint32Map[i]) } } if len(this.Uint64Map) != len(that1.Uint64Map) { return fmt.Errorf("Uint64Map this(%v) Not Equal that(%v)", len(this.Uint64Map), len(that1.Uint64Map)) } for i := range this.Uint64Map { if this.Uint64Map[i] != that1.Uint64Map[i] { return fmt.Errorf("Uint64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Uint64Map[i], i, that1.Uint64Map[i]) } } if len(this.Sint32Map) != len(that1.Sint32Map) { return fmt.Errorf("Sint32Map this(%v) Not Equal that(%v)", len(this.Sint32Map), len(that1.Sint32Map)) } for i := range this.Sint32Map { if this.Sint32Map[i] != that1.Sint32Map[i] { return fmt.Errorf("Sint32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sint32Map[i], i, that1.Sint32Map[i]) } } if len(this.Sint64Map) != len(that1.Sint64Map) { return fmt.Errorf("Sint64Map this(%v) Not Equal that(%v)", len(this.Sint64Map), len(that1.Sint64Map)) } for i := range this.Sint64Map { if this.Sint64Map[i] != that1.Sint64Map[i] { return fmt.Errorf("Sint64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sint64Map[i], i, that1.Sint64Map[i]) } } if len(this.Fixed32Map) != len(that1.Fixed32Map) { return fmt.Errorf("Fixed32Map this(%v) Not Equal that(%v)", len(this.Fixed32Map), len(that1.Fixed32Map)) } for i := range this.Fixed32Map { if this.Fixed32Map[i] != that1.Fixed32Map[i] { return fmt.Errorf("Fixed32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Fixed32Map[i], i, that1.Fixed32Map[i]) } } if len(this.Sfixed32Map) != len(that1.Sfixed32Map) { return fmt.Errorf("Sfixed32Map this(%v) Not Equal that(%v)", len(this.Sfixed32Map), len(that1.Sfixed32Map)) } for i := range this.Sfixed32Map { if this.Sfixed32Map[i] != that1.Sfixed32Map[i] { return fmt.Errorf("Sfixed32Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sfixed32Map[i], i, that1.Sfixed32Map[i]) } } if len(this.Fixed64Map) != len(that1.Fixed64Map) { return fmt.Errorf("Fixed64Map this(%v) Not Equal that(%v)", len(this.Fixed64Map), len(that1.Fixed64Map)) } for i := range this.Fixed64Map { if this.Fixed64Map[i] != that1.Fixed64Map[i] { return fmt.Errorf("Fixed64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Fixed64Map[i], i, that1.Fixed64Map[i]) } } if len(this.Sfixed64Map) != len(that1.Sfixed64Map) { return fmt.Errorf("Sfixed64Map this(%v) Not Equal that(%v)", len(this.Sfixed64Map), len(that1.Sfixed64Map)) } for i := range this.Sfixed64Map { if this.Sfixed64Map[i] != that1.Sfixed64Map[i] { return fmt.Errorf("Sfixed64Map this[%v](%v) Not Equal that[%v](%v)", i, this.Sfixed64Map[i], i, that1.Sfixed64Map[i]) } } if len(this.BoolMap) != len(that1.BoolMap) { return fmt.Errorf("BoolMap this(%v) Not Equal that(%v)", len(this.BoolMap), len(that1.BoolMap)) } for i := range this.BoolMap { if this.BoolMap[i] != that1.BoolMap[i] { return fmt.Errorf("BoolMap this[%v](%v) Not Equal that[%v](%v)", i, this.BoolMap[i], i, that1.BoolMap[i]) } } if len(this.StringMap) != len(that1.StringMap) { return fmt.Errorf("StringMap this(%v) Not Equal that(%v)", len(this.StringMap), len(that1.StringMap)) } for i := range this.StringMap { if this.StringMap[i] != that1.StringMap[i] { return fmt.Errorf("StringMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringMap[i], i, that1.StringMap[i]) } } if len(this.StringToBytesMap) != len(that1.StringToBytesMap) { return fmt.Errorf("StringToBytesMap this(%v) Not Equal that(%v)", len(this.StringToBytesMap), len(that1.StringToBytesMap)) } for i := range this.StringToBytesMap { if !bytes.Equal(this.StringToBytesMap[i], that1.StringToBytesMap[i]) { return fmt.Errorf("StringToBytesMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToBytesMap[i], i, that1.StringToBytesMap[i]) } } if len(this.StringToEnumMap) != len(that1.StringToEnumMap) { return fmt.Errorf("StringToEnumMap this(%v) Not Equal that(%v)", len(this.StringToEnumMap), len(that1.StringToEnumMap)) } for i := range this.StringToEnumMap { if this.StringToEnumMap[i] != that1.StringToEnumMap[i] { return fmt.Errorf("StringToEnumMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToEnumMap[i], i, that1.StringToEnumMap[i]) } } if len(this.StringToMsgMap) != len(that1.StringToMsgMap) { return fmt.Errorf("StringToMsgMap this(%v) Not Equal that(%v)", len(this.StringToMsgMap), len(that1.StringToMsgMap)) } for i := range this.StringToMsgMap { if !this.StringToMsgMap[i].Equal(that1.StringToMsgMap[i]) { return fmt.Errorf("StringToMsgMap this[%v](%v) Not Equal that[%v](%v)", i, this.StringToMsgMap[i], i, that1.StringToMsgMap[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *AllMapsOrdered) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*AllMapsOrdered) if !ok { that2, ok := that.(AllMapsOrdered) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if len(this.StringToDoubleMap) != len(that1.StringToDoubleMap) { return false } for i := range this.StringToDoubleMap { if this.StringToDoubleMap[i] != that1.StringToDoubleMap[i] { return false } } if len(this.StringToFloatMap) != len(that1.StringToFloatMap) { return false } for i := range this.StringToFloatMap { if this.StringToFloatMap[i] != that1.StringToFloatMap[i] { return false } } if len(this.Int32Map) != len(that1.Int32Map) { return false } for i := range this.Int32Map { if this.Int32Map[i] != that1.Int32Map[i] { return false } } if len(this.Int64Map) != len(that1.Int64Map) { return false } for i := range this.Int64Map { if this.Int64Map[i] != that1.Int64Map[i] { return false } } if len(this.Uint32Map) != len(that1.Uint32Map) { return false } for i := range this.Uint32Map { if this.Uint32Map[i] != that1.Uint32Map[i] { return false } } if len(this.Uint64Map) != len(that1.Uint64Map) { return false } for i := range this.Uint64Map { if this.Uint64Map[i] != that1.Uint64Map[i] { return false } } if len(this.Sint32Map) != len(that1.Sint32Map) { return false } for i := range this.Sint32Map { if this.Sint32Map[i] != that1.Sint32Map[i] { return false } } if len(this.Sint64Map) != len(that1.Sint64Map) { return false } for i := range this.Sint64Map { if this.Sint64Map[i] != that1.Sint64Map[i] { return false } } if len(this.Fixed32Map) != len(that1.Fixed32Map) { return false } for i := range this.Fixed32Map { if this.Fixed32Map[i] != that1.Fixed32Map[i] { return false } } if len(this.Sfixed32Map) != len(that1.Sfixed32Map) { return false } for i := range this.Sfixed32Map { if this.Sfixed32Map[i] != that1.Sfixed32Map[i] { return false } } if len(this.Fixed64Map) != len(that1.Fixed64Map) { return false } for i := range this.Fixed64Map { if this.Fixed64Map[i] != that1.Fixed64Map[i] { return false } } if len(this.Sfixed64Map) != len(that1.Sfixed64Map) { return false } for i := range this.Sfixed64Map { if this.Sfixed64Map[i] != that1.Sfixed64Map[i] { return false } } if len(this.BoolMap) != len(that1.BoolMap) { return false } for i := range this.BoolMap { if this.BoolMap[i] != that1.BoolMap[i] { return false } } if len(this.StringMap) != len(that1.StringMap) { return false } for i := range this.StringMap { if this.StringMap[i] != that1.StringMap[i] { return false } } if len(this.StringToBytesMap) != len(that1.StringToBytesMap) { return false } for i := range this.StringToBytesMap { if !bytes.Equal(this.StringToBytesMap[i], that1.StringToBytesMap[i]) { return false } } if len(this.StringToEnumMap) != len(that1.StringToEnumMap) { return false } for i := range this.StringToEnumMap { if this.StringToEnumMap[i] != that1.StringToEnumMap[i] { return false } } if len(this.StringToMsgMap) != len(that1.StringToMsgMap) { return false } for i := range this.StringToMsgMap { if !this.StringToMsgMap[i].Equal(that1.StringToMsgMap[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *MessageWithMap) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*MessageWithMap) if !ok { that2, ok := that.(MessageWithMap) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *MessageWithMap") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *MessageWithMap but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *MessageWithMap but is not nil && this == nil") } if len(this.NameMapping) != len(that1.NameMapping) { return fmt.Errorf("NameMapping this(%v) Not Equal that(%v)", len(this.NameMapping), len(that1.NameMapping)) } for i := range this.NameMapping { if this.NameMapping[i] != that1.NameMapping[i] { return fmt.Errorf("NameMapping this[%v](%v) Not Equal that[%v](%v)", i, this.NameMapping[i], i, that1.NameMapping[i]) } } if len(this.MsgMapping) != len(that1.MsgMapping) { return fmt.Errorf("MsgMapping this(%v) Not Equal that(%v)", len(this.MsgMapping), len(that1.MsgMapping)) } for i := range this.MsgMapping { if !this.MsgMapping[i].Equal(that1.MsgMapping[i]) { return fmt.Errorf("MsgMapping this[%v](%v) Not Equal that[%v](%v)", i, this.MsgMapping[i], i, that1.MsgMapping[i]) } } if len(this.ByteMapping) != len(that1.ByteMapping) { return fmt.Errorf("ByteMapping this(%v) Not Equal that(%v)", len(this.ByteMapping), len(that1.ByteMapping)) } for i := range this.ByteMapping { if !bytes.Equal(this.ByteMapping[i], that1.ByteMapping[i]) { return fmt.Errorf("ByteMapping this[%v](%v) Not Equal that[%v](%v)", i, this.ByteMapping[i], i, that1.ByteMapping[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *MessageWithMap) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*MessageWithMap) if !ok { that2, ok := that.(MessageWithMap) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if len(this.NameMapping) != len(that1.NameMapping) { return false } for i := range this.NameMapping { if this.NameMapping[i] != that1.NameMapping[i] { return false } } if len(this.MsgMapping) != len(that1.MsgMapping) { return false } for i := range this.MsgMapping { if !this.MsgMapping[i].Equal(that1.MsgMapping[i]) { return false } } if len(this.ByteMapping) != len(that1.ByteMapping) { return false } for i := range this.ByteMapping { if !bytes.Equal(this.ByteMapping[i], that1.ByteMapping[i]) { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *FloatingPoint) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*FloatingPoint) if !ok { that2, ok := that.(FloatingPoint) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *FloatingPoint") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *FloatingPoint but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *FloatingPoint but is not nil && this == nil") } if this.F != that1.F { return fmt.Errorf("F this(%v) Not Equal that(%v)", this.F, that1.F) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *FloatingPoint) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*FloatingPoint) if !ok { that2, ok := that.(FloatingPoint) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if this.F != that1.F { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *Uint128Pair) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*Uint128Pair) if !ok { that2, ok := that.(Uint128Pair) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *Uint128Pair") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *Uint128Pair but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *Uint128Pair but is not nil && this == nil") } if !this.Left.Equal(that1.Left) { return fmt.Errorf("Left this(%v) Not Equal that(%v)", this.Left, that1.Left) } if that1.Right == nil { if this.Right != nil { return fmt.Errorf("this.Right != nil && that1.Right == nil") } } else if !this.Right.Equal(*that1.Right) { return fmt.Errorf("Right this(%v) Not Equal that(%v)", this.Right, that1.Right) } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *Uint128Pair) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*Uint128Pair) if !ok { that2, ok := that.(Uint128Pair) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if !this.Left.Equal(that1.Left) { return false } if that1.Right == nil { if this.Right != nil { return false } } else if !this.Right.Equal(*that1.Right) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ContainsNestedMap) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ContainsNestedMap) if !ok { that2, ok := that.(ContainsNestedMap) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *ContainsNestedMap") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ContainsNestedMap but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ContainsNestedMap but is not nil && this == nil") } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ContainsNestedMap) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*ContainsNestedMap) if !ok { that2, ok := that.(ContainsNestedMap) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *ContainsNestedMap_NestedMap) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*ContainsNestedMap_NestedMap) if !ok { that2, ok := that.(ContainsNestedMap_NestedMap) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *ContainsNestedMap_NestedMap") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *ContainsNestedMap_NestedMap but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *ContainsNestedMap_NestedMap but is not nil && this == nil") } if len(this.NestedMapField) != len(that1.NestedMapField) { return fmt.Errorf("NestedMapField this(%v) Not Equal that(%v)", len(this.NestedMapField), len(that1.NestedMapField)) } for i := range this.NestedMapField { if this.NestedMapField[i] != that1.NestedMapField[i] { return fmt.Errorf("NestedMapField this[%v](%v) Not Equal that[%v](%v)", i, this.NestedMapField[i], i, that1.NestedMapField[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *ContainsNestedMap_NestedMap) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*ContainsNestedMap_NestedMap) if !ok { that2, ok := that.(ContainsNestedMap_NestedMap) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if len(this.NestedMapField) != len(that1.NestedMapField) { return false } for i := range this.NestedMapField { if this.NestedMapField[i] != that1.NestedMapField[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func (this *NotPacked) VerboseEqual(that interface{}) error { if that == nil { if this == nil { return nil } return fmt.Errorf("that == nil && this != nil") } that1, ok := that.(*NotPacked) if !ok { that2, ok := that.(NotPacked) if ok { that1 = &that2 } else { return fmt.Errorf("that is not of type *NotPacked") } } if that1 == nil { if this == nil { return nil } return fmt.Errorf("that is type *NotPacked but is nil && this != nil") } else if this == nil { return fmt.Errorf("that is type *NotPacked but is not nil && this == nil") } if len(this.Key) != len(that1.Key) { return fmt.Errorf("Key this(%v) Not Equal that(%v)", len(this.Key), len(that1.Key)) } for i := range this.Key { if this.Key[i] != that1.Key[i] { return fmt.Errorf("Key this[%v](%v) Not Equal that[%v](%v)", i, this.Key[i], i, that1.Key[i]) } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized) } return nil } func (this *NotPacked) Equal(that interface{}) bool { if that == nil { return this == nil } that1, ok := that.(*NotPacked) if !ok { that2, ok := that.(NotPacked) if ok { that1 = &that2 } else { return false } } if that1 == nil { return this == nil } else if this == nil { return false } if len(this.Key) != len(that1.Key) { return false } for i := range this.Key { if this.Key[i] != that1.Key[i] { return false } } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } type MessageFace interface { Proto() github_com_gogo_protobuf_proto.Message GetName() string GetHilarity() Message_Humour GetHeightInCm() uint32 GetData() []byte GetResultCount() int64 GetTrueScotsman() bool GetScore() float32 GetKey() []uint64 GetNested() *Nested GetTerrain() map[int64]*Nested GetProto2Field() *both.NinOptNative GetProto2Value() map[int64]*both.NinOptEnum } func (this *Message) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *Message) TestProto() github_com_gogo_protobuf_proto.Message { return NewMessageFromFace(this) } func (this *Message) GetName() string { return this.Name } func (this *Message) GetHilarity() Message_Humour { return this.Hilarity } func (this *Message) GetHeightInCm() uint32 { return this.HeightInCm } func (this *Message) GetData() []byte { return this.Data } func (this *Message) GetResultCount() int64 { return this.ResultCount } func (this *Message) GetTrueScotsman() bool { return this.TrueScotsman } func (this *Message) GetScore() float32 { return this.Score } func (this *Message) GetKey() []uint64 { return this.Key } func (this *Message) GetNested() *Nested { return this.Nested } func (this *Message) GetTerrain() map[int64]*Nested { return this.Terrain } func (this *Message) GetProto2Field() *both.NinOptNative { return this.Proto2Field } func (this *Message) GetProto2Value() map[int64]*both.NinOptEnum { return this.Proto2Value } func NewMessageFromFace(that MessageFace) *Message { this := &Message{} this.Name = that.GetName() this.Hilarity = that.GetHilarity() this.HeightInCm = that.GetHeightInCm() this.Data = that.GetData() this.ResultCount = that.GetResultCount() this.TrueScotsman = that.GetTrueScotsman() this.Score = that.GetScore() this.Key = that.GetKey() this.Nested = that.GetNested() this.Terrain = that.GetTerrain() this.Proto2Field = that.GetProto2Field() this.Proto2Value = that.GetProto2Value() return this } type NestedFace interface { Proto() github_com_gogo_protobuf_proto.Message GetBunny() string } func (this *Nested) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *Nested) TestProto() github_com_gogo_protobuf_proto.Message { return NewNestedFromFace(this) } func (this *Nested) GetBunny() string { return this.Bunny } func NewNestedFromFace(that NestedFace) *Nested { this := &Nested{} this.Bunny = that.GetBunny() return this } type AllMapsFace interface { Proto() github_com_gogo_protobuf_proto.Message GetStringToDoubleMap() map[string]float64 GetStringToFloatMap() map[string]float32 GetInt32Map() map[int32]int32 GetInt64Map() map[int64]int64 GetUint32Map() map[uint32]uint32 GetUint64Map() map[uint64]uint64 GetSint32Map() map[int32]int32 GetSint64Map() map[int64]int64 GetFixed32Map() map[uint32]uint32 GetSfixed32Map() map[int32]int32 GetFixed64Map() map[uint64]uint64 GetSfixed64Map() map[int64]int64 GetBoolMap() map[bool]bool GetStringMap() map[string]string GetStringToBytesMap() map[string][]byte GetStringToEnumMap() map[string]MapEnum GetStringToMsgMap() map[string]*FloatingPoint } func (this *AllMaps) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *AllMaps) TestProto() github_com_gogo_protobuf_proto.Message { return NewAllMapsFromFace(this) } func (this *AllMaps) GetStringToDoubleMap() map[string]float64 { return this.StringToDoubleMap } func (this *AllMaps) GetStringToFloatMap() map[string]float32 { return this.StringToFloatMap } func (this *AllMaps) GetInt32Map() map[int32]int32 { return this.Int32Map } func (this *AllMaps) GetInt64Map() map[int64]int64 { return this.Int64Map } func (this *AllMaps) GetUint32Map() map[uint32]uint32 { return this.Uint32Map } func (this *AllMaps) GetUint64Map() map[uint64]uint64 { return this.Uint64Map } func (this *AllMaps) GetSint32Map() map[int32]int32 { return this.Sint32Map } func (this *AllMaps) GetSint64Map() map[int64]int64 { return this.Sint64Map } func (this *AllMaps) GetFixed32Map() map[uint32]uint32 { return this.Fixed32Map } func (this *AllMaps) GetSfixed32Map() map[int32]int32 { return this.Sfixed32Map } func (this *AllMaps) GetFixed64Map() map[uint64]uint64 { return this.Fixed64Map } func (this *AllMaps) GetSfixed64Map() map[int64]int64 { return this.Sfixed64Map } func (this *AllMaps) GetBoolMap() map[bool]bool { return this.BoolMap } func (this *AllMaps) GetStringMap() map[string]string { return this.StringMap } func (this *AllMaps) GetStringToBytesMap() map[string][]byte { return this.StringToBytesMap } func (this *AllMaps) GetStringToEnumMap() map[string]MapEnum { return this.StringToEnumMap } func (this *AllMaps) GetStringToMsgMap() map[string]*FloatingPoint { return this.StringToMsgMap } func NewAllMapsFromFace(that AllMapsFace) *AllMaps { this := &AllMaps{} this.StringToDoubleMap = that.GetStringToDoubleMap() this.StringToFloatMap = that.GetStringToFloatMap() this.Int32Map = that.GetInt32Map() this.Int64Map = that.GetInt64Map() this.Uint32Map = that.GetUint32Map() this.Uint64Map = that.GetUint64Map() this.Sint32Map = that.GetSint32Map() this.Sint64Map = that.GetSint64Map() this.Fixed32Map = that.GetFixed32Map() this.Sfixed32Map = that.GetSfixed32Map() this.Fixed64Map = that.GetFixed64Map() this.Sfixed64Map = that.GetSfixed64Map() this.BoolMap = that.GetBoolMap() this.StringMap = that.GetStringMap() this.StringToBytesMap = that.GetStringToBytesMap() this.StringToEnumMap = that.GetStringToEnumMap() this.StringToMsgMap = that.GetStringToMsgMap() return this } type AllMapsOrderedFace interface { Proto() github_com_gogo_protobuf_proto.Message GetStringToDoubleMap() map[string]float64 GetStringToFloatMap() map[string]float32 GetInt32Map() map[int32]int32 GetInt64Map() map[int64]int64 GetUint32Map() map[uint32]uint32 GetUint64Map() map[uint64]uint64 GetSint32Map() map[int32]int32 GetSint64Map() map[int64]int64 GetFixed32Map() map[uint32]uint32 GetSfixed32Map() map[int32]int32 GetFixed64Map() map[uint64]uint64 GetSfixed64Map() map[int64]int64 GetBoolMap() map[bool]bool GetStringMap() map[string]string GetStringToBytesMap() map[string][]byte GetStringToEnumMap() map[string]MapEnum GetStringToMsgMap() map[string]*FloatingPoint } func (this *AllMapsOrdered) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *AllMapsOrdered) TestProto() github_com_gogo_protobuf_proto.Message { return NewAllMapsOrderedFromFace(this) } func (this *AllMapsOrdered) GetStringToDoubleMap() map[string]float64 { return this.StringToDoubleMap } func (this *AllMapsOrdered) GetStringToFloatMap() map[string]float32 { return this.StringToFloatMap } func (this *AllMapsOrdered) GetInt32Map() map[int32]int32 { return this.Int32Map } func (this *AllMapsOrdered) GetInt64Map() map[int64]int64 { return this.Int64Map } func (this *AllMapsOrdered) GetUint32Map() map[uint32]uint32 { return this.Uint32Map } func (this *AllMapsOrdered) GetUint64Map() map[uint64]uint64 { return this.Uint64Map } func (this *AllMapsOrdered) GetSint32Map() map[int32]int32 { return this.Sint32Map } func (this *AllMapsOrdered) GetSint64Map() map[int64]int64 { return this.Sint64Map } func (this *AllMapsOrdered) GetFixed32Map() map[uint32]uint32 { return this.Fixed32Map } func (this *AllMapsOrdered) GetSfixed32Map() map[int32]int32 { return this.Sfixed32Map } func (this *AllMapsOrdered) GetFixed64Map() map[uint64]uint64 { return this.Fixed64Map } func (this *AllMapsOrdered) GetSfixed64Map() map[int64]int64 { return this.Sfixed64Map } func (this *AllMapsOrdered) GetBoolMap() map[bool]bool { return this.BoolMap } func (this *AllMapsOrdered) GetStringMap() map[string]string { return this.StringMap } func (this *AllMapsOrdered) GetStringToBytesMap() map[string][]byte { return this.StringToBytesMap } func (this *AllMapsOrdered) GetStringToEnumMap() map[string]MapEnum { return this.StringToEnumMap } func (this *AllMapsOrdered) GetStringToMsgMap() map[string]*FloatingPoint { return this.StringToMsgMap } func NewAllMapsOrderedFromFace(that AllMapsOrderedFace) *AllMapsOrdered { this := &AllMapsOrdered{} this.StringToDoubleMap = that.GetStringToDoubleMap() this.StringToFloatMap = that.GetStringToFloatMap() this.Int32Map = that.GetInt32Map() this.Int64Map = that.GetInt64Map() this.Uint32Map = that.GetUint32Map() this.Uint64Map = that.GetUint64Map() this.Sint32Map = that.GetSint32Map() this.Sint64Map = that.GetSint64Map() this.Fixed32Map = that.GetFixed32Map() this.Sfixed32Map = that.GetSfixed32Map() this.Fixed64Map = that.GetFixed64Map() this.Sfixed64Map = that.GetSfixed64Map() this.BoolMap = that.GetBoolMap() this.StringMap = that.GetStringMap() this.StringToBytesMap = that.GetStringToBytesMap() this.StringToEnumMap = that.GetStringToEnumMap() this.StringToMsgMap = that.GetStringToMsgMap() return this } type MessageWithMapFace interface { Proto() github_com_gogo_protobuf_proto.Message GetNameMapping() map[int32]string GetMsgMapping() map[int64]*FloatingPoint GetByteMapping() map[bool][]byte } func (this *MessageWithMap) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *MessageWithMap) TestProto() github_com_gogo_protobuf_proto.Message { return NewMessageWithMapFromFace(this) } func (this *MessageWithMap) GetNameMapping() map[int32]string { return this.NameMapping } func (this *MessageWithMap) GetMsgMapping() map[int64]*FloatingPoint { return this.MsgMapping } func (this *MessageWithMap) GetByteMapping() map[bool][]byte { return this.ByteMapping } func NewMessageWithMapFromFace(that MessageWithMapFace) *MessageWithMap { this := &MessageWithMap{} this.NameMapping = that.GetNameMapping() this.MsgMapping = that.GetMsgMapping() this.ByteMapping = that.GetByteMapping() return this } type FloatingPointFace interface { Proto() github_com_gogo_protobuf_proto.Message GetF() float64 } func (this *FloatingPoint) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *FloatingPoint) TestProto() github_com_gogo_protobuf_proto.Message { return NewFloatingPointFromFace(this) } func (this *FloatingPoint) GetF() float64 { return this.F } func NewFloatingPointFromFace(that FloatingPointFace) *FloatingPoint { this := &FloatingPoint{} this.F = that.GetF() return this } type Uint128PairFace interface { Proto() github_com_gogo_protobuf_proto.Message GetLeft() github_com_gogo_protobuf_test_custom.Uint128 GetRight() *github_com_gogo_protobuf_test_custom.Uint128 } func (this *Uint128Pair) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *Uint128Pair) TestProto() github_com_gogo_protobuf_proto.Message { return NewUint128PairFromFace(this) } func (this *Uint128Pair) GetLeft() github_com_gogo_protobuf_test_custom.Uint128 { return this.Left } func (this *Uint128Pair) GetRight() *github_com_gogo_protobuf_test_custom.Uint128 { return this.Right } func NewUint128PairFromFace(that Uint128PairFace) *Uint128Pair { this := &Uint128Pair{} this.Left = that.GetLeft() this.Right = that.GetRight() return this } type ContainsNestedMapFace interface { Proto() github_com_gogo_protobuf_proto.Message } func (this *ContainsNestedMap) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *ContainsNestedMap) TestProto() github_com_gogo_protobuf_proto.Message { return NewContainsNestedMapFromFace(this) } func NewContainsNestedMapFromFace(that ContainsNestedMapFace) *ContainsNestedMap { this := &ContainsNestedMap{} return this } type ContainsNestedMap_NestedMapFace interface { Proto() github_com_gogo_protobuf_proto.Message GetNestedMapField() map[string]float64 } func (this *ContainsNestedMap_NestedMap) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *ContainsNestedMap_NestedMap) TestProto() github_com_gogo_protobuf_proto.Message { return NewContainsNestedMap_NestedMapFromFace(this) } func (this *ContainsNestedMap_NestedMap) GetNestedMapField() map[string]float64 { return this.NestedMapField } func NewContainsNestedMap_NestedMapFromFace(that ContainsNestedMap_NestedMapFace) *ContainsNestedMap_NestedMap { this := &ContainsNestedMap_NestedMap{} this.NestedMapField = that.GetNestedMapField() return this } type NotPackedFace interface { Proto() github_com_gogo_protobuf_proto.Message GetKey() []uint64 } func (this *NotPacked) Proto() github_com_gogo_protobuf_proto.Message { return this } func (this *NotPacked) TestProto() github_com_gogo_protobuf_proto.Message { return NewNotPackedFromFace(this) } func (this *NotPacked) GetKey() []uint64 { return this.Key } func NewNotPackedFromFace(that NotPackedFace) *NotPacked { this := &NotPacked{} this.Key = that.GetKey() return this } func (this *Message) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 16) s = append(s, "&theproto3.Message{") s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") s = append(s, "Hilarity: "+fmt.Sprintf("%#v", this.Hilarity)+",\n") s = append(s, "HeightInCm: "+fmt.Sprintf("%#v", this.HeightInCm)+",\n") s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n") s = append(s, "ResultCount: "+fmt.Sprintf("%#v", this.ResultCount)+",\n") s = append(s, "TrueScotsman: "+fmt.Sprintf("%#v", this.TrueScotsman)+",\n") s = append(s, "Score: "+fmt.Sprintf("%#v", this.Score)+",\n") s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") if this.Nested != nil { s = append(s, "Nested: "+fmt.Sprintf("%#v", this.Nested)+",\n") } keysForTerrain := make([]int64, 0, len(this.Terrain)) for k := range this.Terrain { keysForTerrain = append(keysForTerrain, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForTerrain) mapStringForTerrain := "map[int64]*Nested{" for _, k := range keysForTerrain { mapStringForTerrain += fmt.Sprintf("%#v: %#v,", k, this.Terrain[k]) } mapStringForTerrain += "}" if this.Terrain != nil { s = append(s, "Terrain: "+mapStringForTerrain+",\n") } if this.Proto2Field != nil { s = append(s, "Proto2Field: "+fmt.Sprintf("%#v", this.Proto2Field)+",\n") } keysForProto2Value := make([]int64, 0, len(this.Proto2Value)) for k := range this.Proto2Value { keysForProto2Value = append(keysForProto2Value, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForProto2Value) mapStringForProto2Value := "map[int64]*both.NinOptEnum{" for _, k := range keysForProto2Value { mapStringForProto2Value += fmt.Sprintf("%#v: %#v,", k, this.Proto2Value[k]) } mapStringForProto2Value += "}" if this.Proto2Value != nil { s = append(s, "Proto2Value: "+mapStringForProto2Value+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Nested) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&theproto3.Nested{") s = append(s, "Bunny: "+fmt.Sprintf("%#v", this.Bunny)+",\n") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *AllMaps) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 21) s = append(s, "&theproto3.AllMaps{") keysForStringToDoubleMap := make([]string, 0, len(this.StringToDoubleMap)) for k := range this.StringToDoubleMap { keysForStringToDoubleMap = append(keysForStringToDoubleMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToDoubleMap) mapStringForStringToDoubleMap := "map[string]float64{" for _, k := range keysForStringToDoubleMap { mapStringForStringToDoubleMap += fmt.Sprintf("%#v: %#v,", k, this.StringToDoubleMap[k]) } mapStringForStringToDoubleMap += "}" if this.StringToDoubleMap != nil { s = append(s, "StringToDoubleMap: "+mapStringForStringToDoubleMap+",\n") } keysForStringToFloatMap := make([]string, 0, len(this.StringToFloatMap)) for k := range this.StringToFloatMap { keysForStringToFloatMap = append(keysForStringToFloatMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToFloatMap) mapStringForStringToFloatMap := "map[string]float32{" for _, k := range keysForStringToFloatMap { mapStringForStringToFloatMap += fmt.Sprintf("%#v: %#v,", k, this.StringToFloatMap[k]) } mapStringForStringToFloatMap += "}" if this.StringToFloatMap != nil { s = append(s, "StringToFloatMap: "+mapStringForStringToFloatMap+",\n") } keysForInt32Map := make([]int32, 0, len(this.Int32Map)) for k := range this.Int32Map { keysForInt32Map = append(keysForInt32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForInt32Map) mapStringForInt32Map := "map[int32]int32{" for _, k := range keysForInt32Map { mapStringForInt32Map += fmt.Sprintf("%#v: %#v,", k, this.Int32Map[k]) } mapStringForInt32Map += "}" if this.Int32Map != nil { s = append(s, "Int32Map: "+mapStringForInt32Map+",\n") } keysForInt64Map := make([]int64, 0, len(this.Int64Map)) for k := range this.Int64Map { keysForInt64Map = append(keysForInt64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForInt64Map) mapStringForInt64Map := "map[int64]int64{" for _, k := range keysForInt64Map { mapStringForInt64Map += fmt.Sprintf("%#v: %#v,", k, this.Int64Map[k]) } mapStringForInt64Map += "}" if this.Int64Map != nil { s = append(s, "Int64Map: "+mapStringForInt64Map+",\n") } keysForUint32Map := make([]uint32, 0, len(this.Uint32Map)) for k := range this.Uint32Map { keysForUint32Map = append(keysForUint32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForUint32Map) mapStringForUint32Map := "map[uint32]uint32{" for _, k := range keysForUint32Map { mapStringForUint32Map += fmt.Sprintf("%#v: %#v,", k, this.Uint32Map[k]) } mapStringForUint32Map += "}" if this.Uint32Map != nil { s = append(s, "Uint32Map: "+mapStringForUint32Map+",\n") } keysForUint64Map := make([]uint64, 0, len(this.Uint64Map)) for k := range this.Uint64Map { keysForUint64Map = append(keysForUint64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForUint64Map) mapStringForUint64Map := "map[uint64]uint64{" for _, k := range keysForUint64Map { mapStringForUint64Map += fmt.Sprintf("%#v: %#v,", k, this.Uint64Map[k]) } mapStringForUint64Map += "}" if this.Uint64Map != nil { s = append(s, "Uint64Map: "+mapStringForUint64Map+",\n") } keysForSint32Map := make([]int32, 0, len(this.Sint32Map)) for k := range this.Sint32Map { keysForSint32Map = append(keysForSint32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSint32Map) mapStringForSint32Map := "map[int32]int32{" for _, k := range keysForSint32Map { mapStringForSint32Map += fmt.Sprintf("%#v: %#v,", k, this.Sint32Map[k]) } mapStringForSint32Map += "}" if this.Sint32Map != nil { s = append(s, "Sint32Map: "+mapStringForSint32Map+",\n") } keysForSint64Map := make([]int64, 0, len(this.Sint64Map)) for k := range this.Sint64Map { keysForSint64Map = append(keysForSint64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSint64Map) mapStringForSint64Map := "map[int64]int64{" for _, k := range keysForSint64Map { mapStringForSint64Map += fmt.Sprintf("%#v: %#v,", k, this.Sint64Map[k]) } mapStringForSint64Map += "}" if this.Sint64Map != nil { s = append(s, "Sint64Map: "+mapStringForSint64Map+",\n") } keysForFixed32Map := make([]uint32, 0, len(this.Fixed32Map)) for k := range this.Fixed32Map { keysForFixed32Map = append(keysForFixed32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForFixed32Map) mapStringForFixed32Map := "map[uint32]uint32{" for _, k := range keysForFixed32Map { mapStringForFixed32Map += fmt.Sprintf("%#v: %#v,", k, this.Fixed32Map[k]) } mapStringForFixed32Map += "}" if this.Fixed32Map != nil { s = append(s, "Fixed32Map: "+mapStringForFixed32Map+",\n") } keysForSfixed32Map := make([]int32, 0, len(this.Sfixed32Map)) for k := range this.Sfixed32Map { keysForSfixed32Map = append(keysForSfixed32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSfixed32Map) mapStringForSfixed32Map := "map[int32]int32{" for _, k := range keysForSfixed32Map { mapStringForSfixed32Map += fmt.Sprintf("%#v: %#v,", k, this.Sfixed32Map[k]) } mapStringForSfixed32Map += "}" if this.Sfixed32Map != nil { s = append(s, "Sfixed32Map: "+mapStringForSfixed32Map+",\n") } keysForFixed64Map := make([]uint64, 0, len(this.Fixed64Map)) for k := range this.Fixed64Map { keysForFixed64Map = append(keysForFixed64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForFixed64Map) mapStringForFixed64Map := "map[uint64]uint64{" for _, k := range keysForFixed64Map { mapStringForFixed64Map += fmt.Sprintf("%#v: %#v,", k, this.Fixed64Map[k]) } mapStringForFixed64Map += "}" if this.Fixed64Map != nil { s = append(s, "Fixed64Map: "+mapStringForFixed64Map+",\n") } keysForSfixed64Map := make([]int64, 0, len(this.Sfixed64Map)) for k := range this.Sfixed64Map { keysForSfixed64Map = append(keysForSfixed64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSfixed64Map) mapStringForSfixed64Map := "map[int64]int64{" for _, k := range keysForSfixed64Map { mapStringForSfixed64Map += fmt.Sprintf("%#v: %#v,", k, this.Sfixed64Map[k]) } mapStringForSfixed64Map += "}" if this.Sfixed64Map != nil { s = append(s, "Sfixed64Map: "+mapStringForSfixed64Map+",\n") } keysForBoolMap := make([]bool, 0, len(this.BoolMap)) for k := range this.BoolMap { keysForBoolMap = append(keysForBoolMap, k) } github_com_gogo_protobuf_sortkeys.Bools(keysForBoolMap) mapStringForBoolMap := "map[bool]bool{" for _, k := range keysForBoolMap { mapStringForBoolMap += fmt.Sprintf("%#v: %#v,", k, this.BoolMap[k]) } mapStringForBoolMap += "}" if this.BoolMap != nil { s = append(s, "BoolMap: "+mapStringForBoolMap+",\n") } keysForStringMap := make([]string, 0, len(this.StringMap)) for k := range this.StringMap { keysForStringMap = append(keysForStringMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringMap) mapStringForStringMap := "map[string]string{" for _, k := range keysForStringMap { mapStringForStringMap += fmt.Sprintf("%#v: %#v,", k, this.StringMap[k]) } mapStringForStringMap += "}" if this.StringMap != nil { s = append(s, "StringMap: "+mapStringForStringMap+",\n") } keysForStringToBytesMap := make([]string, 0, len(this.StringToBytesMap)) for k := range this.StringToBytesMap { keysForStringToBytesMap = append(keysForStringToBytesMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToBytesMap) mapStringForStringToBytesMap := "map[string][]byte{" for _, k := range keysForStringToBytesMap { mapStringForStringToBytesMap += fmt.Sprintf("%#v: %#v,", k, this.StringToBytesMap[k]) } mapStringForStringToBytesMap += "}" if this.StringToBytesMap != nil { s = append(s, "StringToBytesMap: "+mapStringForStringToBytesMap+",\n") } keysForStringToEnumMap := make([]string, 0, len(this.StringToEnumMap)) for k := range this.StringToEnumMap { keysForStringToEnumMap = append(keysForStringToEnumMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToEnumMap) mapStringForStringToEnumMap := "map[string]MapEnum{" for _, k := range keysForStringToEnumMap { mapStringForStringToEnumMap += fmt.Sprintf("%#v: %#v,", k, this.StringToEnumMap[k]) } mapStringForStringToEnumMap += "}" if this.StringToEnumMap != nil { s = append(s, "StringToEnumMap: "+mapStringForStringToEnumMap+",\n") } keysForStringToMsgMap := make([]string, 0, len(this.StringToMsgMap)) for k := range this.StringToMsgMap { keysForStringToMsgMap = append(keysForStringToMsgMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToMsgMap) mapStringForStringToMsgMap := "map[string]*FloatingPoint{" for _, k := range keysForStringToMsgMap { mapStringForStringToMsgMap += fmt.Sprintf("%#v: %#v,", k, this.StringToMsgMap[k]) } mapStringForStringToMsgMap += "}" if this.StringToMsgMap != nil { s = append(s, "StringToMsgMap: "+mapStringForStringToMsgMap+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *AllMapsOrdered) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 21) s = append(s, "&theproto3.AllMapsOrdered{") keysForStringToDoubleMap := make([]string, 0, len(this.StringToDoubleMap)) for k := range this.StringToDoubleMap { keysForStringToDoubleMap = append(keysForStringToDoubleMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToDoubleMap) mapStringForStringToDoubleMap := "map[string]float64{" for _, k := range keysForStringToDoubleMap { mapStringForStringToDoubleMap += fmt.Sprintf("%#v: %#v,", k, this.StringToDoubleMap[k]) } mapStringForStringToDoubleMap += "}" if this.StringToDoubleMap != nil { s = append(s, "StringToDoubleMap: "+mapStringForStringToDoubleMap+",\n") } keysForStringToFloatMap := make([]string, 0, len(this.StringToFloatMap)) for k := range this.StringToFloatMap { keysForStringToFloatMap = append(keysForStringToFloatMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToFloatMap) mapStringForStringToFloatMap := "map[string]float32{" for _, k := range keysForStringToFloatMap { mapStringForStringToFloatMap += fmt.Sprintf("%#v: %#v,", k, this.StringToFloatMap[k]) } mapStringForStringToFloatMap += "}" if this.StringToFloatMap != nil { s = append(s, "StringToFloatMap: "+mapStringForStringToFloatMap+",\n") } keysForInt32Map := make([]int32, 0, len(this.Int32Map)) for k := range this.Int32Map { keysForInt32Map = append(keysForInt32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForInt32Map) mapStringForInt32Map := "map[int32]int32{" for _, k := range keysForInt32Map { mapStringForInt32Map += fmt.Sprintf("%#v: %#v,", k, this.Int32Map[k]) } mapStringForInt32Map += "}" if this.Int32Map != nil { s = append(s, "Int32Map: "+mapStringForInt32Map+",\n") } keysForInt64Map := make([]int64, 0, len(this.Int64Map)) for k := range this.Int64Map { keysForInt64Map = append(keysForInt64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForInt64Map) mapStringForInt64Map := "map[int64]int64{" for _, k := range keysForInt64Map { mapStringForInt64Map += fmt.Sprintf("%#v: %#v,", k, this.Int64Map[k]) } mapStringForInt64Map += "}" if this.Int64Map != nil { s = append(s, "Int64Map: "+mapStringForInt64Map+",\n") } keysForUint32Map := make([]uint32, 0, len(this.Uint32Map)) for k := range this.Uint32Map { keysForUint32Map = append(keysForUint32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForUint32Map) mapStringForUint32Map := "map[uint32]uint32{" for _, k := range keysForUint32Map { mapStringForUint32Map += fmt.Sprintf("%#v: %#v,", k, this.Uint32Map[k]) } mapStringForUint32Map += "}" if this.Uint32Map != nil { s = append(s, "Uint32Map: "+mapStringForUint32Map+",\n") } keysForUint64Map := make([]uint64, 0, len(this.Uint64Map)) for k := range this.Uint64Map { keysForUint64Map = append(keysForUint64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForUint64Map) mapStringForUint64Map := "map[uint64]uint64{" for _, k := range keysForUint64Map { mapStringForUint64Map += fmt.Sprintf("%#v: %#v,", k, this.Uint64Map[k]) } mapStringForUint64Map += "}" if this.Uint64Map != nil { s = append(s, "Uint64Map: "+mapStringForUint64Map+",\n") } keysForSint32Map := make([]int32, 0, len(this.Sint32Map)) for k := range this.Sint32Map { keysForSint32Map = append(keysForSint32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSint32Map) mapStringForSint32Map := "map[int32]int32{" for _, k := range keysForSint32Map { mapStringForSint32Map += fmt.Sprintf("%#v: %#v,", k, this.Sint32Map[k]) } mapStringForSint32Map += "}" if this.Sint32Map != nil { s = append(s, "Sint32Map: "+mapStringForSint32Map+",\n") } keysForSint64Map := make([]int64, 0, len(this.Sint64Map)) for k := range this.Sint64Map { keysForSint64Map = append(keysForSint64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSint64Map) mapStringForSint64Map := "map[int64]int64{" for _, k := range keysForSint64Map { mapStringForSint64Map += fmt.Sprintf("%#v: %#v,", k, this.Sint64Map[k]) } mapStringForSint64Map += "}" if this.Sint64Map != nil { s = append(s, "Sint64Map: "+mapStringForSint64Map+",\n") } keysForFixed32Map := make([]uint32, 0, len(this.Fixed32Map)) for k := range this.Fixed32Map { keysForFixed32Map = append(keysForFixed32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForFixed32Map) mapStringForFixed32Map := "map[uint32]uint32{" for _, k := range keysForFixed32Map { mapStringForFixed32Map += fmt.Sprintf("%#v: %#v,", k, this.Fixed32Map[k]) } mapStringForFixed32Map += "}" if this.Fixed32Map != nil { s = append(s, "Fixed32Map: "+mapStringForFixed32Map+",\n") } keysForSfixed32Map := make([]int32, 0, len(this.Sfixed32Map)) for k := range this.Sfixed32Map { keysForSfixed32Map = append(keysForSfixed32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSfixed32Map) mapStringForSfixed32Map := "map[int32]int32{" for _, k := range keysForSfixed32Map { mapStringForSfixed32Map += fmt.Sprintf("%#v: %#v,", k, this.Sfixed32Map[k]) } mapStringForSfixed32Map += "}" if this.Sfixed32Map != nil { s = append(s, "Sfixed32Map: "+mapStringForSfixed32Map+",\n") } keysForFixed64Map := make([]uint64, 0, len(this.Fixed64Map)) for k := range this.Fixed64Map { keysForFixed64Map = append(keysForFixed64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForFixed64Map) mapStringForFixed64Map := "map[uint64]uint64{" for _, k := range keysForFixed64Map { mapStringForFixed64Map += fmt.Sprintf("%#v: %#v,", k, this.Fixed64Map[k]) } mapStringForFixed64Map += "}" if this.Fixed64Map != nil { s = append(s, "Fixed64Map: "+mapStringForFixed64Map+",\n") } keysForSfixed64Map := make([]int64, 0, len(this.Sfixed64Map)) for k := range this.Sfixed64Map { keysForSfixed64Map = append(keysForSfixed64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSfixed64Map) mapStringForSfixed64Map := "map[int64]int64{" for _, k := range keysForSfixed64Map { mapStringForSfixed64Map += fmt.Sprintf("%#v: %#v,", k, this.Sfixed64Map[k]) } mapStringForSfixed64Map += "}" if this.Sfixed64Map != nil { s = append(s, "Sfixed64Map: "+mapStringForSfixed64Map+",\n") } keysForBoolMap := make([]bool, 0, len(this.BoolMap)) for k := range this.BoolMap { keysForBoolMap = append(keysForBoolMap, k) } github_com_gogo_protobuf_sortkeys.Bools(keysForBoolMap) mapStringForBoolMap := "map[bool]bool{" for _, k := range keysForBoolMap { mapStringForBoolMap += fmt.Sprintf("%#v: %#v,", k, this.BoolMap[k]) } mapStringForBoolMap += "}" if this.BoolMap != nil { s = append(s, "BoolMap: "+mapStringForBoolMap+",\n") } keysForStringMap := make([]string, 0, len(this.StringMap)) for k := range this.StringMap { keysForStringMap = append(keysForStringMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringMap) mapStringForStringMap := "map[string]string{" for _, k := range keysForStringMap { mapStringForStringMap += fmt.Sprintf("%#v: %#v,", k, this.StringMap[k]) } mapStringForStringMap += "}" if this.StringMap != nil { s = append(s, "StringMap: "+mapStringForStringMap+",\n") } keysForStringToBytesMap := make([]string, 0, len(this.StringToBytesMap)) for k := range this.StringToBytesMap { keysForStringToBytesMap = append(keysForStringToBytesMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToBytesMap) mapStringForStringToBytesMap := "map[string][]byte{" for _, k := range keysForStringToBytesMap { mapStringForStringToBytesMap += fmt.Sprintf("%#v: %#v,", k, this.StringToBytesMap[k]) } mapStringForStringToBytesMap += "}" if this.StringToBytesMap != nil { s = append(s, "StringToBytesMap: "+mapStringForStringToBytesMap+",\n") } keysForStringToEnumMap := make([]string, 0, len(this.StringToEnumMap)) for k := range this.StringToEnumMap { keysForStringToEnumMap = append(keysForStringToEnumMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToEnumMap) mapStringForStringToEnumMap := "map[string]MapEnum{" for _, k := range keysForStringToEnumMap { mapStringForStringToEnumMap += fmt.Sprintf("%#v: %#v,", k, this.StringToEnumMap[k]) } mapStringForStringToEnumMap += "}" if this.StringToEnumMap != nil { s = append(s, "StringToEnumMap: "+mapStringForStringToEnumMap+",\n") } keysForStringToMsgMap := make([]string, 0, len(this.StringToMsgMap)) for k := range this.StringToMsgMap { keysForStringToMsgMap = append(keysForStringToMsgMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToMsgMap) mapStringForStringToMsgMap := "map[string]*FloatingPoint{" for _, k := range keysForStringToMsgMap { mapStringForStringToMsgMap += fmt.Sprintf("%#v: %#v,", k, this.StringToMsgMap[k]) } mapStringForStringToMsgMap += "}" if this.StringToMsgMap != nil { s = append(s, "StringToMsgMap: "+mapStringForStringToMsgMap+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *MessageWithMap) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 7) s = append(s, "&theproto3.MessageWithMap{") keysForNameMapping := make([]int32, 0, len(this.NameMapping)) for k := range this.NameMapping { keysForNameMapping = append(keysForNameMapping, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForNameMapping) mapStringForNameMapping := "map[int32]string{" for _, k := range keysForNameMapping { mapStringForNameMapping += fmt.Sprintf("%#v: %#v,", k, this.NameMapping[k]) } mapStringForNameMapping += "}" if this.NameMapping != nil { s = append(s, "NameMapping: "+mapStringForNameMapping+",\n") } keysForMsgMapping := make([]int64, 0, len(this.MsgMapping)) for k := range this.MsgMapping { keysForMsgMapping = append(keysForMsgMapping, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForMsgMapping) mapStringForMsgMapping := "map[int64]*FloatingPoint{" for _, k := range keysForMsgMapping { mapStringForMsgMapping += fmt.Sprintf("%#v: %#v,", k, this.MsgMapping[k]) } mapStringForMsgMapping += "}" if this.MsgMapping != nil { s = append(s, "MsgMapping: "+mapStringForMsgMapping+",\n") } keysForByteMapping := make([]bool, 0, len(this.ByteMapping)) for k := range this.ByteMapping { keysForByteMapping = append(keysForByteMapping, k) } github_com_gogo_protobuf_sortkeys.Bools(keysForByteMapping) mapStringForByteMapping := "map[bool][]byte{" for _, k := range keysForByteMapping { mapStringForByteMapping += fmt.Sprintf("%#v: %#v,", k, this.ByteMapping[k]) } mapStringForByteMapping += "}" if this.ByteMapping != nil { s = append(s, "ByteMapping: "+mapStringForByteMapping+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *FloatingPoint) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&theproto3.FloatingPoint{") s = append(s, "F: "+fmt.Sprintf("%#v", this.F)+",\n") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *Uint128Pair) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 6) s = append(s, "&theproto3.Uint128Pair{") s = append(s, "Left: "+fmt.Sprintf("%#v", this.Left)+",\n") s = append(s, "Right: "+fmt.Sprintf("%#v", this.Right)+",\n") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ContainsNestedMap) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 4) s = append(s, "&theproto3.ContainsNestedMap{") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *ContainsNestedMap_NestedMap) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&theproto3.ContainsNestedMap_NestedMap{") keysForNestedMapField := make([]string, 0, len(this.NestedMapField)) for k := range this.NestedMapField { keysForNestedMapField = append(keysForNestedMapField, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForNestedMapField) mapStringForNestedMapField := "map[string]float64{" for _, k := range keysForNestedMapField { mapStringForNestedMapField += fmt.Sprintf("%#v: %#v,", k, this.NestedMapField[k]) } mapStringForNestedMapField += "}" if this.NestedMapField != nil { s = append(s, "NestedMapField: "+mapStringForNestedMapField+",\n") } if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func (this *NotPacked) GoString() string { if this == nil { return "nil" } s := make([]string, 0, 5) s = append(s, "&theproto3.NotPacked{") s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") if this.XXX_unrecognized != nil { s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") } s = append(s, "}") return strings.Join(s, "") } func valueToGoStringTheproto3(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } func NewPopulatedMessage(r randyTheproto3, easy bool) *Message { this := &Message{} this.Name = string(randStringTheproto3(r)) this.Hilarity = Message_Humour([]int32{0, 1, 2, 3}[r.Intn(4)]) this.HeightInCm = uint32(r.Uint32()) v1 := r.Intn(100) this.Data = make([]byte, v1) for i := 0; i < v1; i++ { this.Data[i] = byte(r.Intn(256)) } this.ResultCount = int64(r.Int63()) if r.Intn(2) == 0 { this.ResultCount *= -1 } this.TrueScotsman = bool(bool(r.Intn(2) == 0)) this.Score = float32(r.Float32()) if r.Intn(2) == 0 { this.Score *= -1 } v2 := r.Intn(10) this.Key = make([]uint64, v2) for i := 0; i < v2; i++ { this.Key[i] = uint64(uint64(r.Uint32())) } if r.Intn(5) != 0 { this.Nested = NewPopulatedNested(r, easy) } if r.Intn(5) != 0 { v3 := r.Intn(10) this.Terrain = make(map[int64]*Nested) for i := 0; i < v3; i++ { this.Terrain[int64(r.Int63())] = NewPopulatedNested(r, easy) } } if r.Intn(5) != 0 { this.Proto2Field = both.NewPopulatedNinOptNative(r, easy) } if r.Intn(5) != 0 { v4 := r.Intn(10) this.Proto2Value = make(map[int64]*both.NinOptEnum) for i := 0; i < v4; i++ { this.Proto2Value[int64(r.Int63())] = both.NewPopulatedNinOptEnum(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 14) } return this } func NewPopulatedNested(r randyTheproto3, easy bool) *Nested { this := &Nested{} this.Bunny = string(randStringTheproto3(r)) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 2) } return this } func NewPopulatedAllMaps(r randyTheproto3, easy bool) *AllMaps { this := &AllMaps{} if r.Intn(5) != 0 { v5 := r.Intn(10) this.StringToDoubleMap = make(map[string]float64) for i := 0; i < v5; i++ { v6 := randStringTheproto3(r) this.StringToDoubleMap[v6] = float64(r.Float64()) if r.Intn(2) == 0 { this.StringToDoubleMap[v6] *= -1 } } } if r.Intn(5) != 0 { v7 := r.Intn(10) this.StringToFloatMap = make(map[string]float32) for i := 0; i < v7; i++ { v8 := randStringTheproto3(r) this.StringToFloatMap[v8] = float32(r.Float32()) if r.Intn(2) == 0 { this.StringToFloatMap[v8] *= -1 } } } if r.Intn(5) != 0 { v9 := r.Intn(10) this.Int32Map = make(map[int32]int32) for i := 0; i < v9; i++ { v10 := int32(r.Int31()) this.Int32Map[v10] = int32(r.Int31()) if r.Intn(2) == 0 { this.Int32Map[v10] *= -1 } } } if r.Intn(5) != 0 { v11 := r.Intn(10) this.Int64Map = make(map[int64]int64) for i := 0; i < v11; i++ { v12 := int64(r.Int63()) this.Int64Map[v12] = int64(r.Int63()) if r.Intn(2) == 0 { this.Int64Map[v12] *= -1 } } } if r.Intn(5) != 0 { v13 := r.Intn(10) this.Uint32Map = make(map[uint32]uint32) for i := 0; i < v13; i++ { v14 := uint32(r.Uint32()) this.Uint32Map[v14] = uint32(r.Uint32()) } } if r.Intn(5) != 0 { v15 := r.Intn(10) this.Uint64Map = make(map[uint64]uint64) for i := 0; i < v15; i++ { v16 := uint64(uint64(r.Uint32())) this.Uint64Map[v16] = uint64(uint64(r.Uint32())) } } if r.Intn(5) != 0 { v17 := r.Intn(10) this.Sint32Map = make(map[int32]int32) for i := 0; i < v17; i++ { v18 := int32(r.Int31()) this.Sint32Map[v18] = int32(r.Int31()) if r.Intn(2) == 0 { this.Sint32Map[v18] *= -1 } } } if r.Intn(5) != 0 { v19 := r.Intn(10) this.Sint64Map = make(map[int64]int64) for i := 0; i < v19; i++ { v20 := int64(r.Int63()) this.Sint64Map[v20] = int64(r.Int63()) if r.Intn(2) == 0 { this.Sint64Map[v20] *= -1 } } } if r.Intn(5) != 0 { v21 := r.Intn(10) this.Fixed32Map = make(map[uint32]uint32) for i := 0; i < v21; i++ { v22 := uint32(r.Uint32()) this.Fixed32Map[v22] = uint32(r.Uint32()) } } if r.Intn(5) != 0 { v23 := r.Intn(10) this.Sfixed32Map = make(map[int32]int32) for i := 0; i < v23; i++ { v24 := int32(r.Int31()) this.Sfixed32Map[v24] = int32(r.Int31()) if r.Intn(2) == 0 { this.Sfixed32Map[v24] *= -1 } } } if r.Intn(5) != 0 { v25 := r.Intn(10) this.Fixed64Map = make(map[uint64]uint64) for i := 0; i < v25; i++ { v26 := uint64(uint64(r.Uint32())) this.Fixed64Map[v26] = uint64(uint64(r.Uint32())) } } if r.Intn(5) != 0 { v27 := r.Intn(10) this.Sfixed64Map = make(map[int64]int64) for i := 0; i < v27; i++ { v28 := int64(r.Int63()) this.Sfixed64Map[v28] = int64(r.Int63()) if r.Intn(2) == 0 { this.Sfixed64Map[v28] *= -1 } } } if r.Intn(5) != 0 { v29 := r.Intn(10) this.BoolMap = make(map[bool]bool) for i := 0; i < v29; i++ { v30 := bool(bool(r.Intn(2) == 0)) this.BoolMap[v30] = bool(bool(r.Intn(2) == 0)) } } if r.Intn(5) != 0 { v31 := r.Intn(10) this.StringMap = make(map[string]string) for i := 0; i < v31; i++ { this.StringMap[randStringTheproto3(r)] = randStringTheproto3(r) } } if r.Intn(5) != 0 { v32 := r.Intn(10) this.StringToBytesMap = make(map[string][]byte) for i := 0; i < v32; i++ { v33 := r.Intn(100) v34 := randStringTheproto3(r) this.StringToBytesMap[v34] = make([]byte, v33) for i := 0; i < v33; i++ { this.StringToBytesMap[v34][i] = byte(r.Intn(256)) } } } if r.Intn(5) != 0 { v35 := r.Intn(10) this.StringToEnumMap = make(map[string]MapEnum) for i := 0; i < v35; i++ { this.StringToEnumMap[randStringTheproto3(r)] = MapEnum([]int32{0, 1, 2}[r.Intn(3)]) } } if r.Intn(5) != 0 { v36 := r.Intn(10) this.StringToMsgMap = make(map[string]*FloatingPoint) for i := 0; i < v36; i++ { this.StringToMsgMap[randStringTheproto3(r)] = NewPopulatedFloatingPoint(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 18) } return this } func NewPopulatedAllMapsOrdered(r randyTheproto3, easy bool) *AllMapsOrdered { this := &AllMapsOrdered{} if r.Intn(5) != 0 { v37 := r.Intn(10) this.StringToDoubleMap = make(map[string]float64) for i := 0; i < v37; i++ { v38 := randStringTheproto3(r) this.StringToDoubleMap[v38] = float64(r.Float64()) if r.Intn(2) == 0 { this.StringToDoubleMap[v38] *= -1 } } } if r.Intn(5) != 0 { v39 := r.Intn(10) this.StringToFloatMap = make(map[string]float32) for i := 0; i < v39; i++ { v40 := randStringTheproto3(r) this.StringToFloatMap[v40] = float32(r.Float32()) if r.Intn(2) == 0 { this.StringToFloatMap[v40] *= -1 } } } if r.Intn(5) != 0 { v41 := r.Intn(10) this.Int32Map = make(map[int32]int32) for i := 0; i < v41; i++ { v42 := int32(r.Int31()) this.Int32Map[v42] = int32(r.Int31()) if r.Intn(2) == 0 { this.Int32Map[v42] *= -1 } } } if r.Intn(5) != 0 { v43 := r.Intn(10) this.Int64Map = make(map[int64]int64) for i := 0; i < v43; i++ { v44 := int64(r.Int63()) this.Int64Map[v44] = int64(r.Int63()) if r.Intn(2) == 0 { this.Int64Map[v44] *= -1 } } } if r.Intn(5) != 0 { v45 := r.Intn(10) this.Uint32Map = make(map[uint32]uint32) for i := 0; i < v45; i++ { v46 := uint32(r.Uint32()) this.Uint32Map[v46] = uint32(r.Uint32()) } } if r.Intn(5) != 0 { v47 := r.Intn(10) this.Uint64Map = make(map[uint64]uint64) for i := 0; i < v47; i++ { v48 := uint64(uint64(r.Uint32())) this.Uint64Map[v48] = uint64(uint64(r.Uint32())) } } if r.Intn(5) != 0 { v49 := r.Intn(10) this.Sint32Map = make(map[int32]int32) for i := 0; i < v49; i++ { v50 := int32(r.Int31()) this.Sint32Map[v50] = int32(r.Int31()) if r.Intn(2) == 0 { this.Sint32Map[v50] *= -1 } } } if r.Intn(5) != 0 { v51 := r.Intn(10) this.Sint64Map = make(map[int64]int64) for i := 0; i < v51; i++ { v52 := int64(r.Int63()) this.Sint64Map[v52] = int64(r.Int63()) if r.Intn(2) == 0 { this.Sint64Map[v52] *= -1 } } } if r.Intn(5) != 0 { v53 := r.Intn(10) this.Fixed32Map = make(map[uint32]uint32) for i := 0; i < v53; i++ { v54 := uint32(r.Uint32()) this.Fixed32Map[v54] = uint32(r.Uint32()) } } if r.Intn(5) != 0 { v55 := r.Intn(10) this.Sfixed32Map = make(map[int32]int32) for i := 0; i < v55; i++ { v56 := int32(r.Int31()) this.Sfixed32Map[v56] = int32(r.Int31()) if r.Intn(2) == 0 { this.Sfixed32Map[v56] *= -1 } } } if r.Intn(5) != 0 { v57 := r.Intn(10) this.Fixed64Map = make(map[uint64]uint64) for i := 0; i < v57; i++ { v58 := uint64(uint64(r.Uint32())) this.Fixed64Map[v58] = uint64(uint64(r.Uint32())) } } if r.Intn(5) != 0 { v59 := r.Intn(10) this.Sfixed64Map = make(map[int64]int64) for i := 0; i < v59; i++ { v60 := int64(r.Int63()) this.Sfixed64Map[v60] = int64(r.Int63()) if r.Intn(2) == 0 { this.Sfixed64Map[v60] *= -1 } } } if r.Intn(5) != 0 { v61 := r.Intn(10) this.BoolMap = make(map[bool]bool) for i := 0; i < v61; i++ { v62 := bool(bool(r.Intn(2) == 0)) this.BoolMap[v62] = bool(bool(r.Intn(2) == 0)) } } if r.Intn(5) != 0 { v63 := r.Intn(10) this.StringMap = make(map[string]string) for i := 0; i < v63; i++ { this.StringMap[randStringTheproto3(r)] = randStringTheproto3(r) } } if r.Intn(5) != 0 { v64 := r.Intn(10) this.StringToBytesMap = make(map[string][]byte) for i := 0; i < v64; i++ { v65 := r.Intn(100) v66 := randStringTheproto3(r) this.StringToBytesMap[v66] = make([]byte, v65) for i := 0; i < v65; i++ { this.StringToBytesMap[v66][i] = byte(r.Intn(256)) } } } if r.Intn(5) != 0 { v67 := r.Intn(10) this.StringToEnumMap = make(map[string]MapEnum) for i := 0; i < v67; i++ { this.StringToEnumMap[randStringTheproto3(r)] = MapEnum([]int32{0, 1, 2}[r.Intn(3)]) } } if r.Intn(5) != 0 { v68 := r.Intn(10) this.StringToMsgMap = make(map[string]*FloatingPoint) for i := 0; i < v68; i++ { this.StringToMsgMap[randStringTheproto3(r)] = NewPopulatedFloatingPoint(r, easy) } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 18) } return this } func NewPopulatedMessageWithMap(r randyTheproto3, easy bool) *MessageWithMap { this := &MessageWithMap{} if r.Intn(5) != 0 { v69 := r.Intn(10) this.NameMapping = make(map[int32]string) for i := 0; i < v69; i++ { this.NameMapping[int32(r.Int31())] = randStringTheproto3(r) } } if r.Intn(5) != 0 { v70 := r.Intn(10) this.MsgMapping = make(map[int64]*FloatingPoint) for i := 0; i < v70; i++ { this.MsgMapping[int64(r.Int63())] = NewPopulatedFloatingPoint(r, easy) } } if r.Intn(5) != 0 { v71 := r.Intn(10) this.ByteMapping = make(map[bool][]byte) for i := 0; i < v71; i++ { v72 := r.Intn(100) v73 := bool(bool(r.Intn(2) == 0)) this.ByteMapping[v73] = make([]byte, v72) for i := 0; i < v72; i++ { this.ByteMapping[v73][i] = byte(r.Intn(256)) } } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 4) } return this } func NewPopulatedFloatingPoint(r randyTheproto3, easy bool) *FloatingPoint { this := &FloatingPoint{} this.F = float64(r.Float64()) if r.Intn(2) == 0 { this.F *= -1 } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 2) } return this } func NewPopulatedUint128Pair(r randyTheproto3, easy bool) *Uint128Pair { this := &Uint128Pair{} v74 := github_com_gogo_protobuf_test_custom.NewPopulatedUint128(r) this.Left = *v74 this.Right = github_com_gogo_protobuf_test_custom.NewPopulatedUint128(r) if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 3) } return this } func NewPopulatedContainsNestedMap(r randyTheproto3, easy bool) *ContainsNestedMap { this := &ContainsNestedMap{} if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 1) } return this } func NewPopulatedContainsNestedMap_NestedMap(r randyTheproto3, easy bool) *ContainsNestedMap_NestedMap { this := &ContainsNestedMap_NestedMap{} if r.Intn(5) != 0 { v75 := r.Intn(10) this.NestedMapField = make(map[string]float64) for i := 0; i < v75; i++ { v76 := randStringTheproto3(r) this.NestedMapField[v76] = float64(r.Float64()) if r.Intn(2) == 0 { this.NestedMapField[v76] *= -1 } } } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 2) } return this } func NewPopulatedNotPacked(r randyTheproto3, easy bool) *NotPacked { this := &NotPacked{} v77 := r.Intn(10) this.Key = make([]uint64, v77) for i := 0; i < v77; i++ { this.Key[i] = uint64(uint64(r.Uint32())) } if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedTheproto3(r, 6) } return this } type randyTheproto3 interface { Float32() float32 Float64() float64 Int63() int64 Int31() int32 Uint32() uint32 Intn(n int) int } func randUTF8RuneTheproto3(r randyTheproto3) rune { ru := r.Intn(62) if ru < 10 { return rune(ru + 48) } else if ru < 36 { return rune(ru + 55) } return rune(ru + 61) } func randStringTheproto3(r randyTheproto3) string { v78 := r.Intn(100) tmps := make([]rune, v78) for i := 0; i < v78; i++ { tmps[i] = randUTF8RuneTheproto3(r) } return string(tmps) } func randUnrecognizedTheproto3(r randyTheproto3, maxFieldNumber int) (dAtA []byte) { l := r.Intn(5) for i := 0; i < l; i++ { wire := r.Intn(4) if wire == 3 { wire = 5 } fieldNumber := maxFieldNumber + r.Intn(100) dAtA = randFieldTheproto3(dAtA, r, fieldNumber, wire) } return dAtA } func randFieldTheproto3(dAtA []byte, r randyTheproto3, fieldNumber int, wire int) []byte { key := uint32(fieldNumber)<<3 | uint32(wire) switch wire { case 0: dAtA = encodeVarintPopulateTheproto3(dAtA, uint64(key)) v79 := r.Int63() if r.Intn(2) == 0 { v79 *= -1 } dAtA = encodeVarintPopulateTheproto3(dAtA, uint64(v79)) case 1: dAtA = encodeVarintPopulateTheproto3(dAtA, uint64(key)) dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) case 2: dAtA = encodeVarintPopulateTheproto3(dAtA, uint64(key)) ll := r.Intn(100) dAtA = encodeVarintPopulateTheproto3(dAtA, uint64(ll)) for j := 0; j < ll; j++ { dAtA = append(dAtA, byte(r.Intn(256))) } default: dAtA = encodeVarintPopulateTheproto3(dAtA, uint64(key)) dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) } return dAtA } func encodeVarintPopulateTheproto3(dAtA []byte, v uint64) []byte { for v >= 1<<7 { dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) v >>= 7 } dAtA = append(dAtA, uint8(v)) return dAtA } func (m *Message) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Name) if l > 0 { n += 1 + l + sovTheproto3(uint64(l)) } if m.Hilarity != 0 { n += 1 + sovTheproto3(uint64(m.Hilarity)) } if m.HeightInCm != 0 { n += 1 + sovTheproto3(uint64(m.HeightInCm)) } l = len(m.Data) if l > 0 { n += 1 + l + sovTheproto3(uint64(l)) } if m.ResultCount != 0 { n += 1 + sovTheproto3(uint64(m.ResultCount)) } if m.TrueScotsman { n += 2 } if m.Score != 0 { n += 5 } if len(m.Key) > 0 { l = 0 for _, e := range m.Key { l += sovTheproto3(uint64(e)) } n += 1 + sovTheproto3(uint64(l)) + l } if m.Nested != nil { l = m.Nested.Size() n += 1 + l + sovTheproto3(uint64(l)) } if len(m.Terrain) > 0 { for k, v := range m.Terrain { _ = k _ = v l = 0 if v != nil { l = v.Size() l += 1 + sovTheproto3(uint64(l)) } mapEntrySize := 1 + sovTheproto3(uint64(k)) + l n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if m.Proto2Field != nil { l = m.Proto2Field.Size() n += 1 + l + sovTheproto3(uint64(l)) } if len(m.Proto2Value) > 0 { for k, v := range m.Proto2Value { _ = k _ = v l = 0 if v != nil { l = v.Size() l += 1 + sovTheproto3(uint64(l)) } mapEntrySize := 1 + sovTheproto3(uint64(k)) + l n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Nested) Size() (n int) { if m == nil { return 0 } var l int _ = l l = len(m.Bunny) if l > 0 { n += 1 + l + sovTheproto3(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *AllMaps) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.StringToDoubleMap) > 0 { for k, v := range m.StringToDoubleMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + 8 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToFloatMap) > 0 { for k, v := range m.StringToFloatMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + 4 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Int32Map) > 0 { for k, v := range m.Int32Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Int64Map) > 0 { for k, v := range m.Int64Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Uint32Map) > 0 { for k, v := range m.Uint32Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Uint64Map) > 0 { for k, v := range m.Uint64Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sint32Map) > 0 { for k, v := range m.Sint32Map { _ = k _ = v mapEntrySize := 1 + sozTheproto3(uint64(k)) + 1 + sozTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sint64Map) > 0 { for k, v := range m.Sint64Map { _ = k _ = v mapEntrySize := 1 + sozTheproto3(uint64(k)) + 1 + sozTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Fixed32Map) > 0 { for k, v := range m.Fixed32Map { _ = k _ = v mapEntrySize := 1 + 4 + 1 + 4 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sfixed32Map) > 0 { for k, v := range m.Sfixed32Map { _ = k _ = v mapEntrySize := 1 + 4 + 1 + 4 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Fixed64Map) > 0 { for k, v := range m.Fixed64Map { _ = k _ = v mapEntrySize := 1 + 8 + 1 + 8 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sfixed64Map) > 0 { for k, v := range m.Sfixed64Map { _ = k _ = v mapEntrySize := 1 + 8 + 1 + 8 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.BoolMap) > 0 { for k, v := range m.BoolMap { _ = k _ = v mapEntrySize := 1 + 1 + 1 + 1 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringMap) > 0 { for k, v := range m.StringMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + len(v) + sovTheproto3(uint64(len(v))) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToBytesMap) > 0 { for k, v := range m.StringToBytesMap { _ = k _ = v l = 0 if len(v) > 0 { l = 1 + len(v) + sovTheproto3(uint64(len(v))) } mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + l n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToEnumMap) > 0 { for k, v := range m.StringToEnumMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 2 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToMsgMap) > 0 { for k, v := range m.StringToMsgMap { _ = k _ = v l = 0 if v != nil { l = v.Size() l += 1 + sovTheproto3(uint64(l)) } mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + l n += mapEntrySize + 2 + sovTheproto3(uint64(mapEntrySize)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *AllMapsOrdered) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.StringToDoubleMap) > 0 { for k, v := range m.StringToDoubleMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + 8 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToFloatMap) > 0 { for k, v := range m.StringToFloatMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + 4 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Int32Map) > 0 { for k, v := range m.Int32Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Int64Map) > 0 { for k, v := range m.Int64Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Uint32Map) > 0 { for k, v := range m.Uint32Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Uint64Map) > 0 { for k, v := range m.Uint64Map { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sint32Map) > 0 { for k, v := range m.Sint32Map { _ = k _ = v mapEntrySize := 1 + sozTheproto3(uint64(k)) + 1 + sozTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sint64Map) > 0 { for k, v := range m.Sint64Map { _ = k _ = v mapEntrySize := 1 + sozTheproto3(uint64(k)) + 1 + sozTheproto3(uint64(v)) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Fixed32Map) > 0 { for k, v := range m.Fixed32Map { _ = k _ = v mapEntrySize := 1 + 4 + 1 + 4 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sfixed32Map) > 0 { for k, v := range m.Sfixed32Map { _ = k _ = v mapEntrySize := 1 + 4 + 1 + 4 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Fixed64Map) > 0 { for k, v := range m.Fixed64Map { _ = k _ = v mapEntrySize := 1 + 8 + 1 + 8 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.Sfixed64Map) > 0 { for k, v := range m.Sfixed64Map { _ = k _ = v mapEntrySize := 1 + 8 + 1 + 8 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.BoolMap) > 0 { for k, v := range m.BoolMap { _ = k _ = v mapEntrySize := 1 + 1 + 1 + 1 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringMap) > 0 { for k, v := range m.StringMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + len(v) + sovTheproto3(uint64(len(v))) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToBytesMap) > 0 { for k, v := range m.StringToBytesMap { _ = k _ = v l = 0 if len(v) > 0 { l = 1 + len(v) + sovTheproto3(uint64(len(v))) } mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + l n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToEnumMap) > 0 { for k, v := range m.StringToEnumMap { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + sovTheproto3(uint64(v)) n += mapEntrySize + 2 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.StringToMsgMap) > 0 { for k, v := range m.StringToMsgMap { _ = k _ = v l = 0 if v != nil { l = v.Size() l += 1 + sovTheproto3(uint64(l)) } mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + l n += mapEntrySize + 2 + sovTheproto3(uint64(mapEntrySize)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *MessageWithMap) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.NameMapping) > 0 { for k, v := range m.NameMapping { _ = k _ = v mapEntrySize := 1 + sovTheproto3(uint64(k)) + 1 + len(v) + sovTheproto3(uint64(len(v))) n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.MsgMapping) > 0 { for k, v := range m.MsgMapping { _ = k _ = v l = 0 if v != nil { l = v.Size() l += 1 + sovTheproto3(uint64(l)) } mapEntrySize := 1 + sozTheproto3(uint64(k)) + l n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if len(m.ByteMapping) > 0 { for k, v := range m.ByteMapping { _ = k _ = v l = 0 if len(v) > 0 { l = 1 + len(v) + sovTheproto3(uint64(len(v))) } mapEntrySize := 1 + 1 + l n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *FloatingPoint) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.F != 0 { n += 9 } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *Uint128Pair) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.Left.Size() n += 1 + l + sovTheproto3(uint64(l)) if m.Right != nil { l = m.Right.Size() n += 1 + l + sovTheproto3(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ContainsNestedMap) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *ContainsNestedMap_NestedMap) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.NestedMapField) > 0 { for k, v := range m.NestedMapField { _ = k _ = v mapEntrySize := 1 + len(k) + sovTheproto3(uint64(len(k))) + 1 + 8 n += mapEntrySize + 1 + sovTheproto3(uint64(mapEntrySize)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func (m *NotPacked) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.Key) > 0 { for _, e := range m.Key { n += 1 + sovTheproto3(uint64(e)) } } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } return n } func sovTheproto3(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTheproto3(x uint64) (n int) { return sovTheproto3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *Message) String() string { if this == nil { return "nil" } keysForTerrain := make([]int64, 0, len(this.Terrain)) for k := range this.Terrain { keysForTerrain = append(keysForTerrain, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForTerrain) mapStringForTerrain := "map[int64]*Nested{" for _, k := range keysForTerrain { mapStringForTerrain += fmt.Sprintf("%v: %v,", k, this.Terrain[k]) } mapStringForTerrain += "}" keysForProto2Value := make([]int64, 0, len(this.Proto2Value)) for k := range this.Proto2Value { keysForProto2Value = append(keysForProto2Value, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForProto2Value) mapStringForProto2Value := "map[int64]*both.NinOptEnum{" for _, k := range keysForProto2Value { mapStringForProto2Value += fmt.Sprintf("%v: %v,", k, this.Proto2Value[k]) } mapStringForProto2Value += "}" s := strings.Join([]string{`&Message{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Hilarity:` + fmt.Sprintf("%v", this.Hilarity) + `,`, `HeightInCm:` + fmt.Sprintf("%v", this.HeightInCm) + `,`, `Data:` + fmt.Sprintf("%v", this.Data) + `,`, `ResultCount:` + fmt.Sprintf("%v", this.ResultCount) + `,`, `TrueScotsman:` + fmt.Sprintf("%v", this.TrueScotsman) + `,`, `Score:` + fmt.Sprintf("%v", this.Score) + `,`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `Nested:` + strings.Replace(this.Nested.String(), "Nested", "Nested", 1) + `,`, `Terrain:` + mapStringForTerrain + `,`, `Proto2Field:` + strings.Replace(fmt.Sprintf("%v", this.Proto2Field), "NinOptNative", "both.NinOptNative", 1) + `,`, `Proto2Value:` + mapStringForProto2Value + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Nested) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Nested{`, `Bunny:` + fmt.Sprintf("%v", this.Bunny) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *AllMaps) String() string { if this == nil { return "nil" } keysForStringToDoubleMap := make([]string, 0, len(this.StringToDoubleMap)) for k := range this.StringToDoubleMap { keysForStringToDoubleMap = append(keysForStringToDoubleMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToDoubleMap) mapStringForStringToDoubleMap := "map[string]float64{" for _, k := range keysForStringToDoubleMap { mapStringForStringToDoubleMap += fmt.Sprintf("%v: %v,", k, this.StringToDoubleMap[k]) } mapStringForStringToDoubleMap += "}" keysForStringToFloatMap := make([]string, 0, len(this.StringToFloatMap)) for k := range this.StringToFloatMap { keysForStringToFloatMap = append(keysForStringToFloatMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToFloatMap) mapStringForStringToFloatMap := "map[string]float32{" for _, k := range keysForStringToFloatMap { mapStringForStringToFloatMap += fmt.Sprintf("%v: %v,", k, this.StringToFloatMap[k]) } mapStringForStringToFloatMap += "}" keysForInt32Map := make([]int32, 0, len(this.Int32Map)) for k := range this.Int32Map { keysForInt32Map = append(keysForInt32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForInt32Map) mapStringForInt32Map := "map[int32]int32{" for _, k := range keysForInt32Map { mapStringForInt32Map += fmt.Sprintf("%v: %v,", k, this.Int32Map[k]) } mapStringForInt32Map += "}" keysForInt64Map := make([]int64, 0, len(this.Int64Map)) for k := range this.Int64Map { keysForInt64Map = append(keysForInt64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForInt64Map) mapStringForInt64Map := "map[int64]int64{" for _, k := range keysForInt64Map { mapStringForInt64Map += fmt.Sprintf("%v: %v,", k, this.Int64Map[k]) } mapStringForInt64Map += "}" keysForUint32Map := make([]uint32, 0, len(this.Uint32Map)) for k := range this.Uint32Map { keysForUint32Map = append(keysForUint32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForUint32Map) mapStringForUint32Map := "map[uint32]uint32{" for _, k := range keysForUint32Map { mapStringForUint32Map += fmt.Sprintf("%v: %v,", k, this.Uint32Map[k]) } mapStringForUint32Map += "}" keysForUint64Map := make([]uint64, 0, len(this.Uint64Map)) for k := range this.Uint64Map { keysForUint64Map = append(keysForUint64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForUint64Map) mapStringForUint64Map := "map[uint64]uint64{" for _, k := range keysForUint64Map { mapStringForUint64Map += fmt.Sprintf("%v: %v,", k, this.Uint64Map[k]) } mapStringForUint64Map += "}" keysForSint32Map := make([]int32, 0, len(this.Sint32Map)) for k := range this.Sint32Map { keysForSint32Map = append(keysForSint32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSint32Map) mapStringForSint32Map := "map[int32]int32{" for _, k := range keysForSint32Map { mapStringForSint32Map += fmt.Sprintf("%v: %v,", k, this.Sint32Map[k]) } mapStringForSint32Map += "}" keysForSint64Map := make([]int64, 0, len(this.Sint64Map)) for k := range this.Sint64Map { keysForSint64Map = append(keysForSint64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSint64Map) mapStringForSint64Map := "map[int64]int64{" for _, k := range keysForSint64Map { mapStringForSint64Map += fmt.Sprintf("%v: %v,", k, this.Sint64Map[k]) } mapStringForSint64Map += "}" keysForFixed32Map := make([]uint32, 0, len(this.Fixed32Map)) for k := range this.Fixed32Map { keysForFixed32Map = append(keysForFixed32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForFixed32Map) mapStringForFixed32Map := "map[uint32]uint32{" for _, k := range keysForFixed32Map { mapStringForFixed32Map += fmt.Sprintf("%v: %v,", k, this.Fixed32Map[k]) } mapStringForFixed32Map += "}" keysForSfixed32Map := make([]int32, 0, len(this.Sfixed32Map)) for k := range this.Sfixed32Map { keysForSfixed32Map = append(keysForSfixed32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSfixed32Map) mapStringForSfixed32Map := "map[int32]int32{" for _, k := range keysForSfixed32Map { mapStringForSfixed32Map += fmt.Sprintf("%v: %v,", k, this.Sfixed32Map[k]) } mapStringForSfixed32Map += "}" keysForFixed64Map := make([]uint64, 0, len(this.Fixed64Map)) for k := range this.Fixed64Map { keysForFixed64Map = append(keysForFixed64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForFixed64Map) mapStringForFixed64Map := "map[uint64]uint64{" for _, k := range keysForFixed64Map { mapStringForFixed64Map += fmt.Sprintf("%v: %v,", k, this.Fixed64Map[k]) } mapStringForFixed64Map += "}" keysForSfixed64Map := make([]int64, 0, len(this.Sfixed64Map)) for k := range this.Sfixed64Map { keysForSfixed64Map = append(keysForSfixed64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSfixed64Map) mapStringForSfixed64Map := "map[int64]int64{" for _, k := range keysForSfixed64Map { mapStringForSfixed64Map += fmt.Sprintf("%v: %v,", k, this.Sfixed64Map[k]) } mapStringForSfixed64Map += "}" keysForBoolMap := make([]bool, 0, len(this.BoolMap)) for k := range this.BoolMap { keysForBoolMap = append(keysForBoolMap, k) } github_com_gogo_protobuf_sortkeys.Bools(keysForBoolMap) mapStringForBoolMap := "map[bool]bool{" for _, k := range keysForBoolMap { mapStringForBoolMap += fmt.Sprintf("%v: %v,", k, this.BoolMap[k]) } mapStringForBoolMap += "}" keysForStringMap := make([]string, 0, len(this.StringMap)) for k := range this.StringMap { keysForStringMap = append(keysForStringMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringMap) mapStringForStringMap := "map[string]string{" for _, k := range keysForStringMap { mapStringForStringMap += fmt.Sprintf("%v: %v,", k, this.StringMap[k]) } mapStringForStringMap += "}" keysForStringToBytesMap := make([]string, 0, len(this.StringToBytesMap)) for k := range this.StringToBytesMap { keysForStringToBytesMap = append(keysForStringToBytesMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToBytesMap) mapStringForStringToBytesMap := "map[string][]byte{" for _, k := range keysForStringToBytesMap { mapStringForStringToBytesMap += fmt.Sprintf("%v: %v,", k, this.StringToBytesMap[k]) } mapStringForStringToBytesMap += "}" keysForStringToEnumMap := make([]string, 0, len(this.StringToEnumMap)) for k := range this.StringToEnumMap { keysForStringToEnumMap = append(keysForStringToEnumMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToEnumMap) mapStringForStringToEnumMap := "map[string]MapEnum{" for _, k := range keysForStringToEnumMap { mapStringForStringToEnumMap += fmt.Sprintf("%v: %v,", k, this.StringToEnumMap[k]) } mapStringForStringToEnumMap += "}" keysForStringToMsgMap := make([]string, 0, len(this.StringToMsgMap)) for k := range this.StringToMsgMap { keysForStringToMsgMap = append(keysForStringToMsgMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToMsgMap) mapStringForStringToMsgMap := "map[string]*FloatingPoint{" for _, k := range keysForStringToMsgMap { mapStringForStringToMsgMap += fmt.Sprintf("%v: %v,", k, this.StringToMsgMap[k]) } mapStringForStringToMsgMap += "}" s := strings.Join([]string{`&AllMaps{`, `StringToDoubleMap:` + mapStringForStringToDoubleMap + `,`, `StringToFloatMap:` + mapStringForStringToFloatMap + `,`, `Int32Map:` + mapStringForInt32Map + `,`, `Int64Map:` + mapStringForInt64Map + `,`, `Uint32Map:` + mapStringForUint32Map + `,`, `Uint64Map:` + mapStringForUint64Map + `,`, `Sint32Map:` + mapStringForSint32Map + `,`, `Sint64Map:` + mapStringForSint64Map + `,`, `Fixed32Map:` + mapStringForFixed32Map + `,`, `Sfixed32Map:` + mapStringForSfixed32Map + `,`, `Fixed64Map:` + mapStringForFixed64Map + `,`, `Sfixed64Map:` + mapStringForSfixed64Map + `,`, `BoolMap:` + mapStringForBoolMap + `,`, `StringMap:` + mapStringForStringMap + `,`, `StringToBytesMap:` + mapStringForStringToBytesMap + `,`, `StringToEnumMap:` + mapStringForStringToEnumMap + `,`, `StringToMsgMap:` + mapStringForStringToMsgMap + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *AllMapsOrdered) String() string { if this == nil { return "nil" } keysForStringToDoubleMap := make([]string, 0, len(this.StringToDoubleMap)) for k := range this.StringToDoubleMap { keysForStringToDoubleMap = append(keysForStringToDoubleMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToDoubleMap) mapStringForStringToDoubleMap := "map[string]float64{" for _, k := range keysForStringToDoubleMap { mapStringForStringToDoubleMap += fmt.Sprintf("%v: %v,", k, this.StringToDoubleMap[k]) } mapStringForStringToDoubleMap += "}" keysForStringToFloatMap := make([]string, 0, len(this.StringToFloatMap)) for k := range this.StringToFloatMap { keysForStringToFloatMap = append(keysForStringToFloatMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToFloatMap) mapStringForStringToFloatMap := "map[string]float32{" for _, k := range keysForStringToFloatMap { mapStringForStringToFloatMap += fmt.Sprintf("%v: %v,", k, this.StringToFloatMap[k]) } mapStringForStringToFloatMap += "}" keysForInt32Map := make([]int32, 0, len(this.Int32Map)) for k := range this.Int32Map { keysForInt32Map = append(keysForInt32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForInt32Map) mapStringForInt32Map := "map[int32]int32{" for _, k := range keysForInt32Map { mapStringForInt32Map += fmt.Sprintf("%v: %v,", k, this.Int32Map[k]) } mapStringForInt32Map += "}" keysForInt64Map := make([]int64, 0, len(this.Int64Map)) for k := range this.Int64Map { keysForInt64Map = append(keysForInt64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForInt64Map) mapStringForInt64Map := "map[int64]int64{" for _, k := range keysForInt64Map { mapStringForInt64Map += fmt.Sprintf("%v: %v,", k, this.Int64Map[k]) } mapStringForInt64Map += "}" keysForUint32Map := make([]uint32, 0, len(this.Uint32Map)) for k := range this.Uint32Map { keysForUint32Map = append(keysForUint32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForUint32Map) mapStringForUint32Map := "map[uint32]uint32{" for _, k := range keysForUint32Map { mapStringForUint32Map += fmt.Sprintf("%v: %v,", k, this.Uint32Map[k]) } mapStringForUint32Map += "}" keysForUint64Map := make([]uint64, 0, len(this.Uint64Map)) for k := range this.Uint64Map { keysForUint64Map = append(keysForUint64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForUint64Map) mapStringForUint64Map := "map[uint64]uint64{" for _, k := range keysForUint64Map { mapStringForUint64Map += fmt.Sprintf("%v: %v,", k, this.Uint64Map[k]) } mapStringForUint64Map += "}" keysForSint32Map := make([]int32, 0, len(this.Sint32Map)) for k := range this.Sint32Map { keysForSint32Map = append(keysForSint32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSint32Map) mapStringForSint32Map := "map[int32]int32{" for _, k := range keysForSint32Map { mapStringForSint32Map += fmt.Sprintf("%v: %v,", k, this.Sint32Map[k]) } mapStringForSint32Map += "}" keysForSint64Map := make([]int64, 0, len(this.Sint64Map)) for k := range this.Sint64Map { keysForSint64Map = append(keysForSint64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSint64Map) mapStringForSint64Map := "map[int64]int64{" for _, k := range keysForSint64Map { mapStringForSint64Map += fmt.Sprintf("%v: %v,", k, this.Sint64Map[k]) } mapStringForSint64Map += "}" keysForFixed32Map := make([]uint32, 0, len(this.Fixed32Map)) for k := range this.Fixed32Map { keysForFixed32Map = append(keysForFixed32Map, k) } github_com_gogo_protobuf_sortkeys.Uint32s(keysForFixed32Map) mapStringForFixed32Map := "map[uint32]uint32{" for _, k := range keysForFixed32Map { mapStringForFixed32Map += fmt.Sprintf("%v: %v,", k, this.Fixed32Map[k]) } mapStringForFixed32Map += "}" keysForSfixed32Map := make([]int32, 0, len(this.Sfixed32Map)) for k := range this.Sfixed32Map { keysForSfixed32Map = append(keysForSfixed32Map, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForSfixed32Map) mapStringForSfixed32Map := "map[int32]int32{" for _, k := range keysForSfixed32Map { mapStringForSfixed32Map += fmt.Sprintf("%v: %v,", k, this.Sfixed32Map[k]) } mapStringForSfixed32Map += "}" keysForFixed64Map := make([]uint64, 0, len(this.Fixed64Map)) for k := range this.Fixed64Map { keysForFixed64Map = append(keysForFixed64Map, k) } github_com_gogo_protobuf_sortkeys.Uint64s(keysForFixed64Map) mapStringForFixed64Map := "map[uint64]uint64{" for _, k := range keysForFixed64Map { mapStringForFixed64Map += fmt.Sprintf("%v: %v,", k, this.Fixed64Map[k]) } mapStringForFixed64Map += "}" keysForSfixed64Map := make([]int64, 0, len(this.Sfixed64Map)) for k := range this.Sfixed64Map { keysForSfixed64Map = append(keysForSfixed64Map, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForSfixed64Map) mapStringForSfixed64Map := "map[int64]int64{" for _, k := range keysForSfixed64Map { mapStringForSfixed64Map += fmt.Sprintf("%v: %v,", k, this.Sfixed64Map[k]) } mapStringForSfixed64Map += "}" keysForBoolMap := make([]bool, 0, len(this.BoolMap)) for k := range this.BoolMap { keysForBoolMap = append(keysForBoolMap, k) } github_com_gogo_protobuf_sortkeys.Bools(keysForBoolMap) mapStringForBoolMap := "map[bool]bool{" for _, k := range keysForBoolMap { mapStringForBoolMap += fmt.Sprintf("%v: %v,", k, this.BoolMap[k]) } mapStringForBoolMap += "}" keysForStringMap := make([]string, 0, len(this.StringMap)) for k := range this.StringMap { keysForStringMap = append(keysForStringMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringMap) mapStringForStringMap := "map[string]string{" for _, k := range keysForStringMap { mapStringForStringMap += fmt.Sprintf("%v: %v,", k, this.StringMap[k]) } mapStringForStringMap += "}" keysForStringToBytesMap := make([]string, 0, len(this.StringToBytesMap)) for k := range this.StringToBytesMap { keysForStringToBytesMap = append(keysForStringToBytesMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToBytesMap) mapStringForStringToBytesMap := "map[string][]byte{" for _, k := range keysForStringToBytesMap { mapStringForStringToBytesMap += fmt.Sprintf("%v: %v,", k, this.StringToBytesMap[k]) } mapStringForStringToBytesMap += "}" keysForStringToEnumMap := make([]string, 0, len(this.StringToEnumMap)) for k := range this.StringToEnumMap { keysForStringToEnumMap = append(keysForStringToEnumMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToEnumMap) mapStringForStringToEnumMap := "map[string]MapEnum{" for _, k := range keysForStringToEnumMap { mapStringForStringToEnumMap += fmt.Sprintf("%v: %v,", k, this.StringToEnumMap[k]) } mapStringForStringToEnumMap += "}" keysForStringToMsgMap := make([]string, 0, len(this.StringToMsgMap)) for k := range this.StringToMsgMap { keysForStringToMsgMap = append(keysForStringToMsgMap, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForStringToMsgMap) mapStringForStringToMsgMap := "map[string]*FloatingPoint{" for _, k := range keysForStringToMsgMap { mapStringForStringToMsgMap += fmt.Sprintf("%v: %v,", k, this.StringToMsgMap[k]) } mapStringForStringToMsgMap += "}" s := strings.Join([]string{`&AllMapsOrdered{`, `StringToDoubleMap:` + mapStringForStringToDoubleMap + `,`, `StringToFloatMap:` + mapStringForStringToFloatMap + `,`, `Int32Map:` + mapStringForInt32Map + `,`, `Int64Map:` + mapStringForInt64Map + `,`, `Uint32Map:` + mapStringForUint32Map + `,`, `Uint64Map:` + mapStringForUint64Map + `,`, `Sint32Map:` + mapStringForSint32Map + `,`, `Sint64Map:` + mapStringForSint64Map + `,`, `Fixed32Map:` + mapStringForFixed32Map + `,`, `Sfixed32Map:` + mapStringForSfixed32Map + `,`, `Fixed64Map:` + mapStringForFixed64Map + `,`, `Sfixed64Map:` + mapStringForSfixed64Map + `,`, `BoolMap:` + mapStringForBoolMap + `,`, `StringMap:` + mapStringForStringMap + `,`, `StringToBytesMap:` + mapStringForStringToBytesMap + `,`, `StringToEnumMap:` + mapStringForStringToEnumMap + `,`, `StringToMsgMap:` + mapStringForStringToMsgMap + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *MessageWithMap) String() string { if this == nil { return "nil" } keysForNameMapping := make([]int32, 0, len(this.NameMapping)) for k := range this.NameMapping { keysForNameMapping = append(keysForNameMapping, k) } github_com_gogo_protobuf_sortkeys.Int32s(keysForNameMapping) mapStringForNameMapping := "map[int32]string{" for _, k := range keysForNameMapping { mapStringForNameMapping += fmt.Sprintf("%v: %v,", k, this.NameMapping[k]) } mapStringForNameMapping += "}" keysForMsgMapping := make([]int64, 0, len(this.MsgMapping)) for k := range this.MsgMapping { keysForMsgMapping = append(keysForMsgMapping, k) } github_com_gogo_protobuf_sortkeys.Int64s(keysForMsgMapping) mapStringForMsgMapping := "map[int64]*FloatingPoint{" for _, k := range keysForMsgMapping { mapStringForMsgMapping += fmt.Sprintf("%v: %v,", k, this.MsgMapping[k]) } mapStringForMsgMapping += "}" keysForByteMapping := make([]bool, 0, len(this.ByteMapping)) for k := range this.ByteMapping { keysForByteMapping = append(keysForByteMapping, k) } github_com_gogo_protobuf_sortkeys.Bools(keysForByteMapping) mapStringForByteMapping := "map[bool][]byte{" for _, k := range keysForByteMapping { mapStringForByteMapping += fmt.Sprintf("%v: %v,", k, this.ByteMapping[k]) } mapStringForByteMapping += "}" s := strings.Join([]string{`&MessageWithMap{`, `NameMapping:` + mapStringForNameMapping + `,`, `MsgMapping:` + mapStringForMsgMapping + `,`, `ByteMapping:` + mapStringForByteMapping + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *FloatingPoint) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&FloatingPoint{`, `F:` + fmt.Sprintf("%v", this.F) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *Uint128Pair) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&Uint128Pair{`, `Left:` + fmt.Sprintf("%v", this.Left) + `,`, `Right:` + fmt.Sprintf("%v", this.Right) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ContainsNestedMap) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&ContainsNestedMap{`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *ContainsNestedMap_NestedMap) String() string { if this == nil { return "nil" } keysForNestedMapField := make([]string, 0, len(this.NestedMapField)) for k := range this.NestedMapField { keysForNestedMapField = append(keysForNestedMapField, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForNestedMapField) mapStringForNestedMapField := "map[string]float64{" for _, k := range keysForNestedMapField { mapStringForNestedMapField += fmt.Sprintf("%v: %v,", k, this.NestedMapField[k]) } mapStringForNestedMapField += "}" s := strings.Join([]string{`&ContainsNestedMap_NestedMap{`, `NestedMapField:` + mapStringForNestedMapField + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func (this *NotPacked) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&NotPacked{`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") return s } func valueToStringTheproto3(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *Message) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: Message: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Hilarity", wireType) } m.Hilarity = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.Hilarity |= Message_Humour(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field HeightInCm", wireType) } m.HeightInCm = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.HeightInCm |= uint32(b&0x7F) << shift if b < 0x80 { break } } case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) if m.Data == nil { m.Data = []byte{} } iNdEx = postIndex case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ResultCount", wireType) } m.ResultCount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ m.ResultCount |= int64(b&0x7F) << shift if b < 0x80 { break } } case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TrueScotsman", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } m.TrueScotsman = bool(v != 0) case 9: if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field Score", wireType) } var v uint32 if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 m.Score = float32(math.Float32frombits(v)) case 5: if wireType == 0 { var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= uint64(b&0x7F) << shift if b < 0x80 { break } } m.Key = append(m.Key, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ packedLen |= int(b&0x7F) << shift if b < 0x80 { break } } if packedLen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + packedLen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } var elementCount int var count int for _, integer := range dAtA[iNdEx:postIndex] { if integer < 128 { count++ } } elementCount = count if elementCount != 0 && len(m.Key) == 0 { m.Key = make([]uint64, 0, elementCount) } for iNdEx < postIndex { var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= uint64(b&0x7F) << shift if b < 0x80 { break } } m.Key = append(m.Key, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Nested", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Nested == nil { m.Nested = &Nested{} } if err := m.Nested.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Terrain", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Terrain == nil { m.Terrain = make(map[int64]*Nested) } var mapkey int64 var mapvalue *Nested for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= int64(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthTheproto3 } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthTheproto3 } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &Nested{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Terrain[mapkey] = mapvalue iNdEx = postIndex case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Proto2Field", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Proto2Field == nil { m.Proto2Field = &both.NinOptNative{} } if err := m.Proto2Field.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Proto2Value", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Proto2Value == nil { m.Proto2Value = make(map[int64]*both.NinOptEnum) } var mapkey int64 var mapvalue *both.NinOptEnum for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= int64(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthTheproto3 } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthTheproto3 } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &both.NinOptEnum{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Proto2Value[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *Nested) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: Nested: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: Nested: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Bunny", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } m.Bunny = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *AllMaps) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: AllMaps: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: AllMaps: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToDoubleMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToDoubleMap == nil { m.StringToDoubleMap = make(map[string]float64) } var mapkey string var mapvalue float64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapvaluetemp uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapvaluetemp = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 mapvalue = math.Float64frombits(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToDoubleMap[mapkey] = mapvalue iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToFloatMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToFloatMap == nil { m.StringToFloatMap = make(map[string]float32) } var mapkey string var mapvalue float32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapvaluetemp uint32 if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapvaluetemp = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 mapvalue = math.Float32frombits(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToFloatMap[mapkey] = mapvalue iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Int32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Int32Map == nil { m.Int32Map = make(map[int32]int32) } var mapkey int32 var mapvalue int32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= int32(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= int32(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Int32Map[mapkey] = mapvalue iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Int64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Int64Map == nil { m.Int64Map = make(map[int64]int64) } var mapkey int64 var mapvalue int64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= int64(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= int64(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Int64Map[mapkey] = mapvalue iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Uint32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Uint32Map == nil { m.Uint32Map = make(map[uint32]uint32) } var mapkey uint32 var mapvalue uint32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= uint32(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= uint32(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Uint32Map[mapkey] = mapvalue iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Uint64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Uint64Map == nil { m.Uint64Map = make(map[uint64]uint64) } var mapkey uint64 var mapvalue uint64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Uint64Map[mapkey] = mapvalue iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sint32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sint32Map == nil { m.Sint32Map = make(map[int32]int32) } var mapkey int32 var mapvalue int32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= int32(b&0x7F) << shift if b < 0x80 { break } } mapkeytemp = int32((uint32(mapkeytemp) >> 1) ^ uint32(((mapkeytemp&1)<<31)>>31)) mapkey = int32(mapkeytemp) } else if fieldNum == 2 { var mapvaluetemp int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvaluetemp |= int32(b&0x7F) << shift if b < 0x80 { break } } mapvaluetemp = int32((uint32(mapvaluetemp) >> 1) ^ uint32(((mapvaluetemp&1)<<31)>>31)) mapvalue = int32(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sint32Map[mapkey] = mapvalue iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sint64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sint64Map == nil { m.Sint64Map = make(map[int64]int64) } var mapkey int64 var mapvalue int64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= uint64(b&0x7F) << shift if b < 0x80 { break } } mapkeytemp = (mapkeytemp >> 1) ^ uint64((int64(mapkeytemp&1)<<63)>>63) mapkey = int64(mapkeytemp) } else if fieldNum == 2 { var mapvaluetemp uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvaluetemp |= uint64(b&0x7F) << shift if b < 0x80 { break } } mapvaluetemp = (mapvaluetemp >> 1) ^ uint64((int64(mapvaluetemp&1)<<63)>>63) mapvalue = int64(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sint64Map[mapkey] = mapvalue iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Fixed32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Fixed32Map == nil { m.Fixed32Map = make(map[uint32]uint32) } var mapkey uint32 var mapvalue uint32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapkey = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else if fieldNum == 2 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapvalue = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Fixed32Map[mapkey] = mapvalue iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sfixed32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sfixed32Map == nil { m.Sfixed32Map = make(map[int32]int32) } var mapkey int32 var mapvalue int32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapkey = int32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else if fieldNum == 2 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapvalue = int32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sfixed32Map[mapkey] = mapvalue iNdEx = postIndex case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Fixed64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Fixed64Map == nil { m.Fixed64Map = make(map[uint64]uint64) } var mapkey uint64 var mapvalue uint64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapkey = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else if fieldNum == 2 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapvalue = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Fixed64Map[mapkey] = mapvalue iNdEx = postIndex case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sfixed64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sfixed64Map == nil { m.Sfixed64Map = make(map[int64]int64) } var mapkey int64 var mapvalue int64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapkey = int64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else if fieldNum == 2 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapvalue = int64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sfixed64Map[mapkey] = mapvalue iNdEx = postIndex case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BoolMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.BoolMap == nil { m.BoolMap = make(map[bool]bool) } var mapkey bool var mapvalue bool for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= int(b&0x7F) << shift if b < 0x80 { break } } mapkey = bool(mapkeytemp != 0) } else if fieldNum == 2 { var mapvaluetemp int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvaluetemp |= int(b&0x7F) << shift if b < 0x80 { break } } mapvalue = bool(mapvaluetemp != 0) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.BoolMap[mapkey] = mapvalue iNdEx = postIndex case 14: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringMap == nil { m.StringMap = make(map[string]string) } var mapkey string var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringMap[mapkey] = mapvalue iNdEx = postIndex case 15: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToBytesMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToBytesMap == nil { m.StringToBytesMap = make(map[string][]byte) } var mapkey string mapvalue := []byte{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapbyteLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapbyteLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intMapbyteLen := int(mapbyteLen) if intMapbyteLen < 0 { return ErrInvalidLengthTheproto3 } postbytesIndex := iNdEx + intMapbyteLen if postbytesIndex < 0 { return ErrInvalidLengthTheproto3 } if postbytesIndex > l { return io.ErrUnexpectedEOF } mapvalue = make([]byte, mapbyteLen) copy(mapvalue, dAtA[iNdEx:postbytesIndex]) iNdEx = postbytesIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToBytesMap[mapkey] = mapvalue iNdEx = postIndex case 16: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToEnumMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToEnumMap == nil { m.StringToEnumMap = make(map[string]MapEnum) } var mapkey string var mapvalue MapEnum for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= MapEnum(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToEnumMap[mapkey] = mapvalue iNdEx = postIndex case 17: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToMsgMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToMsgMap == nil { m.StringToMsgMap = make(map[string]*FloatingPoint) } var mapkey string var mapvalue *FloatingPoint for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthTheproto3 } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthTheproto3 } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &FloatingPoint{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToMsgMap[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *AllMapsOrdered) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: AllMapsOrdered: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: AllMapsOrdered: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToDoubleMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToDoubleMap == nil { m.StringToDoubleMap = make(map[string]float64) } var mapkey string var mapvalue float64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapvaluetemp uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapvaluetemp = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 mapvalue = math.Float64frombits(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToDoubleMap[mapkey] = mapvalue iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToFloatMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToFloatMap == nil { m.StringToFloatMap = make(map[string]float32) } var mapkey string var mapvalue float32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapvaluetemp uint32 if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapvaluetemp = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 mapvalue = math.Float32frombits(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToFloatMap[mapkey] = mapvalue iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Int32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Int32Map == nil { m.Int32Map = make(map[int32]int32) } var mapkey int32 var mapvalue int32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= int32(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= int32(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Int32Map[mapkey] = mapvalue iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Int64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Int64Map == nil { m.Int64Map = make(map[int64]int64) } var mapkey int64 var mapvalue int64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= int64(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= int64(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Int64Map[mapkey] = mapvalue iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Uint32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Uint32Map == nil { m.Uint32Map = make(map[uint32]uint32) } var mapkey uint32 var mapvalue uint32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= uint32(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= uint32(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Uint32Map[mapkey] = mapvalue iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Uint64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Uint64Map == nil { m.Uint64Map = make(map[uint64]uint64) } var mapkey uint64 var mapvalue uint64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Uint64Map[mapkey] = mapvalue iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sint32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sint32Map == nil { m.Sint32Map = make(map[int32]int32) } var mapkey int32 var mapvalue int32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= int32(b&0x7F) << shift if b < 0x80 { break } } mapkeytemp = int32((uint32(mapkeytemp) >> 1) ^ uint32(((mapkeytemp&1)<<31)>>31)) mapkey = int32(mapkeytemp) } else if fieldNum == 2 { var mapvaluetemp int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvaluetemp |= int32(b&0x7F) << shift if b < 0x80 { break } } mapvaluetemp = int32((uint32(mapvaluetemp) >> 1) ^ uint32(((mapvaluetemp&1)<<31)>>31)) mapvalue = int32(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sint32Map[mapkey] = mapvalue iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sint64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sint64Map == nil { m.Sint64Map = make(map[int64]int64) } var mapkey int64 var mapvalue int64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= uint64(b&0x7F) << shift if b < 0x80 { break } } mapkeytemp = (mapkeytemp >> 1) ^ uint64((int64(mapkeytemp&1)<<63)>>63) mapkey = int64(mapkeytemp) } else if fieldNum == 2 { var mapvaluetemp uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvaluetemp |= uint64(b&0x7F) << shift if b < 0x80 { break } } mapvaluetemp = (mapvaluetemp >> 1) ^ uint64((int64(mapvaluetemp&1)<<63)>>63) mapvalue = int64(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sint64Map[mapkey] = mapvalue iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Fixed32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Fixed32Map == nil { m.Fixed32Map = make(map[uint32]uint32) } var mapkey uint32 var mapvalue uint32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapkey = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else if fieldNum == 2 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapvalue = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Fixed32Map[mapkey] = mapvalue iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sfixed32Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sfixed32Map == nil { m.Sfixed32Map = make(map[int32]int32) } var mapkey int32 var mapvalue int32 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapkey = int32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else if fieldNum == 2 { if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } mapvalue = int32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) iNdEx += 4 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sfixed32Map[mapkey] = mapvalue iNdEx = postIndex case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Fixed64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Fixed64Map == nil { m.Fixed64Map = make(map[uint64]uint64) } var mapkey uint64 var mapvalue uint64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapkey = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else if fieldNum == 2 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapvalue = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Fixed64Map[mapkey] = mapvalue iNdEx = postIndex case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Sfixed64Map", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.Sfixed64Map == nil { m.Sfixed64Map = make(map[int64]int64) } var mapkey int64 var mapvalue int64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapkey = int64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else if fieldNum == 2 { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapvalue = int64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Sfixed64Map[mapkey] = mapvalue iNdEx = postIndex case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BoolMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.BoolMap == nil { m.BoolMap = make(map[bool]bool) } var mapkey bool var mapvalue bool for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= int(b&0x7F) << shift if b < 0x80 { break } } mapkey = bool(mapkeytemp != 0) } else if fieldNum == 2 { var mapvaluetemp int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvaluetemp |= int(b&0x7F) << shift if b < 0x80 { break } } mapvalue = bool(mapvaluetemp != 0) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.BoolMap[mapkey] = mapvalue iNdEx = postIndex case 14: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringMap == nil { m.StringMap = make(map[string]string) } var mapkey string var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringMap[mapkey] = mapvalue iNdEx = postIndex case 15: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToBytesMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToBytesMap == nil { m.StringToBytesMap = make(map[string][]byte) } var mapkey string mapvalue := []byte{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapbyteLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapbyteLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intMapbyteLen := int(mapbyteLen) if intMapbyteLen < 0 { return ErrInvalidLengthTheproto3 } postbytesIndex := iNdEx + intMapbyteLen if postbytesIndex < 0 { return ErrInvalidLengthTheproto3 } if postbytesIndex > l { return io.ErrUnexpectedEOF } mapvalue = make([]byte, mapbyteLen) copy(mapvalue, dAtA[iNdEx:postbytesIndex]) iNdEx = postbytesIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToBytesMap[mapkey] = mapvalue iNdEx = postIndex case 16: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToEnumMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToEnumMap == nil { m.StringToEnumMap = make(map[string]MapEnum) } var mapkey string var mapvalue MapEnum for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapvalue |= MapEnum(b&0x7F) << shift if b < 0x80 { break } } } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToEnumMap[mapkey] = mapvalue iNdEx = postIndex case 17: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StringToMsgMap", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.StringToMsgMap == nil { m.StringToMsgMap = make(map[string]*FloatingPoint) } var mapkey string var mapvalue *FloatingPoint for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthTheproto3 } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthTheproto3 } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &FloatingPoint{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.StringToMsgMap[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *MessageWithMap) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: MessageWithMap: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: MessageWithMap: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NameMapping", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.NameMapping == nil { m.NameMapping = make(map[int32]string) } var mapkey int32 var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkey |= int32(b&0x7F) << shift if b < 0x80 { break } } } else if fieldNum == 2 { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.NameMapping[mapkey] = mapvalue iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MsgMapping", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.MsgMapping == nil { m.MsgMapping = make(map[int64]*FloatingPoint) } var mapkey int64 var mapvalue *FloatingPoint for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= uint64(b&0x7F) << shift if b < 0x80 { break } } mapkeytemp = (mapkeytemp >> 1) ^ uint64((int64(mapkeytemp&1)<<63)>>63) mapkey = int64(mapkeytemp) } else if fieldNum == 2 { var mapmsglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapmsglen |= int(b&0x7F) << shift if b < 0x80 { break } } if mapmsglen < 0 { return ErrInvalidLengthTheproto3 } postmsgIndex := iNdEx + mapmsglen if postmsgIndex < 0 { return ErrInvalidLengthTheproto3 } if postmsgIndex > l { return io.ErrUnexpectedEOF } mapvalue = &FloatingPoint{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } iNdEx = postmsgIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.MsgMapping[mapkey] = mapvalue iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ByteMapping", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.ByteMapping == nil { m.ByteMapping = make(map[bool][]byte) } var mapkey bool mapvalue := []byte{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var mapkeytemp int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapkeytemp |= int(b&0x7F) << shift if b < 0x80 { break } } mapkey = bool(mapkeytemp != 0) } else if fieldNum == 2 { var mapbyteLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ mapbyteLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intMapbyteLen := int(mapbyteLen) if intMapbyteLen < 0 { return ErrInvalidLengthTheproto3 } postbytesIndex := iNdEx + intMapbyteLen if postbytesIndex < 0 { return ErrInvalidLengthTheproto3 } if postbytesIndex > l { return io.ErrUnexpectedEOF } mapvalue = make([]byte, mapbyteLen) copy(mapvalue, dAtA[iNdEx:postbytesIndex]) iNdEx = postbytesIndex } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.ByteMapping[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *FloatingPoint) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: FloatingPoint: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: FloatingPoint: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field F", wireType) } var v uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 m.F = float64(math.Float64frombits(v)) default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *Uint128Pair) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: Uint128Pair: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: Uint128Pair: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } if byteLen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } var v github_com_gogo_protobuf_test_custom.Uint128 m.Right = &v if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ContainsNestedMap) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: ContainsNestedMap: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: ContainsNestedMap: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *ContainsNestedMap_NestedMap) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NestedMap: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NestedMap: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NestedMapField", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } if m.NestedMapField == nil { m.NestedMapField = make(map[string]float64) } var mapkey string var mapvalue float64 for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthTheproto3 } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthTheproto3 } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var mapvaluetemp uint64 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } mapvaluetemp = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 mapvalue = math.Float64frombits(mapvaluetemp) } else { iNdEx = entryPreIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.NestedMapField[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *NotPacked) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: NotPacked: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: NotPacked: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 5: if wireType == 0 { var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= uint64(b&0x7F) << shift if b < 0x80 { break } } m.Key = append(m.Key, v) } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ packedLen |= int(b&0x7F) << shift if b < 0x80 { break } } if packedLen < 0 { return ErrInvalidLengthTheproto3 } postIndex := iNdEx + packedLen if postIndex < 0 { return ErrInvalidLengthTheproto3 } if postIndex > l { return io.ErrUnexpectedEOF } var elementCount int var count int for _, integer := range dAtA[iNdEx:postIndex] { if integer < 128 { count++ } } elementCount = count if elementCount != 0 && len(m.Key) == 0 { m.Key = make([]uint64, 0, elementCount) } for iNdEx < postIndex { var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTheproto3 } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= uint64(b&0x7F) << shift if b < 0x80 { break } } m.Key = append(m.Key, v) } } else { return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } default: iNdEx = preIndex skippy, err := skipTheproto3(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) < 0 { return ErrInvalidLengthTheproto3 } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipTheproto3(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowTheproto3 } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowTheproto3 } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowTheproto3 } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthTheproto3 } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupTheproto3 } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthTheproto3 } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthTheproto3 = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTheproto3 = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTheproto3 = fmt.Errorf("proto: unexpected end of group") )
Miciah/origin
vendor/github.com/gogo/protobuf/test/theproto3/combos/unmarshaler/theproto3.pb.go
GO
apache-2.0
334,898
/* * 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.syncope.client.console.policies; import java.util.List; import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn; import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.CollectionPropertyColumn; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel; import org.apache.syncope.common.lib.policy.AccountPolicyTO; import org.apache.syncope.common.lib.types.PolicyType; import org.apache.syncope.common.lib.types.IdRepoEntitlement; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; import org.apache.wicket.model.IModel; import org.apache.wicket.model.StringResourceModel; /** * Account policies page. */ public class AccountPolicyDirectoryPanel extends PolicyDirectoryPanel<AccountPolicyTO> { private static final long serialVersionUID = 4984337552918213290L; public AccountPolicyDirectoryPanel(final String id, final PageReference pageRef) { super(id, PolicyType.ACCOUNT, pageRef); this.addNewItemPanelBuilder(new PolicyModalPanelBuilder<>( PolicyType.ACCOUNT, new AccountPolicyTO(), modal, pageRef), true); MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, IdRepoEntitlement.POLICY_CREATE); initResultTable(); } @Override protected void addCustomColumnFields(final List<IColumn<AccountPolicyTO, String>> columns) { columns.add(new CollectionPropertyColumn<>(new StringResourceModel( "passthroughResources", this), "passthroughResources")); columns.add(new PropertyColumn<>(new StringResourceModel( "maxAuthenticationAttempts", this), "maxAuthenticationAttempts", "maxAuthenticationAttempts")); columns.add(new BooleanPropertyColumn<>(new StringResourceModel( "propagateSuspension", this), "propagateSuspension", "propagateSuspension")); } @Override protected void addCustomActions(final ActionsPanel<AccountPolicyTO> panel, final IModel<AccountPolicyTO> model) { panel.add(new ActionLink<>() { private static final long serialVersionUID = -3722207913631435501L; @Override public void onClick(final AjaxRequestTarget target, final AccountPolicyTO ignore) { target.add(ruleCompositionModal.setContent(new PolicyRuleDirectoryPanel<>( ruleCompositionModal, model.getObject().getKey(), PolicyType.ACCOUNT, pageRef))); ruleCompositionModal.header(new StringResourceModel( "policy.rules", AccountPolicyDirectoryPanel.this, model)); MetaDataRoleAuthorizationStrategy.authorize( ruleCompositionModal.getForm(), ENABLE, IdRepoEntitlement.POLICY_UPDATE); ruleCompositionModal.show(true); } }, ActionLink.ActionType.COMPOSE, IdRepoEntitlement.POLICY_UPDATE); } }
apache/syncope
client/idrepo/console/src/main/java/org/apache/syncope/client/console/policies/AccountPolicyDirectoryPanel.java
Java
apache-2.0
4,155
/* * #%L * ELK OWL Object Interfaces * * $Id$ * $HeadURL$ * %% * Copyright (C) 2011 Department of Computer Science, University of Oxford * %% * 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. * #L% */ package org.semanticweb.elk.owl.interfaces; import org.semanticweb.elk.owl.visitors.ElkPropertyAxiomVisitor; /** * A generic interface for axioms with data properties or object properties. * * @author "Yevgeny Kazakov" * * @param <P> * the type of the property of this axiom */ public interface ElkPropertyAxiom<P> extends ElkAxiom { /** * Get the property of this axiom. * * @return the property of this axiom */ P getProperty(); /** * Accept an {@link ElkPropertyAxiomVisitor}. * * @param visitor * the visitor that can work with this axiom type * @return the output of the visitor */ public <O> O accept(ElkPropertyAxiomVisitor<O> visitor); /** * A factory for creating instances * * @author Yevgeny Kazakov * */ interface Factory extends ElkAsymmetricObjectPropertyAxiom.Factory, ElkFunctionalDataPropertyAxiom.Factory, ElkFunctionalObjectPropertyAxiom.Factory, ElkInverseFunctionalObjectPropertyAxiom.Factory, ElkIrreflexiveObjectPropertyAxiom.Factory, ElkPropertyAssertionAxiom.Factory, ElkPropertyDomainAxiom.Factory, ElkPropertyRangeAxiom.Factory, ElkReflexiveObjectPropertyAxiom.Factory, ElkSymmetricObjectPropertyAxiom.Factory, ElkTransitiveObjectPropertyAxiom.Factory { // combined interface } }
live-ontologies/elk-reasoner
elk-owl-parent/elk-owl-model/src/main/java/org/semanticweb/elk/owl/interfaces/ElkPropertyAxiom.java
Java
apache-2.0
2,035
/** * 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. * * Copyright 2012-2017 the original author or authors. */ package org.assertj.core.api.byte_; import org.assertj.core.api.ByteAssert; import org.assertj.core.api.ByteAssertBaseTest; import org.assertj.core.data.Percentage; import static org.assertj.core.data.Percentage.withPercentage; import static org.mockito.Mockito.verify; public class ByteAssert_isCloseToPercentage_byte_Test extends ByteAssertBaseTest { private final Percentage percentage = withPercentage((byte) 5); private final Byte value = 10; @Override protected ByteAssert invoke_api_method() { return assertions.isCloseTo(value, percentage); } @Override protected void verify_internal_effects() { verify(bytes).assertIsCloseToPercentage(getInfo(assertions), getActual(assertions), value, percentage); } }
ChrisA89/assertj-core
src/test/java/org/assertj/core/api/byte_/ByteAssert_isCloseToPercentage_byte_Test.java
Java
apache-2.0
1,374
package razor.android.lib.core.holders; import java.util.ArrayList; import java.util.List; import razor.android.lib.core.R; import razor.android.lib.core.adapters.CoreViewModelListAdapter; import razor.android.lib.core.adapters.CoreViewModelListAdapter.OnCoreViewModelListAdapterListener; import razor.android.lib.core.helpers.EndlessScrollListener; import razor.android.lib.core.interfaces.ICoreViewModel; import razor.android.lib.core.views.ListFooterView; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.ListView; import android.widget.TextView; public class ViewModelListViewHolder { public interface ViewModelListViewAdapterBuilder{ CoreViewModelListAdapter createAdapter(Context context, List<ICoreViewModel> models); } private View parentView = null; private ListView modelList = null; private CoreViewModelListAdapter adapter = null; private EndlessScrollListener scrollListener = null; private List<ICoreViewModel> modelStore = null; private ViewModelListViewAdapterBuilder builder = null; private ListFooterView vFooter = null; private TextView noResultMessage = null; public ViewModelListViewHolder(View view){ this.parentView = view; this.scrollListener = new EndlessScrollListener(2); this.modelList = (ListView) view.findViewById(R.id.viewmodel_list); this.modelList.setOnScrollListener(this.scrollListener); this.noResultMessage = (TextView)view.findViewById(R.id.no_results); this.vFooter = new ListFooterView(view.getContext()); this.modelList.addFooterView(vFooter, null, false); } public ListView getModelList(){ return this.modelList; } public int getSize(){ return this.modelStore != null ? this.modelStore.size() : 0; } public void setAdapter(List<ICoreViewModel> models, OnCoreViewModelListAdapterListener listener){ if(this.modelStore==null){ this.modelStore = new ArrayList<ICoreViewModel>(); } this.modelStore.addAll(models); // build the adapter if(this.builder == null){ this.adapter = new CoreViewModelListAdapter(this.parentView.getContext(),this.modelStore); } else{ this.adapter = this.builder.createAdapter(this.parentView.getContext(), this.modelStore); } this.adapter.setListener(listener); this.modelList.setAdapter(this.adapter); this.modelList.refreshDrawableState(); } public void updateAdapter(List<ICoreViewModel> moreModels){ if(this.modelStore!=null && this.adapter!=null){ this.modelStore.addAll(moreModels); this.adapter.notifyDataSetChanged(); } } public void clearAdapter(){ if(this.modelStore!=null){ this.modelStore.clear(); } if(this.adapter!=null){ this.adapter.notifyDataSetChanged(); } if(this.scrollListener!=null){ this.scrollListener.reset(); } } public void setOnMoreDataListener(EndlessScrollListener.OnLoadMoreDataListener moreDataListener){ this.scrollListener.setMoreDataListener(moreDataListener); } public void setBuilder(ViewModelListViewAdapterBuilder builder) { this.builder = builder; } public ViewModelListViewAdapterBuilder getBuilder() { return builder; } public void showLoading(boolean show){ if(show){ this.showNoResults(false); } if(this.vFooter!=null){ this.vFooter.showLoading(show); } } public void showNoResults(boolean show){ if(this.modelList!=null&&this.noResultMessage!=null){ if (!show){ this.modelList.setVisibility(View.VISIBLE); this.noResultMessage.setVisibility(View.GONE); } else{ this.modelList.setVisibility(View.GONE); this.noResultMessage.setVisibility(View.VISIBLE); } } } }
paulshemmings/pico
razor.lib.comms/target/unpack/apklibs/razor.android_razor.android.lib.core_apklib_1.0.0-SNAPSHOT/src/razor/android/lib/core/holders/ViewModelListViewHolder.java
Java
apache-2.0
3,778
package org.terracotta.sample.service; import org.ehcache.Cache; /** * @author Aurelien Broszniowski */ public class CachedDataService implements DataService<byte[]> { private final Cache<Long, byte[]> cache; public CachedDataService(final Cache<Long, byte[]> cache) { this.cache = cache; } @Override public byte[] loadData(final Long key) { return cache.get(key); } }
ehcache/ehcache3-samples
scale-continuum/src/main/java/org/terracotta/sample/service/CachedDataService.java
Java
apache-2.0
396
define([ '../Core/Cartesian3', '../Core/defined', '../Core/Intersect', '../Core/ManagedArray', '../Core/Math', './Cesium3DTileOptimizationHint', './Cesium3DTileRefine' ], function( Cartesian3, defined, Intersect, ManagedArray, CesiumMath, Cesium3DTileOptimizationHint, Cesium3DTileRefine) { 'use strict'; /** * @private */ function Cesium3DTilesetTraversal() { } function isVisible(tile) { return tile._visible && tile._inRequestVolume; } var traversal = { stack : new ManagedArray(), stackMaximumLength : 0 }; var emptyTraversal = { stack : new ManagedArray(), stackMaximumLength : 0 }; var descendantTraversal = { stack : new ManagedArray(), stackMaximumLength : 0 }; var selectionTraversal = { stack : new ManagedArray(), stackMaximumLength : 0, ancestorStack : new ManagedArray(), ancestorStackMaximumLength : 0 }; var descendantSelectionDepth = 2; Cesium3DTilesetTraversal.selectTiles = function(tileset, frameState) { tileset._requestedTiles.length = 0; if (tileset.debugFreezeFrame) { return; } tileset._selectedTiles.length = 0; tileset._selectedTilesToStyle.length = 0; tileset._emptyTiles.length = 0; tileset._hasMixedContent = false; var root = tileset.root; updateTile(tileset, root, frameState); // The root tile is not visible if (!isVisible(root)) { return; } // The tileset doesn't meet the SSE requirement, therefore the tree does not need to be rendered if (root.getScreenSpaceError(frameState, true) <= tileset._maximumScreenSpaceError) { return; } if (!skipLevelOfDetail(tileset)) { executeBaseTraversal(tileset, root, frameState); } else if (tileset.immediatelyLoadDesiredLevelOfDetail) { executeSkipTraversal(tileset, root, frameState); } else { executeBaseAndSkipTraversal(tileset, root, frameState); } traversal.stack.trim(traversal.stackMaximumLength); emptyTraversal.stack.trim(emptyTraversal.stackMaximumLength); descendantTraversal.stack.trim(descendantTraversal.stackMaximumLength); selectionTraversal.stack.trim(selectionTraversal.stackMaximumLength); selectionTraversal.ancestorStack.trim(selectionTraversal.ancestorStackMaximumLength); // Update the priority for any requests found during traversal // Update after traversal so that min and max values can be used to normalize priority values var requestedTiles = tileset._requestedTiles; var length = requestedTiles.length; for (var i = 0; i < length; ++i) { requestedTiles[i].updatePriority(); } }; function executeBaseTraversal(tileset, root, frameState) { var baseScreenSpaceError = tileset._maximumScreenSpaceError; var maximumScreenSpaceError = tileset._maximumScreenSpaceError; executeTraversal(tileset, root, baseScreenSpaceError, maximumScreenSpaceError, frameState); } function executeSkipTraversal(tileset, root, frameState) { var baseScreenSpaceError = Number.MAX_VALUE; var maximumScreenSpaceError = tileset._maximumScreenSpaceError; executeTraversal(tileset, root, baseScreenSpaceError, maximumScreenSpaceError, frameState); traverseAndSelect(tileset, root, frameState); } function executeBaseAndSkipTraversal(tileset, root, frameState) { var baseScreenSpaceError = Math.max(tileset.baseScreenSpaceError, tileset.maximumScreenSpaceError); var maximumScreenSpaceError = tileset.maximumScreenSpaceError; executeTraversal(tileset, root, baseScreenSpaceError, maximumScreenSpaceError, frameState); traverseAndSelect(tileset, root, frameState); } function skipLevelOfDetail(tileset) { return tileset._skipLevelOfDetail; } function addEmptyTile(tileset, tile) { tileset._emptyTiles.push(tile); } function selectTile(tileset, tile, frameState) { if (tile.contentVisibility(frameState) !== Intersect.OUTSIDE) { var tileContent = tile.content; if (tileContent.featurePropertiesDirty) { // A feature's property in this tile changed, the tile needs to be re-styled. tileContent.featurePropertiesDirty = false; tile.lastStyleTime = 0; // Force applying the style to this tile tileset._selectedTilesToStyle.push(tile); } else if ((tile._selectedFrame < frameState.frameNumber - 1)) { // Tile is newly selected; it is selected this frame, but was not selected last frame. tileset._selectedTilesToStyle.push(tile); } tile._selectedFrame = frameState.frameNumber; tileset._selectedTiles.push(tile); } } function selectDescendants(tileset, root, frameState) { var stack = descendantTraversal.stack; stack.push(root); while (stack.length > 0) { descendantTraversal.stackMaximumLength = Math.max(descendantTraversal.stackMaximumLength, stack.length); var tile = stack.pop(); var children = tile.children; var childrenLength = children.length; for (var i = 0; i < childrenLength; ++i) { var child = children[i]; if (isVisible(child)) { if (child.contentAvailable) { updateTile(tileset, child, frameState); touchTile(tileset, child, frameState); selectTile(tileset, child, frameState); } else if (child._depth - root._depth < descendantSelectionDepth) { // Continue traversing, but not too far stack.push(child); } } } } } function selectDesiredTile(tileset, tile, frameState) { if (!skipLevelOfDetail(tileset)) { if (tile.contentAvailable) { // The tile can be selected right away and does not require traverseAndSelect selectTile(tileset, tile, frameState); } return; } // If this tile is not loaded attempt to select its ancestor instead var loadedTile = tile.contentAvailable ? tile : tile._ancestorWithContentAvailable; if (defined(loadedTile)) { // Tiles will actually be selected in traverseAndSelect loadedTile._shouldSelect = true; } else { // If no ancestors are ready traverse down and select tiles to minimize empty regions. // This happens often for immediatelyLoadDesiredLevelOfDetail where parent tiles are not necessarily loaded before zooming out. selectDescendants(tileset, tile, frameState); } } function visitTile(tileset, tile, frameState) { ++tileset._statistics.visited; tile._visitedFrame = frameState.frameNumber; } function touchTile(tileset, tile, frameState) { if (tile._touchedFrame === frameState.frameNumber) { // Prevents another pass from touching the frame again return; } tileset._cache.touch(tile); tile._touchedFrame = frameState.frameNumber; } function updateMinimumMaximumPriority(tileset, tile) { tileset._maximumPriority.distance = Math.max(tile._priorityHolder._distanceToCamera, tileset._maximumPriority.distance); tileset._minimumPriority.distance = Math.min(tile._priorityHolder._distanceToCamera, tileset._minimumPriority.distance); tileset._maximumPriority.depth = Math.max(tile._depth, tileset._maximumPriority.depth); tileset._minimumPriority.depth = Math.min(tile._depth, tileset._minimumPriority.depth); tileset._maximumPriority.foveatedFactor = Math.max(tile._priorityHolder._foveatedFactor, tileset._maximumPriority.foveatedFactor); tileset._minimumPriority.foveatedFactor = Math.min(tile._priorityHolder._foveatedFactor, tileset._minimumPriority.foveatedFactor); tileset._maximumPriority.reverseScreenSpaceError = Math.max(tile._priorityReverseScreenSpaceError, tileset._maximumPriority.reverseScreenSpaceError); tileset._minimumPriority.reverseScreenSpaceError = Math.min(tile._priorityReverseScreenSpaceError, tileset._minimumPriority.reverseScreenSpaceError); } function isOnScreenLongEnough(tileset, tile, frameState) { // Prevent unnecessary loads while camera is moving by getting the ratio of travel distance to tile size. if (!tileset.cullRequestsWhileMoving) { return true; } var sphere = tile.boundingSphere; var diameter = Math.max(sphere.radius * 2.0, 1.0); var camera = frameState.camera; var deltaMagnitude = camera.positionWCDeltaMagnitude !== 0.0 ? camera.positionWCDeltaMagnitude : camera.positionWCDeltaMagnitudeLastFrame; var movementRatio = tileset.cullRequestsWhileMovingMultiplier * deltaMagnitude / diameter; // How do n frames of this movement compare to the tile's physical size. return movementRatio < 1.0; } function loadTile(tileset, tile, frameState) { if (tile._requestedFrame === frameState.frameNumber || (!hasUnloadedContent(tile) && !tile.contentExpired)) { return; } if (!isOnScreenLongEnough(tileset, tile, frameState)) { return; } var cameraHasNotStoppedMovingLongEnough = frameState.camera.timeSinceMoved < tileset.foveatedTimeDelay; if (tile.priorityDeferred && cameraHasNotStoppedMovingLongEnough) { return; } tile._requestedFrame = frameState.frameNumber; tileset._requestedTiles.push(tile); } function updateVisibility(tileset, tile, frameState) { if (tile._updatedVisibilityFrame === tileset._updatedVisibilityFrame) { // Return early if visibility has already been checked during the traversal. // The visibility may have already been checked if the cullWithChildrenBounds optimization is used. return; } tile.updateVisibility(frameState); tile._updatedVisibilityFrame = tileset._updatedVisibilityFrame; } function anyChildrenVisible(tileset, tile, frameState) { var anyVisible = false; var children = tile.children; var length = children.length; for (var i = 0; i < length; ++i) { var child = children[i]; updateVisibility(tileset, child, frameState); anyVisible = anyVisible || isVisible(child); } return anyVisible; } function meetsScreenSpaceErrorEarly(tileset, tile, frameState) { var parent = tile.parent; if (!defined(parent) || parent.hasTilesetContent || (parent.refine !== Cesium3DTileRefine.ADD)) { return false; } // Use parent's geometric error with child's box to see if the tile already meet the SSE return tile.getScreenSpaceError(frameState, true) <= tileset._maximumScreenSpaceError; } function updateTileVisibility(tileset, tile, frameState) { updateVisibility(tileset, tile, frameState); if (!isVisible(tile)) { return; } var hasChildren = tile.children.length > 0; if (tile.hasTilesetContent && hasChildren) { // Use the root tile's visibility instead of this tile's visibility. // The root tile may be culled by the children bounds optimization in which // case this tile should also be culled. var child = tile.children[0]; updateTileVisibility(tileset, child, frameState); tile._visible = child._visible; return; } if (meetsScreenSpaceErrorEarly(tileset, tile, frameState)) { tile._visible = false; return; } // Optimization - if none of the tile's children are visible then this tile isn't visible var replace = tile.refine === Cesium3DTileRefine.REPLACE; var useOptimization = tile._optimChildrenWithinParent === Cesium3DTileOptimizationHint.USE_OPTIMIZATION; if (replace && useOptimization && hasChildren) { if (!anyChildrenVisible(tileset, tile, frameState)) { ++tileset._statistics.numberOfTilesCulledWithChildrenUnion; tile._visible = false; return; } } } function updateTile(tileset, tile, frameState) { // Reset some of the tile's flags and re-evaluate visibility updateTileVisibility(tileset, tile, frameState); tile.updateExpiration(); // Request priority tile._wasMinPriorityChild = false; tile._priorityHolder = tile; updateMinimumMaximumPriority(tileset, tile); // SkipLOD tile._shouldSelect = false; tile._finalResolution = true; } function updateTileAncestorContentLinks(tile, frameState) { tile._ancestorWithContent = undefined; tile._ancestorWithContentAvailable = undefined; var parent = tile.parent; if (defined(parent)) { // ancestorWithContent is an ancestor that has content or has the potential to have // content. Used in conjunction with tileset.skipLevels to know when to skip a tile. // ancestorWithContentAvailable is an ancestor that is rendered if a desired tile is not loaded. var hasContent = !hasUnloadedContent(parent) || (parent._requestedFrame === frameState.frameNumber); tile._ancestorWithContent = hasContent ? parent : parent._ancestorWithContent; tile._ancestorWithContentAvailable = parent.contentAvailable ? parent : parent._ancestorWithContentAvailable; // Links a descendant up to its contentAvailable ancestor as the traversal progresses. } } function hasEmptyContent(tile) { return tile.hasEmptyContent || tile.hasTilesetContent; } function hasUnloadedContent(tile) { return !hasEmptyContent(tile) && tile.contentUnloaded; } function reachedSkippingThreshold(tileset, tile) { var ancestor = tile._ancestorWithContent; return !tileset.immediatelyLoadDesiredLevelOfDetail && (tile._priorityProgressiveResolutionScreenSpaceErrorLeaf || (defined(ancestor) && (tile._screenSpaceError < (ancestor._screenSpaceError / tileset.skipScreenSpaceErrorFactor)) && (tile._depth > (ancestor._depth + tileset.skipLevels)))); } function sortChildrenByDistanceToCamera(a, b) { // Sort by farthest child first since this is going on a stack if (b._distanceToCamera === 0 && a._distanceToCamera === 0) { return b._centerZDepth - a._centerZDepth; } return b._distanceToCamera - a._distanceToCamera; } function updateAndPushChildren(tileset, tile, stack, frameState) { var i; var replace = tile.refine === Cesium3DTileRefine.REPLACE; var children = tile.children; var length = children.length; for (i = 0; i < length; ++i) { updateTile(tileset, children[i], frameState); } // Sort by distance to take advantage of early Z and reduce artifacts for skipLevelOfDetail children.sort(sortChildrenByDistanceToCamera); // For traditional replacement refinement only refine if all children are loaded. // Empty tiles are exempt since it looks better if children stream in as they are loaded to fill the empty space. var checkRefines = !skipLevelOfDetail(tileset) && replace && !hasEmptyContent(tile); var refines = true; var anyChildrenVisible = false; // Determining min child var minIndex = -1; var minimumPriority = Number.MAX_VALUE; var child; for (i = 0; i < length; ++i) { child = children[i]; if (isVisible(child)) { stack.push(child); if (child._foveatedFactor < minimumPriority) { minIndex = i; minimumPriority = child._foveatedFactor; } anyChildrenVisible = true; } else if (checkRefines || tileset.loadSiblings) { // Keep non-visible children loaded since they are still needed before the parent can refine. // Or loadSiblings is true so always load tiles regardless of visibility. if (child._foveatedFactor < minimumPriority) { minIndex = i; minimumPriority = child._foveatedFactor; } loadTile(tileset, child, frameState); touchTile(tileset, child, frameState); } if (checkRefines) { var childRefines; if (!child._inRequestVolume) { childRefines = false; } else if (hasEmptyContent(child)) { childRefines = executeEmptyTraversal(tileset, child, frameState); } else { childRefines = child.contentAvailable; } refines = refines && childRefines; } } if (!anyChildrenVisible) { refines = false; } if (minIndex !== -1 && !skipLevelOfDetail(tileset) && replace) { // An ancestor will hold the _foveatedFactor and _distanceToCamera for descendants between itself and its highest priority descendant. Siblings of a min children along the way use this ancestor as their priority holder as well. // Priority of all tiles that refer to the _foveatedFactor and _distanceToCamera stored in the common ancestor will be differentiated based on their _depth. var minPriorityChild = children[minIndex]; minPriorityChild._wasMinPriorityChild = true; var priorityHolder = (tile._wasMinPriorityChild || tile === tileset.root) && minimumPriority <= tile._priorityHolder._foveatedFactor ? tile._priorityHolder : tile; // This is where priority dependency chains are wired up or started anew. priorityHolder._foveatedFactor = Math.min(minPriorityChild._foveatedFactor, priorityHolder._foveatedFactor); priorityHolder._distanceToCamera = Math.min(minPriorityChild._distanceToCamera, priorityHolder._distanceToCamera); for (i = 0; i < length; ++i) { child = children[i]; child._priorityHolder = priorityHolder; } } return refines; } function inBaseTraversal(tileset, tile, baseScreenSpaceError) { if (!skipLevelOfDetail(tileset)) { return true; } if (tileset.immediatelyLoadDesiredLevelOfDetail) { return false; } if (!defined(tile._ancestorWithContent)) { // Include root or near-root tiles in the base traversal so there is something to select up to return true; } if (tile._screenSpaceError === 0.0) { // If a leaf, use parent's SSE return tile.parent._screenSpaceError > baseScreenSpaceError; } return tile._screenSpaceError > baseScreenSpaceError; } function canTraverse(tileset, tile) { if (tile.children.length === 0) { return false; } if (tile.hasTilesetContent) { // Traverse external tileset to visit its root tile // Don't traverse if the subtree is expired because it will be destroyed return !tile.contentExpired; } return tile._screenSpaceError > tileset._maximumScreenSpaceError; } function executeTraversal(tileset, root, baseScreenSpaceError, maximumScreenSpaceError, frameState) { // Depth-first traversal that traverses all visible tiles and marks tiles for selection. // If skipLevelOfDetail is off then a tile does not refine until all children are loaded. // This is the traditional replacement refinement approach and is called the base traversal. // Tiles that have a greater screen space error than the base screen space error are part of the base traversal, // all other tiles are part of the skip traversal. The skip traversal allows for skipping levels of the tree // and rendering children and parent tiles simultaneously. var stack = traversal.stack; stack.push(root); while (stack.length > 0) { traversal.stackMaximumLength = Math.max(traversal.stackMaximumLength, stack.length); var tile = stack.pop(); updateTileAncestorContentLinks(tile, frameState); var baseTraversal = inBaseTraversal(tileset, tile, baseScreenSpaceError); var add = tile.refine === Cesium3DTileRefine.ADD; var replace = tile.refine === Cesium3DTileRefine.REPLACE; var parent = tile.parent; var parentRefines = !defined(parent) || parent._refines; var refines = false; if (canTraverse(tileset, tile)) { refines = updateAndPushChildren(tileset, tile, stack, frameState) && parentRefines; } var stoppedRefining = !refines && parentRefines; if (hasEmptyContent(tile)) { // Add empty tile just to show its debug bounding volume // If the tile has tileset content load the external tileset // If the tile cannot refine further select its nearest loaded ancestor addEmptyTile(tileset, tile, frameState); loadTile(tileset, tile, frameState); if (stoppedRefining) { selectDesiredTile(tileset, tile, frameState); } } else if (add) { // Additive tiles are always loaded and selected selectDesiredTile(tileset, tile, frameState); loadTile(tileset, tile, frameState); } else if (replace) { if (baseTraversal) { // Always load tiles in the base traversal // Select tiles that can't refine further loadTile(tileset, tile, frameState); if (stoppedRefining) { selectDesiredTile(tileset, tile, frameState); } } else if (stoppedRefining) { // In skip traversal, load and select tiles that can't refine further selectDesiredTile(tileset, tile, frameState); loadTile(tileset, tile, frameState); } else if (reachedSkippingThreshold(tileset, tile)) { // In skip traversal, load tiles that aren't skipped. In practice roughly half the tiles stay unloaded. loadTile(tileset, tile, frameState); } } visitTile(tileset, tile, frameState); touchTile(tileset, tile, frameState); tile._refines = refines; } } function executeEmptyTraversal(tileset, root, frameState) { // Depth-first traversal that checks if all nearest descendants with content are loaded. Ignores visibility. var allDescendantsLoaded = true; var stack = emptyTraversal.stack; stack.push(root); while (stack.length > 0) { emptyTraversal.stackMaximumLength = Math.max(emptyTraversal.stackMaximumLength, stack.length); var tile = stack.pop(); var children = tile.children; var childrenLength = children.length; // Only traverse if the tile is empty - traversal stop at descendants with content var traverse = hasEmptyContent(tile) && canTraverse(tileset, tile); // Traversal stops but the tile does not have content yet. // There will be holes if the parent tries to refine to its children, so don't refine. if (!traverse && !tile.contentAvailable) { allDescendantsLoaded = false; } updateTile(tileset, tile, frameState); if (!isVisible(tile)) { // Load tiles that aren't visible since they are still needed for the parent to refine loadTile(tileset, tile, frameState); touchTile(tileset, tile, frameState); } if (traverse) { for (var i = 0; i < childrenLength; ++i) { var child = children[i]; stack.push(child); } } } return allDescendantsLoaded; } /** * Traverse the tree and check if their selected frame is the current frame. If so, add it to a selection queue. * This is a preorder traversal so children tiles are selected before ancestor tiles. * * The reason for the preorder traversal is so that tiles can easily be marked with their * selection depth. A tile's _selectionDepth is its depth in the tree where all non-selected tiles are removed. * This property is important for use in the stencil test because we want to render deeper tiles on top of their * ancestors. If a tileset is very deep, the depth is unlikely to fit into the stencil buffer. * * We want to select children before their ancestors because there is no guarantee on the relationship between * the children's z-depth and the ancestor's z-depth. We cannot rely on Z because we want the child to appear on top * of ancestor regardless of true depth. The stencil tests used require children to be drawn first. * * NOTE: 3D Tiles uses 3 bits from the stencil buffer meaning this will not work when there is a chain of * selected tiles that is deeper than 7. This is not very likely. */ function traverseAndSelect(tileset, root, frameState) { var stack = selectionTraversal.stack; var ancestorStack = selectionTraversal.ancestorStack; var lastAncestor; stack.push(root); while (stack.length > 0 || ancestorStack.length > 0) { selectionTraversal.stackMaximumLength = Math.max(selectionTraversal.stackMaximumLength, stack.length); selectionTraversal.ancestorStackMaximumLength = Math.max(selectionTraversal.ancestorStackMaximumLength, ancestorStack.length); if (ancestorStack.length > 0) { var waitingTile = ancestorStack.peek(); if (waitingTile._stackLength === stack.length) { ancestorStack.pop(); if (waitingTile !== lastAncestor) { waitingTile._finalResolution = false; } selectTile(tileset, waitingTile, frameState); continue; } } var tile = stack.pop(); if (!defined(tile)) { // stack is empty but ancestorStack isn't continue; } var add = tile.refine === Cesium3DTileRefine.ADD; var shouldSelect = tile._shouldSelect; var children = tile.children; var childrenLength = children.length; var traverse = canTraverse(tileset, tile); if (shouldSelect) { if (add) { selectTile(tileset, tile, frameState); } else { tile._selectionDepth = ancestorStack.length; if (tile._selectionDepth > 0) { tileset._hasMixedContent = true; } lastAncestor = tile; if (!traverse) { selectTile(tileset, tile, frameState); continue; } ancestorStack.push(tile); tile._stackLength = stack.length; } } if (traverse) { for (var i = 0; i < childrenLength; ++i) { var child = children[i]; if (isVisible(child)) { stack.push(child); } } } } } return Cesium3DTilesetTraversal; });
geoscan/cesium
Source/Scene/Cesium3DTilesetTraversal.js
JavaScript
apache-2.0
28,819
/* * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.idea.maven.services; import com.intellij.openapi.components.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ArrayUtil; import com.intellij.util.SmartList; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.maven.model.MavenArtifactInfo; import org.jetbrains.idea.maven.model.MavenRepositoryInfo; import org.jetbrains.idea.maven.services.artifactory.ArtifactoryRepositoryService; import org.jetbrains.idea.maven.services.nexus.NexusRepositoryService; import org.jetbrains.idea.maven.utils.MavenLog; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * @author Gregory.Shrago */ @State( name = "MavenServices", storages = {@Storage( file = StoragePathMacros.APP_CONFIG + "/mavenServices.xml")}) public class MavenRepositoryServicesManager implements PersistentStateComponent<Element> { private final List<String> myUrls = new ArrayList<String>(); @NotNull public static MavenRepositoryServicesManager getInstance() { return ServiceManager.getService(MavenRepositoryServicesManager.class); } @NotNull public static MavenRepositoryService[] getServices() { return new MavenRepositoryService[]{new NexusRepositoryService(), new ArtifactoryRepositoryService()}; } public static String[] getServiceUrls() { final List<String> configured = getInstance().getUrls(); if (!configured.isEmpty()) return ArrayUtil.toStringArray(configured); return new String[]{ "http://oss.sonatype.org/service/local/", "http://repo.jfrog.org/artifactory/api/", "https://repository.jboss.org/nexus/service/local/" }; } public List<String> getUrls() { return myUrls; } public void setUrls(List<String> urls) { myUrls.clear(); myUrls.addAll(urls); } @Override public Element getState() { final Element element = new Element("maven-services"); for (String url : myUrls) { final Element child = new Element("service-url"); child.setText(StringUtil.escapeXml(url)); element.addContent(child); } return element; } @Override public void loadState(Element state) { myUrls.clear(); for (Element element : (List<Element>)state.getChildren("service-url")) { myUrls.add(StringUtil.unescapeXml(element.getTextTrim())); } } @NotNull public static List<MavenRepositoryInfo> getRepositories(String url) { List<MavenRepositoryInfo> result = new SmartList<MavenRepositoryInfo>(); for (MavenRepositoryService service : getServices()) { try { result.addAll(service.getRepositories(url)); } catch (IOException e) { MavenLog.LOG.info(e); } } return result; } @NotNull public static List<MavenArtifactInfo> findArtifacts(@NotNull MavenArtifactInfo template, @NotNull String url) { List<MavenArtifactInfo> result = new SmartList<MavenArtifactInfo>(); for (MavenRepositoryService service : getServices()) { try { result.addAll(service.findArtifacts(url, template)); } catch (IOException e) { MavenLog.LOG.info(e); } } return result; } }
android-ia/platform_tools_idea
plugins/maven/src/main/java/org/jetbrains/idea/maven/services/MavenRepositoryServicesManager.java
Java
apache-2.0
3,801
<?php $max_age = 0;//600; //seconds this URL should be cached header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $max_age) . ' GMT'); header("Cache-Control: public, max-age=$max_age"); header("Content-Type: application/json"); $response = []; $included_fonts = glob("../fonts/*.ttf");//only ttf for now foreach($included_fonts as $included_font){ $response[] = basename($included_font, ".ttf"); } //sort($response, SORT_NATURAL); echo json_encode($response); ?>
wbmccool/bsd-txt
ajax/fonts.php
PHP
apache-2.0
473
package com.eas.client.utils.scalableui; import java.awt.BorderLayout; import java.awt.Component; /** * * @author Marat */ public class ScalableBorderLayout extends BorderLayout{ public ScalableBorderLayout() { super(); } @Override public void addLayoutComponent(Component comp, Object constraints) { if(!(comp instanceof ScalablePopup.ScalablePopupPanel)) super.addLayoutComponent(comp, constraints); } }
altsoft/PlatypusJS
platypus-js-scalable-widget/src/main/java/com/eas/client/utils/scalableui/ScalableBorderLayout.java
Java
apache-2.0
467
var Main = function(){ this.domain = ''; this.pname = '免费版'; this.days = []; this.months = []; this.flowDayData = []; this.cacheDayData = []; this.flowMontyData = []; this.cacheMonthData = []; this.getInfo = function() { var that = this; $.ajax({ url : '/api/?c=record&a=getDomainInfo', dataType : 'json', success : function(a) { if (a.status.code != 1) { that.renderLoginError(); return; } that.domain = a.domain.name; that.pname = a.domain.pname; $("#domain_name_show").html(that.domain); $("#domain_pname_show").html(that.pname).parent('a').attr('href','?c=product&a=index&domain='+that.domain); that.getFlow(); //that.render(); if(a.domain['cdn_id'] == 0){ $("#popup").css('display','block'); $("#msg").html("<a href='?c=cdn&a=index&domain="+that.domain+"' style='color:red'>请先增加CDN站点</a>"); $("#msg").css("display","block"); } }, error : function(e) { that.showError('后台数据出错' + e.responseText); } }); } this.getFlow = function(){ var that = this; $.ajax({ url:'/api/?c=record&a=getCdnFlow', dataType:'json', success:function(a){ //alert('s'); if(a.status.code == 1){ that.days = a.days; that.months = a.months; that.render(); return; } that.render(); return; }, error:function(a){ alert('error'); } }); } this.render = function() { this.renderDay(); this.renderMonth(); } this.showError = function(msg){ alert(msg); } this.getDayRatio = function(index) { flowval = this.flowDayData[index]; cacheval = this.cacheDayData[index]; return Highcharts.numberFormat(cacheval*100/flowval,2); } this.getMonthRatio = function(index) { flowval = this.flowMonthData[index]; cacheval = this.cacheMonthData[index]; return Highcharts.numberFormat(cacheval*100/flowval,2); } this.renderDay = function() { var that = this; var data = this.days; var flow = {}; var cache = {}; var options = { chart : { defaultSeriesType : 'line', renderTo : 'query_day', inverted : false }, title : { text : '最近24小时流量(蓝色),缓存(绿色)统计图' }, subtitle : { text : '', x : 80 }, xAxis : { categories : [] }, yAxis : { title : { text : '流量' } }, credits:{ enabled: true, position: { align: 'right', x: -10, y: -10 }, href: "https://www.cdnbest.com", style: { color:'blue' }, text: "CDN贝" }, legend : { enabled : false }, tooltip : { valueSuffix:'{value}m', formatter : function() { var str = '流量:' + Highcharts.numberFormat(this.y, 1) + ' byte<br/>当前时间:' + this.x + '点'; str += ",缓存命中率:" + that.getDayRatio(this.point.x) + "%"; return str } }, series : [] }; flow.name = '流量'; //线条颜色 //flow.color = '#89A54E'; //显示方式,柱子还是线条或其它 //flow.type = 'spline'; flow.data = []; for ( var i in data.cate) { flow.data.push(data.nums[data.cate[i]]); } for ( var i in data.cate) { options.xAxis.categories.push(data.cate[i].substr(-2)); } this.flowDayData = flow.data; cache.name = "缓存"; //cache.color = 'red', //cache.type = 'spline'; cache.data = []; for ( var i in data.cate) { cache.data.push(data.cache[data.cate[i]]); } this.cacheDayData = cache.data; options.series.push(flow); options.series.push(cache); var chat = new Highcharts.Chart(options); } this.renderMonth = function() { var that = this; var data = this.months; var options = { chart : { defaultSeriesType : 'line', renderTo : 'query_month', inverted : false }, title : { text : '最近30天流量(蓝色),缓存(绿色)统计图' }, subtitle : { text : '', x : 80 }, credits:{ enabled: true, position: { align: 'right', x: -10, y: -10 }, href: "https://www.cdnbest.com", style: { color:'blue' }, text: "CDN贝" }, xAxis : { categories : [] }, yAxis : { title : { text : '流量' } }, legend : { enabled : false }, tooltip : { formatter : function() { var str = '流量:' + Highcharts.numberFormat(this.y, 1) + ' byte<br/>当前时间:' + this.x + '日'; str += ",缓存命中率:" + that.getMonthRatio(this.point.x) + "%"; return str } }, series : [] }; var flow = {}; flow.name = '流量'; flow.data = []; for ( var i in data.cate) { flow.data.push(data.nums[data.cate[i]]); } this.flowMonthData = flow.data; for ( var i in data.cate) { options.xAxis.categories.push(data.cate[i].substr(-2)); } options.series.push(flow); var cache = {}; cache.name = "缓存"; cache.data = []; for ( var i in data.cate) { cache.data.push(data.cache[data.cate[i]]); } this.cacheMonthData = cache.data; options.series.push(cache); var chat = new Highcharts.Chart(options); } this.renderLoginError = function() { var template = $("#site-nologin-template").html(); $("#h").append(template); } } $(document).ready(function(){ $("#record-operat").find('#cdnflow').find('a').addClass('cur'); $("#nav_domain").addClass("cur"); var main = new Main(); main.getInfo(); });
zdchao/php_demo
wwwroot/wwwroot/user/view/new0807/record/cdnflow.js
JavaScript
apache-2.0
5,652
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/iot/model/DescribeAuditMitigationActionsTaskResult.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/AmazonWebServiceResult.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/UnreferencedParam.h> #include <utility> using namespace Aws::IoT::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; DescribeAuditMitigationActionsTaskResult::DescribeAuditMitigationActionsTaskResult() : m_taskStatus(AuditMitigationActionsTaskStatus::NOT_SET) { } DescribeAuditMitigationActionsTaskResult::DescribeAuditMitigationActionsTaskResult(const Aws::AmazonWebServiceResult<JsonValue>& result) : m_taskStatus(AuditMitigationActionsTaskStatus::NOT_SET) { *this = result; } DescribeAuditMitigationActionsTaskResult& DescribeAuditMitigationActionsTaskResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("taskStatus")) { m_taskStatus = AuditMitigationActionsTaskStatusMapper::GetAuditMitigationActionsTaskStatusForName(jsonValue.GetString("taskStatus")); } if(jsonValue.ValueExists("startTime")) { m_startTime = jsonValue.GetDouble("startTime"); } if(jsonValue.ValueExists("endTime")) { m_endTime = jsonValue.GetDouble("endTime"); } if(jsonValue.ValueExists("taskStatistics")) { Aws::Map<Aws::String, JsonView> taskStatisticsJsonMap = jsonValue.GetObject("taskStatistics").GetAllObjects(); for(auto& taskStatisticsItem : taskStatisticsJsonMap) { m_taskStatistics[taskStatisticsItem.first] = taskStatisticsItem.second.AsObject(); } } if(jsonValue.ValueExists("target")) { m_target = jsonValue.GetObject("target"); } if(jsonValue.ValueExists("auditCheckToActionsMapping")) { Aws::Map<Aws::String, JsonView> auditCheckToActionsMappingJsonMap = jsonValue.GetObject("auditCheckToActionsMapping").GetAllObjects(); for(auto& auditCheckToActionsMappingItem : auditCheckToActionsMappingJsonMap) { Array<JsonView> mitigationActionNameListJsonList = auditCheckToActionsMappingItem.second.AsArray(); Aws::Vector<Aws::String> mitigationActionNameListList; mitigationActionNameListList.reserve((size_t)mitigationActionNameListJsonList.GetLength()); for(unsigned mitigationActionNameListIndex = 0; mitigationActionNameListIndex < mitigationActionNameListJsonList.GetLength(); ++mitigationActionNameListIndex) { mitigationActionNameListList.push_back(mitigationActionNameListJsonList[mitigationActionNameListIndex].AsString()); } m_auditCheckToActionsMapping[auditCheckToActionsMappingItem.first] = std::move(mitigationActionNameListList); } } if(jsonValue.ValueExists("actionsDefinition")) { Array<JsonView> actionsDefinitionJsonList = jsonValue.GetArray("actionsDefinition"); for(unsigned actionsDefinitionIndex = 0; actionsDefinitionIndex < actionsDefinitionJsonList.GetLength(); ++actionsDefinitionIndex) { m_actionsDefinition.push_back(actionsDefinitionJsonList[actionsDefinitionIndex].AsObject()); } } return *this; }
awslabs/aws-sdk-cpp
aws-cpp-sdk-iot/source/model/DescribeAuditMitigationActionsTaskResult.cpp
C++
apache-2.0
3,297
from __future__ import absolute_import from __future__ import print_function from typing import Any, Dict, List from .template_parser import ( tokenize, Token, is_django_block_tag, ) from six.moves import range import os def pretty_print_html(html, num_spaces=4): # type: (str, int) -> str # We use 1-based indexing for both rows and columns. tokens = tokenize(html) lines = html.split('\n') # We will keep a stack of "start" tags so that we know # when HTML ranges end. Note that some start tags won't # be blocks from an indentation standpoint. stack = [] # type: List[Dict[str, Any]] # Seed our stack with a pseudo entry to make depth calculations # easier. info = dict( block=False, depth=-1, line=-1, token_kind='html_start', tag='html', extra_indent=0) # type: Dict[str, Any] stack.append(info) # Our main job is to figure out offsets that we use to nudge lines # over by. offsets = {} # type: Dict[int, int] # Loop through our start/end tokens, and calculate offsets. As # we proceed, we will push/pop info dictionaries on/off a stack. for token in tokens: if token.kind in ('html_start', 'handlebars_start', 'html_singleton', 'django_start') and stack[-1]['tag'] != 'pre': # An HTML start tag should only cause a new indent if we # are on a new line. if (token.tag not in ('extends', 'include', 'else', 'elif') and (is_django_block_tag(token.tag) or token.kind != 'django_start')): is_block = token.line > stack[-1]['line'] if is_block: if (((token.kind == 'handlebars_start' and stack[-1]['token_kind'] == 'handlebars_start') or (token.kind == 'django_start' and stack[-1]['token_kind'] == 'django_start')) and not stack[-1]['indenting']): info = stack.pop() info['depth'] = info['depth'] + 1 info['indenting'] = True info['adjust_offset_until'] = token.line stack.append(info) new_depth = stack[-1]['depth'] + 1 extra_indent = stack[-1]['extra_indent'] line = lines[token.line - 1] adjustment = len(line)-len(line.lstrip()) + 1 offset = (1 + extra_indent + new_depth * num_spaces) - adjustment info = dict( block=True, depth=new_depth, actual_depth=new_depth, line=token.line, tag=token.tag, token_kind=token.kind, line_span=token.line_span, offset=offset, extra_indent=token.col - adjustment + extra_indent, extra_indent_prev=extra_indent, adjustment=adjustment, indenting=True, adjust_offset_until=token.line ) if token.kind in ('handlebars_start', 'django_start'): info.update(dict(depth=new_depth - 1, indenting=False)) else: info = dict( block=False, depth=stack[-1]['depth'], actual_depth=stack[-1]['depth'], line=token.line, tag=token.tag, token_kind=token.kind, extra_indent=stack[-1]['extra_indent'] ) stack.append(info) elif token.kind in ('html_end', 'handlebars_end', 'html_singleton_end', 'django_end') and (stack[-1]['tag'] != 'pre' or token.tag == 'pre'): info = stack.pop() if info['block']: # We are at the end of an indentation block. We # assume the whole block was formatted ok before, just # possibly at an indentation that we don't like, so we # nudge over all lines in the block by the same offset. start_line = info['line'] end_line = token.line if token.tag == 'pre': offsets[start_line] = 0 offsets[end_line] = 0 else: offsets[start_line] = info['offset'] line = lines[token.line - 1] adjustment = len(line)-len(line.lstrip()) + 1 if adjustment == token.col: offsets[end_line] = (info['offset'] + info['adjustment'] - adjustment + info['extra_indent'] - info['extra_indent_prev']) elif (start_line + info['line_span'] - 1 == end_line and info['line_span'] > 2 and token.kind != 'html_singleton_end'): offsets[end_line] = (1 + info['extra_indent'] + (info['depth'] + 1) * num_spaces) - adjustment elif token.line != info['line']: offsets[end_line] = info['offset'] if token.tag != 'pre' and token.kind != 'html_singleton_end' and token.tag != 'script': for line_num in range(start_line + 1, end_line): # Be careful not to override offsets that happened # deeper in the HTML within our block. if line_num not in offsets: line = lines[line_num - 1] new_depth = info['depth'] + 1 if (line.lstrip().startswith('{{else}}') or line.lstrip().startswith('{% else %}') or line.lstrip().startswith('{% elif')): new_depth = info['actual_depth'] extra_indent = info['extra_indent'] adjustment = len(line)-len(line.lstrip()) + 1 offset = (1 + extra_indent + new_depth * num_spaces) - adjustment offsets[line_num] = offset elif (token.kind in ('handlebars_end', 'django_end') and info['indenting'] and line_num < info['adjust_offset_until']): offsets[line_num] += num_spaces elif token.tag != 'pre': for line_num in range(start_line + 1, end_line): if line_num not in offsets: offsets[line_num] = info['offset'] else: for line_num in range(start_line + 1, end_line): if line_num not in offsets: offsets[line_num] = 0 # Now that we have all of our offsets calculated, we can just # join all our lines together, fixing up offsets as needed. formatted_lines = [] for i, line in enumerate(html.split('\n')): row = i + 1 offset = offsets.get(row, 0) pretty_line = line if line.strip() == '': pretty_line = '' else: if offset > 0: pretty_line = (' ' * offset) + pretty_line elif offset < 0: pretty_line = pretty_line[-1 * offset:] assert line.strip() == pretty_line.strip() formatted_lines.append(pretty_line) return '\n'.join(formatted_lines) def validate_indent_html(fn): # type: (str) -> int file = open(fn) html = file.read() phtml = pretty_print_html(html) file.close() if not html.split('\n') == phtml.split('\n'): temp_file = open('/var/tmp/pretty_html.txt', 'w') temp_file.write(phtml) temp_file.close() print('Invalid Indentation detected in file: %s\nDiff for the file against expected indented file:' % (fn)) os.system('diff %s %s' % (fn, '/var/tmp/pretty_html.txt')) return 0 return 1
christi3k/zulip
tools/lib/pretty_print.py
Python
apache-2.0
8,553
/* * Copyright 2015 the original author or 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 org.gradle.internal.filewatch.jdk7; import com.google.common.base.Throwables; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import org.gradle.api.Action; import org.gradle.api.internal.file.FileSystemSubset; import org.gradle.internal.filewatch.FileWatcher; import org.gradle.internal.filewatch.FileWatcherEvent; import org.gradle.internal.filewatch.FileWatcherListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.lang.ref.SoftReference; import java.nio.file.ClosedWatchServiceException; import java.nio.file.WatchService; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; public class WatchServiceFileWatcherBacking { private static final Logger LOGGER = LoggerFactory.getLogger(WatchServiceFileWatcherBacking.class); private final AtomicBoolean started = new AtomicBoolean(); private final AtomicBoolean running = new AtomicBoolean(); private final AtomicBoolean stopped = new AtomicBoolean(); private final AtomicReference<SoftReference<Thread>> pollerThreadReference = new AtomicReference<SoftReference<Thread>>(); private final Action<? super Throwable> onError; private final WatchServiceRegistrar watchServiceRegistrar; private final WatchService watchService; private final WatchServicePoller poller; private final FileWatcher fileWatcher = new FileWatcher() { @Override public boolean isRunning() { return running.get(); } @Override public void watch(FileSystemSubset fileSystemSubset) throws IOException { WatchServiceFileWatcherBacking.this.watchServiceRegistrar.watch(fileSystemSubset); } @Override public void stop() { WatchServiceFileWatcherBacking.this.stop(); } }; WatchServiceFileWatcherBacking(Action<? super Throwable> onError, FileWatcherListener listener, WatchService watchService) throws IOException { this(onError, listener, watchService, new WatchServiceRegistrar(watchService, listener)); } WatchServiceFileWatcherBacking(Action<? super Throwable> onError, FileWatcherListener listener, WatchService watchService, WatchServiceRegistrar watchServiceRegistrar) throws IOException { this.onError = onError; this.watchServiceRegistrar = watchServiceRegistrar; this.watchService = watchService; this.poller = new WatchServicePoller(watchService); } public FileWatcher start(ListeningExecutorService executorService) { if (started.compareAndSet(false, true)) { final ListenableFuture<?> runLoopFuture = executorService.submit(new Runnable() { @Override public void run() { if (!stopped.get()) { pollerThreadReference.set(new SoftReference<Thread>(Thread.currentThread())); running.set(true); try { try { pumpEvents(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { if (!(Throwables.getRootCause(t) instanceof InterruptedException)) { stop(); onError.execute(t); } } } finally { stop(); } } } }); // This is necessary so that the watcher indicates its not running if the runnable gets cancelled Futures.addCallback(runLoopFuture, new FutureCallback<Object>() { @Override public void onSuccess(Object result) { running.set(false); } @Override public void onFailure(Throwable t) { running.set(false); } }, MoreExecutors.directExecutor()); return fileWatcher; } else { throw new IllegalStateException("file watcher is started"); } } private void pumpEvents() throws InterruptedException { while (isRunning()) { try { List<FileWatcherEvent> events = poller.takeEvents(); if (events != null) { deliverEvents(events); } } catch (ClosedWatchServiceException e) { LOGGER.debug("Received ClosedWatchServiceException, stopping"); stop(); } } } private void deliverEvents(List<FileWatcherEvent> events) { for (FileWatcherEvent event : events) { if (!isRunning()) { LOGGER.debug("File watching isn't running, breaking out of event delivery."); break; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Received file system event: {}", event); } watchServiceRegistrar.onChange(fileWatcher, event); } } private boolean isRunning() { return running.get() && !Thread.currentThread().isInterrupted(); } private void stop() { if (stopped.compareAndSet(false, true)) { if (running.compareAndSet(true, false)) { LOGGER.debug("Stopping file watching"); interruptPollerThread(); try { watchService.close(); } catch (IOException e) { // ignore exception in shutdown } catch (ClosedWatchServiceException e) { // ignore } } } } private void interruptPollerThread() { SoftReference<Thread> threadSoftReference = pollerThreadReference.getAndSet(null); if (threadSoftReference != null) { Thread pollerThread = threadSoftReference.get(); if (pollerThread != null && pollerThread != Thread.currentThread()) { // only interrupt poller thread if it's not current thread LOGGER.debug("Interrupting poller thread '{}'", pollerThread.getName()); pollerThread.interrupt(); } } } }
blindpirate/gradle
subprojects/core/src/main/java/org/gradle/internal/filewatch/jdk7/WatchServiceFileWatcherBacking.java
Java
apache-2.0
7,361
/** * Copyright 2016 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS-IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { is3pThrottled, getAmpAdRenderOutsideViewport, incrementLoadingAds, } from '../../amp-ad/0.1/concurrent-load'; import {adConfig} from '../../../ads/_config'; import {signingServerURLs} from '../../../ads/_a4a-config'; import { removeChildren, createElementWithAttributes, } from '../../../src/dom'; import {cancellation, isCancellation} from '../../../src/error'; import { installAnchorClickInterceptor, } from '../../../src/anchor-click-interceptor'; import { installFriendlyIframeEmbed, setFriendlyIframeEmbedVisible, } from '../../../src/friendly-iframe-embed'; import {isLayoutSizeDefined} from '../../../src/layout'; import {isAdPositionAllowed} from '../../../src/ad-helper'; import {dev, user} from '../../../src/log'; import {getMode} from '../../../src/mode'; import {isArray, isObject, isEnumValue} from '../../../src/types'; import {some} from '../../../src/utils/promise'; import {utf8Decode} from '../../../src/utils/bytes'; import {viewerForDoc} from '../../../src/viewer'; import {xhrFor} from '../../../src/xhr'; import {endsWith} from '../../../src/string'; import {platformFor} from '../../../src/platform'; import {cryptoFor} from '../../../src/crypto'; import {isExperimentOn} from '../../../src/experiments'; import {setStyle} from '../../../src/style'; import {handleClick} from '../../../ads/alp/handler'; import {AdDisplayState} from '../../../extensions/amp-ad/0.1/amp-ad-ui'; import { getDefaultBootstrapBaseUrl, generateSentinel, } from '../../../src/3p-frame'; import { installUrlReplacementsForEmbed, } from '../../../src/service/url-replacements-impl'; import {extensionsFor} from '../../../src/extensions'; import {A4AVariableSource} from './a4a-variable-source'; // TODO(tdrl): Temporary. Remove when we migrate to using amp-analytics. import {getTimingDataAsync} from '../../../src/service/variable-source'; import {getContextMetadata} from '../../../src/iframe-attributes'; /** @type {string} */ const METADATA_STRING = '<script type="application/json" amp-ad-metadata>'; /** @type {string} */ const METADATA_STRING_NO_QUOTES = '<script type=application/json amp-ad-metadata>'; // TODO(tdrl): Temporary, while we're verifying whether SafeFrame is an // acceptable solution to the 'Safari on iOS doesn't fetch iframe src from // cache' issue. See https://github.com/ampproject/amphtml/issues/5614 /** @type {string} */ const SAFEFRAME_VERSION = '1-0-5'; /** @type {string} @visibleForTesting */ export const SAFEFRAME_IMPL_PATH = 'https://tpc.googlesyndication.com/safeframe/' + SAFEFRAME_VERSION + '/html/container.html'; /** @type {string} @visibleForTesting */ export const RENDERING_TYPE_HEADER = 'X-AmpAdRender'; /** @type {string} */ const TAG = 'amp-a4a'; /** @type {string} */ const NO_CONTENT_RESPONSE = 'NO-CONTENT-RESPONSE'; /** @enum {string} */ export const XORIGIN_MODE = { CLIENT_CACHE: 'client_cache', SAFEFRAME: 'safeframe', NAMEFRAME: 'nameframe', }; /** @type {!Object} @private */ const SHARED_IFRAME_PROPERTIES = { frameborder: '0', allowfullscreen: '', allowtransparency: '', scrolling: 'no', marginwidth: '0', marginheight: '0', }; /** @typedef {{ * creative: ArrayBuffer, * signature: ?Uint8Array, * size: ?Array<number> * }} */ export let AdResponseDef; /** @typedef {{ minifiedCreative: string, customElementExtensions: !Array<string>, customStylesheets: !Array<{href: string}> }} */ let CreativeMetaDataDef; /** * A set of public keys for a single AMP signing service. A single service may * return more than one key if, e.g., they're rotating keys and they serve * the current and upcoming keys. A CryptoKeysDef stores one or more * (promises to) keys, in the order given by the return value from the * signing service. * * @typedef {{serviceName: string, keys: !Array<!Promise<!../../../src/crypto.PublicKeyInfoDef>>}} */ let CryptoKeysDef; /** * The public keys for all signing services. This is an array of promises, * one per signing service, in the order given by the array returned by * #getSigningServiceNames(). Each entry resolves to the keys returned by * that service, represented by a `CryptoKeysDef` object. * * @typedef {Array<!Promise<!CryptoKeysDef>>} */ let AllServicesCryptoKeysDef; /** @private */ export const LIFECYCLE_STAGES = { // Note: Use strings as values here, rather than numbers, so that "0" does // not test as `false` later. adSlotCleared: '-1', urlBuilt: '1', adRequestStart: '2', adRequestEnd: '3', extractCreativeAndSignature: '4', adResponseValidateStart: '5', renderFriendlyStart: '6', // TODO(dvoytenko): this signal and similar are actually "embed-create", not "render-start". renderCrossDomainStart: '7', renderFriendlyEnd: '8', renderCrossDomainEnd: '9', preAdThrottle: '10', renderSafeFrameStart: '11', throttled3p: '12', adResponseValidateEnd: '13', xDomIframeLoaded: '14', friendlyIframeLoaded: '15', adSlotCollapsed: '16', adSlotUnhidden: '17', layoutAdPromiseDelay: '18', signatureVerifySuccess: '19', networkError: '20', friendlyIframeIniLoad: '21', }; /** * Utility function that ensures any error thrown is handled by optional * onError handler (if none provided or handler throws, error is swallowed and * undefined is returned). * @param {!Function} fn to protect * @param {T=} inThis An optional object to use as the 'this' object * when calling the function. If not provided, undefined is bound as this * when calling function. * @param {function(this:T, !Error, ...*):?=} onError function given error * and arguments provided to function call. * @return {!Function} protected function * @template T * @visibleForTesting */ export function protectFunctionWrapper( fn, inThis = undefined, onError = undefined) { return (...fnArgs) => { try { return fn.apply(inThis, fnArgs); } catch (err) { if (onError) { try { // Ideally we could use [err, ...var_args] but linter disallows // spread so instead using unshift :( fnArgs.unshift(err); return onError.apply(inThis, fnArgs); } catch (captureErr) { // swallow error if error handler throws. } } // In the event of no optional on error function or its execution throws, // return undefined. return undefined; } }; }; export class AmpA4A extends AMP.BaseElement { // TODO: Add more error handling throughout code. // TODO: Handle creatives that do not fill. /** * @param {!Element} element */ constructor(element) { super(element); dev().assert(AMP.AmpAdUIHandler); dev().assert(AMP.AmpAdXOriginIframeHandler); /** @private {?Promise<?CreativeMetaDataDef>} */ this.adPromise_ = null; /** * @private {number} unique ID of the currently executing promise to allow * for cancellation. */ this.promiseId_ = 0; /** {?Object} */ this.config = null; /** @private {?string} */ this.adUrl_ = null; /** @private {?../../../src/friendly-iframe-embed.FriendlyIframeEmbed} */ this.friendlyIframeEmbed_ = null; /** {?AMP.AmpAdUIHandler} */ this.uiHandler = null; /** @private {?AMP.AmpAdXOriginIframeHandler} */ this.xOriginIframeHandler_ = null; /** @private {boolean} whether layoutMeasure has been executed. */ this.layoutMeasureExecuted_ = false; /** @const @private {!../../../src/service/vsync-impl.Vsync} */ this.vsync_ = this.getVsync(); /** @private {boolean} whether creative has been verified as AMP */ this.isVerifiedAmpCreative_ = false; /** @private @const {!../../../src/service/crypto-impl.Crypto} */ this.crypto_ = cryptoFor(this.win); if (!this.win.ampA4aValidationKeys) { // Without the following variable assignment, there's no way to apply a // type annotation to a win-scoped variable, so the type checker doesn't // catch type errors here. This no-op allows us to enforce some type // expectations. The const assignment will hopefully be optimized // away by the compiler. *fingers crossed* /** @type {!AllServicesCryptoKeysDef} */ const forTypeSafety = this.getKeyInfoSets_(); this.win.ampA4aValidationKeys = forTypeSafety; } /** @private {?ArrayBuffer} */ this.creativeBody_ = null; /** * Note(keithwrightbos) - ensure the default here is null so that ios * uses safeframe when response header is not specified. * @private {?XORIGIN_MODE} */ this.experimentalNonAmpCreativeRenderMethod_ = platformFor(this.win).isIos() ? XORIGIN_MODE.SAFEFRAME : null; /** * Gets a notion of current time, in ms. The value is not necessarily * absolute, so should be used only for computing deltas. When available, * the performance system will be used; otherwise Date.now() will be * returned. * * @const {function():number} * @private */ this.getNow_ = (this.win.performance && this.win.performance.now) ? this.win.performance.now.bind(this.win.performance) : Date.now; /** * Protected version of emitLifecycleEvent that ensures error does not * cause promise chain to reject. * @private {function(string, !Object=)} */ this.protectedEmitLifecycleEvent_ = protectFunctionWrapper( this.emitLifecycleEvent, this, (err, varArgs) => { dev().error(TAG, this.element.getAttribute('type'), 'Error on emitLifecycleEvent', err, varArgs) ; }); /** @const {string} */ this.sentinel = generateSentinel(window); /** * Used to indicate whether this slot should be collapsed or not. Marked * true if the ad response has status 204, is null, or has a null * arrayBuffer. * @private {boolean} */ this.isCollapsed_ = false; } /** @override */ getPriority() { // Priority used for scheduling preload and layout callback. Because // AMP creatives will be injected as part of the promise chain created // within onLayoutMeasure, this is only relevant to non-AMP creatives // therefore we want this to match the 3p priority. return 2; } /** @override */ isLayoutSupported(layout) { return isLayoutSizeDefined(layout); } /** @override */ buildCallback() { const adType = this.element.getAttribute('type'); this.config = adConfig[adType] || {}; this.uiHandler = new AMP.AmpAdUIHandler(this); this.uiHandler.init(); } /** @override */ renderOutsideViewport() { // Ensure non-verified AMP creatives are throttled. if (!this.isVerifiedAmpCreative_ && is3pThrottled(this.win)) { this.protectedEmitLifecycleEvent_('throttled3p'); return false; } // Otherwise the ad is good to go. const elementCheck = getAmpAdRenderOutsideViewport(this.element); return elementCheck !== null ? elementCheck : super.renderOutsideViewport(); } /** * To be overridden by network specific implementation indicating if element * (and environment generally) are valid for sending XHR queries. * @return {boolean} whether element is valid and ad request should be * sent. If false, no ad request is sent and slot will be collapsed if * possible. */ isValidElement() { return true; } /** * Returns true if this element was loaded from an amp-ad element. For use by * network-specific implementations that don't want to allow themselves to be * embedded directly into a page. * @return {boolean} */ isAmpAdElement() { return this.element.tagName == 'AMP-AD' || this.element.tagName == 'AMP-EMBED'; } /** * Prefetches and preconnects URLs related to the ad using adPreconnect * registration which assumes ad request domain used for 3p is applicable. * @param {boolean=} unusedOnLayout * @override */ preconnectCallback(unusedOnLayout) { this.preconnect.url(SAFEFRAME_IMPL_PATH); this.preconnect.url(getDefaultBootstrapBaseUrl(this.win, 'nameframe')); if (!this.config) { return; } const preconnect = this.config.preconnect; // NOTE(keithwrightbos): using onLayout to indicate if preconnect should be // given preferential treatment. Currently this would be false when // relevant (i.e. want to preconnect on or before onLayoutMeasure) which // causes preconnect to delay for 1 sec (see custom-element#preconnect) // therefore hard coding to true. // NOTE(keithwrightbos): Does not take isValidElement into account so could // preconnect unnecessarily, however it is assumed that isValidElement // matches amp-ad loader predicate such that A4A impl does not load. if (typeof preconnect == 'string') { this.preconnect.url(preconnect, true); } else if (preconnect) { preconnect.forEach(p => { this.preconnect.url(p, true); }); } } /** @override */ onLayoutMeasure() { if (this.xOriginIframeHandler_) { this.xOriginIframeHandler_.onLayoutMeasure(); } if (this.layoutMeasureExecuted_ || !this.crypto_.isCryptoAvailable()) { // onLayoutMeasure gets called multiple times. return; } const slotRect = this.getIntersectionElementLayoutBox(); if (slotRect.height == 0 || slotRect.width == 0) { dev().fine( TAG, 'onLayoutMeasure canceled due height/width 0', this.element); return; } user().assert(isAdPositionAllowed(this.element, this.win), '<%s> is not allowed to be placed in elements with ' + 'position:fixed: %s', this.element.tagName, this.element); this.layoutMeasureExecuted_ = true; // OnLayoutMeasure can be called when page is in prerender so delay until // visible. Assume that it is ok to call isValidElement as it should // only being looking at window, immutable properties (i.e. location) and // its element ancestry. if (!this.isValidElement()) { // TODO(kjwright): collapse? user().warn(TAG, this.element.getAttribute('type'), 'Amp ad element ignored as invalid', this.element); return; } // Increment unique promise ID so that if its value changes within the // promise chain due to cancel from unlayout, the promise will be rejected. this.promiseId_++; const promiseId = this.promiseId_; // Shorthand for: reject promise if current promise chain is out of date. const checkStillCurrent = promiseId => { if (promiseId != this.promiseId_) { throw cancellation(); } }; // If in localDev `type=fake` Ad specifies `force3p`, it will be forced // to go via 3p. if (getMode().localDev && this.element.getAttribute('type') == 'fake' && this.element.getAttribute('force3p') == 'true') { this.adUrl_ = this.getAdUrl(); this.adPromise_ = Promise.resolve(); return; } // Return value from this chain: True iff rendering was "successful" // (i.e., shouldn't try to render later via iframe); false iff should // try to render later in iframe. // Cases to handle in this chain: // - Everything ok => Render; return true // - Empty network response returned => Don't render; return true // - Can't parse creative out of response => Don't render; return false // - Can parse, but creative is empty => Don't render; return true // - Validation fails => return false // - Rendering fails => return false // - Chain cancelled => don't return; drop error // - Uncaught error otherwise => don't return; percolate error up this.adPromise_ = viewerForDoc(this.getAmpDoc()).whenFirstVisible() // This block returns the ad URL, if one is available. /** @return {!Promise<?string>} */ .then(() => { checkStillCurrent(promiseId); return /** @type {!Promise<?string>} */ (this.getAdUrl()); }) // This block returns the (possibly empty) response to the XHR request. /** @return {!Promise<?Response>} */ .then(adUrl => { checkStillCurrent(promiseId); this.adUrl_ = adUrl; this.protectedEmitLifecycleEvent_('urlBuilt'); return adUrl && this.sendXhrRequest_(adUrl); }) // The following block returns either the response (as a {bytes, headers} // object), or null if no response is available / response is empty. /** @return {?Promise<?{bytes: !ArrayBuffer, headers: !Headers}>} */ .then(fetchResponse => { checkStillCurrent(promiseId); this.protectedEmitLifecycleEvent_('adRequestEnd'); // If the response is null, we want to return null so that // unlayoutCallback will attempt to render via x-domain iframe, // assuming ad url or creative exist. if (!fetchResponse) { return null; } // If the response has response code 204, or arrayBuffer is null, // collapse it. if (!fetchResponse.arrayBuffer || fetchResponse.status == 204) { this.forceCollapse(); return Promise.reject(NO_CONTENT_RESPONSE); } // TODO(tdrl): Temporary, while we're verifying whether SafeFrame is // an acceptable solution to the 'Safari on iOS doesn't fetch // iframe src from cache' issue. See // https://github.com/ampproject/amphtml/issues/5614 const method = fetchResponse.headers.get(RENDERING_TYPE_HEADER) || this.experimentalNonAmpCreativeRenderMethod_; this.experimentalNonAmpCreativeRenderMethod_ = method; if (method && !isEnumValue(XORIGIN_MODE, method)) { dev().error('AMP-A4A', `cross-origin render mode header ${method}`); } // Note: Resolving a .then inside a .then because we need to capture // two fields of fetchResponse, one of which is, itself, a promise, // and one of which isn't. If we just return // fetchResponse.arrayBuffer(), the next step in the chain will // resolve it to a concrete value, but we'll lose track of // fetchResponse.headers. return fetchResponse.arrayBuffer().then(bytes => { if (bytes.byteLength == 0) { // The server returned no content. Instead of displaying a blank // rectangle, we collapse the slot instead. this.forceCollapse(); return Promise.reject(NO_CONTENT_RESPONSE); } return { bytes, headers: fetchResponse.headers, }; }); }) // This block returns the ad creative and signature, if available; null // otherwise. /** * @return {!Promise<?{creative: !ArrayBuffer, signature: !ArrayBuffer}>} */ .then(responseParts => { checkStillCurrent(promiseId); if (responseParts) { this.protectedEmitLifecycleEvent_('extractCreativeAndSignature'); } return responseParts && this.extractCreativeAndSignature( responseParts.bytes, responseParts.headers); }) // This block returns the ad creative if it exists and validates as AMP; // null otherwise. /** @return {!Promise<?ArrayBuffer>} */ .then(creativeParts => { checkStillCurrent(promiseId); // Keep a handle to the creative body so that we can render into // SafeFrame or NameFrame later, if necessary. TODO(tdrl): Temporary, // while we // assess whether this is the right solution to the Safari+iOS iframe // src cache issue. If we decide to keep a SafeFrame-like solution, // we should restructure the promise chain to pass this info along // more cleanly, without use of an object variable outside the chain. if (!creativeParts) { return Promise.resolve(); } if (this.experimentalNonAmpCreativeRenderMethod_ != XORIGIN_MODE.CLIENT_CACHE && creativeParts.creative) { this.creativeBody_ = creativeParts.creative; } if (creativeParts.size && creativeParts.size.length == 2) { this.handleResize(creativeParts.size[0], creativeParts.size[1]); } if (!creativeParts.signature) { return Promise.resolve(); } this.protectedEmitLifecycleEvent_('adResponseValidateStart'); return this.verifyCreativeSignature_( creativeParts.creative, creativeParts.signature) .then(creative => { if (creative) { return creative; } user().error(TAG, this.element.getAttribute('type'), 'Unable to validate AMP creative against key providers'); // Attempt to re-fetch the keys in case our locally cached // batch has expired. this.win.ampA4aValidationKeys = this.getKeyInfoSets_(); return this.verifyCreativeSignature_( creativeParts.creative, creativeParts.signature); }); }) .then(creative => { checkStillCurrent(promiseId); // Need to know if creative was verified as part of render outside // viewport but cannot wait on promise. Sadly, need a state a // variable. this.isVerifiedAmpCreative_ = !!creative; // TODO(levitzky) If creative comes back null, we should consider re- // fetching the signing server public keys and try the verification // step again. return creative && utf8Decode(creative); }) // This block returns CreativeMetaDataDef iff the creative was verified // as AMP and could be properly parsed for friendly iframe render. /** @return {?CreativeMetaDataDef} */ .then(creativeDecoded => { checkStillCurrent(promiseId); // Note: It's critical that #getAmpAdMetadata_ be called // on precisely the same creative that was validated // via #validateAdResponse_. See GitHub issue // https://github.com/ampproject/amphtml/issues/4187 let creativeMetaDataDef; if (!creativeDecoded || !(creativeMetaDataDef = this.getAmpAdMetadata_(creativeDecoded))) { return null; } // Update priority. this.updatePriority(0); // Load any extensions; do not wait on their promises as this // is just to prefetch. const extensions = extensionsFor(this.win); creativeMetaDataDef.customElementExtensions.forEach( extensionId => extensions.loadExtension(extensionId)); return creativeMetaDataDef; }) .catch(error => { if (error == NO_CONTENT_RESPONSE) { return { minifiedCreative: '', customElementExtensions: [], customStylesheets: [], }; } // If error in chain occurs, report it and return null so that // layoutCallback can render via cross domain iframe assuming ad // url or creative exist. this.promiseErrorHandler_(error); return null; }); } /** * Attempts to validate the creative signature against every key currently in * our possession. This should never be called before at least one key fetch * attempt is made. * * @param {!ArrayBuffer} creative * @param {!Uint8Array} signature * @return {!Promise<!ArrayBuffer>} The creative. */ verifyCreativeSignature_(creative, signature) { if (getMode().localDev) { // localDev mode allows "FAKESIG" signature for the "fake" network. if (signature == 'FAKESIG' && this.element.getAttribute('type') == 'fake') { return Promise.resolve(creative); } } // For each signing service, we have exactly one Promise, // keyInfoSetPromise, that holds an Array of Promises of signing keys. // So long as any one of these signing services can verify the // signature, then the creative is valid AMP. /** @type {!AllServicesCryptoKeysDef} */ const keyInfoSetPromises = this.win.ampA4aValidationKeys; // Track if verification found, as it will ensure that promises yet to // resolve will "cancel" as soon as possible saving unnecessary resource // allocation. let verified = false; return some(keyInfoSetPromises.map(keyInfoSetPromise => { // Resolve Promise into an object containing a 'keys' field, which // is an Array of Promises of signing keys. *whew* return keyInfoSetPromise.then(keyInfoSet => { // As long as any one individual key of a particular signing // service, keyInfoPromise, can verify the signature, then the // creative is valid AMP. if (verified) { return Promise.reject('noop'); } return some(keyInfoSet.keys.map(keyInfoPromise => { // Resolve Promise into signing key. return keyInfoPromise.then(keyInfo => { if (verified) { return Promise.reject('noop'); } if (!keyInfo) { return Promise.reject('Promise resolved to null key.'); } const signatureVerifyStartTime = this.getNow_(); // If the key exists, try verifying with it. return this.crypto_.verifySignature( new Uint8Array(creative), signature, keyInfo) .then(isValid => { if (isValid) { verified = true; this.protectedEmitLifecycleEvent_( 'signatureVerifySuccess', { 'met.delta.AD_SLOT_ID': Math.round( this.getNow_() - signatureVerifyStartTime), 'signingServiceName.AD_SLOT_ID': keyInfo.serviceName, }); return creative; } // Only report if signature is expected to match, given that // multiple key providers could have been specified. // Note: the 'keyInfo &&' check here is not strictly // necessary, because we checked that above. But // Closure type compiler can't seem to recognize that, so // this guarantees it to the compiler. if (keyInfo && this.crypto_.verifyHashVersion(signature, keyInfo)) { user().error(TAG, this.element.getAttribute('type'), 'Key failed to validate creative\'s signature', keyInfo.serviceName, keyInfo.cryptoKey); } // Reject to ensure the some operation waits for other // possible providers to properly verify and resolve. return Promise.reject( `${keyInfo.serviceName} key failed to verify`); }, err => { dev().error( TAG, this.element.getAttribute('type'), keyInfo.serviceName, err, this.element); }); }); })) // some() returns an array of which we only need a single value. .then(returnedArray => returnedArray[0], () => { // Rejection occurs if all keys for this provider fail to validate. return Promise.reject( `All keys for ${keyInfoSet.serviceName} failed to verify`); }); }); })) .then(returnedArray => { this.protectedEmitLifecycleEvent_('adResponseValidateEnd'); return returnedArray[0]; }, () => { // rejection occurs if all providers fail to verify. this.protectedEmitLifecycleEvent_('adResponseValidateEnd'); return Promise.reject('No validation service could verify this key'); }); } /** * Handles uncaught errors within promise flow. * @param {*} error * @private */ promiseErrorHandler_(error) { if (isCancellation(error)) { // Rethrow if cancellation. throw error; } if (!error || !error.message) { error = new Error('unknown error ' + error); } // Add `type` to the message. Ensure to preserve the original stack. const type = this.element.getAttribute('type') || 'notype'; error.message = `${TAG}: ${type}: ${error.message}`; // Additional arguments. const adQueryIdx = this.adUrl_ ? this.adUrl_.indexOf('?') : -1; error.args = { 'au': adQueryIdx < 0 ? '' : this.adUrl_.substring(adQueryIdx + 1, adQueryIdx + 251), }; if (getMode().development || getMode().localDev || getMode().log) { user().error(TAG, error); } else { user().warn(TAG, error); // Report with 1% sampling as an expected dev error. if (Math.random() < 0.01) { dev().expectedError(TAG, error); } } } /** @override */ layoutCallback() { // Promise may be null if element was determined to be invalid for A4A. if (!this.adPromise_) { return Promise.resolve(); } // There's no real throttling with A4A, but this is the signal that is // most comparable with the layout callback for 3p ads. this.protectedEmitLifecycleEvent_('preAdThrottle'); const layoutCallbackStart = this.getNow_(); // Promise chain will have determined if creative is valid AMP. return this.adPromise_.then(creativeMetaData => { const delta = this.getNow_() - layoutCallbackStart; this.protectedEmitLifecycleEvent_('layoutAdPromiseDelay', { layoutAdPromiseDelay: Math.round(delta), isAmpCreative: !!creativeMetaData, }); if (this.isCollapsed_) { return Promise.resolve(); } const protectedOnCreativeRender = protectFunctionWrapper(this.onCreativeRender, this, err => { dev().error(TAG, this.element.getAttribute('type'), 'Error executing onCreativeRender', err); }); if (!creativeMetaData) { // Non-AMP creative case, will verify ad url existence. return this.renderNonAmpCreative_() .then(() => protectedOnCreativeRender(false)); } // Must be an AMP creative. return this.renderAmpCreative_(creativeMetaData) .then(() => protectedOnCreativeRender(true)) .catch(err => { // Failed to render via AMP creative path so fallback to non-AMP // rendering within cross domain iframe. user().error(TAG, this.element.getAttribute('type'), 'Error injecting creative in friendly frame', err); this.promiseErrorHandler_(err); return this.renderNonAmpCreative_() .then(() => protectedOnCreativeRender(false)); }); }).catch(error => { this.promiseErrorHandler_(error); throw cancellation(); }); } /** @override */ unlayoutCallback() { this.protectedEmitLifecycleEvent_('adSlotCleared'); this.uiHandler.setDisplayState(AdDisplayState.NOT_LAID_OUT); this.isCollapsed_ = false; // Allow embed to release its resources. if (this.friendlyIframeEmbed_) { this.friendlyIframeEmbed_.destroy(); this.friendlyIframeEmbed_ = null; } // Remove creative and reset to allow for creation of new ad. if (!this.layoutMeasureExecuted_) { return true; } removeChildren(this.element); this.adPromise_ = null; this.adUrl_ = null; this.creativeBody_ = null; this.isVerifiedAmpCreative_ = false; this.experimentalNonAmpCreativeRenderMethod_ = platformFor(this.win).isIos() ? XORIGIN_MODE.SAFEFRAME : null; if (this.xOriginIframeHandler_) { this.xOriginIframeHandler_.freeXOriginIframe(); this.xOriginIframeHandler_ = null; } this.layoutMeasureExecuted_ = false; // Increment promiseId to cause any pending promise to cancel. this.promiseId_++; return true; } /** @override */ viewportCallback(inViewport) { if (this.friendlyIframeEmbed_) { setFriendlyIframeEmbedVisible(this.friendlyIframeEmbed_, inViewport); } if (this.xOriginIframeHandler_) { this.xOriginIframeHandler_.viewportCallback(inViewport); } } /** @override */ createPlaceholderCallback() { return this.uiHandler.createPlaceholderCallback(); } /** * Gets the Ad URL to send an XHR Request to. To be implemented * by network. * @return {!Promise<string>|string} */ getAdUrl() { throw new Error('getAdUrl not implemented!'); } /** * Extracts creative and verification signature (if present) from * XHR response body and header. To be implemented by network. * * In the returned value, the `creative` field should be an `ArrayBuffer` * containing the utf-8 encoded bytes of the creative itself, while the * `signature` field should be a `Uint8Array` containing the raw signature * bytes. The `signature` field may be null if no signature was available * for this creative / the creative is not valid AMP. * * @param {!ArrayBuffer} unusedResponseArrayBuffer content as array buffer * @param {!../../../src/service/xhr-impl.FetchResponseHeaders} unusedResponseHeaders * XHR service FetchResponseHeaders object containing the response * headers. * @return {!Promise<!AdResponseDef>} */ extractCreativeAndSignature(unusedResponseArrayBuffer, unusedResponseHeaders) { throw new Error('extractCreativeAndSignature not implemented!'); } /** * This function is called if the ad response contains a creative size header * indicating the size of the creative. It provides an opportunity to resize * the creative, if desired, before it is rendered. * * To be implemented by network. * * @param {number} width * @param {number} height * */ handleResize(width, height) { user().info('A4A', `Received creative with size ${width}x${height}.`); } /** * Forces the UI Handler to collapse this slot. * @visibleForTesting */ forceCollapse() { dev().assert(this.uiHandler); this.uiHandler.setDisplayState(AdDisplayState.LOADING); this.uiHandler.setDisplayState(AdDisplayState.LOADED_NO_CONTENT); this.isCollapsed_ = true; } /** * Callback executed when creative has successfully rendered within the * publisher page. To be overridden by network implementations as needed. * * @param {boolean} isVerifiedAmpCreative whether or not the creative was * verified as AMP and therefore given preferential treatment. */ onCreativeRender(isVerifiedAmpCreative) { if (isVerifiedAmpCreative) { this.protectedEmitLifecycleEvent_('renderFriendlyEnd'); } } /** * @param {!Element} iframe that was just created. To be overridden for * testing. * @visibleForTesting */ onCrossDomainIframeCreated(iframe) { dev().info(TAG, this.element.getAttribute('type'), `onCrossDomainIframeCreated ${iframe}`); } /** * Send ad request, extract the creative and signature from the response. * @param {string} adUrl Request URL to send XHR to. * @return {!Promise<?../../../src/service/xhr-impl.FetchResponse>} * @private */ sendXhrRequest_(adUrl) { this.protectedEmitLifecycleEvent_('adRequestStart'); const xhrInit = { mode: 'cors', method: 'GET', credentials: 'include', }; return xhrFor(this.win) .fetch(adUrl, xhrInit) .catch(unusedReason => { // If an error occurs, let the ad be rendered via iframe after delay. // TODO(taymonbeal): Figure out a more sophisticated test for deciding // whether to retry with an iframe after an ad request failure or just // give up and render the fallback content (or collapse the ad slot). this.protectedEmitLifecycleEvent_('networkError'); return null; }); } /** * To be overridden by network specific implementation indicating which * signing service(s) is to be used. * @return {!Array<string>} A list of signing services. */ getSigningServiceNames() { return getMode().localDev ? ['google', 'google-dev'] : ['google']; } /** * Retrieves all public keys, as specified in _a4a-config.js. * None of the (inner or outer) promises returned by this function can reject. * * @return {!AllServicesCryptoKeysDef} * @private */ getKeyInfoSets_() { if (!this.crypto_.isCryptoAvailable()) { return []; } return this.getSigningServiceNames().map(serviceName => { dev().assert(getMode().localDev || !endsWith(serviceName, '-dev')); const url = signingServerURLs[serviceName]; const currServiceName = serviceName; if (url) { // Set disableAmpSourceOrigin so that __amp_source_origin is not // included in XHR CORS request allowing for keyset to be cached // across pages. return xhrFor(this.win).fetchJson(url, { mode: 'cors', method: 'GET', ampCors: false, credentials: 'omit', }).then(jwkSetObj => { const result = {serviceName: currServiceName}; if (isObject(jwkSetObj) && Array.isArray(jwkSetObj.keys) && jwkSetObj.keys.every(isObject)) { result.keys = jwkSetObj.keys; } else { user().error(TAG, this.element.getAttribute('type'), `Invalid response from signing server ${currServiceName}`, this.element); result.keys = []; } return result; }).then(jwkSet => { return { serviceName: jwkSet.serviceName, keys: jwkSet.keys.map(jwk => this.crypto_.importPublicKey(jwkSet.serviceName, jwk) .catch(err => { user().error(TAG, this.element.getAttribute('type'), `error importing keys for service: ${jwkSet.serviceName}`, err, this.element); return null; })), }; }).catch(err => { user().error( TAG, this.element.getAttribute('type'), err, this.element); // TODO(a4a-team): This is a failure in the initial attempt to get // the keys, probably b/c of a network condition. We should // re-trigger key fetching later. return {serviceName: currServiceName, keys: []}; }); } else { // The given serviceName does not have a corresponding URL in // _a4a-config.js. const reason = `Signing service '${serviceName}' does not exist.`; user().error( TAG, this.element.getAttribute('type'), reason, this.element); return Promise.resolve({serviceName: currServiceName, keys: []}); } }); } /** * Render non-AMP creative within cross domain iframe. * @return {Promise<boolean>} Whether the creative was successfully rendered. * @private */ renderNonAmpCreative_() { this.promiseErrorHandler_(new Error('fallback to 3p')); this.protectedEmitLifecycleEvent_('preAdThrottle'); incrementLoadingAds(this.win); // Haven't rendered yet, so try rendering via one of our // cross-domain iframe solutions. const method = this.experimentalNonAmpCreativeRenderMethod_; if ((method == XORIGIN_MODE.SAFEFRAME || method == XORIGIN_MODE.NAMEFRAME) && this.creativeBody_) { const renderPromise = this.renderViaNameAttrOfXOriginIframe_( this.creativeBody_); this.creativeBody_ = null; // Free resources. return renderPromise; } else if (this.adUrl_) { return this.renderViaCachedContentIframe_(this.adUrl_); } else { // Ad URL may not exist if buildAdUrl throws error or returns empty. // If error occurred, it would have already been reported but let's // report to user in case of empty. user().warn(TAG, this.element.getAttribute('type'), 'No creative or URL available -- A4A can\'t render any ad'); return Promise.resolve(false); } } /** * Render a validated AMP creative directly in the parent page. * @param {!CreativeMetaDataDef} creativeMetaData Metadata required to render * AMP creative. * @return {!Promise} Whether the creative was successfully rendered. * @private */ renderAmpCreative_(creativeMetaData) { dev().assert(creativeMetaData.minifiedCreative, 'missing minified creative'); dev().assert(!!this.element.ownerDocument, 'missing owner document?!'); this.protectedEmitLifecycleEvent_('renderFriendlyStart'); // Create and setup friendly iframe. const iframe = /** @type {!HTMLIFrameElement} */( createElementWithAttributes( /** @type {!Document} */(this.element.ownerDocument), 'iframe', { frameborder: '0', allowfullscreen: '', allowtransparency: '', scrolling: 'no', })); this.applyFillContent(iframe); const fontsArray = []; if (creativeMetaData.customStylesheets) { creativeMetaData.customStylesheets.forEach(s => { const href = s['href']; if (href) { fontsArray.push(href); } }); } return installFriendlyIframeEmbed( iframe, this.element, { host: this.element, url: this.adUrl_, html: creativeMetaData.minifiedCreative, extensionIds: creativeMetaData.customElementExtensions || [], fonts: fontsArray, }, embedWin => { installUrlReplacementsForEmbed(this.getAmpDoc(), embedWin, new A4AVariableSource(this.getAmpDoc(), embedWin)); }).then(friendlyIframeEmbed => { this.friendlyIframeEmbed_ = friendlyIframeEmbed; setFriendlyIframeEmbedVisible( friendlyIframeEmbed, this.isInViewport()); // Ensure visibility hidden has been removed (set by boilerplate). const frameDoc = friendlyIframeEmbed.iframe.contentDocument || friendlyIframeEmbed.win.document; setStyle(frameDoc.body, 'visibility', 'visible'); // Capture phase click handlers on the ad. installAnchorClickInterceptor( this.getAmpDoc(), friendlyIframeEmbed.win); // Bubble phase click handlers on the ad. this.registerAlpHandler_(friendlyIframeEmbed.win); // Capture timing info for friendly iframe load completion. getTimingDataAsync(friendlyIframeEmbed.win, 'navigationStart', 'loadEventEnd').then(delta => { this.protectedEmitLifecycleEvent_('friendlyIframeLoaded', { 'navStartToLoadEndDelta.AD_SLOT_ID': Math.round(delta), }); }).catch(err => { dev().error(TAG, this.element.getAttribute('type'), 'getTimingDataAsync for renderFriendlyEnd failed: ', err); }); // It's enough to wait for "ini-load" signal because in a FIE case // we know that the embed no longer consumes significant resources // after the initial load. return friendlyIframeEmbed.whenIniLoaded(); }).then(() => { // Capture ini-load ping. this.protectedEmitLifecycleEvent_('friendlyIframeIniLoad'); }); } /** * Shared functionality for cross-domain iframe-based rendering methods. * @param {!Element} iframe Iframe to render. Should be fully configured * (all attributes set), but not yet attached to DOM. * @return {!Promise} awaiting load event for ad frame * @private */ iframeRenderHelper_(iframe) { // TODO(keithwrightbos): noContentCallback? this.xOriginIframeHandler_ = new AMP.AmpAdXOriginIframeHandler(this); return this.xOriginIframeHandler_.init(iframe, /* opt_isA4A */ true); } /** * Creates iframe whose src matches that of the ad URL. The response should * have been cached causing the browser to render without callout. However, * it is possible for cache miss to occur which can be detected server-side * by missing ORIGIN header. * * Note: As of 2016-10-18, the fill-from-cache assumption appears to fail on * Safari-on-iOS, which issues a fresh network request, even though the * content is already in cache. * * @param {string} adUrl Ad request URL, as sent to #sendXhrRequest_ (i.e., * before any modifications that XHR module does to it.) * @return {!Promise} awaiting ad completed insertion. * @private */ renderViaCachedContentIframe_(adUrl) { this.protectedEmitLifecycleEvent_('renderCrossDomainStart'); /** @const {!Element} */ const iframe = createElementWithAttributes( /** @type {!Document} */(this.element.ownerDocument), 'iframe', Object.assign({ 'height': this.element.getAttribute('height'), 'width': this.element.getAttribute('width'), // XHR request modifies URL by adding origin as parameter. Need to // append ad URL, otherwise cache will miss. // TODO: remove call to getCorsUrl and instead have fetch API return // modified url. 'src': xhrFor(this.win).getCorsUrl(this.win, adUrl), }, SHARED_IFRAME_PROPERTIES)); // Can't get the attributes until we have the iframe, then set it. const attributes = getContextMetadata( this.win, this.element, this.sentinel); iframe.setAttribute('name', JSON.stringify(attributes)); iframe.setAttribute('data-amp-3p-sentinel', this.sentinel); return this.iframeRenderHelper_(iframe); } /** * Render the creative via some "cross domain iframe that accepts the creative * in the name attribute". This could be SafeFrame or the AMP-native * NameFrame. * * @param {!ArrayBuffer} creativeBody * @return {!Promise} awaiting load event for ad frame * @private */ renderViaNameAttrOfXOriginIframe_(creativeBody) { const method = this.experimentalNonAmpCreativeRenderMethod_; dev().assert(method == XORIGIN_MODE.SAFEFRAME || method == XORIGIN_MODE.NAMEFRAME, 'Unrecognized A4A cross-domain rendering mode: %s', method); this.protectedEmitLifecycleEvent_('renderSafeFrameStart'); return utf8Decode(creativeBody).then(creative => { let srcPath; let nameData; switch (method) { case XORIGIN_MODE.SAFEFRAME: srcPath = SAFEFRAME_IMPL_PATH + '?n=0'; nameData = `${SAFEFRAME_VERSION};${creative.length};${creative}`; break; case XORIGIN_MODE.NAMEFRAME: srcPath = getDefaultBootstrapBaseUrl(this.win, 'nameframe'); nameData = ''; // Name will be set for real below in nameframe case. break; default: // Shouldn't be able to get here, but... Because of the assert, above, // we can only get here in non-dev mode, so give user feedback. user().error('A4A', 'A4A received unrecognized cross-domain name' + ' attribute iframe rendering mode request: %s. Unable to' + ' render a creative for' + ' slot %s.', method, this.element.getAttribute('id')); return Promise.reject('Unrecognized rendering mode request'); } /** @const {!Element} */ const iframe = createElementWithAttributes( /** @type {!Document} */(this.element.ownerDocument), 'iframe', Object.assign({ 'height': this.element.getAttribute('height'), 'width': this.element.getAttribute('width'), 'src': srcPath, 'name': nameData, }, SHARED_IFRAME_PROPERTIES)); if (method == XORIGIN_MODE.NAMEFRAME) { // TODO(bradfrizzell): change name of function and var const attributes = getContextMetadata( this.win, this.element, this.sentinel); attributes['creative'] = creative; const name = JSON.stringify(attributes); // Need to reassign the name once we've generated the context // attributes off of the iframe. Need the iframe to generate. iframe.setAttribute('name', name); iframe.setAttribute('data-amp-3p-sentinel', this.sentinel); } return this.iframeRenderHelper_(iframe); }); } /** * * Throws {@code SyntaxError} if the metadata block delimiters are missing * or corrupted or if the metadata content doesn't parse as JSON. * @param {string} creative from which CSS is extracted * @return {?CreativeMetaDataDef} Object result of parsing JSON data blob inside * the metadata markers on the ad text, or null if no metadata markers are * found. * @private * TODO(keithwrightbos@): report error cases */ getAmpAdMetadata_(creative) { let metadataString = METADATA_STRING; let metadataStart = creative.lastIndexOf(METADATA_STRING); if (metadataStart < 0) { metadataString = METADATA_STRING_NO_QUOTES; metadataStart = creative.lastIndexOf(METADATA_STRING_NO_QUOTES); } if (metadataStart < 0) { // Couldn't find a metadata blob. dev().warn(TAG, this.element.getAttribute('type'), 'Could not locate start index for amp meta data in: %s', creative); return null; } const metadataEnd = creative.lastIndexOf('</script>'); if (metadataEnd < 0) { // Couldn't find a metadata blob. dev().warn(TAG, this.element.getAttribute('type'), 'Could not locate closing script tag for amp meta data in: %s', creative); return null; } try { const metaDataObj = JSON.parse( creative.slice(metadataStart + metadataString.length, metadataEnd)); const ampRuntimeUtf16CharOffsets = metaDataObj['ampRuntimeUtf16CharOffsets']; if (!isArray(ampRuntimeUtf16CharOffsets) || ampRuntimeUtf16CharOffsets.length != 2 || typeof ampRuntimeUtf16CharOffsets[0] !== 'number' || typeof ampRuntimeUtf16CharOffsets[1] !== 'number') { throw new Error('Invalid runtime offsets'); } const metaData = {}; if (metaDataObj['customElementExtensions']) { metaData.customElementExtensions = metaDataObj['customElementExtensions']; if (!isArray(metaData.customElementExtensions)) { throw new Error( 'Invalid extensions', metaData.customElementExtensions); } } else { metaData.customElementExtensions = []; } if (metaDataObj['customStylesheets']) { // Expect array of objects with at least one key being 'href' whose // value is URL. metaData.customStylesheets = metaDataObj['customStylesheets']; const errorMsg = 'Invalid custom stylesheets'; if (!isArray(metaData.customStylesheets)) { throw new Error(errorMsg); } metaData.customStylesheets.forEach(stylesheet => { if (!isObject(stylesheet) || !stylesheet['href'] || typeof stylesheet['href'] !== 'string' || !/^https:\/\//i.test(stylesheet['href'])) { throw new Error(errorMsg); } }); } // TODO(keithwrightbos): OK to assume ampRuntimeUtf16CharOffsets is before // metadata as its in the head? metaData.minifiedCreative = creative.slice(0, ampRuntimeUtf16CharOffsets[0]) + creative.slice(ampRuntimeUtf16CharOffsets[1], metadataStart) + creative.slice(metadataEnd + '</script>'.length); return metaData; } catch (err) { dev().warn( TAG, this.element.getAttribute('type'), 'Invalid amp metadata: %s', creative.slice(metadataStart + METADATA_STRING.length, metadataEnd)); return null; } } /** * Registers a click handler for "A2A" (AMP-to-AMP navigation where the AMP * viewer navigates to an AMP destination on our behalf. * @param {!Window} iframeWin */ registerAlpHandler_(iframeWin) { if (!isExperimentOn(this.win, 'alp-for-a4a')) { return; } iframeWin.document.documentElement.addEventListener('click', event => { handleClick(event, url => { viewerForDoc(this.getAmpDoc()).navigateTo(url, 'a4a'); }); }); } /** * Receive collapse notifications and record lifecycle events for them. * * @param unusedElement {!AmpElement} * @override */ collapsedCallback(unusedElement) { this.protectedEmitLifecycleEvent_('adSlotCollapsed'); } /** * To be overriden by network specific implementation. * This function will be called for each lifecycle event as specified in the * LIFECYCLE_STAGES enum declaration. It may additionally pass extra * variables of the form { name: val }. It is up to the subclass what to * do with those variables. * * @param {string} unusedEventName * @param {!Object<string, string|number>=} opt_extraVariables */ emitLifecycleEvent(unusedEventName, opt_extraVariables) {} }
Adtoma/amphtml
extensions/amp-a4a/0.1/amp-a4a.js
JavaScript
apache-2.0
54,093
/** * Copyright 2010-2014 Axel Fontaine * * 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. */ /** * Private API. No compatibility guarantees provided. */ package org.flywaydb.core.internal.resolver.jdbc;
typischmann/flyway
flyway-core/src/main/java/org/flywaydb/core/internal/resolver/jdbc/package-info.java
Java
apache-2.0
718
/* * Copyright 2013 Séven Le Mesle * * 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 fr.xebia.extras.selma.beans; import java.util.List; /** * Created by slemesle on 21/06/2014. */ public class LibraryDTO { private List<BookDTO> books; public List<BookDTO> getBooks() { return books; } public void setBooks(List<BookDTO> books) { this.books = books; } }
zouabimourad/selma
processor/src/test/java/fr/xebia/extras/selma/beans/LibraryDTO.java
Java
apache-2.0
925
package com.material.widget; import android.content.Context; import android.content.res.AssetManager; import android.content.res.TypedArray; import android.graphics.*; import android.os.Build; import android.support.annotation.NonNull; import android.text.TextPaint; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; /** * Created by IntelliJ IDEA. * User: keith. * Date: 14-10-9. * Time: 17:04. */ public class PaperButton extends View { private static final String TAG = PaperButton.class.getSimpleName(); private static final long ANIMATION_DURATION = 200; private static final int StateNormal = 1; private static final int StateTouchDown = 2; private static final int StateTouchUp = 3; private static final float SHADOW_RADIUS = 8.0f; private static final float SHADOW_OFFSET_X = 0.0f; private static final float SHADOW_OFFSET_Y = 4.0f; private static final float MIN_SHADOW_COLOR_ALPHA = 0.1f; private static final float MAX_SHADOW_COLOR_ALPHA = 0.4f; private int mState = StateNormal; private long mStartTime; private int mColor; private int mShadowColor; private int mCornerRadius; private int mPadding; private int mTextSize; private int mTextColor; private float mShadowRadius; private float mShadowOffsetX; private float mShadowOffsetY; private CharSequence mText; private RectF backgroundRectF; private Rect mFingerRect; private Path rippleClipPath; private boolean mMoveOutside; private Point mTouchPoint = new Point(); private Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private Paint ripplePaint = new Paint(Paint.ANTI_ALIAS_FLAG); private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); public PaperButton(Context context) { this(context, null); } public PaperButton(Context context, AttributeSet attrs) { this(context, attrs, 0); } public PaperButton(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mPadding = getResources().getDimensionPixelSize(R.dimen.paper_padding); TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.PaperButton); mColor = attributes.getColor(R.styleable.PaperButton_paper_color, getResources().getColor(R.color.paper_button_color)); mShadowColor = attributes.getColor(R.styleable.PaperButton_paper_shadow_color, getResources().getColor(R.color.paper_button_shadow_color)); mCornerRadius = attributes.getDimensionPixelSize(R.styleable.PaperButton_paper_corner_radius, getResources().getDimensionPixelSize(R.dimen.paper_button_corner_radius)); mText = attributes.getText(R.styleable.PaperButton_paper_text); mTextSize = attributes.getDimensionPixelSize(R.styleable.PaperButton_paper_text_size, getResources().getDimensionPixelSize(R.dimen.paper_text_size)); mTextColor = attributes.getColor(R.styleable.PaperButton_paper_text_color, getResources().getColor(R.color.paper_text_color)); final String assetPath = attributes.getString(R.styleable.PaperButton_paper_font); if (assetPath != null) { AssetManager assets = context.getAssets(); Typeface typeface = Typeface.createFromAsset(assets, assetPath); textPaint.setTypeface(typeface); } mShadowRadius = attributes.getFloat(R.styleable.PaperButton_paper_shadow_radius, SHADOW_RADIUS); mShadowOffsetX = attributes.getFloat(R.styleable.PaperButton_paper_shadow_offset_x, SHADOW_OFFSET_X); mShadowOffsetY = attributes.getFloat(R.styleable.PaperButton_paper_shadow_offset_y, SHADOW_OFFSET_Y); attributes.recycle(); backgroundPaint.setColor(mColor); backgroundPaint.setStyle(Paint.Style.FILL); int shadowColor = changeColorAlpha(mShadowColor, MIN_SHADOW_COLOR_ALPHA); backgroundPaint.setShadowLayer(mShadowRadius, mShadowOffsetX, mShadowOffsetY, shadowColor); textPaint.setColor(mTextColor); textPaint.setTextSize(mTextSize); textPaint.setTextAlign(TextPaint.Align.CENTER); ripplePaint.setColor(darkenColor(mColor)); setWillNotDraw(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { setLayerType(View.LAYER_TYPE_SOFTWARE, null); } } private int changeColorAlpha(int color, float value) { int alpha = Math.round(Color.alpha(color) * value); int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); return Color.argb(alpha, red, green, blue); } private int darkenColor(int color) { float[] hsv = new float[3]; Color.colorToHSV(color, hsv); hsv[2] *= 0.9f; return Color.HSVToColor(hsv); } public void setColor(int color) { mColor = color; backgroundPaint.setColor(mColor); ripplePaint.setColor(darkenColor(mColor));// invalidate(); } public void setShadowColor(int color) { mShadowColor = color; backgroundPaint.setShadowLayer(mShadowRadius, mShadowOffsetX, mShadowOffsetY, mShadowColor); invalidate(); } public void setTextSize(int pixel) { mTextSize = pixel; textPaint.setTextSize(mTextSize); invalidate(); } public void setTextColor(int color) { mTextColor = color; textPaint.setColor(mTextColor); invalidate(); } public void setText(String text){ mText = text; invalidate(); } private RectF getRectF() { if (backgroundRectF == null) { backgroundRectF = new RectF(); backgroundRectF.left = mPadding; backgroundRectF.top = mPadding; backgroundRectF.right = getWidth() - mPadding; backgroundRectF.bottom = getHeight() - mPadding; } return backgroundRectF; } @Override public boolean onTouchEvent(@NonNull MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mMoveOutside = false; mFingerRect = new Rect(getLeft(), getTop(), getRight(), getBottom()); mTouchPoint.set(Math.round(event.getX()), Math.round(event.getY())); mState = StateTouchDown; mStartTime = System.currentTimeMillis(); invalidate(); break; case MotionEvent.ACTION_MOVE: if (!mFingerRect.contains(getLeft() + (int) event.getX(), getTop() + (int) event.getY())) { mMoveOutside = true; mState = StateNormal; invalidate(); } break; case MotionEvent.ACTION_UP: if (!mMoveOutside) { mState = StateTouchUp; mStartTime = System.currentTimeMillis(); invalidate(); performClick(); } break; case MotionEvent.ACTION_CANCEL: mState = StateNormal; invalidate(); break; } return true; } @Override protected void onDraw(@NonNull Canvas canvas) { super.onDraw(canvas); int radius = 0; int shadowColor = changeColorAlpha(mShadowColor, MIN_SHADOW_COLOR_ALPHA); long elapsed = System.currentTimeMillis() - mStartTime; switch (mState) { case StateNormal: shadowColor = changeColorAlpha(mShadowColor, MIN_SHADOW_COLOR_ALPHA); break; case StateTouchDown: ripplePaint.setAlpha(255); if (elapsed < ANIMATION_DURATION) { radius = Math.round(elapsed * getWidth() / 2 / ANIMATION_DURATION); float shadowAlpha = (MAX_SHADOW_COLOR_ALPHA - MIN_SHADOW_COLOR_ALPHA) * elapsed / ANIMATION_DURATION + MIN_SHADOW_COLOR_ALPHA; shadowColor = changeColorAlpha(mShadowColor, shadowAlpha); } else { radius = getWidth() / 2; shadowColor = changeColorAlpha(mShadowColor, MAX_SHADOW_COLOR_ALPHA); } postInvalidate(); break; case StateTouchUp: if (elapsed < ANIMATION_DURATION) { int alpha = Math.round((ANIMATION_DURATION - elapsed) * 255 / ANIMATION_DURATION); ripplePaint.setAlpha(alpha); radius = getWidth() / 2 + Math.round(elapsed * getWidth() / 2 / ANIMATION_DURATION); float shadowAlpha = (MAX_SHADOW_COLOR_ALPHA - MIN_SHADOW_COLOR_ALPHA) * (ANIMATION_DURATION - elapsed) / ANIMATION_DURATION + MIN_SHADOW_COLOR_ALPHA; shadowColor = changeColorAlpha(mShadowColor, shadowAlpha); } else { mState = StateNormal; radius = 0; ripplePaint.setAlpha(0); shadowColor = changeColorAlpha(mShadowColor, MIN_SHADOW_COLOR_ALPHA); } postInvalidate(); break; } backgroundPaint.setShadowLayer(mShadowRadius, mShadowOffsetX, mShadowOffsetY, shadowColor); canvas.drawRoundRect(getRectF(), mCornerRadius, mCornerRadius, backgroundPaint); canvas.save(); if (mState == StateTouchDown || mState == StateTouchUp) { if (rippleClipPath == null) { rippleClipPath = new Path(); rippleClipPath.addRoundRect(getRectF(), mCornerRadius, mCornerRadius, Path.Direction.CW); } canvas.clipPath(rippleClipPath); } canvas.drawCircle(mTouchPoint.x, mTouchPoint.y, radius, ripplePaint); canvas.restore(); if (mText != null && mText.length() > 0) { int y = (int) (getHeight() / 2 - ((textPaint.descent() + textPaint.ascent()) / 2)); canvas.drawText(mText.toString(), getWidth() / 2, y, textPaint); } } }
0359xiaodong/MaterialQQLite
MaterialWidget/src/main/java/com/material/widget/PaperButton.java
Java
apache-2.0
10,482
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Benchmarks FilterDataset input pipeline op.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import numpy as np from tensorflow.contrib.data.python.ops import optimization from tensorflow.python.client import session from tensorflow.python.data.ops import dataset_ops from tensorflow.python.framework import ops from tensorflow.python.ops import math_ops from tensorflow.python.platform import test class FilterBenchmark(test.Benchmark): # This benchmark compares the performance of pipeline with multiple chained # filter with and without filter fusion. def benchmarkFilters(self): chain_lengths = [0, 1, 2, 5, 10, 20, 50] for chain_length in chain_lengths: self._benchmarkFilters(chain_length, False) self._benchmarkFilters(chain_length, True) def _benchmarkFilters(self, chain_length, optimize_dataset): with ops.Graph().as_default(): dataset = dataset_ops.Dataset.from_tensors(5).repeat(None) for _ in range(chain_length): dataset = dataset.filter(lambda x: math_ops.greater_equal(x - 5, 0)) if optimize_dataset: dataset = dataset.apply(optimization.optimize(["filter_fusion"])) iterator = dataset.make_one_shot_iterator() next_element = iterator.get_next() with session.Session() as sess: for _ in range(10): sess.run(next_element.op) deltas = [] for _ in range(100): start = time.time() for _ in range(100): sess.run(next_element.op) end = time.time() deltas.append(end - start) median_wall_time = np.median(deltas) / 100 opt_mark = "opt" if optimize_dataset else "no-opt" print("Filter dataset {} chain length: {} Median wall time: {}".format( opt_mark, chain_length, median_wall_time)) self.report_benchmark( iters=1000, wall_time=median_wall_time, name="benchmark_filter_dataset_chain_latency_{}_{}".format( opt_mark, chain_length)) if __name__ == "__main__": test.main()
kobejean/tensorflow
tensorflow/contrib/data/python/kernel_tests/filter_dataset_op_test.py
Python
apache-2.0
2,828
/* * Copyright 2017 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.workbench.common.stunner.core.graph.command.impl; import java.util.HashSet; import java.util.Set; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.kie.workbench.common.stunner.core.command.CommandResult; import org.kie.workbench.common.stunner.core.command.exception.BadCommandArgumentsException; import org.kie.workbench.common.stunner.core.graph.Node; import org.kie.workbench.common.stunner.core.graph.content.Bounds; import org.kie.workbench.common.stunner.core.graph.content.view.View; import org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext; import org.kie.workbench.common.stunner.core.rule.RuleViolation; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class UpdateElementPropertyValueCommandTest extends AbstractGraphCommandTest { private static final String UUID = "testUUID"; private static final String DEF_ID = "defId"; private static final String PROPERTY_ID = "pId"; private static final String PROPERTY_VALUE = "testValue1"; private static final String PROPERTY_OLD_VALUE = "testOldValue1"; @Mock private Node candidate; private View content; @Mock private Object definition; private Object property = new PropertyStub(PROPERTY_ID); private UpdateElementPropertyValueCommand tested; @Before @SuppressWarnings("unchecked") public void setup() throws Exception { super.init(500, 500); content = mockView(10, 10, 50, 50); when(candidate.getContent()).thenReturn(content); when(content.getDefinition()).thenReturn(definition); Set<Object> properties = new HashSet<Object>(1) {{ add(property); }}; when(definitionAdapter.getProperties(eq(definition))).thenReturn(properties); when(definitionAdapter.getId(eq(definition))).thenReturn(DEF_ID); when(propertyAdapter.getId(eq(property))).thenReturn(PROPERTY_ID); when(propertyAdapter.getValue(eq(property))).thenReturn(PROPERTY_OLD_VALUE); when(graphIndex.getNode(eq(UUID))).thenReturn(candidate); when(graphIndex.get(eq(UUID))).thenReturn(candidate); this.tested = new UpdateElementPropertyValueCommand(UUID, PROPERTY_ID, PROPERTY_VALUE); } @Test @SuppressWarnings("unchecked") public void testAllow() { CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(ruleManager, times(0)).evaluate(eq(ruleSet), any(RuleEvaluationContext.class)); } @Test(expected = BadCommandArgumentsException.class) public void testAllowNodeNotFound() { when(graphIndex.getNode(eq(UUID))).thenReturn(null); tested.allow(graphCommandExecutionContext); } @Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<Bounds> bounds = ArgumentCaptor.forClass(Bounds.class); assertEquals(CommandResult.Type.INFO, result.getType()); assertEquals(PROPERTY_OLD_VALUE, tested.getOldValue()); verify(propertyAdapter, times(1)).getValue(eq(property)); verify(propertyAdapter, times(1)).setValue(eq(property), eq(PROPERTY_VALUE)); } @Test(expected = BadCommandArgumentsException.class) public void testExecuteNodeNotFound() { when(graphIndex.get(eq(UUID))).thenReturn(null); tested.execute(graphCommandExecutionContext); } private class PropertyStub { private final String uuid; private PropertyStub(String uuid) { this.uuid = uuid; } } }
etirelli/kie-wb-common
kie-wb-common-stunner/kie-wb-common-stunner-core/kie-wb-common-stunner-commons/kie-wb-common-stunner-core-common/src/test/java/org/kie/workbench/common/stunner/core/graph/command/impl/UpdateElementPropertyValueCommandTest.java
Java
apache-2.0
5,093
package com.lidroid.xutils.sample; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.*; import com.lidroid.xutils.ViewUtils; import com.lidroid.xutils.exception.DbException; import com.lidroid.xutils.exception.HttpException; import com.lidroid.xutils.http.HttpHandler; import com.lidroid.xutils.http.ResponseInfo; import com.lidroid.xutils.http.callback.RequestCallBack; import com.lidroid.xutils.sample.download.DownloadInfo; import com.lidroid.xutils.sample.download.DownloadManager; import com.lidroid.xutils.sample.download.DownloadService; import com.lidroid.xutils.util.LogUtils; import com.lidroid.xutils.view.annotation.ViewInject; import com.lidroid.xutils.view.annotation.event.OnClick; import java.io.File; import java.lang.ref.WeakReference; /** * Author: wyouflf * Date: 13-11-20 * Time: 上午12:12 */ public class DownloadListActivity extends Activity { @ViewInject(R.id.download_list) private ListView downloadList; private DownloadManager downloadManager; private DownloadListAdapter downloadListAdapter; private Context mAppContext; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.download_list); ViewUtils.inject(this); mAppContext = this.getApplicationContext(); downloadManager = DownloadService.getDownloadManager(mAppContext); downloadListAdapter = new DownloadListAdapter(mAppContext); downloadList.setAdapter(downloadListAdapter); } @Override public void onResume() { super.onResume(); downloadListAdapter.notifyDataSetChanged(); } @Override public void onDestroy() { try { if (downloadListAdapter != null && downloadManager != null) { downloadManager.backupDownloadInfoList(); } } catch (DbException e) { LogUtils.e(e.getMessage(), e); } super.onDestroy(); } private class DownloadListAdapter extends BaseAdapter { private final Context mContext; private final LayoutInflater mInflater; private DownloadListAdapter(Context context) { mContext = context; mInflater = LayoutInflater.from(mContext); } @Override public int getCount() { if (downloadManager == null) return 0; return downloadManager.getDownloadInfoListCount(); } @Override public Object getItem(int i) { return downloadManager.getDownloadInfo(i); } @Override public long getItemId(int i) { return i; } @SuppressWarnings("unchecked") @Override public View getView(int i, View view, ViewGroup viewGroup) { DownloadItemViewHolder holder = null; DownloadInfo downloadInfo = downloadManager.getDownloadInfo(i); if (view == null) { view = mInflater.inflate(R.layout.download_item, null); holder = new DownloadItemViewHolder(downloadInfo); ViewUtils.inject(holder, view); view.setTag(holder); holder.refresh(); } else { holder = (DownloadItemViewHolder) view.getTag(); holder.update(downloadInfo); } HttpHandler<File> handler = downloadInfo.getHandler(); if (handler != null) { RequestCallBack callBack = handler.getRequestCallBack(); if (callBack instanceof DownloadManager.ManagerCallBack) { DownloadManager.ManagerCallBack managerCallBack = (DownloadManager.ManagerCallBack) callBack; if (managerCallBack.getBaseCallBack() == null) { managerCallBack.setBaseCallBack(new DownloadRequestCallBack()); } } callBack.setUserTag(new WeakReference<DownloadItemViewHolder>(holder)); } return view; } } public class DownloadItemViewHolder { @ViewInject(R.id.download_label) TextView label; @ViewInject(R.id.download_state) TextView state; @ViewInject(R.id.download_pb) ProgressBar progressBar; @ViewInject(R.id.download_stop_btn) Button stopBtn; @ViewInject(R.id.download_remove_btn) Button removeBtn; private DownloadInfo downloadInfo; public DownloadItemViewHolder(DownloadInfo downloadInfo) { this.downloadInfo = downloadInfo; } @OnClick(R.id.download_stop_btn) public void stop(View view) { HttpHandler.State state = downloadInfo.getState(); switch (state) { case WAITING: case STARTED: case LOADING: try { downloadManager.stopDownload(downloadInfo); } catch (DbException e) { LogUtils.e(e.getMessage(), e); } break; case CANCELLED: case FAILURE: try { downloadManager.resumeDownload(downloadInfo, new DownloadRequestCallBack()); } catch (DbException e) { LogUtils.e(e.getMessage(), e); } downloadListAdapter.notifyDataSetChanged(); break; default: break; } } @OnClick(R.id.download_remove_btn) public void remove(View view) { try { downloadManager.removeDownload(downloadInfo); downloadListAdapter.notifyDataSetChanged(); } catch (DbException e) { LogUtils.e(e.getMessage(), e); } } public void update(DownloadInfo downloadInfo) { this.downloadInfo = downloadInfo; refresh(); } public void refresh() { label.setText(downloadInfo.getFileName()); state.setText(downloadInfo.getState().toString()); if (downloadInfo.getFileLength() > 0) { progressBar.setProgress((int) (downloadInfo.getProgress() * 100 / downloadInfo.getFileLength())); } else { progressBar.setProgress(0); } stopBtn.setVisibility(View.VISIBLE); stopBtn.setText(mAppContext.getString(R.string.stop)); HttpHandler.State state = downloadInfo.getState(); switch (state) { case WAITING: stopBtn.setText(mAppContext.getString(R.string.stop)); break; case STARTED: stopBtn.setText(mAppContext.getString(R.string.stop)); break; case LOADING: stopBtn.setText(mAppContext.getString(R.string.stop)); break; case CANCELLED: stopBtn.setText(mAppContext.getString(R.string.resume)); break; case SUCCESS: stopBtn.setVisibility(View.INVISIBLE); break; case FAILURE: stopBtn.setText(mAppContext.getString(R.string.retry)); break; default: break; } } } private class DownloadRequestCallBack extends RequestCallBack<File> { @SuppressWarnings("unchecked") private void refreshListItem() { if (userTag == null) return; WeakReference<DownloadItemViewHolder> tag = (WeakReference<DownloadItemViewHolder>) userTag; DownloadItemViewHolder holder = tag.get(); if (holder != null) { holder.refresh(); } } @Override public void onStart() { refreshListItem(); } @Override public void onLoading(long total, long current, boolean isUploading) { refreshListItem(); } @Override public void onSuccess(ResponseInfo<File> responseInfo) { refreshListItem(); } @Override public void onFailure(HttpException error, String msg) { refreshListItem(); } @Override public void onCancelled() { refreshListItem(); } } }
zzspuck/SmartCity
xUtils-master/sample/src/com/lidroid/xutils/sample/DownloadListActivity.java
Java
apache-2.0
8,716
/* * 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.ignite.spi.deployment.uri.scanners.ftp; import org.apache.ignite.*; /** * An exception occurred during URI FTP deployment. */ class GridUriDeploymentFtpException extends IgniteCheckedException { /** */ private static final long serialVersionUID = 0L; /** * Creates new grid exception with given error message. * * @param msg Error message. */ GridUriDeploymentFtpException(String msg) { super(msg); } /** * Creates new grid ftp client exception with given error message and optional nested exception. * * @param msg Error message. * @param cause Optional nested exception (can be {@code null}). */ GridUriDeploymentFtpException(String msg, Throwable cause) { super(msg, cause); } }
gridgain/apache-ignite
modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/ftp/GridUriDeploymentFtpException.java
Java
apache-2.0
1,580
/* * Copyright 2012 Amadeus s.a.s. * 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. */ Aria.classDefinition({ $classpath : "test.aria.html.HTMLTestSuite", $extends : "aria.jsunit.TestSuite", $constructor : function () { this.$TestSuite.constructor.call(this); this.addTests("test.aria.html.element.ElementTestSuite"); this.addTests("test.aria.html.controllers.suggestions.ResourcesHandlerTest"); this.addTests("test.aria.html.textinput.TextInputTestSuite"); this.addTests("test.aria.html.checkbox.CheckBoxTest"); this.addTests("test.aria.html.template.basic.HtmlTemplateTestCase"); this.addTests("test.aria.html.template.submodule.SubModuleTestCase"); this.addTests("test.aria.html.radioButton.RadioButtonTest"); this.addTests("test.aria.html.select.SelectTest"); this.addTests("test.aria.html.select.bodycontent.BodyContentTestCase"); this.addTests("test.aria.html.select.onchange.DataModelOnChangeTestCase"); this.addTests("test.aria.html.DisabledTraitTest"); this.addTests("test.aria.html.radioButton.ieBug.RadioButtonTestCase"); this.addTests("test.aria.html.textarea.TextAreaTestSuite"); this.addTests("test.aria.html.template.prematureDisposal.PrematureDisposalTest"); this.addTests("test.aria.html.radioButton.listenerAfterDestruction.ListenerCalledAfterDestructionTest"); this.addTests("test.aria.html.radioButton.disabled.DisabledStateTest"); } });
mlaval/ariatemplates
test/aria/html/HTMLTestSuite.js
JavaScript
apache-2.0
2,019
import { Nullable } from "babylonjs/types"; import { serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from "babylonjs/Misc/decorators"; import { Matrix, Vector3 } from "babylonjs/Maths/math.vector"; import { Color3 } from "babylonjs/Maths/math.color"; import { IAnimatable } from 'babylonjs/Animations/animatable.interface'; import { Tags } from "babylonjs/Misc/tags"; import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture"; import { Texture } from "babylonjs/Materials/Textures/texture"; import { DynamicTexture } from "babylonjs/Materials/Textures/dynamicTexture"; import { IEffectCreationOptions } from "babylonjs/Materials/effect"; import { MaterialDefines } from "babylonjs/Materials/materialDefines"; import { MaterialHelper } from "babylonjs/Materials/materialHelper"; import { PushMaterial } from "babylonjs/Materials/pushMaterial"; import { MaterialFlags } from "babylonjs/Materials/materialFlags"; import { VertexBuffer } from "babylonjs/Buffers/buffer"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { SubMesh } from "babylonjs/Meshes/subMesh"; import { Mesh } from "babylonjs/Meshes/mesh"; import { Scene } from "babylonjs/scene"; import { RegisterClass } from 'babylonjs/Misc/typeStore'; import { EffectFallbacks } from 'babylonjs/Materials/effectFallbacks'; import "./fur.fragment"; import "./fur.vertex"; class FurMaterialDefines extends MaterialDefines { public DIFFUSE = false; public HEIGHTMAP = false; public CLIPPLANE = false; public CLIPPLANE2 = false; public CLIPPLANE3 = false; public CLIPPLANE4 = false; public CLIPPLANE5 = false; public CLIPPLANE6 = false; public ALPHATEST = false; public DEPTHPREPASS = false; public POINTSIZE = false; public FOG = false; public NORMAL = false; public UV1 = false; public UV2 = false; public VERTEXCOLOR = false; public VERTEXALPHA = false; public NUM_BONE_INFLUENCERS = 0; public BonesPerMesh = 0; public INSTANCES = false; public INSTANCESCOLOR = false; public HIGHLEVEL = false; public IMAGEPROCESSINGPOSTPROCESS = false; public SKIPFINALCOLORCLAMP = false; constructor() { super(); this.rebuild(); } } export class FurMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture") private _diffuseTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") public diffuseTexture: BaseTexture; @serializeAsTexture("heightTexture") private _heightTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") public heightTexture: BaseTexture; @serializeAsColor3() public diffuseColor = new Color3(1, 1, 1); @serialize() public furLength: number = 1; @serialize() public furAngle: number = 0; @serializeAsColor3() public furColor = new Color3(0.44, 0.21, 0.02); @serialize() public furOffset: number = 0.0; @serialize() public furSpacing: number = 12; @serializeAsVector3() public furGravity = new Vector3(0, 0, 0); @serialize() public furSpeed: number = 100; @serialize() public furDensity: number = 20; @serialize() public furOcclusion: number = 0.0; public furTexture: DynamicTexture; @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") public disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") public maxSimultaneousLights: number; @serialize() public highLevelFur: boolean = true; public _meshes: AbstractMesh[]; private _furTime: number = 0; constructor(name: string, scene?: Scene) { super(name, scene); } @serialize() public get furTime() { return this._furTime; } public set furTime(furTime: number) { this._furTime = furTime; } public needAlphaBlending(): boolean { return (this.alpha < 1.0); } public needAlphaTesting(): boolean { return false; } public getAlphaTestTexture(): Nullable<BaseTexture> { return null; } public updateFur(): void { for (var i = 1; i < this._meshes.length; i++) { var offsetFur = <FurMaterial>this._meshes[i].material; offsetFur.furLength = this.furLength; offsetFur.furAngle = this.furAngle; offsetFur.furGravity = this.furGravity; offsetFur.furSpacing = this.furSpacing; offsetFur.furSpeed = this.furSpeed; offsetFur.furColor = this.furColor; offsetFur.diffuseTexture = this.diffuseTexture; offsetFur.furTexture = this.furTexture; offsetFur.highLevelFur = this.highLevelFur; offsetFur.furTime = this.furTime; offsetFur.furDensity = this.furDensity; } } // Methods public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean { if (this.isFrozen) { if (subMesh.effect && subMesh.effect._wasPreviouslyReady) { return true; } } if (!subMesh.materialDefines) { subMesh.materialDefines = new FurMaterialDefines(); } var defines = <FurMaterialDefines>subMesh.materialDefines; var scene = this.getScene(); if (this._isReadyForSubMesh(subMesh)) { return true; } var engine = scene.getEngine(); // Textures if (defines._areTexturesDirty) { if (scene.texturesEnabled) { if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) { if (!this.diffuseTexture.isReady()) { return false; } else { defines._needUVs = true; defines.DIFFUSE = true; } } if (this.heightTexture && engine.getCaps().maxVertexTextureImageUnits) { if (!this.heightTexture.isReady()) { return false; } else { defines._needUVs = true; defines.HEIGHTMAP = true; } } } } // High level if (this.highLevelFur !== defines.HIGHLEVEL) { defines.HIGHLEVEL = true; defines.markAsUnprocessed(); } // Misc. MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines); // Lights defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting); // Values that need to be evaluated on every frame MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false); // Attribs MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true); // Get correct effect if (defines.isDirty) { defines.markAsProcessed(); scene.resetCachedMaterial(); // Fallbacks var fallbacks = new EffectFallbacks(); if (defines.FOG) { fallbacks.addFallback(1, "FOG"); } MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights); if (defines.NUM_BONE_INFLUENCERS > 0) { fallbacks.addCPUSkinningFallback(0, mesh); } defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess; //Attributes var attribs = [VertexBuffer.PositionKind]; if (defines.NORMAL) { attribs.push(VertexBuffer.NormalKind); } if (defines.UV1) { attribs.push(VertexBuffer.UVKind); } if (defines.UV2) { attribs.push(VertexBuffer.UV2Kind); } if (defines.VERTEXCOLOR) { attribs.push(VertexBuffer.ColorKind); } MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks); MaterialHelper.PrepareAttributesForInstances(attribs, defines); // Legacy browser patch var shaderName = "fur"; var join = defines.toString(); var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor", "vFogInfos", "vFogColor", "pointSize", "vDiffuseInfos", "mBones", "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "diffuseMatrix", "furLength", "furAngle", "furColor", "furOffset", "furGravity", "furTime", "furSpacing", "furDensity", "furOcclusion" ]; var samplers = ["diffuseSampler", "heightTexture", "furTexture" ]; var uniformBuffers = new Array<string>(); MaterialHelper.PrepareUniformsAndSamplersList(<IEffectCreationOptions>{ uniformsNames: uniforms, uniformBuffersNames: uniformBuffers, samplers: samplers, defines: defines, maxSimultaneousLights: this.maxSimultaneousLights }); subMesh.setEffect(scene.getEngine().createEffect(shaderName, <IEffectCreationOptions>{ attributes: attribs, uniformsNames: uniforms, uniformBuffersNames: uniformBuffers, samplers: samplers, defines: join, fallbacks: fallbacks, onCompiled: this.onCompiled, onError: this.onError, indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights } }, engine), defines, this._materialContext); } if (!subMesh.effect || !subMesh.effect.isReady()) { return false; } defines._renderId = scene.getRenderId(); subMesh.effect._wasPreviouslyReady = true; return true; } public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void { var scene = this.getScene(); var defines = <FurMaterialDefines>subMesh.materialDefines; if (!defines) { return; } var effect = subMesh.effect; if (!effect) { return; } this._activeEffect = effect; // Matrices this.bindOnlyWorldMatrix(world); this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix()); // Bones MaterialHelper.BindBonesParameters(mesh, this._activeEffect); if (scene.getCachedMaterial() !== this) { // Textures if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) { this._activeEffect.setTexture("diffuseSampler", this._diffuseTexture); this._activeEffect.setFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level); this._activeEffect.setMatrix("diffuseMatrix", this._diffuseTexture.getTextureMatrix()); } if (this._heightTexture) { this._activeEffect.setTexture("heightTexture", this._heightTexture); } // Clip plane MaterialHelper.BindClipPlane(this._activeEffect, scene); // Point size if (this.pointsCloud) { this._activeEffect.setFloat("pointSize", this.pointSize); } scene.bindEyePosition(effect); } this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility); if (scene.lightsEnabled && !this.disableLighting) { MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights); } // View if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) { this._activeEffect.setMatrix("view", scene.getViewMatrix()); } // Fog MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect); this._activeEffect.setFloat("furLength", this.furLength); this._activeEffect.setFloat("furAngle", this.furAngle); this._activeEffect.setColor4("furColor", this.furColor, 1.0); if (this.highLevelFur) { this._activeEffect.setVector3("furGravity", this.furGravity); this._activeEffect.setFloat("furOffset", this.furOffset); this._activeEffect.setFloat("furSpacing", this.furSpacing); this._activeEffect.setFloat("furDensity", this.furDensity); this._activeEffect.setFloat("furOcclusion", this.furOcclusion); this._furTime += this.getScene().getEngine().getDeltaTime() / this.furSpeed; this._activeEffect.setFloat("furTime", this._furTime); this._activeEffect.setTexture("furTexture", this.furTexture); } this._afterBind(mesh, this._activeEffect); } public getAnimatables(): IAnimatable[] { var results = []; if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) { results.push(this.diffuseTexture); } if (this.heightTexture && this.heightTexture.animations && this.heightTexture.animations.length > 0) { results.push(this.heightTexture); } return results; } public getActiveTextures(): BaseTexture[] { var activeTextures = super.getActiveTextures(); if (this._diffuseTexture) { activeTextures.push(this._diffuseTexture); } if (this._heightTexture) { activeTextures.push(this._heightTexture); } return activeTextures; } public hasTexture(texture: BaseTexture): boolean { if (super.hasTexture(texture)) { return true; } if (this.diffuseTexture === texture) { return true; } if (this._heightTexture === texture) { return true; } return false; } public dispose(forceDisposeEffect?: boolean): void { if (this.diffuseTexture) { this.diffuseTexture.dispose(); } if (this._meshes) { for (var i = 1; i < this._meshes.length; i++) { let mat = this._meshes[i].material; if (mat) { mat.dispose(forceDisposeEffect); } this._meshes[i].dispose(); } } super.dispose(forceDisposeEffect); } public clone(name: string): FurMaterial { return SerializationHelper.Clone(() => new FurMaterial(name, this.getScene()), this); } public serialize(): any { var serializationObject = super.serialize(); serializationObject.customType = "BABYLON.FurMaterial"; if (this._meshes) { serializationObject.sourceMeshName = this._meshes[0].name; serializationObject.quality = this._meshes.length; } return serializationObject; } public getClassName(): string { return "FurMaterial"; } // Statics public static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial { var material = SerializationHelper.Parse(() => new FurMaterial(source.name, scene), source, scene, rootUrl); if (source.sourceMeshName && material.highLevelFur) { scene.executeWhenReady(() => { var sourceMesh = <Mesh>scene.getMeshByName(source.sourceMeshName); if (sourceMesh) { var furTexture = FurMaterial.GenerateTexture("Fur Texture", scene); material.furTexture = furTexture; FurMaterial.FurifyMesh(sourceMesh, source.quality); } }); } return material; } public static GenerateTexture(name: string, scene: Scene): DynamicTexture { // Generate fur textures var texture = new DynamicTexture("FurTexture " + name, 256, scene, true); var context = texture.getContext(); for (var i = 0; i < 20000; ++i) { context.fillStyle = "rgba(255, " + Math.floor(Math.random() * 255) + ", " + Math.floor(Math.random() * 255) + ", 1)"; context.fillRect((Math.random() * texture.getSize().width), (Math.random() * texture.getSize().height), 2, 2); } texture.update(false); texture.wrapU = Texture.WRAP_ADDRESSMODE; texture.wrapV = Texture.WRAP_ADDRESSMODE; return texture; } // Creates and returns an array of meshes used as shells for the Fur Material // that can be disposed later in your code // The quality is in interval [0, 100] public static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[] { var meshes = [sourceMesh]; var mat: FurMaterial = <FurMaterial>sourceMesh.material; var i; if (!(mat instanceof FurMaterial)) { throw "The material of the source mesh must be a Fur Material"; } for (i = 1; i < quality; i++) { var offsetFur = new FurMaterial(mat.name + i, sourceMesh.getScene()); sourceMesh.getScene().materials.pop(); Tags.EnableFor(offsetFur); Tags.AddTagsTo(offsetFur, "furShellMaterial"); offsetFur.furLength = mat.furLength; offsetFur.furAngle = mat.furAngle; offsetFur.furGravity = mat.furGravity; offsetFur.furSpacing = mat.furSpacing; offsetFur.furSpeed = mat.furSpeed; offsetFur.furColor = mat.furColor; offsetFur.diffuseTexture = mat.diffuseTexture; offsetFur.furOffset = i / quality; offsetFur.furTexture = mat.furTexture; offsetFur.highLevelFur = mat.highLevelFur; offsetFur.furTime = mat.furTime; offsetFur.furDensity = mat.furDensity; var offsetMesh = sourceMesh.clone(sourceMesh.name + i) as Mesh; offsetMesh.material = offsetFur; offsetMesh.skeleton = sourceMesh.skeleton; offsetMesh.position = Vector3.Zero(); meshes.push(offsetMesh); } for (i = 1; i < meshes.length; i++) { meshes[i].parent = sourceMesh; } (<FurMaterial>sourceMesh.material)._meshes = meshes; return meshes; } } RegisterClass("BABYLON.FurMaterial", FurMaterial);
BabylonJS/Babylon.js
materialsLibrary/src/fur/furMaterial.ts
TypeScript
apache-2.0
19,590
// (C) Copyright 2015 Moodle Pty Ltd. // // 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. import { Injectable } from '@angular/core'; import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; import { TranslateService } from '@ngx-translate/core'; import { AddonModBookProvider } from './book'; /** * Handler to treat links to book list page. */ @Injectable() export class AddonModBookListLinkHandler extends CoreContentLinksModuleListHandler { name = 'AddonModBookListLinkHandler'; constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, protected bookProvider: AddonModBookProvider) { super(linkHelper, translate, 'AddonModBook', 'book'); } /** * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * * @param siteId The site ID. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { return this.bookProvider.isPluginEnabled(); } }
FMCorz/moodlemobile2
src/addon/mod/book/providers/list-link-handler.ts
TypeScript
apache-2.0
1,951
// Copyright 2008 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview The default renderer for a goog.dom.DimensionPicker. A * dimension picker allows the user to visually select a row and column count. * It looks like a palette but in order to minimize DOM load it is rendered. * using CSS background tiling instead of as a grid of nodes. * * @author robbyw@google.com (Robby Walker) */ goog.provide('goog.ui.DimensionPickerRenderer'); goog.require('goog.a11y.aria.Announcer'); goog.require('goog.a11y.aria.LivePriority'); goog.require('goog.dom'); goog.require('goog.dom.TagName'); goog.require('goog.i18n.bidi'); goog.require('goog.style'); goog.require('goog.ui.ControlRenderer'); goog.require('goog.userAgent'); goog.forwardDeclare('goog.ui.DimensionPicker'); /** * Default renderer for {@link goog.ui.DimensionPicker}s. Renders the * palette as two divs, one with the un-highlighted background, and one with the * highlighted background. * * @constructor * @extends {goog.ui.ControlRenderer} */ goog.ui.DimensionPickerRenderer = function() { goog.ui.ControlRenderer.call(this); /** @private {goog.a11y.aria.Announcer} */ this.announcer_ = new goog.a11y.aria.Announcer(); }; goog.inherits(goog.ui.DimensionPickerRenderer, goog.ui.ControlRenderer); goog.addSingletonGetter(goog.ui.DimensionPickerRenderer); /** * Default CSS class to be applied to the root element of components rendered * by this renderer. * @type {string} */ goog.ui.DimensionPickerRenderer.CSS_CLASS = goog.getCssName('goog-dimension-picker'); /** * Return the underlying div for the given outer element. * @param {Element} element The root element. * @return {Element} The underlying div. * @private */ goog.ui.DimensionPickerRenderer.prototype.getUnderlyingDiv_ = function( element) { return /** @type {Element} */ (element.firstChild.childNodes[1]); }; /** * Return the highlight div for the given outer element. * @param {Element} element The root element. * @return {Element} The highlight div. * @private */ goog.ui.DimensionPickerRenderer.prototype.getHighlightDiv_ = function(element) { return /** @type {Element} */ (element.firstChild.lastChild); }; /** * Return the status message div for the given outer element. * @param {Element} element The root element. * @return {Element} The status message div. * @private */ goog.ui.DimensionPickerRenderer.prototype.getStatusDiv_ = function(element) { return /** @type {Element} */ (element.lastChild); }; /** * Return the invisible mouse catching div for the given outer element. * @param {Element} element The root element. * @return {Element} The invisible mouse catching div. * @private */ goog.ui.DimensionPickerRenderer.prototype.getMouseCatcher_ = function(element) { return /** @type {Element} */ (element.firstChild.firstChild); }; /** * Overrides {@link goog.ui.ControlRenderer#canDecorate} to allow decorating * empty DIVs only. * @param {Element} element The element to check. * @return {boolean} Whether if the element is an empty div. * @override */ goog.ui.DimensionPickerRenderer.prototype.canDecorate = function(element) { return element.tagName == goog.dom.TagName.DIV && !element.firstChild; }; /** * Overrides {@link goog.ui.ControlRenderer#decorate} to decorate empty DIVs. * @param {goog.ui.Control} control goog.ui.DimensionPicker to decorate. * @param {Element} element The element to decorate. * @return {Element} The decorated element. * @override */ goog.ui.DimensionPickerRenderer.prototype.decorate = function( control, element) { var palette = /** @type {goog.ui.DimensionPicker} */ (control); goog.ui.DimensionPickerRenderer.superClass_.decorate.call( this, palette, element); this.addElementContents_(palette, element); this.updateSize(palette, element); return element; }; /** * Scales various elements in order to update the palette's size. * @param {goog.ui.DimensionPicker} palette The palette object. * @param {Element} element The element to set the style of. */ goog.ui.DimensionPickerRenderer.prototype.updateSize = function( palette, element) { var size = palette.getSize(); element.style.width = size.width + 'em'; var underlyingDiv = this.getUnderlyingDiv_(element); underlyingDiv.style.width = size.width + 'em'; underlyingDiv.style.height = size.height + 'em'; if (palette.isRightToLeft()) { this.adjustParentDirection_(palette, element); } }; /** * Adds the appropriate content elements to the given outer DIV. * @param {goog.ui.DimensionPicker} palette The palette object. * @param {Element} element The element to decorate. * @private */ goog.ui.DimensionPickerRenderer.prototype.addElementContents_ = function( palette, element) { // First we create a single div containing three stacked divs. The bottom div // catches mouse events. We can't use document level mouse move detection as // we could lose events to iframes. This is especially important in Firefox 2 // in which TrogEdit creates iframes. The middle div uses a css tiled // background image to represent deselected tiles. The top div uses a // different css tiled background image to represent selected tiles. var mouseCatcherDiv = palette.getDomHelper().createDom( goog.dom.TagName.DIV, goog.getCssName(this.getCssClass(), 'mousecatcher')); var unhighlightedDiv = palette.getDomHelper().createDom(goog.dom.TagName.DIV, { 'class': goog.getCssName(this.getCssClass(), 'unhighlighted'), 'style': 'width:100%;height:100%' }); var highlightedDiv = palette.getDomHelper().createDom( goog.dom.TagName.DIV, goog.getCssName(this.getCssClass(), 'highlighted')); element.appendChild( palette.getDomHelper().createDom( goog.dom.TagName.DIV, { 'style': 'width:100%;height:100%;touch-action:none;' }, mouseCatcherDiv, unhighlightedDiv, highlightedDiv)); // Lastly we add a div to store the text version of the current state. element.appendChild( palette.getDomHelper().createDom( goog.dom.TagName.DIV, goog.getCssName(this.getCssClass(), 'status'))); }; /** * Creates a div and adds the appropriate contents to it. * @param {goog.ui.Control} control Picker to render. * @return {!Element} Root element for the palette. * @override */ goog.ui.DimensionPickerRenderer.prototype.createDom = function(control) { var palette = /** @type {goog.ui.DimensionPicker} */ (control); var classNames = this.getClassNames(palette); // Hide the element from screen readers so they don't announce "1 of 1" for // the perceived number of items in the palette. var element = palette.getDomHelper().createDom( goog.dom.TagName.DIV, {'class': classNames ? classNames.join(' ') : '', 'aria-hidden': 'true'}); this.addElementContents_(palette, element); this.updateSize(palette, element); return element; }; /** * Initializes the control's DOM when the control enters the document. Called * from {@link goog.ui.Control#enterDocument}. * @param {goog.ui.Control} control Palette whose DOM is to be * initialized as it enters the document. * @override */ goog.ui.DimensionPickerRenderer.prototype.initializeDom = function(control) { var palette = /** @type {goog.ui.DimensionPicker} */ (control); goog.ui.DimensionPickerRenderer.superClass_.initializeDom.call(this, palette); // Make the displayed highlighted size match the dimension picker's value. var highlightedSize = palette.getValue(); this.setHighlightedSize( palette, highlightedSize.width, highlightedSize.height); this.positionMouseCatcher(palette); }; /** * Get the element to listen for mouse move events on. * @param {goog.ui.DimensionPicker} palette The palette to listen on. * @return {Element} The element to listen for mouse move events on. */ goog.ui.DimensionPickerRenderer.prototype.getMouseMoveElement = function( palette) { return /** @type {Element} */ (palette.getElement().firstChild); }; /** * Returns the x offset in to the grid for the given mouse x position. * @param {goog.ui.DimensionPicker} palette The table size palette. * @param {number} x The mouse event x position. * @return {number} The x offset in to the grid. */ goog.ui.DimensionPickerRenderer.prototype.getGridOffsetX = function( palette, x) { // TODO(robbyw): Don't rely on magic 18 - measure each palette's em size. return Math.min(palette.maxColumns, Math.ceil(x / 18)); }; /** * Returns the y offset in to the grid for the given mouse y position. * @param {goog.ui.DimensionPicker} palette The table size palette. * @param {number} y The mouse event y position. * @return {number} The y offset in to the grid. */ goog.ui.DimensionPickerRenderer.prototype.getGridOffsetY = function( palette, y) { return Math.min(palette.maxRows, Math.ceil(y / 18)); }; /** * Sets the highlighted size. Does nothing if the palette hasn't been rendered. * @param {goog.ui.DimensionPicker} palette The table size palette. * @param {number} columns The number of columns to highlight. * @param {number} rows The number of rows to highlight. */ goog.ui.DimensionPickerRenderer.prototype.setHighlightedSize = function( palette, columns, rows) { var element = palette.getElement(); // Can't update anything if DimensionPicker hasn't been rendered. if (!element) { return; } // Style the highlight div. var style = this.getHighlightDiv_(element).style; style.width = columns + 'em'; style.height = rows + 'em'; // Explicitly set style.right so the element grows to the left when increase // in width. if (palette.isRightToLeft()) { style.right = '0'; } /** * @desc The dimension of the columns and rows currently selected in the * dimension picker, as text that can be spoken by a screen reader. */ var MSG_DIMENSION_PICKER_HIGHLIGHTED_DIMENSIONS = goog.getMsg( '{$numCols} by {$numRows}', {'numCols': String(columns), 'numRows': String(rows)}); this.announcer_.say( MSG_DIMENSION_PICKER_HIGHLIGHTED_DIMENSIONS, goog.a11y.aria.LivePriority.ASSERTIVE); // Update the size text. goog.dom.setTextContent( this.getStatusDiv_(element), goog.i18n.bidi.enforceLtrInText(columns + ' x ' + rows)); }; /** * Position the mouse catcher such that it receives mouse events past the * selectedsize up to the maximum size. Takes care to not introduce scrollbars. * Should be called on enter document and when the window changes size. * @param {goog.ui.DimensionPicker} palette The table size palette. */ goog.ui.DimensionPickerRenderer.prototype.positionMouseCatcher = function( palette) { var mouseCatcher = this.getMouseCatcher_(palette.getElement()); var doc = goog.dom.getOwnerDocument(mouseCatcher); var body = doc.body; var position = goog.style.getRelativePosition(mouseCatcher, body); // Hide the mouse catcher so it doesn't affect the body's scroll size. mouseCatcher.style.display = 'none'; // Compute the maximum size the catcher can be without introducing scrolling. var xAvailableEm = (palette.isRightToLeft() && position.x > 0) ? Math.floor(position.x / 18) : Math.floor((body.scrollWidth - position.x) / 18); // Computing available height is more complicated - we need to check the // window's inner height. var height; if (goog.userAgent.IE) { // Offset 20px to make up for scrollbar size. height = goog.style.getClientViewportElement(body).scrollHeight - 20; } else { var win = goog.dom.getWindow(doc); // Offset 20px to make up for scrollbar size. height = Math.max(win.innerHeight, body.scrollHeight) - 20; } var yAvailableEm = Math.floor((height - position.y) / 18); // Resize and display the mouse catcher. mouseCatcher.style.width = Math.min(palette.maxColumns, xAvailableEm) + 'em'; mouseCatcher.style.height = Math.min(palette.maxRows, yAvailableEm) + 'em'; mouseCatcher.style.display = ''; // Explicitly set style.right so the mouse catcher is positioned on the left // side instead of right. if (palette.isRightToLeft()) { mouseCatcher.style.right = '0'; } }; /** * Returns the CSS class to be applied to the root element of components * rendered using this renderer. * @return {string} Renderer-specific CSS class. * @override */ goog.ui.DimensionPickerRenderer.prototype.getCssClass = function() { return goog.ui.DimensionPickerRenderer.CSS_CLASS; }; /** * This function adjusts the positioning from 'left' and 'top' to 'right' and * 'top' as appropriate for RTL control. This is so when the dimensionpicker * grow in width, the containing element grow to the left instead of right. * This won't be necessary if goog.ui.SubMenu rendering code would position RTL * control with 'right' and 'top'. * @private * * @param {goog.ui.DimensionPicker} palette The palette object. * @param {Element} element The palette's element. */ goog.ui.DimensionPickerRenderer.prototype.adjustParentDirection_ = function( palette, element) { var parent = palette.getParent(); if (parent) { var parentElement = parent.getElement(); // Anchors the containing element to the right so it grows to the left // when it increase in width. var right = goog.style.getStyle(parentElement, 'right'); if (right == '') { var parentPos = goog.style.getPosition(parentElement); var parentSize = goog.style.getSize(parentElement); if (parentSize.width != 0 && parentPos.x != 0) { var visibleRect = goog.style.getBounds(goog.style.getClientViewportElement()); var visibleWidth = visibleRect.width; right = visibleWidth - parentPos.x - parentSize.width; goog.style.setStyle(parentElement, 'right', right + 'px'); } } // When a table is inserted, the containing elemet's position is // recalculated the next time it shows, set left back to '' to prevent // extra white space on the left. var left = goog.style.getStyle(parentElement, 'left'); if (left != '') { goog.style.setStyle(parentElement, 'left', ''); } } else { goog.style.setStyle(element, 'right', '0px'); } };
teppeis/closure-library
closure/goog/ui/dimensionpickerrenderer.js
JavaScript
apache-2.0
14,821
/* * Copyright 2012 Timothy Lin <lzh9102@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package zxinggui.generator; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SpringLayout; import java.lang.String; public class PlainTextGenerator implements GeneratorInterface { private JPanel panel = new JPanel(); private JTextArea textarea = new JTextArea(); static final String NORTH = SpringLayout.NORTH; static final String SOUTH = SpringLayout.SOUTH; static final String EAST = SpringLayout.EAST; static final String WEST = SpringLayout.WEST; public PlainTextGenerator() { SpringLayout layout = new SpringLayout(); JLabel label = new JLabel("Text: "); JScrollPane scrollPane = new JScrollPane(textarea); textarea.setLineWrap(true); panel.setLayout(layout); panel.add(label); panel.add(scrollPane); layout.putConstraint(NORTH, label, 5, NORTH, panel); layout.putConstraint(WEST, label, 5, WEST, panel); layout.putConstraint(NORTH, scrollPane, 5, SOUTH, label); layout.putConstraint(SOUTH, scrollPane, -5, SOUTH, panel); layout.putConstraint(EAST, scrollPane, -5, EAST, panel); layout.putConstraint(WEST, scrollPane, 5, WEST, panel); } @Override public JPanel getPanel() { return panel; } @Override public String getName() { return "Plain Text"; } @Override public String getText() throws GeneratorException { String text = textarea.getText(); if (text.isEmpty()) throw new GeneratorException("Text cannot be empty.", textarea); return text; } @Override public void setFocus() { textarea.requestFocusInWindow(); } @Override public int getParsingPriority() { return 0; // always fallback to plain text } @Override public boolean parseText(String text, boolean write) { if (text.isEmpty()) return false; if (write) textarea.setText(text); return true; } }
adrianommelo/qrcode-desktop
src/zxinggui/generator/PlainTextGenerator.java
Java
apache-2.0
2,466
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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.elasticsearch.action.admin.cluster.allocation; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.routing.allocation.decider.Decision; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.shard.ShardId; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.Map; /** * A {@code ClusterAllocationExplanation} is an explanation of why a shard may or may not be allocated to nodes. It also includes weights * for where the shard is likely to be assigned. It is an immutable class */ public final class ClusterAllocationExplanation implements ToXContent, Writeable<ClusterAllocationExplanation> { private final ShardId shard; private final boolean primary; private final String assignedNodeId; private final Map<DiscoveryNode, Decision> nodeToDecision; private final Map<DiscoveryNode, Float> nodeWeights; private final UnassignedInfo unassignedInfo; private final long remainingDelayNanos; public ClusterAllocationExplanation(StreamInput in) throws IOException { this.shard = ShardId.readShardId(in); this.primary = in.readBoolean(); this.assignedNodeId = in.readOptionalString(); this.unassignedInfo = in.readOptionalWriteable(UnassignedInfo::new); Map<DiscoveryNode, Decision> ntd = null; int size = in.readVInt(); ntd = new HashMap<>(size); for (int i = 0; i < size; i++) { DiscoveryNode dn = new DiscoveryNode(in); Decision decision = Decision.readFrom(in); ntd.put(dn, decision); } this.nodeToDecision = ntd; Map<DiscoveryNode, Float> ntw = null; size = in.readVInt(); ntw = new HashMap<>(size); for (int i = 0; i < size; i++) { DiscoveryNode dn = new DiscoveryNode(in); float weight = in.readFloat(); ntw.put(dn, weight); } this.nodeWeights = ntw; remainingDelayNanos = in.readVLong(); } public ClusterAllocationExplanation(ShardId shard, boolean primary, @Nullable String assignedNodeId, UnassignedInfo unassignedInfo, Map<DiscoveryNode, Decision> nodeToDecision, Map<DiscoveryNode, Float> nodeWeights, long remainingDelayNanos) { this.shard = shard; this.primary = primary; this.assignedNodeId = assignedNodeId; this.unassignedInfo = unassignedInfo; this.nodeToDecision = nodeToDecision == null ? Collections.emptyMap() : nodeToDecision; this.nodeWeights = nodeWeights == null ? Collections.emptyMap() : nodeWeights; this.remainingDelayNanos = remainingDelayNanos; } public ShardId getShard() { return this.shard; } public boolean isPrimary() { return this.primary; } /** Return turn if the shard is assigned to a node */ public boolean isAssigned() { return this.assignedNodeId != null; } /** Return the assigned node id or null if not assigned */ @Nullable public String getAssignedNodeId() { return this.assignedNodeId; } /** Return the unassigned info for the shard or null if the shard is assigned */ @Nullable public UnassignedInfo getUnassignedInfo() { return this.unassignedInfo; } /** Return a map of node to decision for shard allocation */ public Map<DiscoveryNode, Decision> getNodeDecisions() { return this.nodeToDecision; } /** * Return a map of node to balancer "weight" for allocation. Higher weights mean the balancer wants to allocated the shard to that node * more */ public Map<DiscoveryNode, Float> getNodeWeights() { return this.nodeWeights; } /** Return the remaining allocation delay for this shard in nanoseconds */ public long getRemainingDelayNanos() { return this.remainingDelayNanos; } public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); { builder.startObject("shard"); { builder.field("index", shard.getIndexName()); builder.field("index_uuid", shard.getIndex().getUUID()); builder.field("id", shard.getId()); builder.field("primary", primary); } builder.endObject(); // end shard builder.field("assigned", this.assignedNodeId != null); // If assigned, show the node id of the node it's assigned to if (assignedNodeId != null) { builder.field("assigned_node_id", this.assignedNodeId); } // If we have unassigned info, show that if (unassignedInfo != null) { unassignedInfo.toXContent(builder, params); long delay = unassignedInfo.getLastComputedLeftDelayNanos(); builder.field("allocation_delay", TimeValue.timeValueNanos(delay)); builder.field("allocation_delay_ms", TimeValue.timeValueNanos(delay).millis()); builder.field("remaining_delay", TimeValue.timeValueNanos(remainingDelayNanos)); builder.field("remaining_delay_ms", TimeValue.timeValueNanos(remainingDelayNanos).millis()); } builder.startObject("nodes"); for (Map.Entry<DiscoveryNode, Float> entry : nodeWeights.entrySet()) { DiscoveryNode node = entry.getKey(); builder.startObject(node.getId()); { builder.field("node_name", node.getName()); builder.startObject("node_attributes"); { for (Map.Entry<String, String> attrEntry : node.getAttributes().entrySet()) { builder.field(attrEntry.getKey(), attrEntry.getValue()); } } builder.endObject(); // end attributes Decision d = nodeToDecision.get(node); if (node.getId().equals(assignedNodeId)) { builder.field("final_decision", "CURRENTLY_ASSIGNED"); } else { builder.field("final_decision", d.type().toString()); } builder.field("weight", entry.getValue()); d.toXContent(builder, params); } builder.endObject(); // end node <uuid> } builder.endObject(); // end nodes } builder.endObject(); // end wrapping object return builder; } @Override public ClusterAllocationExplanation readFrom(StreamInput in) throws IOException { return new ClusterAllocationExplanation(in); } @Override public void writeTo(StreamOutput out) throws IOException { this.getShard().writeTo(out); out.writeBoolean(this.isPrimary()); out.writeOptionalString(this.getAssignedNodeId()); out.writeOptionalWriteable(this.getUnassignedInfo()); Map<DiscoveryNode, Decision> ntd = this.getNodeDecisions(); out.writeVInt(ntd.size()); for (Map.Entry<DiscoveryNode, Decision> entry : ntd.entrySet()) { entry.getKey().writeTo(out); Decision.writeTo(entry.getValue(), out); } Map<DiscoveryNode, Float> ntw = this.getNodeWeights(); out.writeVInt(ntw.size()); for (Map.Entry<DiscoveryNode, Float> entry : ntw.entrySet()) { entry.getKey().writeTo(out); out.writeFloat(entry.getValue()); } out.writeVLong(remainingDelayNanos); } }
mmaracic/elasticsearch
core/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplanation.java
Java
apache-2.0
8,925
/* Derby - Class com.pivotal.gemfirexd.internal.impl.sql.compile.LOBTypeCompiler 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. */ /* * Changes for GemFireXD distributed data platform (some marked by "GemStone changes") * * Portions Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. See accompanying * LICENSE file. */ package com.pivotal.gemfirexd.internal.impl.sql.compile; import java.sql.Types; import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.reference.ClassName; import com.pivotal.gemfirexd.internal.iapi.reference.JDBC20Translation; import com.pivotal.gemfirexd.internal.iapi.services.loader.ClassFactory; import com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager; import com.pivotal.gemfirexd.internal.iapi.sql.compile.TypeCompiler; import com.pivotal.gemfirexd.internal.iapi.types.BitDataValue; import com.pivotal.gemfirexd.internal.iapi.types.DataTypeDescriptor; import com.pivotal.gemfirexd.internal.iapi.types.DataValueFactory; import com.pivotal.gemfirexd.internal.iapi.types.TypeId; import com.pivotal.gemfirexd.internal.shared.common.StoredFormatIds; /** * This class implements TypeCompiler for the SQL LOB types. * */ public class LOBTypeCompiler extends BaseTypeCompiler { /** * Tell whether this type (LOB) can be converted to the given type. * * @see TypeCompiler#convertible */ public boolean convertible(TypeId otherType, boolean forDataTypeFunction) { // GemStone changes BEGIN final int otherJDBCTypeId = otherType.getJDBCTypeId(); return otherJDBCTypeId == Types.BLOB || otherJDBCTypeId == Types.BINARY || otherJDBCTypeId == Types.VARBINARY; /* (original code) return (otherType.isBlobTypeId()); */ // GemStone changes END } /** * Tell whether this type (LOB) is compatible with the given type. * * @param otherType The TypeId of the other type. */ public boolean compatible(TypeId otherType) { return convertible(otherType,false); } /** * Tell whether this type (LOB) can be stored into from the given type. * * @param otherType The TypeId of the other type. * @param cf A ClassFactory */ public boolean storable(TypeId otherType, ClassFactory cf) { // GemStone changes BEGIN final int otherJDBCTypeId = otherType.getJDBCTypeId(); return otherJDBCTypeId == Types.BLOB || otherJDBCTypeId == Types.BINARY || otherJDBCTypeId == Types.VARBINARY; /* (original code) // no automatic conversions at store time return (otherType.isBlobTypeId()); */ // GemStone changes END } /** @see TypeCompiler#interfaceName */ public String interfaceName() { return ClassName.BitDataValue; } /** * @see TypeCompiler#getCorrespondingPrimitiveTypeName */ public String getCorrespondingPrimitiveTypeName() { int formatId = getStoredFormatIdFromTypeId(); switch (formatId) { case StoredFormatIds.BLOB_TYPE_ID: return "java.sql.Blob"; default: if (SanityManager.DEBUG) SanityManager.THROWASSERT("unexpected formatId in getCorrespondingPrimitiveTypeName() - " + formatId); return null; } } /** * @see TypeCompiler#getCastToCharWidth */ public int getCastToCharWidth(DataTypeDescriptor dts) { return dts.getMaximumWidth(); } String nullMethodName() { int formatId = getStoredFormatIdFromTypeId(); switch (formatId) { case StoredFormatIds.BLOB_TYPE_ID: return "getNullBlob"; default: if (SanityManager.DEBUG) SanityManager.THROWASSERT("unexpected formatId in nullMethodName() - " + formatId); return null; } } String dataValueMethodName() { int formatId = getStoredFormatIdFromTypeId(); switch (formatId) { case StoredFormatIds.BLOB_TYPE_ID: return "getBlobDataValue"; default: if (SanityManager.DEBUG) SanityManager.THROWASSERT("unexpected formatId in dataValueMethodName() - " + formatId); return null; } } }
papicella/snappy-store
gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/compile/LOBTypeCompiler.java
Java
apache-2.0
5,995
/* * 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.syncope.core.provisioning.java.propagation; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.common.lib.Attr; import org.apache.syncope.common.lib.request.AbstractPatchItem; import org.apache.syncope.common.lib.request.UserUR; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.ResourceOperation; import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO; import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO; import org.apache.syncope.core.persistence.api.entity.Any; import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory; import org.apache.syncope.core.persistence.api.entity.EntityFactory; import org.apache.syncope.core.persistence.api.entity.Realm; import org.apache.syncope.core.persistence.api.entity.VirSchema; import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource; import org.apache.syncope.core.persistence.api.entity.resource.Item; import org.apache.syncope.core.persistence.api.entity.resource.OrgUnit; import org.apache.syncope.core.persistence.api.entity.resource.Provision; import org.apache.syncope.core.persistence.api.entity.user.LinkedAccount; import org.apache.syncope.core.persistence.api.entity.user.User; import org.apache.syncope.core.provisioning.api.DerAttrHandler; import org.apache.syncope.core.provisioning.api.MappingManager; import org.apache.syncope.core.provisioning.api.PropagationByResource; import org.apache.syncope.core.provisioning.api.propagation.PropagationManager; import org.apache.syncope.core.provisioning.api.UserWorkflowResult; import org.apache.syncope.core.provisioning.api.jexl.JexlUtils; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor; import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskInfo; import org.apache.syncope.core.provisioning.api.serialization.POJOHelper; import org.apache.syncope.core.provisioning.java.utils.ConnObjectUtils; import org.apache.syncope.core.provisioning.java.utils.MappingUtils; import org.identityconnectors.framework.common.objects.Attribute; import org.identityconnectors.framework.common.objects.AttributeBuilder; import org.identityconnectors.framework.common.objects.AttributeUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; /** * Manage the data propagation to external resources. */ @Transactional(rollbackFor = { Throwable.class }) public class DefaultPropagationManager implements PropagationManager { protected static final Logger LOG = LoggerFactory.getLogger(PropagationManager.class); protected final VirSchemaDAO virSchemaDAO; protected final ExternalResourceDAO resourceDAO; protected final EntityFactory entityFactory; protected final ConnObjectUtils connObjectUtils; protected final MappingManager mappingManager; protected final DerAttrHandler derAttrHandler; protected final AnyUtilsFactory anyUtilsFactory; public DefaultPropagationManager( final VirSchemaDAO virSchemaDAO, final ExternalResourceDAO resourceDAO, final EntityFactory entityFactory, final ConnObjectUtils connObjectUtils, final MappingManager mappingManager, final DerAttrHandler derAttrHandler, final AnyUtilsFactory anyUtilsFactory) { this.virSchemaDAO = virSchemaDAO; this.resourceDAO = resourceDAO; this.entityFactory = entityFactory; this.connObjectUtils = connObjectUtils; this.mappingManager = mappingManager; this.derAttrHandler = derAttrHandler; this.anyUtilsFactory = anyUtilsFactory; } @Override public List<PropagationTaskInfo> getCreateTasks( final AnyTypeKind kind, final String key, final Boolean enable, final PropagationByResource<String> propByRes, final Collection<Attr> vAttrs, final Collection<String> noPropResourceKeys) { return getCreateTasks( anyUtilsFactory.getInstance(kind).dao().authFind(key), null, enable, propByRes, null, vAttrs, noPropResourceKeys); } @Override public List<PropagationTaskInfo> getUserCreateTasks( final String key, final String password, final Boolean enable, final PropagationByResource<String> propByRes, final PropagationByResource<Pair<String, String>> propByLinkedAccount, final Collection<Attr> vAttrs, final Collection<String> noPropResourceKeys) { return getCreateTasks( anyUtilsFactory.getInstance(AnyTypeKind.USER).dao().authFind(key), password, enable, propByRes, propByLinkedAccount, vAttrs, noPropResourceKeys); } protected List<PropagationTaskInfo> getCreateTasks( final Any<?> any, final String password, final Boolean enable, final PropagationByResource<String> propByRes, final PropagationByResource<Pair<String, String>> propByLinkedAccount, final Collection<Attr> vAttrs, final Collection<String> noPropResourceKeys) { if ((propByRes == null || propByRes.isEmpty()) && (propByLinkedAccount == null || propByLinkedAccount.isEmpty())) { return List.of(); } if (noPropResourceKeys != null) { if (propByRes != null) { propByRes.get(ResourceOperation.CREATE).removeAll(noPropResourceKeys); } if (propByLinkedAccount != null) { propByLinkedAccount.get(ResourceOperation.CREATE). removeIf(account -> noPropResourceKeys.contains(account.getLeft())); } } return createTasks(any, password, true, enable, propByRes, propByLinkedAccount, vAttrs); } @Override public List<PropagationTaskInfo> getUpdateTasks( final AnyTypeKind kind, final String key, final boolean changePwd, final Boolean enable, final PropagationByResource<String> propByRes, final PropagationByResource<Pair<String, String>> propByLinkedAccount, final Collection<Attr> vAttrs, final Collection<String> noPropResourceKeys) { return getUpdateTasks( anyUtilsFactory.getInstance(kind).dao().authFind(key), null, changePwd, enable, propByRes, propByLinkedAccount, vAttrs, noPropResourceKeys); } @Override public List<PropagationTaskInfo> getUserUpdateTasks( final UserWorkflowResult<Pair<UserUR, Boolean>> wfResult, final boolean changePwd, final Collection<String> noPropResourceKeys) { return getUpdateTasks( anyUtilsFactory.getInstance(AnyTypeKind.USER).dao().authFind(wfResult.getResult().getLeft().getKey()), wfResult.getResult().getLeft().getPassword() == null ? null : wfResult.getResult().getLeft().getPassword().getValue(), changePwd, wfResult.getResult().getRight(), wfResult.getPropByRes(), wfResult.getPropByLinkedAccount(), wfResult.getResult().getLeft().getVirAttrs(), noPropResourceKeys); } @Override public List<PropagationTaskInfo> getUserUpdateTasks(final UserWorkflowResult<Pair<UserUR, Boolean>> wfResult) { UserUR userUR = wfResult.getResult().getLeft(); // Propagate password update only to requested resources List<PropagationTaskInfo> tasks; if (userUR.getPassword() == null) { // a. no specific password propagation request: generate propagation tasks for any resource associated tasks = getUserUpdateTasks(wfResult, false, null); } else { tasks = new ArrayList<>(); // b. generate the propagation task list in two phases: first the ones containing password, // then the rest (with no password) UserWorkflowResult<Pair<UserUR, Boolean>> pwdWFResult = new UserWorkflowResult<>( wfResult.getResult(), new PropagationByResource<>(), wfResult.getPropByLinkedAccount(), wfResult.getPerformedTasks()); Set<String> pwdResourceNames = new HashSet<>(userUR.getPassword().getResources()); Collection<String> allResourceNames = anyUtilsFactory.getInstance(AnyTypeKind.USER). dao().findAllResourceKeys(userUR.getKey()); pwdResourceNames.retainAll(allResourceNames); pwdWFResult.getPropByRes().addAll(ResourceOperation.UPDATE, pwdResourceNames); if (!pwdWFResult.getPropByRes().isEmpty()) { Set<String> toBeExcluded = new HashSet<>(allResourceNames); toBeExcluded.addAll(userUR.getResources().stream(). map(AbstractPatchItem::getValue).collect(Collectors.toList())); toBeExcluded.removeAll(pwdResourceNames); tasks.addAll(getUserUpdateTasks(pwdWFResult, true, toBeExcluded)); } UserWorkflowResult<Pair<UserUR, Boolean>> noPwdWFResult = new UserWorkflowResult<>( wfResult.getResult(), new PropagationByResource<>(), new PropagationByResource<>(), wfResult.getPerformedTasks()); noPwdWFResult.getPropByRes().merge(wfResult.getPropByRes()); noPwdWFResult.getPropByRes().removeAll(pwdResourceNames); noPwdWFResult.getPropByRes().purge(); if (!noPwdWFResult.getPropByRes().isEmpty()) { tasks.addAll(getUserUpdateTasks(noPwdWFResult, false, pwdResourceNames)); } tasks = tasks.stream().distinct().collect(Collectors.toList()); } return tasks; } protected List<PropagationTaskInfo> getUpdateTasks( final Any<?> any, final String password, final boolean changePwd, final Boolean enable, final PropagationByResource<String> propByRes, final PropagationByResource<Pair<String, String>> propByLinkedAccount, final Collection<Attr> vAttrs, final Collection<String> noPropResourceKeys) { if (noPropResourceKeys != null) { if (propByRes != null) { propByRes.removeAll(noPropResourceKeys); } if (propByLinkedAccount != null) { propByLinkedAccount.get(ResourceOperation.CREATE). removeIf(account -> noPropResourceKeys.contains(account.getLeft())); propByLinkedAccount.get(ResourceOperation.UPDATE). removeIf(account -> noPropResourceKeys.contains(account.getLeft())); propByLinkedAccount.get(ResourceOperation.DELETE). removeIf(account -> noPropResourceKeys.contains(account.getLeft())); } } return createTasks( any, password, changePwd, enable, Optional.ofNullable(propByRes).orElseGet(PropagationByResource::new), propByLinkedAccount, vAttrs); } @Override public List<PropagationTaskInfo> getDeleteTasks( final AnyTypeKind kind, final String key, final PropagationByResource<String> propByRes, final PropagationByResource<Pair<String, String>> propByLinkedAccount, final Collection<String> noPropResourceKeys) { return getDeleteTasks( anyUtilsFactory.getInstance(kind).dao().authFind(key), propByRes, propByLinkedAccount, noPropResourceKeys); } protected List<PropagationTaskInfo> getDeleteTasks( final Any<?> any, final PropagationByResource<String> propByRes, final PropagationByResource<Pair<String, String>> propByLinkedAccount, final Collection<String> noPropResourceKeys) { PropagationByResource<String> localPropByRes = new PropagationByResource<>(); if (propByRes == null || propByRes.isEmpty()) { localPropByRes.addAll( ResourceOperation.DELETE, anyUtilsFactory.getInstance(any).dao().findAllResourceKeys(any.getKey())); } else { localPropByRes.merge(propByRes); } if (noPropResourceKeys != null) { localPropByRes.removeAll(noPropResourceKeys); if (propByLinkedAccount != null) { propByLinkedAccount.get(ResourceOperation.CREATE). removeIf(account -> noPropResourceKeys.contains(account.getLeft())); propByLinkedAccount.get(ResourceOperation.UPDATE). removeIf(account -> noPropResourceKeys.contains(account.getLeft())); propByLinkedAccount.get(ResourceOperation.DELETE). removeIf(account -> noPropResourceKeys.contains(account.getLeft())); } } return createTasks(any, null, false, false, localPropByRes, propByLinkedAccount, null); } @Override public PropagationTaskInfo newTask( final DerAttrHandler derAttrHandler, final Any<?> any, final ExternalResource resource, final ResourceOperation operation, final Provision provision, final Stream<? extends Item> mappingItems, final Pair<String, Set<Attribute>> preparedAttrs) { PropagationTaskInfo task = new PropagationTaskInfo(resource); task.setObjectClassName(provision.getObjectClass().getObjectClassValue()); task.setAnyTypeKind(any.getType().getKind()); task.setAnyType(any.getType().getKey()); task.setEntityKey(any.getKey()); task.setOperation(operation); task.setConnObjectKey(preparedAttrs.getLeft()); // Check if any of mandatory attributes (in the mapping) is missing or not received any value: // if so, add special attributes that will be evaluated by PropagationTaskExecutor List<String> mandatoryMissing = new ArrayList<>(); List<String> mandatoryNullOrEmpty = new ArrayList<>(); mappingItems.filter(item -> (!item.isConnObjectKey() && JexlUtils.evaluateMandatoryCondition(item.getMandatoryCondition(), any, derAttrHandler))). forEach(item -> { Attribute attr = AttributeUtil.find(item.getExtAttrName(), preparedAttrs.getRight()); if (attr == null) { mandatoryMissing.add(item.getExtAttrName()); } else if (CollectionUtils.isEmpty(attr.getValue())) { mandatoryNullOrEmpty.add(item.getExtAttrName()); } }); if (!mandatoryMissing.isEmpty()) { preparedAttrs.getRight().add(AttributeBuilder.build( PropagationTaskExecutor.MANDATORY_MISSING_ATTR_NAME, mandatoryMissing)); } if (!mandatoryNullOrEmpty.isEmpty()) { preparedAttrs.getRight().add(AttributeBuilder.build( PropagationTaskExecutor.MANDATORY_NULL_OR_EMPTY_ATTR_NAME, mandatoryNullOrEmpty)); } task.setAttributes(POJOHelper.serialize(preparedAttrs.getRight())); return task; } /** * Create propagation tasks. * * @param any to be provisioned * @param password clear text password to be provisioned * @param changePwd whether password should be included for propagation attributes or not * @param enable whether user must be enabled or not * @param propByRes operation to be performed per resource * @param propByLinkedAccount operation to be performed on linked accounts * @param vAttrs virtual attributes to be set * @return list of propagation tasks created */ protected List<PropagationTaskInfo> createTasks( final Any<?> any, final String password, final boolean changePwd, final Boolean enable, final PropagationByResource<String> propByRes, final PropagationByResource<Pair<String, String>> propByLinkedAccount, final Collection<Attr> vAttrs) { LOG.debug("Provisioning {}:\n{}", any, propByRes); // Avoid duplicates - see javadoc propByRes.purge(); LOG.debug("After purge {}:\n{}", any, propByRes); // Virtual attributes Set<String> virtualResources = new HashSet<>(); virtualResources.addAll(propByRes.get(ResourceOperation.CREATE)); virtualResources.addAll(propByRes.get(ResourceOperation.UPDATE)); virtualResources.addAll(anyUtilsFactory.getInstance(any).dao().findAllResourceKeys(any.getKey())); Map<String, Set<Attribute>> vAttrMap = new HashMap<>(); if (vAttrs != null) { vAttrs.forEach(vAttr -> { VirSchema schema = virSchemaDAO.find(vAttr.getSchema()); if (schema == null) { LOG.warn("Ignoring invalid {} {}", VirSchema.class.getSimpleName(), vAttr.getSchema()); } else if (schema.isReadonly()) { LOG.warn("Ignoring read-only {} {}", VirSchema.class.getSimpleName(), vAttr.getSchema()); } else if (anyUtilsFactory.getInstance(any).dao(). findAllowedSchemas(any, VirSchema.class).contains(schema) && virtualResources.contains(schema.getProvision().getResource().getKey())) { Set<Attribute> values = vAttrMap.get(schema.getProvision().getResource().getKey()); if (values == null) { values = new HashSet<>(); vAttrMap.put(schema.getProvision().getResource().getKey(), values); } values.add(AttributeBuilder.build(schema.getExtAttrName(), vAttr.getValues())); if (!propByRes.contains(ResourceOperation.CREATE, schema.getProvision().getResource().getKey())) { propByRes.add(ResourceOperation.UPDATE, schema.getProvision().getResource().getKey()); } } else { LOG.warn("{} not owned by or {} not allowed for {}", schema.getProvision().getResource(), schema, any); } }); } LOG.debug("With virtual attributes {}:\n{}\n{}", any, propByRes, vAttrMap); List<PropagationTaskInfo> tasks = new ArrayList<>(); propByRes.asMap().forEach((resourceKey, operation) -> { ExternalResource resource = resourceDAO.find(resourceKey); Provision provision = Optional.ofNullable(resource). flatMap(externalResource -> externalResource.getProvision(any.getType())).orElse(null); Stream<? extends Item> mappingItems = provision == null ? Stream.empty() : MappingUtils.getPropagationItems(provision.getMapping().getItems().stream()); if (resource == null) { LOG.error("Invalid resource name specified: {}, ignoring...", resourceKey); } else if (provision == null) { LOG.error("No provision specified on resource {} for type {}, ignoring...", resource, any.getType()); } else if (provision.getMapping() == null || provision.getMapping().getItems().isEmpty()) { LOG.warn("Requesting propagation for {} but no propagation mapping provided for {}", any.getType(), resource); } else { Pair<String, Set<Attribute>> preparedAttrs = mappingManager.prepareAttrsFromAny(any, password, changePwd, enable, provision); if (vAttrMap.containsKey(resourceKey)) { preparedAttrs.getRight().addAll(vAttrMap.get(resourceKey)); } PropagationTaskInfo task = newTask( derAttrHandler, any, resource, operation, provision, mappingItems, preparedAttrs); task.setOldConnObjectKey(propByRes.getOldConnObjectKey(resourceKey)); tasks.add(task); LOG.debug("PropagationTask created: {}", task); } }); if (any instanceof User && propByLinkedAccount != null) { User user = (User) any; propByLinkedAccount.asMap().forEach((accountInfo, operation) -> { LinkedAccount account = user.getLinkedAccount(accountInfo.getLeft(), accountInfo.getRight()). orElse(null); if (account == null && operation == ResourceOperation.DELETE) { account = new DeletingLinkedAccount( user, resourceDAO.find(accountInfo.getLeft()), accountInfo.getRight()); } Provision provision = account == null || account.getResource() == null ? null : account.getResource().getProvision(AnyTypeKind.USER.name()).orElse(null); Stream<? extends Item> mappingItems = provision == null ? Stream.empty() : MappingUtils.getPropagationItems(provision.getMapping().getItems().stream()); if (account == null) { LOG.error("Invalid operation {} on deleted account {} on resource {}, ignoring...", operation, accountInfo.getRight(), accountInfo.getLeft()); } else if (account.getResource() == null) { LOG.error("Invalid resource name specified: {}, ignoring...", accountInfo.getLeft()); } else if (provision == null) { LOG.error("No provision specified on resource {} for type {}, ignoring...", account.getResource(), AnyTypeKind.USER.name()); } else if (provision.getMapping() == null || provision.getMapping().getItems().isEmpty()) { LOG.warn("Requesting propagation for {} but no propagation mapping provided for {}", AnyTypeKind.USER.name(), account.getResource()); } else { PropagationTaskInfo accountTask = newTask( derAttrHandler, user, account.getResource(), operation, provision, mappingItems, Pair.of(account.getConnObjectKeyValue(), mappingManager.prepareAttrsFromLinkedAccount( user, account, password, true, provision))); tasks.add(accountTask); LOG.debug("PropagationTask created for Linked Account {}: {}", account.getConnObjectKeyValue(), accountTask); } }); } return tasks; } @Override public List<PropagationTaskInfo> createTasks( final Realm realm, final PropagationByResource<String> propByRes, final Collection<String> noPropResourceKeys) { if (noPropResourceKeys != null) { propByRes.removeAll(noPropResourceKeys); } LOG.debug("Provisioning {}:\n{}", realm, propByRes); // Avoid duplicates - see javadoc propByRes.purge(); LOG.debug("After purge {}:\n{}", realm, propByRes); List<PropagationTaskInfo> tasks = new ArrayList<>(); propByRes.asMap().forEach((resourceKey, operation) -> { ExternalResource resource = resourceDAO.find(resourceKey); OrgUnit orgUnit = Optional.ofNullable(resource).map(ExternalResource::getOrgUnit).orElse(null); if (resource == null) { LOG.error("Invalid resource name specified: {}, ignoring...", resourceKey); } else if (orgUnit == null) { LOG.error("No orgUnit specified on resource {}, ignoring...", resource); } else if (StringUtils.isBlank(orgUnit.getConnObjectLink())) { LOG.warn("Requesting propagation for {} but no ConnObjectLink provided for {}", realm.getFullPath(), resource); } else { PropagationTaskInfo task = new PropagationTaskInfo(resource); task.setObjectClassName(orgUnit.getObjectClass().getObjectClassValue()); task.setEntityKey(realm.getKey()); task.setOperation(operation); task.setOldConnObjectKey(propByRes.getOldConnObjectKey(resource.getKey())); Pair<String, Set<Attribute>> preparedAttrs = mappingManager.prepareAttrsFromRealm(realm, orgUnit); task.setConnObjectKey(preparedAttrs.getLeft()); task.setAttributes(POJOHelper.serialize(preparedAttrs.getRight())); tasks.add(task); LOG.debug("PropagationTask created: {}", task); } }); return tasks; } }
apache/syncope
core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationManager.java
Java
apache-2.0
27,232
/* * Copyright 2002-2005 the original author or 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 org.springframework.binding.validation; import org.springframework.richclient.core.Message; /** * A specific type of message that relates to a property. * <code>ValidationMessage</code>s often find their origin in validation * triggered by a constraint on a property. This information is additionally * kept available in this <code>ValidationMessage</code>. */ public interface ValidationMessage extends Message { /** * The property name for messages that have a global scope i.e. do not apply * to a specific property. */ public static final String GLOBAL_PROPERTY = null; /** * The property that this validation message applies to; or * <code>GLOBAL_PROPERTY</code> if this message does not apply to a * specific property. */ String getProperty(); }
springrichclient/springrcp
spring-richclient-core/src/main/java/org/springframework/binding/validation/ValidationMessage.java
Java
apache-2.0
1,409
/* * Copyright 2002-2004 the original author or 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 org.springframework.binding.value.swing; import javax.swing.JSpinner; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.springframework.binding.value.ValueModel; import org.springframework.binding.value.support.AbstractValueModelAdapter; /** * Adapts a value model to a JSpinner control. * * @author Oliver Hutchison */ public class SpinnerAdapter extends AbstractValueModelAdapter { private final SpinnerChangeListener listener = new SpinnerChangeListener(); private final JSpinner spinner; public SpinnerAdapter(JSpinner spinner, ValueModel valueModel) { super(valueModel); this.spinner = spinner; this.spinner.addChangeListener(listener); initalizeAdaptedValue(); } protected void valueModelValueChanged(Object newValue) { if (newValue == null) { spinner.setValue(new Integer(0)); } else { spinner.setValue(newValue); } } private class SpinnerChangeListener implements ChangeListener { public void stateChanged(ChangeEvent e) { adaptedValueChanged(spinner.getValue()); } } }
springrichclient/springrcp
spring-richclient-core/src/main/java/org/springframework/binding/value/swing/SpinnerAdapter.java
Java
apache-2.0
1,821
# Copyright 2012 OpenStack Foundation # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011,2012 Akira YOSHIYAMA <akirayoshiyama@gmail.com> # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # This source code is based ./auth_token.py and ./ec2_token.py. # See them for their copyright. """ ------------------- S3 Token Middleware ------------------- s3token middleware is for authentication with s3api + keystone. This middleware: * Gets a request from the s3api middleware with an S3 Authorization access key. * Validates s3 token with Keystone. * Transforms the account name to AUTH_%(tenant_name). * Optionally can retrieve and cache secret from keystone to validate signature locally .. note:: If upgrading from swift3, the ``auth_version`` config option has been removed, and the ``auth_uri`` option now includes the Keystone API version. If you previously had a configuration like .. code-block:: ini [filter:s3token] use = egg:swift3#s3token auth_uri = https://keystonehost:35357 auth_version = 3 you should now use .. code-block:: ini [filter:s3token] use = egg:swift#s3token auth_uri = https://keystonehost:35357/v3 """ import base64 import json from keystoneclient.v3 import client as keystone_client from keystoneauth1 import session as keystone_session from keystoneauth1 import loading as keystone_loading import requests import six from six.moves import urllib from swift.common.swob import Request, HTTPBadRequest, HTTPUnauthorized, \ HTTPException from swift.common.utils import config_true_value, split_path, get_logger, \ cache_from_env, append_underscore from swift.common.wsgi import ConfigFileError PROTOCOL_NAME = 'S3 Token Authentication' # Headers to purge if they came from (or may have come from) the client KEYSTONE_AUTH_HEADERS = ( 'X-Identity-Status', 'X-Service-Identity-Status', 'X-Domain-Id', 'X-Service-Domain-Id', 'X-Domain-Name', 'X-Service-Domain-Name', 'X-Project-Id', 'X-Service-Project-Id', 'X-Project-Name', 'X-Service-Project-Name', 'X-Project-Domain-Id', 'X-Service-Project-Domain-Id', 'X-Project-Domain-Name', 'X-Service-Project-Domain-Name', 'X-User-Id', 'X-Service-User-Id', 'X-User-Name', 'X-Service-User-Name', 'X-User-Domain-Id', 'X-Service-User-Domain-Id', 'X-User-Domain-Name', 'X-Service-User-Domain-Name', 'X-Roles', 'X-Service-Roles', 'X-Is-Admin-Project', 'X-Service-Catalog', # Deprecated headers, too... 'X-Tenant-Id', 'X-Tenant-Name', 'X-Tenant', 'X-User', 'X-Role', ) def parse_v2_response(token): access_info = token['access'] headers = { 'X-Identity-Status': 'Confirmed', 'X-Roles': ','.join(r['name'] for r in access_info['user']['roles']), 'X-User-Id': access_info['user']['id'], 'X-User-Name': access_info['user']['name'], 'X-Tenant-Id': access_info['token']['tenant']['id'], 'X-Tenant-Name': access_info['token']['tenant']['name'], 'X-Project-Id': access_info['token']['tenant']['id'], 'X-Project-Name': access_info['token']['tenant']['name'], } return headers, access_info['token']['tenant'] def parse_v3_response(token): token = token['token'] headers = { 'X-Identity-Status': 'Confirmed', 'X-Roles': ','.join(r['name'] for r in token['roles']), 'X-User-Id': token['user']['id'], 'X-User-Name': token['user']['name'], 'X-User-Domain-Id': token['user']['domain']['id'], 'X-User-Domain-Name': token['user']['domain']['name'], 'X-Tenant-Id': token['project']['id'], 'X-Tenant-Name': token['project']['name'], 'X-Project-Id': token['project']['id'], 'X-Project-Name': token['project']['name'], 'X-Project-Domain-Id': token['project']['domain']['id'], 'X-Project-Domain-Name': token['project']['domain']['name'], } return headers, token['project'] class S3Token(object): """Middleware that handles S3 authentication.""" def __init__(self, app, conf): """Common initialization code.""" self._app = app self._logger = get_logger( conf, log_route=conf.get('log_name', 's3token')) self._logger.debug('Starting the %s component', PROTOCOL_NAME) self._timeout = float(conf.get('http_timeout', '10.0')) if not (0 < self._timeout <= 60): raise ValueError('http_timeout must be between 0 and 60 seconds') self._reseller_prefix = append_underscore( conf.get('reseller_prefix', 'AUTH')) self._delay_auth_decision = config_true_value( conf.get('delay_auth_decision')) # where to find the auth service (we use this to validate tokens) self._request_uri = conf.get('auth_uri', '').rstrip('/') + '/s3tokens' parsed = urllib.parse.urlsplit(self._request_uri) if not parsed.scheme or not parsed.hostname: raise ConfigFileError( 'Invalid auth_uri; must include scheme and host') if parsed.scheme not in ('http', 'https'): raise ConfigFileError( 'Invalid auth_uri; scheme must be http or https') if parsed.query or parsed.fragment or '@' in parsed.netloc: raise ConfigFileError('Invalid auth_uri; must not include ' 'username, query, or fragment') # SSL insecure = config_true_value(conf.get('insecure')) cert_file = conf.get('certfile') key_file = conf.get('keyfile') if insecure: self._verify = False elif cert_file and key_file: self._verify = (cert_file, key_file) elif cert_file: self._verify = cert_file else: self._verify = None self._secret_cache_duration = int(conf.get('secret_cache_duration', 0)) if self._secret_cache_duration < 0: raise ValueError('secret_cache_duration must be non-negative') if self._secret_cache_duration: try: auth_plugin = keystone_loading.get_plugin_loader( conf.get('auth_type', 'password')) available_auth_options = auth_plugin.get_options() auth_options = {} for option in available_auth_options: name = option.name.replace('-', '_') value = conf.get(name) if value: auth_options[name] = value auth = auth_plugin.load_from_options(**auth_options) session = keystone_session.Session(auth=auth) self.keystoneclient = keystone_client.Client( session=session, region_name=conf.get('region_name')) self._logger.info("Caching s3tokens for %s seconds", self._secret_cache_duration) except Exception: self._logger.warning("Unable to load keystone auth_plugin. " "Secret caching will be unavailable.", exc_info=True) self.keystoneclient = None self._secret_cache_duration = 0 def _deny_request(self, code): error_cls, message = { 'AccessDenied': (HTTPUnauthorized, 'Access denied'), 'InvalidURI': (HTTPBadRequest, 'Could not parse the specified URI'), }[code] resp = error_cls(content_type='text/xml') error_msg = ('<?xml version="1.0" encoding="UTF-8"?>\r\n' '<Error>\r\n <Code>%s</Code>\r\n ' '<Message>%s</Message>\r\n</Error>\r\n' % (code, message)) if six.PY3: error_msg = error_msg.encode() resp.body = error_msg return resp def _json_request(self, creds_json): headers = {'Content-Type': 'application/json'} try: response = requests.post(self._request_uri, headers=headers, data=creds_json, verify=self._verify, timeout=self._timeout) except requests.exceptions.RequestException as e: self._logger.info('HTTP connection exception: %s', e) raise self._deny_request('InvalidURI') if response.status_code < 200 or response.status_code >= 300: self._logger.debug('Keystone reply error: status=%s reason=%s', response.status_code, response.reason) raise self._deny_request('AccessDenied') return response def __call__(self, environ, start_response): """Handle incoming request. authenticate and send downstream.""" req = Request(environ) self._logger.debug('Calling S3Token middleware.') # Always drop auth headers if we're first in the pipeline if 'keystone.token_info' not in req.environ: req.headers.update({h: None for h in KEYSTONE_AUTH_HEADERS}) try: parts = split_path(urllib.parse.unquote(req.path), 1, 4, True) version, account, container, obj = parts except ValueError: msg = 'Not a path query: %s, skipping.' % req.path self._logger.debug(msg) return self._app(environ, start_response) # Read request signature and access id. s3_auth_details = req.environ.get('s3api.auth_details') if not s3_auth_details: msg = 'No authorization details from s3api. skipping.' self._logger.debug(msg) return self._app(environ, start_response) access = s3_auth_details['access_key'] if isinstance(access, six.binary_type): access = access.decode('utf-8') signature = s3_auth_details['signature'] if isinstance(signature, six.binary_type): signature = signature.decode('utf-8') string_to_sign = s3_auth_details['string_to_sign'] if isinstance(string_to_sign, six.text_type): string_to_sign = string_to_sign.encode('utf-8') token = base64.urlsafe_b64encode(string_to_sign) if isinstance(token, six.binary_type): token = token.decode('ascii') # NOTE(chmou): This is to handle the special case with nova # when we have the option s3_affix_tenant. We will force it to # connect to another account than the one # authenticated. Before people start getting worried about # security, I should point that we are connecting with # username/token specified by the user but instead of # connecting to its own account we will force it to go to an # another account. In a normal scenario if that user don't # have the reseller right it will just fail but since the # reseller account can connect to every account it is allowed # by the swift_auth middleware. force_tenant = None if ':' in access: access, force_tenant = access.split(':') # Authenticate request. creds = {'credentials': {'access': access, 'token': token, 'signature': signature}} memcache_client = None memcache_token_key = 's3secret/%s' % access if self._secret_cache_duration > 0: memcache_client = cache_from_env(environ) cached_auth_data = None if memcache_client: cached_auth_data = memcache_client.get(memcache_token_key) if cached_auth_data: if len(cached_auth_data) == 4: # Old versions of swift may have cached token, too, # but we don't need it headers, _token, tenant, secret = cached_auth_data else: headers, tenant, secret = cached_auth_data if s3_auth_details['check_signature'](secret): self._logger.debug("Cached creds valid") else: self._logger.debug("Cached creds invalid") cached_auth_data = None if not cached_auth_data: creds_json = json.dumps(creds) self._logger.debug('Connecting to Keystone sending this JSON: %s', creds_json) # NOTE(vish): We could save a call to keystone by having # keystone return token, tenant, user, and roles # from this call. # # NOTE(chmou): We still have the same problem we would need to # change token_auth to detect if we already # identified and not doing a second query and just # pass it through to swiftauth in this case. try: # NB: requests.Response, not swob.Response resp = self._json_request(creds_json) except HTTPException as e_resp: if self._delay_auth_decision: msg = ('Received error, deferring rejection based on ' 'error: %s') self._logger.debug(msg, e_resp.status) return self._app(environ, start_response) else: msg = 'Received error, rejecting request with error: %s' self._logger.debug(msg, e_resp.status) # NB: swob.Response, not requests.Response return e_resp(environ, start_response) self._logger.debug('Keystone Reply: Status: %d, Output: %s', resp.status_code, resp.content) try: token = resp.json() if 'access' in token: headers, tenant = parse_v2_response(token) elif 'token' in token: headers, tenant = parse_v3_response(token) else: raise ValueError if memcache_client: user_id = headers.get('X-User-Id') if not user_id: raise ValueError try: cred_ref = self.keystoneclient.ec2.get( user_id=user_id, access=access) memcache_client.set( memcache_token_key, (headers, tenant, cred_ref.secret), time=self._secret_cache_duration) self._logger.debug("Cached keystone credentials") except Exception: self._logger.warning("Unable to cache secret", exc_info=True) # Populate the environment similar to auth_token, # so we don't have to contact Keystone again. # # Note that although the strings are unicode following json # deserialization, Swift's HeaderEnvironProxy handles ensuring # they're stored as native strings req.environ['keystone.token_info'] = token except (ValueError, KeyError, TypeError): if self._delay_auth_decision: error = ('Error on keystone reply: %d %s - ' 'deferring rejection downstream') self._logger.debug(error, resp.status_code, resp.content) return self._app(environ, start_response) else: error = ('Error on keystone reply: %d %s - ' 'rejecting request') self._logger.debug(error, resp.status_code, resp.content) return self._deny_request('InvalidURI')( environ, start_response) req.headers.update(headers) tenant_to_connect = force_tenant or tenant['id'] if six.PY2 and isinstance(tenant_to_connect, six.text_type): tenant_to_connect = tenant_to_connect.encode('utf-8') self._logger.debug('Connecting with tenant: %s', tenant_to_connect) new_tenant_name = '%s%s' % (self._reseller_prefix, tenant_to_connect) environ['PATH_INFO'] = environ['PATH_INFO'].replace(account, new_tenant_name) return self._app(environ, start_response) def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) def auth_filter(app): return S3Token(app, conf) return auth_filter
openstack/swift
swift/common/middleware/s3api/s3token.py
Python
apache-2.0
17,603
/* * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. See accompanying * LICENSE file. */ package com.gemstone.gemfire.lang; import java.io.Serializable; /** * The Identifiable interface defines a contract for classes whose Object instances can be uniquely identified relative * to other Object instances within the same class type hierarchy. * <p/> * @author John Blum * @param <T> the class type of the identifier. * @see java.lang.Comparable * @since 7.0 */ public interface Identifiable<T extends Comparable<T>> extends Serializable { /** * Gets the identifier uniquely identifying this Object instance. * <p/> * @return an identifier uniquely identifying this Object. */ public T getId(); }
papicella/snappy-store
gemfire-core/src/main/java/com/gemstone/gemfire/lang/Identifiable.java
Java
apache-2.0
1,301
/* * Copyright 2013 Google Inc. * * 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.bitcoinj.protocols.channels; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import org.bitcoinj.core.*; import org.bitcoinj.crypto.TransactionSignature; import org.bitcoinj.script.Script; import org.bitcoinj.script.ScriptBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.math.BigInteger; import java.util.Arrays; import java.util.Locale; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; /** * Version 2 of the payment channel state machine - uses CLTV opcode transactions * instead of multisig transactions. */ public class PaymentChannelV2ServerState extends PaymentChannelServerState { private static final Logger log = LoggerFactory.getLogger(PaymentChannelV1ServerState.class); // The total value locked into the CLTV output and the value to us in the last signature the client provided private Coin feePaidForPayment; // The client key for the multi-sig contract // We currently also use the serverKey for payouts, but this is not required protected ECKey clientKey; PaymentChannelV2ServerState(StoredServerChannel storedServerChannel, Wallet wallet, TransactionBroadcaster broadcaster) throws VerificationException { super(storedServerChannel, wallet, broadcaster); synchronized (storedServerChannel) { this.clientKey = storedServerChannel.clientKey; stateMachine.transition(State.READY); } } public PaymentChannelV2ServerState(TransactionBroadcaster broadcaster, Wallet wallet, ECKey serverKey, long minExpireTime) { super(broadcaster, wallet, serverKey, minExpireTime); stateMachine.transition(State.WAITING_FOR_MULTISIG_CONTRACT); } @Override public Multimap<State, State> getStateTransitions() { Multimap<State, State> result = MultimapBuilder.enumKeys(State.class).arrayListValues().build(); result.put(State.UNINITIALISED, State.READY); result.put(State.UNINITIALISED, State.WAITING_FOR_MULTISIG_CONTRACT); result.put(State.WAITING_FOR_MULTISIG_CONTRACT, State.WAITING_FOR_MULTISIG_ACCEPTANCE); result.put(State.WAITING_FOR_MULTISIG_ACCEPTANCE, State.READY); result.put(State.READY, State.CLOSING); result.put(State.CLOSING, State.CLOSED); for (State state : State.values()) { result.put(state, State.ERROR); } return result; } @Override public int getMajorVersion() { return 2; } @Override public TransactionOutput getClientOutput() { return null; } public void provideClientKey(byte[] clientKey) { this.clientKey = ECKey.fromPublicOnly(clientKey); } @Override public synchronized Coin getFeePaid() { stateMachine.checkState(State.CLOSED, State.CLOSING); return feePaidForPayment; } @Override protected Script getSignedScript() { return createP2SHRedeemScript(); } @Override protected void verifyContract(final Transaction contract) { super.verifyContract(contract); // Check contract matches P2SH hash byte[] expected = getContractScript().getPubKeyHash(); byte[] actual = Utils.sha256hash160(createP2SHRedeemScript().getProgram()); if (!Arrays.equals(actual, expected)) { throw new VerificationException( "P2SH hash didn't match required contract - contract should be a CLTV micropayment channel to client and server in that order."); } } /** * Creates a P2SH script outputting to the client and server pubkeys * @return */ @Override protected Script createOutputScript() { return ScriptBuilder.createP2SHOutputScript(createP2SHRedeemScript()); } private Script createP2SHRedeemScript() { return ScriptBuilder.createCLTVPaymentChannelOutput(BigInteger.valueOf(getExpiryTime()), clientKey, serverKey); } protected ECKey getClientKey() { return clientKey; } // Signs the first input of the transaction which must spend the multisig contract. private void signP2SHInput(Transaction tx, Transaction.SigHash hashType, boolean anyoneCanPay) { TransactionSignature signature = tx.calculateSignature(0, serverKey, createP2SHRedeemScript(), hashType, anyoneCanPay); byte[] mySig = signature.encodeToBitcoin(); Script scriptSig = ScriptBuilder.createCLTVPaymentChannelP2SHInput(bestValueSignature, mySig, createP2SHRedeemScript()); tx.getInput(0).setScriptSig(scriptSig); } final SettableFuture<Transaction> closedFuture = SettableFuture.create(); @Override public synchronized ListenableFuture<Transaction> close() throws InsufficientMoneyException { if (storedServerChannel != null) { StoredServerChannel temp = storedServerChannel; storedServerChannel = null; StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates) wallet.getExtensions().get(StoredPaymentChannelServerStates.EXTENSION_ID); channels.closeChannel(temp); // May call this method again for us (if it wasn't the original caller) if (getState().compareTo(State.CLOSING) >= 0) return closedFuture; } if (getState().ordinal() < State.READY.ordinal()) { log.error("Attempt to settle channel in state " + getState()); stateMachine.transition(State.CLOSED); closedFuture.set(null); return closedFuture; } if (getState() != State.READY) { // TODO: What is this codepath for? log.warn("Failed attempt to settle a channel in state " + getState()); return closedFuture; } Transaction tx = null; try { Wallet.SendRequest req = makeUnsignedChannelContract(bestValueToMe); tx = req.tx; // Provide a throwaway signature so that completeTx won't complain out about unsigned inputs it doesn't // know how to sign. Note that this signature does actually have to be valid, so we can't use a dummy // signature to save time, because otherwise completeTx will try to re-sign it to make it valid and then // die. We could probably add features to the SendRequest API to make this a bit more efficient. signP2SHInput(tx, Transaction.SigHash.NONE, true); // Let wallet handle adding additional inputs/fee as necessary. req.shuffleOutputs = false; req.missingSigsMode = Wallet.MissingSigsMode.USE_DUMMY_SIG; wallet.completeTx(req); // TODO: Fix things so shuffling is usable. feePaidForPayment = req.tx.getFee(); log.info("Calculated fee is {}", feePaidForPayment); if (feePaidForPayment.compareTo(bestValueToMe) > 0) { final String msg = String.format(Locale.US, "Had to pay more in fees (%s) than the channel was worth (%s)", feePaidForPayment, bestValueToMe); throw new InsufficientMoneyException(feePaidForPayment.subtract(bestValueToMe), msg); } // Now really sign the multisig input. signP2SHInput(tx, Transaction.SigHash.ALL, false); // Some checks that shouldn't be necessary but it can't hurt to check. tx.verify(); // Sanity check syntax. for (TransactionInput input : tx.getInputs()) input.verify(); // Run scripts and ensure it is valid. } catch (InsufficientMoneyException e) { throw e; // Don't fall through. } catch (Exception e) { log.error("Could not verify self-built tx\nMULTISIG {}\nCLOSE {}", contract, tx != null ? tx : ""); throw new RuntimeException(e); // Should never happen. } stateMachine.transition(State.CLOSING); log.info("Closing channel, broadcasting tx {}", tx); // The act of broadcasting the transaction will add it to the wallet. ListenableFuture<Transaction> future = broadcaster.broadcastTransaction(tx).future(); Futures.addCallback(future, new FutureCallback<Transaction>() { @Override public void onSuccess(Transaction transaction) { log.info("TX {} propagated, channel successfully closed.", transaction.getHash()); stateMachine.transition(State.CLOSED); closedFuture.set(transaction); } @Override public void onFailure(Throwable throwable) { log.error("Failed to settle channel, could not broadcast: {}", throwable); stateMachine.transition(State.ERROR); closedFuture.setException(throwable); } }); return closedFuture; } }
rnicoll/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelV2ServerState.java
Java
apache-2.0
9,869
<?php /* * Copyright 2014 Google Inc. * * 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. */ class Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1LogoRecognitionAnnotation extends Google_Collection { protected $collection_key = 'tracks'; protected $entityType = 'Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1Entity'; protected $entityDataType = ''; protected $segmentsType = 'Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1VideoSegment'; protected $segmentsDataType = 'array'; protected $tracksType = 'Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1Track'; protected $tracksDataType = 'array'; /** * @param Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1Entity */ public function setEntity(Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1Entity $entity) { $this->entity = $entity; } /** * @return Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1Entity */ public function getEntity() { return $this->entity; } /** * @param Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1VideoSegment[] */ public function setSegments($segments) { $this->segments = $segments; } /** * @return Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1VideoSegment[] */ public function getSegments() { return $this->segments; } /** * @param Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1Track[] */ public function setTracks($tracks) { $this->tracks = $tracks; } /** * @return Google_Service_CloudVideoIntelligence_GoogleCloudVideointelligenceV1Track[] */ public function getTracks() { return $this->tracks; } }
tsugiproject/tsugi
vendor/google/apiclient-services/src/Google/Service/CloudVideoIntelligence/GoogleCloudVideointelligenceV1LogoRecognitionAnnotation.php
PHP
apache-2.0
2,318
/* * 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.geode.internal.cache.execute; import static org.apache.geode.cache.Region.SEPARATOR; import java.util.Map; import java.util.Set; import org.apache.geode.cache.Region; import org.apache.geode.cache.execute.FunctionAdapter; import org.apache.geode.cache.execute.FunctionContext; import org.apache.geode.cache.execute.RegionFunctionContext; import org.apache.geode.cache.partition.PartitionRegionHelper; import org.apache.geode.internal.Assert; import org.apache.geode.internal.cache.LocalDataSet; public class LocalDataSetFunction extends FunctionAdapter { private volatile boolean optimizeForWrite; public LocalDataSetFunction(boolean optimizeForWrite) { this.optimizeForWrite = optimizeForWrite; } @Override public void execute(FunctionContext context) { RegionFunctionContext rContext = (RegionFunctionContext) context; Region cust = rContext.getDataSet(); LocalDataSet localCust = (LocalDataSet) PartitionRegionHelper.getLocalDataForContext(rContext); Map<String, Region<?, ?>> localColocatedRegions = PartitionRegionHelper.getLocalColocatedRegions(rContext); Map<String, Region<?, ?>> colocatedRegions = PartitionRegionHelper.getColocatedRegions(cust); Assert.assertTrue(colocatedRegions.size() == 2); Set custKeySet = cust.keySet(); Set localCustKeySet = localCust.keySet(); Region ord = colocatedRegions.get(SEPARATOR + "OrderPR"); Region localOrd = localColocatedRegions.get(SEPARATOR + "OrderPR"); Set ordKeySet = ord.keySet(); Set localOrdKeySet = localOrd.keySet(); Region ship = colocatedRegions.get(SEPARATOR + "ShipmentPR"); Region localShip = localColocatedRegions.get(SEPARATOR + "ShipmentPR"); Set shipKeySet = ship.keySet(); Set localShipKeySet = localShip.keySet(); Assert.assertTrue( localCust.getBucketSet().size() == ((LocalDataSet) localOrd).getBucketSet().size()); Assert.assertTrue( localCust.getBucketSet().size() == ((LocalDataSet) localShip).getBucketSet().size()); Assert.assertTrue(custKeySet.size() == 120); Assert.assertTrue(ordKeySet.size() == 120); Assert.assertTrue(shipKeySet.size() == 120); Assert.assertTrue(localCustKeySet.size() == localOrdKeySet.size()); Assert.assertTrue(localCustKeySet.size() == localShipKeySet.size()); context.getResultSender().lastResult(null); } @Override public String getId() { return "LocalDataSetFunction" + optimizeForWrite; } @Override public boolean hasResult() { return true; } @Override public boolean optimizeForWrite() { return optimizeForWrite; } @Override public boolean isHA() { return false; } }
smgoller/geode
geode-core/src/test/java/org/apache/geode/internal/cache/execute/LocalDataSetFunction.java
Java
apache-2.0
3,480
""" Helper module that will enable lazy imports of Cocoa wrapper items. This should improve startup times and memory usage, at the cost of not being able to use 'from Cocoa import *' """ __all__ = ('ObjCLazyModule',) import sys import re import struct from objc import lookUpClass, getClassList, nosuchclass_error, loadBundle import objc ModuleType = type(sys) def _loadBundle(frameworkName, frameworkIdentifier, frameworkPath): if frameworkIdentifier is None: bundle = loadBundle( frameworkName, {}, bundle_path=frameworkPath, scan_classes=False) else: try: bundle = loadBundle( frameworkName, {}, bundle_identifier=frameworkIdentifier, scan_classes=False) except ImportError: bundle = loadBundle( frameworkName, {}, bundle_path=frameworkPath, scan_classes=False) return bundle class GetAttrMap (object): __slots__ = ('_container',) def __init__(self, container): self._container = container def __getitem__(self, key): try: return getattr(self._container, key) except AttributeError: raise KeyError(key) class ObjCLazyModule (ModuleType): # Define slots for all attributes, that way they don't end up it __dict__. __slots__ = ( '_ObjCLazyModule__bundle', '_ObjCLazyModule__enummap', '_ObjCLazyModule__funcmap', '_ObjCLazyModule__parents', '_ObjCLazyModule__varmap', '_ObjCLazyModule__inlinelist', '_ObjCLazyModule__aliases', ) def __init__(self, name, frameworkIdentifier, frameworkPath, metadict, inline_list=None, initialdict={}, parents=()): super(ObjCLazyModule, self).__init__(name) if frameworkIdentifier is not None or frameworkPath is not None: self.__bundle = self.__dict__['__bundle__'] = _loadBundle(name, frameworkIdentifier, frameworkPath) pfx = name + '.' for nm in sys.modules: if nm.startswith(pfx): rest = nm[len(pfx):] if '.' in rest: continue if sys.modules[nm] is not None: self.__dict__[rest] = sys.modules[nm] self.__dict__.update(initialdict) self.__dict__.update(metadict.get('misc', {})) self.__parents = parents self.__varmap = metadict.get('constants') self.__varmap_dct = metadict.get('constants_dict', {}) self.__enummap = metadict.get('enums') self.__funcmap = metadict.get('functions') self.__aliases = metadict.get('aliases') self.__inlinelist = inline_list self.__expressions = metadict.get('expressions') self.__expressions_mapping = GetAttrMap(self) self.__load_cftypes(metadict.get('cftypes')) if metadict.get('protocols') is not None: self.__dict__['protocols'] = ModuleType('%s.protocols'%(name,)) self.__dict__['protocols'].__dict__.update( metadict['protocols']) for p in objc.protocolsForProcess(): setattr(self.__dict__['protocols'], p.__name__, p) def __dir__(self): return self.__all__ def __getattr__(self, name): if name == "__all__": # Load everything immediately value = self.__calc_all() self.__dict__[name] = value return value # First try parent module, as we had done # 'from parents import *' for p in self.__parents: try: value = getattr(p, name) except AttributeError: pass else: self.__dict__[name] = value return value # Check if the name is a constant from # the metadata files try: value = self.__get_constant(name) except AttributeError: pass else: self.__dict__[name] = value return value # Then check if the name is class try: value = lookUpClass(name) except nosuchclass_error: pass else: self.__dict__[name] = value return value # Finally give up and raise AttributeError raise AttributeError(name) def __calc_all(self): all = set() # Ensure that all dynamic entries get loaded if self.__varmap_dct: for nm in self.__varmap_dct: try: getattr(self, nm) except AttributeError: pass if self.__varmap: for nm in re.findall(r"\$([A-Z0-9a-z_]*)(?:@[^$]*)?(?=\$)", self.__varmap): try: getattr(self, nm) except AttributeError: pass if self.__enummap: for nm in re.findall(r"\$([A-Z0-9a-z_]*)@[^$]*(?=\$)", self.__enummap): try: getattr(self, nm) except AttributeError: pass if self.__funcmap: for nm in self.__funcmap: try: getattr(self, nm) except AttributeError: pass if self.__expressions: for nm in self.__expressions: try: getattr(self, nm) except AttributeError: pass if self.__aliases: for nm in self.__aliases: try: getattr(self, nm) except AttributeError: pass # Add all names that are already in our __dict__ all.update(self.__dict__) # Merge __all__of parents ('from parent import *') for p in self.__parents: all.update(getattr(p, '__all__', ())) # Add all class names all.update(cls.__name__ for cls in getClassList()) return [ v for v in all if not v.startswith('_') ] return list(all) def __get_constant(self, name): # FIXME: Loading variables and functions requires too much # code at the moment, the objc API can be adjusted for # this later on. if self.__varmap_dct: if name in self.__varmap_dct: tp = self.__varmap_dct[name] return objc._loadConstant(name, tp, False) if self.__varmap: m = re.search(r"\$%s(@[^$]*)?\$"%(name,), self.__varmap) if m is not None: tp = m.group(1) if tp is None: tp = '@' else: tp = tp[1:] d = {} if tp.startswith('='): tp = tp[1:] magic = True else: magic = False #try: return objc._loadConstant(name, tp, magic) #except Exception as exc: # print "LOAD %r %r %r -> raise %s"%(name, tp, magic, exc) # raise if self.__enummap: m = re.search(r"\$%s@([^$]*)\$"%(name,), self.__enummap) if m is not None: val = m.group(1) if val.startswith("'"): if isinstance(val, bytes): # Python 2.x val, = struct.unpack('>l', val[1:-1]) else: # Python 3.x val, = struct.unpack('>l', val[1:-1].encode('latin1')) elif '.' in val: val = float(val) else: val = int(val) return val if self.__funcmap: if name in self.__funcmap: info = self.__funcmap[name] func_list = [ (name,) + info ] d = {} objc.loadBundleFunctions(self.__bundle, d, func_list) if name in d: return d[name] if self.__inlinelist is not None: try: objc.loadFunctionList( self.__inlinelist, d, func_list, skip_undefined=False) except objc.error: pass else: if name in d: return d[name] if self.__expressions: if name in self.__expressions: info = self.__expressions[name] try: return eval(info, {}, self.__expressions_mapping) except NameError: pass if self.__aliases: if name in self.__aliases: alias = self.__aliases[name] if alias == 'ULONG_MAX': return (sys.maxsize * 2) + 1 elif alias == 'LONG_MAX': return sys.maxsize elif alias == 'LONG_MIN': return -sys.maxsize-1 return getattr(self, alias) raise AttributeError(name) def __load_cftypes(self, cftypes): if not cftypes: return for name, type, gettypeid_func, tollfree in cftypes: if tollfree: for nm in tollfree.split(','): try: objc.lookUpClass(nm) except objc.error: pass else: tollfree = nm break try: v = objc.registerCFSignature(name, type, None, tollfree) if v is not None: self.__dict__[name] = v continue except objc.nosuchclass_error: pass try: func = getattr(self, gettypeid_func) except AttributeError: # GetTypeID function not found, this is either # a CFType that isn't present on the current # platform, or a CFType without a public GetTypeID # function. Proxy using the generic CFType if tollfree is None: v = objc.registerCFSignature(name, type, None, 'NSCFType') if v is not None: self.__dict__[name] = v continue v = objc.registerCFSignature(name, type, func()) if v is not None: self.__dict__[name] = v
albertz/music-player
mac/pyobjc-core/Lib/objc/_lazyimport.py
Python
bsd-2-clause
10,756
/* * #%L * Simmetrics Core * %% * Copyright (C) 2014 - 2016 Simmetrics 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. * #L% */ package org.simmetrics.builders; import java.util.List; import java.util.Set; import org.simmetrics.Metric; import org.simmetrics.StringMetric; import org.simmetrics.simplifiers.Simplifier; import org.simmetrics.tokenizers.Tokenizer; import com.google.common.collect.Multiset; @SuppressWarnings("deprecation") // Implementation of StringMetrics will migrate into this class final class StringMetrics { public static StringMetric create(Metric<String> metric) { return org.simmetrics.metrics.StringMetrics.create(metric); } public static StringMetric create(Metric<String> metric, Simplifier simplifier) { return org.simmetrics.metrics.StringMetrics.create(metric,simplifier); } public static StringMetric createForListMetric(Metric<List<String>> metric, Simplifier simplifier, Tokenizer tokenizer) { return org.simmetrics.metrics.StringMetrics.createForListMetric(metric,simplifier, tokenizer); } public static StringMetric createForListMetric(Metric<List<String>> metric, Tokenizer tokenizer) { return org.simmetrics.metrics.StringMetrics.createForListMetric(metric, tokenizer); } public static StringMetric createForSetMetric(Metric<Set<String>> metric, Simplifier simplifier, Tokenizer tokenizer) { return org.simmetrics.metrics.StringMetrics.createForSetMetric(metric,simplifier, tokenizer); } public static StringMetric createForSetMetric(Metric<Set<String>> metric, Tokenizer tokenizer) { return org.simmetrics.metrics.StringMetrics.createForSetMetric(metric, tokenizer); } public static StringMetric createForMultisetMetric(Metric<Multiset<String>> metric, Simplifier simplifier, Tokenizer tokenizer) { return org.simmetrics.metrics.StringMetrics.createForMultisetMetric(metric,simplifier, tokenizer); } public static StringMetric createForMultisetMetric(Metric<Multiset<String>> metric, Tokenizer tokenizer) { return org.simmetrics.metrics.StringMetrics.createForMultisetMetric(metric, tokenizer); } private StringMetrics() { // Utility class. } }
janmotl/linkifier
src/org/simmetrics/builders/StringMetrics.java
Java
bsd-2-clause
2,692
goog.provide('ol.test.format.WFS'); describe('ol.format.WFS', function() { describe('when parsing TOPP states GML from WFS', function() { var features, feature, xml; var config = { 'featureNS': 'http://www.openplans.org/topp', 'featureType': 'states' }; before(function(done) { proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326')); afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(data) { try { xml = data; features = new ol.format.WFS(config).readFeatures(xml); } catch (e) { done(e); } done(); }); }); it('creates 3 features', function() { expect(features).to.have.length(3); }); it('creates a polygon for Illinois', function() { feature = features[0]; expect(feature.getId()).to.equal('states.1'); expect(feature.get('STATE_NAME')).to.equal('Illinois'); expect(feature.getGeometry()).to.be.an(ol.geom.MultiPolygon); }); it('transforms and creates a polygon for Illinois', function() { features = new ol.format.WFS(config).readFeatures(xml, { featureProjection: 'EPSG:3857' }); feature = features[0]; expect(feature.getId()).to.equal('states.1'); expect(feature.get('STATE_NAME')).to.equal('Illinois'); var geom = feature.getGeometry(); expect(geom).to.be.an(ol.geom.MultiPolygon); var p = ol.proj.transform([-88.071, 37.511], 'EPSG:4326', 'EPSG:3857'); p.push(0); expect(geom.getFirstCoordinate()).to.eql(p); }); }); describe('when parsing mapserver GML2 polygon', function() { var features, feature, xml; var config = { 'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureType': 'polygon', 'gmlFormat': new ol.format.GML2() }; before(function(done) { proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326')); afterLoadText('spec/ol/format/wfs/polygonv2.xml', function(data) { try { xml = data; features = new ol.format.WFS(config).readFeatures(xml); } catch (e) { done(e); } done(); }); }); it('creates 3 features', function() { expect(features).to.have.length(3); }); it('creates a polygon for My Polygon with hole', function() { feature = features[0]; expect(feature.getId()).to.equal('1'); expect(feature.get('name')).to.equal('My Polygon with hole'); expect(feature.get('boundedBy')).to.eql( [47.003018, -0.768746, 47.925567, 0.532597]); expect(feature.getGeometry()).to.be.an(ol.geom.MultiPolygon); expect(feature.getGeometry().getFlatCoordinates()). to.have.length(60); }); }); describe('when parsing FeatureCollection', function() { var xml; before(function(done) { afterLoadText('spec/ol/format/wfs/EmptyFeatureCollection.xml', function(_xml) { xml = _xml; done(); }); }); it('returns an empty array of features when none exist', function() { var result = new ol.format.WFS().readFeatures(xml); expect(result).to.have.length(0); }); }); describe('when parsing FeatureCollection', function() { var response; before(function(done) { afterLoadText('spec/ol/format/wfs/NumberOfFeatures.xml', function(xml) { try { response = new ol.format.WFS().readFeatureCollectionMetadata(xml); } catch (e) { done(e); } done(); }); }); it('returns the correct number of features', function() { expect(response.numberOfFeatures).to.equal(625); }); }); describe('when parsing FeatureCollection', function() { var response; before(function(done) { proj4.defs('EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 ' + '+lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 ' + '+ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,' + '-1.8774,4.0725 +units=m +no_defs'); afterLoadText('spec/ol/format/wfs/boundedBy.xml', function(xml) { try { response = new ol.format.WFS().readFeatureCollectionMetadata(xml); } catch (e) { done(e); } done(); }); }); it('returns the correct bounds', function() { expect(response.bounds).to.eql([3197.88, 306457.313, 280339.156, 613850.438]); }); }); describe('when parsing TransactionResponse', function() { var response; before(function(done) { afterLoadText('spec/ol/format/wfs/TransactionResponse.xml', function(xml) { try { response = new ol.format.WFS().readTransactionResponse(xml); } catch (e) { done(e); } done(); }); }); it('returns the correct TransactionResponse object', function() { expect(response.transactionSummary.totalDeleted).to.equal(0); expect(response.transactionSummary.totalInserted).to.equal(0); expect(response.transactionSummary.totalUpdated).to.equal(1); expect(response.insertIds).to.have.length(2); expect(response.insertIds[0]).to.equal('parcelle.40'); }); }); describe('when writing out a GetFeature request', function() { it('creates the expected output', function() { var text = '<wfs:GetFeature service="WFS" version="1.1.0" resultType="hits" ' + ' xmlns:topp="http://www.openplans.org/topp"' + ' xmlns:wfs="http://www.opengis.net/wfs"' + ' xmlns:ogc="http://www.opengis.net/ogc"' + ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' + ' xsi:schemaLocation="http://www.opengis.net/wfs ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' + ' <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' + ' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' + ' xmlns:topp="http://www.openplans.org/topp">' + ' <wfs:PropertyName>STATE_NAME</wfs:PropertyName>' + ' <wfs:PropertyName>STATE_FIPS</wfs:PropertyName>' + ' <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>' + ' </wfs:Query>' + '</wfs:GetFeature>'; var serialized = new ol.format.WFS().writeGetFeature({ resultType: 'hits', featureTypes: ['states'], featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', srsName: 'urn:ogc:def:crs:EPSG::4326', propertyNames: ['STATE_NAME', 'STATE_FIPS', 'STATE_ABBR'] }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); it('creates paging headers', function() { var text = '<wfs:GetFeature service="WFS" version="1.1.0" startIndex="20" ' + ' count="10" xmlns:topp="http://www.openplans.org/topp"' + ' xmlns:wfs="http://www.opengis.net/wfs"' + ' xmlns:ogc="http://www.opengis.net/ogc"' + ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' + ' xsi:schemaLocation="http://www.opengis.net/wfs ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">' + ' <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' + ' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326"' + ' xmlns:topp="http://www.openplans.org/topp">' + ' </wfs:Query>' + '</wfs:GetFeature>'; var serialized = new ol.format.WFS().writeGetFeature({ count: 10, startIndex: 20, srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', featureTypes: ['states'] }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); it('creates a BBOX filter', function() { var text = '<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' + ' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' + ' xmlns:topp="http://www.openplans.org/topp">' + ' <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">' + ' <ogc:BBOX>' + ' <ogc:PropertyName>the_geom</ogc:PropertyName>' + ' <gml:Envelope xmlns:gml="http://www.opengis.net/gml" ' + ' srsName="urn:ogc:def:crs:EPSG::4326">' + ' <gml:lowerCorner>1 2</gml:lowerCorner>' + ' <gml:upperCorner>3 4</gml:upperCorner>' + ' </gml:Envelope>' + ' </ogc:BBOX>' + ' </ogc:Filter>' + '</wfs:Query>'; var serialized = new ol.format.WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', featureTypes: ['states'], geometryName: 'the_geom', bbox: [1, 2, 3, 4] }); expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text)); }); }); describe('when writing out a Transaction request', function() { it('creates a handle', function() { var text = '<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" ' + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + 'service="WFS" version="1.1.0" handle="handle_t" ' + 'xsi:schemaLocation="http://www.opengis.net/wfs ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>'; var serialized = new ol.format.WFS().writeTransaction(null, null, null, {handle: 'handle_t'}); expect(serialized).to.xmleql(ol.xml.parse(text)); }); }); describe('when writing out a Transaction request', function() { var text; before(function(done) { afterLoadText('spec/ol/format/wfs/TransactionSrs.xml', function(xml) { text = xml; done(); }); }); it('creates the correct srsName', function() { var format = new ol.format.WFS(); var insertFeature = new ol.Feature({ the_geom: new ol.geom.MultiLineString([[ [-5178372.1885436, 1992365.7775042], [-4434792.7774889, 1601008.1927386], [-4043435.1927233, 2148908.8114105] ]]), TYPE: 'xyz' }); insertFeature.setGeometryName('the_geom'); var inserts = [insertFeature]; var serialized = format.writeTransaction(inserts, null, null, { featureNS: 'http://foo', featureType: 'FAULTS', featurePrefix: 'feature', gmlOptions: {multiCurve: true, srsName: 'EPSG:900913'} }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); }); describe('when writing out a Transaction request', function() { var text; before(function(done) { afterLoadText('spec/ol/format/wfs/TransactionUpdate.xml', function(xml) { text = xml; done(); }); }); it('creates the correct update', function() { var format = new ol.format.WFS(); var updateFeature = new ol.Feature(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new ol.geom.MultiLineString([[ [-12279454, 6741885], [-12064207, 6732101], [-11941908, 6595126], [-12240318, 6507071], [-12416429, 6604910] ]])); updateFeature.setId('FAULTS.4455'); var serialized = format.writeTransaction(null, [updateFeature], null, { featureNS: 'http://foo', featureType: 'FAULTS', featurePrefix: 'foo', gmlOptions: {srsName: 'EPSG:900913'} }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); }); describe('when writing out a Transaction request', function() { it('does not create an update if no fid', function() { var format = new ol.format.WFS(); var updateFeature = new ol.Feature(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new ol.geom.MultiLineString([[ [-12279454, 6741885], [-12064207, 6732101], [-11941908, 6595126], [-12240318, 6507071], [-12416429, 6604910] ]])); var error = false; try { format.writeTransaction(null, [updateFeature], null, { featureNS: 'http://foo', featureType: 'FAULTS', featurePrefix: 'foo', gmlOptions: {srsName: 'EPSG:900913'} }); } catch (e) { error = true; } expect(error).to.be(true); }); }); describe('when writing out a Transaction request', function() { var text, filename = 'spec/ol/format/wfs/TransactionUpdateMultiGeoms.xml'; before(function(done) { afterLoadText(filename, function(xml) { text = xml; done(); } ); }); it('handles multiple geometries', function() { var format = new ol.format.WFS(); var updateFeature = new ol.Feature(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new ol.geom.MultiLineString([[ [-12279454, 6741885], [-12064207, 6732101], [-11941908, 6595126], [-12240318, 6507071], [-12416429, 6604910] ]])); updateFeature.set('geom2', new ol.geom.MultiLineString([[ [-12000000, 6700000], [-12000001, 6700001], [-12000002, 6700002] ]])); var serialized = format.writeTransaction([updateFeature], [], null, { featureNS: 'http://foo', featureType: 'FAULTS', featurePrefix: 'foo', gmlOptions: {srsName: 'EPSG:900913'} }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); }); describe('when writing out a Transaction request', function() { var text; before(function(done) { afterLoadText('spec/ol/format/wfs/TransactionMulti.xml', function(xml) { text = xml; done(); }); }); it('creates the correct transaction body', function() { var format = new ol.format.WFS(); var insertFeature = new ol.Feature({ the_geom: new ol.geom.MultiPoint([[1, 2]]), foo: 'bar', nul: null }); insertFeature.setGeometryName('the_geom'); var inserts = [insertFeature]; var updateFeature = new ol.Feature({ the_geom: new ol.geom.MultiPoint([[1, 2]]), foo: 'bar', // null value gets Property element with no Value nul: null, // undefined value means don't create a Property element unwritten: undefined }); updateFeature.setId('fid.42'); var updates = [updateFeature]; var deleteFeature = new ol.Feature(); deleteFeature.setId('fid.37'); var deletes = [deleteFeature]; var serialized = format.writeTransaction(inserts, updates, deletes, { featureNS: 'http://www.openplans.org/topp', featureType: 'states', featurePrefix: 'topp' }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); }); describe('when writing out a Transaction request', function() { var text; before(function(done) { afterLoadText('spec/ol/format/wfs/Native.xml', function(xml) { text = xml; done(); }); }); it('handles writing out Native', function() { var format = new ol.format.WFS(); var serialized = format.writeTransaction(null, null, null, { nativeElements: [{ vendorId: 'ORACLE', safeToIgnore: true, value: 'ALTER SESSION ENABLE PARALLEL DML' }, { vendorId: 'ORACLE', safeToIgnore: false, value: 'Another native line goes here' }] }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); }); describe('when writing out a GetFeature request', function() { var text; before(function(done) { afterLoadText('spec/ol/format/wfs/GetFeatureMultiple.xml', function(xml) { text = xml; done(); }); }); it('handles writing multiple Query elements', function() { var format = new ol.format.WFS(); var serialized = format.writeGetFeature({ featureNS: 'http://www.openplans.org/topp', featureTypes: ['states', 'cities'], featurePrefix: 'topp' }); expect(serialized).to.xmleql(ol.xml.parse(text)); }); }); describe('when parsing GML from MapServer', function() { var features, feature; before(function(done) { afterLoadText('spec/ol/format/wfs/mapserver.xml', function(xml) { try { var config = { 'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureType': 'Historische_Messtischblaetter_WFS' }; features = new ol.format.WFS(config).readFeatures(xml); } catch (e) { done(e); } done(); }); }); it('creates 7 features', function() { expect(features).to.have.length(7); }); it('creates a polygon for Arnstadt', function() { feature = features[0]; var fid = 'Historische_Messtischblaetter_WFS.71055885'; expect(feature.getId()).to.equal(fid); expect(feature.get('titel')).to.equal('Arnstadt'); expect(feature.getGeometry()).to.be.an(ol.geom.Polygon); }); }); describe('when parsing multiple feature types', function() { var features; before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { features = new ol.format.WFS({ featureNS: 'http://localhost:8080/official', featureType: ['planet_osm_polygon', 'planet_osm_line'] }).readFeatures(xml); } catch (e) { done(e); } done(); }); }); it('reads all features', function() { expect(features.length).to.be(12); }); }); describe('when parsing multiple feature types', function() { var features; before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { features = new ol.format.WFS().readFeatures(xml); } catch (e) { done(e); } done(); }); }); it('reads all features with autoconfigure', function() { expect(features.length).to.be(12); }); }); }); goog.require('ol.xml'); goog.require('ol.Feature'); goog.require('ol.geom.MultiLineString'); goog.require('ol.geom.MultiPoint'); goog.require('ol.geom.MultiPolygon'); goog.require('ol.geom.Polygon'); goog.require('ol.format.GML2'); goog.require('ol.format.WFS'); goog.require('ol.proj');
NOAA-ORR-ERD/ol3
test/spec/ol/format/wfsformat.test.js
JavaScript
bsd-2-clause
18,764
#include <SFGUI/ResourceManager.hpp> #include <SFGUI/FileResourceLoader.hpp> #if defined( SFGUI_INCLUDE_FONT ) #include <SFGUI/DejaVuSansFont.hpp> #endif #include <SFML/Graphics/Font.hpp> namespace sfg { ResourceManager::ResourceManager( bool use_default_font ) : m_use_default_font( use_default_font ) { // Add file resource loader as fallback. CreateLoader<FileResourceLoader>(); } std::shared_ptr<const ResourceLoader> ResourceManager::GetLoader( const std::string& id ) { auto loader_iter = m_loaders.find( id ); return loader_iter == m_loaders.end() ? std::shared_ptr<const ResourceLoader>() : loader_iter->second; } std::shared_ptr<const sf::Font> ResourceManager::GetFont( const std::string& path ) { { auto font_iter = m_fonts.find( path ); if( font_iter != m_fonts.end() ) { return font_iter->second; } } if( path == "Default" ) { if( m_use_default_font ) { #if defined( SFGUI_INCLUDE_FONT ) auto font = std::make_shared<sf::Font>( LoadDejaVuSansFont() ); #else #if defined( SFGUI_DEBUG ) std::cerr << "SFGUI warning: No default font available. (SFGUI_INCLUDE_FONT = FALSE)\n"; #endif auto font = std::make_shared<sf::Font>(); #endif m_fonts[path] = font; return font; } return std::shared_ptr<const sf::Font>(); } // Try to load. auto loader = GetMatchingLoader( path ); if( !loader ) { std::shared_ptr<const sf::Font> font; if( m_use_default_font ) { auto font_iter = m_fonts.find( path ); if( font_iter == m_fonts.end() ) { #if defined( SFGUI_INCLUDE_FONT ) font = std::make_shared<sf::Font>( LoadDejaVuSansFont() ); #else #if defined( SFGUI_DEBUG ) std::cerr << "SFGUI warning: No default font available. (SFGUI_INCLUDE_FONT = FALSE)\n"; #endif font = std::make_shared<sf::Font>(); #endif m_fonts[path] = font; } else { font = font_iter->second; } } return font; } auto font = loader->LoadFont( GetFilename( path, *loader ) ); if( !font ) { if( m_use_default_font ) { auto font_iter = m_fonts.find( path ); if( font_iter == m_fonts.end() ) { #if defined( SFGUI_INCLUDE_FONT ) font = std::make_shared<sf::Font>( LoadDejaVuSansFont() ); #else #if defined( SFGUI_DEBUG ) std::cerr << "SFGUI warning: No default font available. (SFGUI_INCLUDE_FONT = FALSE)\n"; #endif font = std::make_shared<sf::Font>(); #endif m_fonts[path] = font; } else { font = font_iter->second; } } return font; } // Cache. m_fonts[path] = font; return font; } std::shared_ptr<const sf::Image> ResourceManager::GetImage( const std::string& path ) { auto image_iter = m_images.find( path ); if( image_iter != m_images.end() ) { return image_iter->second; } // Try to load. auto loader = GetMatchingLoader( path ); if( !loader ) { return std::shared_ptr<const sf::Image>(); } auto image = loader->LoadImage( GetFilename( path, *loader ) ); if( !image ) { return std::shared_ptr<const sf::Image>(); } // Cache. m_images[path] = image; return image; } std::shared_ptr<const ResourceLoader> ResourceManager::GetMatchingLoader( const std::string& path ) { if( path.empty() || ( path == "Default" ) ) { return std::shared_ptr<const ResourceLoader>(); } // Extract prefix. auto colon_pos = path.find( ':' ); std::shared_ptr<const ResourceLoader> loader; if( colon_pos != std::string::npos ) { auto ident = path.substr( 0, colon_pos ); auto loader_iter = m_loaders.find( ident ); if( loader_iter != m_loaders.end() ) { loader = loader_iter->second; } } // Use file loader as fallback. if( !loader ) { loader = m_loaders["file"]; } return loader; } void ResourceManager::Clear() { m_loaders.clear(); m_fonts.clear(); m_images.clear(); } std::string ResourceManager::GetFilename( const std::string& path, const ResourceLoader& loader ) { auto ident = loader.GetIdentifier() + ":"; auto ident_pos = path.find( ident ); if( ident_pos == std::string::npos || ident_pos != 0 ) { return path; } return path.substr( ident.size() ); } void ResourceManager::AddFont( const std::string& path, std::shared_ptr<const sf::Font> font ) { m_fonts[path] = font; } void ResourceManager::AddImage( const std::string& path, std::shared_ptr<const sf::Image> image ) { m_images[path] = image; } void ResourceManager::SetDefaultFont( std::shared_ptr<const sf::Font> font ) { AddFont( "", font ); } }
Krozark/SFML-book
extlibs/SFGUI/src/SFGUI/ResourceManager.cpp
C++
bsd-2-clause
4,383
#ifndef Rice__Module_defn__hpp_ #define Rice__Module_defn__hpp_ #include "Object_defn.hpp" #include "Module_impl.hpp" #include "to_from_ruby_defn.hpp" #include <memory> namespace Rice { class Array; class Class; class String; //! A helper for defining a Module and its methods. /*! This class provides a C++-style interface to ruby's Module class and * for defining methods on that module. * * Many of the methods are defined in Module_impl.hpp so that they can * return a reference to the most derived type. */ class Module // TODO: we can't inherit from Builtin_Object, because Class needs // type T_CLASS and Module needs type T_MODULE : public Module_impl<Module_base, Module> { public: //! Default construct a Module and initialize it to rb_cObject. Module(); //! Construct a Module from an existing Module object. Module(VALUE v); //! Return the name of the module. String name() const; //! Swap with another Module. void swap(Module & other); //! Return an array containing the Module's ancestors. /*! You will need to include Array.hpp to use this function. */ Array ancestors() const; //! Return the module's singleton class. /*! You will need to include Class.hpp to use this function. */ Class singleton_class() const; }; //! Define a new module in the namespace given by module. /*! \param module the module in which to define the new module. * \param name the name of the new module. */ Module define_module_under( Object module, char const * name); //! Define a new module in the default namespace. /*! \param name the name of the new module. */ Module define_module( char const * name); //! Create a new anonymous module. /*! \return the new module. */ Module anonymous_module(); } // namespace Rice template<> inline Rice::Module from_ruby<Rice::Module>(Rice::Object x) { return Rice::Module(x); } template<> inline Rice::Object to_ruby<Rice::Module>(Rice::Module const & x) { return x; } #endif // Rice__Module_defn__hpp_
cout/rice
rice/Module_defn.hpp
C++
bsd-2-clause
2,025
cask "freetube" do version "0.13.2" sha256 "104b5718b54a0015453b934a58b333cb1336c6d5ec87148abb4722ada870b682" url "https://github.com/FreeTubeApp/FreeTube/releases/download/v#{version}-beta/freetube-#{version}-mac.dmg" name "FreeTube" desc "YouTube player focusing on privacy" homepage "https://github.com/FreeTubeApp/FreeTube" livecheck do url :url regex(/^v?(\d+(?:\.\d+)+)/i) end app "FreeTube.app" zap trash: [ "~/Library/Application Support/FreeTube", "~/Library/Preferences/io.freetubeapp.freetube.plist", "~/Library/Saved Application State/io.freetubeapp.freetube.savedState", ] end
tjnycum/homebrew-cask
Casks/freetube.rb
Ruby
bsd-2-clause
636
cask 'docker' do version '1.12.0.10871' sha256 'f170610d95c188dee8433eff33c84696c1c8a39421de548a71a1258a458e1b21' url "https://download.docker.com/mac/stable/#{version}/Docker.dmg" appcast 'https://download.docker.com/mac/stable/appcast.xml', checkpoint: 'ee03f7c36b4192a64ba30e49a0fa1f8358cc3fe4a8a3af3def066c80f36b18bf' name 'Docker for Mac' homepage 'https://www.docker.com/products/docker' license :mit auto_updates true app 'Docker.app' end
MoOx/homebrew-cask
Casks/docker.rb
Ruby
bsd-2-clause
477
# this: every_hour.py # by: Poul Staugaard (poul(dot)staugaard(at)gmail...) # URL: http://code.google.com/p/giewiki # ver.: 1.13 import cgi import codecs import datetime import difflib import glob import hashlib import logging import os import re import urllib import urlparse import uuid import xml.dom.minidom from new import instance, classobj from os import path from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db from google.appengine.api import memcache from google.appengine.api import urlfetch from google.appengine.api import mail from google.appengine.api import namespace_manager from giewikidb import Tiddler,SiteInfo,ShadowTiddler,EditLock,Page,PageTemplate,DeletionLog,Comment,Include,Note,Message,Group,GroupMember,UrlImport,UploadedFile,UserProfile,PenName,SubDomain,LogEntry,CronJob from giewikidb import truncateModel, truncateAllData, HasGroupAccess, ReadAccessToPage, AccessToPage, IsSoleOwner, Upgrade, CopyIntoNamespace, dropCronJob class EveryHour(webapp.RequestHandler): def get(self): for cj in CronJob.all(): if cj.when < datetime.datetime.now(): tdlr = Tiddler.all().filter('id',cj.tiddler).filter('current',True).get() if tdlr is None: logging.warning("Tiddler not found") else: if cj.action == 'promote': logging.info("CJob:promote " + cj.tiddler) if hasattr(tdlr,'deprecated'): delattr(tdlr,'deprecated') tdlr.tags = tdlr.tags.replace('@promote@','@promoted@') tdlr.put() dts = Tiddler.all().filter('page', tdlr.page).filter('title','DefaultTiddlers').filter('current', True).get() if dts is None: logging.warning("DefaultTiddlers not found for page " + tdlr.page) else: dtparts = dts.text.split('\n') dtparts.insert(cj.position,'[[' + tdlr.title + ']]') dts.text = '\n'.join(dtparts) dts.put() logging.info("Tiddler " + tdlr.title + " added to DefaultTiddlers") if cj.action == 'announce': logging.info("CJob/announce " + cj.tiddler) if hasattr(tdlr,'deprecated'): delattr(tdlr,'deprecated') tdlr.tags = tdlr.tags.replace('@announce@','@announced@') tdlr.put() dts = Tiddler.all().filter('page', tdlr.page).filter('title','MainMenu').filter('current', True).get() if dts is None: logging.warning("MainMenu not found for page " + tdlr.page) else: dtparts = dts.text.split('\n') dtparts.insert(cj.position,'[[' + tdlr.title + ']]') dts.text = '\n'.join(dtparts) dts.put() logging.info("Tiddler " + tdlr.title + " added to MainMenu") if cj.action == 'demote' or cj.action == 'deprecate': logging.info("CJob:demote " + cj.tiddler) dts = Tiddler.all().filter('page', tdlr.page).filter('title','DefaultTiddlers').filter('current', True).get() if not dts is None: ss = '[[' + tdlr.title + ']]\n' dts.text = dts.text.replace(ss,'') dts.put() dts = Tiddler.all().filter('page', tdlr.page).filter('title','MainMenu').filter('current', True).get() if not dts is None: ss = '[[' + tdlr.title + ']]\n' dts.text = dts.text.replace(ss,'') dts.put() if cj.action == 'deprecate': logging.info("CJob:deprecate " + cj.tiddler) setattr(tdlr,'deprecated',True) tdlr.put() if cj.action == 'revert': logging.info("CJob: revert " + str(cj.tiddler) + " to V#" + str(cj.position)) rvn = cj.position if cj.position > 0 else tdlr.version - 1 tdlrvr = Tiddler.all().filter('id',cj.tiddler).filter('version',rvn).get() if tdlrvr is None: logging.warning("Version " + str(rvn) + " of tiddler " + tdlr.page + "#" + tdlr.title + " not found!") else: tdlr.current = False tdlr.put() tdlrvr.current = True tdlrvr.vercnt = tdlr.vercnt tdlrvr.reverted = datetime.datetime.now() tdlrvr.reverted_by = None tdlrvr.put() cj.delete() application = webapp.WSGIApplication( [('/every_1_hours', EveryHour)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main()
wangjun/giewiki
every_hour.py
Python
bsd-2-clause
4,271
from lino.api import dd class Persons(dd.Table): model = 'app.Person' column_names = 'name *' detail_layout = """ id name owned_places managed_places VisitsByPerson MealsByPerson """ class Places(dd.Table): model = 'app.Place' detail_layout = """ id name ceo owners VisitsByPlace """ class Restaurants(dd.Table): model = 'app.Restaurant' detail_layout = """ id place serves_hot_dogs cooks MealsByRestaurant """ class VisitsByPlace(dd.Table): model = 'app.Visit' master_key = 'place' column_names = 'person purpose' class VisitsByPerson(dd.Table): model = 'app.Visit' master_key = 'person' column_names = 'place purpose' class MealsByRestaurant(dd.Table): model = 'app.Meal' master_key = 'restaurant' column_names = 'person what' class MealsByPerson(dd.Table): model = 'app.Meal' master_key = 'person' column_names = 'restaurant what'
lino-framework/book
lino_book/projects/nomti/app/desktop.py
Python
bsd-2-clause
979
/* * 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 com.evernote.thrift.protocol; /** * Helper class that encapsulates list metadata. * */ public final class TList { public TList() { this(TType.STOP, 0); } public TList(byte t, int s) { elemType = t; size = s; } public final byte elemType; public final int size; }
alexchenzl/evernote-sdk-java
src/main/java/com/evernote/thrift/protocol/TList.java
Java
bsd-2-clause
1,107
"""Test module for wiring with invalid type of marker for attribute injection.""" from dependency_injector.wiring import Closing service = Closing["service"]
rmk135/dependency_injector
tests/unit/samples/wiringstringids/module_invalid_attr_injection.py
Python
bsd-3-clause
161
from datadog import initialize, api options = { 'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4', 'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff' } initialize(**options) # Get a downtime api.Downtime.get(2910)
jhotta/documentation
code_snippets/api-monitor-get-downtime.py
Python
bsd-3-clause
224
/* This file is part of the Vc library. {{{ Copyright © 2011-2015 Matthias Kretz <kretz@kde.org> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the names of contributing organizations nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. }}}*/ #include <avx/vector.h> #include <avx/debug.h> #include <avx/macros.h> namespace Vc_VERSIONED_NAMESPACE { namespace Detail { #ifdef Vc_IMPL_AVX2 template <> Vc_CONST AVX2::short_v sorted<CurrentImplementation::current()>(AVX2::short_v x_) { // ab cd ef gh ij kl mn op // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ // ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮ // ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ // <> <> <> <> <> <> <> <> // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ // ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮ // ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮ // 01 23 01 23 01 23 01 23 // ⎮⎮ ⎮⎮ ╳ ⎮⎮ ⎮⎮ ╳ // 01 23 32 10 01 23 32 10 // ⎮⎝ ⎮⎝ ⎠⎮ ⎠⎮ ⎮⎝ ⎮⎝ ⎠⎮ ⎠⎮ // ⎮ ╲⎮ ╳ ⎮╱ ⎮ ⎮ ╲⎮ ╳ ⎮╱ ⎮ // ⎮ ╲╱ ╲╱ ⎮ ⎮ ╲╱ ╲╱ ⎮ // ⎮ ╱╲ ╱╲ ⎮ ⎮ ╱╲ ╱╲ ⎮ // ⎮ ╱⎮ ╳ ⎮╲ ⎮ ⎮ ╱⎮ ╳ ⎮╲ ⎮ // ⎮⎛ ⎮⎛ ⎞⎮ ⎞⎮ ⎮⎛ ⎮⎛ ⎞⎮ ⎞⎮ // <> <> <> <> <> <> <> <> // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ // ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮ // ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ // <> <> <> <> <> <> <> <> // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ // ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮ // ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮ // 01 23 01 23 01 23 01 23 // sort pairs (one min/max) auto x = AVX::lo128(x_.data()); auto y = AVX::hi128(x_.data()); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); auto l = _mm_min_epi16(x, y); auto h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); // merge left & right quads (two min/max) x = _mm_unpacklo_epi16(l, h); y = _mm_unpackhi_epi16(h, l); Vc_DEBUG << "8x2 sorted xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h)); y = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l)); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); // merge quads into octs (three min/max) x = _mm_unpacklo_epi16(h, l); y = _mm_unpackhi_epi16(l, h); Vc_DEBUG << "4x4 sorted xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::permuteLo<X2, X3, X0, X1>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(h, l)); y = Mem::permuteHi<X6, X7, X4, X5>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(l, h)); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h)); y = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l)); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h) << " done?"; // merge octs into hexa (four min/max) x = _mm_unpacklo_epi16(l, h); y = _mm_unpackhi_epi16(h, l); Vc_DEBUG << "2x8 sorted xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = _mm_unpacklo_epi64(l, h); y = _mm_unpackhi_epi64(l, h); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = _mm_castps_si128(Mem::permute<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(h), _mm_castsi128_ps(l)))); y = _mm_castps_si128(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(l), _mm_castsi128_ps(h))); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h); y = Mem::permuteLo<X1, X0, X3, X2>( Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l))); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epi16(x, y); h = _mm_max_epi16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = _mm_unpacklo_epi16(l, h); y = _mm_unpackhi_epi16(l, h); return AVX::concat(x, y); } template <> Vc_CONST AVX2::ushort_v sorted<CurrentImplementation::current()>(AVX2::ushort_v x_) { // sort pairs (one min/max) auto x = AVX::lo128(x_.data()); auto y = AVX::hi128(x_.data()); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); auto l = _mm_min_epu16(x, y); auto h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); // merge left & right quads (two min/max) x = _mm_unpacklo_epi16(l, h); y = _mm_unpackhi_epi16(h, l); Vc_DEBUG << "8x2 sorted xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h)); y = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l)); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); // merge quads into octs (three min/max) x = _mm_unpacklo_epi16(h, l); y = _mm_unpackhi_epi16(l, h); Vc_DEBUG << "4x4 sorted xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::permuteLo<X2, X3, X0, X1>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(h, l)); y = Mem::permuteHi<X6, X7, X4, X5>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(l, h)); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h)); y = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l)); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h) << " done?"; // merge octs into hexa (four min/max) x = _mm_unpacklo_epi16(l, h); y = _mm_unpackhi_epi16(h, l); Vc_DEBUG << "2x8 sorted xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = _mm_unpacklo_epi64(l, h); y = _mm_unpackhi_epi64(l, h); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = _mm_castps_si128(Mem::permute<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(h), _mm_castsi128_ps(l)))); y = _mm_castps_si128(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(l), _mm_castsi128_ps(h))); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h); y = Mem::permuteLo<X1, X0, X3, X2>( Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l))); Vc_DEBUG << "xy: " << AVX::addType<short>(x) << AVX::addType<short>(y); l = _mm_min_epu16(x, y); h = _mm_max_epu16(x, y); Vc_DEBUG << "lh: " << AVX::addType<short>(l) << AVX::addType<short>(h); x = _mm_unpacklo_epi16(l, h); y = _mm_unpackhi_epi16(l, h); return AVX::concat(x, y); } template <> Vc_CONST AVX2::int_v sorted<CurrentImplementation::current()>(AVX2::int_v x_) { using namespace AVX; const __m256i hgfedcba = x_.data(); const __m128i hgfe = hi128(hgfedcba); const __m128i dcba = lo128(hgfedcba); __m128i l = _mm_min_epi32(hgfe, dcba); // ↓hd ↓gc ↓fb ↓ea __m128i h = _mm_max_epi32(hgfe, dcba); // ↑hd ↑gc ↑fb ↑ea __m128i x = _mm_unpacklo_epi32(l, h); // ↑fb ↓fb ↑ea ↓ea __m128i y = _mm_unpackhi_epi32(l, h); // ↑hd ↓hd ↑gc ↓gc l = _mm_min_epi32(x, y); // ↓(↑fb,↑hd) ↓hfdb ↓(↑ea,↑gc) ↓geca h = _mm_max_epi32(x, y); // ↑hfdb ↑(↓fb,↓hd) ↑geca ↑(↓ea,↓gc) x = _mm_min_epi32(l, Reg::permute<X2, X2, X0, X0>(h)); // 2(hfdb) 1(hfdb) 2(geca) 1(geca) y = _mm_max_epi32(h, Reg::permute<X3, X3, X1, X1>(l)); // 4(hfdb) 3(hfdb) 4(geca) 3(geca) __m128i b = Reg::shuffle<Y0, Y1, X0, X1>(y, x); // b3 <= b2 <= b1 <= b0 __m128i a = _mm_unpackhi_epi64(x, y); // a3 >= a2 >= a1 >= a0 // _mm_extract_epi32 may return an unsigned int, breaking these comparisons. if (Vc_IS_UNLIKELY(static_cast<int>(_mm_extract_epi32(x, 2)) >= static_cast<int>(_mm_extract_epi32(y, 1)))) { return concat(Reg::permute<X0, X1, X2, X3>(b), a); } else if (Vc_IS_UNLIKELY(static_cast<int>(_mm_extract_epi32(x, 0)) >= static_cast<int>(_mm_extract_epi32(y, 3)))) { return concat(a, Reg::permute<X0, X1, X2, X3>(b)); } // merge l = _mm_min_epi32(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0 h = _mm_max_epi32(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0 a = _mm_unpacklo_epi32(l, h); // ↑a1b1 ↓a1b1 ↑a0b0 ↓a0b0 b = _mm_unpackhi_epi32(l, h); // ↑a3b3 ↓a3b3 ↑a2b2 ↓a2b2 l = _mm_min_epi32(a, b); // ↓(↑a1b1,↑a3b3) ↓a1b3 ↓(↑a0b0,↑a2b2) ↓a0b2 h = _mm_max_epi32(a, b); // ↑a3b1 ↑(↓a1b1,↓a3b3) ↑a2b0 ↑(↓a0b0,↓a2b2) a = _mm_unpacklo_epi32(l, h); // ↑a2b0 ↓(↑a0b0,↑a2b2) ↑(↓a0b0,↓a2b2) ↓a0b2 b = _mm_unpackhi_epi32(l, h); // ↑a3b1 ↓(↑a1b1,↑a3b3) ↑(↓a1b1,↓a3b3) ↓a1b3 l = _mm_min_epi32(a, b); // ↓(↑a2b0,↑a3b1) ↓(↑a0b0,↑a2b2,↑a1b1,↑a3b3) ↓(↑(↓a0b0,↓a2b2) ↑(↓a1b1,↓a3b3)) ↓a0b3 h = _mm_max_epi32(a, b); // ↑a3b0 ↑(↓(↑a0b0,↑a2b2) ↓(↑a1b1,↑a3b3)) ↑(↓a0b0,↓a2b2,↓a1b1,↓a3b3) ↑(↓a0b2,↓a1b3) return concat(_mm_unpacklo_epi32(l, h), _mm_unpackhi_epi32(l, h)); } template <> Vc_CONST AVX2::uint_v sorted<CurrentImplementation::current()>(AVX2::uint_v x_) { using namespace AVX; const __m256i hgfedcba = x_.data(); const __m128i hgfe = hi128(hgfedcba); const __m128i dcba = lo128(hgfedcba); __m128i l = _mm_min_epu32(hgfe, dcba); // ↓hd ↓gc ↓fb ↓ea __m128i h = _mm_max_epu32(hgfe, dcba); // ↑hd ↑gc ↑fb ↑ea __m128i x = _mm_unpacklo_epi32(l, h); // ↑fb ↓fb ↑ea ↓ea __m128i y = _mm_unpackhi_epi32(l, h); // ↑hd ↓hd ↑gc ↓gc l = _mm_min_epu32(x, y); // ↓(↑fb,↑hd) ↓hfdb ↓(↑ea,↑gc) ↓geca h = _mm_max_epu32(x, y); // ↑hfdb ↑(↓fb,↓hd) ↑geca ↑(↓ea,↓gc) x = _mm_min_epu32(l, Reg::permute<X2, X2, X0, X0>(h)); // 2(hfdb) 1(hfdb) 2(geca) 1(geca) y = _mm_max_epu32(h, Reg::permute<X3, X3, X1, X1>(l)); // 4(hfdb) 3(hfdb) 4(geca) 3(geca) __m128i b = Reg::shuffle<Y0, Y1, X0, X1>(y, x); // b3 <= b2 <= b1 <= b0 __m128i a = _mm_unpackhi_epi64(x, y); // a3 >= a2 >= a1 >= a0 if (Vc_IS_UNLIKELY(extract_epu32<2>(x) >= extract_epu32<1>(y))) { return concat(Reg::permute<X0, X1, X2, X3>(b), a); } else if (Vc_IS_UNLIKELY(extract_epu32<0>(x) >= extract_epu32<3>(y))) { return concat(a, Reg::permute<X0, X1, X2, X3>(b)); } // merge l = _mm_min_epu32(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0 h = _mm_max_epu32(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0 a = _mm_unpacklo_epi32(l, h); // ↑a1b1 ↓a1b1 ↑a0b0 ↓a0b0 b = _mm_unpackhi_epi32(l, h); // ↑a3b3 ↓a3b3 ↑a2b2 ↓a2b2 l = _mm_min_epu32(a, b); // ↓(↑a1b1,↑a3b3) ↓a1b3 ↓(↑a0b0,↑a2b2) ↓a0b2 h = _mm_max_epu32(a, b); // ↑a3b1 ↑(↓a1b1,↓a3b3) ↑a2b0 ↑(↓a0b0,↓a2b2) a = _mm_unpacklo_epi32(l, h); // ↑a2b0 ↓(↑a0b0,↑a2b2) ↑(↓a0b0,↓a2b2) ↓a0b2 b = _mm_unpackhi_epi32(l, h); // ↑a3b1 ↓(↑a1b1,↑a3b3) ↑(↓a1b1,↓a3b3) ↓a1b3 l = _mm_min_epu32(a, b); // ↓(↑a2b0,↑a3b1) ↓(↑a0b0,↑a2b2,↑a1b1,↑a3b3) ↓(↑(↓a0b0,↓a2b2) ↑(↓a1b1,↓a3b3)) ↓a0b3 h = _mm_max_epu32(a, b); // ↑a3b0 ↑(↓(↑a0b0,↑a2b2) ↓(↑a1b1,↑a3b3)) ↑(↓a0b0,↓a2b2,↓a1b1,↓a3b3) ↑(↓a0b2,↓a1b3) return concat(_mm_unpacklo_epi32(l, h), _mm_unpackhi_epi32(l, h)); } #endif // AVX2 template <> Vc_CONST AVX2::float_v sorted<CurrentImplementation::current()>(AVX2::float_v x_) { __m256 hgfedcba = x_.data(); const __m128 hgfe = AVX::hi128(hgfedcba); const __m128 dcba = AVX::lo128(hgfedcba); __m128 l = _mm_min_ps(hgfe, dcba); // ↓hd ↓gc ↓fb ↓ea __m128 h = _mm_max_ps(hgfe, dcba); // ↑hd ↑gc ↑fb ↑ea __m128 x = _mm_unpacklo_ps(l, h); // ↑fb ↓fb ↑ea ↓ea __m128 y = _mm_unpackhi_ps(l, h); // ↑hd ↓hd ↑gc ↓gc l = _mm_min_ps(x, y); // ↓(↑fb,↑hd) ↓hfdb ↓(↑ea,↑gc) ↓geca h = _mm_max_ps(x, y); // ↑hfdb ↑(↓fb,↓hd) ↑geca ↑(↓ea,↓gc) x = _mm_min_ps(l, Reg::permute<X2, X2, X0, X0>(h)); // 2(hfdb) 1(hfdb) 2(geca) 1(geca) y = _mm_max_ps(h, Reg::permute<X3, X3, X1, X1>(l)); // 4(hfdb) 3(hfdb) 4(geca) 3(geca) __m128 a = _mm_castpd_ps(_mm_unpackhi_pd(_mm_castps_pd(x), _mm_castps_pd(y))); // a3 >= a2 >= a1 >= a0 __m128 b = Reg::shuffle<Y0, Y1, X0, X1>(y, x); // b3 <= b2 <= b1 <= b0 // merge l = _mm_min_ps(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0 h = _mm_max_ps(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0 a = _mm_unpacklo_ps(l, h); // ↑a1b1 ↓a1b1 ↑a0b0 ↓a0b0 b = _mm_unpackhi_ps(l, h); // ↑a3b3 ↓a3b3 ↑a2b2 ↓a2b2 l = _mm_min_ps(a, b); // ↓(↑a1b1,↑a3b3) ↓a1b3 ↓(↑a0b0,↑a2b2) ↓a0b2 h = _mm_max_ps(a, b); // ↑a3b1 ↑(↓a1b1,↓a3b3) ↑a2b0 ↑(↓a0b0,↓a2b2) a = _mm_unpacklo_ps(l, h); // ↑a2b0 ↓(↑a0b0,↑a2b2) ↑(↓a0b0,↓a2b2) ↓a0b2 b = _mm_unpackhi_ps(l, h); // ↑a3b1 ↓(↑a1b1,↑a3b3) ↑(↓a1b1,↓a3b3) ↓a1b3 l = _mm_min_ps(a, b); // ↓(↑a2b0,↑a3b1) ↓(↑a0b0,↑a2b2,↑a1b1,↑a3b3) ↓(↑(↓a0b0,↓a2b2),↑(↓a1b1,↓a3b3)) ↓a0b3 h = _mm_max_ps(a, b); // ↑a3b0 ↑(↓(↑a0b0,↑a2b2),↓(↑a1b1,↑a3b3)) ↑(↓a0b0,↓a2b2,↓a1b1,↓a3b3) ↑(↓a0b2,↓a1b3) return AVX::concat(_mm_unpacklo_ps(l, h), _mm_unpackhi_ps(l, h)); } #if 0 template<> void SortHelper<double>::sort(__m256d &Vc_RESTRICT x, __m256d &Vc_RESTRICT y) { __m256d l = _mm256_min_pd(x, y); // ↓x3y3 ↓x2y2 ↓x1y1 ↓x0y0 __m256d h = _mm256_max_pd(x, y); // ↑x3y3 ↑x2y2 ↑x1y1 ↑x0y0 x = _mm256_unpacklo_pd(l, h); // ↑x2y2 ↓x2y2 ↑x0y0 ↓x0y0 y = _mm256_unpackhi_pd(l, h); // ↑x3y3 ↓x3y3 ↑x1y1 ↓x1y1 l = _mm256_min_pd(x, y); // ↓(↑x2y2,↑x3y3) ↓x3x2y3y2 ↓(↑x0y0,↑x1y1) ↓x1x0y1y0 h = _mm256_max_pd(x, y); // ↑x3x2y3y2 ↑(↓x2y2,↓x3y3) ↑x1x0y1y0 ↑(↓x0y0,↓x1y1) x = _mm256_unpacklo_pd(l, h); // ↑(↓x2y2,↓x3y3) ↓x3x2y3y2 ↑(↓x0y0,↓x1y1) ↓x1x0y1y0 y = _mm256_unpackhi_pd(h, l); // ↓(↑x2y2,↑x3y3) ↑x3x2y3y2 ↓(↑x0y0,↑x1y1) ↑x1x0y1y0 l = _mm256_min_pd(x, y); // ↓(↑(↓x2y2,↓x3y3) ↓(↑x2y2,↑x3y3)) ↓x3x2y3y2 ↓(↑(↓x0y0,↓x1y1) ↓(↑x0y0,↑x1y1)) ↓x1x0y1y0 h = _mm256_max_pd(x, y); // ↑(↑(↓x2y2,↓x3y3) ↓(↑x2y2,↑x3y3)) ↑x3x2y3y2 ↑(↑(↓x0y0,↓x1y1) ↓(↑x0y0,↑x1y1)) ↑x1x0y1y0 __m256d a = Reg::permute<X2, X3, X1, X0>(Reg::permute128<X0, X1>(h, h)); // h0 h1 h3 h2 __m256d b = Reg::permute<X2, X3, X1, X0>(l); // l2 l3 l1 l0 // a3 >= a2 >= b1 >= b0 // b3 <= b2 <= a1 <= a0 // merge l = _mm256_min_pd(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0 h = _mm256_min_pd(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0 x = _mm256_unpacklo_pd(l, h); // ↑a2b2 ↓a2b2 ↑a0b0 ↓a0b0 y = _mm256_unpackhi_pd(l, h); // ↑a3b3 ↓a3b3 ↑a1b1 ↓a1b1 l = _mm256_min_pd(x, y); // ↓(↑a2b2,↑a3b3) ↓a2b3 ↓(↑a0b0,↑a1b1) ↓a1b0 h = _mm256_min_pd(x, y); // ↑a3b2 ↑(↓a2b2,↓a3b3) ↑a0b1 ↑(↓a0b0,↓a1b1) x = Reg::permute128<Y0, X0>(l, h); // ↑a0b1 ↑(↓a0b0,↓a1b1) ↓(↑a0b0,↑a1b1) ↓a1b0 y = Reg::permute128<Y1, X1>(l, h); // ↑a3b2 ↑(↓a2b2,↓a3b3) ↓(↑a2b2,↑a3b3) ↓a2b3 l = _mm256_min_pd(x, y); // ↓(↑a0b1,↑a3b2) ↓(↑(↓a0b0,↓a1b1) ↑(↓a2b2,↓a3b3)) ↓(↑a0b0,↑a1b1,↑a2b2,↑a3b3) ↓b0b3 h = _mm256_min_pd(x, y); // ↑a0a3 ↑(↓a0b0,↓a1b1,↓a2b2,↓a3b3) ↑(↓(↑a0b0,↑a1b1) ↓(↑a2b2,↑a3b3)) ↑(↓a1b0,↓a2b3) x = _mm256_unpacklo_pd(l, h); // h2 l2 h0 l0 y = _mm256_unpackhi_pd(l, h); // h3 l3 h1 l1 } #endif template <> Vc_CONST AVX2::double_v sorted<CurrentImplementation::current()>(AVX2::double_v x_) { __m256d dcba = x_.data(); /* * to find the second largest number find * max(min(max(ab),max(cd)), min(max(ad),max(bc))) * or * max(max(min(ab),min(cd)), min(max(ab),max(cd))) * const __m256d adcb = avx_cast<__m256d>(AVX::concat(_mm_alignr_epi8(avx_cast<__m128i>(dc), avx_cast<__m128i>(ba), 8), _mm_alignr_epi8(avx_cast<__m128i>(ba), avx_cast<__m128i>(dc), 8))); const __m256d l = _mm256_min_pd(dcba, adcb); // min(ad cd bc ab) const __m256d h = _mm256_max_pd(dcba, adcb); // max(ad cd bc ab) // max(h3, h1) // max(min(h0,h2), min(h3,h1)) // min(max(l0,l2), max(l3,l1)) // min(l3, l1) const __m256d ll = _mm256_min_pd(h, Reg::permute128<X0, X1>(h, h)); // min(h3h1 h2h0 h1h3 h0h2) //const __m256d hh = _mm256_max_pd(h3 ll1_3 l1 l0, h1 ll0_2 l3 l2); const __m256d hh = _mm256_max_pd( Reg::permute128<X1, Y0>(_mm256_unpackhi_pd(ll, h), l), Reg::permute128<X0, Y1>(_mm256_blend_pd(h ll, 0x1), l)); _mm256_min_pd(hh0, hh1 */ ////////////////////////////////////////////////////////////////////////////////// // max(max(ac), max(bd)) // max(max(min(ac),min(bd)), min(max(ac),max(bd))) // min(max(min(ac),min(bd)), min(max(ac),max(bd))) // min(min(ac), min(bd)) __m128d l = _mm_min_pd(AVX::lo128(dcba), AVX::hi128(dcba)); // min(bd) min(ac) __m128d h = _mm_max_pd(AVX::lo128(dcba), AVX::hi128(dcba)); // max(bd) max(ac) __m128d h0_l0 = _mm_unpacklo_pd(l, h); __m128d h1_l1 = _mm_unpackhi_pd(l, h); l = _mm_min_pd(h0_l0, h1_l1); h = _mm_max_pd(h0_l0, h1_l1); return AVX::concat( _mm_min_pd(l, Reg::permute<X0, X0>(h)), _mm_max_pd(h, Reg::permute<X1, X1>(l)) ); // extract: 1 cycle // min/max: 4 cycles // unpacklo/hi: 2 cycles // min/max: 4 cycles // permute: 1 cycle // min/max: 4 cycles // insert: 1 cycle // ---------------------- // total: 17 cycles /* __m256d cdab = Reg::permute<X2, X3, X0, X1>(dcba); __m256d l = _mm256_min_pd(dcba, cdab); __m256d h = _mm256_max_pd(dcba, cdab); __m256d maxmin_ba = Reg::permute128<X0, Y0>(l, h); __m256d maxmin_dc = Reg::permute128<X1, Y1>(l, h); l = _mm256_min_pd(maxmin_ba, maxmin_dc); h = _mm256_max_pd(maxmin_ba, maxmin_dc); return _mm256_blend_pd(h, l, 0x55); */ /* // a b c d // b a d c // sort pairs __m256d y, l, h; __m128d l2, h2; y = shuffle<X1, Y0, X3, Y2>(x, x); l = _mm256_min_pd(x, y); // min[ab ab cd cd] h = _mm256_max_pd(x, y); // max[ab ab cd cd] // 1 of 2 is at [0] // 1 of 4 is at [1] // 1 of 4 is at [2] // 1 of 2 is at [3] // don't be fooled by unpack here. It works differently for AVX pd than for SSE ps x = _mm256_unpacklo_pd(l, h); // l_ab h_ab l_cd h_cd l2 = _mm_min_pd(AVX::lo128(x), AVX::hi128(x)); // l_abcd l(h_ab hcd) h2 = _mm_max_pd(AVX::lo128(x), AVX::hi128(x)); // h(l_ab l_cd) h_abcd // either it is: return AVX::concat(l2, h2); // or: // AVX::concat(_mm_unpacklo_pd(l2, h2), _mm_unpackhi_pd(l2, h2)); // I'd like to have four useful compares const __m128d dc = AVX::hi128(dcba); const __m128d ba = AVX::lo128(dcba); const __m256d adcb = avx_cast<__m256d>(AVX::concat(_mm_alignr_epi8(avx_cast<__m128i>(dc), avx_cast<__m128i>(ba), 8), _mm_alignr_epi8(avx_cast<__m128i>(ba), avx_cast<__m128i>(dc), 8))); const int extraCmp = _mm_movemask_pd(_mm_cmpgt_pd(dc, ba)); // 0x0: d <= b && c <= a // 0x1: d <= b && c > a // 0x2: d > b && c <= a // 0x3: d > b && c > a switch (_mm256_movemask_pd(_mm256_cmpgt_pd(dcba, adcb))) { // impossible: 0x0, 0xf case 0x1: // a <= b && b <= c && c <= d && d > a // abcd return Reg::permute<X2, X3, X0, X1>(Reg::permute<X0, X1>(dcba, dcba)); case 0x2: // a <= b && b <= c && c > d && d <= a // dabc return Reg::permute<X2, X3, X0, X1>(adcb); case 0x3: // a <= b && b <= c && c > d && d > a // a[bd]c if (extraCmp & 2) { // abdc return Reg::permute<X2, X3, X1, X0>(Reg::permute<X0, X1>(dcba, dcba)); } else { // adbc return Reg::permute<X3, X2, X0, X1>(adcb); } case 0x4: // a <= b && b > c && c <= d && d <= a // cdab; return Reg::permute<X2, X3, X0, X1>(dcba); case 0x5: // a <= b && b > c && c <= d && d > a // [ac] < [bd] switch (extraCmp) { case 0x0: // d <= b && c <= a // cadb return shuffle<>(dcba, bcda); case 0x1: // d <= b && c > a case 0x2: // d > b && c <= a case 0x3: // d > b && c > a } case 0x6: // a <= b && b > c && c > d && d <= a // d[ac]b case 0x7: // a <= b && b > c && c > d && d > a // adcb; return permute<X1, X0, X3, X2>(permute128<X1, X0>(bcda, bcda)); case 0x8: // a > b && b <= c && c <= d && d <= a return bcda; case 0x9: // a > b && b <= c && c <= d && d > a // b[ac]d; case 0xa: // a > b && b <= c && c > d && d <= a // [ac] > [bd] case 0xb: // a > b && b <= c && c > d && d > a // badc; return permute128<X1, X0>(dcba); case 0xc: // a > b && b > c && c <= d && d <= a // c[bd]a; case 0xd: // a > b && b > c && c <= d && d > a // cbad; return permute<X1, X0, X3, X2>(bcda); case 0xe: // a > b && b > c && c > d && d <= a return dcba; } */ } } // namespace Detail } // namespace Vc // vim: foldmethod=marker
chr-engwer/Vc
src/avx_sorthelper.cpp
C++
bsd-3-clause
25,912
 /// <reference path="../lib/types.d.ts" /> import utils = require('../lib/utils'); import file = require('../lib/FileUtil'); import childProcess = require("child_process"); export function buildRunEmulate(callback: (code: number) => void) { exec(egret.args.command, [egret.args.platform], callback); } function exec(command: string, params: string[], callback: Function) { var cdvProcess = childProcess.exec(`cordova ${command} ${params.join(' ')}`, {}, (e, stdout, stdin) => { console.log(e) }); cdvProcess.stdout.on("data", data=> console.log("/"+data)); cdvProcess.stderr.on("data", data=> console.log("/"+data)); cdvProcess.on("close", code=> callback(code)); cdvProcess.on("error", (ee) => console.log("error when build", ee)); }
Lanfei/egret-core
tools/actions/Cordova.ts
TypeScript
bsd-3-clause
767
<?php class ObjectPath { static protected $type = array(0=>'main'); static function getType() { return self::$type; } } print_r(ObjectPath::getType()); $object_type = array_pop((ObjectPath::getType())); print_r(ObjectPath::getType()); ?>
JSchwehn/php
testdata/fuzzdir/corpus/Zend_tests_bug35393.php
PHP
bsd-3-clause
263
<?php Yii::import('application.modules.store.models.StoreCategory'); /** * Class CategoryWidget * * <pre> * <?php * $this->widget('application.modules.store.widgets.CategoryWidget'); * ?> * </pre> */ class CategoryWidget extends yupe\widgets\YWidget { public $parent = 0; public $depth = 1; public $view = 'category-widget'; public $htmlOptions = []; public function run() { $this->render($this->view, [ 'tree' => (new StoreCategory())->getMenuList($this->depth, $this->parent), 'htmlOptions' => $this->htmlOptions ]); } }
RonLab1987/43berega
protected/modules/store/widgets/CategoryWidget.php
PHP
bsd-3-clause
609
import os import cStringIO as StringIO git_binary = "git" verbose_mode = False try: from subprocess import Popen, PIPE def run_cmd(cmd): p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) return p.stdin, p.stdout, p.stderr except ImportError: def run_cmd(cmd): return os.popen3(self._cmd) class GitData (object): def __init__(self, location, command_string): self._cmd = "%s %s" % (git_binary, command_string) self._location = location self._data = None def open(self): if verbose_mode: print " >> %s" % (self._cmd) cwd = os.getcwd() os.chdir(self._location) self._in, self._data, self._err = run_cmd(self._cmd) self._read = 0 os.chdir(cwd) def tell(self): return self._read def read(self, l=-1): if self._data is None: self.open() data = self._data.read(l) self._read += len(data) return data def write(self, data): if self._data is None: self.open() self._in.write(data) def flush(self): if self._data is not None: self._in.flush() def close_stdin(self): if self._data is not None: self._in.close() def close(self): if self._data is not None: self._in.close() self._data.close() self._err.close() self._data = None def reopen(self): self.close() self.open() class FakeData (object): def __init__(self, data): self._data = data self._string = None def open(self): self._string = StringIO.StringIO(self._data) def read(self, l=-1): if self._string is None: self.open() return self._string.read(l) def close(self): if self._string is not None: self._string.close() self._string = None def reopen(self): self.close() self.open()
slonopotamus/git_svn_server
GitSvnServer/vcs/git/data.py
Python
bsd-3-clause
2,086
/* * Copyright LWJGL. All rights reserved. * License terms: https://www.lwjgl.org/license * MACHINE GENERATED FILE, DO NOT EDIT */ package org.lwjgl.opengl; import javax.annotation.*; import java.nio.*; import org.lwjgl.system.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; import static org.lwjgl.system.MemoryStack.*; import static org.lwjgl.system.MemoryUtil.*; /** * Native bindings to the <a target="_blank" href="https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_performance_monitor.txt">AMD_performance_monitor</a> extension. * * <p>This extension enables the capture and reporting of performance monitors. Performance monitors contain groups of counters which hold arbitrary counted * data. Typically, the counters hold information on performance-related counters in the underlying hardware. The extension is general enough to allow the * implementation to choose which counters to expose and pick the data type and range of the counters. The extension also allows counting to start and end * on arbitrary boundaries during rendering.</p> */ public class AMDPerformanceMonitor { static { GL.initialize(); } /** Accepted by the {@code pame} parameter of GetPerfMonitorCounterInfoAMD. */ public static final int GL_COUNTER_TYPE_AMD = 0x8BC0, GL_COUNTER_RANGE_AMD = 0x8BC1; /** Returned as a valid value in {@code data} parameter of GetPerfMonitorCounterInfoAMD if {@code pname} = COUNTER_TYPE_AMD. */ public static final int GL_UNSIGNED_INT64_AMD = 0x8BC2, GL_PERCENTAGE_AMD = 0x8BC3; /** Accepted by the {@code pname} parameter of GetPerfMonitorCounterDataAMD. */ public static final int GL_PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4, GL_PERFMON_RESULT_SIZE_AMD = 0x8BC5, GL_PERFMON_RESULT_AMD = 0x8BC6; protected AMDPerformanceMonitor() { throw new UnsupportedOperationException(); } // --- [ glGetPerfMonitorGroupsAMD ] --- public static native void nglGetPerfMonitorGroupsAMD(long numGroups, int groupsSize, long groups); public static void glGetPerfMonitorGroupsAMD(@Nullable @NativeType("GLint *") IntBuffer numGroups, @Nullable @NativeType("GLuint *") IntBuffer groups) { if (CHECKS) { checkSafe(numGroups, 1); } nglGetPerfMonitorGroupsAMD(memAddressSafe(numGroups), remainingSafe(groups), memAddressSafe(groups)); } // --- [ glGetPerfMonitorCountersAMD ] --- public static native void nglGetPerfMonitorCountersAMD(int group, long numCounters, long maxActiveCounters, int counterSize, long counters); public static void glGetPerfMonitorCountersAMD(@NativeType("GLuint") int group, @NativeType("GLint *") IntBuffer numCounters, @NativeType("GLint *") IntBuffer maxActiveCounters, @NativeType("GLuint *") IntBuffer counters) { if (CHECKS) { check(numCounters, 1); check(maxActiveCounters, 1); } nglGetPerfMonitorCountersAMD(group, memAddress(numCounters), memAddress(maxActiveCounters), counters.remaining(), memAddress(counters)); } // --- [ glGetPerfMonitorGroupStringAMD ] --- public static native void nglGetPerfMonitorGroupStringAMD(int group, int bufSize, long length, long groupString); public static void glGetPerfMonitorGroupStringAMD(@NativeType("GLuint") int group, @NativeType("GLsizei *") IntBuffer length, @NativeType("GLchar *") ByteBuffer groupString) { if (CHECKS) { check(length, 1); } nglGetPerfMonitorGroupStringAMD(group, groupString.remaining(), memAddress(length), memAddress(groupString)); } // --- [ glGetPerfMonitorCounterStringAMD ] --- public static native void nglGetPerfMonitorCounterStringAMD(int group, int counter, int bufSize, long length, long counterString); public static void glGetPerfMonitorCounterStringAMD(@NativeType("GLuint") int group, @NativeType("GLuint") int counter, @Nullable @NativeType("GLsizei *") IntBuffer length, @Nullable @NativeType("GLchar *") ByteBuffer counterString) { if (CHECKS) { checkSafe(length, 1); } nglGetPerfMonitorCounterStringAMD(group, counter, remainingSafe(counterString), memAddressSafe(length), memAddressSafe(counterString)); } // --- [ glGetPerfMonitorCounterInfoAMD ] --- public static native void nglGetPerfMonitorCounterInfoAMD(int group, int counter, int pname, long data); public static void glGetPerfMonitorCounterInfoAMD(@NativeType("GLuint") int group, @NativeType("GLuint") int counter, @NativeType("GLenum") int pname, @NativeType("void *") ByteBuffer data) { if (CHECKS) { check(data, 4); } nglGetPerfMonitorCounterInfoAMD(group, counter, pname, memAddress(data)); } public static void glGetPerfMonitorCounterInfoAMD(@NativeType("GLuint") int group, @NativeType("GLuint") int counter, @NativeType("GLenum") int pname, @NativeType("void *") IntBuffer data) { if (CHECKS) { check(data, 4 >> 2); } nglGetPerfMonitorCounterInfoAMD(group, counter, pname, memAddress(data)); } public static void glGetPerfMonitorCounterInfoAMD(@NativeType("GLuint") int group, @NativeType("GLuint") int counter, @NativeType("GLenum") int pname, @NativeType("void *") FloatBuffer data) { if (CHECKS) { check(data, 4 >> 2); } nglGetPerfMonitorCounterInfoAMD(group, counter, pname, memAddress(data)); } // --- [ glGenPerfMonitorsAMD ] --- public static native void nglGenPerfMonitorsAMD(int n, long monitors); public static void glGenPerfMonitorsAMD(@NativeType("GLuint *") IntBuffer monitors) { nglGenPerfMonitorsAMD(monitors.remaining(), memAddress(monitors)); } @NativeType("void") public static int glGenPerfMonitorsAMD() { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { IntBuffer monitors = stack.callocInt(1); nglGenPerfMonitorsAMD(1, memAddress(monitors)); return monitors.get(0); } finally { stack.setPointer(stackPointer); } } // --- [ glDeletePerfMonitorsAMD ] --- public static native void nglDeletePerfMonitorsAMD(int n, long monitors); public static void glDeletePerfMonitorsAMD(@NativeType("GLuint *") IntBuffer monitors) { nglDeletePerfMonitorsAMD(monitors.remaining(), memAddress(monitors)); } public static void glDeletePerfMonitorsAMD(@NativeType("GLuint *") int monitor) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { IntBuffer monitors = stack.ints(monitor); nglDeletePerfMonitorsAMD(1, memAddress(monitors)); } finally { stack.setPointer(stackPointer); } } // --- [ glSelectPerfMonitorCountersAMD ] --- public static native void nglSelectPerfMonitorCountersAMD(int monitor, boolean enable, int group, int numCounters, long counterList); public static void glSelectPerfMonitorCountersAMD(@NativeType("GLuint") int monitor, @NativeType("GLboolean") boolean enable, @NativeType("GLuint") int group, @NativeType("GLuint *") IntBuffer counterList) { nglSelectPerfMonitorCountersAMD(monitor, enable, group, counterList.remaining(), memAddress(counterList)); } // --- [ glBeginPerfMonitorAMD ] --- public static native void glBeginPerfMonitorAMD(@NativeType("GLuint") int monitor); // --- [ glEndPerfMonitorAMD ] --- public static native void glEndPerfMonitorAMD(@NativeType("GLuint") int monitor); // --- [ glGetPerfMonitorCounterDataAMD ] --- public static native void nglGetPerfMonitorCounterDataAMD(int monitor, int pname, int dataSize, long data, long bytesWritten); public static void glGetPerfMonitorCounterDataAMD(@NativeType("GLuint") int monitor, @NativeType("GLenum") int pname, @NativeType("GLuint *") IntBuffer data, @Nullable @NativeType("GLint *") IntBuffer bytesWritten) { if (CHECKS) { checkSafe(bytesWritten, 1); } nglGetPerfMonitorCounterDataAMD(monitor, pname, data.remaining(), memAddress(data), memAddressSafe(bytesWritten)); } /** Array version of: {@link #glGetPerfMonitorGroupsAMD GetPerfMonitorGroupsAMD} */ public static void glGetPerfMonitorGroupsAMD(@Nullable @NativeType("GLint *") int[] numGroups, @Nullable @NativeType("GLuint *") int[] groups) { long __functionAddress = GL.getICD().glGetPerfMonitorGroupsAMD; if (CHECKS) { check(__functionAddress); checkSafe(numGroups, 1); } callPPV(numGroups, lengthSafe(groups), groups, __functionAddress); } /** Array version of: {@link #glGetPerfMonitorCountersAMD GetPerfMonitorCountersAMD} */ public static void glGetPerfMonitorCountersAMD(@NativeType("GLuint") int group, @NativeType("GLint *") int[] numCounters, @NativeType("GLint *") int[] maxActiveCounters, @NativeType("GLuint *") int[] counters) { long __functionAddress = GL.getICD().glGetPerfMonitorCountersAMD; if (CHECKS) { check(__functionAddress); check(numCounters, 1); check(maxActiveCounters, 1); } callPPPV(group, numCounters, maxActiveCounters, counters.length, counters, __functionAddress); } /** Array version of: {@link #glGetPerfMonitorGroupStringAMD GetPerfMonitorGroupStringAMD} */ public static void glGetPerfMonitorGroupStringAMD(@NativeType("GLuint") int group, @NativeType("GLsizei *") int[] length, @NativeType("GLchar *") ByteBuffer groupString) { long __functionAddress = GL.getICD().glGetPerfMonitorGroupStringAMD; if (CHECKS) { check(__functionAddress); check(length, 1); } callPPV(group, groupString.remaining(), length, memAddress(groupString), __functionAddress); } /** Array version of: {@link #glGetPerfMonitorCounterStringAMD GetPerfMonitorCounterStringAMD} */ public static void glGetPerfMonitorCounterStringAMD(@NativeType("GLuint") int group, @NativeType("GLuint") int counter, @Nullable @NativeType("GLsizei *") int[] length, @Nullable @NativeType("GLchar *") ByteBuffer counterString) { long __functionAddress = GL.getICD().glGetPerfMonitorCounterStringAMD; if (CHECKS) { check(__functionAddress); checkSafe(length, 1); } callPPV(group, counter, remainingSafe(counterString), length, memAddressSafe(counterString), __functionAddress); } /** Array version of: {@link #glGetPerfMonitorCounterInfoAMD GetPerfMonitorCounterInfoAMD} */ public static void glGetPerfMonitorCounterInfoAMD(@NativeType("GLuint") int group, @NativeType("GLuint") int counter, @NativeType("GLenum") int pname, @NativeType("void *") int[] data) { long __functionAddress = GL.getICD().glGetPerfMonitorCounterInfoAMD; if (CHECKS) { check(__functionAddress); check(data, 4 >> 2); } callPV(group, counter, pname, data, __functionAddress); } /** Array version of: {@link #glGetPerfMonitorCounterInfoAMD GetPerfMonitorCounterInfoAMD} */ public static void glGetPerfMonitorCounterInfoAMD(@NativeType("GLuint") int group, @NativeType("GLuint") int counter, @NativeType("GLenum") int pname, @NativeType("void *") float[] data) { long __functionAddress = GL.getICD().glGetPerfMonitorCounterInfoAMD; if (CHECKS) { check(__functionAddress); check(data, 4 >> 2); } callPV(group, counter, pname, data, __functionAddress); } /** Array version of: {@link #glGenPerfMonitorsAMD GenPerfMonitorsAMD} */ public static void glGenPerfMonitorsAMD(@NativeType("GLuint *") int[] monitors) { long __functionAddress = GL.getICD().glGenPerfMonitorsAMD; if (CHECKS) { check(__functionAddress); } callPV(monitors.length, monitors, __functionAddress); } /** Array version of: {@link #glDeletePerfMonitorsAMD DeletePerfMonitorsAMD} */ public static void glDeletePerfMonitorsAMD(@NativeType("GLuint *") int[] monitors) { long __functionAddress = GL.getICD().glDeletePerfMonitorsAMD; if (CHECKS) { check(__functionAddress); } callPV(monitors.length, monitors, __functionAddress); } /** Array version of: {@link #glSelectPerfMonitorCountersAMD SelectPerfMonitorCountersAMD} */ public static void glSelectPerfMonitorCountersAMD(@NativeType("GLuint") int monitor, @NativeType("GLboolean") boolean enable, @NativeType("GLuint") int group, @NativeType("GLuint *") int[] counterList) { long __functionAddress = GL.getICD().glSelectPerfMonitorCountersAMD; if (CHECKS) { check(__functionAddress); } callPV(monitor, enable, group, counterList.length, counterList, __functionAddress); } /** Array version of: {@link #glGetPerfMonitorCounterDataAMD GetPerfMonitorCounterDataAMD} */ public static void glGetPerfMonitorCounterDataAMD(@NativeType("GLuint") int monitor, @NativeType("GLenum") int pname, @NativeType("GLuint *") int[] data, @Nullable @NativeType("GLint *") int[] bytesWritten) { long __functionAddress = GL.getICD().glGetPerfMonitorCounterDataAMD; if (CHECKS) { check(__functionAddress); checkSafe(bytesWritten, 1); } callPPV(monitor, pname, data.length, data, bytesWritten, __functionAddress); } }
LWJGL-CI/lwjgl3
modules/lwjgl/opengl/src/generated/java/org/lwjgl/opengl/AMDPerformanceMonitor.java
Java
bsd-3-clause
13,606
<?php /** * @see https://github.com/zendframework/zend-uri for the canonical source repository * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com) * @license https://github.com/zendframework/zend-uri/blob/master/LICENSE.md New BSD License */ namespace Zend\Uri; /** * URI Factory Class * * The URI factory can be used to generate URI objects from strings, using a * different URI subclass depending on the input URI scheme. New scheme-specific * classes can be registered using the registerScheme() method. * * Note that this class contains only static methods and should not be * instantiated */ abstract class UriFactory { /** * Registered scheme-specific classes * * @var array */ protected static $schemeClasses = [ 'http' => 'Zend\Uri\Http', 'https' => 'Zend\Uri\Http', 'mailto' => 'Zend\Uri\Mailto', 'file' => 'Zend\Uri\File', 'urn' => 'Zend\Uri\Uri', 'tag' => 'Zend\Uri\Uri', ]; /** * Register a scheme-specific class to be used * * @param string $scheme * @param string $class */ public static function registerScheme($scheme, $class) { $scheme = strtolower($scheme); static::$schemeClasses[$scheme] = $class; } /** * Unregister a scheme * * @param string $scheme */ public static function unregisterScheme($scheme) { $scheme = strtolower($scheme); if (isset(static::$schemeClasses[$scheme])) { unset(static::$schemeClasses[$scheme]); } } /** * Get the class name for a registered scheme * * If provided scheme is not registered, will return NULL * * @param string $scheme * @return string|null */ public static function getRegisteredSchemeClass($scheme) { if (isset(static::$schemeClasses[$scheme])) { return static::$schemeClasses[$scheme]; } return; } /** * Create a URI from a string * * @param string $uriString * @param string $defaultScheme * @throws Exception\InvalidArgumentException * @return \Zend\Uri\Uri */ public static function factory($uriString, $defaultScheme = null) { if (! is_string($uriString)) { throw new Exception\InvalidArgumentException(sprintf( 'Expecting a string, received "%s"', (is_object($uriString) ? get_class($uriString) : gettype($uriString)) )); } $uri = new Uri($uriString); $scheme = strtolower($uri->getScheme()); if (! $scheme && $defaultScheme) { $scheme = $defaultScheme; } if ($scheme && ! isset(static::$schemeClasses[$scheme])) { throw new Exception\InvalidArgumentException(sprintf( 'no class registered for scheme "%s"', $scheme )); } if ($scheme && isset(static::$schemeClasses[$scheme])) { $class = static::$schemeClasses[$scheme]; $uri = new $class($uri); if (! $uri instanceof UriInterface) { throw new Exception\InvalidArgumentException( sprintf( 'class "%s" registered for scheme "%s" does not implement Zend\Uri\UriInterface', $class, $scheme ) ); } } return $uri; } }
rongeb/anit_cms_for_zf3
vendor/zendframework/zend-uri/src/UriFactory.php
PHP
bsd-3-clause
3,567
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/background_sync/background_sync_manager.h" #include "base/barrier_closure.h" #include "base/bind.h" #include "base/location.h" #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" #include "content/browser/background_sync/background_sync_metrics.h" #include "content/browser/background_sync/background_sync_network_observer.h" #include "content/browser/background_sync/background_sync_power_observer.h" #include "content/browser/background_sync/background_sync_registration_handle.h" #include "content/browser/background_sync/background_sync_registration_options.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_storage.h" #include "content/public/browser/browser_thread.h" #if defined(OS_ANDROID) #include "content/browser/android/background_sync_launcher_android.h" #endif namespace content { class BackgroundSyncManager::RefCountedRegistration : public base::RefCounted<RefCountedRegistration> { public: BackgroundSyncRegistration* value() { return &registration_; } const BackgroundSyncRegistration* value() const { return &registration_; } private: friend class base::RefCounted<RefCountedRegistration>; ~RefCountedRegistration() = default; BackgroundSyncRegistration registration_; }; namespace { const char kBackgroundSyncUserDataKey[] = "BackgroundSyncUserData"; void PostErrorResponse( BackgroundSyncStatus status, const BackgroundSyncManager::StatusAndRegistrationCallback& callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind( callback, status, base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>().Pass()))); } } // namespace BackgroundSyncManager::BackgroundSyncRegistrations:: BackgroundSyncRegistrations() : next_id(BackgroundSyncRegistration::kInitialId) { } BackgroundSyncManager::BackgroundSyncRegistrations:: ~BackgroundSyncRegistrations() { } // static scoped_ptr<BackgroundSyncManager> BackgroundSyncManager::Create( const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) { DCHECK_CURRENTLY_ON(BrowserThread::IO); BackgroundSyncManager* sync_manager = new BackgroundSyncManager(service_worker_context); sync_manager->Init(); return make_scoped_ptr(sync_manager); } BackgroundSyncManager::~BackgroundSyncManager() { DCHECK_CURRENTLY_ON(BrowserThread::IO); service_worker_context_->RemoveObserver(this); } BackgroundSyncManager::RegistrationKey::RegistrationKey( const BackgroundSyncRegistration& registration) : RegistrationKey(registration.options()->tag, registration.options()->periodicity) { } BackgroundSyncManager::RegistrationKey::RegistrationKey( const BackgroundSyncRegistrationOptions& options) : RegistrationKey(options.tag, options.periodicity) { } BackgroundSyncManager::RegistrationKey::RegistrationKey( const std::string& tag, SyncPeriodicity periodicity) : value_(periodicity == SYNC_ONE_SHOT ? "o_" + tag : "p_" + tag) { } void BackgroundSyncManager::Register( int64 sw_registration_id, const BackgroundSyncRegistrationOptions& options, bool requested_from_service_worker, const StatusAndRegistrationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // For UMA, determine here whether the sync could fire immediately BackgroundSyncMetrics::RegistrationCouldFire registration_could_fire = AreOptionConditionsMet(options) ? BackgroundSyncMetrics::REGISTRATION_COULD_FIRE : BackgroundSyncMetrics::REGISTRATION_COULD_NOT_FIRE; if (disabled_) { BackgroundSyncMetrics::CountRegister( options.periodicity, registration_could_fire, BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); PostErrorResponse(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback); return; } op_scheduler_.ScheduleOperation(base::Bind( &BackgroundSyncManager::RegisterImpl, weak_ptr_factory_.GetWeakPtr(), sw_registration_id, options, requested_from_service_worker, MakeStatusAndRegistrationCompletion(callback))); } void BackgroundSyncManager::GetRegistration( int64 sw_registration_id, const std::string& sync_registration_tag, SyncPeriodicity periodicity, const StatusAndRegistrationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { PostErrorResponse(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback); return; } RegistrationKey registration_key(sync_registration_tag, periodicity); op_scheduler_.ScheduleOperation(base::Bind( &BackgroundSyncManager::GetRegistrationImpl, weak_ptr_factory_.GetWeakPtr(), sw_registration_id, registration_key, MakeStatusAndRegistrationCompletion(callback))); } void BackgroundSyncManager::GetRegistrations( int64 sw_registration_id, SyncPeriodicity periodicity, const StatusAndRegistrationsCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind( callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, base::Passed( scoped_ptr<ScopedVector<BackgroundSyncRegistrationHandle>>() .Pass()))); return; } op_scheduler_.ScheduleOperation( base::Bind(&BackgroundSyncManager::GetRegistrationsImpl, weak_ptr_factory_.GetWeakPtr(), sw_registration_id, periodicity, MakeStatusAndRegistrationsCompletion(callback))); } // Given a HandleId |handle_id|, return a new handle for the same // registration. scoped_ptr<BackgroundSyncRegistrationHandle> BackgroundSyncManager::DuplicateRegistrationHandle( BackgroundSyncRegistrationHandle::HandleId handle_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); scoped_refptr<RefCountedRegistration>* ref_registration = registration_handle_ids_.Lookup(handle_id); if (!ref_registration) return scoped_ptr<BackgroundSyncRegistrationHandle>(); return CreateRegistrationHandle(ref_registration->get()); } void BackgroundSyncManager::OnRegistrationDeleted(int64 registration_id, const GURL& pattern) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // Operations already in the queue will either fail when they write to storage // or return stale results based on registrations loaded in memory. This is // inconsequential since the service worker is gone. op_scheduler_.ScheduleOperation(base::Bind( &BackgroundSyncManager::OnRegistrationDeletedImpl, weak_ptr_factory_.GetWeakPtr(), registration_id, MakeEmptyCompletion())); } void BackgroundSyncManager::OnStorageWiped() { DCHECK_CURRENTLY_ON(BrowserThread::IO); // Operations already in the queue will either fail when they write to storage // or return stale results based on registrations loaded in memory. This is // inconsequential since the service workers are gone. op_scheduler_.ScheduleOperation( base::Bind(&BackgroundSyncManager::OnStorageWipedImpl, weak_ptr_factory_.GetWeakPtr(), MakeEmptyCompletion())); } BackgroundSyncManager::BackgroundSyncManager( const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) : service_worker_context_(service_worker_context), disabled_(false), weak_ptr_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::IO); service_worker_context_->AddObserver(this); network_observer_.reset(new BackgroundSyncNetworkObserver( base::Bind(&BackgroundSyncManager::OnNetworkChanged, weak_ptr_factory_.GetWeakPtr()))); power_observer_.reset(new BackgroundSyncPowerObserver(base::Bind( &BackgroundSyncManager::OnPowerChanged, weak_ptr_factory_.GetWeakPtr()))); } void BackgroundSyncManager::Init() { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(!op_scheduler_.ScheduledOperations()); DCHECK(!disabled_); op_scheduler_.ScheduleOperation(base::Bind(&BackgroundSyncManager::InitImpl, weak_ptr_factory_.GetWeakPtr(), MakeEmptyCompletion())); } void BackgroundSyncManager::InitImpl(const base::Closure& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); return; } GetDataFromBackend( kBackgroundSyncUserDataKey, base::Bind(&BackgroundSyncManager::InitDidGetDataFromBackend, weak_ptr_factory_.GetWeakPtr(), callback)); } void BackgroundSyncManager::InitDidGetDataFromBackend( const base::Closure& callback, const std::vector<std::pair<int64, std::string>>& user_data, ServiceWorkerStatusCode status) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (status != SERVICE_WORKER_OK && status != SERVICE_WORKER_ERROR_NOT_FOUND) { LOG(ERROR) << "BackgroundSync failed to init due to backend failure."; DisableAndClearManager(base::Bind(callback)); return; } bool corruption_detected = false; for (const std::pair<int64, std::string>& data : user_data) { BackgroundSyncRegistrationsProto registrations_proto; if (registrations_proto.ParseFromString(data.second)) { BackgroundSyncRegistrations* registrations = &active_registrations_[data.first]; registrations->next_id = registrations_proto.next_registration_id(); registrations->origin = GURL(registrations_proto.origin()); for (int i = 0, max = registrations_proto.registration_size(); i < max; ++i) { const BackgroundSyncRegistrationProto& registration_proto = registrations_proto.registration(i); if (registration_proto.id() >= registrations->next_id) { corruption_detected = true; break; } RegistrationKey registration_key(registration_proto.tag(), registration_proto.periodicity()); scoped_refptr<RefCountedRegistration> ref_registration( new RefCountedRegistration()); registrations->registration_map[registration_key] = ref_registration; BackgroundSyncRegistration* registration = ref_registration->value(); BackgroundSyncRegistrationOptions* options = registration->options(); options->tag = registration_proto.tag(); options->periodicity = registration_proto.periodicity(); options->min_period = registration_proto.min_period(); options->network_state = registration_proto.network_state(); options->power_state = registration_proto.power_state(); registration->set_id(registration_proto.id()); registration->set_sync_state(registration_proto.sync_state()); if (registration->sync_state() == SYNC_STATE_FIRING) { // If the browser (or worker) closed while firing the event, consider // it pending again> registration->set_sync_state(SYNC_STATE_PENDING); } } } if (corruption_detected) break; } if (corruption_detected) { LOG(ERROR) << "Corruption detected in background sync backend"; DisableAndClearManager(base::Bind(callback)); return; } FireReadyEvents(); base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); } void BackgroundSyncManager::RegisterImpl( int64 sw_registration_id, const BackgroundSyncRegistrationOptions& options, bool requested_from_service_worker, const StatusAndRegistrationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // For UMA, determine here whether the sync could fire immediately BackgroundSyncMetrics::RegistrationCouldFire registration_could_fire = AreOptionConditionsMet(options) ? BackgroundSyncMetrics::REGISTRATION_COULD_FIRE : BackgroundSyncMetrics::REGISTRATION_COULD_NOT_FIRE; if (disabled_) { BackgroundSyncMetrics::CountRegister( options.periodicity, registration_could_fire, BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); PostErrorResponse(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback); return; } ServiceWorkerRegistration* sw_registration = service_worker_context_->GetLiveRegistration(sw_registration_id); if (!sw_registration || !sw_registration->active_version()) { BackgroundSyncMetrics::CountRegister( options.periodicity, registration_could_fire, BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE, BACKGROUND_SYNC_STATUS_NO_SERVICE_WORKER); PostErrorResponse(BACKGROUND_SYNC_STATUS_NO_SERVICE_WORKER, callback); return; } if (requested_from_service_worker && !sw_registration->active_version()->HasWindowClients()) { PostErrorResponse(BACKGROUND_SYNC_STATUS_NOT_ALLOWED, callback); return; } RefCountedRegistration* existing_registration_ref = LookupActiveRegistration(sw_registration_id, RegistrationKey(options)); if (existing_registration_ref && existing_registration_ref->value()->options()->Equals(options)) { BackgroundSyncRegistration* existing_registration = existing_registration_ref->value(); if (existing_registration->sync_state() == SYNC_STATE_FAILED) { existing_registration->set_sync_state(SYNC_STATE_PENDING); StoreRegistrations( sw_registration_id, base::Bind(&BackgroundSyncManager::RegisterDidStore, weak_ptr_factory_.GetWeakPtr(), sw_registration_id, make_scoped_refptr(existing_registration_ref), callback)); return; } // Record the duplicated registration BackgroundSyncMetrics::CountRegister( existing_registration->options()->periodicity, registration_could_fire, BackgroundSyncMetrics::REGISTRATION_IS_DUPLICATE, BACKGROUND_SYNC_STATUS_OK); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind( callback, BACKGROUND_SYNC_STATUS_OK, base::Passed( CreateRegistrationHandle(existing_registration_ref).Pass()))); return; } scoped_refptr<RefCountedRegistration> new_ref_registration( new RefCountedRegistration()); BackgroundSyncRegistration* new_registration = new_ref_registration->value(); *new_registration->options() = options; BackgroundSyncRegistrations* registrations = &active_registrations_[sw_registration_id]; new_registration->set_id(registrations->next_id++); AddActiveRegistration(sw_registration_id, sw_registration->pattern().GetOrigin(), new_ref_registration); StoreRegistrations( sw_registration_id, base::Bind(&BackgroundSyncManager::RegisterDidStore, weak_ptr_factory_.GetWeakPtr(), sw_registration_id, new_ref_registration, callback)); } void BackgroundSyncManager::DisableAndClearManager( const base::Closure& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); return; } disabled_ = true; active_registrations_.clear(); // Delete all backend entries. The memory representation of registered syncs // may be out of sync with storage (e.g., due to corruption detection on // loading from storage), so reload the registrations from storage again. GetDataFromBackend( kBackgroundSyncUserDataKey, base::Bind(&BackgroundSyncManager::DisableAndClearDidGetRegistrations, weak_ptr_factory_.GetWeakPtr(), callback)); } void BackgroundSyncManager::DisableAndClearDidGetRegistrations( const base::Closure& callback, const std::vector<std::pair<int64, std::string>>& user_data, ServiceWorkerStatusCode status) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (status != SERVICE_WORKER_OK || user_data.empty()) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); return; } base::Closure barrier_closure = base::BarrierClosure(user_data.size(), base::Bind(callback)); for (const auto& sw_id_and_regs : user_data) { service_worker_context_->ClearRegistrationUserData( sw_id_and_regs.first, kBackgroundSyncUserDataKey, base::Bind(&BackgroundSyncManager::DisableAndClearManagerClearedOne, weak_ptr_factory_.GetWeakPtr(), barrier_closure)); } } void BackgroundSyncManager::DisableAndClearManagerClearedOne( const base::Closure& barrier_closure, ServiceWorkerStatusCode status) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // The status doesn't matter at this point, there is nothing else to be done. base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(barrier_closure)); } BackgroundSyncManager::RefCountedRegistration* BackgroundSyncManager::LookupActiveRegistration( int64 sw_registration_id, const RegistrationKey& registration_key) { DCHECK_CURRENTLY_ON(BrowserThread::IO); SWIdToRegistrationsMap::iterator it = active_registrations_.find(sw_registration_id); if (it == active_registrations_.end()) return nullptr; BackgroundSyncRegistrations& registrations = it->second; DCHECK_LE(BackgroundSyncRegistration::kInitialId, registrations.next_id); DCHECK(!registrations.origin.is_empty()); auto key_and_registration_iter = registrations.registration_map.find(registration_key); if (key_and_registration_iter == registrations.registration_map.end()) return nullptr; return key_and_registration_iter->second.get(); } void BackgroundSyncManager::StoreRegistrations( int64 sw_registration_id, const ServiceWorkerStorage::StatusCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // Serialize the data. const BackgroundSyncRegistrations& registrations = active_registrations_[sw_registration_id]; BackgroundSyncRegistrationsProto registrations_proto; registrations_proto.set_next_registration_id(registrations.next_id); registrations_proto.set_origin(registrations.origin.spec()); for (const auto& key_and_registration : registrations.registration_map) { const BackgroundSyncRegistration& registration = *key_and_registration.second->value(); BackgroundSyncRegistrationProto* registration_proto = registrations_proto.add_registration(); registration_proto->set_id(registration.id()); registration_proto->set_sync_state(registration.sync_state()); registration_proto->set_tag(registration.options()->tag); registration_proto->set_periodicity(registration.options()->periodicity); registration_proto->set_min_period(registration.options()->min_period); registration_proto->set_network_state( registration.options()->network_state); registration_proto->set_power_state(registration.options()->power_state); } std::string serialized; bool success = registrations_proto.SerializeToString(&serialized); DCHECK(success); StoreDataInBackend(sw_registration_id, registrations.origin, kBackgroundSyncUserDataKey, serialized, callback); } void BackgroundSyncManager::RegisterDidStore( int64 sw_registration_id, const scoped_refptr<RefCountedRegistration>& new_registration_ref, const StatusAndRegistrationCallback& callback, ServiceWorkerStatusCode status) { DCHECK_CURRENTLY_ON(BrowserThread::IO); const BackgroundSyncRegistration* new_registration = new_registration_ref->value(); // For UMA, determine here whether the sync could fire immediately BackgroundSyncMetrics::RegistrationCouldFire registration_could_fire = AreOptionConditionsMet(*new_registration->options()) ? BackgroundSyncMetrics::REGISTRATION_COULD_FIRE : BackgroundSyncMetrics::REGISTRATION_COULD_NOT_FIRE; if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { // The service worker registration is gone. BackgroundSyncMetrics::CountRegister( new_registration->options()->periodicity, registration_could_fire, BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); active_registrations_.erase(sw_registration_id); PostErrorResponse(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback); return; } if (status != SERVICE_WORKER_OK) { LOG(ERROR) << "BackgroundSync failed to store registration due to backend " "failure."; BackgroundSyncMetrics::CountRegister( new_registration->options()->periodicity, registration_could_fire, BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); DisableAndClearManager(base::Bind( callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>().Pass()))); return; } BackgroundSyncMetrics::CountRegister( new_registration->options()->periodicity, registration_could_fire, BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE, BACKGROUND_SYNC_STATUS_OK); FireReadyEvents(); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind( callback, BACKGROUND_SYNC_STATUS_OK, base::Passed( CreateRegistrationHandle(new_registration_ref.get()).Pass()))); } void BackgroundSyncManager::RemoveActiveRegistration( int64 sw_registration_id, const RegistrationKey& registration_key) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(LookupActiveRegistration(sw_registration_id, registration_key)); BackgroundSyncRegistrations* registrations = &active_registrations_[sw_registration_id]; registrations->registration_map.erase(registration_key); } void BackgroundSyncManager::AddActiveRegistration( int64 sw_registration_id, const GURL& origin, const scoped_refptr<RefCountedRegistration>& sync_registration) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(sync_registration->value()->IsValid()); BackgroundSyncRegistrations* registrations = &active_registrations_[sw_registration_id]; registrations->origin = origin; RegistrationKey registration_key(*sync_registration->value()); registrations->registration_map[registration_key] = sync_registration; } void BackgroundSyncManager::StoreDataInBackend( int64 sw_registration_id, const GURL& origin, const std::string& backend_key, const std::string& data, const ServiceWorkerStorage::StatusCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); service_worker_context_->StoreRegistrationUserData( sw_registration_id, origin, backend_key, data, callback); } void BackgroundSyncManager::GetDataFromBackend( const std::string& backend_key, const ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); service_worker_context_->GetUserDataForAllRegistrations(backend_key, callback); } void BackgroundSyncManager::FireOneShotSync( BackgroundSyncRegistrationHandle::HandleId handle_id, const scoped_refptr<ServiceWorkerVersion>& active_version, const ServiceWorkerVersion::StatusCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(active_version); // The ServiceWorkerVersion doesn't know when the client (javascript) is done // with the registration so don't give it a BackgroundSyncRegistrationHandle. // Once the render process gets the handle_id it can create its own handle // (with a new unique handle id). active_version->DispatchSyncEvent(handle_id, callback); } scoped_ptr<BackgroundSyncRegistrationHandle> BackgroundSyncManager::CreateRegistrationHandle( const scoped_refptr<RefCountedRegistration>& registration) { scoped_refptr<RefCountedRegistration>* ptr = new scoped_refptr<RefCountedRegistration>(registration); // Registration handles have unique handle ids. The handle id maps to an // internal RefCountedRegistration (which has the persistent registration id) // via // registration_reference_ids_. BackgroundSyncRegistrationHandle::HandleId handle_id = registration_handle_ids_.Add(ptr); return make_scoped_ptr(new BackgroundSyncRegistrationHandle( weak_ptr_factory_.GetWeakPtr(), handle_id)); } BackgroundSyncRegistration* BackgroundSyncManager::GetRegistrationForHandle( BackgroundSyncRegistrationHandle::HandleId handle_id) const { scoped_refptr<RefCountedRegistration>* ref_registration = registration_handle_ids_.Lookup(handle_id); if (!ref_registration) return nullptr; return (*ref_registration)->value(); } void BackgroundSyncManager::ReleaseRegistrationHandle( BackgroundSyncRegistrationHandle::HandleId handle_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(registration_handle_ids_.Lookup(handle_id)); registration_handle_ids_.Remove(handle_id); } void BackgroundSyncManager::Unregister( int64 sw_registration_id, SyncPeriodicity periodicity, BackgroundSyncRegistrationHandle::HandleId handle_id, const StatusCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { BackgroundSyncMetrics::CountUnregister( periodicity, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR)); return; } BackgroundSyncRegistration* registration = GetRegistrationForHandle(handle_id); DCHECK(registration); op_scheduler_.ScheduleOperation(base::Bind( &BackgroundSyncManager::UnregisterImpl, weak_ptr_factory_.GetWeakPtr(), sw_registration_id, RegistrationKey(*registration), registration->id(), periodicity, MakeStatusCompletion(callback))); } void BackgroundSyncManager::UnregisterImpl( int64 sw_registration_id, const RegistrationKey& registration_key, BackgroundSyncRegistration::RegistrationId sync_registration_id, SyncPeriodicity periodicity, const StatusCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { BackgroundSyncMetrics::CountUnregister( periodicity, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR)); return; } const RefCountedRegistration* existing_registration = LookupActiveRegistration(sw_registration_id, registration_key); if (!existing_registration || existing_registration->value()->id() != sync_registration_id) { BackgroundSyncMetrics::CountUnregister(periodicity, BACKGROUND_SYNC_STATUS_NOT_FOUND); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_NOT_FOUND)); return; } RemoveActiveRegistration(sw_registration_id, registration_key); StoreRegistrations(sw_registration_id, base::Bind(&BackgroundSyncManager::UnregisterDidStore, weak_ptr_factory_.GetWeakPtr(), sw_registration_id, periodicity, callback)); } void BackgroundSyncManager::UnregisterDidStore(int64 sw_registration_id, SyncPeriodicity periodicity, const StatusCallback& callback, ServiceWorkerStatusCode status) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (status == SERVICE_WORKER_ERROR_NOT_FOUND) { // ServiceWorker was unregistered. BackgroundSyncMetrics::CountUnregister( periodicity, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); active_registrations_.erase(sw_registration_id); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR)); return; } if (status != SERVICE_WORKER_OK) { LOG(ERROR) << "BackgroundSync failed to unregister due to backend failure."; BackgroundSyncMetrics::CountUnregister( periodicity, BACKGROUND_SYNC_STATUS_STORAGE_ERROR); DisableAndClearManager( base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR)); return; } BackgroundSyncMetrics::CountUnregister(periodicity, BACKGROUND_SYNC_STATUS_OK); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_OK)); } void BackgroundSyncManager::GetRegistrationImpl( int64 sw_registration_id, const RegistrationKey& registration_key, const StatusAndRegistrationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { PostErrorResponse(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback); return; } RefCountedRegistration* registration = LookupActiveRegistration(sw_registration_id, registration_key); if (!registration) { PostErrorResponse(BACKGROUND_SYNC_STATUS_NOT_FOUND, callback); return; } base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, base::Passed(CreateRegistrationHandle(registration).Pass()))); } void BackgroundSyncManager::GetRegistrationsImpl( int64 sw_registration_id, SyncPeriodicity periodicity, const StatusAndRegistrationsCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); scoped_ptr<ScopedVector<BackgroundSyncRegistrationHandle>> out_registrations( new ScopedVector<BackgroundSyncRegistrationHandle>()); if (disabled_) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, base::Passed(out_registrations.Pass()))); return; } SWIdToRegistrationsMap::iterator it = active_registrations_.find(sw_registration_id); if (it != active_registrations_.end()) { const BackgroundSyncRegistrations& registrations = it->second; for (const auto& tag_and_registration : registrations.registration_map) { RefCountedRegistration* registration = tag_and_registration.second.get(); if (registration->value()->options()->periodicity == periodicity) { out_registrations->push_back( CreateRegistrationHandle(registration).release()); } } } base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, base::Passed(out_registrations.Pass()))); } bool BackgroundSyncManager::AreOptionConditionsMet( const BackgroundSyncRegistrationOptions& options) { DCHECK_CURRENTLY_ON(BrowserThread::IO); return network_observer_->NetworkSufficient(options.network_state) && power_observer_->PowerSufficient(options.power_state); } bool BackgroundSyncManager::IsRegistrationReadyToFire( const BackgroundSyncRegistration& registration) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // TODO(jkarlin): Add support for firing periodic registrations. if (registration.options()->periodicity == SYNC_PERIODIC) return false; if (registration.sync_state() != SYNC_STATE_PENDING) return false; DCHECK_EQ(SYNC_ONE_SHOT, registration.options()->periodicity); return AreOptionConditionsMet(*registration.options()); } void BackgroundSyncManager::SchedulePendingRegistrations() { #if defined(OS_ANDROID) bool keep_browser_alive_for_one_shot = false; for (const auto& sw_id_and_registrations : active_registrations_) { for (const auto& key_and_registration : sw_id_and_registrations.second.registration_map) { const BackgroundSyncRegistration& registration = *key_and_registration.second->value(); if (registration.sync_state() == SYNC_STATE_PENDING) { if (registration.options()->periodicity == SYNC_ONE_SHOT) { keep_browser_alive_for_one_shot = true; } else { // TODO(jkarlin): Support keeping the browser alive for periodic // syncs. } } } } // TODO(jkarlin): Use the context's path instead of the 'this' pointer as an // identifier. See crbug.com/489705. BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&BackgroundSyncLauncherAndroid::LaunchBrowserWhenNextOnline, this, keep_browser_alive_for_one_shot)); #else // TODO(jkarlin): Toggle Chrome's background mode. #endif } void BackgroundSyncManager::FireReadyEvents() { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) return; op_scheduler_.ScheduleOperation( base::Bind(&BackgroundSyncManager::FireReadyEventsImpl, weak_ptr_factory_.GetWeakPtr(), MakeEmptyCompletion())); } void BackgroundSyncManager::FireReadyEventsImpl(const base::Closure& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); return; } // Find the registrations that are ready to run. std::vector<std::pair<int64, RegistrationKey>> sw_id_and_keys_to_fire; for (auto& sw_id_and_registrations : active_registrations_) { const int64 service_worker_id = sw_id_and_registrations.first; for (auto& key_and_registration : sw_id_and_registrations.second.registration_map) { BackgroundSyncRegistration* registration = key_and_registration.second->value(); if (IsRegistrationReadyToFire(*registration)) { sw_id_and_keys_to_fire.push_back( std::make_pair(service_worker_id, key_and_registration.first)); // The state change is not saved to persistent storage because // if the sync event is killed mid-sync then it should return to // SYNC_STATE_PENDING. registration->set_sync_state(SYNC_STATE_FIRING); } } } // If there are no registrations currently ready, then just run |callback|. // Otherwise, fire them all, and record the result when done. if (sw_id_and_keys_to_fire.size() == 0) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); } else { base::TimeTicks start_time = base::TimeTicks::Now(); // Fire the sync event of the ready registrations and run |callback| once // they're all done. base::Closure events_fired_barrier_closure = base::BarrierClosure( sw_id_and_keys_to_fire.size(), base::Bind(callback)); // Record the total time taken after all events have run to completion. base::Closure events_completed_barrier_closure = base::BarrierClosure(sw_id_and_keys_to_fire.size(), base::Bind(&OnAllSyncEventsCompleted, start_time, sw_id_and_keys_to_fire.size())); for (const auto& sw_id_and_key : sw_id_and_keys_to_fire) { int64 service_worker_id = sw_id_and_key.first; const RefCountedRegistration* registration = LookupActiveRegistration(service_worker_id, sw_id_and_key.second); DCHECK(registration); service_worker_context_->FindRegistrationForId( service_worker_id, active_registrations_[service_worker_id].origin, base::Bind(&BackgroundSyncManager::FireReadyEventsDidFindRegistration, weak_ptr_factory_.GetWeakPtr(), sw_id_and_key.second, registration->value()->id(), events_fired_barrier_closure, events_completed_barrier_closure)); } } SchedulePendingRegistrations(); } void BackgroundSyncManager::FireReadyEventsDidFindRegistration( const RegistrationKey& registration_key, BackgroundSyncRegistration::RegistrationId registration_id, const base::Closure& event_fired_callback, const base::Closure& event_completed_callback, ServiceWorkerStatusCode service_worker_status, const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (service_worker_status != SERVICE_WORKER_OK) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(event_fired_callback)); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(event_completed_callback)); return; } RefCountedRegistration* registration = LookupActiveRegistration( service_worker_registration->id(), registration_key); DCHECK(registration); // Create a handle and keep it until the sync event completes. The client can // acquire its own handle for longer-term use. scoped_ptr<BackgroundSyncRegistrationHandle> registration_handle = CreateRegistrationHandle(registration); BackgroundSyncRegistrationHandle::HandleId handle_id = registration_handle->handle_id(); FireOneShotSync( handle_id, service_worker_registration->active_version(), base::Bind( &BackgroundSyncManager::EventComplete, weak_ptr_factory_.GetWeakPtr(), service_worker_registration, service_worker_registration->id(), base::Passed(registration_handle.Pass()), event_completed_callback)); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(event_fired_callback)); } // |service_worker_registration| is just to keep the registration alive // while the event is firing. void BackgroundSyncManager::EventComplete( const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, int64 service_worker_id, scoped_ptr<BackgroundSyncRegistrationHandle> registration_handle, const base::Closure& callback, ServiceWorkerStatusCode status_code) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) return; op_scheduler_.ScheduleOperation(base::Bind( &BackgroundSyncManager::EventCompleteImpl, weak_ptr_factory_.GetWeakPtr(), service_worker_id, base::Passed(registration_handle.Pass()), status_code, MakeClosureCompletion(callback))); } void BackgroundSyncManager::EventCompleteImpl( int64 service_worker_id, scoped_ptr<BackgroundSyncRegistrationHandle> registration_handle, ServiceWorkerStatusCode status_code, const base::Closure& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (disabled_) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); return; } BackgroundSyncRegistration* registration = registration_handle->registration(); DCHECK(registration); // The event ran to completion, we should count it, no matter what happens // from here. BackgroundSyncMetrics::RecordEventResult(registration->options()->periodicity, status_code == SERVICE_WORKER_OK); if (registration->options()->periodicity == SYNC_ONE_SHOT) { if (status_code != SERVICE_WORKER_OK) { // TODO(jkarlin) Fire the sync event on the next page load controlled by // this registration. (crbug.com/479665) registration->set_sync_state(SYNC_STATE_FAILED); } else { RegistrationKey key(*registration); // Remove the registration if it's still active. RefCountedRegistration* active_registration = LookupActiveRegistration(service_worker_id, key); if (active_registration && active_registration->value()->id() == registration->id()) RemoveActiveRegistration(service_worker_id, key); } } else { // TODO(jkarlin): Add support for running periodic syncs. (crbug.com/479674) NOTREACHED(); } StoreRegistrations( service_worker_id, base::Bind(&BackgroundSyncManager::EventCompleteDidStore, weak_ptr_factory_.GetWeakPtr(), service_worker_id, callback)); } void BackgroundSyncManager::EventCompleteDidStore( int64 service_worker_id, const base::Closure& callback, ServiceWorkerStatusCode status_code) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (status_code == SERVICE_WORKER_ERROR_NOT_FOUND) { // The registration is gone. active_registrations_.erase(service_worker_id); base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); return; } if (status_code != SERVICE_WORKER_OK) { LOG(ERROR) << "BackgroundSync failed to store registration due to backend " "failure."; DisableAndClearManager(base::Bind(callback)); return; } base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); } // static void BackgroundSyncManager::OnAllSyncEventsCompleted( const base::TimeTicks& start_time, int number_of_batched_sync_events) { // Record the combined time taken by all sync events. BackgroundSyncMetrics::RecordBatchSyncEventComplete( base::TimeTicks::Now() - start_time, number_of_batched_sync_events); } void BackgroundSyncManager::OnRegistrationDeletedImpl( int64 registration_id, const base::Closure& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // The backend (ServiceWorkerStorage) will delete the data, so just delete the // memory representation here. active_registrations_.erase(registration_id); base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, base::Bind(callback)); } void BackgroundSyncManager::OnStorageWipedImpl(const base::Closure& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); active_registrations_.clear(); disabled_ = false; InitImpl(callback); } void BackgroundSyncManager::OnNetworkChanged() { DCHECK_CURRENTLY_ON(BrowserThread::IO); FireReadyEvents(); } void BackgroundSyncManager::OnPowerChanged() { DCHECK_CURRENTLY_ON(BrowserThread::IO); FireReadyEvents(); } // TODO(jkarlin): Figure out how to pass scoped_ptrs with this. template <typename CallbackT, typename... Params> void BackgroundSyncManager::CompleteOperationCallback(const CallbackT& callback, Params... parameters) { DCHECK_CURRENTLY_ON(BrowserThread::IO); callback.Run(parameters...); op_scheduler_.CompleteOperationAndRunNext(); } void BackgroundSyncManager::CompleteStatusAndRegistrationCallback( StatusAndRegistrationCallback callback, BackgroundSyncStatus status, scoped_ptr<BackgroundSyncRegistrationHandle> registration_handle) { DCHECK_CURRENTLY_ON(BrowserThread::IO); callback.Run(status, registration_handle.Pass()); op_scheduler_.CompleteOperationAndRunNext(); } void BackgroundSyncManager::CompleteStatusAndRegistrationsCallback( StatusAndRegistrationsCallback callback, BackgroundSyncStatus status, scoped_ptr<ScopedVector<BackgroundSyncRegistrationHandle>> registration_handles) { DCHECK_CURRENTLY_ON(BrowserThread::IO); callback.Run(status, registration_handles.Pass()); op_scheduler_.CompleteOperationAndRunNext(); } base::Closure BackgroundSyncManager::MakeEmptyCompletion() { DCHECK_CURRENTLY_ON(BrowserThread::IO); return MakeClosureCompletion(base::Bind(base::DoNothing)); } base::Closure BackgroundSyncManager::MakeClosureCompletion( const base::Closure& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); return base::Bind( &BackgroundSyncManager::CompleteOperationCallback<base::Closure>, weak_ptr_factory_.GetWeakPtr(), callback); } BackgroundSyncManager::StatusAndRegistrationCallback BackgroundSyncManager::MakeStatusAndRegistrationCompletion( const StatusAndRegistrationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); return base::Bind( &BackgroundSyncManager::CompleteStatusAndRegistrationCallback, weak_ptr_factory_.GetWeakPtr(), callback); } BackgroundSyncManager::StatusAndRegistrationsCallback BackgroundSyncManager::MakeStatusAndRegistrationsCompletion( const StatusAndRegistrationsCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); return base::Bind( &BackgroundSyncManager::CompleteStatusAndRegistrationsCallback, weak_ptr_factory_.GetWeakPtr(), callback); } BackgroundSyncManager::StatusCallback BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); return base::Bind( &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, BackgroundSyncStatus>, weak_ptr_factory_.GetWeakPtr(), callback); } } // namespace content
Chilledheart/chromium
content/browser/background_sync/background_sync_manager.cc
C++
bsd-3-clause
45,304
var http = require('http'); // check against public file to see if this is the current version of Mapbox Studio Classic module.exports = function (opts, callback) { var update = false; http.request({ host: opts.host, port: opts.port || 80, path: opts.path, method: 'GET' }, function(response){ var latest = ''; response.on('data', function (chunk) { latest += chunk; }); response.on('end', function () { var current = opts.pckge.version.replace(/^\s+|\s+$/g, ''); latest = latest.replace(/^\s+|\s+$/g, ''); if (latest !== current) { update = true; } return callback(update, current, latest); }); }) .on('error', function(err){ return callback(false); }) .end(); };
mapbox/mapbox-studio
lib/version-check.js
JavaScript
bsd-3-clause
862
<?php /* * This file is part of Cachet. * * (c) Alt Three Services Limited * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace CachetHQ\Cachet\Composers; use CachetHQ\Cachet\Facades\Setting; use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Repositories\Metric\MetricRepository; use Illuminate\Contracts\View\View; class MetricsComposer { /** * @var \CachetHQ\Cachet\Repositories\Metric\MetricRepository */ protected $metricRepository; /** * Construct a new home controller instance. * * @param \CachetHQ\Cachet\Repositories\Metric\MetricRepository $metricRepository * * @return void */ public function __construct(MetricRepository $metricRepository) { $this->metricRepository = $metricRepository; } /** * Metrics view composer. * * @param \Illuminate\Contracts\View\View $view * * @return void */ public function compose(View $view) { $metrics = null; $metricData = []; if ($displayMetrics = Setting::get('display_graphs')) { $metrics = Metric::where('display_chart', 1)->get(); $metrics->map(function ($metric) use (&$metricData) { $metricData[$metric->id] = [ 'today' => $this->metricRepository->listPointsToday($metric), 'week' => $this->metricRepository->listPointsForWeek($metric), 'month' => $this->metricRepository->listPointsForMonth($metric), ]; }); } $view->withDisplayMetrics($displayMetrics) ->withMetrics($metrics) ->withMetricData($metricData); } }
katzien/Cachet
app/Composers/MetricsComposer.php
PHP
bsd-3-clause
1,783
// $G $D/$F.go && $L $F.$A && // ./$A.out -pass 0 >tmp.go && $G tmp.go && $L -o $A.out1 tmp.$A && ./$A.out1 && // ./$A.out -pass 1 >tmp.go && errchk $G -e tmp.go && // ./$A.out -pass 2 >tmp.go && errchk $G -e tmp.go // rm -f tmp.go $A.out1 // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Generate test of index and slice bounds checks. // The output is compiled and run. package main import ( "bufio" "flag" "fmt" "os" ) const prolog = ` package main import ( "runtime" ) type quad struct { x, y, z, w int } const ( cj = 11 ci int = 12 ci32 int32 = 13 ci64 int64 = 14 ci64big int64 = 1<<31 ci64bigger int64 = 1<<32 chuge = 1<<100 cnj = -2 cni int = -3 cni32 int32 = -4 cni64 int64 = -5 cni64big int64 = -1<<31 cni64bigger int64 = -1<<32 cnhuge = -1<<100 ) var j int = 20 var i int = 21 var i32 int32 = 22 var i64 int64 = 23 var i64big int64 = 1<<31 var i64bigger int64 = 1<<32 var huge uint64 = 1<<64 - 1 var nj int = -10 var ni int = -11 var ni32 int32 = -12 var ni64 int64 = -13 var ni64big int64 = -1<<31 var ni64bigger int64 = -1<<32 var nhuge int64 = -1<<63 var si []int = make([]int, 10) var ai [10]int var pai *[10]int = &ai var sq []quad = make([]quad, 10) var aq [10]quad var paq *[10]quad = &aq type T struct { si []int ai [10]int pai *[10]int sq []quad aq [10]quad paq *[10]quad } var t = T{si, ai, pai, sq, aq, paq} var pt = &T{si, ai, pai, sq, aq, paq} // test that f panics func test(f func(), s string) { defer func() { if err := recover(); err == nil { _, file, line, _ := runtime.Caller(2) bug() print(file, ":", line, ": ", s, " did not panic\n") } }() f() } var X interface{} func use(y interface{}) { X = y } var didBug = false func bug() { if !didBug { didBug = true println("BUG") } } func main() { ` // Passes: // 0 - dynamic checks // 1 - static checks of invalid constants (cannot assign to types) // 2 - static checks of array bounds var pass = flag.Int("pass", 0, "which test (0,1,2)") func testExpr(b *bufio.Writer, expr string) { if *pass == 0 { fmt.Fprintf(b, "\ttest(func(){use(%s)}, %q)\n", expr, expr) } else { fmt.Fprintf(b, "\tuse(%s) // ERROR \"index|overflow\"\n", expr) } } func main() { b := bufio.NewWriter(os.Stdout) flag.Parse() if *pass == 0 { fmt.Fprint(b, "// $G $D/$F.go && $L $F.$A && ./$A.out\n\n") } else { fmt.Fprint(b, "// errchk $G -e $D/$F.go\n\n") } fmt.Fprint(b, prolog) var choices = [][]string{ // Direct value, fetch from struct, fetch from struct pointer. // The last two cases get us to oindex_const_sudo in gsubr.c. []string{"", "t.", "pt."}, // Array, pointer to array, slice. []string{"a", "pa", "s"}, // Element is int, element is quad (struct). // This controls whether we end up in gsubr.c (i) or cgen.c (q). []string{"i", "q"}, // Variable or constant. []string{"", "c"}, // Positive or negative. []string{"", "n"}, // Size of index. []string{"j", "i", "i32", "i64", "i64big", "i64bigger", "huge"}, } forall(choices, func(x []string) { p, a, e, c, n, i := x[0], x[1], x[2], x[3], x[4], x[5] // Pass: dynamic=0, static=1, 2. // Which cases should be caught statically? // Only constants, obviously. // Beyond that, must be one of these: // indexing into array or pointer to array // negative constant // large constant thisPass := 0 if c == "c" && (a == "a" || a == "pa" || n == "n" || i == "i64big" || i == "i64bigger" || i == "huge") { if i == "huge" { // Due to a detail of 6g's internals, // the huge constant errors happen in an // earlier pass than the others and inhibits // the next pass from running. // So run it as a separate check. thisPass = 1 } else { thisPass = 2 } } // Only print the test case if it is appropriate for this pass. if thisPass == *pass { pae := p+a+e cni := c+n+i // Index operation testExpr(b, pae + "[" + cni + "]") // Slice operation. // Low index 0 is a special case in ggen.c // so test both 0 and 1. testExpr(b, pae + "[0:" + cni + "]") testExpr(b, pae + "[1:" + cni + "]") testExpr(b, pae + "[" + cni + ":]") testExpr(b, pae + "[" + cni + ":" + cni + "]") } }) fmt.Fprintln(b, "}") b.Flush() } func forall(choices [][]string, f func([]string)) { x := make([]string, len(choices)) var recurse func(d int) recurse = func(d int) { if d >= len(choices) { f(x) return } for _, x[d] = range choices[d] { recurse(d+1) } } recurse(0) }
oopos/go
test/index.go
GO
bsd-3-clause
4,621
//============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef BOOST_SIMD_SDK_SIMD_EXTENSIONS_POWERPC_QPX_HPP_INCLUDED #define BOOST_SIMD_SDK_SIMD_EXTENSIONS_POWERPC_QPX_HPP_INCLUDED #if defined(__VECTOR4DOUBLE__) # ifndef BOOST_SIMD_HAS_QPX_SUPPORT # define BOOST_SIMD_HAS_QPX_SUPPORT # endif #elif defined(BOOST_SIMD_HAS_QPX_SUPPORT) # undef BOOST_SIMD_HAS_QPX_SUPPORT #endif #if !defined(BOOST_SIMD_DETECTED) && defined(BOOST_SIMD_HAS_QPX_SUPPORT) //////////////////////////////////////////////////////////////////////////////// // Altivec PPC extensions flags //////////////////////////////////////////////////////////////////////////////// #define BOOST_SIMD_DETECTED #define BOOST_SIMD_ALTIVEC #define BOOST_SIMD_STRING "QPX" #define BOOST_SIMD_STRING_LIST "QPX" #define BOOST_SIMD_VMX_FAMILY #define BOOST_SIMD_BYTES 32 #define BOOST_SIMD_BITS 256 #define BOOST_SIMD_CARDINALS (8) #define BOOST_SIMD_TAG_SEQ (::boost::simd::tag::qpx_) #ifndef BOOST_SIMD_DEFAULT_EXTENSION #define BOOST_SIMD_DEFAULT_EXTENSION ::boost::simd::tag::qpx_ #endif #define BOOST_SIMD_DEFAULT_SITE ::boost::simd::tag::qpx_ #define BOOST_SIMD_NO_DENORMALS #define BOOST_SIMD_SIMD_REAL_TYPES (double) #define BOOST_SIMD_SIMD_INTEGRAL_UNSIGNED_TYPES #define BOOST_SIMD_SIMD_INTEGRAL_SIGNED_TYPES #define BOOST_SIMD_SIMD_INT_CONVERT_TYPES #define BOOST_SIMD_SIMD_UINT_CONVERT_TYPES #define BOOST_SIMD_SIMD_GROUPABLE_TYPES #define BOOST_SIMD_SIMD_SPLITABLE_TYPES #define BOOST_SIMD_SIMD_REAL_GROUPABLE_TYPES #define BOOST_SIMD_SIMD_REAL_SPLITABLE_TYPES #include <boost/simd/sdk/simd/extensions/meta/qpx.hpp> #endif #endif
hainm/pythran
third_party/boost/simd/sdk/simd/extensions/powerpc/qpx.hpp
C++
bsd-3-clause
2,143
<?php error_reporting(E_ALL & ~E_NOTICE); $root = simplexml_load_string('<?xml version="1.0"?> <root xmlns:reserved="reserved-ns"> <child reserved:attribute="Sample" /> </root> '); $attr = $root->child->attributes('reserved-ns'); echo $attr['attribute']; echo "\n---Done---\n"; ?>
JSchwehn/php
testdata/fuzzdir/corpus/ext_simplexml_tests_profile06.php
PHP
bsd-3-clause
283
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/speech/speech_recognizer_impl_android.h" #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" #include "base/android/scoped_java_ref.h" #include "base/bind.h" #include "base/strings/utf_string_conversions.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/speech_recognition_event_listener.h" #include "content/public/browser/speech_recognition_manager.h" #include "content/public/browser/speech_recognition_session_config.h" #include "content/public/common/speech_recognition_grammar.h" #include "content/public/common/speech_recognition_result.h" #include "jni/SpeechRecognition_jni.h" using base::android::AppendJavaStringArrayToStringVector; using base::android::AttachCurrentThread; using base::android::GetApplicationContext; using base::android::JavaFloatArrayToFloatVector; namespace content { SpeechRecognizerImplAndroid::SpeechRecognizerImplAndroid( SpeechRecognitionEventListener* listener, int session_id) : SpeechRecognizer(listener, session_id), state_(STATE_IDLE) { } SpeechRecognizerImplAndroid::~SpeechRecognizerImplAndroid() { } void SpeechRecognizerImplAndroid::StartRecognition() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognitionEventListener::OnRecognitionStart, base::Unretained(listener()), session_id())); SpeechRecognitionSessionConfig config = SpeechRecognitionManager::GetInstance()->GetSessionConfig(session_id()); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( &content::SpeechRecognizerImplAndroid::StartRecognitionOnUIThread, this, config.continuous, config.interim_results)); } void SpeechRecognizerImplAndroid::StartRecognitionOnUIThread( bool continuous, bool interim_results) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); JNIEnv* env = AttachCurrentThread(); j_recognition_.Reset(Java_SpeechRecognition_createSpeechRecognition(env, GetApplicationContext(), reinterpret_cast<jint>(this))); Java_SpeechRecognition_startRecognition(env, j_recognition_.obj(), continuous, interim_results); } void SpeechRecognizerImplAndroid::AbortRecognition() { if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { state_ = STATE_IDLE; BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( &content::SpeechRecognizerImplAndroid::AbortRecognition, this)); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); JNIEnv* env = AttachCurrentThread(); if (!j_recognition_.is_null()) Java_SpeechRecognition_abortRecognition(env, j_recognition_.obj()); } void SpeechRecognizerImplAndroid::StopAudioCapture() { if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( &content::SpeechRecognizerImplAndroid::StopAudioCapture, this)); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); JNIEnv* env = AttachCurrentThread(); if (!j_recognition_.is_null()) Java_SpeechRecognition_stopRecognition(env, j_recognition_.obj()); } bool SpeechRecognizerImplAndroid::IsActive() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); return state_ != STATE_IDLE; } bool SpeechRecognizerImplAndroid::IsCapturingAudio() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); return state_ == STATE_CAPTURING_AUDIO; } void SpeechRecognizerImplAndroid::OnAudioStart(JNIEnv* env, jobject obj) { if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognizerImplAndroid::OnAudioStart, this, static_cast<JNIEnv*>(NULL), static_cast<jobject>(NULL))); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); state_ = STATE_CAPTURING_AUDIO; listener()->OnAudioStart(session_id()); } void SpeechRecognizerImplAndroid::OnSoundStart(JNIEnv* env, jobject obj) { if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognizerImplAndroid::OnSoundStart, this, static_cast<JNIEnv*>(NULL), static_cast<jobject>(NULL))); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); listener()->OnSoundStart(session_id()); } void SpeechRecognizerImplAndroid::OnSoundEnd(JNIEnv* env, jobject obj) { if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognizerImplAndroid::OnSoundEnd, this, static_cast<JNIEnv*>(NULL), static_cast<jobject>(NULL))); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); listener()->OnSoundEnd(session_id()); } void SpeechRecognizerImplAndroid::OnAudioEnd(JNIEnv* env, jobject obj) { if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognizerImplAndroid::OnAudioEnd, this, static_cast<JNIEnv*>(NULL), static_cast<jobject>(NULL))); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (state_ == STATE_CAPTURING_AUDIO) state_ = STATE_AWAITING_FINAL_RESULT; listener()->OnAudioEnd(session_id()); } void SpeechRecognizerImplAndroid::OnRecognitionResults(JNIEnv* env, jobject obj, jobjectArray strings, jfloatArray floats, jboolean provisional) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); std::vector<string16> options; AppendJavaStringArrayToStringVector(env, strings, &options); std::vector<float> scores(options.size(), 0.0); if (floats != NULL) JavaFloatArrayToFloatVector(env, floats, &scores); SpeechRecognitionResults results; results.push_back(SpeechRecognitionResult()); SpeechRecognitionResult& result = results.back(); CHECK_EQ(options.size(), scores.size()); for (size_t i = 0; i < options.size(); ++i) { result.hypotheses.push_back(SpeechRecognitionHypothesis( options[i], static_cast<double>(scores[i]))); } result.is_provisional = provisional; BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognizerImplAndroid::OnRecognitionResultsOnIOThread, this, results)); } void SpeechRecognizerImplAndroid::OnRecognitionResultsOnIOThread( SpeechRecognitionResults const &results) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); listener()->OnRecognitionResults(session_id(), results); } void SpeechRecognizerImplAndroid::OnRecognitionError(JNIEnv* env, jobject obj, jint error) { if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognizerImplAndroid::OnRecognitionError, this, static_cast<JNIEnv*>(NULL), static_cast<jobject>(NULL), error)); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); SpeechRecognitionErrorCode code = static_cast<SpeechRecognitionErrorCode>(error); listener()->OnRecognitionError(session_id(), SpeechRecognitionError(code)); } void SpeechRecognizerImplAndroid::OnRecognitionEnd(JNIEnv* env, jobject obj) { if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( &SpeechRecognizerImplAndroid::OnRecognitionEnd, this, static_cast<JNIEnv*>(NULL), static_cast<jobject>(NULL))); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); state_ = STATE_IDLE; listener()->OnRecognitionEnd(session_id()); } // static bool SpeechRecognizerImplAndroid::RegisterSpeechRecognizer(JNIEnv* env) { return RegisterNativesImpl(env); } } // namespace content
hujiajie/pa-chromium
content/browser/speech/speech_recognizer_impl_android.cc
C++
bsd-3-clause
8,013
/***************************************************************************** * McPAT/CACTI * SOFTWARE LICENSE AGREEMENT * Copyright 2012 Hewlett-Packard Development Company, L.P. * All Rights Reserved * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution; * neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.” * ***************************************************************************/ #include <math.h> #include "basic_circuit.h" #include "parameter.h" double wire_resistance(double resistivity, double wire_width, double wire_thickness, double barrier_thickness, double dishing_thickness, double alpha_scatter) { double resistance; resistance = alpha_scatter * resistivity /((wire_thickness - barrier_thickness - dishing_thickness)*(wire_width - 2 * barrier_thickness)); return(resistance); } double wire_capacitance(double wire_width, double wire_thickness, double wire_spacing, double ild_thickness, double miller_value, double horiz_dielectric_constant, double vert_dielectric_constant, double fringe_cap) { double vertical_cap, sidewall_cap, total_cap; vertical_cap = 2 * PERMITTIVITY_FREE_SPACE * vert_dielectric_constant * wire_width / ild_thickness; sidewall_cap = 2 * PERMITTIVITY_FREE_SPACE * miller_value * horiz_dielectric_constant * wire_thickness / wire_spacing; total_cap = vertical_cap + sidewall_cap + fringe_cap; return(total_cap); } void init_tech_params(double technology, bool is_tag) { int iter, tech, tech_lo, tech_hi; double curr_alpha, curr_vpp; double wire_width, wire_thickness, wire_spacing, fringe_cap, pmos_to_nmos_sizing_r; // double aspect_ratio,ild_thickness, miller_value = 1.5, horiz_dielectric_constant, vert_dielectric_constant; double barrier_thickness, dishing_thickness, alpha_scatter; double curr_vdd_dram_cell, curr_v_th_dram_access_transistor, curr_I_on_dram_cell, curr_c_dram_cell; uint32_t ram_cell_tech_type = (is_tag) ? g_ip->tag_arr_ram_cell_tech_type : g_ip->data_arr_ram_cell_tech_type; uint32_t peri_global_tech_type = (is_tag) ? g_ip->tag_arr_peri_global_tech_type : g_ip->data_arr_peri_global_tech_type; technology = technology * 1000.0; // in the unit of nm // initialize parameters g_tp.reset(); double gmp_to_gmn_multiplier_periph_global = 0; double curr_Wmemcella_dram, curr_Wmemcellpmos_dram, curr_Wmemcellnmos_dram, curr_area_cell_dram, curr_asp_ratio_cell_dram, curr_Wmemcella_sram, curr_Wmemcellpmos_sram, curr_Wmemcellnmos_sram, curr_area_cell_sram, curr_asp_ratio_cell_sram, curr_I_off_dram_cell_worst_case_length_temp; double curr_Wmemcella_cam, curr_Wmemcellpmos_cam, curr_Wmemcellnmos_cam, curr_area_cell_cam,//Sheng: CAM data curr_asp_ratio_cell_cam; double SENSE_AMP_D, SENSE_AMP_P; // J double area_cell_dram = 0; double asp_ratio_cell_dram = 0; double area_cell_sram = 0; double asp_ratio_cell_sram = 0; double area_cell_cam = 0; double asp_ratio_cell_cam = 0; double mobility_eff_periph_global = 0; double Vdsat_periph_global = 0; double nmos_effective_resistance_multiplier; double width_dram_access_transistor; double curr_logic_scaling_co_eff = 0;//This is based on the reported numbers of Intel Merom 65nm, Penryn45nm and IBM cell 90/65/45 date double curr_core_tx_density = 0;//this is density per um^2; 90, ...22nm based on Intel Penryn double curr_chip_layout_overhead = 0; double curr_macro_layout_overhead = 0; double curr_sckt_co_eff = 0; if (technology < 181 && technology > 179) { tech_lo = 180; tech_hi = 180; } else if (technology < 91 && technology > 89) { tech_lo = 90; tech_hi = 90; } else if (technology < 66 && technology > 64) { tech_lo = 65; tech_hi = 65; } else if (technology < 46 && technology > 44) { tech_lo = 45; tech_hi = 45; } else if (technology < 33 && technology > 31) { tech_lo = 32; tech_hi = 32; } else if (technology < 23 && technology > 21) { tech_lo = 22; tech_hi = 22; if (ram_cell_tech_type == 3 ) { cout<<"current version does not support eDRAM technologies at 22nm"<<endl; exit(0); } } // else if (technology < 17 && technology > 15) // { // tech_lo = 16; // tech_hi = 16; // } else if (technology < 180 && technology > 90) { tech_lo = 180; tech_hi = 90; } else if (technology < 90 && technology > 65) { tech_lo = 90; tech_hi = 65; } else if (technology < 65 && technology > 45) { tech_lo = 65; tech_hi = 45; } else if (technology < 45 && technology > 32) { tech_lo = 45; tech_hi = 32; } else if (technology < 32 && technology > 22) { tech_lo = 32; tech_hi = 22; } // else if (technology < 22 && technology > 16) // { // tech_lo = 22; // tech_hi = 16; // } else { cout<<"Invalid technology nodes"<<endl; exit(0); } double vdd[NUMBER_TECH_FLAVORS];//default vdd from itrs double vdd_real[NUMBER_TECH_FLAVORS]; //real vdd defined by user, this is for changing vdd from itrs; it actually does not dependent on technology node since it is user defined double alpha_power_law[NUMBER_TECH_FLAVORS];//co-efficient for ap-law double Lphy[NUMBER_TECH_FLAVORS]; double Lelec[NUMBER_TECH_FLAVORS]; double t_ox[NUMBER_TECH_FLAVORS]; double v_th[NUMBER_TECH_FLAVORS]; double c_ox[NUMBER_TECH_FLAVORS]; double mobility_eff[NUMBER_TECH_FLAVORS]; double Vdsat[NUMBER_TECH_FLAVORS]; double c_g_ideal[NUMBER_TECH_FLAVORS]; double c_fringe[NUMBER_TECH_FLAVORS]; double c_junc[NUMBER_TECH_FLAVORS]; double I_on_n[NUMBER_TECH_FLAVORS]; double I_on_p[NUMBER_TECH_FLAVORS]; double Rnchannelon[NUMBER_TECH_FLAVORS]; double Rpchannelon[NUMBER_TECH_FLAVORS]; double n_to_p_eff_curr_drv_ratio[NUMBER_TECH_FLAVORS]; double I_off_n[NUMBER_TECH_FLAVORS][101]; double I_g_on_n[NUMBER_TECH_FLAVORS][101]; //double I_off_p[NUMBER_TECH_FLAVORS][101]; double gmp_to_gmn_multiplier[NUMBER_TECH_FLAVORS]; //double curr_sckt_co_eff[NUMBER_TECH_FLAVORS]; double long_channel_leakage_reduction[NUMBER_TECH_FLAVORS]; for (iter = 0; iter <= 1; ++iter) { // linear interpolation if (iter == 0) { tech = tech_lo; if (tech_lo == tech_hi) { curr_alpha = 1; } else { curr_alpha = (technology - tech_hi)/(tech_lo - tech_hi); } } else { tech = tech_hi; if (tech_lo == tech_hi) { break; } else { curr_alpha = (tech_lo - technology)/(tech_lo - tech_hi); } } if (tech == 180) { //180nm technology-node. Corresponds to year 1999 in ITRS //Only HP transistor was of interest that 180nm since leakage power was not a big issue. Performance was the king //MASTAR does not contain data for 0.18um process. The following parameters are projected based on ITRS 2000 update and IBM 0.18 Cu Spice input //180nm does not support DVS bool Aggre_proj = false; SENSE_AMP_D = .28e-9; // s SENSE_AMP_P = 14.7e-15; // J vdd[0] = 1.5; vdd_real[0] = g_ip->specific_hp_vdd ? g_ip->hp_Vdd : vdd[0]; alpha_power_law[0]=1.4; Lphy[0] = 0.12;//Lphy is the physical gate-length. micron Lelec[0] = 0.10;//Lelec is the electrical gate-length. micron t_ox[0] = 1.2e-3*(Aggre_proj? 1.9/1.2:2);//micron v_th[0] = Aggre_proj? 0.36 : 0.4407;//V c_ox[0] = 1.79e-14*(Aggre_proj? 1.9/1.2:2);//F/micron2 mobility_eff[0] = 302.16 * (1e-2 * 1e6 * 1e-2 * 1e6); //micron2 / Vs Vdsat[0] = 0.128*2; //V c_g_ideal[0] = (Aggre_proj? 1.9/1.2:2)*6.64e-16;//F/micron c_fringe[0] = (Aggre_proj? 1.9/1.2:2)*0.08e-15;//F/micron c_junc[0] = (Aggre_proj? 1.9/1.2:2)*1e-15;//F/micron2 I_on_n[0] = 750e-6*pow((vdd_real[0]-v_th[0])/(vdd[0]-v_th[0]),alpha_power_law[0]);//A/micron I_on_p[0] = 350e-6;//A/micron //Note that nmos_effective_resistance_multiplier, n_to_p_eff_curr_drv_ratio and gmp_to_gmn_multiplier values are calculated offline nmos_effective_resistance_multiplier = 1.54; n_to_p_eff_curr_drv_ratio[0] = 2.45; gmp_to_gmn_multiplier[0] = 1.22; Rnchannelon[0] = nmos_effective_resistance_multiplier * vdd[0] / I_on_n[0];//ohm-micron Rpchannelon[0] = n_to_p_eff_curr_drv_ratio[0] * Rnchannelon[0];//ohm-micron long_channel_leakage_reduction[0] = 1; I_off_n[0][0] = 7e-10;//A/micron I_off_n[0][10] = 8.26e-10; I_off_n[0][20] = 9.74e-10; I_off_n[0][30] = 1.15e-9; I_off_n[0][40] = 1.35e-9; I_off_n[0][50] = 1.60e-9; I_off_n[0][60] = 1.88e-9; I_off_n[0][70] = 2.29e-9; I_off_n[0][80] = 2.70e-9; I_off_n[0][90] = 3.19e-9; I_off_n[0][100] = 3.76e-9; I_g_on_n[0][0] = 1.65e-10;//A/micron I_g_on_n[0][10] = 1.65e-10; I_g_on_n[0][20] = 1.65e-10; I_g_on_n[0][30] = 1.65e-10; I_g_on_n[0][40] = 1.65e-10; I_g_on_n[0][50] = 1.65e-10; I_g_on_n[0][60] = 1.65e-10; I_g_on_n[0][70] = 1.65e-10; I_g_on_n[0][80] = 1.65e-10; I_g_on_n[0][90] = 1.65e-10; I_g_on_n[0][100] = 1.65e-10; //SRAM cell properties curr_Wmemcella_sram = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_sram = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_sram = 2.08 * g_ip->F_sz_um; curr_area_cell_sram = 146 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_sram = 1.46; //CAM cell properties //TODO: data need to be revisited curr_Wmemcella_cam = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_cam = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_cam = 2.08 * g_ip->F_sz_um; curr_area_cell_cam = 292 * g_ip->F_sz_um * g_ip->F_sz_um;//360 curr_asp_ratio_cell_cam = 2.92;//2.5 //Empirical undifferetiated core/FU coefficient curr_logic_scaling_co_eff = 1.5;//linear scaling from 90nm curr_core_tx_density = 1.25*0.7*0.7*0.4; curr_sckt_co_eff = 1.11; curr_chip_layout_overhead = 1.0;//die measurement results based on Niagara 1 and 2 curr_macro_layout_overhead = 1.0;//EDA placement and routing tool rule of thumb } if (tech == 90) { SENSE_AMP_D = .28e-9; // s SENSE_AMP_P = 14.7e-15; // J //90nm technology-node. Corresponds to year 2004 in ITRS //ITRS HP device type vdd[0] = 1.2; vdd_real[0] = g_ip->specific_hp_vdd ? g_ip->hp_Vdd : vdd[0]; alpha_power_law[0]=1.34; Lphy[0] = 0.037;//Lphy is the physical gate-length. micron Lelec[0] = 0.0266;//Lelec is the electrical gate-length. micron t_ox[0] = 1.2e-3;//micron v_th[0] = 0.23707;//V c_ox[0] = 1.79e-14;//F/micron2 mobility_eff[0] = 342.16 * (1e-2 * 1e6 * 1e-2 * 1e6); //micron2 / Vs Vdsat[0] = 0.128; //V c_g_ideal[0] = 6.64e-16;//F/micron c_fringe[0] = 0.08e-15;//F/micron c_junc[0] = 1e-15;//F/micron2 I_on_n[0] = 1076.9e-6*pow((vdd_real[0]-v_th[0])/(vdd[0]-v_th[0]),alpha_power_law[0]);//A/micron with ap-law applied for dvs and arbitrary vdd I_on_p[0] = 712.6e-6;//A/micron //Note that nmos_effective_resistance_multiplier, n_to_p_eff_curr_drv_ratio and gmp_to_gmn_multiplier values are calculated offline nmos_effective_resistance_multiplier = 1.54; n_to_p_eff_curr_drv_ratio[0] = 2.45; gmp_to_gmn_multiplier[0] = 1.22; Rnchannelon[0] = nmos_effective_resistance_multiplier * vdd_real[0] / I_on_n[0];//ohm-micron Rpchannelon[0] = n_to_p_eff_curr_drv_ratio[0] * Rnchannelon[0];//ohm-micron long_channel_leakage_reduction[0] = 1; I_off_n[0][0] = 3.24e-8*pow(vdd_real[0]/(vdd[0]),4);//A/micron I_off_n[0][10] = 4.01e-8*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][20] = 4.90e-8*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][30] = 5.92e-8*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][40] = 7.08e-8*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][50] = 8.38e-8*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][60] = 9.82e-8*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][70] = 1.14e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][80] = 1.29e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][90] = 1.43e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][100] = 1.54e-7*pow(vdd_real[0]/(vdd[0]),4); I_g_on_n[0][0] = 1.65e-8;//A/micron I_g_on_n[0][10] = 1.65e-8; I_g_on_n[0][20] = 1.65e-8; I_g_on_n[0][30] = 1.65e-8; I_g_on_n[0][40] = 1.65e-8; I_g_on_n[0][50] = 1.65e-8; I_g_on_n[0][60] = 1.65e-8; I_g_on_n[0][70] = 1.65e-8; I_g_on_n[0][80] = 1.65e-8; I_g_on_n[0][90] = 1.65e-8; I_g_on_n[0][100] = 1.65e-8; //ITRS LSTP device type vdd[1] = 1.3; vdd_real[1] = g_ip->specific_lstp_vdd ? g_ip->lstp_Vdd : vdd[1]; alpha_power_law[1]=1.47; Lphy[1] = 0.075; Lelec[1] = 0.0486; t_ox[1] = 2.2e-3; v_th[1] = 0.48203; c_ox[1] = 1.22e-14; mobility_eff[1] = 356.76 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[1] = 0.373; c_g_ideal[1] = 9.15e-16; c_fringe[1] = 0.08e-15; c_junc[1] = 1e-15; I_on_n[1] = 503.6e-6*pow((vdd_real[1]-v_th[1])/(vdd[1]-v_th[1]),alpha_power_law[1]); I_on_p[1] = 235.1e-6; nmos_effective_resistance_multiplier = 1.92; n_to_p_eff_curr_drv_ratio[1] = 2.44; gmp_to_gmn_multiplier[1] =0.88; Rnchannelon[1] = nmos_effective_resistance_multiplier * vdd_real[1] / I_on_n[1]; Rpchannelon[1] = n_to_p_eff_curr_drv_ratio[1] * Rnchannelon[1]; long_channel_leakage_reduction[1] = 1; I_off_n[1][0] = 2.81e-12*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][10] = 4.76e-12*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][20] = 7.82e-12*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][30] = 1.25e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][40] = 1.94e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][50] = 2.94e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][60] = 4.36e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][70] = 6.32e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][80] = 8.95e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][90] = 1.25e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][100] = 1.7e-10*pow(vdd_real[1]/(vdd[1]),4); I_g_on_n[1][0] = 3.87e-11;//A/micron I_g_on_n[1][10] = 3.87e-11; I_g_on_n[1][20] = 3.87e-11; I_g_on_n[1][30] = 3.87e-11; I_g_on_n[1][40] = 3.87e-11; I_g_on_n[1][50] = 3.87e-11; I_g_on_n[1][60] = 3.87e-11; I_g_on_n[1][70] = 3.87e-11; I_g_on_n[1][80] = 3.87e-11; I_g_on_n[1][90] = 3.87e-11; I_g_on_n[1][100] = 3.87e-11; //ITRS LOP device type vdd[2] = 0.9; vdd_real[2] = g_ip->specific_lop_vdd ? g_ip->lop_Vdd : vdd[2]; alpha_power_law[2]=1.55; Lphy[2] = 0.053; Lelec[2] = 0.0354; t_ox[2] = 1.5e-3; v_th[2] = 0.30764; c_ox[2] = 1.59e-14; mobility_eff[2] = 460.39 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[2] = 0.113; c_g_ideal[2] = 8.45e-16; c_fringe[2] = 0.08e-15; c_junc[2] = 1e-15; I_on_n[2] = 386.6e-6*pow((vdd_real[2]-v_th[2])/(vdd[2]-v_th[2]),alpha_power_law[2]); I_on_p[2] = 209.7e-6; nmos_effective_resistance_multiplier = 1.77; n_to_p_eff_curr_drv_ratio[2] = 2.54; gmp_to_gmn_multiplier[2] = 0.98; Rnchannelon[2] = nmos_effective_resistance_multiplier * vdd_real[2] / I_on_n[2]; Rpchannelon[2] = n_to_p_eff_curr_drv_ratio[2] * Rnchannelon[2]; long_channel_leakage_reduction[2] = 1; I_off_n[2][0] = 2.14e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][10] = 2.9e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][20] = 3.87e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][30] = 5.07e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][40] = 6.54e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][50] = 8.27e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][60] = 1.02e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][70] = 1.20e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][80] = 1.36e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][90] = 1.52e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][100] = 1.73e-8*pow(vdd_real[2]/(vdd[2]),5); I_g_on_n[2][0] = 4.31e-8;//A/micron I_g_on_n[2][10] = 4.31e-8; I_g_on_n[2][20] = 4.31e-8; I_g_on_n[2][30] = 4.31e-8; I_g_on_n[2][40] = 4.31e-8; I_g_on_n[2][50] = 4.31e-8; I_g_on_n[2][60] = 4.31e-8; I_g_on_n[2][70] = 4.31e-8; I_g_on_n[2][80] = 4.31e-8; I_g_on_n[2][90] = 4.31e-8; I_g_on_n[2][100] = 4.31e-8; if (ram_cell_tech_type == lp_dram) { //LP-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.2; Lphy[3] = 0.12; Lelec[3] = 0.0756; curr_v_th_dram_access_transistor = 0.4545; width_dram_access_transistor = 0.14; curr_I_on_dram_cell = 45e-6; curr_I_off_dram_cell_worst_case_length_temp = 21.1e-12; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 0.168; curr_asp_ratio_cell_dram = 1.46; curr_c_dram_cell = 20e-15; //LP-DRAM wordline transistor parameters curr_vpp = 1.6; t_ox[3] = 2.2e-3; v_th[3] = 0.4545; c_ox[3] = 1.22e-14; mobility_eff[3] = 323.95 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.3; c_g_ideal[3] = 1.47e-15; c_fringe[3] = 0.08e-15; c_junc[3] = 1e-15; I_on_n[3] = 321.6e-6; I_on_p[3] = 203.3e-6; nmos_effective_resistance_multiplier = 1.65; n_to_p_eff_curr_drv_ratio[3] = 1.95; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 1.42e-11; I_off_n[3][10] = 2.25e-11; I_off_n[3][20] = 3.46e-11; I_off_n[3][30] = 5.18e-11; I_off_n[3][40] = 7.58e-11; I_off_n[3][50] = 1.08e-10; I_off_n[3][60] = 1.51e-10; I_off_n[3][70] = 2.02e-10; I_off_n[3][80] = 2.57e-10; I_off_n[3][90] = 3.14e-10; I_off_n[3][100] = 3.85e-10; } else if (ram_cell_tech_type == comm_dram) { //COMM-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.6; Lphy[3] = 0.09; Lelec[3] = 0.0576; curr_v_th_dram_access_transistor = 1; width_dram_access_transistor = 0.09; curr_I_on_dram_cell = 20e-6; curr_I_off_dram_cell_worst_case_length_temp = 1e-15; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 6*0.09*0.09; curr_asp_ratio_cell_dram = 1.5; curr_c_dram_cell = 30e-15; //COMM-DRAM wordline transistor parameters curr_vpp = 3.7; t_ox[3] = 5.5e-3; v_th[3] = 1.0; c_ox[3] = 5.65e-15; mobility_eff[3] = 302.2 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.32; c_g_ideal[3] = 5.08e-16; c_fringe[3] = 0.08e-15; c_junc[3] = 1e-15; I_on_n[3] = 1094.3e-6; I_on_p[3] = I_on_n[3] / 2; nmos_effective_resistance_multiplier = 1.62; n_to_p_eff_curr_drv_ratio[3] = 2.05; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 5.80e-15; I_off_n[3][10] = 1.21e-14; I_off_n[3][20] = 2.42e-14; I_off_n[3][30] = 4.65e-14; I_off_n[3][40] = 8.60e-14; I_off_n[3][50] = 1.54e-13; I_off_n[3][60] = 2.66e-13; I_off_n[3][70] = 4.45e-13; I_off_n[3][80] = 7.17e-13; I_off_n[3][90] = 1.11e-12; I_off_n[3][100] = 1.67e-12; } //SRAM cell properties curr_Wmemcella_sram = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_sram = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_sram = 2.08 * g_ip->F_sz_um; curr_area_cell_sram = 146 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_sram = 1.46; //CAM cell properties //TODO: data need to be revisited curr_Wmemcella_cam = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_cam = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_cam = 2.08 * g_ip->F_sz_um; curr_area_cell_cam = 292 * g_ip->F_sz_um * g_ip->F_sz_um;//360 curr_asp_ratio_cell_cam = 2.92;//2.5 //Empirical undifferetiated core/FU coefficient curr_logic_scaling_co_eff = 1; curr_core_tx_density = 1.25*0.7*0.7; curr_sckt_co_eff = 1.1539; curr_chip_layout_overhead = 1.2;//die measurement results based on Niagara 1 and 2 curr_macro_layout_overhead = 1.1;//EDA placement and routing tool rule of thumb } if (tech == 65) { //65nm technology-node. Corresponds to year 2007 in ITRS //ITRS HP device type SENSE_AMP_D = .2e-9; // s SENSE_AMP_P = 5.7e-15; // J vdd[0] = 1.1; vdd_real[0] = g_ip->specific_hp_vdd ? g_ip->hp_Vdd : vdd[0]; alpha_power_law[0]=1.27; Lphy[0] = 0.025; Lelec[0] = 0.019; t_ox[0] = 1.1e-3; v_th[0] = .19491; c_ox[0] = 1.88e-14; mobility_eff[0] = 436.24 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[0] = 7.71e-2; c_g_ideal[0] = 4.69e-16; c_fringe[0] = 0.077e-15; c_junc[0] = 1e-15; I_on_n[0] = 1197.2e-6*pow((vdd_real[0]-v_th[0])/(vdd[0]-v_th[0]),alpha_power_law[0]); I_on_p[0] = 870.8e-6; nmos_effective_resistance_multiplier = 1.50; n_to_p_eff_curr_drv_ratio[0] = 2.41; gmp_to_gmn_multiplier[0] = 1.38; Rnchannelon[0] = nmos_effective_resistance_multiplier * vdd_real[0] / I_on_n[0]; Rpchannelon[0] = n_to_p_eff_curr_drv_ratio[0] * Rnchannelon[0]; long_channel_leakage_reduction[0] = 1/3.74; //Using MASTAR, @380K, increase Lgate until Ion reduces to 90% or Lgate increase by 10%, whichever comes first //Ioff(Lgate normal)/Ioff(Lgate long)= 3.74. I_off_n[0][0] = 1.96e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][10] = 2.29e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][20] = 2.66e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][30] = 3.05e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][40] = 3.49e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][50] = 3.95e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][60] = 4.45e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][70] = 4.97e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][80] = 5.48e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][90] = 5.94e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][100] = 6.3e-7*pow(vdd_real[0]/(vdd[0]),4); I_g_on_n[0][0] = 4.09e-8;//A/micron I_g_on_n[0][10] = 4.09e-8; I_g_on_n[0][20] = 4.09e-8; I_g_on_n[0][30] = 4.09e-8; I_g_on_n[0][40] = 4.09e-8; I_g_on_n[0][50] = 4.09e-8; I_g_on_n[0][60] = 4.09e-8; I_g_on_n[0][70] = 4.09e-8; I_g_on_n[0][80] = 4.09e-8; I_g_on_n[0][90] = 4.09e-8; I_g_on_n[0][100] = 4.09e-8; //ITRS LSTP device type vdd[1] = 1.2; vdd_real[1] = g_ip->specific_lstp_vdd ? g_ip->lstp_Vdd : vdd[1];//TODO alpha_power_law[1]=1.40; Lphy[1] = 0.045; Lelec[1] = 0.0298; t_ox[1] = 1.9e-3; v_th[1] = 0.52354; c_ox[1] = 1.36e-14; mobility_eff[1] = 341.21 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[1] = 0.128; c_g_ideal[1] = 6.14e-16; c_fringe[1] = 0.08e-15; c_junc[1] = 1e-15; I_on_n[1] = 519.2e-6*pow((vdd_real[1]-v_th[1])/(vdd[1]-v_th[1]),alpha_power_law[1]); I_on_p[1] = 266e-6; nmos_effective_resistance_multiplier = 1.96; n_to_p_eff_curr_drv_ratio[1] = 2.23; gmp_to_gmn_multiplier[1] = 0.99; Rnchannelon[1] = nmos_effective_resistance_multiplier * vdd_real[1] / I_on_n[1]; Rpchannelon[1] = n_to_p_eff_curr_drv_ratio[1] * Rnchannelon[1]; long_channel_leakage_reduction[1] = 1/2.82; I_off_n[1][0] = 9.12e-12*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][10] = 1.49e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][20] = 2.36e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][30] = 3.64e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][40] = 5.48e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][50] = 8.05e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][60] = 1.15e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][70] = 1.59e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][80] = 2.1e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][90] = 2.62e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][100] = 3.21e-10*pow(vdd_real[1]/(vdd[1]),4); I_g_on_n[1][0] = 1.09e-10;//A/micron I_g_on_n[1][10] = 1.09e-10; I_g_on_n[1][20] = 1.09e-10; I_g_on_n[1][30] = 1.09e-10; I_g_on_n[1][40] = 1.09e-10; I_g_on_n[1][50] = 1.09e-10; I_g_on_n[1][60] = 1.09e-10; I_g_on_n[1][70] = 1.09e-10; I_g_on_n[1][80] = 1.09e-10; I_g_on_n[1][90] = 1.09e-10; I_g_on_n[1][100] = 1.09e-10; //ITRS LOP device type vdd[2] = 0.8; alpha_power_law[2]=1.43; vdd_real[2] = g_ip->specific_lop_vdd ? g_ip->lop_Vdd : vdd[2]; Lphy[2] = 0.032; Lelec[2] = 0.0216; t_ox[2] = 1.2e-3; v_th[2] = 0.28512; c_ox[2] = 1.87e-14; mobility_eff[2] = 495.19 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[2] = 0.292; c_g_ideal[2] = 6e-16; c_fringe[2] = 0.08e-15; c_junc[2] = 1e-15; I_on_n[2] = 573.1e-6*pow((vdd_real[2]-v_th[2])/(vdd[2]-v_th[2]),alpha_power_law[2]); I_on_p[2] = 340.6e-6; nmos_effective_resistance_multiplier = 1.82; n_to_p_eff_curr_drv_ratio[2] = 2.28; gmp_to_gmn_multiplier[2] = 1.11; Rnchannelon[2] = nmos_effective_resistance_multiplier * vdd_real[2] / I_on_n[2]; Rpchannelon[2] = n_to_p_eff_curr_drv_ratio[2] * Rnchannelon[2]; long_channel_leakage_reduction[2] = 1/2.05; I_off_n[2][0] = 4.9e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][10] = 6.49e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][20] = 8.45e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][30] = 1.08e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][40] = 1.37e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][50] = 1.71e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][60] = 2.09e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][70] = 2.48e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][80] = 2.84e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][90] = 3.13e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][100] = 3.42e-8*pow(vdd_real[2]/(vdd[2]),5); I_g_on_n[2][0] = 9.61e-9;//A/micron I_g_on_n[2][10] = 9.61e-9; I_g_on_n[2][20] = 9.61e-9; I_g_on_n[2][30] = 9.61e-9; I_g_on_n[2][40] = 9.61e-9; I_g_on_n[2][50] = 9.61e-9; I_g_on_n[2][60] = 9.61e-9; I_g_on_n[2][70] = 9.61e-9; I_g_on_n[2][80] = 9.61e-9; I_g_on_n[2][90] = 9.61e-9; I_g_on_n[2][100] = 9.61e-9; if (ram_cell_tech_type == lp_dram) { //LP-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.2; Lphy[3] = 0.12; Lelec[3] = 0.0756; curr_v_th_dram_access_transistor = 0.43806; width_dram_access_transistor = 0.09; curr_I_on_dram_cell = 36e-6; curr_I_off_dram_cell_worst_case_length_temp = 19.6e-12; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 0.11; curr_asp_ratio_cell_dram = 1.46; curr_c_dram_cell = 20e-15; //LP-DRAM wordline transistor parameters curr_vpp = 1.6; t_ox[3] = 2.2e-3; v_th[3] = 0.43806; c_ox[3] = 1.22e-14; mobility_eff[3] = 328.32 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.43806; c_g_ideal[3] = 1.46e-15; c_fringe[3] = 0.08e-15; c_junc[3] = 1e-15 ; I_on_n[3] = 399.8e-6; I_on_p[3] = 243.4e-6; nmos_effective_resistance_multiplier = 1.65; n_to_p_eff_curr_drv_ratio[3] = 2.05; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 2.23e-11; I_off_n[3][10] = 3.46e-11; I_off_n[3][20] = 5.24e-11; I_off_n[3][30] = 7.75e-11; I_off_n[3][40] = 1.12e-10; I_off_n[3][50] = 1.58e-10; I_off_n[3][60] = 2.18e-10; I_off_n[3][70] = 2.88e-10; I_off_n[3][80] = 3.63e-10; I_off_n[3][90] = 4.41e-10; I_off_n[3][100] = 5.36e-10; } else if (ram_cell_tech_type == comm_dram) { //COMM-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.3; Lphy[3] = 0.065; Lelec[3] = 0.0426; curr_v_th_dram_access_transistor = 1; width_dram_access_transistor = 0.065; curr_I_on_dram_cell = 20e-6; curr_I_off_dram_cell_worst_case_length_temp = 1e-15; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 6*0.065*0.065; curr_asp_ratio_cell_dram = 1.5; curr_c_dram_cell = 30e-15; //COMM-DRAM wordline transistor parameters curr_vpp = 3.3; t_ox[3] = 5e-3; v_th[3] = 1.0; c_ox[3] = 6.16e-15; mobility_eff[3] = 303.44 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.385; c_g_ideal[3] = 4e-16; c_fringe[3] = 0.08e-15; c_junc[3] = 1e-15 ; I_on_n[3] = 1031e-6; I_on_p[3] = I_on_n[3] / 2; nmos_effective_resistance_multiplier = 1.69; n_to_p_eff_curr_drv_ratio[3] = 2.39; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 1.80e-14; I_off_n[3][10] = 3.64e-14; I_off_n[3][20] = 7.03e-14; I_off_n[3][30] = 1.31e-13; I_off_n[3][40] = 2.35e-13; I_off_n[3][50] = 4.09e-13; I_off_n[3][60] = 6.89e-13; I_off_n[3][70] = 1.13e-12; I_off_n[3][80] = 1.78e-12; I_off_n[3][90] = 2.71e-12; I_off_n[3][100] = 3.99e-12; } //SRAM cell properties curr_Wmemcella_sram = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_sram = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_sram = 2.08 * g_ip->F_sz_um; curr_area_cell_sram = 146 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_sram = 1.46; //CAM cell properties //TODO: data need to be revisited curr_Wmemcella_cam = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_cam = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_cam = 2.08 * g_ip->F_sz_um; curr_area_cell_cam = 292 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_cam = 2.92; //Empirical undifferetiated core/FU coefficient curr_logic_scaling_co_eff = 0.7; //Rather than scale proportionally to square of feature size, only scale linearly according to IBM cell processor curr_core_tx_density = 1.25*0.7; curr_sckt_co_eff = 1.1359; curr_chip_layout_overhead = 1.2;//die measurement results based on Niagara 1 and 2 curr_macro_layout_overhead = 1.1;//EDA placement and routing tool rule of thumb } if (tech == 45) { //45nm technology-node. Corresponds to year 2010 in ITRS //ITRS HP device type SENSE_AMP_D = .04e-9; // s SENSE_AMP_P = 2.7e-15; // J vdd[0] = 1.0; vdd_real[0] = g_ip->specific_hp_vdd ? g_ip->hp_Vdd : vdd[0];//TODO alpha_power_law[0]=1.21; Lphy[0] = 0.018; Lelec[0] = 0.01345; t_ox[0] = 0.65e-3; v_th[0] = .18035; c_ox[0] = 3.77e-14; mobility_eff[0] = 266.68 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[0] = 9.38E-2; c_g_ideal[0] = 6.78e-16; c_fringe[0] = 0.05e-15; c_junc[0] = 1e-15; I_on_n[0] = 2046.6e-6*pow((vdd_real[0]-v_th[0])/(vdd[0]-v_th[0]),alpha_power_law[0]); //There are certain problems with the ITRS PMOS numbers in MASTAR for 45nm. So we are using 65nm values of //n_to_p_eff_curr_drv_ratio and gmp_to_gmn_multiplier for 45nm I_on_p[0] = I_on_n[0] / 2;//This value is fixed arbitrarily but I_on_p is not being used in CACTI nmos_effective_resistance_multiplier = 1.51; n_to_p_eff_curr_drv_ratio[0] = 2.41; gmp_to_gmn_multiplier[0] = 1.38; Rnchannelon[0] = nmos_effective_resistance_multiplier * vdd_real[0] / I_on_n[0]; Rpchannelon[0] = n_to_p_eff_curr_drv_ratio[0] * Rnchannelon[0]; long_channel_leakage_reduction[0] = 1/3.546;//Using MASTAR, @380K, increase Lgate until Ion reduces to 90%, Ioff(Lgate normal)/Ioff(Lgate long)= 3.74 I_off_n[0][0] = 2.8e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][10] = 3.28e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][20] = 3.81e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][30] = 4.39e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][40] = 5.02e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][50] = 5.69e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][60] = 6.42e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][70] = 7.2e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][80] = 8.03e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][90] = 8.91e-7*pow(vdd_real[0]/(vdd[0]),4); I_off_n[0][100] = 9.84e-7*pow(vdd_real[0]/(vdd[0]),4); I_g_on_n[0][0] = 3.59e-8;//A/micron I_g_on_n[0][10] = 3.59e-8; I_g_on_n[0][20] = 3.59e-8; I_g_on_n[0][30] = 3.59e-8; I_g_on_n[0][40] = 3.59e-8; I_g_on_n[0][50] = 3.59e-8; I_g_on_n[0][60] = 3.59e-8; I_g_on_n[0][70] = 3.59e-8; I_g_on_n[0][80] = 3.59e-8; I_g_on_n[0][90] = 3.59e-8; I_g_on_n[0][100] = 3.59e-8; //ITRS LSTP device type vdd[1] = 1.1; vdd_real[1] = g_ip->specific_lstp_vdd ? g_ip->lstp_Vdd : vdd[1]; alpha_power_law[1]=1.33; Lphy[1] = 0.028; Lelec[1] = 0.0212; t_ox[1] = 1.4e-3; v_th[1] = 0.50245; c_ox[1] = 2.01e-14; mobility_eff[1] = 363.96 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[1] = 9.12e-2; c_g_ideal[1] = 5.18e-16; c_fringe[1] = 0.08e-15; c_junc[1] = 1e-15; I_on_n[1] = 666.2e-6*pow((vdd_real[1]-v_th[1])/(vdd[1]-v_th[1]),alpha_power_law[1]); I_on_p[1] = I_on_n[1] / 2; nmos_effective_resistance_multiplier = 1.99; n_to_p_eff_curr_drv_ratio[1] = 2.23; gmp_to_gmn_multiplier[1] = 0.99; Rnchannelon[1] = nmos_effective_resistance_multiplier * vdd_real[1] / I_on_n[1]; Rpchannelon[1] = n_to_p_eff_curr_drv_ratio[1] * Rnchannelon[1]; long_channel_leakage_reduction[1] = 1/2.08; I_off_n[1][0] = 1.01e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][10] = 1.65e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][20] = 2.62e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][30] = 4.06e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][40] = 6.12e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][50] = 9.02e-11*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][60] = 1.3e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][70] = 1.83e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][80] = 2.51e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][90] = 3.29e-10*pow(vdd_real[1]/(vdd[1]),4); I_off_n[1][100] = 4.1e-10*pow(vdd_real[1]/(vdd[1]),4); I_g_on_n[1][0] = 9.47e-12;//A/micron I_g_on_n[1][10] = 9.47e-12; I_g_on_n[1][20] = 9.47e-12; I_g_on_n[1][30] = 9.47e-12; I_g_on_n[1][40] = 9.47e-12; I_g_on_n[1][50] = 9.47e-12; I_g_on_n[1][60] = 9.47e-12; I_g_on_n[1][70] = 9.47e-12; I_g_on_n[1][80] = 9.47e-12; I_g_on_n[1][90] = 9.47e-12; I_g_on_n[1][100] = 9.47e-12; //ITRS LOP device type vdd[2] = 0.7; vdd_real[2] = g_ip->specific_lop_vdd ? g_ip->lop_Vdd : vdd[2];//TODO alpha_power_law[2]=1.39; Lphy[2] = 0.022; Lelec[2] = 0.016; t_ox[2] = 0.9e-3; v_th[2] = 0.22599; c_ox[2] = 2.82e-14;//F/micron2 mobility_eff[2] = 508.9 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[2] = 5.71e-2; c_g_ideal[2] = 6.2e-16; c_fringe[2] = 0.073e-15; c_junc[2] = 1e-15; I_on_n[2] = 748.9e-6*pow((vdd_real[2]-v_th[2])/(vdd[2]-v_th[2]),alpha_power_law[2]); I_on_p[2] = I_on_n[2] / 2; nmos_effective_resistance_multiplier = 1.76; n_to_p_eff_curr_drv_ratio[2] = 2.28; gmp_to_gmn_multiplier[2] = 1.11; Rnchannelon[2] = nmos_effective_resistance_multiplier * vdd_real[2] / I_on_n[2]; Rpchannelon[2] = n_to_p_eff_curr_drv_ratio[2] * Rnchannelon[2]; long_channel_leakage_reduction[2] = 1/1.92; I_off_n[2][0] = 4.03e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][10] = 5.02e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][20] = 6.18e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][30] = 7.51e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][40] = 9.04e-9*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][50] = 1.08e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][60] = 1.27e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][70] = 1.47e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][80] = 1.66e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][90] = 1.84e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][100] = 2.03e-8*pow(vdd_real[2]/(vdd[2]),5); I_g_on_n[2][0] = 3.24e-8;//A/micron I_g_on_n[2][10] = 4.01e-8; I_g_on_n[2][20] = 4.90e-8; I_g_on_n[2][30] = 5.92e-8; I_g_on_n[2][40] = 7.08e-8; I_g_on_n[2][50] = 8.38e-8; I_g_on_n[2][60] = 9.82e-8; I_g_on_n[2][70] = 1.14e-7; I_g_on_n[2][80] = 1.29e-7; I_g_on_n[2][90] = 1.43e-7; I_g_on_n[2][100] = 1.54e-7; if (ram_cell_tech_type == lp_dram) { //LP-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.1; Lphy[3] = 0.078; Lelec[3] = 0.0504;// Assume Lelec is 30% lesser than Lphy for DRAM access and wordline transistors. curr_v_th_dram_access_transistor = 0.44559; width_dram_access_transistor = 0.079; curr_I_on_dram_cell = 36e-6;//A curr_I_off_dram_cell_worst_case_length_temp = 19.5e-12; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = width_dram_access_transistor * Lphy[3] * 10.0; curr_asp_ratio_cell_dram = 1.46; curr_c_dram_cell = 20e-15; //LP-DRAM wordline transistor parameters curr_vpp = 1.5; t_ox[3] = 2.1e-3; v_th[3] = 0.44559; c_ox[3] = 1.41e-14; mobility_eff[3] = 426.30 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.181; c_g_ideal[3] = 1.10e-15; c_fringe[3] = 0.08e-15; c_junc[3] = 1e-15; I_on_n[3] = 456e-6; I_on_p[3] = I_on_n[3] / 2; nmos_effective_resistance_multiplier = 1.65; n_to_p_eff_curr_drv_ratio[3] = 2.05; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 2.54e-11; I_off_n[3][10] = 3.94e-11; I_off_n[3][20] = 5.95e-11; I_off_n[3][30] = 8.79e-11; I_off_n[3][40] = 1.27e-10; I_off_n[3][50] = 1.79e-10; I_off_n[3][60] = 2.47e-10; I_off_n[3][70] = 3.31e-10; I_off_n[3][80] = 4.26e-10; I_off_n[3][90] = 5.27e-10; I_off_n[3][100] = 6.46e-10; } else if (ram_cell_tech_type == comm_dram) { //COMM-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.1; Lphy[3] = 0.045; Lelec[3] = 0.0298; curr_v_th_dram_access_transistor = 1; width_dram_access_transistor = 0.045; curr_I_on_dram_cell = 20e-6;//A curr_I_off_dram_cell_worst_case_length_temp = 1e-15; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 6*0.045*0.045; curr_asp_ratio_cell_dram = 1.5; curr_c_dram_cell = 30e-15; //COMM-DRAM wordline transistor parameters curr_vpp = 2.7; t_ox[3] = 4e-3; v_th[3] = 1.0; c_ox[3] = 7.98e-15; mobility_eff[3] = 368.58 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.147; c_g_ideal[3] = 3.59e-16; c_fringe[3] = 0.08e-15; c_junc[3] = 1e-15; I_on_n[3] = 999.4e-6; I_on_p[3] = I_on_n[3] / 2; nmos_effective_resistance_multiplier = 1.69; n_to_p_eff_curr_drv_ratio[3] = 1.95; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 1.31e-14; I_off_n[3][10] = 2.68e-14; I_off_n[3][20] = 5.25e-14; I_off_n[3][30] = 9.88e-14; I_off_n[3][40] = 1.79e-13; I_off_n[3][50] = 3.15e-13; I_off_n[3][60] = 5.36e-13; I_off_n[3][70] = 8.86e-13; I_off_n[3][80] = 1.42e-12; I_off_n[3][90] = 2.20e-12; I_off_n[3][100] = 3.29e-12; } //SRAM cell properties curr_Wmemcella_sram = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_sram = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_sram = 2.08 * g_ip->F_sz_um; curr_area_cell_sram = 146 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_sram = 1.46; //CAM cell properties //TODO: data need to be revisited curr_Wmemcella_cam = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_cam = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_cam = 2.08 * g_ip->F_sz_um; curr_area_cell_cam = 292 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_cam = 2.92; //Empirical undifferetiated core/FU coefficient curr_logic_scaling_co_eff = 0.7*0.7; curr_core_tx_density = 1.25; curr_sckt_co_eff = 1.1387; curr_chip_layout_overhead = 1.2;//die measurement results based on Niagara 1 and 2 curr_macro_layout_overhead = 1.1;//EDA placement and routing tool rule of thumb } if (tech == 32) { SENSE_AMP_D = .03e-9; // s SENSE_AMP_P = 2.16e-15; // J //For 2013, MPU/ASIC stagger-contacted M1 half-pitch is 32 nm (so this is 32 nm //technology i.e. FEATURESIZE = 0.032). Using the SOI process numbers for //HP and LSTP. vdd[0] = 0.9; vdd_real[0] = g_ip->specific_hp_vdd ? g_ip->hp_Vdd : vdd[0]; alpha_power_law[0]=1.19; Lphy[0] = 0.013; Lelec[0] = 0.01013; t_ox[0] = 0.5e-3; v_th[0] = 0.21835; c_ox[0] = 4.11e-14; mobility_eff[0] = 361.84 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[0] = 5.09E-2; c_g_ideal[0] = 5.34e-16; c_fringe[0] = 0.04e-15; c_junc[0] = 1e-15; I_on_n[0] = 2211.7e-6*pow((vdd_real[0]-v_th[0])/(vdd[0]-v_th[0]),alpha_power_law[0]); I_on_p[0] = I_on_n[0] / 2; nmos_effective_resistance_multiplier = 1.49; n_to_p_eff_curr_drv_ratio[0] = 2.41; gmp_to_gmn_multiplier[0] = 1.38; Rnchannelon[0] = nmos_effective_resistance_multiplier * vdd_real[0] / I_on_n[0];//ohm-micron Rpchannelon[0] = n_to_p_eff_curr_drv_ratio[0] * Rnchannelon[0];//ohm-micron long_channel_leakage_reduction[0] = 1/3.706; //Using MASTAR, @300K (380K does not work in MASTAR), increase Lgate until Ion reduces to 95% or Lgate increase by 5% (DG device can only increase by 5%), //whichever comes first I_off_n[0][0] = 1.52e-7*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][10] = 1.55e-7*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][20] = 1.59e-7*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][30] = 1.68e-7*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][40] = 1.90e-7*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][50] = 2.69e-7*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][60] = 5.32e-7*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][70] = 1.02e-6*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][80] = 1.62e-6*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][90] = 2.73e-6*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][100] = 6.1e-6*pow(vdd_real[0]/(vdd[0]),2); I_g_on_n[0][0] = 6.55e-8;//A/micron I_g_on_n[0][10] = 6.55e-8; I_g_on_n[0][20] = 6.55e-8; I_g_on_n[0][30] = 6.55e-8; I_g_on_n[0][40] = 6.55e-8; I_g_on_n[0][50] = 6.55e-8; I_g_on_n[0][60] = 6.55e-8; I_g_on_n[0][70] = 6.55e-8; I_g_on_n[0][80] = 6.55e-8; I_g_on_n[0][90] = 6.55e-8; I_g_on_n[0][100] = 6.55e-8; // 32 DG // I_g_on_n[0][0] = 2.71e-9;//A/micron // I_g_on_n[0][10] = 2.71e-9; // I_g_on_n[0][20] = 2.71e-9; // I_g_on_n[0][30] = 2.71e-9; // I_g_on_n[0][40] = 2.71e-9; // I_g_on_n[0][50] = 2.71e-9; // I_g_on_n[0][60] = 2.71e-9; // I_g_on_n[0][70] = 2.71e-9; // I_g_on_n[0][80] = 2.71e-9; // I_g_on_n[0][90] = 2.71e-9; // I_g_on_n[0][100] = 2.71e-9; //LSTP device type vdd[1] = 1; vdd_real[1] = g_ip->specific_lstp_vdd ? g_ip->lstp_Vdd : vdd[1]; alpha_power_law[1]=1.27; Lphy[1] = 0.020; Lelec[1] = 0.0173; t_ox[1] = 1.2e-3; v_th[1] = 0.513; c_ox[1] = 2.29e-14; mobility_eff[1] = 347.46 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[1] = 8.64e-2; c_g_ideal[1] = 4.58e-16; c_fringe[1] = 0.053e-15; c_junc[1] = 1e-15; I_on_n[1] = 683.6e-6*pow((vdd_real[1]-v_th[1])/(vdd[1]-v_th[1]),alpha_power_law[1]); I_on_p[1] = I_on_n[1] / 2; nmos_effective_resistance_multiplier = 1.99; n_to_p_eff_curr_drv_ratio[1] = 2.23; gmp_to_gmn_multiplier[1] = 0.99; Rnchannelon[1] = nmos_effective_resistance_multiplier * vdd_real[1] / I_on_n[1]; Rpchannelon[1] = n_to_p_eff_curr_drv_ratio[1] * Rnchannelon[1]; long_channel_leakage_reduction[1] = 1/1.93; I_off_n[1][0] = 2.06e-11*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][10] = 3.30e-11*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][20] = 5.15e-11*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][30] = 7.83e-11*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][40] = 1.16e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][50] = 1.69e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][60] = 2.40e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][70] = 3.34e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][80] = 4.54e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][90] = 5.96e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][100] = 7.44e-10*pow(vdd_real[1]/(vdd[1]),1); I_g_on_n[1][0] = 3.73e-11;//A/micron I_g_on_n[1][10] = 3.73e-11; I_g_on_n[1][20] = 3.73e-11; I_g_on_n[1][30] = 3.73e-11; I_g_on_n[1][40] = 3.73e-11; I_g_on_n[1][50] = 3.73e-11; I_g_on_n[1][60] = 3.73e-11; I_g_on_n[1][70] = 3.73e-11; I_g_on_n[1][80] = 3.73e-11; I_g_on_n[1][90] = 3.73e-11; I_g_on_n[1][100] = 3.73e-11; //LOP device type vdd[2] = 0.6; vdd_real[2] = g_ip->specific_lop_vdd ? g_ip->lop_Vdd : vdd[2];//TODO alpha_power_law[2]=1.26; Lphy[2] = 0.016; Lelec[2] = 0.01232; t_ox[2] = 0.9e-3; v_th[2] = 0.24227; c_ox[2] = 2.84e-14; mobility_eff[2] = 513.52 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[2] = 4.64e-2; c_g_ideal[2] = 4.54e-16; c_fringe[2] = 0.057e-15; c_junc[2] = 1e-15; I_on_n[2] = 827.8e-6*pow((vdd_real[2]-v_th[2])/(vdd[2]-v_th[2]),alpha_power_law[2]); I_on_p[2] = I_on_n[2] / 2; nmos_effective_resistance_multiplier = 1.73; n_to_p_eff_curr_drv_ratio[2] = 2.28; gmp_to_gmn_multiplier[2] = 1.11; Rnchannelon[2] = nmos_effective_resistance_multiplier * vdd_real[2] / I_on_n[2]; Rpchannelon[2] = n_to_p_eff_curr_drv_ratio[2] * Rnchannelon[2]; long_channel_leakage_reduction[2] = 1/1.89; I_off_n[2][0] = 5.94e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][10] = 7.23e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][20] = 8.7e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][30] = 1.04e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][40] = 1.22e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][50] = 1.43e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][60] = 1.65e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][70] = 1.90e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][80] = 2.15e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][90] = 2.39e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][100] = 2.63e-7*pow(vdd_real[2]/(vdd[2]),5); I_g_on_n[2][0] = 2.93e-9;//A/micron I_g_on_n[2][10] = 2.93e-9; I_g_on_n[2][20] = 2.93e-9; I_g_on_n[2][30] = 2.93e-9; I_g_on_n[2][40] = 2.93e-9; I_g_on_n[2][50] = 2.93e-9; I_g_on_n[2][60] = 2.93e-9; I_g_on_n[2][70] = 2.93e-9; I_g_on_n[2][80] = 2.93e-9; I_g_on_n[2][90] = 2.93e-9; I_g_on_n[2][100] = 2.93e-9; if (ram_cell_tech_type == lp_dram) { //LP-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.0; Lphy[3] = 0.056; Lelec[3] = 0.0419;//Assume Lelec is 30% lesser than Lphy for DRAM access and wordline transistors. curr_v_th_dram_access_transistor = 0.44129; width_dram_access_transistor = 0.056; curr_I_on_dram_cell = 36e-6; curr_I_off_dram_cell_worst_case_length_temp = 18.9e-12; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = width_dram_access_transistor * Lphy[3] * 10.0; curr_asp_ratio_cell_dram = 1.46; curr_c_dram_cell = 20e-15; //LP-DRAM wordline transistor parameters curr_vpp = 1.5; t_ox[3] = 2e-3; v_th[3] = 0.44467; c_ox[3] = 1.48e-14; mobility_eff[3] = 408.12 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.174; c_g_ideal[3] = 7.45e-16; c_fringe[3] = 0.053e-15; c_junc[3] = 1e-15; I_on_n[3] = 1055.4e-6; I_on_p[3] = I_on_n[3] / 2; nmos_effective_resistance_multiplier = 1.65; n_to_p_eff_curr_drv_ratio[3] = 2.05; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 3.57e-11; I_off_n[3][10] = 5.51e-11; I_off_n[3][20] = 8.27e-11; I_off_n[3][30] = 1.21e-10; I_off_n[3][40] = 1.74e-10; I_off_n[3][50] = 2.45e-10; I_off_n[3][60] = 3.38e-10; I_off_n[3][70] = 4.53e-10; I_off_n[3][80] = 5.87e-10; I_off_n[3][90] = 7.29e-10; I_off_n[3][100] = 8.87e-10; } else if (ram_cell_tech_type == comm_dram) { //COMM-DRAM cell access transistor technology parameters curr_vdd_dram_cell = 1.0; Lphy[3] = 0.032; Lelec[3] = 0.0205;//Assume Lelec is 30% lesser than Lphy for DRAM access and wordline transistors. curr_v_th_dram_access_transistor = 1; width_dram_access_transistor = 0.032; curr_I_on_dram_cell = 20e-6; curr_I_off_dram_cell_worst_case_length_temp = 1e-15; curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 6*0.032*0.032; curr_asp_ratio_cell_dram = 1.5; curr_c_dram_cell = 30e-15; //COMM-DRAM wordline transistor parameters curr_vpp = 2.6; t_ox[3] = 4e-3; v_th[3] = 1.0; c_ox[3] = 7.99e-15; mobility_eff[3] = 380.76 * (1e-2 * 1e6 * 1e-2 * 1e6); Vdsat[3] = 0.129; c_g_ideal[3] = 2.56e-16; c_fringe[3] = 0.053e-15; c_junc[3] = 1e-15; I_on_n[3] = 1024.5e-6; I_on_p[3] = I_on_n[3] / 2; nmos_effective_resistance_multiplier = 1.69; n_to_p_eff_curr_drv_ratio[3] = 1.95; gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3]; Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3]; long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 3.63e-14; I_off_n[3][10] = 7.18e-14; I_off_n[3][20] = 1.36e-13; I_off_n[3][30] = 2.49e-13; I_off_n[3][40] = 4.41e-13; I_off_n[3][50] = 7.55e-13; I_off_n[3][60] = 1.26e-12; I_off_n[3][70] = 2.03e-12; I_off_n[3][80] = 3.19e-12; I_off_n[3][90] = 4.87e-12; I_off_n[3][100] = 7.16e-12; } //SRAM cell properties curr_Wmemcella_sram = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_sram = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_sram = 2.08 * g_ip->F_sz_um; curr_area_cell_sram = 146 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_sram = 1.46; //CAM cell properties //TODO: data need to be revisited curr_Wmemcella_cam = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_cam = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_cam = 2.08 * g_ip->F_sz_um; curr_area_cell_cam = 292 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_cam = 2.92; //Empirical undifferetiated core/FU coefficient curr_logic_scaling_co_eff = 0.7*0.7*0.7; curr_core_tx_density = 1.25/0.7; curr_sckt_co_eff = 1.1111; curr_chip_layout_overhead = 1.2;//die measurement results based on Niagara 1 and 2 curr_macro_layout_overhead = 1.1;//EDA placement and routing tool rule of thumb } if(tech == 22){ SENSE_AMP_D = .03e-9; // s SENSE_AMP_P = 2.16e-15; // J //For 2016, MPU/ASIC stagger-contacted M1 half-pitch is 22 nm (so this is 22 nm //technology i.e. FEATURESIZE = 0.022). Using the DG process numbers for HP. //22 nm HP vdd[0] = 0.8; vdd_real[0] = g_ip->specific_hp_vdd ? g_ip->hp_Vdd : vdd[0];//TODO alpha_power_law[0]=1.2;//1.3//1.15; Lphy[0] = 0.009;//Lphy is the physical gate-length. Lelec[0] = 0.00468;//Lelec is the electrical gate-length. t_ox[0] = 0.55e-3;//micron v_th[0] = 0.1395;//V c_ox[0] = 3.63e-14;//F/micron2 mobility_eff[0] = 426.07 * (1e-2 * 1e6 * 1e-2 * 1e6); //micron2 / Vs Vdsat[0] = 2.33e-2; //V/micron c_g_ideal[0] = 3.27e-16;//F/micron c_fringe[0] = 0.06e-15;//F/micron c_junc[0] = 0;//F/micron2 I_on_n[0] = 2626.4e-6*pow((vdd_real[0]-v_th[0])/(vdd[0]-v_th[0]),alpha_power_law[0]);//A/micron I_on_p[0] = I_on_n[0] / 2;//A/micron //This value for I_on_p is not really used. nmos_effective_resistance_multiplier = 1.45; n_to_p_eff_curr_drv_ratio[0] = 2; //Wpmos/Wnmos = 2 in 2007 MASTAR. Look in //"Dynamic" tab of Device workspace. gmp_to_gmn_multiplier[0] = 1.38; //Just using the 32nm SOI value. Rnchannelon[0] = nmos_effective_resistance_multiplier * vdd_real[0] / I_on_n[0];//ohm-micron Rpchannelon[0] = n_to_p_eff_curr_drv_ratio[0] * Rnchannelon[0];//ohm-micron long_channel_leakage_reduction[0] = 1/3.274; I_off_n[0][0] = 1.52e-7/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2);//From 22nm, leakage current are directly from ITRS report rather than MASTAR, since MASTAR has serious bugs there. I_off_n[0][10] = 1.55e-7/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][20] = 1.59e-7/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][30] = 1.68e-7/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][40] = 1.90e-7/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][50] = 2.69e-7/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][60] = 5.32e-7/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][70] = 1.02e-6/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][80] = 1.62e-6/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][90] = 2.73e-6/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); I_off_n[0][100] = 6.1e-6/1.5*1.2*pow(vdd_real[0]/(vdd[0]),2); //for 22nm DG HP I_g_on_n[0][0] = 1.81e-9;//A/micron I_g_on_n[0][10] = 1.81e-9; I_g_on_n[0][20] = 1.81e-9; I_g_on_n[0][30] = 1.81e-9; I_g_on_n[0][40] = 1.81e-9; I_g_on_n[0][50] = 1.81e-9; I_g_on_n[0][60] = 1.81e-9; I_g_on_n[0][70] = 1.81e-9; I_g_on_n[0][80] = 1.81e-9; I_g_on_n[0][90] = 1.81e-9; I_g_on_n[0][100] = 1.81e-9; //22 nm LSTP DG vdd[1] = 0.8; vdd_real[1] = g_ip->specific_lstp_vdd ? g_ip->lstp_Vdd : vdd[1];//TODO alpha_power_law[1]=1.23; Lphy[1] = 0.014; Lelec[1] = 0.008;//Lelec is the electrical gate-length. t_ox[1] = 1.1e-3;//micron v_th[1] = 0.40126;//V c_ox[1] = 2.30e-14;//F/micron2 mobility_eff[1] = 738.09 * (1e-2 * 1e6 * 1e-2 * 1e6); //micron2 / Vs Vdsat[1] = 6.64e-2; //V/micron c_g_ideal[1] = 3.22e-16;//F/micron c_fringe[1] = 0.08e-15; c_junc[1] = 0;//F/micron2 I_on_n[1] = 727.6e-6*pow((vdd_real[1]-v_th[1])/(vdd[1]-v_th[1]),alpha_power_law[1]);//A/micron I_on_p[1] = I_on_n[1] / 2; nmos_effective_resistance_multiplier = 1.99; n_to_p_eff_curr_drv_ratio[1] = 2; gmp_to_gmn_multiplier[1] = 0.99; Rnchannelon[1] = nmos_effective_resistance_multiplier * vdd_real[1] / I_on_n[1];//ohm-micron Rpchannelon[1] = n_to_p_eff_curr_drv_ratio[1] * Rnchannelon[1];//ohm-micron long_channel_leakage_reduction[1] = 1/1.89; I_off_n[1][0] = 2.43e-11*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][10] = 4.85e-11*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][20] = 9.68e-11*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][30] = 1.94e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][40] = 3.87e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][50] = 7.73e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][60] = 3.55e-10*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][70] = 3.09e-9*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][80] = 6.19e-9*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][90] = 1.24e-8*pow(vdd_real[1]/(vdd[1]),1); I_off_n[1][100]= 2.48e-8*pow(vdd_real[1]/(vdd[1]),1); I_g_on_n[1][0] = 4.51e-10;//A/micron I_g_on_n[1][10] = 4.51e-10; I_g_on_n[1][20] = 4.51e-10; I_g_on_n[1][30] = 4.51e-10; I_g_on_n[1][40] = 4.51e-10; I_g_on_n[1][50] = 4.51e-10; I_g_on_n[1][60] = 4.51e-10; I_g_on_n[1][70] = 4.51e-10; I_g_on_n[1][80] = 4.51e-10; I_g_on_n[1][90] = 4.51e-10; I_g_on_n[1][100] = 4.51e-10; //22 nm LOP vdd[2] = 0.6; vdd_real[2] = g_ip->specific_lop_vdd ? g_ip->lop_Vdd : vdd[2];//TODO alpha_power_law[2]=1.21; Lphy[2] = 0.011; Lelec[2] = 0.00604;//Lelec is the electrical gate-length. t_ox[2] = 0.8e-3;//micron v_th[2] = 0.2315;//V c_ox[2] = 2.87e-14;//F/micron2 mobility_eff[2] = 698.37 * (1e-2 * 1e6 * 1e-2 * 1e6); //micron2 / Vs Vdsat[2] = 1.81e-2; //V/micron c_g_ideal[2] = 3.16e-16;//F/micron c_fringe[2] = 0.08e-15; c_junc[2] = 0;//F/micron2 This is Cj0 not Cjunc in MASTAR results->Dynamic Tab I_on_n[2] = 916.1e-6*pow((vdd_real[2]-v_th[2])/(vdd[2]-v_th[2]),alpha_power_law[2]);//A/micron I_on_p[2] = I_on_n[2] / 2; nmos_effective_resistance_multiplier = 1.73; n_to_p_eff_curr_drv_ratio[2] = 2; gmp_to_gmn_multiplier[2] = 1.11; Rnchannelon[2] = nmos_effective_resistance_multiplier * vdd_real[2] / I_on_n[2];//ohm-micron Rpchannelon[2] = n_to_p_eff_curr_drv_ratio[2] * Rnchannelon[2];//ohm-micron long_channel_leakage_reduction[2] = 1/2.38; I_off_n[2][0] = 1.31e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][10] = 2.60e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][20] = 5.14e-8*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][30] = 1.02e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][40] = 2.02e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][50] = 3.99e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][60] = 7.91e-7*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][70] = 1.09e-6*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][80] = 2.09e-6*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][90] = 4.04e-6*pow(vdd_real[2]/(vdd[2]),5); I_off_n[2][100]= 4.48e-6*pow(vdd_real[2]/(vdd[2]),5); I_g_on_n[2][0] = 2.74e-9;//A/micron I_g_on_n[2][10] = 2.74e-9; I_g_on_n[2][20] = 2.74e-9; I_g_on_n[2][30] = 2.74e-9; I_g_on_n[2][40] = 2.74e-9; I_g_on_n[2][50] = 2.74e-9; I_g_on_n[2][60] = 2.74e-9; I_g_on_n[2][70] = 2.74e-9; I_g_on_n[2][80] = 2.74e-9; I_g_on_n[2][90] = 2.74e-9; I_g_on_n[2][100] = 2.74e-9; if (ram_cell_tech_type == 3) {} else if (ram_cell_tech_type == 4) { //22 nm commodity DRAM cell access transistor technology parameters. //parameters curr_vdd_dram_cell = 0.9;//0.45;//This value has reduced greatly in 2007 ITRS for all technology nodes. In //2005 ITRS, the value was about twice the value in 2007 ITRS Lphy[3] = 0.022;//micron Lelec[3] = 0.0181;//micron. curr_v_th_dram_access_transistor = 1;//V width_dram_access_transistor = 0.022;//micron curr_I_on_dram_cell = 20e-6; //This is a typical value that I have always //kept constant. In reality this could perhaps be lower curr_I_off_dram_cell_worst_case_length_temp = 1e-15;//A curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 6*0.022*0.022;//micron2. curr_asp_ratio_cell_dram = 0.667; curr_c_dram_cell = 30e-15;//This is a typical value that I have alwaus //kept constant. //22 nm commodity DRAM wordline transistor parameters obtained using MASTAR. curr_vpp = 2.3;//vpp. V t_ox[3] = 3.5e-3;//micron v_th[3] = 1.0;//V c_ox[3] = 9.06e-15;//F/micron2 mobility_eff[3] = 367.29 * (1e-2 * 1e6 * 1e-2 * 1e6);//micron2 / Vs Vdsat[3] = 0.0972; //V/micron c_g_ideal[3] = 1.99e-16;//F/micron c_fringe[3] = 0.053e-15;//F/micron c_junc[3] = 1e-15;//F/micron2 I_on_n[3] = 910.5e-6;//A/micron I_on_p[3] = I_on_n[3] / 2;//This value for I_on_p is not really used. nmos_effective_resistance_multiplier = 1.69;//Using the value from 32nm. // n_to_p_eff_curr_drv_ratio[3] = 1.95;//Using the value from 32nm gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3];//ohm-micron Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3];//ohm-micron long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 1.1e-13; //A/micron I_off_n[3][10] = 2.11e-13; I_off_n[3][20] = 3.88e-13; I_off_n[3][30] = 6.9e-13; I_off_n[3][40] = 1.19e-12; I_off_n[3][50] = 1.98e-12; I_off_n[3][60] = 3.22e-12; I_off_n[3][70] = 5.09e-12; I_off_n[3][80] = 7.85e-12; I_off_n[3][90] = 1.18e-11; I_off_n[3][100] = 1.72e-11; } else { //some error handler } //SRAM cell properties curr_Wmemcella_sram = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_sram = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_sram = 2.08 * g_ip->F_sz_um; curr_area_cell_sram = 146 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_sram = 1.46; //CAM cell properties //TODO: data need to be revisited curr_Wmemcella_cam = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_cam = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_cam = 2.08 * g_ip->F_sz_um; curr_area_cell_cam = 292 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_cam = 2.92; //Empirical undifferetiated core/FU coefficient curr_logic_scaling_co_eff = 0.7*0.7*0.7*0.7; curr_core_tx_density = 1.25/0.7/0.7; curr_sckt_co_eff = 1.1296; curr_chip_layout_overhead = 1.2;//die measurement results based on Niagara 1 and 2 curr_macro_layout_overhead = 1.1;//EDA placement and routing tool rule of thumb } if(tech == 16){ //For 2019, MPU/ASIC stagger-contacted M1 half-pitch is 16 nm (so this is 16 nm //technology i.e. FEATURESIZE = 0.016). Using the DG process numbers for HP. //16 nm HP vdd[0] = 0.7; Lphy[0] = 0.006;//Lphy is the physical gate-length. Lelec[0] = 0.00315;//Lelec is the electrical gate-length. t_ox[0] = 0.5e-3;//micron v_th[0] = 0.1489;//V c_ox[0] = 3.83e-14;//F/micron2 Cox_elec in MASTAR mobility_eff[0] = 476.15 * (1e-2 * 1e6 * 1e-2 * 1e6); //micron2 / Vs Vdsat[0] = 1.42e-2; //V/micron calculated in spreadsheet c_g_ideal[0] = 2.30e-16;//F/micron c_fringe[0] = 0.06e-15;//F/micron MASTAR inputdynamic/3 c_junc[0] = 0;//F/micron2 MASTAR result dynamic I_on_n[0] = 2768.4e-6;//A/micron I_on_p[0] = I_on_n[0] / 2;//A/micron //This value for I_on_p is not really used. nmos_effective_resistance_multiplier = 1.48;//nmos_effective_resistance_multiplier is the ratio of Ieff to Idsat where Ieff is the effective NMOS current and Idsat is the saturation current. n_to_p_eff_curr_drv_ratio[0] = 2; //Wpmos/Wnmos = 2 in 2007 MASTAR. Look in //"Dynamic" tab of Device workspace. gmp_to_gmn_multiplier[0] = 1.38; //Just using the 32nm SOI value. Rnchannelon[0] = nmos_effective_resistance_multiplier * vdd[0] / I_on_n[0];//ohm-micron Rpchannelon[0] = n_to_p_eff_curr_drv_ratio[0] * Rnchannelon[0];//ohm-micron long_channel_leakage_reduction[0] = 1/2.655; I_off_n[0][0] = 1.52e-7/1.5*1.2*1.07; I_off_n[0][10] = 1.55e-7/1.5*1.2*1.07; I_off_n[0][20] = 1.59e-7/1.5*1.2*1.07; I_off_n[0][30] = 1.68e-7/1.5*1.2*1.07; I_off_n[0][40] = 1.90e-7/1.5*1.2*1.07; I_off_n[0][50] = 2.69e-7/1.5*1.2*1.07; I_off_n[0][60] = 5.32e-7/1.5*1.2*1.07; I_off_n[0][70] = 1.02e-6/1.5*1.2*1.07; I_off_n[0][80] = 1.62e-6/1.5*1.2*1.07; I_off_n[0][90] = 2.73e-6/1.5*1.2*1.07; I_off_n[0][100] = 6.1e-6/1.5*1.2*1.07; //for 16nm DG HP I_g_on_n[0][0] = 1.07e-9;//A/micron I_g_on_n[0][10] = 1.07e-9; I_g_on_n[0][20] = 1.07e-9; I_g_on_n[0][30] = 1.07e-9; I_g_on_n[0][40] = 1.07e-9; I_g_on_n[0][50] = 1.07e-9; I_g_on_n[0][60] = 1.07e-9; I_g_on_n[0][70] = 1.07e-9; I_g_on_n[0][80] = 1.07e-9; I_g_on_n[0][90] = 1.07e-9; I_g_on_n[0][100] = 1.07e-9; // //16 nm LSTP DG // vdd[1] = 0.8; // Lphy[1] = 0.014; // Lelec[1] = 0.008;//Lelec is the electrical gate-length. // t_ox[1] = 1.1e-3;//micron // v_th[1] = 0.40126;//V // c_ox[1] = 2.30e-14;//F/micron2 // mobility_eff[1] = 738.09 * (1e-2 * 1e6 * 1e-2 * 1e6); //micron2 / Vs // Vdsat[1] = 6.64e-2; //V/micron // c_g_ideal[1] = 3.22e-16;//F/micron // c_fringe[1] = 0.008e-15; // c_junc[1] = 0;//F/micron2 // I_on_n[1] = 727.6e-6;//A/micron // I_on_p[1] = I_on_n[1] / 2; // nmos_effective_resistance_multiplier = 1.99; // n_to_p_eff_curr_drv_ratio[1] = 2; // gmp_to_gmn_multiplier[1] = 0.99; // Rnchannelon[1] = nmos_effective_resistance_multiplier * vdd[1] / I_on_n[1];//ohm-micron // Rpchannelon[1] = n_to_p_eff_curr_drv_ratio[1] * Rnchannelon[1];//ohm-micron // I_off_n[1][0] = 2.43e-11; // I_off_n[1][10] = 4.85e-11; // I_off_n[1][20] = 9.68e-11; // I_off_n[1][30] = 1.94e-10; // I_off_n[1][40] = 3.87e-10; // I_off_n[1][50] = 7.73e-10; // I_off_n[1][60] = 3.55e-10; // I_off_n[1][70] = 3.09e-9; // I_off_n[1][80] = 6.19e-9; // I_off_n[1][90] = 1.24e-8; // I_off_n[1][100]= 2.48e-8; // // // for 22nm LSTP HP // I_g_on_n[1][0] = 4.51e-10;//A/micron // I_g_on_n[1][10] = 4.51e-10; // I_g_on_n[1][20] = 4.51e-10; // I_g_on_n[1][30] = 4.51e-10; // I_g_on_n[1][40] = 4.51e-10; // I_g_on_n[1][50] = 4.51e-10; // I_g_on_n[1][60] = 4.51e-10; // I_g_on_n[1][70] = 4.51e-10; // I_g_on_n[1][80] = 4.51e-10; // I_g_on_n[1][90] = 4.51e-10; // I_g_on_n[1][100] = 4.51e-10; if (ram_cell_tech_type == 3) {} else if (ram_cell_tech_type == 4) { //22 nm commodity DRAM cell access transistor technology parameters. //parameters curr_vdd_dram_cell = 0.9;//0.45;//This value has reduced greatly in 2007 ITRS for all technology nodes. In //2005 ITRS, the value was about twice the value in 2007 ITRS Lphy[3] = 0.022;//micron Lelec[3] = 0.0181;//micron. curr_v_th_dram_access_transistor = 1;//V width_dram_access_transistor = 0.022;//micron curr_I_on_dram_cell = 20e-6; //This is a typical value that I have always //kept constant. In reality this could perhaps be lower curr_I_off_dram_cell_worst_case_length_temp = 1e-15;//A curr_Wmemcella_dram = width_dram_access_transistor; curr_Wmemcellpmos_dram = 0; curr_Wmemcellnmos_dram = 0; curr_area_cell_dram = 6*0.022*0.022;//micron2. curr_asp_ratio_cell_dram = 0.667; curr_c_dram_cell = 30e-15;//This is a typical value that I have alwaus //kept constant. //22 nm commodity DRAM wordline transistor parameters obtained using MASTAR. curr_vpp = 2.3;//vpp. V t_ox[3] = 3.5e-3;//micron v_th[3] = 1.0;//V c_ox[3] = 9.06e-15;//F/micron2 mobility_eff[3] = 367.29 * (1e-2 * 1e6 * 1e-2 * 1e6);//micron2 / Vs Vdsat[3] = 0.0972; //V/micron c_g_ideal[3] = 1.99e-16;//F/micron c_fringe[3] = 0.053e-15;//F/micron c_junc[3] = 1e-15;//F/micron2 I_on_n[3] = 910.5e-6;//A/micron I_on_p[3] = I_on_n[3] / 2;//This value for I_on_p is not really used. nmos_effective_resistance_multiplier = 1.69;//Using the value from 32nm. // n_to_p_eff_curr_drv_ratio[3] = 1.95;//Using the value from 32nm gmp_to_gmn_multiplier[3] = 0.90; Rnchannelon[3] = nmos_effective_resistance_multiplier * curr_vpp / I_on_n[3];//ohm-micron Rpchannelon[3] = n_to_p_eff_curr_drv_ratio[3] * Rnchannelon[3];//ohm-micron long_channel_leakage_reduction[3] = 1; I_off_n[3][0] = 1.1e-13; //A/micron I_off_n[3][10] = 2.11e-13; I_off_n[3][20] = 3.88e-13; I_off_n[3][30] = 6.9e-13; I_off_n[3][40] = 1.19e-12; I_off_n[3][50] = 1.98e-12; I_off_n[3][60] = 3.22e-12; I_off_n[3][70] = 5.09e-12; I_off_n[3][80] = 7.85e-12; I_off_n[3][90] = 1.18e-11; I_off_n[3][100] = 1.72e-11; } else { //some error handler } //SRAM cell properties curr_Wmemcella_sram = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_sram = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_sram = 2.08 * g_ip->F_sz_um; curr_area_cell_sram = 146 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_sram = 1.46; //CAM cell properties //TODO: data need to be revisited curr_Wmemcella_cam = 1.31 * g_ip->F_sz_um; curr_Wmemcellpmos_cam = 1.23 * g_ip->F_sz_um; curr_Wmemcellnmos_cam = 2.08 * g_ip->F_sz_um; curr_area_cell_cam = 292 * g_ip->F_sz_um * g_ip->F_sz_um; curr_asp_ratio_cell_cam = 2.92; //Empirical undifferetiated core/FU coefficient curr_logic_scaling_co_eff = 0.7*0.7*0.7*0.7*0.7; curr_core_tx_density = 1.25/0.7/0.7/0.7; curr_sckt_co_eff = 1.1296; curr_chip_layout_overhead = 1.2;//die measurement results based on Niagara 1 and 2 curr_macro_layout_overhead = 1.1;//EDA placement and routing tool rule of thumb } /* * TODO:WL_Vcc does not need to retain data as long as the wordline enable signal is not active (of course enable signal will not be active since it is idle) * So, the WL_Vcc only need to balance the leakage reduction and the required waking up restore time (as mentioned in the 4.0Ghz 291 Mb SRAM Intel Paper) */ g_tp.peri_global.Vdd += curr_alpha * vdd_real[peri_global_tech_type];//real vdd, user defined or itrs g_tp.peri_global.Vdd_default += curr_alpha * vdd[peri_global_tech_type];//itrs vdd this does not have to do within line interpolation loop, can be assigned directly g_tp.peri_global.Vth += curr_alpha * v_th[peri_global_tech_type]; g_tp.peri_global.Vcc_min_default += g_tp.peri_global.Vdd_default * 0.45;// Use minimal voltage to keep the device conducted.//g_tp.peri_global.Vth; g_tp.peri_global.t_ox += curr_alpha * t_ox[peri_global_tech_type]; g_tp.peri_global.C_ox += curr_alpha * c_ox[peri_global_tech_type]; g_tp.peri_global.C_g_ideal += curr_alpha * c_g_ideal[peri_global_tech_type]; g_tp.peri_global.C_fringe += curr_alpha * c_fringe[peri_global_tech_type]; g_tp.peri_global.C_junc += curr_alpha * c_junc[peri_global_tech_type]; g_tp.peri_global.C_junc_sidewall = 0.25e-15; // F/micron g_tp.peri_global.l_phy += curr_alpha * Lphy[peri_global_tech_type]; g_tp.peri_global.l_elec += curr_alpha * Lelec[peri_global_tech_type]; g_tp.peri_global.I_on_n += curr_alpha * I_on_n[peri_global_tech_type]; g_tp.peri_global.R_nch_on += curr_alpha * Rnchannelon[peri_global_tech_type]; g_tp.peri_global.R_pch_on += curr_alpha * Rpchannelon[peri_global_tech_type]; g_tp.peri_global.n_to_p_eff_curr_drv_ratio += curr_alpha * n_to_p_eff_curr_drv_ratio[peri_global_tech_type]; g_tp.peri_global.long_channel_leakage_reduction += curr_alpha * long_channel_leakage_reduction[peri_global_tech_type]; g_tp.peri_global.I_off_n += curr_alpha * I_off_n[peri_global_tech_type][g_ip->temp - 300];//*pow(g_tp.peri_global.Vdd/g_tp.peri_global.Vdd_default,3);//Consider the voltage change may affect the current density as well. TODO: polynomial curve-fitting based on MASTAR may not be accurate enough g_tp.peri_global.I_off_p += curr_alpha * I_off_n[peri_global_tech_type][g_ip->temp - 300];//*pow(g_tp.peri_global.Vdd/g_tp.peri_global.Vdd_default,3);//To mimic the Vdd effect on Ioff (for the same device, dvs should not change default Ioff---only changes if device is different?? but MASTAR shows different results) g_tp.peri_global.I_g_on_n += curr_alpha * I_g_on_n[peri_global_tech_type][g_ip->temp - 300]; g_tp.peri_global.I_g_on_p += curr_alpha * I_g_on_n[peri_global_tech_type][g_ip->temp - 300]; gmp_to_gmn_multiplier_periph_global += curr_alpha * gmp_to_gmn_multiplier[peri_global_tech_type]; g_tp.peri_global.Mobility_n += curr_alpha *mobility_eff[peri_global_tech_type]; //Sleep tx uses LSTP devices g_tp.sleep_tx.Vdd += curr_alpha * vdd_real[1]; g_tp.sleep_tx.Vdd_default += curr_alpha * vdd[1]; g_tp.sleep_tx.Vth += curr_alpha * v_th[1]; g_tp.sleep_tx.Vcc_min_default += g_tp.sleep_tx.Vdd; g_tp.sleep_tx.Vcc_min = g_tp.sleep_tx.Vcc_min_default;//user cannot change this, has to be decided by technology g_tp.sleep_tx.t_ox += curr_alpha * t_ox[1]; g_tp.sleep_tx.C_ox += curr_alpha * c_ox[1]; g_tp.sleep_tx.C_g_ideal += curr_alpha * c_g_ideal[1]; g_tp.sleep_tx.C_fringe += curr_alpha * c_fringe[1]; g_tp.sleep_tx.C_junc += curr_alpha * c_junc[1]; g_tp.sleep_tx.C_junc_sidewall = 0.25e-15; // F/micron g_tp.sleep_tx.l_phy += curr_alpha * Lphy[1]; g_tp.sleep_tx.l_elec += curr_alpha * Lelec[1]; g_tp.sleep_tx.I_on_n += curr_alpha * I_on_n[1]; g_tp.sleep_tx.R_nch_on += curr_alpha * Rnchannelon[1]; g_tp.sleep_tx.R_pch_on += curr_alpha * Rpchannelon[1]; g_tp.sleep_tx.n_to_p_eff_curr_drv_ratio += curr_alpha * n_to_p_eff_curr_drv_ratio[1]; g_tp.sleep_tx.long_channel_leakage_reduction += curr_alpha * long_channel_leakage_reduction[1]; g_tp.sleep_tx.I_off_n += curr_alpha * I_off_n[1][g_ip->temp - 300];//**pow(g_tp.sleep_tx.Vdd/g_tp.sleep_tx.Vdd_default,4); g_tp.sleep_tx.I_off_p += curr_alpha * I_off_n[1][g_ip->temp - 300];//**pow(g_tp.sleep_tx.Vdd/g_tp.sleep_tx.Vdd_default,4); g_tp.sleep_tx.I_g_on_n += curr_alpha * I_g_on_n[1][g_ip->temp - 300]; g_tp.sleep_tx.I_g_on_p += curr_alpha * I_g_on_n[1][g_ip->temp - 300]; g_tp.sleep_tx.Mobility_n += curr_alpha *mobility_eff[1]; // gmp_to_gmn_multiplier_periph_global += curr_alpha * gmp_to_gmn_multiplier[1]; g_tp.sram_cell.Vdd += curr_alpha * vdd_real[ram_cell_tech_type]; g_tp.sram_cell.Vdd_default += curr_alpha * vdd[ram_cell_tech_type]; g_tp.sram_cell.Vth += curr_alpha * v_th[ram_cell_tech_type]; g_tp.sram_cell.Vcc_min_default += g_tp.sram_cell.Vdd_default * 0.6; g_tp.sram_cell.l_phy += curr_alpha * Lphy[ram_cell_tech_type]; g_tp.sram_cell.l_elec += curr_alpha * Lelec[ram_cell_tech_type]; g_tp.sram_cell.t_ox += curr_alpha * t_ox[ram_cell_tech_type]; g_tp.sram_cell.C_g_ideal += curr_alpha * c_g_ideal[ram_cell_tech_type]; g_tp.sram_cell.C_fringe += curr_alpha * c_fringe[ram_cell_tech_type]; g_tp.sram_cell.C_junc += curr_alpha * c_junc[ram_cell_tech_type]; g_tp.sram_cell.C_junc_sidewall = 0.25e-15; // F/micron g_tp.sram_cell.I_on_n += curr_alpha * I_on_n[ram_cell_tech_type]; g_tp.sram_cell.R_nch_on += curr_alpha * Rnchannelon[ram_cell_tech_type]; g_tp.sram_cell.R_pch_on += curr_alpha * Rpchannelon[ram_cell_tech_type]; g_tp.sram_cell.n_to_p_eff_curr_drv_ratio += curr_alpha * n_to_p_eff_curr_drv_ratio[ram_cell_tech_type]; g_tp.sram_cell.long_channel_leakage_reduction += curr_alpha * long_channel_leakage_reduction[ram_cell_tech_type]; g_tp.sram_cell.I_off_n += curr_alpha * I_off_n[ram_cell_tech_type][g_ip->temp - 300];//**pow(g_tp.sram_cell.Vdd/g_tp.sram_cell.Vdd_default,4); g_tp.sram_cell.I_off_p += curr_alpha * I_off_n[ram_cell_tech_type][g_ip->temp - 300];//**pow(g_tp.sram_cell.Vdd/g_tp.sram_cell.Vdd_default,4); g_tp.sram_cell.I_g_on_n += curr_alpha * I_g_on_n[ram_cell_tech_type][g_ip->temp - 300]; g_tp.sram_cell.I_g_on_p += curr_alpha * I_g_on_n[ram_cell_tech_type][g_ip->temp - 300]; g_tp.dram_cell_Vdd += curr_alpha * curr_vdd_dram_cell; g_tp.dram_acc.Vth += curr_alpha * curr_v_th_dram_access_transistor; g_tp.dram_acc.l_phy += curr_alpha * Lphy[dram_cell_tech_flavor]; g_tp.dram_acc.l_elec += curr_alpha * Lelec[dram_cell_tech_flavor]; g_tp.dram_acc.C_g_ideal += curr_alpha * c_g_ideal[dram_cell_tech_flavor]; g_tp.dram_acc.C_fringe += curr_alpha * c_fringe[dram_cell_tech_flavor]; g_tp.dram_acc.C_junc += curr_alpha * c_junc[dram_cell_tech_flavor]; g_tp.dram_acc.C_junc_sidewall = 0.25e-15; // F/micron g_tp.dram_cell_I_on += curr_alpha * curr_I_on_dram_cell; g_tp.dram_cell_I_off_worst_case_len_temp += curr_alpha * curr_I_off_dram_cell_worst_case_length_temp; g_tp.dram_acc.I_on_n += curr_alpha * I_on_n[dram_cell_tech_flavor]; g_tp.dram_cell_C += curr_alpha * curr_c_dram_cell; g_tp.vpp += curr_alpha * curr_vpp; g_tp.dram_wl.l_phy += curr_alpha * Lphy[dram_cell_tech_flavor]; g_tp.dram_wl.l_elec += curr_alpha * Lelec[dram_cell_tech_flavor]; g_tp.dram_wl.C_g_ideal += curr_alpha * c_g_ideal[dram_cell_tech_flavor]; g_tp.dram_wl.C_fringe += curr_alpha * c_fringe[dram_cell_tech_flavor]; g_tp.dram_wl.C_junc += curr_alpha * c_junc[dram_cell_tech_flavor]; g_tp.dram_wl.C_junc_sidewall = 0.25e-15; // F/micron g_tp.dram_wl.I_on_n += curr_alpha * I_on_n[dram_cell_tech_flavor]; g_tp.dram_wl.R_nch_on += curr_alpha * Rnchannelon[dram_cell_tech_flavor]; g_tp.dram_wl.R_pch_on += curr_alpha * Rpchannelon[dram_cell_tech_flavor]; g_tp.dram_wl.n_to_p_eff_curr_drv_ratio += curr_alpha * n_to_p_eff_curr_drv_ratio[dram_cell_tech_flavor]; g_tp.dram_wl.long_channel_leakage_reduction += curr_alpha * long_channel_leakage_reduction[dram_cell_tech_flavor]; g_tp.dram_wl.I_off_n += curr_alpha * I_off_n[dram_cell_tech_flavor][g_ip->temp - 300]; g_tp.dram_wl.I_off_p += curr_alpha * I_off_n[dram_cell_tech_flavor][g_ip->temp - 300]; g_tp.cam_cell.Vdd += curr_alpha * vdd_real[ram_cell_tech_type]; g_tp.cam_cell.Vdd_default += curr_alpha * vdd[ram_cell_tech_type]; g_tp.cam_cell.l_phy += curr_alpha * Lphy[ram_cell_tech_type]; g_tp.cam_cell.l_elec += curr_alpha * Lelec[ram_cell_tech_type]; g_tp.cam_cell.t_ox += curr_alpha * t_ox[ram_cell_tech_type]; g_tp.cam_cell.Vth += curr_alpha * v_th[ram_cell_tech_type]; g_tp.cam_cell.C_g_ideal += curr_alpha * c_g_ideal[ram_cell_tech_type]; g_tp.cam_cell.C_fringe += curr_alpha * c_fringe[ram_cell_tech_type]; g_tp.cam_cell.C_junc += curr_alpha * c_junc[ram_cell_tech_type]; g_tp.cam_cell.C_junc_sidewall = 0.25e-15; // F/micron g_tp.cam_cell.I_on_n += curr_alpha * I_on_n[ram_cell_tech_type]; g_tp.cam_cell.R_nch_on += curr_alpha * Rnchannelon[ram_cell_tech_type]; g_tp.cam_cell.R_pch_on += curr_alpha * Rpchannelon[ram_cell_tech_type]; g_tp.cam_cell.n_to_p_eff_curr_drv_ratio += curr_alpha * n_to_p_eff_curr_drv_ratio[ram_cell_tech_type]; g_tp.cam_cell.long_channel_leakage_reduction += curr_alpha * long_channel_leakage_reduction[ram_cell_tech_type]; g_tp.cam_cell.I_off_n += curr_alpha * I_off_n[ram_cell_tech_type][g_ip->temp - 300];//*pow(g_tp.cam_cell.Vdd/g_tp.cam_cell.Vdd_default,4); g_tp.cam_cell.I_off_p += curr_alpha * I_off_n[ram_cell_tech_type][g_ip->temp - 300];//**pow(g_tp.cam_cell.Vdd/g_tp.cam_cell.Vdd_default,4); g_tp.cam_cell.I_g_on_n += curr_alpha * I_g_on_n[ram_cell_tech_type][g_ip->temp - 300]; g_tp.cam_cell.I_g_on_p += curr_alpha * I_g_on_n[ram_cell_tech_type][g_ip->temp - 300]; g_tp.dram.cell_a_w += curr_alpha * curr_Wmemcella_dram; g_tp.dram.cell_pmos_w += curr_alpha * curr_Wmemcellpmos_dram; g_tp.dram.cell_nmos_w += curr_alpha * curr_Wmemcellnmos_dram; area_cell_dram += curr_alpha * curr_area_cell_dram; asp_ratio_cell_dram += curr_alpha * curr_asp_ratio_cell_dram; g_tp.sram.cell_a_w += curr_alpha * curr_Wmemcella_sram; g_tp.sram.cell_pmos_w += curr_alpha * curr_Wmemcellpmos_sram; g_tp.sram.cell_nmos_w += curr_alpha * curr_Wmemcellnmos_sram; area_cell_sram += curr_alpha * curr_area_cell_sram; asp_ratio_cell_sram += curr_alpha * curr_asp_ratio_cell_sram; g_tp.cam.cell_a_w += curr_alpha * curr_Wmemcella_cam;//sheng g_tp.cam.cell_pmos_w += curr_alpha * curr_Wmemcellpmos_cam; g_tp.cam.cell_nmos_w += curr_alpha * curr_Wmemcellnmos_cam; area_cell_cam += curr_alpha * curr_area_cell_cam; asp_ratio_cell_cam += curr_alpha * curr_asp_ratio_cell_cam; //Sense amplifier latch Gm calculation mobility_eff_periph_global += curr_alpha * mobility_eff[peri_global_tech_type]; Vdsat_periph_global += curr_alpha * Vdsat[peri_global_tech_type]; //Empirical undifferetiated core/FU coefficient g_tp.scaling_factor.logic_scaling_co_eff += curr_alpha * curr_logic_scaling_co_eff; g_tp.scaling_factor.core_tx_density += curr_alpha * curr_core_tx_density; g_tp.chip_layout_overhead += curr_alpha * curr_chip_layout_overhead; g_tp.macro_layout_overhead += curr_alpha * curr_macro_layout_overhead; g_tp.sckt_co_eff += curr_alpha * curr_sckt_co_eff; } //Currently we are not modeling the resistance/capacitance of poly anywhere. //following data are continuous function (or data have been processed) does not need linear interpolation g_tp.w_comp_inv_p1 = 12.5 * g_ip->F_sz_um;//this was 10 micron for the 0.8 micron process g_tp.w_comp_inv_n1 = 7.5 * g_ip->F_sz_um;//this was 6 micron for the 0.8 micron process g_tp.w_comp_inv_p2 = 25 * g_ip->F_sz_um;//this was 20 micron for the 0.8 micron process g_tp.w_comp_inv_n2 = 15 * g_ip->F_sz_um;//this was 12 micron for the 0.8 micron process g_tp.w_comp_inv_p3 = 50 * g_ip->F_sz_um;//this was 40 micron for the 0.8 micron process g_tp.w_comp_inv_n3 = 30 * g_ip->F_sz_um;//this was 24 micron for the 0.8 micron process g_tp.w_eval_inv_p = 100 * g_ip->F_sz_um;//this was 80 micron for the 0.8 micron process g_tp.w_eval_inv_n = 50 * g_ip->F_sz_um;//this was 40 micron for the 0.8 micron process g_tp.w_comp_n = 12.5 * g_ip->F_sz_um;//this was 10 micron for the 0.8 micron process g_tp.w_comp_p = 37.5 * g_ip->F_sz_um;//this was 30 micron for the 0.8 micron process g_tp.MIN_GAP_BET_P_AND_N_DIFFS = 5 * g_ip->F_sz_um; g_tp.MIN_GAP_BET_SAME_TYPE_DIFFS = 1.5 * g_ip->F_sz_um; g_tp.HPOWERRAIL = 2 * g_ip->F_sz_um; g_tp.cell_h_def = 50 * g_ip->F_sz_um; g_tp.w_poly_contact = g_ip->F_sz_um; g_tp.spacing_poly_to_contact = g_ip->F_sz_um; g_tp.spacing_poly_to_poly = 1.5 * g_ip->F_sz_um; g_tp.ram_wl_stitching_overhead_ = 7.5 * g_ip->F_sz_um; g_tp.min_w_nmos_ = 3 * g_ip->F_sz_um / 2; g_tp.max_w_nmos_ = 100 * g_ip->F_sz_um; g_tp.w_iso = 12.5*g_ip->F_sz_um;//was 10 micron for the 0.8 micron process g_tp.w_sense_n = 3.75*g_ip->F_sz_um; // sense amplifier N-trans; was 3 micron for the 0.8 micron process g_tp.w_sense_p = 7.5*g_ip->F_sz_um; // sense amplifier P-trans; was 6 micron for the 0.8 micron process g_tp.w_sense_en = 5*g_ip->F_sz_um; // Sense enable transistor of the sense amplifier; was 4 micron for the 0.8 micron process g_tp.w_nmos_b_mux = 6 * g_tp.min_w_nmos_; g_tp.w_nmos_sa_mux = 6 * g_tp.min_w_nmos_; if (ram_cell_tech_type == comm_dram) { g_tp.max_w_nmos_dec = 8 * g_ip->F_sz_um; g_tp.h_dec = 8; // in the unit of memory cell height } else { g_tp.max_w_nmos_dec = g_tp.max_w_nmos_; g_tp.h_dec = 4; // in the unit of memory cell height } g_tp.peri_global.C_overlap = 0.2 * g_tp.peri_global.C_g_ideal; g_tp.sram_cell.C_overlap = 0.2 * g_tp.sram_cell.C_g_ideal; g_tp.cam_cell.C_overlap = 0.2 * g_tp.cam_cell.C_g_ideal; g_tp.dram_acc.C_overlap = 0.2 * g_tp.dram_acc.C_g_ideal; g_tp.dram_acc.R_nch_on = g_tp.dram_cell_Vdd / g_tp.dram_acc.I_on_n; //g_tp.dram_acc.R_pch_on = g_tp.dram_cell_Vdd / g_tp.dram_acc.I_on_p; g_tp.dram_wl.C_overlap = 0.2 * g_tp.dram_wl.C_g_ideal; double gmn_sense_amp_latch = (mobility_eff_periph_global / 2) * g_tp.peri_global.C_ox * (g_tp.w_sense_n / g_tp.peri_global.l_elec) * Vdsat_periph_global; double gmp_sense_amp_latch = gmp_to_gmn_multiplier_periph_global * gmn_sense_amp_latch; g_tp.gm_sense_amp_latch = gmn_sense_amp_latch + gmp_sense_amp_latch * pow((g_tp.peri_global.Vdd-g_tp.peri_global.Vth)/(g_tp.peri_global.Vdd_default-g_tp.peri_global.Vth),1.3)/(g_tp.peri_global.Vdd/g_tp.peri_global.Vdd_default); g_tp.dram.b_w = sqrt(area_cell_dram / (asp_ratio_cell_dram)); g_tp.dram.b_h = asp_ratio_cell_dram * g_tp.dram.b_w; g_tp.sram.b_w = sqrt(area_cell_sram / (asp_ratio_cell_sram)); g_tp.sram.b_h = asp_ratio_cell_sram * g_tp.sram.b_w; g_tp.cam.b_w = sqrt(area_cell_cam / (asp_ratio_cell_cam));//Sheng g_tp.cam.b_h = asp_ratio_cell_cam * g_tp.cam.b_w; g_tp.dram.Vbitpre = g_tp.dram_cell_Vdd; g_tp.sram.Vbitpre = g_tp.sram_cell.Vdd;//vdd[ram_cell_tech_type]; g_tp.cam.Vbitpre = g_tp.cam_cell.Vdd;//vdd[ram_cell_tech_type];//Sheng pmos_to_nmos_sizing_r = pmos_to_nmos_sz_ratio(); g_tp.w_pmos_bl_precharge = 6 * pmos_to_nmos_sizing_r * g_tp.min_w_nmos_; g_tp.w_pmos_bl_eq = pmos_to_nmos_sizing_r * g_tp.min_w_nmos_; //DVS and power-gating voltage finalization if (g_tp.sram_cell.Vcc_min_default > g_tp.sram_cell.Vdd || g_tp.peri_global.Vdd < g_tp.peri_global.Vdd_default*0.75 || g_tp.sram_cell.Vdd < g_tp.sram_cell.Vdd_default*0.75) { cerr << "User defined Vdd is too low.\n\n"<< endl; exit(0); } if (g_ip->specific_vcc_min) { g_tp.sram_cell.Vcc_min = g_ip->user_defined_vcc_min; g_tp.peri_global.Vcc_min = g_ip->user_defined_vcc_min; g_tp.sram.Vbitfloating = g_tp.sram.Vbitpre*0.7*(g_tp.sram_cell.Vcc_min/g_tp.peri_global.Vcc_min_default); // if (g_ip->user_defined_vcc_min < g_tp.peri_global.Vcc_min_default) // { // g_tp.peri_global.Vcc_min = g_ip->user_defined_vcc_min; // } // else { // // } } else { g_tp.sram_cell.Vcc_min = g_tp.sram_cell.Vcc_min_default; g_tp.peri_global.Vcc_min = g_tp.peri_global.Vcc_min_default; g_tp.sram.Vbitfloating = g_tp.sram.Vbitpre*0.7; } if (g_tp.sram_cell.Vcc_min < g_tp.sram_cell.Vcc_min_default )//if want to compute multiple power-gating vdd settings in one run, should have multiple results copies (each copy containing such flag) in update_pg () { g_ip->user_defined_vcc_underflow = true; } else { g_ip->user_defined_vcc_underflow = false; } if (g_tp.sram_cell.Vcc_min > g_tp.sram_cell.Vdd || g_tp.peri_global.Vcc_min > g_tp.peri_global.Vdd) { cerr << "User defined power-saving supply voltage cannot be lower than Vdd (DVS0).\n\n"<< endl; exit(0); } double wire_pitch [NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES], wire_r_per_micron[NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES], wire_c_per_micron[NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES], horiz_dielectric_constant[NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES], vert_dielectric_constant[NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES], aspect_ratio[NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES], miller_value[NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES], ild_thickness[NUMBER_INTERCONNECT_PROJECTION_TYPES][NUMBER_WIRE_TYPES]; for (iter=0; iter<=1; ++iter) { // linear interpolation if (iter == 0) { tech = tech_lo; if (tech_lo == tech_hi) { curr_alpha = 1; } else { curr_alpha = (technology - tech_hi)/(tech_lo - tech_hi); } } else { tech = tech_hi; if (tech_lo == tech_hi) { break; } else { curr_alpha = (tech_lo - technology)/(tech_lo - tech_hi); } } if (tech == 180) { //Aggressive projections wire_pitch[0][0] = 2.5 * g_ip->F_sz_um;//micron aspect_ratio[0][0] = 2.0; wire_width = wire_pitch[0][0] / 2; //micron wire_thickness = aspect_ratio[0][0] * wire_width;//micron wire_spacing = wire_pitch[0][0] - wire_width;//micron barrier_thickness = 0.017;//micron dishing_thickness = 0;//micron alpha_scatter = 1; wire_r_per_micron[0][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter);//ohm/micron ild_thickness[0][0] = 0.75;//micron miller_value[0][0] = 1.5; horiz_dielectric_constant[0][0] = 2.709; vert_dielectric_constant[0][0] = 3.9; fringe_cap = 0.115e-15; //F/micron wire_c_per_micron[0][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][0], miller_value[0][0], horiz_dielectric_constant[0][0], vert_dielectric_constant[0][0], fringe_cap);//F/micron. wire_pitch[0][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[0][1] / 2; aspect_ratio[0][1] = 2.4; wire_thickness = aspect_ratio[0][1] * wire_width; wire_spacing = wire_pitch[0][1] - wire_width; wire_r_per_micron[0][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][1] = 0.75;//micron miller_value[0][1] = 1.5; horiz_dielectric_constant[0][1] = 2.709; vert_dielectric_constant[0][1] = 3.9; fringe_cap = 0.115e-15; //F/micron wire_c_per_micron[0][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][1], miller_value[0][1], horiz_dielectric_constant[0][1], vert_dielectric_constant[0][1], fringe_cap); wire_pitch[0][2] = 8 * g_ip->F_sz_um; aspect_ratio[0][2] = 2.2; wire_width = wire_pitch[0][2] / 2; wire_thickness = aspect_ratio[0][2] * wire_width; wire_spacing = wire_pitch[0][2] - wire_width; wire_r_per_micron[0][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][2] = 1.5; miller_value[0][2] = 1.5; horiz_dielectric_constant[0][2] = 2.709; vert_dielectric_constant[0][2] = 3.9; wire_c_per_micron[0][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][2], miller_value[0][2], horiz_dielectric_constant[0][2], vert_dielectric_constant[0][2], fringe_cap); //Conservative projections wire_pitch[1][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[1][0]= 2.0; wire_width = wire_pitch[1][0] / 2; wire_thickness = aspect_ratio[1][0] * wire_width; wire_spacing = wire_pitch[1][0] - wire_width; barrier_thickness = 0.017; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[1][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][0] = 0.75; miller_value[1][0] = 1.5; horiz_dielectric_constant[1][0] = 3.038; vert_dielectric_constant[1][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][0], miller_value[1][0], horiz_dielectric_constant[1][0], vert_dielectric_constant[1][0], fringe_cap); wire_pitch[1][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[1][1] / 2; aspect_ratio[1][1] = 2.0; wire_thickness = aspect_ratio[1][1] * wire_width; wire_spacing = wire_pitch[1][1] - wire_width; wire_r_per_micron[1][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][1] = 0.75; miller_value[1][1] = 1.5; horiz_dielectric_constant[1][1] = 3.038; vert_dielectric_constant[1][1] = 3.9; wire_c_per_micron[1][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][1], miller_value[1][1], horiz_dielectric_constant[1][1], vert_dielectric_constant[1][1], fringe_cap); wire_pitch[1][2] = 8 * g_ip->F_sz_um; aspect_ratio[1][2] = 2.2; wire_width = wire_pitch[1][2] / 2; wire_thickness = aspect_ratio[1][2] * wire_width; wire_spacing = wire_pitch[1][2] - wire_width; dishing_thickness = 0.1 * wire_thickness; wire_r_per_micron[1][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][2] = 1.98; miller_value[1][2] = 1.5; horiz_dielectric_constant[1][2] = 3.038; vert_dielectric_constant[1][2] = 3.9; wire_c_per_micron[1][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][2] , miller_value[1][2], horiz_dielectric_constant[1][2], vert_dielectric_constant[1][2], fringe_cap); //Nominal projections for commodity DRAM wordline/bitline wire_pitch[1][3] = 2 * 0.18; wire_c_per_micron[1][3] = 60e-15 / (256 * 2 * 0.18); wire_r_per_micron[1][3] = 12 / 0.18; } else if (tech == 90) { //Aggressive projections wire_pitch[0][0] = 2.5 * g_ip->F_sz_um;//micron aspect_ratio[0][0] = 2.4; wire_width = wire_pitch[0][0] / 2; //micron wire_thickness = aspect_ratio[0][0] * wire_width;//micron wire_spacing = wire_pitch[0][0] - wire_width;//micron barrier_thickness = 0.01;//micron dishing_thickness = 0;//micron alpha_scatter = 1; wire_r_per_micron[0][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter);//ohm/micron ild_thickness[0][0] = 0.48;//micron miller_value[0][0] = 1.5; horiz_dielectric_constant[0][0] = 2.709; vert_dielectric_constant[0][0] = 3.9; fringe_cap = 0.115e-15; //F/micron wire_c_per_micron[0][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][0], miller_value[0][0], horiz_dielectric_constant[0][0], vert_dielectric_constant[0][0], fringe_cap);//F/micron. wire_pitch[0][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[0][1] / 2; aspect_ratio[0][1] = 2.4; wire_thickness = aspect_ratio[0][1] * wire_width; wire_spacing = wire_pitch[0][1] - wire_width; wire_r_per_micron[0][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][1] = 0.48;//micron miller_value[0][1] = 1.5; horiz_dielectric_constant[0][1] = 2.709; vert_dielectric_constant[0][1] = 3.9; wire_c_per_micron[0][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][1], miller_value[0][1], horiz_dielectric_constant[0][1], vert_dielectric_constant[0][1], fringe_cap); wire_pitch[0][2] = 8 * g_ip->F_sz_um; aspect_ratio[0][2] = 2.7; wire_width = wire_pitch[0][2] / 2; wire_thickness = aspect_ratio[0][2] * wire_width; wire_spacing = wire_pitch[0][2] - wire_width; wire_r_per_micron[0][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][2] = 0.96; miller_value[0][2] = 1.5; horiz_dielectric_constant[0][2] = 2.709; vert_dielectric_constant[0][2] = 3.9; wire_c_per_micron[0][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][2], miller_value[0][2], horiz_dielectric_constant[0][2], vert_dielectric_constant[0][2], fringe_cap); //Conservative projections wire_pitch[1][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[1][0] = 2.0; wire_width = wire_pitch[1][0] / 2; wire_thickness = aspect_ratio[1][0] * wire_width; wire_spacing = wire_pitch[1][0] - wire_width; barrier_thickness = 0.008; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[1][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][0] = 0.48; miller_value[1][0] = 1.5; horiz_dielectric_constant[1][0] = 3.038; vert_dielectric_constant[1][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][0], miller_value[1][0], horiz_dielectric_constant[1][0], vert_dielectric_constant[1][0], fringe_cap); wire_pitch[1][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[1][1] / 2; aspect_ratio[1][1] = 2.0; wire_thickness = aspect_ratio[1][1] * wire_width; wire_spacing = wire_pitch[1][1] - wire_width; wire_r_per_micron[1][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][1] = 0.48; miller_value[1][1] = 1.5; horiz_dielectric_constant[1][1] = 3.038; vert_dielectric_constant[1][1] = 3.9; wire_c_per_micron[1][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][1], miller_value[1][1], horiz_dielectric_constant[1][1], vert_dielectric_constant[1][1], fringe_cap); wire_pitch[1][2] = 8 * g_ip->F_sz_um; aspect_ratio[1][2] = 2.2; wire_width = wire_pitch[1][2] / 2; wire_thickness = aspect_ratio[1][2] * wire_width; wire_spacing = wire_pitch[1][2] - wire_width; dishing_thickness = 0.1 * wire_thickness; wire_r_per_micron[1][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][2] = 1.1; miller_value[1][2] = 1.5; horiz_dielectric_constant[1][2] = 3.038; vert_dielectric_constant[1][2] = 3.9; wire_c_per_micron[1][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][2] , miller_value[1][2], horiz_dielectric_constant[1][2], vert_dielectric_constant[1][2], fringe_cap); //Nominal projections for commodity DRAM wordline/bitline wire_pitch[1][3] = 2 * 0.09; wire_c_per_micron[1][3] = 60e-15 / (256 * 2 * 0.09); wire_r_per_micron[1][3] = 12 / 0.09; } else if (tech == 65) { //Aggressive projections wire_pitch[0][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[0][0] = 2.7; wire_width = wire_pitch[0][0] / 2; wire_thickness = aspect_ratio[0][0] * wire_width; wire_spacing = wire_pitch[0][0] - wire_width; barrier_thickness = 0; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[0][0] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][0] = 0.405; miller_value[0][0] = 1.5; horiz_dielectric_constant[0][0] = 2.303; vert_dielectric_constant[0][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[0][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][0] , miller_value[0][0] , horiz_dielectric_constant[0][0] , vert_dielectric_constant[0][0] , fringe_cap); wire_pitch[0][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[0][1] / 2; aspect_ratio[0][1] = 2.7; wire_thickness = aspect_ratio[0][1] * wire_width; wire_spacing = wire_pitch[0][1] - wire_width; wire_r_per_micron[0][1] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][1] = 0.405; miller_value[0][1] = 1.5; horiz_dielectric_constant[0][1] = 2.303; vert_dielectric_constant[0][1] = 3.9; wire_c_per_micron[0][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][1], miller_value[0][1], horiz_dielectric_constant[0][1], vert_dielectric_constant[0][1], fringe_cap); wire_pitch[0][2] = 8 * g_ip->F_sz_um; aspect_ratio[0][2] = 2.8; wire_width = wire_pitch[0][2] / 2; wire_thickness = aspect_ratio[0][2] * wire_width; wire_spacing = wire_pitch[0][2] - wire_width; wire_r_per_micron[0][2] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][2] = 0.81; miller_value[0][2] = 1.5; horiz_dielectric_constant[0][2] = 2.303; vert_dielectric_constant[0][2] = 3.9; wire_c_per_micron[0][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][2], miller_value[0][2], horiz_dielectric_constant[0][2], vert_dielectric_constant[0][2], fringe_cap); //Conservative projections wire_pitch[1][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[1][0] = 2.0; wire_width = wire_pitch[1][0] / 2; wire_thickness = aspect_ratio[1][0] * wire_width; wire_spacing = wire_pitch[1][0] - wire_width; barrier_thickness = 0.006; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[1][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][0] = 0.405; miller_value[1][0] = 1.5; horiz_dielectric_constant[1][0] = 2.734; vert_dielectric_constant[1][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][0], miller_value[1][0], horiz_dielectric_constant[1][0], vert_dielectric_constant[1][0], fringe_cap); wire_pitch[1][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[1][1] / 2; aspect_ratio[1][1] = 2.0; wire_thickness = aspect_ratio[1][1] * wire_width; wire_spacing = wire_pitch[1][1] - wire_width; wire_r_per_micron[1][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][1] = 0.405; miller_value[1][1] = 1.5; horiz_dielectric_constant[1][1] = 2.734; vert_dielectric_constant[1][1] = 3.9; wire_c_per_micron[1][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][1], miller_value[1][1], horiz_dielectric_constant[1][1], vert_dielectric_constant[1][1], fringe_cap); wire_pitch[1][2] = 8 * g_ip->F_sz_um; aspect_ratio[1][2] = 2.2; wire_width = wire_pitch[1][2] / 2; wire_thickness = aspect_ratio[1][2] * wire_width; wire_spacing = wire_pitch[1][2] - wire_width; dishing_thickness = 0.1 * wire_thickness; wire_r_per_micron[1][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][2] = 0.77; miller_value[1][2] = 1.5; horiz_dielectric_constant[1][2] = 2.734; vert_dielectric_constant[1][2] = 3.9; wire_c_per_micron[1][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][2], miller_value[1][2], horiz_dielectric_constant[1][2], vert_dielectric_constant[1][2], fringe_cap); //Nominal projections for commodity DRAM wordline/bitline wire_pitch[1][3] = 2 * 0.065; wire_c_per_micron[1][3] = 52.5e-15 / (256 * 2 * 0.065); wire_r_per_micron[1][3] = 12 / 0.065; } else if (tech == 45) { //Aggressive projections. wire_pitch[0][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[0][0] = 3.0; wire_width = wire_pitch[0][0] / 2; wire_thickness = aspect_ratio[0][0] * wire_width; wire_spacing = wire_pitch[0][0] - wire_width; barrier_thickness = 0; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[0][0] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][0] = 0.315; miller_value[0][0] = 1.5; horiz_dielectric_constant[0][0] = 1.958; vert_dielectric_constant[0][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[0][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][0] , miller_value[0][0] , horiz_dielectric_constant[0][0] , vert_dielectric_constant[0][0] , fringe_cap); wire_pitch[0][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[0][1] / 2; aspect_ratio[0][1] = 3.0; wire_thickness = aspect_ratio[0][1] * wire_width; wire_spacing = wire_pitch[0][1] - wire_width; wire_r_per_micron[0][1] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][1] = 0.315; miller_value[0][1] = 1.5; horiz_dielectric_constant[0][1] = 1.958; vert_dielectric_constant[0][1] = 3.9; wire_c_per_micron[0][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][1], miller_value[0][1], horiz_dielectric_constant[0][1], vert_dielectric_constant[0][1], fringe_cap); wire_pitch[0][2] = 8 * g_ip->F_sz_um; aspect_ratio[0][2] = 3.0; wire_width = wire_pitch[0][2] / 2; wire_thickness = aspect_ratio[0][2] * wire_width; wire_spacing = wire_pitch[0][2] - wire_width; wire_r_per_micron[0][2] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][2] = 0.63; miller_value[0][2] = 1.5; horiz_dielectric_constant[0][2] = 1.958; vert_dielectric_constant[0][2] = 3.9; wire_c_per_micron[0][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][2], miller_value[0][2], horiz_dielectric_constant[0][2], vert_dielectric_constant[0][2], fringe_cap); //Conservative projections wire_pitch[1][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[1][0] = 2.0; wire_width = wire_pitch[1][0] / 2; wire_thickness = aspect_ratio[1][0] * wire_width; wire_spacing = wire_pitch[1][0] - wire_width; barrier_thickness = 0.004; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[1][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][0] = 0.315; miller_value[1][0] = 1.5; horiz_dielectric_constant[1][0] = 2.46; vert_dielectric_constant[1][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][0], miller_value[1][0], horiz_dielectric_constant[1][0], vert_dielectric_constant[1][0], fringe_cap); wire_pitch[1][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[1][1] / 2; aspect_ratio[1][1] = 2.0; wire_thickness = aspect_ratio[1][1] * wire_width; wire_spacing = wire_pitch[1][1] - wire_width; wire_r_per_micron[1][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][1] = 0.315; miller_value[1][1] = 1.5; horiz_dielectric_constant[1][1] = 2.46; vert_dielectric_constant[1][1] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][1], miller_value[1][1], horiz_dielectric_constant[1][1], vert_dielectric_constant[1][1], fringe_cap); wire_pitch[1][2] = 8 * g_ip->F_sz_um; aspect_ratio[1][2] = 2.2; wire_width = wire_pitch[1][2] / 2; wire_thickness = aspect_ratio[1][2] * wire_width; wire_spacing = wire_pitch[1][2] - wire_width; dishing_thickness = 0.1 * wire_thickness; wire_r_per_micron[1][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][2] = 0.55; miller_value[1][2] = 1.5; horiz_dielectric_constant[1][2] = 2.46; vert_dielectric_constant[1][2] = 3.9; wire_c_per_micron[1][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][2], miller_value[1][2], horiz_dielectric_constant[1][2], vert_dielectric_constant[1][2], fringe_cap); //Nominal projections for commodity DRAM wordline/bitline wire_pitch[1][3] = 2 * 0.045; wire_c_per_micron[1][3] = 37.5e-15 / (256 * 2 * 0.045); wire_r_per_micron[1][3] = 12 / 0.045; } else if (tech == 32) { //Aggressive projections. wire_pitch[0][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[0][0] = 3.0; wire_width = wire_pitch[0][0] / 2; wire_thickness = aspect_ratio[0][0] * wire_width; wire_spacing = wire_pitch[0][0] - wire_width; barrier_thickness = 0; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[0][0] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][0] = 0.21; miller_value[0][0] = 1.5; horiz_dielectric_constant[0][0] = 1.664; vert_dielectric_constant[0][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[0][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][0], miller_value[0][0], horiz_dielectric_constant[0][0], vert_dielectric_constant[0][0], fringe_cap); wire_pitch[0][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[0][1] / 2; aspect_ratio[0][1] = 3.0; wire_thickness = aspect_ratio[0][1] * wire_width; wire_spacing = wire_pitch[0][1] - wire_width; wire_r_per_micron[0][1] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][1] = 0.21; miller_value[0][1] = 1.5; horiz_dielectric_constant[0][1] = 1.664; vert_dielectric_constant[0][1] = 3.9; wire_c_per_micron[0][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][1], miller_value[0][1], horiz_dielectric_constant[0][1], vert_dielectric_constant[0][1], fringe_cap); wire_pitch[0][2] = 8 * g_ip->F_sz_um; aspect_ratio[0][2] = 3.0; wire_width = wire_pitch[0][2] / 2; wire_thickness = aspect_ratio[0][2] * wire_width; wire_spacing = wire_pitch[0][2] - wire_width; wire_r_per_micron[0][2] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][2] = 0.42; miller_value[0][2] = 1.5; horiz_dielectric_constant[0][2] = 1.664; vert_dielectric_constant[0][2] = 3.9; wire_c_per_micron[0][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][2], miller_value[0][2], horiz_dielectric_constant[0][2], vert_dielectric_constant[0][2], fringe_cap); //Conservative projections wire_pitch[1][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[1][0] = 2.0; wire_width = wire_pitch[1][0] / 2; wire_thickness = aspect_ratio[1][0] * wire_width; wire_spacing = wire_pitch[1][0] - wire_width; barrier_thickness = 0.003; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[1][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][0] = 0.21; miller_value[1][0] = 1.5; horiz_dielectric_constant[1][0] = 2.214; vert_dielectric_constant[1][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][0], miller_value[1][0], horiz_dielectric_constant[1][0], vert_dielectric_constant[1][0], fringe_cap); wire_pitch[1][1] = 4 * g_ip->F_sz_um; aspect_ratio[1][1] = 2.0; wire_width = wire_pitch[1][1] / 2; wire_thickness = aspect_ratio[1][1] * wire_width; wire_spacing = wire_pitch[1][1] - wire_width; wire_r_per_micron[1][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][1] = 0.21; miller_value[1][1] = 1.5; horiz_dielectric_constant[1][1] = 2.214; vert_dielectric_constant[1][1] = 3.9; wire_c_per_micron[1][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][1], miller_value[1][1], horiz_dielectric_constant[1][1], vert_dielectric_constant[1][1], fringe_cap); wire_pitch[1][2] = 8 * g_ip->F_sz_um; aspect_ratio[1][2] = 2.2; wire_width = wire_pitch[1][2] / 2; wire_thickness = aspect_ratio[1][2] * wire_width; wire_spacing = wire_pitch[1][2] - wire_width; dishing_thickness = 0.1 * wire_thickness; wire_r_per_micron[1][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][2] = 0.385; miller_value[1][2] = 1.5; horiz_dielectric_constant[1][2] = 2.214; vert_dielectric_constant[1][2] = 3.9; wire_c_per_micron[1][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][2], miller_value[1][2], horiz_dielectric_constant[1][2], vert_dielectric_constant[1][2], fringe_cap); //Nominal projections for commodity DRAM wordline/bitline wire_pitch[1][3] = 2 * 0.032;//micron wire_c_per_micron[1][3] = 31e-15 / (256 * 2 * 0.032);//F/micron wire_r_per_micron[1][3] = 12 / 0.032;//ohm/micron } else if (tech == 22) { //Aggressive projections. wire_pitch[0][0] = 2.5 * g_ip->F_sz_um;//local aspect_ratio[0][0] = 3.0; wire_width = wire_pitch[0][0] / 2; wire_thickness = aspect_ratio[0][0] * wire_width; wire_spacing = wire_pitch[0][0] - wire_width; barrier_thickness = 0; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[0][0] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][0] = 0.15; miller_value[0][0] = 1.5; horiz_dielectric_constant[0][0] = 1.414; vert_dielectric_constant[0][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[0][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][0], miller_value[0][0], horiz_dielectric_constant[0][0], vert_dielectric_constant[0][0], fringe_cap); wire_pitch[0][1] = 4 * g_ip->F_sz_um;//semi-global wire_width = wire_pitch[0][1] / 2; aspect_ratio[0][1] = 3.0; wire_thickness = aspect_ratio[0][1] * wire_width; wire_spacing = wire_pitch[0][1] - wire_width; wire_r_per_micron[0][1] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][1] = 0.15; miller_value[0][1] = 1.5; horiz_dielectric_constant[0][1] = 1.414; vert_dielectric_constant[0][1] = 3.9; wire_c_per_micron[0][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][1], miller_value[0][1], horiz_dielectric_constant[0][1], vert_dielectric_constant[0][1], fringe_cap); wire_pitch[0][2] = 8 * g_ip->F_sz_um;//global aspect_ratio[0][2] = 3.0; wire_width = wire_pitch[0][2] / 2; wire_thickness = aspect_ratio[0][2] * wire_width; wire_spacing = wire_pitch[0][2] - wire_width; wire_r_per_micron[0][2] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][2] = 0.3; miller_value[0][2] = 1.5; horiz_dielectric_constant[0][2] = 1.414; vert_dielectric_constant[0][2] = 3.9; wire_c_per_micron[0][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][2], miller_value[0][2], horiz_dielectric_constant[0][2], vert_dielectric_constant[0][2], fringe_cap); // //************************* // wire_pitch[0][4] = 16 * g_ip.F_sz_um;//global // aspect_ratio = 3.0; // wire_width = wire_pitch[0][4] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[0][4] - wire_width; // wire_r_per_micron[0][4] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.3; // wire_c_per_micron[0][4] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[0][5] = 24 * g_ip.F_sz_um;//global // aspect_ratio = 3.0; // wire_width = wire_pitch[0][5] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[0][5] - wire_width; // wire_r_per_micron[0][5] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.3; // wire_c_per_micron[0][5] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[0][6] = 32 * g_ip.F_sz_um;//global // aspect_ratio = 3.0; // wire_width = wire_pitch[0][6] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[0][6] - wire_width; // wire_r_per_micron[0][6] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.3; // wire_c_per_micron[0][6] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); //************************* //Conservative projections wire_pitch[1][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[1][0] = 2.0; wire_width = wire_pitch[1][0] / 2; wire_thickness = aspect_ratio[1][0] * wire_width; wire_spacing = wire_pitch[1][0] - wire_width; barrier_thickness = 0.003; dishing_thickness = 0; alpha_scatter = 1.05; wire_r_per_micron[1][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][0] = 0.15; miller_value[1][0] = 1.5; horiz_dielectric_constant[1][0] = 2.104; vert_dielectric_constant[1][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][0], miller_value[1][0], horiz_dielectric_constant[1][0], vert_dielectric_constant[1][0], fringe_cap); wire_pitch[1][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[1][1] / 2; aspect_ratio[1][1] = 2.0; wire_thickness = aspect_ratio[1][1] * wire_width; wire_spacing = wire_pitch[1][1] - wire_width; wire_r_per_micron[1][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][1] = 0.15; miller_value[1][1] = 1.5; horiz_dielectric_constant[1][1] = 2.104; vert_dielectric_constant[1][1] = 3.9; wire_c_per_micron[1][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][1], miller_value[1][1], horiz_dielectric_constant[1][1], vert_dielectric_constant[1][1], fringe_cap); wire_pitch[1][2] = 8 * g_ip->F_sz_um; aspect_ratio[1][2] = 2.2; wire_width = wire_pitch[1][2] / 2; wire_thickness = aspect_ratio[1][2] * wire_width; wire_spacing = wire_pitch[1][2] - wire_width; dishing_thickness = 0.1 * wire_thickness; wire_r_per_micron[1][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][2] = 0.275; miller_value[1][2] = 1.5; horiz_dielectric_constant[1][2] = 2.104; vert_dielectric_constant[1][2] = 3.9; wire_c_per_micron[1][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][2], miller_value[1][2], horiz_dielectric_constant[1][2], vert_dielectric_constant[1][2], fringe_cap); //Nominal projections for commodity DRAM wordline/bitline wire_pitch[1][3] = 2 * 0.022;//micron wire_c_per_micron[1][3] = 31e-15 / (256 * 2 * 0.022);//F/micron wire_r_per_micron[1][3] = 12 / 0.022;//ohm/micron //****************** // wire_pitch[1][4] = 16 * g_ip.F_sz_um; // aspect_ratio = 2.2; // wire_width = wire_pitch[1][4] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[1][4] - wire_width; // dishing_thickness = 0.1 * wire_thickness; // wire_r_per_micron[1][4] = wire_resistance(CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.275; // wire_c_per_micron[1][4] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[1][5] = 24 * g_ip.F_sz_um; // aspect_ratio = 2.2; // wire_width = wire_pitch[1][5] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[1][5] - wire_width; // dishing_thickness = 0.1 * wire_thickness; // wire_r_per_micron[1][5] = wire_resistance(CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.275; // wire_c_per_micron[1][5] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[1][6] = 32 * g_ip.F_sz_um; // aspect_ratio = 2.2; // wire_width = wire_pitch[1][6] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[1][6] - wire_width; // dishing_thickness = 0.1 * wire_thickness; // wire_r_per_micron[1][6] = wire_resistance(CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.275; // wire_c_per_micron[1][6] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); } else if (tech == 16) { //Aggressive projections. wire_pitch[0][0] = 2.5 * g_ip->F_sz_um;//local aspect_ratio[0][0] = 3.0; wire_width = wire_pitch[0][0] / 2; wire_thickness = aspect_ratio[0][0] * wire_width; wire_spacing = wire_pitch[0][0] - wire_width; barrier_thickness = 0; dishing_thickness = 0; alpha_scatter = 1; wire_r_per_micron[0][0] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][0] = 0.108; miller_value[0][0] = 1.5; horiz_dielectric_constant[0][0] = 1.202; vert_dielectric_constant[0][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[0][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][0], miller_value[0][0], horiz_dielectric_constant[0][0], vert_dielectric_constant[0][0], fringe_cap); wire_pitch[0][1] = 4 * g_ip->F_sz_um;//semi-global aspect_ratio[0][1] = 3.0; wire_width = wire_pitch[0][1] / 2; wire_thickness = aspect_ratio[0][1] * wire_width; wire_spacing = wire_pitch[0][1] - wire_width; wire_r_per_micron[0][1] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][1] = 0.108; miller_value[0][1] = 1.5; horiz_dielectric_constant[0][1] = 1.202; vert_dielectric_constant[0][1] = 3.9; wire_c_per_micron[0][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][1], miller_value[0][1], horiz_dielectric_constant[0][1], vert_dielectric_constant[0][1], fringe_cap); wire_pitch[0][2] = 8 * g_ip->F_sz_um;//global aspect_ratio[0][2] = 3.0; wire_width = wire_pitch[0][2] / 2; wire_thickness = aspect_ratio[0][2] * wire_width; wire_spacing = wire_pitch[0][2] - wire_width; wire_r_per_micron[0][2] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[0][2] = 0.216; miller_value[0][2] = 1.5; horiz_dielectric_constant[0][2] = 1.202; vert_dielectric_constant[0][2] = 3.9; wire_c_per_micron[0][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[0][2], miller_value[0][2], horiz_dielectric_constant[0][2], vert_dielectric_constant[0][2], fringe_cap); // //************************* // wire_pitch[0][4] = 16 * g_ip.F_sz_um;//global // aspect_ratio = 3.0; // wire_width = wire_pitch[0][4] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[0][4] - wire_width; // wire_r_per_micron[0][4] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.3; // wire_c_per_micron[0][4] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[0][5] = 24 * g_ip.F_sz_um;//global // aspect_ratio = 3.0; // wire_width = wire_pitch[0][5] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[0][5] - wire_width; // wire_r_per_micron[0][5] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.3; // wire_c_per_micron[0][5] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[0][6] = 32 * g_ip.F_sz_um;//global // aspect_ratio = 3.0; // wire_width = wire_pitch[0][6] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[0][6] - wire_width; // wire_r_per_micron[0][6] = wire_resistance(BULK_CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.3; // wire_c_per_micron[0][6] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); //************************* //Conservative projections wire_pitch[1][0] = 2.5 * g_ip->F_sz_um; aspect_ratio[1][0] = 2.0; wire_width = wire_pitch[1][0] / 2; wire_thickness = aspect_ratio[1][0] * wire_width; wire_spacing = wire_pitch[1][0] - wire_width; barrier_thickness = 0.002; dishing_thickness = 0; alpha_scatter = 1.05; wire_r_per_micron[1][0] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][0] = 0.108; miller_value[1][0] = 1.5; horiz_dielectric_constant[1][0] = 1.998; vert_dielectric_constant[1][0] = 3.9; fringe_cap = 0.115e-15; wire_c_per_micron[1][0] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][0], miller_value[1][0], horiz_dielectric_constant[1][0], vert_dielectric_constant[1][0], fringe_cap); wire_pitch[1][1] = 4 * g_ip->F_sz_um; wire_width = wire_pitch[1][1] / 2; aspect_ratio[1][1] = 2.0; wire_thickness = aspect_ratio[1][1] * wire_width; wire_spacing = wire_pitch[1][1] - wire_width; wire_r_per_micron[1][1] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][1] = 0.108; miller_value[1][1] = 1.5; horiz_dielectric_constant[1][1] = 1.998; vert_dielectric_constant[1][1] = 3.9; wire_c_per_micron[1][1] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][1], miller_value[1][1], horiz_dielectric_constant[1][1], vert_dielectric_constant[1][1], fringe_cap); wire_pitch[1][2] = 8 * g_ip->F_sz_um; aspect_ratio[1][2] = 2.2; wire_width = wire_pitch[1][2] / 2; wire_thickness = aspect_ratio[1][2] * wire_width; wire_spacing = wire_pitch[1][2] - wire_width; dishing_thickness = 0.1 * wire_thickness; wire_r_per_micron[1][2] = wire_resistance(CU_RESISTIVITY, wire_width, wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); ild_thickness[1][2] = 0.198; miller_value[1][2] = 1.5; horiz_dielectric_constant[1][2] = 1.998; vert_dielectric_constant[1][2] = 3.9; wire_c_per_micron[1][2] = wire_capacitance(wire_width, wire_thickness, wire_spacing, ild_thickness[1][2], miller_value[1][2], horiz_dielectric_constant[1][2], vert_dielectric_constant[1][2], fringe_cap); //Nominal projections for commodity DRAM wordline/bitline wire_pitch[1][3] = 2 * 0.016;//micron wire_c_per_micron[1][3] = 31e-15 / (256 * 2 * 0.016);//F/micron wire_r_per_micron[1][3] = 12 / 0.016;//ohm/micron //****************** // wire_pitch[1][4] = 16 * g_ip.F_sz_um; // aspect_ratio = 2.2; // wire_width = wire_pitch[1][4] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[1][4] - wire_width; // dishing_thickness = 0.1 * wire_thickness; // wire_r_per_micron[1][4] = wire_resistance(CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.275; // wire_c_per_micron[1][4] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[1][5] = 24 * g_ip.F_sz_um; // aspect_ratio = 2.2; // wire_width = wire_pitch[1][5] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[1][5] - wire_width; // dishing_thickness = 0.1 * wire_thickness; // wire_r_per_micron[1][5] = wire_resistance(CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.275; // wire_c_per_micron[1][5] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); // // wire_pitch[1][6] = 32 * g_ip.F_sz_um; // aspect_ratio = 2.2; // wire_width = wire_pitch[1][6] / 2; // wire_thickness = aspect_ratio * wire_width; // wire_spacing = wire_pitch[1][6] - wire_width; // dishing_thickness = 0.1 * wire_thickness; // wire_r_per_micron[1][6] = wire_resistance(CU_RESISTIVITY, wire_width, // wire_thickness, barrier_thickness, dishing_thickness, alpha_scatter); // ild_thickness = 0.275; // wire_c_per_micron[1][6] = wire_capacitance(wire_width, wire_thickness, wire_spacing, // ild_thickness, miller_value, horiz_dielectric_constant, vert_dielectric_constant, // fringe_cap); } g_tp.wire_local.pitch += curr_alpha * wire_pitch[g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_local.R_per_um += curr_alpha * wire_r_per_micron[g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_local.C_per_um += curr_alpha * wire_c_per_micron[g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_local.aspect_ratio += curr_alpha * aspect_ratio[g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_local.ild_thickness += curr_alpha * ild_thickness[g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_local.miller_value += curr_alpha * miller_value[g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_local.horiz_dielectric_constant += curr_alpha* horiz_dielectric_constant[g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_local.vert_dielectric_constant += curr_alpha* vert_dielectric_constant [g_ip->ic_proj_type][(ram_cell_tech_type == comm_dram)?3:0]; g_tp.wire_inside_mat.pitch += curr_alpha * wire_pitch[g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_inside_mat.R_per_um += curr_alpha* wire_r_per_micron[g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_inside_mat.C_per_um += curr_alpha* wire_c_per_micron[g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_inside_mat.aspect_ratio += curr_alpha * aspect_ratio[g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_inside_mat.ild_thickness += curr_alpha * ild_thickness[g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_inside_mat.miller_value += curr_alpha * miller_value[g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_inside_mat.horiz_dielectric_constant += curr_alpha* horiz_dielectric_constant[g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_inside_mat.vert_dielectric_constant += curr_alpha* vert_dielectric_constant [g_ip->ic_proj_type][g_ip->wire_is_mat_type]; g_tp.wire_outside_mat.pitch += curr_alpha * wire_pitch[g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.wire_outside_mat.R_per_um += curr_alpha*wire_r_per_micron[g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.wire_outside_mat.C_per_um += curr_alpha*wire_c_per_micron[g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.wire_outside_mat.aspect_ratio += curr_alpha * aspect_ratio[g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.wire_outside_mat.ild_thickness += curr_alpha * ild_thickness[g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.wire_outside_mat.miller_value += curr_alpha * miller_value[g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.wire_outside_mat.horiz_dielectric_constant += curr_alpha* horiz_dielectric_constant[g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.wire_outside_mat.vert_dielectric_constant += curr_alpha* vert_dielectric_constant [g_ip->ic_proj_type][g_ip->wire_os_mat_type]; g_tp.unit_len_wire_del = g_tp.wire_inside_mat.R_per_um * g_tp.wire_inside_mat.C_per_um / 2; g_tp.sense_delay += curr_alpha *SENSE_AMP_D; g_tp.sense_dy_power += curr_alpha *SENSE_AMP_P; // g_tp.horiz_dielectric_constant += horiz_dielectric_constant; // g_tp.vert_dielectric_constant += vert_dielectric_constant; // g_tp.aspect_ratio += aspect_ratio; // g_tp.miller_value += miller_value; // g_tp.ild_thickness += ild_thickness; } g_tp.fringe_cap = fringe_cap; double rd = tr_R_on(g_tp.min_w_nmos_, NCH, 1); double p_to_n_sizing_r = pmos_to_nmos_sz_ratio(); double c_load = gate_C(g_tp.min_w_nmos_ * (1 + p_to_n_sizing_r), 0.0); double tf = rd * c_load; g_tp.kinv = horowitz(0, tf, 0.5, 0.5, RISE); double KLOAD = 1; c_load = KLOAD * (drain_C_(g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def) + drain_C_(g_tp.min_w_nmos_ * p_to_n_sizing_r, PCH, 1, 1, g_tp.cell_h_def) + gate_C(g_tp.min_w_nmos_ * 4 * (1 + p_to_n_sizing_r), 0.0)); tf = rd * c_load; g_tp.FO4 = horowitz(0, tf, 0.5, 0.5, RISE); }
mlebeane/wattwatcher
fast_mcpat/cacti/technology.cc
C++
bsd-3-clause
143,090
# -*- coding: utf-8 -*- from functools import update_wrapper import os from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils import six from django.utils.translation import ugettext_lazy as _ from cms import constants from cms.utils.compat.urls import urljoin __all__ = ['get_cms_setting'] class VERIFIED: pass # need a unique identifier for CMS_LANGUAGES def default(name): def decorator(wrapped): def wrapper(): if hasattr(settings, name): return getattr(settings, name) return wrapped() update_wrapper(wrapper, wrapped) return wrapped return decorator DEFAULTS = { 'TEMPLATE_INHERITANCE': True, 'PLACEHOLDER_CONF': {}, 'PERMISSION': False, # Whether to use raw ID lookups for users when PERMISSION is True 'RAW_ID_USERS': False, 'PUBLIC_FOR': 'all', 'CONTENT_CACHE_DURATION': 60, 'APPHOOKS': [], 'TOOLBARS': [], 'SITE_CHOICES_CACHE_KEY': 'CMS:site_choices', 'PAGE_CHOICES_CACHE_KEY': 'CMS:page_choices', 'MEDIA_PATH': 'cms/', 'PAGE_MEDIA_PATH': 'cms_page_media/', 'TITLE_CHARACTER': '+', 'PAGE_CACHE': True, 'PLACEHOLDER_CACHE': True, 'PLUGIN_CACHE': True, 'CACHE_PREFIX': 'cms-', 'PLUGIN_PROCESSORS': [], 'PLUGIN_CONTEXT_PROCESSORS': [], 'UNIHANDECODE_VERSION': None, 'UNIHANDECODE_DECODERS': ['ja', 'zh', 'kr', 'vn', 'diacritic'], 'UNIHANDECODE_DEFAULT_DECODER': 'diacritic', 'MAX_PAGE_PUBLISH_REVERSIONS': 10, 'MAX_PAGE_HISTORY_REVERSIONS': 15, 'TOOLBAR_URL__EDIT_ON': 'edit', 'TOOLBAR_URL__EDIT_OFF': 'edit_off', 'TOOLBAR_URL__BUILD': 'build', 'ADMIN_NAMESPACE': 'admin', } def get_cache_durations(): return { 'menus': getattr(settings, 'MENU_CACHE_DURATION', 60 * 60), 'content': get_cms_setting('CONTENT_CACHE_DURATION'), 'permissions': 60 * 60, } @default('CMS_MEDIA_ROOT') def get_media_root(): return os.path.join(settings.MEDIA_ROOT, get_cms_setting('MEDIA_PATH')) @default('CMS_MEDIA_URL') def get_media_url(): return urljoin(settings.MEDIA_URL, get_cms_setting('MEDIA_PATH')) @default('CMS_TOOLBAR_URL__EDIT_ON') def get_toolbar_url__edit_on(): return get_cms_setting('TOOLBAR_URL__EDIT_ON') @default('CMS_TOOLBAR_URL__EDIT_OFF') def get_toolbar_url__edit_off(): return get_cms_setting('TOOLBAR_URL__EDIT_OFF') @default('CMS_TOOLBAR_URL__BUILD') def get_toolbar_url__build(): return get_cms_setting('TOOLBAR_URL__BUILD') def get_templates(): from cms.utils.django_load import load_from_file if getattr(settings, 'CMS_TEMPLATES_DIR', False): tpldir = getattr(settings, 'CMS_TEMPLATES_DIR', False) # CMS_TEMPLATES_DIR can either be a string poiting to the templates directory # or a dictionary holding 'site: template dir' entries if isinstance(tpldir, dict): tpldir = tpldir[settings.SITE_ID] # We must extract the relative path of CMS_TEMPLATES_DIR to the neares # valid templates directory. Here we mimick what the filesystem and # app_directories template loaders do prefix = '' # Relative to TEMPLATE_DIRS for filesystem loader for basedir in settings.TEMPLATE_DIRS: if tpldir.find(basedir) == 0: prefix = tpldir.replace(basedir + os.sep, '') break # Relative to 'templates' directory that app_directory scans if not prefix: components = tpldir.split(os.sep) try: prefix = os.path.join(*components[components.index('templates') + 1:]) except ValueError: # If templates is not found we use the directory name as prefix # and hope for the best prefix = os.path.basename(tpldir) config_path = os.path.join(tpldir, '__init__.py') # Try to load templates list and names from the template module # If module file is not present skip configuration and just dump the filenames as templates if config_path: template_module = load_from_file(config_path) templates = [(os.path.join(prefix, data[0].strip()), data[1]) for data in template_module.TEMPLATES.items()] else: templates = list((os.path.join(prefix, tpl), tpl) for tpl in os.listdir(tpldir)) else: templates = list(getattr(settings, 'CMS_TEMPLATES', [])) if get_cms_setting('TEMPLATE_INHERITANCE'): templates.append((constants.TEMPLATE_INHERITANCE_MAGIC, _(constants.TEMPLATE_INHERITANCE_LABEL))) return templates def _ensure_languages_settings(languages): valid_language_keys = ['code', 'name', 'fallbacks', 'hide_untranslated', 'redirect_on_fallback', 'public'] required_language_keys = ['code', 'name'] simple_defaults = ['public', 'redirect_on_fallback', 'hide_untranslated'] if not isinstance(languages, dict): raise ImproperlyConfigured( "CMS_LANGUAGES must be a dictionary with site IDs and 'default'" " as keys. Please check the format.") defaults = languages.pop('default', {}) default_fallbacks = defaults.get('fallbacks') needs_fallbacks = [] for key in defaults: if key not in valid_language_keys: raise ImproperlyConfigured("CMS_LANGUAGES has an invalid property in the default properties: %s" % key) for key in simple_defaults: if key not in defaults: defaults[key] = True for site, language_list in languages.items(): if not isinstance(site, six.integer_types): raise ImproperlyConfigured( "CMS_LANGUAGES can only be filled with integers (site IDs) and 'default'" " for default values. %s is not a valid key." % site) for language_object in language_list: for required_key in required_language_keys: if required_key not in language_object: raise ImproperlyConfigured("CMS_LANGUAGES has a language which is missing the required key %r " "in site %r" % (key, site)) language_code = language_object['code'] for key in language_object: if key not in valid_language_keys: raise ImproperlyConfigured( "CMS_LANGUAGES has invalid key %r in language %r in site %r" % (key, language_code, site) ) if 'fallbacks' not in language_object: if default_fallbacks: language_object['fallbacks'] = default_fallbacks else: needs_fallbacks.append((site, language_object)) for key in simple_defaults: if key not in language_object: language_object[key] = defaults[key] site_fallbacks = {} for site, language_object in needs_fallbacks: if site not in site_fallbacks: site_fallbacks[site] = [lang['code'] for lang in languages[site] if lang['public']] language_object['fallbacks'] = [lang_code for lang_code in site_fallbacks[site] if lang_code != language_object['code']] languages['default'] = defaults languages[VERIFIED] = True # this will be busted by SettingsOverride and cause a re-check return languages def get_languages(): if not isinstance(settings.SITE_ID, six.integer_types): raise ImproperlyConfigured( "SITE_ID must be an integer" ) if not settings.USE_I18N: return _ensure_languages_settings( {settings.SITE_ID: [{'code': settings.LANGUAGE_CODE, 'name': settings.LANGUAGE_CODE}]}) if settings.LANGUAGE_CODE not in dict(settings.LANGUAGES): raise ImproperlyConfigured( 'LANGUAGE_CODE "%s" must have a matching entry in LANGUAGES' % settings.LANGUAGE_CODE ) languages = getattr(settings, 'CMS_LANGUAGES', { settings.SITE_ID: [{'code': code, 'name': _(name)} for code, name in settings.LANGUAGES] }) if VERIFIED in languages: return languages return _ensure_languages_settings(languages) def get_unihandecode_host(): host = getattr(settings, 'CMS_UNIHANDECODE_HOST', None) if not host: return host if host.endswith('/'): return host else: return host + '/' COMPLEX = { 'CACHE_DURATIONS': get_cache_durations, 'MEDIA_ROOT': get_media_root, 'MEDIA_URL': get_media_url, # complex because not prefixed by CMS_ 'TEMPLATES': get_templates, 'LANGUAGES': get_languages, 'UNIHANDECODE_HOST': get_unihandecode_host, 'CMS_TOOLBAR_URL__EDIT_ON': get_toolbar_url__edit_on, 'CMS_TOOLBAR_URL__EDIT_OFF': get_toolbar_url__edit_off, 'CMS_TOOLBAR_URL__BUILD': get_toolbar_url__build, } def get_cms_setting(name): if name in COMPLEX: return COMPLEX[name]() else: return getattr(settings, 'CMS_%s' % name, DEFAULTS[name]) def get_site_id(site): from django.contrib.sites.models import Site if isinstance(site, Site): return site.id try: return int(site) except (TypeError, ValueError): pass return settings.SITE_ID
samirasnoun/django_cms_gallery_image
cms/utils/conf.py
Python
bsd-3-clause
9,303
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/message_loop.h" namespace aura { class DispatcherWin : public base::MessageLoop::Dispatcher { public: DispatcherWin() {} virtual ~DispatcherWin() {} // Overridden from MessageLoop::Dispatcher: virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(DispatcherWin); }; bool DispatcherWin::Dispatch(const base::NativeEvent& msg) { TranslateMessage(&msg); DispatchMessage(&msg); return true; } MessageLoop::Dispatcher* CreateDispatcher() { return new DispatcherWin; } } // namespace aura
JoKaWare/GViews
ui/aura/dispatcher_win.cc
C++
bsd-3-clause
805
<?php /* Prototype : int mb_stripos(string haystack, string needle [, int offset [, string encoding]]) * Description: Finds position of first occurrence of a string within another, case insensitive * Source code: ext/mbstring/mbstring.c * Alias to functions: */ /* * Pass mb_stripos different data types as $haystack arg to test behaviour */ echo "*** Testing mb_stripos() : usage variations ***\n"; // Initialise function arguments not being substituted $needle = b'string_val'; $offset = 0; $encoding = 'utf-8'; //get an unset variable $unset_var = 10; unset ($unset_var); // get a class class classA { public function __toString() { return "Class A object"; } } // heredoc string $heredoc = <<<EOT hello world EOT; // get a resource variable $fp = fopen(__FILE__, "r"); // unexpected values to be passed to $haystack argument $inputs = array( // int data /*1*/ 0, 1, 12345, -2345, // float data /*5*/ 10.5, -10.5, 12.3456789000e10, 12.3456789000E-10, .5, // null data /*10*/ NULL, null, // boolean data /*12*/ true, false, TRUE, FALSE, // empty data /*16*/ "", '', // string data /*18*/ "string", 'string', $heredoc, // object data /*21*/ new classA(), // undefined data /*22*/ @$undefined_var, // unset data /*23*/ @$unset_var, // resource variable /*24*/ $fp ); // loop through each element of $inputs to check the behavior of mb_stripos() $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; var_dump( mb_stripos($input, $needle, $offset, $encoding)); $iterator++; }; fclose($fp); echo "Done"; ?>
JSchwehn/php
testdata/fuzzdir/corpus/ext_mbstring_tests_mb_stripos_variation1.php
PHP
bsd-3-clause
1,760
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Runs Apple's SunSpider JavaScript benchmark.""" import collections import json import os from telemetry.core import util from telemetry.page import page_measurement from telemetry.page import page_set class SunSpiderMeasurement(page_measurement.PageMeasurement): def CreatePageSet(self, _, options): return page_set.PageSet.FromDict({ 'serving_dirs': ['../../../chrome/test/data/sunspider/'], 'pages': [ { 'url': 'file:///../../../chrome/test/data/sunspider/' 'sunspider-1.0/driver.html' } ] }, os.path.abspath(__file__)) def MeasurePage(self, _, tab, results): js_is_done = """ window.location.pathname.indexOf('results.html') >= 0""" def _IsDone(): return tab.EvaluateJavaScript(js_is_done) util.WaitFor(_IsDone, 300, poll_interval=5) js_get_results = 'JSON.stringify(output);' js_results = json.loads(tab.EvaluateJavaScript(js_get_results)) r = collections.defaultdict(list) totals = [] # js_results is: [{'foo': v1, 'bar': v2}, # {'foo': v3, 'bar': v4}, # ...] for result in js_results: total = 0 for key, value in result.iteritems(): r[key].append(value) total += value totals.append(total) for key, values in r.iteritems(): results.Add(key, 'ms', values, data_type='unimportant') results.Add('Total', 'ms', totals)
jing-bao/pa-chromium
tools/perf/perf_tools/sunspider.py
Python
bsd-3-clause
1,597
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/sync/test/fake_server/fake_server_http_post_provider.h" #include <utility> #include "base/bind.h" #include "base/location.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "components/sync/test/fake_server/fake_server.h" #include "net/base/net_errors.h" namespace fake_server { // static std::atomic_bool FakeServerHttpPostProvider::network_enabled_(true); FakeServerHttpPostProviderFactory::FakeServerHttpPostProviderFactory( const base::WeakPtr<FakeServer>& fake_server, scoped_refptr<base::SequencedTaskRunner> fake_server_task_runner) : fake_server_(fake_server), fake_server_task_runner_(fake_server_task_runner) {} FakeServerHttpPostProviderFactory::~FakeServerHttpPostProviderFactory() = default; scoped_refptr<syncer::HttpPostProviderInterface> FakeServerHttpPostProviderFactory::Create() { return new FakeServerHttpPostProvider(fake_server_, fake_server_task_runner_); } FakeServerHttpPostProvider::FakeServerHttpPostProvider( const base::WeakPtr<FakeServer>& fake_server, scoped_refptr<base::SequencedTaskRunner> fake_server_task_runner) : fake_server_(fake_server), fake_server_task_runner_(fake_server_task_runner), synchronous_post_completion_( base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED), aborted_(false) {} FakeServerHttpPostProvider::~FakeServerHttpPostProvider() = default; void FakeServerHttpPostProvider::SetExtraRequestHeaders(const char* headers) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // TODO(pvalenzuela): Add assertions on this value. extra_request_headers_.assign(headers); } void FakeServerHttpPostProvider::SetURL(const GURL& url) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); request_url_ = url; } void FakeServerHttpPostProvider::SetPostPayload(const char* content_type, int content_length, const char* content) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); request_content_type_.assign(content_type); request_content_.assign(content, content_length); } bool FakeServerHttpPostProvider::MakeSynchronousPost(int* net_error_code, int* http_status_code) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!network_enabled_) { response_.clear(); *net_error_code = net::ERR_INTERNET_DISCONNECTED; *http_status_code = 0; return false; } synchronous_post_completion_.Reset(); aborted_ = false; // It is assumed that a POST is being made to /command. int post_status_code = -1; std::string post_response; bool result = fake_server_task_runner_->PostTask( FROM_HERE, base::BindOnce( &FakeServerHttpPostProvider::HandleCommandOnFakeServerThread, base::RetainedRef(this), base::Unretained(&post_status_code), base::Unretained(&post_response))); if (!result) { response_.clear(); *net_error_code = net::ERR_UNEXPECTED; *http_status_code = 0; return false; } { base::ScopedAllowBaseSyncPrimitivesForTesting allow_wait; synchronous_post_completion_.Wait(); } if (aborted_) { *net_error_code = net::ERR_ABORTED; return false; } // Zero means success. *net_error_code = 0; *http_status_code = post_status_code; response_ = post_response; return true; } int FakeServerHttpPostProvider::GetResponseContentLength() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return response_.length(); } const char* FakeServerHttpPostProvider::GetResponseContent() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return response_.c_str(); } const std::string FakeServerHttpPostProvider::GetResponseHeaderValue( const std::string& name) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return std::string(); } void FakeServerHttpPostProvider::Abort() { // Note: This may be called on any thread, so no |sequence_checker_| here. // The sync thread could be blocked in MakeSynchronousPost(), waiting // for HandleCommandOnFakeServerThread() to be processed and completed. // This causes an immediate unblocking which will be returned as // net::ERR_ABORTED. aborted_ = true; synchronous_post_completion_.Signal(); } // static void FakeServerHttpPostProvider::DisableNetwork() { // Note: This may be called on any thread. network_enabled_ = false; } // static void FakeServerHttpPostProvider::EnableNetwork() { // Note: This may be called on any thread. network_enabled_ = true; } void FakeServerHttpPostProvider::HandleCommandOnFakeServerThread( int* http_status_code, std::string* response) { DCHECK(fake_server_task_runner_->RunsTasksInCurrentSequence()); if (!fake_server_ || aborted_) { // Command explicitly aborted or server destroyed. return; } *http_status_code = fake_server_->HandleCommand(request_content_, response); synchronous_post_completion_.Signal(); } } // namespace fake_server
scheib/chromium
components/sync/test/fake_server/fake_server_http_post_provider.cc
C++
bsd-3-clause
5,309
# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} - Use mailhog for emails {% else %} - Use console backend for emails {% endif %} - Add Django Debug Toolbar - Add django-extensions as app """ import socket import os from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool('DJANGO_DEBUG', default=True) TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # SECRET CONFIGURATION # ------------------------------------------------------------------------------ # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # Note: This key only used for development and testing. SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!') # Mail settings # ------------------------------------------------------------------------------ EMAIL_PORT = 1025 {% if cookiecutter.use_mailhog == 'y' and cookiecutter.use_docker == 'y' %} EMAIL_HOST = env("EMAIL_HOST", default='mailhog') {% else %} EMAIL_HOST = 'localhost' EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend') {% endif %} # CACHING # ------------------------------------------------------------------------------ CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': '' } } # django-debug-toolbar # ------------------------------------------------------------------------------ MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',) INSTALLED_APPS += ('debug_toolbar', ) INTERNAL_IPS = ['127.0.0.1', '10.0.2.2', ] # tricks to have debug toolbar when developing with docker if os.environ.get('USE_DOCKER') == 'yes': ip = socket.gethostbyname(socket.gethostname()) INTERNAL_IPS += [ip[:-1] + "1"] DEBUG_TOOLBAR_CONFIG = { 'DISABLE_PANELS': [ 'debug_toolbar.panels.redirects.RedirectsPanel', ], 'SHOW_TEMPLATE_CONTEXT': True, } # django-extensions # ------------------------------------------------------------------------------ INSTALLED_APPS += ('django_extensions', ) # TESTING # ------------------------------------------------------------------------------ TEST_RUNNER = 'django.test.runner.DiscoverRunner' {% if cookiecutter.use_celery == 'y' %} ########## CELERY # In development, all tasks will be executed locally by blocking until the task returns CELERY_ALWAYS_EAGER = True ########## END CELERY {% endif %} # Your local stuff: Below this line define 3rd party library settings # ------------------------------------------------------------------------------
schacki/cookiecutter-django
{{cookiecutter.project_slug}}/config/settings/local.py
Python
bsd-3-clause
2,678
<?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : basic functionality - using bool format ***\n"; // Initialise all required variables $format = "format"; $format1 = "%b"; $format2 = "%b %b"; $format3 = "%b %b %b"; $arg1 = TRUE; $arg2 = FALSE; $arg3 = true; // Calling sprintf() with default arguments var_dump( sprintf($format) ); // Calling sprintf() with two arguments var_dump( sprintf($format1, $arg1) ); // Calling sprintf() with three arguments var_dump( sprintf($format2, $arg1, $arg2) ); // Calling sprintf() with four arguments var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); echo "Done"; ?>
JSchwehn/php
testdata/fuzzdir/corpus/ext_standard_tests_strings_sprintf_basic4.php
PHP
bsd-3-clause
771
# (C) Datadog, Inc. 2014-2016 # (C) Cory Watson <cory@stripe.com> 2015-2016 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) # stdlib from collections import defaultdict from urlparse import urlparse import re # 3rd party import requests # project from checks import AgentCheck DEFAULT_MAX_METRICS = 350 PATH = "path" ALIAS = "alias" TYPE = "type" TAGS = "tags" GAUGE = "gauge" RATE = "rate" COUNTER = "counter" DEFAULT_TYPE = GAUGE SUPPORTED_TYPES = { GAUGE: AgentCheck.gauge, RATE: AgentCheck.rate, COUNTER: AgentCheck.increment, } DEFAULT_METRIC_NAMESPACE = "go_expvar" # See http://golang.org/pkg/runtime/#MemStats DEFAULT_GAUGE_MEMSTAT_METRICS = [ # General statistics "Alloc", "TotalAlloc", # Main allocation heap statistics "HeapAlloc", "HeapSys", "HeapIdle", "HeapInuse", "HeapReleased", "HeapObjects", ] DEFAULT_RATE_MEMSTAT_METRICS = [ # General statistics "Lookups", "Mallocs", "Frees", # Garbage collector statistics "PauseTotalNs", "NumGC", ] DEFAULT_METRICS = [{PATH: "memstats/%s" % path, TYPE: GAUGE} for path in DEFAULT_GAUGE_MEMSTAT_METRICS] +\ [{PATH: "memstats/%s" % path, TYPE: RATE} for path in DEFAULT_RATE_MEMSTAT_METRICS] GO_EXPVAR_URL_PATH = "/debug/vars" class GoExpvar(AgentCheck): def __init__(self, name, init_config, agentConfig, instances=None): AgentCheck.__init__(self, name, init_config, agentConfig, instances) self._last_gc_count = defaultdict(int) def _get_data(self, url, instance): ssl_params = { 'ssl': instance.get('ssl'), 'ssl_keyfile': instance.get('ssl_keyfile'), 'ssl_certfile': instance.get('ssl_certfile'), 'ssl_verify': instance.get('ssl_verify'), } for key, param in ssl_params.items(): if param is None: del ssl_params[key] # Load SSL configuration, if available. # ssl_verify can be a bool or a string (http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification) if isinstance(ssl_params.get('ssl_verify'), bool) or isinstance(ssl_params.get('ssl_verify'), basestring): verify = ssl_params.get('ssl_verify') else: verify = None if ssl_params.get('ssl_certfile') and ssl_params.get('ssl_keyfile'): cert = (ssl_params.get('ssl_certfile'), ssl_params.get('ssl_keyfile')) elif ssl_params.get('ssl_certfile'): cert = ssl_params.get('ssl_certfile') else: cert = None resp = requests.get( url, timeout=10, verify=verify, cert=cert ) resp.raise_for_status() return resp.json() def _load(self, instance): url = instance.get('expvar_url') if not url: raise Exception('GoExpvar instance missing "expvar_url" value.') parsed_url = urlparse(url) # if no path is specified we use the default one if not parsed_url.path: url = parsed_url._replace(path=GO_EXPVAR_URL_PATH).geturl() tags = instance.get('tags', []) tags.append("expvar_url:%s" % url) data = self._get_data(url, instance) metrics = DEFAULT_METRICS + instance.get("metrics", []) max_metrics = instance.get("max_returned_metrics", DEFAULT_MAX_METRICS) namespace = instance.get('namespace', DEFAULT_METRIC_NAMESPACE) return data, tags, metrics, max_metrics, url, namespace def get_gc_collection_histogram(self, data, tags, url, namespace): num_gc = data.get("memstats", {}).get("NumGC") pause_hist = data.get("memstats", {}).get("PauseNs") last_gc_count = self._last_gc_count[url] if last_gc_count == num_gc: # No GC has run. Do nothing return start = last_gc_count % 256 end = (num_gc + 255) % 256 + 1 if start < end: values = pause_hist[start:end] else: values = pause_hist[start:] + pause_hist[:end] self._last_gc_count[url] = num_gc for value in values: self.histogram( self.normalize("memstats.PauseNs", namespace, fix_case=True), value, tags=tags) def check(self, instance): data, tags, metrics, max_metrics, url, namespace = self._load(instance) self.get_gc_collection_histogram(data, tags, url, namespace) self.parse_expvar_data(data, tags, metrics, max_metrics, namespace) def parse_expvar_data(self, data, tags, metrics, max_metrics, namespace): ''' Report all the metrics based on the configuration in instance If a metric is not well configured or is not present in the payload, continue processing metrics but log the information to the info page ''' count = 0 for metric in metrics: path = metric.get(PATH) metric_type = metric.get(TYPE, DEFAULT_TYPE) metric_tags = list(metric.get(TAGS, [])) metric_tags += tags alias = metric.get(ALIAS) if not path: self.warning("Metric %s has no path" % metric) continue if metric_type not in SUPPORTED_TYPES: self.warning("Metric type %s not supported for this check" % metric_type) continue keys = path.split("/") values = self.deep_get(data, keys) if len(values) == 0: self.warning("No results matching path %s" % path) continue tag_by_path = alias is not None for traversed_path, value in values: actual_path = ".".join(traversed_path) path_tag = ["path:%s" % actual_path] if tag_by_path else [] metric_name = alias or self.normalize(actual_path, namespace, fix_case=True) try: float(value) except ValueError: self.log.warning("Unreportable value for path %s: %s" % (path, value)) continue if count >= max_metrics: self.warning("Reporting more metrics than the allowed maximum. " "Please contact support@datadoghq.com for more information.") return SUPPORTED_TYPES[metric_type](self, metric_name, value, metric_tags + path_tag) count += 1 def deep_get(self, content, keys, traversed_path=None): ''' Allow to retrieve content nested inside a several layers deep dict/list Examples: -content: { "key1": { "key2" : [ { "name" : "object1", "value" : 42 }, { "name" : "object2", "value" : 72 } ] } } -keys: ["key1", "key2", "1", "value"] would return [(["key1", "key2", "1", "value"], 72)] -keys: ["key1", "key2", "1", "*"] would return [(["key1", "key2", "1", "value"], 72), (["key1", "key2", "1", "name"], "object2")] -keys: ["key1", "key2", "*", "value"] would return [(["key1", "key2", "1", "value"], 72), (["key1", "key2", "0", "value"], 42)] ''' if traversed_path is None: traversed_path = [] if keys == []: return [(traversed_path, content)] key = keys[0] regex = "".join(["^", key, "$"]) try: key_rex = re.compile(regex) except Exception: self.warning("Cannot compile regex: %s" % regex) return [] results = [] for new_key, new_content in self.items(content): if key_rex.match(new_key): results.extend(self.deep_get(new_content, keys[1:], traversed_path + [str(new_key)])) return results def items(self, object): if isinstance(object, list): for new_key, new_content in enumerate(object): yield str(new_key), new_content elif isinstance(object, dict): for new_key, new_content in object.iteritems(): yield str(new_key), new_content else: self.log.warning("Could not parse this object, check the json" "served by the expvar")
varlib1/servermall
go_expvar/check.py
Python
bsd-3-clause
8,833
class CreateFireStations < ActiveRecord::Migration def change create_table :fire_stations do |t| t.string :address t.point :latlon, :geographic => true t.integer :zip t.timestamps end end end
cityofaustin/preparedly
db/migrate/20120426235805_create_fire_stations.rb
Ruby
bsd-3-clause
229
class Spree::PagesController < Spree::BaseController def show @page = current_page raise ActionController::RoutingError.new("No route matches [GET] #{request.path}") if @page.nil? if @page.root? @posts = Spree::Post.live.limit(5) if SpreeEssentials.has?(:blog) @articles = Spree::Article.live.limit(5) if SpreeEssentials.has?(:news) render :template => 'spree/pages/home' end end private def accurate_title @page.meta_title end end
hakhanhphuc/spree_essential_cms
app/controllers/spree/pages_controller.rb
Ruby
bsd-3-clause
497
var analytics = require('analytics') var d3 = require('d3') var hogan = require('hogan.js') var log = require('./client/log')('help-me-choose') var modal = require('./client/modal') var RouteModal = require('route-modal') var routeResource = require('route-resource') var routeSummarySegments = require('route-summary-segments') var session = require('session') var toCapitalCase = require('to-capital-case') var optionTemplate = hogan.compile(require('./option.html')) var routeTemplate = hogan.compile(require('./route.html')) var primaryFilter = 'totalCost' var secondaryFilter = 'productiveTime' var filters = { travelTime: function (a) { return a.time }, totalCost: function (a) { return a.cost }, walkDistance: function (a) { return a.walkDistance }, calories: function (a) { return -a.calories }, productiveTime: function (a) { return -a.productiveTime }, none: function (a) { return 0 } } /** * Expose `Modal` */ var Modal = module.exports = modal({ closable: true, width: '768px', template: require('./template.html') }, function (view, routes) { view.primaryFilter = view.find('#primary-filter') view.secondaryFilter = view.find('#secondary-filter') view.primaryFilter.querySelector('[value="none"]').remove() view.primaryFilter.value = primaryFilter view.secondaryFilter.value = secondaryFilter view.oneWay = true view.daily = true view.refresh() }) /** * Refresh */ Modal.prototype.refresh = function (e) { if (e) e.preventDefault() log('refreshing') primaryFilter = this.primaryFilter.value secondaryFilter = this.secondaryFilter.value var i var thead = this.find('thead') var tbody = this.find('tbody') // Remove rows tbody.innerHTML = '' // Remove all colors var headers = thead.querySelectorAll('th') for (i = 0; i < headers.length; i++) { headers[i].classList.remove('primaryFilter') headers[i].classList.remove('secondaryFilter') } var phead = thead.querySelector('.' + primaryFilter) if (phead) phead.classList.add('primaryFilter') var shead = thead.querySelector('.' + secondaryFilter) if (shead) shead.classList.add('secondaryFilter') // Get the indexes var primaryFn = filters[primaryFilter] var secondaryFn = filters[secondaryFilter] // Get the multiplier var multiplier = this.oneWay ? 1 : 2 multiplier *= this.daily ? 1 : 365 // Get the route data var routes = this.model.map(function (r, index) { return getRouteData(r, multiplier, index) }) // Sort by secondary first routes = rankRoutes(routes, primaryFn, secondaryFn) // Render for (i = 0; i < routes.length; i++) { var route = routes[i] tbody.innerHTML += this.renderRoute(route) var row = tbody.childNodes[i] var pcell = row.querySelector('.' + primaryFilter) var scell = row.querySelector('.' + secondaryFilter) if (pcell) pcell.style.backgroundColor = toRGBA(route.primaryColor, 0.25) if (scell) scell.style.backgroundColor = toRGBA(route.secondaryColor, 0.25) } // Track the results analytics.track('Viewed "Help Me Choose"', { plan: session.plan().generateQuery(), primaryFilter: primaryFilter, secondaryFilter: secondaryFilter, multiplier: multiplier }) } /** * Append option */ Modal.prototype.renderRoute = function (data) { data.calories = data.calories ? parseInt(data.calories, 10).toLocaleString() + ' cals' : 'None' data.cost = data.cost ? '$' + data.cost.toFixed(2) : 'Free' data.emissions = data.emissions ? parseInt(data.emissions, 10) : 'None' data.walkDistance = data.walkDistance ? data.walkDistance + ' mi' : 'None' if (data.productiveTime) { if (data.productiveTime > 120) { data.productiveTime = parseInt(data.productiveTime / 60, 10).toLocaleString() + ' hrs' } else { data.productiveTime = parseInt(data.productiveTime, 10).toLocaleString() + ' min' } } else { data.productiveTime = 'None' } return routeTemplate.render(data) } /** * Filters */ Modal.prototype.filters = function () { var options = '' for (var f in filters) { options += optionTemplate.render({ name: toCapitalCase(f).toLowerCase(), value: f }) } return options } /** * Select this option */ Modal.prototype.selectRoute = function (e) { e.preventDefault() if (e.target.tagName !== 'BUTTON') return var index = e.target.getAttribute('data-index') var route = this.model[index] var plan = session.plan() var tags = route.tags(plan) var self = this routeResource.findByTags(tags, function (err, resources) { if (err) log.error(err) var routeModal = new RouteModal(route, null, { context: 'help-me-choose', resources: resources }) self.hide() routeModal.show() routeModal.on('next', function () { routeModal.hide() }) }) } /** * Multipliers */ Modal.prototype.setOneWay = function (e) { this.oneWay = true this.setMultiplier(e) } Modal.prototype.setRoundTrip = function (e) { this.oneWay = false this.setMultiplier(e) } Modal.prototype.setDaily = function (e) { this.daily = true this.setMultiplier(e) } Modal.prototype.setYearly = function (e) { this.daily = false this.setMultiplier(e) } Modal.prototype.setMultiplier = function (e) { e.preventDefault() var button = e.target var parent = button.parentNode var buttons = parent.getElementsByTagName('button') for (var i = 0; i < buttons.length; i++) { buttons[i].classList.remove('active') } button.classList.add('active') this.refresh() } /** * Rank & sort the routes */ function rankRoutes (routes, primary, secondary) { var primaryDomain = [d3.min(routes, primary), d3.max(routes, primary)] var secondaryDomain = [d3.min(routes, secondary), d3.max(routes, secondary)] var primaryScale = d3.scale.linear() .domain(primaryDomain) .range([0, routes.length * 2]) var secondaryScale = d3.scale.linear() .domain(secondaryDomain) .range([1, routes.length]) var primaryColor = d3.scale.linear() .domain(primaryDomain) .range(['#f5a81c', '#fff']) var secondaryColor = d3.scale.linear() .domain(secondaryDomain) .range(['#8ec449', '#fff']) routes = routes.map(function (r) { r.primaryRank = primaryScale(primary(r)) r.primaryColor = primaryColor(primary(r)) r.secondaryRank = secondaryScale(secondary(r)) r.secondaryColor = secondaryColor(secondary(r)) r.rank = r.primaryRank + r.secondaryRank return r }) routes.sort(function (a, b) { return a.rank - b.rank }) // lowest number first return routes } /** * RGB to transparent */ function toRGBA (rgb, opacity) { var c = d3.rgb(rgb) return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + opacity + ')' } /** * Get route data */ function getRouteData (route, multiplier, index) { var data = { segments: routeSummarySegments(route, { inline: true }), index: index, time: route.average(), frequency: 0, cost: route.cost(), walkDistance: route.walkDistances(), calories: route.totalCalories(), productiveTime: route.timeInTransit(), emissions: route.emissions(), score: route.score(), rank: 0 } if (multiplier > 1) { ['cost', 'calories', 'productiveTime', 'emissions'].forEach(function (type) { data[type] = data[type] * multiplier }) } return data }
miraculixx/modeify
client/help-me-choose-view/index.js
JavaScript
bsd-3-clause
7,412
goog.provide('goog.testing.PseudoRandom'); goog.require('goog.Disposable'); goog.testing.PseudoRandom = function(opt_seed, opt_install) { goog.Disposable.call(this); this.seed_ = opt_seed || goog.testing.PseudoRandom.seedUniquifier_ ++ + goog.now(); if(opt_install) { this.install(); } }; goog.inherits(goog.testing.PseudoRandom, goog.Disposable); goog.testing.PseudoRandom.seedUniquifier_ = 0; goog.testing.PseudoRandom.A = 48271; goog.testing.PseudoRandom.M = 2147483647; goog.testing.PseudoRandom.Q = 44488; goog.testing.PseudoRandom.R = 3399; goog.testing.PseudoRandom.ONE_OVER_M = 1.0 / goog.testing.PseudoRandom.M; goog.testing.PseudoRandom.prototype.installed_; goog.testing.PseudoRandom.prototype.mathRandom_; goog.testing.PseudoRandom.prototype.install = function() { if(! this.installed_) { this.mathRandom_ = Math.random; Math.random = goog.bind(this.random, this); this.installed_ = true; } }; goog.testing.PseudoRandom.prototype.disposeInternal = function() { goog.testing.PseudoRandom.superClass_.disposeInternal.call(this); this.uninstall(); }; goog.testing.PseudoRandom.prototype.uninstall = function() { if(this.installed_) { Math.random = this.mathRandom_; this.installed_ = false; } }; goog.testing.PseudoRandom.prototype.random = function() { var hi = this.seed_ / goog.testing.PseudoRandom.Q; var lo = this.seed_ % goog.testing.PseudoRandom.Q; var test = goog.testing.PseudoRandom.A * lo - goog.testing.PseudoRandom.R * hi; if(test > 0) { this.seed_ = test; } else { this.seed_ = test + goog.testing.PseudoRandom.M; } return this.seed_ * goog.testing.PseudoRandom.ONE_OVER_M; };
johnjbarton/qpp
traceur/test/closurebaseline/third_party/closure-library/closure/goog/testing/pseudorandom.js
JavaScript
bsd-3-clause
1,713
# Copyright (c) 2017,2018 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ =============================== Sigma to Pressure Interpolation =============================== By using `metpy.calc.log_interp`, data with sigma as the vertical coordinate can be interpolated to isobaric coordinates. """ import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt from netCDF4 import Dataset, num2date from metpy.cbook import get_test_data from metpy.interpolate import log_interpolate_1d from metpy.plots import add_metpy_logo, add_timestamp from metpy.units import units ###################################### # **Data** # # The data for this example comes from the outer domain of a WRF-ARW model forecast # initialized at 1200 UTC on 03 June 1980. Model data courtesy Matthew Wilson, Valparaiso # University Department of Geography and Meteorology. data = Dataset(get_test_data('wrf_example.nc', False)) lat = data.variables['lat'][:] lon = data.variables['lon'][:] time = data.variables['time'] vtimes = num2date(time[:], time.units) temperature = units.Quantity(data.variables['temperature'][:], 'degC') pressure = units.Quantity(data.variables['pressure'][:], 'Pa') hgt = units.Quantity(data.variables['height'][:], 'meter') #################################### # Array of desired pressure levels plevs = [700.] * units.hPa ##################################### # **Interpolate The Data** # # Now that the data is ready, we can interpolate to the new isobaric levels. The data is # interpolated from the irregular pressure values for each sigma level to the new input # mandatory isobaric levels. `mpcalc.log_interp` will interpolate over a specified dimension # with the `axis` argument. In this case, `axis=1` will correspond to interpolation on the # vertical axis. The interpolated data is output in a list, so we will pull out each # variable for plotting. height, temp = log_interpolate_1d(plevs, pressure, hgt, temperature, axis=1) #################################### # **Plotting the Data for 700 hPa.** # Set up our projection crs = ccrs.LambertConformal(central_longitude=-100.0, central_latitude=45.0) # Set the forecast hour FH = 1 # Create the figure and grid for subplots fig = plt.figure(figsize=(17, 12)) add_metpy_logo(fig, 470, 320, size='large') # Plot 700 hPa ax = plt.subplot(111, projection=crs) ax.add_feature(cfeature.COASTLINE.with_scale('50m'), linewidth=0.75) ax.add_feature(cfeature.STATES, linewidth=0.5) # Plot the heights cs = ax.contour(lon, lat, height[FH, 0, :, :], transform=ccrs.PlateCarree(), colors='k', linewidths=1.0, linestyles='solid') cs.clabel(fontsize=10, inline=1, inline_spacing=7, fmt='%i', rightside_up=True, use_clabeltext=True) # Contour the temperature cf = ax.contourf(lon, lat, temp[FH, 0, :, :], range(-20, 20, 1), cmap=plt.cm.RdBu_r, transform=ccrs.PlateCarree()) cb = fig.colorbar(cf, orientation='horizontal', aspect=65, shrink=0.5, pad=0.05, extendrect='True') cb.set_label('Celsius', size='x-large') ax.set_extent([-106.5, -90.4, 34.5, 46.75], crs=ccrs.PlateCarree()) # Make the axis title ax.set_title(f'{plevs[0]:~.0f} Heights (m) and Temperature (C)', loc='center', fontsize=10) # Set the figure title fig.suptitle(f'WRF-ARW Forecast VALID: {vtimes[FH]} UTC', fontsize=14) add_timestamp(ax, vtimes[FH], y=0.02, high_contrast=True) plt.show()
metpy/MetPy
v1.1/_downloads/0f93e682cc461be360e2fd037bf1fb7e/sigma_to_pressure_interpolation.py
Python
bsd-3-clause
3,493
<?php // autoload_real.php @generated by Composer class ComposerAutoloaderInit074aee1d4233eb5f2c56ebdb549dbef4 { private static $loader; public static function loadClassLoader($class) { if ('Composer\Autoload\ClassLoader' === $class) { require __DIR__ . '/ClassLoader.php'; } } public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit074aee1d4233eb5f2c56ebdb549dbef4', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit074aee1d4233eb5f2c56ebdb549dbef4', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = require __DIR__ . '/autoload_psr4.php'; foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { composerRequire074aee1d4233eb5f2c56ebdb549dbef4($file); } return $loader; } } function composerRequire074aee1d4233eb5f2c56ebdb549dbef4($file) { require $file; }
kidbai/d4t
vendor/composer/autoload_real.php
PHP
bsd-3-clause
1,585
# # cocos2d # http://cocos2d.org # from __future__ import division, print_function, unicode_literals import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) from cocos.director import director from cocos.layer import Layer, ColorLayer from cocos.scene import Scene from cocos.scenes.transitions import * from cocos.actions import * from cocos.sprite import Sprite import pyglet from pyglet import gl, font from pyglet.window import key class ControlLayer(Layer): is_event_handler = True #: enable pyglet's events def __init__( self ): super(ControlLayer, self).__init__() self.text_title = pyglet.text.Label("Transition Demos", font_size=32, x=5, y=director.get_window_size()[1], anchor_x=font.Text.LEFT, anchor_y=font.Text.TOP ) self.text_subtitle = pyglet.text.Label( transition_list[current_transition].__name__, font_size=18, multiline=True, width=600, x=5, y=director.get_window_size()[1] - 80, anchor_x=font.Text.LEFT, anchor_y=font.Text.TOP ) self.text_help = pyglet.text.Label("Press LEFT / RIGHT for prev/next test, ENTER to restart test", font_size=16, x=director.get_window_size()[0] // 2, y=20, anchor_x=font.Text.CENTER, anchor_y=font.Text.CENTER) def draw( self ): self.text_title.draw() self.text_subtitle.draw() self.text_help.draw() def on_key_press( self, k , m ): global current_transition, control_p if k == key.LEFT: current_transition = (current_transition-1)%len(transition_list) elif k == key.RIGHT: current_transition = (current_transition+1)%len(transition_list) elif k == key.ENTER: director.replace( transition_list[current_transition]( (control_list[(control_p+1)%len(control_list)] ), 1.25) ) control_p = (control_p + 1) % len(control_list) return True if k in (key.LEFT, key.RIGHT ): self.text_subtitle.text = transition_list[current_transition].__name__ class GrossiniLayer(Layer): def __init__( self ): super( GrossiniLayer, self ).__init__() g = Sprite( 'grossini.png') g.position = (320,240) rot = RotateBy( 360, 4 ) g.do( Repeat( rot + Reverse(rot) ) ) self.add( g ) class GrossiniLayer2(Layer): def __init__( self ): super( GrossiniLayer2, self ).__init__() rot = Rotate( 360, 5 ) g1 = Sprite( 'grossinis_sister1.png' ) g1.position = (490,240) g2 = Sprite( 'grossinis_sister2.png' ) g2.position = (140,240) g1.do( Repeat( rot + Reverse(rot) ) ) g2.do( Repeat( rot + Reverse(rot) ) ) self.add( g1 ) self.add( g2 ) if __name__ == "__main__": director.init(resizable=True) # director.window.set_fullscreen(True) transition_list = [ # ActionTransitions RotoZoomTransition, JumpZoomTransition, SplitColsTransition, SplitRowsTransition, MoveInLTransition, MoveInRTransition, MoveInBTransition, MoveInTTransition, SlideInLTransition, SlideInRTransition, SlideInBTransition, SlideInTTransition, FlipX3DTransition, FlipY3DTransition, FlipAngular3DTransition, ShuffleTransition, ShrinkGrowTransition, CornerMoveTransition, EnvelopeTransition, FadeTRTransition, FadeBLTransition, FadeUpTransition, FadeDownTransition, TurnOffTilesTransition, FadeTransition, ZoomTransition, ] current_transition = 0 g = GrossiniLayer() g2 = GrossiniLayer2() c2 = ColorLayer(128,16,16,255) c1 = ColorLayer(0,255,255,255) control1 = ControlLayer() control2 = ControlLayer() controlScene1 = Scene( c2, g, control2 ) controlScene2 = Scene( c1, g2, control2 ) control_p = 0 control_list = [controlScene1, controlScene2] director.run( controlScene1 )
Alwnikrotikz/los-cocos
samples/demo_transitions.py
Python
bsd-3-clause
4,303
class PlasmaException(Exception): pass class IncompleteAtomicData(PlasmaException): def __init__(self, atomic_data_name): message = ('The current plasma calculation requires {0}, ' 'which is not provided by the given atomic data'.format( atomic_data_name)) super(PlasmaException, self).__init__(message) class PlasmaMissingModule(PlasmaException): pass class PlasmaIsolatedModule(PlasmaException): pass class NotInitializedModule(PlasmaException): pass class PlasmaIonizationError(PlasmaException): pass class PlasmaConfigContradiction(PlasmaException): pass
rajul/tardis
tardis/plasma/exceptions.py
Python
bsd-3-clause
640
#pragma once #include <memory> #include <arbor/context.hpp> #include "distributed_context.hpp" #include "threading/threading.hpp" #include "gpu_context.hpp" namespace arb { // execution_context is a simple container for the state relating to // execution resources. // Specifically, it has handles for the distributed context, gpu // context and thread pool. // // Note: the public API uses an opaque handle arb::context for // execution_context, to hide implementation details of the // container and its constituent contexts from the public API. struct execution_context { distributed_context_handle distributed; task_system_handle thread_pool; gpu_context_handle gpu; execution_context(const proc_allocation& resources = proc_allocation{}); // Use a template for constructing with a specific distributed context. // Specialised implementations are implemented in execution_context.cpp. template <typename Comm> execution_context(const proc_allocation& resources, Comm comm); }; } // namespace arb
halfflat/nestmc-proto
arbor/execution_context.hpp
C++
bsd-3-clause
1,041
<?php /** * This file is part of phpUnderControl. * * PHP Version 5.2.0 * * Copyright (c) 2007-2011, Manuel Pichler <mapi@phpundercontrol.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of Manuel Pichler nor the names of his * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @category QualityAssurance * @package Graph * @author Manuel Pichler <mapi@phpundercontrol.org> * @copyright 2007-2011 Manuel Pichler. All rights reserved. * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version SVN: $Id$ * @link http://www.phpundercontrol.org/ */ /** * Object factory for the different chart types. * * @category QualityAssurance * @package Graph * @author Manuel Pichler <mapi@phpundercontrol.org> * @copyright 2007-2011 Manuel Pichler. All rights reserved. * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version Release: @package_version@ * @link http://www.phpundercontrol.org/ */ class phpucChartFactory { /** * The number entries to display in a chart. * * @var integer */ private $numberOfEntries = 0; /** * Constructs a new chart factory instance. * * @param integer $numberOfEntries Optional argument which defines the * maximum number of entries that should be shown by a chart. */ public function __construct( $numberOfEntries = 0 ) { $this->numberOfEntries = $numberOfEntries; } /** * Creates a chart instance depending on the given <b>$input</b> settings. * * @param phpucAbstractInput $input The input data source. * * @return ezcGraphChart */ public function createChart( phpucAbstractInput $input ) { switch ( $input->type ) { case phpucChartI::TYPE_DOT: $chart = new phpucDotChart(); break; case phpucChartI::TYPE_LINE: $chart = new phpucLineChart(); break; case phpucChartI::TYPE_PIE: $chart = new phpucPieChart(); break; case phpucChartI::TYPE_TIME: $chart = new phpucTimeChart(); break; } $chart->setNumberOfEntries( $this->numberOfEntries ); $chart->setInput( $input ); return $chart; } }
phpundercontrol/phpUnderControl-UNMAINTAINED
src/Graph/ChartFactory.php
PHP
bsd-3-clause
3,807
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Presubmit script for mojo See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built into depot_tools. """ import os.path import re # NOTE: The EDK allows all external paths, so doesn't need a whitelist. _PACKAGE_WHITELISTED_EXTERNAL_PATHS = { "SDK": ["//build/module_args/mojo.gni", "//build/module_args/dart.gni", "//testing/gtest", "//third_party/cython", "//third_party/khronos"], "services": ["//build/module_args/mojo.gni", "//testing/gtest"], } # These files are not part of the exported package. _PACKAGE_IGNORED_BUILD_FILES = { "SDK": {}, "EDK": {}, "services": {"mojo/services/BUILD.gn"}, } _PACKAGE_PATH_PREFIXES = {"SDK": "mojo/public/", "EDK": "mojo/edk/", "services": "mojo/services"} # TODO(etiennej): python_binary_source_set added due to crbug.com/443147 _PACKAGE_SOURCE_SET_TYPES = {"SDK": ["mojo_sdk_source_set", "python_binary_source_set"], "EDK": ["mojo_edk_source_set"], "services": ["mojo_sdk_source_set"]} _ILLEGAL_EXTERNAL_PATH_WARNING_MESSAGE = \ "Found disallowed external paths within SDK buildfiles." _ILLEGAL_SERVICES_ABSOLUTE_PATH_WARNING_MESSAGE = \ "Found references to services' public buildfiles via absolute paths " \ "within services' public buildfiles." _ILLEGAL_EDK_ABSOLUTE_PATH_WARNING_MESSAGE = \ "Found references to the EDK via absolute paths within EDK buildfiles." _ILLEGAL_SDK_ABSOLUTE_PATH_WARNING_MESSAGE_TEMPLATE = \ "Found references to the SDK via absolute paths within %s buildfiles." _ILLEGAL_SDK_ABSOLUTE_PATH_WARNING_MESSAGES = { "SDK": _ILLEGAL_SDK_ABSOLUTE_PATH_WARNING_MESSAGE_TEMPLATE % "SDK", "EDK": _ILLEGAL_SDK_ABSOLUTE_PATH_WARNING_MESSAGE_TEMPLATE % "EDK", "services": _ILLEGAL_SDK_ABSOLUTE_PATH_WARNING_MESSAGE_TEMPLATE % "services' public", } _INCORRECT_SOURCE_SET_TYPE_WARNING_MESSAGE_TEMPLATE = \ "All source sets in %s must be constructed via %s." _INCORRECT_SOURCE_SET_TYPE_WARNING_MESSAGES = { "SDK": _INCORRECT_SOURCE_SET_TYPE_WARNING_MESSAGE_TEMPLATE % ("the SDK", _PACKAGE_SOURCE_SET_TYPES["SDK"]), "EDK": _INCORRECT_SOURCE_SET_TYPE_WARNING_MESSAGE_TEMPLATE % ("the EDK", _PACKAGE_SOURCE_SET_TYPES["EDK"]), "services": _INCORRECT_SOURCE_SET_TYPE_WARNING_MESSAGE_TEMPLATE % ("services' client libs", _PACKAGE_SOURCE_SET_TYPES["services"]), } def _IsBuildFileWithinPackage(f, package): """Returns whether |f| specifies a GN build file within |package|.""" assert package in _PACKAGE_PATH_PREFIXES package_path_prefix = _PACKAGE_PATH_PREFIXES[package] if not f.LocalPath().startswith(package_path_prefix): return False if (not f.LocalPath().endswith("/BUILD.gn") and not f.LocalPath().endswith(".gni")): return False if f.LocalPath() in _PACKAGE_IGNORED_BUILD_FILES[package]: return False return True def _AffectedBuildFilesWithinPackage(input_api, package): """Returns all the affected build files within |package|.""" return [f for f in input_api.AffectedFiles() if _IsBuildFileWithinPackage(f, package)] def _FindIllegalAbsolutePathsInBuildFiles(input_api, package): """Finds illegal absolute paths within the build files in |input_api.AffectedFiles()| that are within |package|. An illegal absolute path within the SDK or a service's SDK is one that is to the SDK itself or a non-whitelisted external path. An illegal absolute path within the EDK is one that is to the SDK or the EDK. Returns any such references in a list of (file_path, line_number, referenced_path) tuples.""" illegal_references = [] for f in _AffectedBuildFilesWithinPackage(input_api, package): for line_num, line in f.ChangedContents(): # Determine if this is a reference to an absolute path. m = re.search(r'"(//[^"]*)"', line) if not m: continue referenced_path = m.group(1) if not referenced_path.startswith("//mojo"): # In the EDK, all external absolute paths are allowed. if package == "EDK": continue # Determine if this is a whitelisted external path. if referenced_path in _PACKAGE_WHITELISTED_EXTERNAL_PATHS[package]: continue illegal_references.append((f.LocalPath(), line_num, referenced_path)) return illegal_references def _PathReferenceInBuildFileWarningItem(build_file, line_num, referenced_path): """Returns a string expressing a warning item that |referenced_path| is referenced at |line_num| in |build_file|.""" return "%s, line %d (%s)" % (build_file, line_num, referenced_path) def _IncorrectSourceSetTypeWarningItem(build_file, line_num): """Returns a string expressing that the error occurs at |line_num| in |build_file|.""" return "%s, line %d" % (build_file, line_num) def _CheckNoIllegalAbsolutePathsInBuildFiles(input_api, output_api, package): """Makes sure that the BUILD.gn files within |package| do not reference the SDK/EDK via absolute paths, and do not reference disallowed external dependencies.""" sdk_references = [] edk_references = [] external_deps_references = [] services_references = [] # Categorize any illegal references. illegal_references = _FindIllegalAbsolutePathsInBuildFiles(input_api, package) for build_file, line_num, referenced_path in illegal_references: reference_string = _PathReferenceInBuildFileWarningItem(build_file, line_num, referenced_path) if referenced_path.startswith("//mojo/public"): sdk_references.append(reference_string) elif package == "SDK": external_deps_references.append(reference_string) elif package == "services": if referenced_path.startswith("//mojo/services"): services_references.append(reference_string) else: external_deps_references.append(reference_string) elif referenced_path.startswith("//mojo/edk"): edk_references.append(reference_string) # Package up categorized illegal references into results. results = [] if sdk_references: results.extend([output_api.PresubmitError( _ILLEGAL_SDK_ABSOLUTE_PATH_WARNING_MESSAGES[package], items=sdk_references)]) if external_deps_references: assert package == "SDK" or package == "services" results.extend([output_api.PresubmitError( _ILLEGAL_EXTERNAL_PATH_WARNING_MESSAGE, items=external_deps_references)]) if services_references: assert package == "services" results.extend([output_api.PresubmitError( _ILLEGAL_SERVICES_ABSOLUTE_PATH_WARNING_MESSAGE, items=services_references)]) if edk_references: assert package == "EDK" results.extend([output_api.PresubmitError( _ILLEGAL_EDK_ABSOLUTE_PATH_WARNING_MESSAGE, items=edk_references)]) return results def _CheckSourceSetsAreOfCorrectType(input_api, output_api, package): """Makes sure that the BUILD.gn files always use the correct wrapper type for |package|, which can be one of ["SDK", "EDK"], to construct source_set targets.""" assert package in _PACKAGE_SOURCE_SET_TYPES required_source_set_type = _PACKAGE_SOURCE_SET_TYPES[package] problems = [] for f in _AffectedBuildFilesWithinPackage(input_api, package): for line_num, line in f.ChangedContents(): m = re.search(r"[a-z_]*source_set\(", line) if not m: continue source_set_type = m.group(0)[:-1] if source_set_type in required_source_set_type: continue problems.append(_IncorrectSourceSetTypeWarningItem(f.LocalPath(), line_num)) if not problems: return [] return [output_api.PresubmitError( _INCORRECT_SOURCE_SET_TYPE_WARNING_MESSAGES[package], items=problems)] def _CheckChangePylintsClean(input_api, output_api): # Additional python module paths (we're in src/mojo/); not everyone needs # them, but it's easiest to add them to everyone's path. # For ply and jinja2: third_party_path = os.path.join( input_api.PresubmitLocalPath(), "..", "third_party") # For the bindings generator: mojo_public_bindings_pylib_path = os.path.join( input_api.PresubmitLocalPath(), "public", "tools", "bindings", "pylib") # For the python bindings: mojo_python_bindings_path = os.path.join( input_api.PresubmitLocalPath(), "public", "python") # For the python bindings tests: mojo_python_bindings_tests_path = os.path.join( input_api.PresubmitLocalPath(), "python", "tests") # For the roll tools scripts: mojo_roll_tools_path = os.path.join( input_api.PresubmitLocalPath(), "tools", "roll") # For all mojo/tools scripts: mopy_path = os.path.join(input_api.PresubmitLocalPath(), "tools") # For all mojo/devtools scripts: devtools_path = os.path.join(input_api.PresubmitLocalPath(), "devtools") # TODO(vtl): Don't lint these files until the (many) problems are fixed # (possibly by deleting/rewriting some files). temporary_black_list = ( r".*\bpublic[\\\/]tools[\\\/]bindings[\\\/]pylib[\\\/]mojom[\\\/]" r"generate[\\\/].+\.py$", r".*\bpublic[\\\/]tools[\\\/]bindings[\\\/]generators[\\\/].+\.py$") black_list = input_api.DEFAULT_BLACK_LIST + temporary_black_list + ( # Imported from Android tools, we might want not to fix the warnings # raised for it to make it easier to compare the code with the original. r".*\bdevtools[\\\/]common[\\\/]android_stack_parser[\\\/].+\.py$",) results = [] pylint_extra_paths = [ third_party_path, mojo_public_bindings_pylib_path, mojo_python_bindings_path, mojo_python_bindings_tests_path, mojo_roll_tools_path, mopy_path, devtools_path ] results.extend(input_api.canned_checks.RunPylint( input_api, output_api, extra_paths_list=pylint_extra_paths, black_list=black_list)) return results def _BuildFileChecks(input_api, output_api): """Performs checks on SDK, EDK, and services' public buildfiles.""" results = [] for package in ["SDK", "EDK", "services"]: results.extend(_CheckNoIllegalAbsolutePathsInBuildFiles(input_api, output_api, package)) results.extend(_CheckSourceSetsAreOfCorrectType(input_api, output_api, package)) return results def _CommonChecks(input_api, output_api): """Checks common to both upload and commit.""" results = [] results.extend(_BuildFileChecks(input_api, output_api)) return results def CheckChangeOnUpload(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) results.extend(_CheckChangePylintsClean(input_api, output_api)) return results def CheckChangeOnCommit(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) return results
zhangxq5012/sky_engine
mojo/PRESUBMIT.py
Python
bsd-3-clause
11,467
/* * Copyright (c) 2015, University of Oslo * * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.hisp.dhis.android.sdk.utils; /** * @author Araz Abishov <araz.abishov.gsoc@gmail.com>. */ public final class StringUtils { private StringBuilder mBuilder; private StringUtils() { mBuilder = new StringBuilder(); } public static StringUtils create() { return new StringUtils(); } public <T> StringUtils append(T item) { mBuilder.append(item); return this; } public String build() { return mBuilder.toString(); } }
arthurgwatidzo/dhis2-android-sdk
app/src/main/java/org/hisp/dhis/android/sdk/utils/StringUtils.java
Java
bsd-3-clause
2,060
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package com.facebook.react.uimanager; import javax.annotation.Nullable; import javax.annotation.concurrent.GuardedBy; import java.util.ArrayList; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import com.facebook.react.animation.Animation; import com.facebook.react.animation.AnimationRegistry; import com.facebook.react.bridge.Callback; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.SoftAssertions; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener; import com.facebook.systrace.Systrace; import com.facebook.systrace.SystraceMessage; /** * This class acts as a buffer for command executed on {@link NativeViewHierarchyManager} or on * {@link AnimationRegistry}. It expose similar methods as mentioned classes but instead of * executing commands immediately it enqueues those operations in a queue that is then flushed from * {@link UIManagerModule} once JS batch of ui operations is finished. This is to make sure that we * execute all the JS operation coming from a single batch a single loop of the main (UI) android * looper. * * TODO(7135923): Pooling of operation objects * TODO(5694019): Consider a better data structure for operations queue to save on allocations */ public class UIViewOperationQueue { private final int[] mMeasureBuffer = new int[4]; /** * A mutation or animation operation on the view hierarchy. */ protected interface UIOperation { void execute(); } /** * A spec for an operation on the native View hierarchy. */ private abstract class ViewOperation implements UIOperation { public int mTag; public ViewOperation(int tag) { mTag = tag; } } private final class RemoveRootViewOperation extends ViewOperation { public RemoveRootViewOperation(int tag) { super(tag); } @Override public void execute() { mNativeViewHierarchyManager.removeRootView(mTag); } } private final class UpdatePropertiesOperation extends ViewOperation { private final CatalystStylesDiffMap mProps; private UpdatePropertiesOperation(int tag, CatalystStylesDiffMap props) { super(tag); mProps = props; } @Override public void execute() { mNativeViewHierarchyManager.updateProperties(mTag, mProps); } } /** * Operation for updating native view's position and size. The operation is not created directly * by a {@link UIManagerModule} call from JS. Instead it gets inflated using computed position * and size values by CSSNode hierarchy. */ private final class UpdateLayoutOperation extends ViewOperation { private final int mParentTag, mX, mY, mWidth, mHeight; public UpdateLayoutOperation( int parentTag, int tag, int x, int y, int width, int height) { super(tag); mParentTag = parentTag; mX = x; mY = y; mWidth = width; mHeight = height; } @Override public void execute() { mNativeViewHierarchyManager.updateLayout(mParentTag, mTag, mX, mY, mWidth, mHeight); } } private final class CreateViewOperation extends ViewOperation { private final ThemedReactContext mThemedContext; private final String mClassName; private final @Nullable CatalystStylesDiffMap mInitialProps; public CreateViewOperation( ThemedReactContext themedContext, int tag, String className, @Nullable CatalystStylesDiffMap initialProps) { super(tag); mThemedContext = themedContext; mClassName = className; mInitialProps = initialProps; } @Override public void execute() { mNativeViewHierarchyManager.createView( mThemedContext, mTag, mClassName, mInitialProps); } } private final class ManageChildrenOperation extends ViewOperation { private final @Nullable int[] mIndicesToRemove; private final @Nullable ViewAtIndex[] mViewsToAdd; private final @Nullable int[] mTagsToDelete; public ManageChildrenOperation( int tag, @Nullable int[] indicesToRemove, @Nullable ViewAtIndex[] viewsToAdd, @Nullable int[] tagsToDelete) { super(tag); mIndicesToRemove = indicesToRemove; mViewsToAdd = viewsToAdd; mTagsToDelete = tagsToDelete; } @Override public void execute() { mNativeViewHierarchyManager.manageChildren( mTag, mIndicesToRemove, mViewsToAdd, mTagsToDelete); } } private final class UpdateViewExtraData extends ViewOperation { private final Object mExtraData; public UpdateViewExtraData(int tag, Object extraData) { super(tag); mExtraData = extraData; } @Override public void execute() { mNativeViewHierarchyManager.updateViewExtraData(mTag, mExtraData); } } private final class ChangeJSResponderOperation extends ViewOperation { private final int mInitialTag; private final boolean mBlockNativeResponder; private final boolean mClearResponder; public ChangeJSResponderOperation( int tag, int initialTag, boolean clearResponder, boolean blockNativeResponder) { super(tag); mInitialTag = initialTag; mClearResponder = clearResponder; mBlockNativeResponder = blockNativeResponder; } @Override public void execute() { if (!mClearResponder) { mNativeViewHierarchyManager.setJSResponder(mTag, mInitialTag, mBlockNativeResponder); } else { mNativeViewHierarchyManager.clearJSResponder(); } } } private final class DispatchCommandOperation extends ViewOperation { private final int mCommand; private final @Nullable ReadableArray mArgs; public DispatchCommandOperation(int tag, int command, @Nullable ReadableArray args) { super(tag); mCommand = command; mArgs = args; } @Override public void execute() { mNativeViewHierarchyManager.dispatchCommand(mTag, mCommand, mArgs); } } private final class ShowPopupMenuOperation extends ViewOperation { private final ReadableArray mItems; private final Callback mSuccess; public ShowPopupMenuOperation( int tag, ReadableArray items, Callback success) { super(tag); mItems = items; mSuccess = success; } @Override public void execute() { mNativeViewHierarchyManager.showPopupMenu(mTag, mItems, mSuccess); } } /** * A spec for animation operations (add/remove) */ private static abstract class AnimationOperation implements UIViewOperationQueue.UIOperation { protected final int mAnimationID; public AnimationOperation(int animationID) { mAnimationID = animationID; } } private class RegisterAnimationOperation extends AnimationOperation { private final Animation mAnimation; private RegisterAnimationOperation(Animation animation) { super(animation.getAnimationID()); mAnimation = animation; } @Override public void execute() { mAnimationRegistry.registerAnimation(mAnimation); } } private class AddAnimationOperation extends AnimationOperation { private final int mReactTag; private final Callback mSuccessCallback; private AddAnimationOperation(int reactTag, int animationID, Callback successCallback) { super(animationID); mReactTag = reactTag; mSuccessCallback = successCallback; } @Override public void execute() { Animation animation = mAnimationRegistry.getAnimation(mAnimationID); if (animation != null) { mNativeViewHierarchyManager.startAnimationForNativeView( mReactTag, animation, mSuccessCallback); } else { // node or animation not found // TODO(5712813): cleanup callback in JS callbacks table in case of an error throw new IllegalViewOperationException("Animation with id " + mAnimationID + " was not found"); } } } private final class RemoveAnimationOperation extends AnimationOperation { private RemoveAnimationOperation(int animationID) { super(animationID); } @Override public void execute() { Animation animation = mAnimationRegistry.getAnimation(mAnimationID); if (animation != null) { animation.cancel(); } } } private class SetLayoutAnimationEnabledOperation implements UIOperation { private final boolean mEnabled; private SetLayoutAnimationEnabledOperation(final boolean enabled) { mEnabled = enabled; } @Override public void execute() { mNativeViewHierarchyManager.setLayoutAnimationEnabled(mEnabled); } } private class ConfigureLayoutAnimationOperation implements UIOperation { private final ReadableMap mConfig; private ConfigureLayoutAnimationOperation(final ReadableMap config) { mConfig = config; } @Override public void execute() { mNativeViewHierarchyManager.configureLayoutAnimation(mConfig); } } private final class MeasureOperation implements UIOperation { private final int mReactTag; private final Callback mCallback; private MeasureOperation( final int reactTag, final Callback callback) { super(); mReactTag = reactTag; mCallback = callback; } @Override public void execute() { try { mNativeViewHierarchyManager.measure(mReactTag, mMeasureBuffer); } catch (NoSuchNativeViewException e) { // Invoke with no args to signal failure and to allow JS to clean up the callback // handle. mCallback.invoke(); return; } float x = PixelUtil.toDIPFromPixel(mMeasureBuffer[0]); float y = PixelUtil.toDIPFromPixel(mMeasureBuffer[1]); float width = PixelUtil.toDIPFromPixel(mMeasureBuffer[2]); float height = PixelUtil.toDIPFromPixel(mMeasureBuffer[3]); mCallback.invoke(0, 0, width, height, x, y); } } private ArrayList<UIOperation> mOperations = new ArrayList<>(); private final class FindTargetForTouchOperation implements UIOperation { private final int mReactTag; private final float mTargetX; private final float mTargetY; private final Callback mCallback; private FindTargetForTouchOperation( final int reactTag, final float targetX, final float targetY, final Callback callback) { super(); mReactTag = reactTag; mTargetX = targetX; mTargetY = targetY; mCallback = callback; } @Override public void execute() { try { mNativeViewHierarchyManager.measure( mReactTag, mMeasureBuffer); } catch (IllegalViewOperationException e) { mCallback.invoke(); return; } // Because React coordinates are relative to root container, and measure() operates // on screen coordinates, we need to offset values using root container location. final float containerX = (float) mMeasureBuffer[0]; final float containerY = (float) mMeasureBuffer[1]; final int touchTargetReactTag = mNativeViewHierarchyManager.findTargetTagForTouch( mReactTag, mTargetX, mTargetY); try { mNativeViewHierarchyManager.measure( touchTargetReactTag, mMeasureBuffer); } catch (IllegalViewOperationException e) { mCallback.invoke(); return; } float x = PixelUtil.toDIPFromPixel(mMeasureBuffer[0] - containerX); float y = PixelUtil.toDIPFromPixel(mMeasureBuffer[1] - containerY); float width = PixelUtil.toDIPFromPixel(mMeasureBuffer[2]); float height = PixelUtil.toDIPFromPixel(mMeasureBuffer[3]); mCallback.invoke(touchTargetReactTag, x, y, width, height); } } private final class SendAccessibilityEvent extends ViewOperation { private final int mEventType; private SendAccessibilityEvent(int tag, int eventType) { super(tag); mEventType = eventType; } @Override public void execute() { mNativeViewHierarchyManager.sendAccessibilityEvent(mTag, mEventType); } } private final NativeViewHierarchyManager mNativeViewHierarchyManager; private final AnimationRegistry mAnimationRegistry; private final Object mDispatchRunnablesLock = new Object(); private final DispatchUIFrameCallback mDispatchUIFrameCallback; private final ReactApplicationContext mReactApplicationContext; @GuardedBy("mDispatchRunnablesLock") private final ArrayList<Runnable> mDispatchUIRunnables = new ArrayList<>(); private @Nullable NotThreadSafeViewHierarchyUpdateDebugListener mViewHierarchyUpdateDebugListener; public UIViewOperationQueue( ReactApplicationContext reactContext, NativeViewHierarchyManager nativeViewHierarchyManager) { mNativeViewHierarchyManager = nativeViewHierarchyManager; mAnimationRegistry = nativeViewHierarchyManager.getAnimationRegistry(); mDispatchUIFrameCallback = new DispatchUIFrameCallback(reactContext); mReactApplicationContext = reactContext; } public void setViewHierarchyUpdateDebugListener( @Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) { mViewHierarchyUpdateDebugListener = listener; } public boolean isEmpty() { return mOperations.isEmpty(); } public void addRootView( final int tag, final SizeMonitoringFrameLayout rootView, final ThemedReactContext themedRootContext) { if (UiThreadUtil.isOnUiThread()) { mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext); } else { final Semaphore semaphore = new Semaphore(0); mReactApplicationContext.runOnUiQueueThread( new Runnable() { @Override public void run() { mNativeViewHierarchyManager.addRootView(tag, rootView, themedRootContext); semaphore.release(); } }); try { SoftAssertions.assertCondition( semaphore.tryAcquire(5000, TimeUnit.MILLISECONDS), "Timed out adding root view"); } catch (InterruptedException e) { throw new RuntimeException(e); } } } /** * Enqueues a UIOperation to be executed in UI thread. This method should only be used by a * subclass to support UIOperations not provided by UIViewOperationQueue. */ protected void enqueueUIOperation(UIOperation operation) { mOperations.add(operation); } public void enqueueRemoveRootView(int rootViewTag) { mOperations.add(new RemoveRootViewOperation(rootViewTag)); } public void enqueueSetJSResponder( int tag, int initialTag, boolean blockNativeResponder) { mOperations.add( new ChangeJSResponderOperation( tag, initialTag, false /*clearResponder*/, blockNativeResponder)); } public void enqueueClearJSResponder() { // Tag is 0 because JSResponderHandler doesn't need one in order to clear the responder. mOperations.add(new ChangeJSResponderOperation(0, 0, true /*clearResponder*/, false)); } public void enqueueDispatchCommand( int reactTag, int commandId, ReadableArray commandArgs) { mOperations.add(new DispatchCommandOperation(reactTag, commandId, commandArgs)); } public void enqueueUpdateExtraData(int reactTag, Object extraData) { mOperations.add(new UpdateViewExtraData(reactTag, extraData)); } public void enqueueShowPopupMenu( int reactTag, ReadableArray items, Callback error, Callback success) { mOperations.add(new ShowPopupMenuOperation(reactTag, items, success)); } public void enqueueCreateView( ThemedReactContext themedContext, int viewReactTag, String viewClassName, @Nullable CatalystStylesDiffMap initialProps) { mOperations.add( new CreateViewOperation( themedContext, viewReactTag, viewClassName, initialProps)); } public void enqueueUpdateProperties(int reactTag, String className, CatalystStylesDiffMap props) { mOperations.add(new UpdatePropertiesOperation(reactTag, props)); } public void enqueueUpdateLayout( int parentTag, int reactTag, int x, int y, int width, int height) { mOperations.add( new UpdateLayoutOperation(parentTag, reactTag, x, y, width, height)); } public void enqueueManageChildren( int reactTag, @Nullable int[] indicesToRemove, @Nullable ViewAtIndex[] viewsToAdd, @Nullable int[] tagsToDelete) { mOperations.add( new ManageChildrenOperation(reactTag, indicesToRemove, viewsToAdd, tagsToDelete)); } public void enqueueRegisterAnimation(Animation animation) { mOperations.add(new RegisterAnimationOperation(animation)); } public void enqueueAddAnimation( final int reactTag, final int animationID, final Callback onSuccess) { mOperations.add(new AddAnimationOperation(reactTag, animationID, onSuccess)); } public void enqueueRemoveAnimation(int animationID) { mOperations.add(new RemoveAnimationOperation(animationID)); } public void enqueueSetLayoutAnimationEnabled( final boolean enabled) { mOperations.add(new SetLayoutAnimationEnabledOperation(enabled)); } public void enqueueConfigureLayoutAnimation( final ReadableMap config, final Callback onSuccess, final Callback onError) { mOperations.add(new ConfigureLayoutAnimationOperation(config)); } public void enqueueMeasure( final int reactTag, final Callback callback) { mOperations.add( new MeasureOperation(reactTag, callback)); } public void enqueueFindTargetForTouch( final int reactTag, final float targetX, final float targetY, final Callback callback) { mOperations.add( new FindTargetForTouchOperation(reactTag, targetX, targetY, callback)); } public void enqueueSendAccessibilityEvent(int tag, int eventType) { mOperations.add(new SendAccessibilityEvent(tag, eventType)); } /* package */ void dispatchViewUpdates(final int batchId) { // Store the current operation queues to dispatch and create new empty ones to continue // receiving new operations final ArrayList<UIOperation> operations = mOperations.isEmpty() ? null : mOperations; if (operations != null) { mOperations = new ArrayList<>(); } if (mViewHierarchyUpdateDebugListener != null) { mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateEnqueued(); } synchronized (mDispatchRunnablesLock) { mDispatchUIRunnables.add( new Runnable() { @Override public void run() { SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "DispatchUI") .arg("BatchId", batchId) .flush(); try { if (operations != null) { for (int i = 0; i < operations.size(); i++) { operations.get(i).execute(); } } if (mViewHierarchyUpdateDebugListener != null) { mViewHierarchyUpdateDebugListener.onViewHierarchyUpdateFinished(); } } finally { Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } } }); } } /* package */ void resumeFrameCallback() { ReactChoreographer.getInstance() .postFrameCallback(ReactChoreographer.CallbackType.DISPATCH_UI, mDispatchUIFrameCallback); } /* package */ void pauseFrameCallback() { ReactChoreographer.getInstance() .removeFrameCallback(ReactChoreographer.CallbackType.DISPATCH_UI, mDispatchUIFrameCallback); } /** * Choreographer FrameCallback responsible for actually dispatching view updates on the UI thread * that were enqueued via {@link #dispatchViewUpdates(int)}. The reason we don't just enqueue * directly to the UI thread from that method is to make sure our Runnables actually run before * the next traversals happen: * * ViewRootImpl#scheduleTraversals (which is called from invalidate, requestLayout, etc) calls * Looper#postSyncBarrier which keeps any UI thread looper messages from being processed until * that barrier is removed during the next traversal. That means, depending on when we get updates * from JS and what else is happening on the UI thread, we can sometimes try to post this runnable * after ViewRootImpl has posted a barrier. * * Using a Choreographer callback (which runs immediately before traversals), we guarantee we run * before the next traversal. */ private class DispatchUIFrameCallback extends GuardedChoreographerFrameCallback { private DispatchUIFrameCallback(ReactContext reactContext) { super(reactContext); } @Override public void doFrameGuarded(long frameTimeNanos) { synchronized (mDispatchRunnablesLock) { for (int i = 0; i < mDispatchUIRunnables.size(); i++) { mDispatchUIRunnables.get(i).run(); } mDispatchUIRunnables.clear(); // Clear layout animation, as animation only apply to current UI operations batch. mNativeViewHierarchyManager.clearLayoutAnimation(); } ReactChoreographer.getInstance().postFrameCallback( ReactChoreographer.CallbackType.DISPATCH_UI, this); } } }
mihaigiurgeanu/react-native
ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java
Java
bsd-3-clause
22,305
<?php /* This program is free software; you can redistribute it and/or modify it under the terms of the Revised BSD License. This program 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 Revised BSD License for more details. Copyright 2011-2012 Cool Dude 2k - http://idb.berlios.de/ Copyright 2011-2012 Game Maker 2k - http://intdb.sourceforge.net/ Copyright 2011-2012 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski $FileInfo: ean8.php - Last Update: 02/13/2012 Ver. 2.2.5 RC 1 - Author: cooldude2k $ */ $File3Name = basename($_SERVER['SCRIPT_NAME']); if ($File3Name=="ean8.php"||$File3Name=="/ean8.php") { chdir("../"); require("./upc.php"); exit(); } if(!isset($upcfunctions)) { $upcfunctions = array(); } if(!is_array($upcfunctions)) { $upcfunctions = array(); } array_push($upcfunctions, "create_ean8"); function create_ean8($upc,$imgtype="png",$outputimage=true,$resize=1,$resizetype="resize",$outfile=NULL,$hidecd=false) { if(!isset($upc)) { return false; } $upc_pieces = null; $supplement = null; if(preg_match("/([0-9]+)([ |\|]{1})([0-9]{2})$/", $upc, $upc_pieces)) { $upc = $upc_pieces[1]; $supplement = $upc_pieces[3]; } if(preg_match("/([0-9]+)([ |\|]){1}([0-9]{5})$/", $upc, $upc_pieces)) { $upc = $upc_pieces[1]; $supplement = $upc_pieces[3]; } if(!isset($upc)||!is_numeric($upc)) { return false; } if(strlen($upc)==7) { $upc = $upc.validate_ean8($upc,true); } if(strlen($upc)>8||strlen($upc)<8) { return false; } if(!isset($resize)||!preg_match("/^([0-9]*[\.]?[0-9])/", $resize)||$resize<1) { $resize = 1; } if($resizetype!="resample"&&$resizetype!="resize") { $resizetype = "resize"; } if(validate_ean8($upc)===false) { preg_match("/^(\d{7})/", $upc, $pre_matches); $upc = $pre_matches[1].validate_ean8($pre_matches[1],true); } if($imgtype!="png"&&$imgtype!="gif"&&$imgtype!="xbm"&&$imgtype!="wbmp") { $imgtype = "png"; } preg_match("/(\d{4})(\d{4})/", $upc, $upc_matches); if(count($upc_matches)<=0) { return false; } $LeftDigit = str_split($upc_matches[1]); preg_match("/(\d{2})(\d{2})/", $upc_matches[1], $upc_matches_new); $LeftLeftDigit = $upc_matches_new[1]; $LeftRightDigit = $upc_matches_new[2]; $RightDigit = str_split($upc_matches[2]); preg_match("/(\d{2})(\d{2})/", $upc_matches[2], $upc_matches_new); $RightLeftDigit = $upc_matches_new[1]; $RightRightDigit = $upc_matches_new[2]; if($imgtype=="png") { if($outputimage==true) { header("Content-Type: image/png"); } } if($imgtype=="gif") { if($outputimage==true) { header("Content-Type: image/gif"); } } if($imgtype=="xbm") { if($outputimage==true) { header("Content-Type: image/x-xbitmap"); } } if($imgtype=="wbmp") { if($outputimage==true) { header("Content-Type: image/vnd.wap.wbmp"); } } $addonsize = 0; if(strlen($supplement)==2) { $addonsize = 29; } if(strlen($supplement)==5) { $addonsize = 56; } $upc_img = imagecreatetruecolor(83 + $addonsize, 62); imagefilledrectangle($upc_img, 0, 0, 83 + $addonsize, 62, 0xFFFFFF); imageinterlace($upc_img, true); $background_color = imagecolorallocate($upc_img, 255, 255, 255); $text_color = imagecolorallocate($upc_img, 0, 0, 0); $alt_text_color = imagecolorallocate($upc_img, 255, 255, 255); imagestring($upc_img, 2, 12, 47, $LeftLeftDigit, $text_color); imagestring($upc_img, 2, 25, 47, $LeftRightDigit, $text_color); imagestring($upc_img, 2, 45, 47, $RightLeftDigit, $text_color); imagestring($upc_img, 2, 58, 47, $RightRightDigit, $text_color); imageline($upc_img, 0, 10, 0, 47, $alt_text_color); imageline($upc_img, 1, 10, 1, 47, $alt_text_color); imageline($upc_img, 2, 10, 2, 47, $alt_text_color); imageline($upc_img, 3, 10, 3, 47, $alt_text_color); imageline($upc_img, 4, 10, 4, 47, $alt_text_color); imageline($upc_img, 5, 10, 5, 47, $alt_text_color); imageline($upc_img, 6, 10, 6, 47, $alt_text_color); imageline($upc_img, 7, 10, 7, 53, $text_color); imageline($upc_img, 8, 10, 8, 53, $alt_text_color); imageline($upc_img, 9, 10, 9, 53, $text_color); $NumZero = 0; $LineStart = 10; while ($NumZero < count($LeftDigit)) { $LineSize = 47; $left_text_color_l = array(0, 0, 0, 0, 0, 0, 0); $left_text_color_g = array(1, 1, 1, 1, 1, 1, 1); if($LeftDigit[$NumZero]==0) { $left_text_color_l = array(0, 0, 0, 1, 1, 0, 1); $left_text_color_g = array(0, 1, 0, 0, 1, 1, 1); } if($LeftDigit[$NumZero]==1) { $left_text_color_l = array(0, 0, 1, 1, 0, 0, 1); $left_text_color_g = array(0, 1, 1, 0, 0, 1, 1); } if($LeftDigit[$NumZero]==2) { $left_text_color_l = array(0, 0, 1, 0, 0, 1, 1); $left_text_color_g = array(0, 0, 1, 1, 0, 1, 1); } if($LeftDigit[$NumZero]==3) { $left_text_color_l = array(0, 1, 1, 1, 1, 0, 1); $left_text_color_g = array(0, 1, 0, 0, 0, 0, 1); } if($LeftDigit[$NumZero]==4) { $left_text_color_l = array(0, 1, 0, 0, 0, 1, 1); $left_text_color_g = array(0, 0, 1, 1, 1, 0, 1); } if($LeftDigit[$NumZero]==5) { $left_text_color_l = array(0, 1, 1, 0, 0, 0, 1); $left_text_color_g = array(0, 1, 1, 1, 0, 0, 1); } if($LeftDigit[$NumZero]==6) { $left_text_color_l = array(0, 1, 0, 1, 1, 1, 1); $left_text_color_g = array(0, 0, 0, 0, 1, 0, 1); } if($LeftDigit[$NumZero]==7) { $left_text_color_l = array(0, 1, 1, 1, 0, 1, 1); $left_text_color_g = array(0, 0, 1, 0, 0, 0, 1); } if($LeftDigit[$NumZero]==8) { $left_text_color_l = array(0, 1, 1, 0, 1, 1, 1); $left_text_color_g = array(0, 0, 0, 1, 0, 0, 1); } if($LeftDigit[$NumZero]==9) { $left_text_color_l = array(0, 0, 0, 1, 0, 1, 1); $left_text_color_g = array(0, 0, 1, 0, 1, 1, 1); } $left_text_color = $left_text_color_l; if($upc_matches[1]==1) { if($NumZero==2) { $left_text_color = $left_text_color_g; } if($NumZero==4) { $left_text_color = $left_text_color_g; } if($NumZero==5) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==2) { if($NumZero==2) { $left_text_color = $left_text_color_g; } if($NumZero==3) { $left_text_color = $left_text_color_g; } if($NumZero==5) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==3) { if($NumZero==2) { $left_text_color = $left_text_color_g; } if($NumZero==3) { $left_text_color = $left_text_color_g; } if($NumZero==4) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==4) { if($NumZero==1) { $left_text_color = $left_text_color_g; } if($NumZero==4) { $left_text_color = $left_text_color_g; } if($NumZero==5) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==5) { if($NumZero==1) { $left_text_color = $left_text_color_g; } if($NumZero==2) { $left_text_color = $left_text_color_g; } if($NumZero==5) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==6) { if($NumZero==1) { $left_text_color = $left_text_color_g; } if($NumZero==2) { $left_text_color = $left_text_color_g; } if($NumZero==3) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==7) { if($NumZero==1) { $left_text_color = $left_text_color_g; } if($NumZero==3) { $left_text_color = $left_text_color_g; } if($NumZero==5) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==8) { if($NumZero==1) { $left_text_color = $left_text_color_g; } if($NumZero==3) { $left_text_color = $left_text_color_g; } if($NumZero==4) { $left_text_color = $left_text_color_g; } } if($upc_matches[1]==9) { if($NumZero==1) { $left_text_color = $left_text_color_g; } if($NumZero==2) { $left_text_color = $left_text_color_g; } if($NumZero==4) { $left_text_color = $left_text_color_g; } } $InnerUPCNum = 0; while ($InnerUPCNum < count($left_text_color)) { if($left_text_color[$InnerUPCNum]==1) { imageline($upc_img, $LineStart, 10, $LineStart, $LineSize, $text_color); } if($left_text_color[$InnerUPCNum]==0) { imageline($upc_img, $LineStart, 10, $LineStart, $LineSize, $alt_text_color); } $LineStart += 1; ++$InnerUPCNum; } ++$NumZero; } imageline($upc_img, 38, 10, 38, 53, $alt_text_color); imageline($upc_img, 39, 10, 39, 53, $text_color); imageline($upc_img, 40, 10, 40, 53, $alt_text_color); imageline($upc_img, 41, 10, 41, 53, $text_color); imageline($upc_img, 42, 10, 42, 53, $alt_text_color); $NumZero = 0; $LineStart = 43; while ($NumZero < count($RightDigit)) { $LineSize = 47; $right_text_color = array(0, 0, 0, 0, 0, 0, 0); if($RightDigit[$NumZero]==0) { $right_text_color = array(1, 1, 1, 0, 0, 1, 0); } if($RightDigit[$NumZero]==1) { $right_text_color = array(1, 1, 0, 0, 1, 1, 0); } if($RightDigit[$NumZero]==2) { $right_text_color = array(1, 1, 0, 1, 1, 0, 0); } if($RightDigit[$NumZero]==3) { $right_text_color = array(1, 0, 0, 0, 0, 1, 0); } if($RightDigit[$NumZero]==4) { $right_text_color = array(1, 0, 1, 1, 1, 0, 0); } if($RightDigit[$NumZero]==5) { $right_text_color = array(1, 0, 0, 1, 1, 1, 0); } if($RightDigit[$NumZero]==6) { $right_text_color = array(1, 0, 1, 0, 0, 0, 0); } if($RightDigit[$NumZero]==7) { $right_text_color = array(1, 0, 0, 0, 1, 0, 0); } if($RightDigit[$NumZero]==8) { $right_text_color = array(1, 0, 0, 1, 0, 0, 0); } if($RightDigit[$NumZero]==9) { $right_text_color = array(1, 1, 1, 0, 1, 0, 0); } $InnerUPCNum = 0; while ($InnerUPCNum < count($right_text_color)) { if($right_text_color[$InnerUPCNum]==1) { imageline($upc_img, $LineStart, 10, $LineStart, $LineSize, $text_color); } if($right_text_color[$InnerUPCNum]==0) { imageline($upc_img, $LineStart, 10, $LineStart, $LineSize, $alt_text_color); } $LineStart += 1; ++$InnerUPCNum; } ++$NumZero; } imageline($upc_img, 71, 10, 71, 53, $text_color); imageline($upc_img, 72, 10, 72, 53, $alt_text_color); imageline($upc_img, 73, 10, 73, 53, $text_color); imageline($upc_img, 74, 10, 74, 47, $alt_text_color); imageline($upc_img, 75, 10, 75, 47, $alt_text_color); imageline($upc_img, 76, 10, 76, 47, $alt_text_color); imageline($upc_img, 77, 10, 77, 47, $alt_text_color); imageline($upc_img, 78, 10, 78, 47, $alt_text_color); imageline($upc_img, 79, 10, 79, 47, $alt_text_color); imageline($upc_img, 80, 10, 80, 47, $alt_text_color); imageline($upc_img, 81, 10, 81, 47, $alt_text_color); imageline($upc_img, 82, 10, 82, 47, $alt_text_color); if(strlen($supplement)==2) { create_ean2($supplement,83,$upc_img); } if(strlen($supplement)==5) { create_ean5($supplement,83,$upc_img); } if($resize>1) { $new_upc_img = imagecreatetruecolor((83 + $addonsize) * $resize, 62 * $resize); imagefilledrectangle($new_upc_img, 0, 0, 83 + $addonsize, 62, 0xFFFFFF); imageinterlace($new_upc_img, true); if($resizetype=="resize") { imagecopyresized($new_upc_img, $upc_img, 0, 0, 0, 0, (83 + $addonsize) * $resize, 62 * $resize, 83 + $addonsize, 62); } if($resizetype=="resample") { imagecopyresampled($new_upc_img, $upc_img, 0, 0, 0, 0, (83 + $addonsize) * $resize, 62 * $resize, 83 + $addonsize, 62); } imagedestroy($upc_img); $upc_img = $new_upc_img; } if($imgtype=="png") { if($outputimage==true) { imagepng($upc_img); } if($outfile!=null) { imagepng($upc_img,$outfile); } } if($imgtype=="gif") { if($outputimage==true) { imagegif($upc_img); } if($outfile!=null) { imagegif($upc_img,$outfile); } } if($imgtype=="xbm") { if($outputimage==true) { imagexbm($upc_img,NULL); } if($outfile!=null) { imagexbm($upc_img,$outfile); } } if($imgtype=="wbmp") { if($outputimage==true) { imagewbmp($upc_img); } if($outfile!=null) { imagewbmp($upc_img,$outfile); } } imagedestroy($upc_img); return true; } ?>
GameMaker2k/UPC-Database
inc/ean8.php
PHP
bsd-3-clause
11,580