code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
<?xml version="1.0" encoding="utf-8"?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"><ShortName>National Water Supply and Drainage Board</ShortName><Description>National Water Supply and Drainage Board</Description><InputEncoding>UTF-8</InputEncoding><Image type="image/vnd.microsoft.icon" width="16" height="16">http://waterboard.lk/web/templates/poora_temp/favicon.ico</Image><Url type="application/opensearchdescription+xml" rel="self" template="http://waterboard.lk/web/index.php?option=com_search&amp;view=article&amp;id=160:contact-us-of-laboratory&amp;catid=27:laboratory&amp;Itemid=172&amp;lang=en&amp;format=opensearch"/><Url type="text/html" template="http://waterboard.lk/web/index.php?option=com_search&amp;searchword={searchTerms}&amp;Itemid=188"/></OpenSearchDescription>
cmaere/lwb
templates/protostar/index2082.php
PHP
apache-2.0
808
/* define(['angular','angularMocks', 'app/app'], function (angular, mocks) { describe('MainCtrl', function () { var $scope, ctrl; beforeEach(module('myApp')) beforeEach(inject(function ($controller, $rootScope) { $scope = $rootScope.$new(); ctrl = $controller('MainCtrl', { '$scope': $scope }); })) it('should set message', function () { expect($scope.message).toBeDefined(); }) }) }) */
jeremydmiller/Postgres.Projections
test/MainCtrlSpec.js
JavaScript
apache-2.0
456
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.outposts.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.outposts.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import static com.fasterxml.jackson.core.JsonToken.*; /** * CancelOrderResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CancelOrderResultJsonUnmarshaller implements Unmarshaller<CancelOrderResult, JsonUnmarshallerContext> { public CancelOrderResult unmarshall(JsonUnmarshallerContext context) throws Exception { CancelOrderResult cancelOrderResult = new CancelOrderResult(); return cancelOrderResult; } private static CancelOrderResultJsonUnmarshaller instance; public static CancelOrderResultJsonUnmarshaller getInstance() { if (instance == null) instance = new CancelOrderResultJsonUnmarshaller(); return instance; } }
aws/aws-sdk-java
aws-java-sdk-outposts/src/main/java/com/amazonaws/services/outposts/model/transform/CancelOrderResultJsonUnmarshaller.java
Java
apache-2.0
1,581
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.securityhub.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.securityhub.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * Standard JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class StandardJsonUnmarshaller implements Unmarshaller<Standard, JsonUnmarshallerContext> { public Standard unmarshall(JsonUnmarshallerContext context) throws Exception { Standard standard = new Standard(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("StandardsArn", targetDepth)) { context.nextToken(); standard.setStandardsArn(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Name", targetDepth)) { context.nextToken(); standard.setName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Description", targetDepth)) { context.nextToken(); standard.setDescription(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("EnabledByDefault", targetDepth)) { context.nextToken(); standard.setEnabledByDefault(context.getUnmarshaller(Boolean.class).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return standard; } private static StandardJsonUnmarshaller instance; public static StandardJsonUnmarshaller getInstance() { if (instance == null) instance = new StandardJsonUnmarshaller(); return instance; } }
aws/aws-sdk-java
aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/transform/StandardJsonUnmarshaller.java
Java
apache-2.0
3,376
/** * Copyright 2011 Microsoft Corporation * * 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. */ var assert = require('assert'); var sinon = require('sinon'); // Test includes var testutil = require('../util/util'); // Lib includes var NamedPipeInputChannel = testutil.libRequire('serviceruntime/namedpipeinputchannel'); var RuntimeVersionProtocolClient = testutil.libRequire('serviceruntime/runtimeversionprotocolclient'); var RuntimeVersionManager = testutil.libRequire('serviceruntime/runtimeversionmanager'); suite('runtimeversionmanager-tests', function () { test('getRuntimeClient', function (done) { var versionsEndpointPath = 'versionsEndpointPath'; var inputChannel = new NamedPipeInputChannel(); var stub = sinon.stub(inputChannel, '_readData'); stub.withArgs(versionsEndpointPath).callsArgWith(1, undefined, "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<RuntimeServerDiscovery xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + "<RuntimeServerEndpoints>" + "<RuntimeServerEndpoint version=\"2011-03-08\" path=\"SomePath.GoalState\" />" + "</RuntimeServerEndpoints>" + "</RuntimeServerDiscovery>" ); var runtimeVersionProtocolClient = new RuntimeVersionProtocolClient(inputChannel); var runtimeKernel = { getGoalStateClient: function () { return {}; }, getCurrentStateClient: function () { return {}; } }; var runtimeVersionManager = new RuntimeVersionManager(runtimeVersionProtocolClient, runtimeKernel); runtimeVersionManager.getRuntimeClient(versionsEndpointPath, function (error, runtimeClient) { assert.equal(error, undefined); assert.notEqual(runtimeClient, null); done(); }); }); });
egamma/azure-sdk-for-node
test/serviceruntime/runtimeversionmanager-tests.js
JavaScript
apache-2.0
2,285
/** * $RCSfile: ,v $ * $Revision: $ * $Date: $ * * Copyright (C) 2004-2011 Jive Software. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jivesoftware.fastpath.workspace.panes; import org.jivesoftware.resource.Default; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.LayoutManager; import java.awt.geom.AffineTransform; import javax.swing.ImageIcon; import javax.swing.JPanel; /** * An implementation of a colored background panel. Allows implementations * to specify an image to use in the background of the panel. */ public class BackgroundPane extends JPanel { private static final long serialVersionUID = 1L; private ImageIcon backgroundImage; /** * Creates a background panel using the default Spark background image. */ public BackgroundPane() { backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE); } /** * Creates a new background panel based on the icon specified. * * @param icon the icon to use in the background. */ public BackgroundPane(ImageIcon icon) { this.backgroundImage = icon; } /** * Creates a new background panel with the specified layout. * * @param layout the type of layout to use with this panel. Note: The icon * used will be the default Spark background image. */ public BackgroundPane(LayoutManager layout) { super(layout); backgroundImage = new ImageIcon(getClass().getResource("/images/gray-background.png")); } /** * Specifies the new image to use as the background image in this panel. * * @param image the new image to use. */ public void setBackgroundImage(ImageIcon image) { this.backgroundImage = image; } public void paintComponent(Graphics g) { Image backgroundImage = this.backgroundImage.getImage(); double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleY = getHeight() / (double)backgroundImage.getHeight(null); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); ((Graphics2D)g).drawImage(backgroundImage, xform, this); } }
joshuairl/toothchat-client
src/plugins/fastpath/src/java/org/jivesoftware/fastpath/workspace/panes/BackgroundPane.java
Java
apache-2.0
2,778
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 * http://www.apache.org/licenses/LICENSE-2.0 */ package net.sf.mmm.service.base; import java.io.Serializable; import java.util.Collection; import net.sf.mmm.service.api.CsrfToken; /** * This is the transfer-object for the generic response to a remote invocation. * * @see net.sf.mmm.service.base.rpc.GenericRemoteInvocationRpcService#callServices(net.sf.mmm.service.base.rpc.GenericRemoteInvocationRpcRequest) * @see net.sf.mmm.service.base.command.GenericRemoteInvocationCommandService#callCommands(net.sf.mmm.service.base.command.GenericRemoteInvocationCommandRequest) * * @author Joerg Hohwiller (hohwille at users.sourceforge.net) * @since 1.0.0 */ public class GenericRemoteInvocationResponse implements Serializable { /** UID for serialization. */ private static final long serialVersionUID = -3659003282415103857L; /** @see #getTransactionalResults() */ private GenericRemoteInvocationTransactionalResults[] transactionalResults; /** @see #getRequestId() */ private int requestId; /** @see #getXsrfToken() */ private CsrfToken xsrfToken; /** * The constructor. */ protected GenericRemoteInvocationResponse() { super(); } /** * The constructor. * * @param requestId - see {@link #getRequestId()}. * @param xsrfToken - see {@link #getXsrfToken()}. * @param transactionalResults - see {@link #getTransactionalResults()}. */ public GenericRemoteInvocationResponse(int requestId, CsrfToken xsrfToken, GenericRemoteInvocationTransactionalResults[] transactionalResults) { super(); this.requestId = requestId; this.xsrfToken = xsrfToken; this.transactionalResults = transactionalResults; } /** * The constructor. * * @param requestId - see {@link #getRequestId()}. * @param xsrfToken - see {@link #getXsrfToken()}. * @param transactionalResults - see {@link #getTransactionalResults()}. */ public GenericRemoteInvocationResponse(int requestId, CsrfToken xsrfToken, Collection<GenericRemoteInvocationTransactionalResults> transactionalResults) { this(requestId, xsrfToken, transactionalResults .toArray(new GenericRemoteInvocationTransactionalResults[transactionalResults.size()])); } /** * @return the {@link GenericRemoteInvocationRequest#getRequestId() ID of the request} this response * corresponds to. */ public int getRequestId() { return this.requestId; } /** * Gets the {@link CsrfToken} that has been generated on the server-side. If not <code>null</code> the * client has to store the token and send it back to the server * {@link GenericRemoteInvocationRequest#getXsrfToken() within} the next * {@link GenericRemoteInvocationRequest request}. This is all handled by the infrastructure of mmm-service * but can be extended for custom needs. * * @return the {@link CsrfToken} or <code>null</code> if unchanged. */ public CsrfToken getXsrfToken() { return this.xsrfToken; } /** * @return an array with the {@link GenericRemoteInvocationTransactionalResults}s. */ public GenericRemoteInvocationTransactionalResults[] getTransactionalResults() { return this.transactionalResults; } }
m-m-m/service
base/src/main/java/net/sf/mmm/service/base/GenericRemoteInvocationResponse.java
Java
apache-2.0
3,295
dc.w word_18AFC-Map_Invincibility dc.w word_18AFE-Map_Invincibility dc.w word_18B06-Map_Invincibility dc.w word_18B0E-Map_Invincibility dc.w word_18B16-Map_Invincibility dc.w word_18B1E-Map_Invincibility dc.w word_18B26-Map_Invincibility dc.w word_18B2E-Map_Invincibility dc.w word_18B36-Map_Invincibility word_18AFC: dc.w 0 ; DATA XREF: ROM:00018AEAo word_18AFE: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F8, 0, 0, 0, $FF, $FC word_18B06: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F8, 0, 0, 1, $FF, $FC word_18B0E: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F8, 1, 0, 2, $FF, $FC word_18B16: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F8, 1, 0, 4, $FF, $FC word_18B1E: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F8, 1, 0, 6, $FF, $FC word_18B26: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F8, 5, 0, 8, $FF, $F8 word_18B2E: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F8, 5, 0, $C, $FF, $F8 word_18B36: dc.w 1 ; DATA XREF: ROM:00018AEAo dc.b $F0, $F, 0, $10, $FF, $F0
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
Working Disassembly/General/Sprites/Shields/Map - Invincibility.asm
Assembly
apache-2.0
1,061
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.SignatureHelp; using Microsoft.CodeAnalysis.Editor.UnitTests.SignatureHelp; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.SignatureHelp { public class InvocationExpressionSignatureHelpProviderTests : AbstractCSharpSignatureHelpProviderTests { public InvocationExpressionSignatureHelpProviderTests(CSharpTestWorkspaceFixture workspaceFixture) : base(workspaceFixture) { } internal override ISignatureHelpProvider CreateSignatureHelpProvider() { return new InvocationExpressionSignatureHelpProvider(); } #region "Regular tests" [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationAfterCloseParen() { var markup = @" class C { int Goo(int x) { [|Goo(Goo(x)$$|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("int C.Goo(int x)", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationInsideLambda() { var markup = @" using System; class C { void Goo(Action<int> f) { [|Goo(i => Console.WriteLine(i)$$|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(Action<int> f)", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationInsideLambda2() { var markup = @" using System; class C { void Goo(Action<int> f) { [|Goo(i => Con$$sole.WriteLine(i)|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(Action<int> f)", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithoutParameters() { var markup = @" class C { void Goo() { [|Goo($$|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo()", string.Empty, null, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithoutParametersMethodXmlComments() { var markup = @" class C { /// <summary> /// Summary for goo /// </summary> void Goo() { [|Goo($$|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo()", "Summary for goo", null, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithParametersOn1() { var markup = @" class C { void Goo(int a, int b) { [|Goo($$a, b|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(int a, int b)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithParametersXmlCommentsOn1() { var markup = @" class C { /// <summary> /// Summary for Goo /// </summary> /// <param name=" + "\"a\">Param a</param>" + @" /// <param name=" + "\"b\">Param b</param>" + @" void Goo(int a, int b) { [|Goo($$a, b|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(int a, int b)", "Summary for Goo", "Param a", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithParametersOn2() { var markup = @" class C { void Goo(int a, int b) { [|Goo(a, $$b|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(int a, int b)", string.Empty, string.Empty, currentParameterIndex: 1)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithParametersXmlComentsOn2() { var markup = @" class C { /// <summary> /// Summary for Goo /// </summary> /// <param name=" + "\"a\">Param a</param>" + @" /// <param name=" + "\"b\">Param b</param>" + @" void Goo(int a, int b) { [|Goo(a, $$b|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(int a, int b)", "Summary for Goo", "Param b", currentParameterIndex: 1)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithoutClosingParen() { var markup = @" class C { void Goo() { [|Goo($$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo()", string.Empty, null, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithoutClosingParenWithParameters() { var markup = @"class C { void Goo(int a, int b) { [|Goo($$a, b |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(int a, int b)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithoutClosingParenWithParametersOn2() { var markup = @" class C { void Goo(int a, int b) { [|Goo(a, $$b |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(int a, int b)", string.Empty, string.Empty, currentParameterIndex: 1)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnLambda() { var markup = @" using System; class C { void Goo() { Action<int> f = (i) => Console.WriteLine(i); [|f($$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void Action<int>(int obj)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnMemberAccessExpression() { var markup = @" class C { static void Bar(int a) { } void Goo() { [|C.Bar($$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Bar(int a)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestExtensionMethod1() { var markup = @" using System; class C { void Method() { string s = ""Text""; [|s.ExtensionMethod($$ |]} } public static class MyExtension { public static int ExtensionMethod(this string s, int x) { return s.Length; } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem($"({CSharpFeaturesResources.extension}) int string.ExtensionMethod(int x)", string.Empty, string.Empty, currentParameterIndex: 0)); // TODO: Once we do the work to allow extension methods in nested types, we should change this. await TestAsync(markup, expectedOrderedItems, sourceCodeKind: SourceCodeKind.Regular); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestOptionalParameters() { var markup = @" class Class1 { void Test() { Goo($$ } void Goo(int a = 42) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void Class1.Goo([int a = 42])", string.Empty, string.Empty, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestNoInvocationOnEventNotInCurrentClass() { var markup = @" using System; class C { void Goo() { D d; [|d.evt($$ |]} } public class D { public event Action evt; }"; await TestAsync(markup); } [WorkItem(539712, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539712")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnNamedType() { var markup = @" class Program { void Main() { C.Goo($$ } } class C { public static double Goo(double x) { return x; } public double Goo(double x, double y) { return x + y; } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("double C.Goo(double x)", string.Empty, string.Empty, currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(539712, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539712")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnInstance() { var markup = @" class Program { void Main() { new C().Goo($$ } } class C { public static double Goo(double x) { return x; } public double Goo(double x, double y) { return x + y; } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("double C.Goo(double x, double y)", string.Empty, string.Empty, currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(545118, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545118")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestStatic1() { var markup = @" class C { static void Goo() { Bar($$ } static void Bar() { } void Bar(int i) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void C.Bar()", currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(545118, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545118")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestStatic2() { var markup = @" class C { void Goo() { Bar($$ } static void Bar() { } void Bar(int i) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void C.Bar()", currentParameterIndex: 0), new SignatureHelpTestItem("void C.Bar(int i)", currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(543117, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543117")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnAnonymousType() { var markup = @" using System.Collections.Generic; class Program { static void Main(string[] args) { var goo = new { Name = string.Empty, Age = 30 }; Goo(goo).Add($$); } static List<T> Goo<T>(T t) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( $@"void List<'a>.Add('a item) {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ string Name, int Age }}", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: $@" {FeaturesResources.Anonymous_Types_colon} 'a {FeaturesResources.is_} new {{ string Name, int Age }}") }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnBaseExpression_ProtectedAccessibility() { var markup = @" using System; public class Base { protected virtual void Goo(int x) { } } public class Derived : Base { void Test() { base.Goo($$); } protected override void Goo(int x) { throw new NotImplementedException(); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( @"void Base.Goo(int x)", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnBaseExpression_AbstractBase() { var markup = @" using System; public abstract class Base { protected abstract void Goo(int x); } public class Derived : Base { void Test() { base.Goo($$); } protected override void Goo(int x) { throw new NotImplementedException(); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( @"void Base.Goo(int x)", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnThisExpression_ProtectedAccessibility() { var markup = @" using System; public class Base { protected virtual void Goo(int x) { } } public class Derived : Base { void Test() { this.Goo($$); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( @"void Base.Goo(int x)", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnThisExpression_ProtectedAccessibility_Overridden() { var markup = @" using System; public class Base { protected virtual void Goo(int x) { } } public class Derived : Base { void Test() { this.Goo($$); } protected override void Goo(int x) { throw new NotImplementedException(); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( @"void Derived.Goo(int x)", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnThisExpression_ProtectedAccessibility_AbstractBase() { var markup = @" using System; public abstract class Base { protected abstract void Goo(int x); } public class Derived : Base { void Test() { this.Goo($$); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( @"void Base.Goo(int x)", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnThisExpression_ProtectedAccessibility_AbstractBase_Overridden() { var markup = @" using System; public abstract class Base { protected abstract void Goo(int x); } public class Derived : Base { void Test() { this.Goo($$); } protected override void Goo(int x) { throw new NotImplementedException(); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( @"void Derived.Goo(int x)", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnBaseExpression_ProtectedInternalAccessibility() { var markup = @" using System; public class Base { protected internal void Goo(int x) { } } public class Derived : Base { void Test() { base.Goo($$); } protected override void Goo(int x) { throw new NotImplementedException(); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( @"void Base.Goo(int x)", methodDocumentation: string.Empty, parameterDocumentation: string.Empty, currentParameterIndex: 0, description: string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnBaseMember_ProtectedAccessibility_ThroughType() { var markup = @" using System; public class Base { protected virtual void Goo(int x) { } } public class Derived : Base { void Test() { new Base().Goo($$); } protected override void Goo(int x) { throw new NotImplementedException(); } }"; await TestAsync(markup, null); } [WorkItem(968188, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/968188")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnBaseExpression_PrivateAccessibility() { var markup = @" using System; public class Base { private void Goo(int x) { } } public class Derived : Base { void Test() { base.Goo($$); } protected override void Goo(int x) { throw new NotImplementedException(); } }"; await TestAsync(markup, null); } #endregion #region "Current Parameter Name" [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestCurrentParameterName() { var markup = @" class C { void Goo(int someParameter, bool something) { Goo(something: false, someParameter: $$) } }"; await VerifyCurrentParameterNameAsync(markup, "someParameter"); } #endregion #region "Trigger tests" [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnTriggerParens() { var markup = @" class C { void Goo() { [|Goo($$|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo()", string.Empty, null, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationOnTriggerComma() { var markup = @" class C { void Goo(int a, int b) { [|Goo(23,$$|]); } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo(int a, int b)", string.Empty, string.Empty, currentParameterIndex: 1)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestNoInvocationOnSpace() { var markup = @" class C { void Goo(int a, int b) { [|Goo(23, $$|]); } }"; await TestAsync(markup, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestTriggerCharacterInComment01() { var markup = @" class C { void Goo(int a) { Goo(/*,$$*/); } }"; await TestAsync(markup, Enumerable.Empty<SignatureHelpTestItem>(), usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestTriggerCharacterInComment02() { var markup = @" class C { void Goo(int a) { Goo(//,$$ ); } }"; await TestAsync(markup, Enumerable.Empty<SignatureHelpTestItem>(), usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestTriggerCharacterInString01() { var markup = @" class C { void Goo(int a) { Goo("",$$""); } }"; await TestAsync(markup, Enumerable.Empty<SignatureHelpTestItem>(), usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public void TestTriggerCharacters() { char[] expectedCharacters = { ',', '(' }; char[] unexpectedCharacters = { ' ', '[', '<' }; VerifyTriggerCharacters(expectedCharacters, unexpectedCharacters); } #endregion #region "EditorBrowsable tests" [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_Method_BrowsableStateAlways() { var markup = @" class Program { void M() { Goo.Bar($$ } }"; var referencedCode = @" public class Goo { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Always)] public static void Bar() { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void Goo.Bar()", string.Empty, null, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_Method_BrowsableStateNever() { var markup = @" class Program { void M() { Goo.Bar($$ } }"; var referencedCode = @" public class Goo { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static void Bar() { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void Goo.Bar()", string.Empty, null, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_Method_BrowsableStateAdvanced() { var markup = @" class Program { void M() { new Goo().Bar($$ } }"; var referencedCode = @" public class Goo { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] public void Bar() { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void Goo.Bar()", string.Empty, null, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp, hideAdvancedMembers: true); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp, hideAdvancedMembers: false); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_Method_Overloads_OneBrowsableAlways_OneBrowsableNever() { var markup = @" class Program { void M() { new Goo().Bar($$ } }"; var referencedCode = @" public class Goo { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Always)] public void Bar() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Bar(int x) { } }"; var expectedOrderedItemsMetadataReference = new List<SignatureHelpTestItem>(); expectedOrderedItemsMetadataReference.Add(new SignatureHelpTestItem("void Goo.Bar()", string.Empty, null, currentParameterIndex: 0)); var expectedOrderedItemsSameSolution = new List<SignatureHelpTestItem>(); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void Goo.Bar()", string.Empty, null, currentParameterIndex: 0)); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void Goo.Bar(int x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItemsMetadataReference, expectedOrderedItemsSameSolution: expectedOrderedItemsSameSolution, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_Method_Overloads_BothBrowsableNever() { var markup = @" class Program { void M() { new Goo().Bar($$ } }"; var referencedCode = @" public class Goo { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Bar() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Bar(int x) { } }"; var expectedOrderedItemsSameSolution = new List<SignatureHelpTestItem>(); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void Goo.Bar()", string.Empty, null, currentParameterIndex: 0)); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void Goo.Bar(int x)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItemsSameSolution, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task OverriddenSymbolsFilteredFromSigHelp() { var markup = @" class Program { void M() { new D().Goo($$ } }"; var referencedCode = @" public class B { public virtual void Goo(int original) { } } public class D : B { public override void Goo(int derived) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void D.Goo(int derived)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_BrowsableStateAlwaysMethodInBrowsableStateNeverClass() { var markup = @" class Program { void M() { new C().Goo($$ } }"; var referencedCode = @" [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public class C { public void Goo() { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo()", string.Empty, null, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_BrowsableStateAlwaysMethodInBrowsableStateNeverBaseClass() { var markup = @" class Program { void M() { new D().Goo($$ } }"; var referencedCode = @" [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public class B { public void Goo() { } } public class D : B { public void Goo(int x) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void B.Goo()", string.Empty, null, currentParameterIndex: 0), new SignatureHelpTestItem("void D.Goo(int x)", string.Empty, string.Empty, currentParameterIndex: 0), }; await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_BrowsableStateNeverMethodsInBaseClass() { var markup = @" class Program : B { void M() { Goo($$ } }"; var referencedCode = @" public class B { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo() { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void B.Goo()", string.Empty, null, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericTypeCausingMethodSignatureEquality_BothBrowsableAlways() { var markup = @" class Program { void M() { new C<int>().Goo($$ } }"; var referencedCode = @" public class C<T> { public void Goo(T t) { } public void Goo(int i) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int>.Goo(int i)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericTypeCausingMethodSignatureEquality_BrowsableMixed1() { var markup = @" class Program { void M() { new C<int>().Goo($$ } }"; var referencedCode = @" public class C<T> { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo(T t) { } public void Goo(int i) { } }"; var expectedOrderedItemsMetadataReference = new List<SignatureHelpTestItem>(); expectedOrderedItemsMetadataReference.Add(new SignatureHelpTestItem("void C<int>.Goo(int i)", string.Empty, string.Empty, currentParameterIndex: 0)); var expectedOrderedItemsSameSolution = new List<SignatureHelpTestItem>(); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C<int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C<int>.Goo(int i)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItemsMetadataReference, expectedOrderedItemsSameSolution: expectedOrderedItemsSameSolution, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericTypeCausingMethodSignatureEquality_BrowsableMixed2() { var markup = @" class Program { void M() { new C<int>().Goo($$ } }"; var referencedCode = @" public class C<T> { public void Goo(T t) { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo(int i) { } }"; var expectedOrderedItemsMetadataReference = new List<SignatureHelpTestItem>(); expectedOrderedItemsMetadataReference.Add(new SignatureHelpTestItem("void C<int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); var expectedOrderedItemsSameSolution = new List<SignatureHelpTestItem>(); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C<int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C<int>.Goo(int i)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItemsMetadataReference, expectedOrderedItemsSameSolution: expectedOrderedItemsSameSolution, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericTypeCausingMethodSignatureEquality_BothBrowsableNever() { var markup = @" class Program { void M() { new C<int>().Goo($$ } }"; var referencedCode = @" public class C<T> { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo(T t) { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo(int i) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int>.Goo(int i)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericType2CausingMethodSignatureEquality_BothBrowsableAlways() { var markup = @" class Program { void M() { new C<int, int>().Goo($$ } }"; var referencedCode = @" public class C<T, U> { public void Goo(T t) { } public void Goo(U u) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int, int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int, int>.Goo(int u)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItems, expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericType2CausingMethodSignatureEquality_BrowsableMixed() { var markup = @" class Program { void M() { new C<int, int>().Goo($$ } }"; var referencedCode = @" public class C<T, U> { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo(T t) { } public void Goo(U u) { } }"; var expectedOrderedItemsMetadataReference = new List<SignatureHelpTestItem>(); expectedOrderedItemsMetadataReference.Add(new SignatureHelpTestItem("void C<int, int>.Goo(int u)", string.Empty, string.Empty, currentParameterIndex: 0)); var expectedOrderedItemsSameSolution = new List<SignatureHelpTestItem>(); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C<int, int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItemsSameSolution.Add(new SignatureHelpTestItem("void C<int, int>.Goo(int u)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: expectedOrderedItemsMetadataReference, expectedOrderedItemsSameSolution: expectedOrderedItemsSameSolution, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } [WorkItem(7336, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task EditorBrowsable_GenericType2CausingMethodSignatureEquality_BothBrowsableNever() { var markup = @" class Program { void M() { new C<int, int>().Goo($$ } }"; var referencedCode = @" public class C<T, U> { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo(T t) { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public void Goo(U u) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int, int>.Goo(int t)", string.Empty, string.Empty, currentParameterIndex: 0)); expectedOrderedItems.Add(new SignatureHelpTestItem("void C<int, int>.Goo(int u)", string.Empty, string.Empty, currentParameterIndex: 0)); await TestSignatureHelpInEditorBrowsableContextsAsync(markup: markup, referencedCode: referencedCode, expectedOrderedItemsMetadataReference: new List<SignatureHelpTestItem>(), expectedOrderedItemsSameSolution: expectedOrderedItems, sourceLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.CSharp); } #endregion #region "Awaitable tests" [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task AwaitableMethod() { var markup = @" using System.Threading.Tasks; class C { async Task Goo() { [|Goo($$|]); } }"; var description = $@" {WorkspacesResources.Usage_colon} await Goo();"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem($"({CSharpFeaturesResources.awaitable}) Task C.Goo()", methodDocumentation: description, currentParameterIndex: 0)); await TestSignatureHelpWithMscorlib45Async(markup, expectedOrderedItems, "C#"); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task AwaitableMethod2() { var markup = @" using System.Threading.Tasks; class C { async Task<Task<int>> Goo() { [|Goo($$|]); } }"; var description = $@" {WorkspacesResources.Usage_colon} Task<int> x = await Goo();"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem($"({CSharpFeaturesResources.awaitable}) Task<Task<int>> C.Goo()", methodDocumentation: description, currentParameterIndex: 0)); await TestSignatureHelpWithMscorlib45Async(markup, expectedOrderedItems, "C#"); } #endregion [WorkItem(13849, "DevDiv_Projects/Roslyn")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestSpecificity1() { var markup = @" class Class1 { static void Main() { var obj = new C<int>(); [|obj.M($$|]) } } class C<T> { /// <param name=""t"">Generic t</param> public void M(T t) { } /// <param name=""t"">Real t</param> public void M(int t) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void C<int>.M(int t)", string.Empty, "Real t", currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(530017, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530017")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task LongSignature() { var markup = @" class C { void Goo(string a, string b, string c, string d, string e, string f, string g, string h, string i, string j, string k, string l, string m, string n, string o, string p, string q, string r, string s, string t, string u, string v, string w, string x, string y, string z) { [|Goo($$|]) } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem( signature: "void C.Goo(string a, string b, string c, string d, string e, string f, string g, string h, string i, string j, string k, string l, string m, string n, string o, string p, string q, string r, string s, string t, string u, string v, string w, string x, string y, string z)", prettyPrintedSignature: @"void C.Goo(string a, string b, string c, string d, string e, string f, string g, string h, string i, string j, string k, string l, string m, string n, string o, string p, string q, string r, string s, string t, string u, string v, string w, string x, string y, string z)", currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task GenericExtensionMethod() { var markup = @" interface IGoo { void Bar<T>(); } static class GooExtensions { public static void Bar<T1, T2>(this IGoo goo) { } } class Program { static void Main() { IGoo f = null; [|f.Bar($$ |]} }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void IGoo.Bar<T>()", currentParameterIndex: 0), new SignatureHelpTestItem($"({CSharpFeaturesResources.extension}) void IGoo.Bar<T1, T2>()", currentParameterIndex: 0), }; // Extension methods are supported in Interactive/Script (yet). await TestAsync(markup, expectedOrderedItems, sourceCodeKind: SourceCodeKind.Regular); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestInvocationWithCrefXmlComments() { var markup = @" class C { /// <summary> /// Summary for goo. See method <see cref=""Bar"" /> /// </summary> void Goo() { [|Goo($$|]); } void Bar() { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("void C.Goo()", "Summary for goo. See method C.Bar()", null, currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task FieldUnavailableInOneLinkedFile() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO void bar() { } #endif void goo() { bar($$ } } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = new SignatureHelpTestItem($"void C.bar()\r\n\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}", currentParameterIndex: 0); await VerifyItemWithReferenceWorkerAsync(markup, new[] { expectedDescription }, false); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task ExcludeFilesWithInactiveRegions() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""GOO,BAR""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if GOO void bar() { } #endif #if BAR void goo() { bar($$ } #endif } ]]> </Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument"" /> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj3"" PreprocessorSymbols=""BAR""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = new SignatureHelpTestItem($"void C.bar()\r\n\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj3", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}", currentParameterIndex: 0); await VerifyItemWithReferenceWorkerAsync(markup, new[] { expectedDescription }, false); } [WorkItem(768697, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768697")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InstanceAndStaticMethodsShown1() { var markup = @" class C { Goo Goo; void M() { Goo.Bar($$ } } class Goo { public void Bar(int x) { } public static void Bar(string s) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void Goo.Bar(int x)", currentParameterIndex: 0), new SignatureHelpTestItem("void Goo.Bar(string s)", currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(768697, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768697")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InstanceAndStaticMethodsShown2() { var markup = @" class C { Goo Goo; void M() { Goo.Bar($$""); } } class Goo { public void Bar(int x) { } public static void Bar(string s) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void Goo.Bar(int x)", currentParameterIndex: 0), new SignatureHelpTestItem("void Goo.Bar(string s)", currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(768697, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768697")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InstanceAndStaticMethodsShown3() { var markup = @" class C { Goo Goo; void M() { Goo.Bar($$ } } class Goo { public static void Bar(int x) { } public static void Bar(string s) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem> { new SignatureHelpTestItem("void Goo.Bar(int x)", currentParameterIndex: 0), new SignatureHelpTestItem("void Goo.Bar(string s)", currentParameterIndex: 0) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(768697, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768697")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InstanceAndStaticMethodsShown4() { var markup = @" class C { void M() { Goo x; x.Bar($$ } } class Goo { public static void Bar(int x) { } public static void Bar(string s) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); await TestAsync(markup, expectedOrderedItems); } [WorkItem(768697, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768697")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InstanceAndStaticMethodsShown5() { var markup = @" class C { void M() { Goo x; x.Bar($$ } } class x { } class Goo { public static void Bar(int x) { } public static void Bar(string s) { } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); await TestAsync(markup, expectedOrderedItems); } [WorkItem(1067933, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1067933")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task InvokedWithNoToken() { var markup = @" // goo($$"; await TestAsync(markup); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task MethodOverloadDifferencesIgnored() { var markup = @"<Workspace> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"" PreprocessorSymbols=""ONE""> <Document FilePath=""SourceDocument""><![CDATA[ class C { #if ONE void Do(int x){} #endif #if TWO void Do(string x){} #endif void Shared() { this.Do($$ } }]]></Document> </Project> <Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj2"" PreprocessorSymbols=""TWO""> <Document IsLinkFile=""true"" LinkAssemblyName=""Proj1"" LinkFilePath=""SourceDocument""/> </Project> </Workspace>"; var expectedDescription = new SignatureHelpTestItem($"void C.Do(int x)", currentParameterIndex: 0); await VerifyItemWithReferenceWorkerAsync(markup, new[] { expectedDescription }, false); } [WorkItem(699, "https://github.com/dotnet/roslyn/issues/699")] [WorkItem(1068424, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1068424")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestGenericParameters1() { var markup = @" class C { void M() { Goo(""""$$); } void Goo<T>(T a) { } void Goo<T, U>(T a, U b) { } } "; var expectedOrderedItems = new List<SignatureHelpTestItem>() { new SignatureHelpTestItem("void C.Goo<string>(string a)", string.Empty, string.Empty, currentParameterIndex: 0), new SignatureHelpTestItem("void C.Goo<T, U>(T a, U b)", string.Empty) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(699, "https://github.com/dotnet/roslyn/issues/699")] [WorkItem(1068424, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1068424")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestGenericParameters2() { var markup = @" class C { void M() { Goo("""", $$); } void Goo<T>(T a) { } void Goo<T, U>(T a, U b) { } } "; var expectedOrderedItems = new List<SignatureHelpTestItem>() { new SignatureHelpTestItem("void C.Goo<T>(T a)", string.Empty), new SignatureHelpTestItem("void C.Goo<T, U>(T a, U b)", string.Empty, string.Empty, currentParameterIndex: 1) }; await TestAsync(markup, expectedOrderedItems); } [WorkItem(4144, "https://github.com/dotnet/roslyn/issues/4144")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TestSigHelpIsVisibleOnInaccessibleItem() { var markup = @" using System.Collections.Generic; class A { List<int> args; } class B : A { void M() { args.Add($$ } } "; await TestAsync(markup, new[] { new SignatureHelpTestItem("void List<int>.Add(int item)") }); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TypingTupleDoesNotDismiss1() { var markup = @" class C { int Goo(object x) { [|Goo(($$)|]; } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("int C.Goo(object x)", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TypingTupleDoesNotDismiss2() { var markup = @" class C { int Goo(object x) { [|Goo((1,$$)|]; } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("int C.Goo(object x)", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TypingTupleDoesNotDismiss3() { var markup = @" class C { int Goo(object x) { [|Goo((1, ($$)|]; } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("int C.Goo(object x)", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] public async Task TypingTupleDoesNotDismiss4() { var markup = @" class C { int Goo(object x) { [|Goo((1, (2,$$)|]; } }"; var expectedOrderedItems = new List<SignatureHelpTestItem>(); expectedOrderedItems.Add(new SignatureHelpTestItem("int C.Goo(object x)", currentParameterIndex: 0)); await TestAsync(markup, expectedOrderedItems, usePreviousCharAsTrigger: true); } } }
Hosch250/roslyn
src/EditorFeatures/CSharpTest/SignatureHelp/InvocationExpressionSignatureHelpProviderTests.cs
C#
apache-2.0
67,861
<?php /** * DO NOT EDIT THIS FILE! * * This file was automatically generated from external sources. * * Any manual change here will be lost the next time the SDK * is updated. You've been warned! */ namespace DTS\eBaySDK\Trading\Types; /** * * @property \DTS\eBaySDK\Trading\Enums\DiscountNameCodeType $DiscountName * @property \DTS\eBaySDK\Trading\Types\DiscountProfileType[] $DiscountProfile */ class FlatShippingDiscountType extends \DTS\eBaySDK\Types\BaseType { /** * @var array Properties belonging to objects of this class. */ private static $propertyTypes = [ 'DiscountName' => [ 'type' => 'string', 'repeatable' => false, 'attribute' => false, 'elementName' => 'DiscountName' ], 'DiscountProfile' => [ 'type' => 'DTS\eBaySDK\Trading\Types\DiscountProfileType', 'repeatable' => true, 'attribute' => false, 'elementName' => 'DiscountProfile' ] ]; /** * @param array $values Optional properties and values to assign to the object. */ public function __construct(array $values = []) { list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values); parent::__construct($parentValues); if (!array_key_exists(__CLASS__, self::$properties)) { self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes); } if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) { self::$xmlNamespaces[__CLASS__] = 'xmlns="urn:ebay:apis:eBLBaseComponents"'; } $this->setValues(__CLASS__, $childValues); } }
davidtsadler/ebay-sdk-php
src/Trading/Types/FlatShippingDiscountType.php
PHP
apache-2.0
1,735
/* * 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.bpmscript.web; import javax.servlet.http.HttpServletRequest; /** * */ public class DefaultNameOperationStrategy implements INameOperationStrategy { private String defaultDefinitionName = "home"; private String defaultOperation = "index"; private String prefix = "bpmscript/"; /** * @see org.bpmscript.web.INameOperationStrategy#getNameOperation(javax.servlet.http.HttpServletRequest) */ public INameOperation getNameOperation(HttpServletRequest request) { String[] split = request.getRequestURI().substring(request.getContextPath().length() + 1 + prefix.length()).split("/"); StringBuilder definitionName = new StringBuilder(); String operation = null; if(split.length == 0) { return new NameOperation(defaultDefinitionName, defaultOperation); } else if (split.length == 1) { return new NameOperation(defaultDefinitionName, split[0].split("\\.")[0]); } else { for(int i = 0; i < split.length; i++) { if(i == split.length - 1) { operation = split[i].split("\\.")[0]; } else { definitionName.append(split[i]); if(i < split.length - 2) { definitionName.append("."); } } } } return new NameOperation(definitionName.toString(), operation); } public void setDefaultDefinitionName(String defaultDefinitionName) { this.defaultDefinitionName = defaultDefinitionName; } public void setDefaultOperation(String defaultOperation) { this.defaultOperation = defaultOperation; } public void setPrefix(String prefix) { this.prefix = prefix; } }
jamiemccrindle/bpmscript
bpmscript-core/src/main/java/org/bpmscript/web/DefaultNameOperationStrategy.java
Java
apache-2.0
2,606
describe ApplicationHelper::Button::MiqTemplateTimeline do let(:view_context) { setup_view_context_with_sandbox({}) } let(:record) { FactoryBot.create(:template_redhat) } let(:button) { described_class.new(view_context, {}, {'record' => record}, {}) } it_behaves_like 'a timeline button', :entity => 'Template' end
ManageIQ/manageiq-ui-classic
spec/helpers/application_helper/buttons/miq_template_timeline_spec.rb
Ruby
apache-2.0
324
# 3rd party imports from bidi.algorithm import get_display as apply_bidi # Django imports from django.conf import settings # Project imports from .base import TestGeneratePdfBase from .factories import create_voters from .utils_for_tests import extract_pdf_page, extract_textlines, clean_textlines, unwrap_lines from ..arabic_reshaper import reshape from ..generate_pdf import generate_pdf from ..utils import truncate_center_name, format_name from libya_elections.constants import ARABIC_COMMA, MALE, FEMALE, UNISEX class TestGeneratePdfNoRegistrants(TestGeneratePdfBase): """Compare the word-by-word content of the PDF with expected content when there are no voters""" def setUp(self): super(TestGeneratePdfNoRegistrants, self).setUp() self.voter_roll = [] def test_blank_page_content_male(self): """tests that the "blank" page explains why it is blank (no voters)""" generate_pdf(self.filename, self.center, self.voter_roll, MALE) # Build a list of the lines I expect to see. expected_lines = [] expected_lines.append(self.STRINGS['center_header_prefix']) expected_lines.append(self.STRINGS['center_list_header']) expected_lines.append(self.STRINGS['no_male_registrants']) expected_lines.append("1 / 1") # Now see what was actually in the PDF and compare to expected. xml = extract_pdf_page(self.filename, 1) textlines = extract_textlines(xml) actual_lines = clean_textlines(textlines) self.assertEqual(expected_lines, actual_lines) for textline in textlines: self.assertCorrectFontsInUse(textline) def test_blank_page_content_female(self): """tests that the "blank" page explains why it is blank (no voters)""" # Build a list of the lines I expect to see. generate_pdf(self.filename, self.center, self.voter_roll, FEMALE) expected_lines = [] expected_lines.append(self.STRINGS['center_header_prefix']) expected_lines.append(self.STRINGS['center_list_header']) expected_lines.append(self.STRINGS['no_female_registrants']) expected_lines.append("1 / 1") # Now see what was actually in the PDF and compare to expected. xml = extract_pdf_page(self.filename, 1) textlines = extract_textlines(xml) actual_lines = clean_textlines(textlines) self.assertEqual(expected_lines, actual_lines) for textline in textlines: self.assertCorrectFontsInUse(textline) class TestGeneratePdfGenderParam(TestGeneratePdfBase): """Ensure that passing UNISEX to generate_pdf() raises an error. This is a small test that didn't seem to fit elsewhere. """ def test_gender_param(self): self.voter_roll = create_voters(1, self.gender) with self.assertRaises(ValueError): generate_pdf(self.filename, self.center, self.voter_roll, UNISEX) class GeneratePdfContentTestMixin(object): """Mixin the provides the main methods tested in several test cases in this file (below). These methods compare the actual word-by-word content of the PDF with expected content. There's no unisex tests needed here because that concept only matters when dealing with polling stations. """ def test_cover_content(self): """tests that the cover page contains the expected text""" # Build a list of the lines I expect to see. expected_lines = [] key = 'center_book_cover' if self.center_book else 'center_list_cover' expected_lines += self.STRINGS[key] # These are constructed "backwards" relative to how the actual code does it. It's # necessary to do so because the text is laid out RtoL in the PDF. expected_lines.append('{} :{}'.format(self.STRINGS['female'], self.STRINGS['gender'])) expected_lines.append('{} :{}'.format(self.center.center_id, self.STRINGS['center_number'])) center_name = apply_bidi(reshape(self.center.name)) expected_lines.append('{} :{}'.format(center_name, self.STRINGS['center_name'])) copied_by = self.center.copied_by.all() if self.center.copy_of: expected_lines.append('{} :{}'.format(self.center.copy_of.center_id, self.STRINGS['copy_of'])) elif copied_by: copied_by = [center.center_id for center in copied_by] copied_by = (' ' + ARABIC_COMMA).join(map(str, reversed(copied_by))) expected_lines.append('{} :{}'.format(copied_by, self.STRINGS['copied_by_plural'])) subconstituency_id = self.center.subconstituency.id subconstituency_name = reshape(self.center.subconstituency.name_arabic) subconstituency_name = apply_bidi(subconstituency_name) subconstituency = '{} / {} :{}'.format(subconstituency_name, subconstituency_id, self.STRINGS['subconstituency_name']) expected_lines.append(subconstituency) # Now see what was actually in the PDF and compare to expected. xml = extract_pdf_page(self.filename, 0) textlines = extract_textlines(xml) actual_lines = clean_textlines(textlines) # Did center name wrap? If so, unwrap. if expected_lines[4].startswith(actual_lines[5]): actual_lines = unwrap_lines(actual_lines, 4) has_copy_info = (self.center.copy_of or self.center.copied_by) if has_copy_info: # Did center name wrap? If so, unwrap. if expected_lines[5].startswith(actual_lines[6]): actual_lines = unwrap_lines(actual_lines, 5) # Did subcon name wrap? If so, unwrap. offset = 1 if has_copy_info else 0 if len(actual_lines) >= 7 + offset: if expected_lines[5 + offset].startswith(actual_lines[6 + offset]): actual_lines = unwrap_lines(actual_lines, 5 + offset) self.assertEqual(expected_lines, actual_lines) for textline in textlines: self.assertCorrectFontsInUse(textline) def test_inner_page_content(self): """tests that the non-cover pages of a multipage PDF contain the expected text""" # 1 pages = cover + 2 pages of names self.assertEqual(self.n_pages, 3) # Build a list of the lines I expect to see. I don't care about the cover page, just # the inner pages. expected_lines = [] page_header = [] page_header.append(self.STRINGS['center_header_prefix']) key = 'center_book_header' if self.center_book else 'center_list_header' page_header.append(self.STRINGS[key]) mf_string = self.STRINGS['female'] page_header.append('{} :{}'.format(mf_string, self.STRINGS['gender'])) page_header.append('{} :{}'.format(self.center.center_id, self.STRINGS['center_number'])) center_name = apply_bidi(truncate_center_name(reshape(self.center.name))) page_header.append('{} :{}'.format(center_name, self.STRINGS['center_name'])) expected_lines += page_header expected_lines.append(self.STRINGS['the_names']) for voter in self.voter_roll[:self.n_voters - 1]: expected_lines.append(apply_bidi(reshape(format_name(voter)))) expected_lines.append(mf_string) # '2 / 1' is the 'page N/n_pages' from the footer expected_lines.append('2 / 1') # Now see what was actually in the PDF and compare to expected. xml = extract_pdf_page(self.filename, 1) textlines = extract_textlines(xml) actual_lines = clean_textlines(textlines) self.assertEqual(expected_lines, actual_lines) for textline in textlines: self.assertCorrectFontsInUse(textline) # OK now test the second (final) inner page. It only has one voter on it. expected_lines = page_header expected_lines.append(self.STRINGS['the_names']) for voter in self.voter_roll[-1:]: expected_lines.append(apply_bidi(reshape(format_name(voter)))) expected_lines.append(mf_string) # '2 / 2' is the 'page N/n_pages' from the footer expected_lines.append('2 / 2') # Now see what was actually in the PDF and compare to expected. xml = extract_pdf_page(self.filename, 2) textlines = extract_textlines(xml) actual_lines = clean_textlines(textlines) self.assertEqual(expected_lines, actual_lines) for textline in textlines: self.assertCorrectFontsInUse(textline) class TestGeneratePdfContentCenterList(TestGeneratePdfBase, GeneratePdfContentTestMixin): """Invoke GeneratePdfContentTestMixin for center lists. Center lists are only used during the in-person phase. """ def setUp(self): super(TestGeneratePdfContentCenterList, self).setUp() self.center_book = False # Create a PDF that will spill to multiple pages. self.n_voters = settings.ROLLGEN_REGISTRATIONS_PER_PAGE_REGISTRATION + 1 self.voter_roll = create_voters(self.n_voters, FEMALE) self.n_pages = generate_pdf(self.filename, self.center, self.voter_roll, FEMALE) class TestGeneratePdfContentCenterBook(TestGeneratePdfBase): """Invoke GeneratePdfContentTestMixin for center books. Center books are only used during the exhibitions phase. """ def setUp(self): super(TestGeneratePdfContentCenterBook, self).setUp() self.center_book = True self.n_pages = generate_pdf(self.filename, self.center, self.voter_roll, FEMALE) class TestCopyOfCenter(TestGeneratePdfBase, GeneratePdfContentTestMixin): """Invoke GeneratePdfContentTestMixin for a copy center. This class uses a center that is a copy in order to exercise the copy_of code branch. """ def setUp(self): super(TestCopyOfCenter, self).setUp() self.center_book = False self.n_voters = 5 self.voter_roll = create_voters(self.n_voters, FEMALE) # Any of the copy centers will do. self.center = self.copy_centers[2] self.n_pages = generate_pdf(self.filename, self.center, self.voter_roll, FEMALE) def test_inner_page_content(self): # This doesn't need to be re-tested for copy centers; they only affect the cover page. self.assertTrue(True) class TestCopiedByCenter(TestGeneratePdfBase, GeneratePdfContentTestMixin): """Invoke GeneratePdfContentTestMixin for a copied center. This class uses a center that is copied by other centers in order to exercise the copied_by code branch. """ def setUp(self): super(TestCopiedByCenter, self).setUp() self.center_book = False self.n_voters = 5 self.voter_roll = create_voters(self.n_voters, FEMALE) self.center = self.original_center self.n_pages = generate_pdf(self.filename, self.center, self.voter_roll, FEMALE) def test_inner_page_content(self): # This doesn't need to be re-tested for copy centers; they only affect the cover page. self.assertTrue(True)
SmartElect/SmartElect
rollgen/tests/test_generate_pdf.py
Python
apache-2.0
11,178
using System; using System.Collections.Generic; using System.IO; using System.Linq; using Gate.Middleware; using Gate.Middleware.StaticFiles; using Owin; using System.Threading.Tasks; namespace Owin { using AppFunc = Func<IDictionary<string, object>, Task>; // Serves static files from the given root directory for any matching URLs. public static class StaticExtensions { public static IAppBuilder UseStatic(this IAppBuilder builder, string root, IEnumerable<string> urls) { return builder.UseFunc<AppFunc>(app => Static.Middleware(app, root, urls)); } public static IAppBuilder UseStatic(this IAppBuilder builder, IEnumerable<string> urls) { return builder.UseFunc<AppFunc>(app => Static.Middleware(app, urls)); } public static IAppBuilder UseStatic(this IAppBuilder builder, string root) { return builder.UseFunc<AppFunc>(app => Static.Middleware(app, root)); } public static IAppBuilder UseStatic(this IAppBuilder builder) { return builder.UseFunc<AppFunc>(Static.Middleware); } } } namespace Gate.Middleware { using AppFunc = Func<IDictionary<string, object>, Task>; public class Static { private readonly AppFunc app; private readonly FileServer fileServer; private readonly IEnumerable<string> urls; public Static(AppFunc app, IEnumerable<string> urls) : this(app, null, urls) { } public Static(AppFunc app, string root = null, IEnumerable<string> urls = null) { this.app = app; if (root == null) { root = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "public"); } if (!Directory.Exists(root)) { throw new DirectoryNotFoundException(string.Format("Invalid root directory: {0}", root)); } if (urls == null) { var rootDirectory = new DirectoryInfo(root); var files = rootDirectory.GetFiles("*").Select(fi => "/" + fi.Name); var directories = rootDirectory.GetDirectories().Select(di => "/" + di.Name); urls = files.Concat(directories); } this.urls = urls; fileServer = new FileServer(root); } public static AppFunc Middleware(AppFunc app, string root, IEnumerable<string> urls) { return new Static(app, root, urls).Invoke; } public static AppFunc Middleware(AppFunc app, string root) { return new Static(app, root).Invoke; } public static AppFunc Middleware(AppFunc app, IEnumerable<string> urls) { return new Static(app, urls).Invoke; } public static AppFunc Middleware(AppFunc app) { return new Static(app).Invoke; } public Task Invoke(IDictionary<string, object> env) { var path = env[OwinConstants.RequestPath].ToString(); var method = env[OwinConstants.RequestMethod].ToString(); if (("GET".Equals(method, StringComparison.OrdinalIgnoreCase) || "HEAD".Equals(method, StringComparison.OrdinalIgnoreCase)) && urls.Any(path.StartsWith)) { return fileServer.Invoke(env); } else { return app.Invoke(env); } } } }
owin/museum-piece-gate
src/Main/Gate.Middleware/Static.cs
C#
apache-2.0
3,697
using System; namespace Nest { public abstract class CoordinatedRequestObserverBase<T> : IObserver<T> { private readonly Action<T> _onNext; private readonly Action<Exception> _onError; private readonly Action _completed; protected CoordinatedRequestObserverBase(Action<T> onNext = null, Action<Exception> onError = null, Action completed = null) { _onNext = onNext; _onError = onError; _completed = completed; } public void OnNext(T value) { this._onNext?.Invoke(value); } public void OnError(Exception error) { this._onError?.Invoke(error); } public void OnCompleted() { this._completed?.Invoke(); } } }
TheFireCookie/elasticsearch-net
src/Nest/CommonAbstractions/CoordinatedRequestObserverBase.cs
C#
apache-2.0
664
using System; using UnityEditor; using UnityEngine; namespace UnityShell { [Serializable] public class AutocompleteBox { static class Styles { public const float resultHeight = 20f; public const float resultsBorderWidth = 2f; public const float resultsMargin = 15f; public const float resultsLabelOffset = 2f; public static readonly GUIStyle entryEven; public static readonly GUIStyle entryOdd; public static readonly GUIStyle labelStyle; public static readonly GUIStyle resultsBorderStyle; public static readonly GUIStyle sliderStyle; static Styles() { entryOdd = new GUIStyle("CN EntryBackOdd"); entryEven = new GUIStyle("CN EntryBackEven"); resultsBorderStyle = new GUIStyle("hostview"); labelStyle = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleLeft, richText = true }; sliderStyle = new GUIStyle("MiniSliderVertical"); } } const int HintToNextCompletionHeight = 7; public Action<string> onConfirm; public int maxResults = 10; [SerializeField] public string[] results = new string[0]; [SerializeField] Vector2 scrollPos; [SerializeField] int selectedIndex = -1; [SerializeField] int visualIndex = -1; bool showResults; string searchString; public void Clear() { searchString = ""; showResults = false; } public void OnGUI(string result, Rect rect) { if(results == null) results = new string[0]; if (result != searchString) { selectedIndex = 0; visualIndex = 0; showResults = true; } searchString = result; DoResults(rect); } public void HandleEvents() { if(results.Length == 0) return; var current = Event.current; if (current.type == EventType.KeyDown) { if (current.keyCode == KeyCode.Escape) { showResults = false; } if (current.keyCode == KeyCode.UpArrow) { current.Use(); selectedIndex--; } else if (current.keyCode == KeyCode.DownArrow) { current.Use(); selectedIndex++; } else if(current.keyCode == KeyCode.Return && selectedIndex >= 0) { current.Use(); OnConfirm(results[selectedIndex]); } if (selectedIndex >= results.Length) selectedIndex = 0; else if (selectedIndex < 0) selectedIndex = results.Length - 1; } } void DoResults(Rect drawRect) { if(results.Length <= 0 || !showResults) return; var current = Event.current; drawRect.height = Styles.resultHeight * Mathf.Min(maxResults, results.Length); drawRect.x = Styles.resultsMargin; drawRect.width -= Styles.resultsMargin * 2; drawRect.height += Styles.resultsBorderWidth; var backgroundRect = drawRect; if(results.Length > maxResults) { backgroundRect.height += HintToNextCompletionHeight + Styles.resultsBorderWidth; } GUI.color = new Color(0.78f, 0.78f, 0.78f); GUI.Label(backgroundRect, "", Styles.resultsBorderStyle); GUI.color = Color.white; var elementRect = drawRect; elementRect.x += Styles.resultsBorderWidth; elementRect.width -= Styles.resultsBorderWidth * 2; elementRect.height = Styles.resultHeight; var scrollViewRect = drawRect; scrollViewRect.height = Styles.resultHeight * results.Length; var clipRect = drawRect; clipRect.height += HintToNextCompletionHeight; // to hint for more UpdateVisualIndex(clipRect); var posRect = new Rect(); posRect.yMin = selectedIndex * Styles.resultHeight; posRect.yMax = selectedIndex * Styles.resultHeight + Styles.resultHeight; GUI.BeginClip(clipRect); { elementRect.x = Styles.resultsBorderWidth; elementRect.y = 0; if(results.Length > maxResults) { elementRect.y = -visualIndex * Styles.resultHeight; var maxPos = GetTotalResultsShown(clipRect) * Styles.resultHeight - HintToNextCompletionHeight; if(-elementRect.y > maxPos) { elementRect.y = -maxPos; } } for (var i = 0; i < results.Length; i++) { if(current.type == EventType.Repaint) { var style = i % 2 == 0 ? Styles.entryOdd : Styles.entryEven; style.Draw(elementRect, false, false, i == selectedIndex, false); var labelRect = elementRect; labelRect.x += Styles.resultsLabelOffset; GUI.Label(labelRect, results[i], Styles.labelStyle); } elementRect.y += Styles.resultHeight; } if(results.Length > maxResults) { DrawScroll(clipRect); } } GUI.EndClip(); } void DrawScroll(Rect clipRect) { var scrollRect = clipRect; scrollRect.x += scrollRect.width - 30; scrollRect.y = 0; var resultsShown = GetTotalResultsShown(clipRect); scrollRect.height = ((float) maxResults / resultsShown * clipRect.height); scrollRect.y = ((float) visualIndex / (resultsShown)) * (clipRect.height - scrollRect.height); GUI.Box(scrollRect, GUIContent.none, Styles.sliderStyle); } int GetTotalResultsShown(Rect clipRect) { // Actual scrolling is a bit less as there's also the view itself in which is not scrolled, // when moving down initially, for example. int resultsShown = results.Length; resultsShown -= (int) (clipRect.height / Styles.resultHeight); return resultsShown; } void UpdateVisualIndex(Rect clipRect) { var ySelectedPos = selectedIndex * Styles.resultHeight; var yVisualPos = visualIndex * Styles.resultHeight; var totalHeight = results.Length * Styles.resultHeight; var max = Mathf.Min(clipRect.height, clipRect.height); var min = Math.Min(0, totalHeight - ySelectedPos); var diffMax = ySelectedPos - (yVisualPos + max) + Styles.resultHeight; var diffMin = (yVisualPos + min) - ySelectedPos; if(diffMax > 0) { visualIndex += Mathf.CeilToInt(diffMax / Styles.resultHeight); } else if(diffMin > 0) { visualIndex -= Mathf.CeilToInt(diffMin / Styles.resultHeight); } } void OnConfirm(string result) { if(onConfirm != null) onConfirm(result); RepaintFocusedWindow(); showResults = false; searchString = result; } static void RepaintFocusedWindow() { if(EditorWindow.focusedWindow != null) { EditorWindow.focusedWindow.Repaint(); } } } }
gradylorenzo/Quadrant9
Assets/ThirdParty/UnityShell/Editor/Scripts/AutocompleteBox.cs
C#
apache-2.0
6,207
/** * <p>Title: SubmitterDocument</p> * * <p>Description: this is the data structure for storing the information of a crawled document</p> * * <p>Copyright: Copyright Madian Khabsa @ Penn State(c) 2009</p> * * <p>Company: Penn State</p> * * @author Madian Khabsa * @version 1.0 */ package edu.psu.ist.youseer; public class SubmitterDocument { /** * The binary content of any not text document */ private byte[] ByteContent; /** * The title of the document */ private String Title; /** * i.e. text/html, text/xml ...etc */ private String DataType; /** * The URL of the document */ private String Url; /** * The text content of the file before stripping */ private String RawTextContent; /** * The file content after stripping the HTML tags */ private String StrippedTextContent; /** * offset within the ARC file */ private int Offset; /** * The absolute path of the ARC file that contains this document */ private String ContainingFile; public SubmitterDocument(String Url, String dataType, String containingFile, int recordOffset) { this.Url = Url; this.DataType = dataType; this.Offset = recordOffset; this.ContainingFile = containingFile; } public SubmitterDocument(String Url, String RawTextContent, String dataType, String containingFile, int recordOffset) { this.Url = Url; this.RawTextContent = RawTextContent; this.DataType = dataType; this.Offset=recordOffset; this.ContainingFile=containingFile; } public SubmitterDocument(String Url, byte[] buffer,String dataType, String containingFile,int recordOffset) { this.Url = Url; this.ByteContent = buffer; this.DataType = dataType; this.Offset = recordOffset; this.ContainingFile = containingFile; } public String getRawTextContent() { return RawTextContent; } public void setRawTextContent(String content){ this.RawTextContent = content; } public void setTitle(String Title) { this.Title = Title; } public String getTitle() { return Title; } public void setDataType(String DataType) { this.DataType = DataType; } public String getDataType() { return DataType; } public String getUrl() { return Url; } public void setStrippedTextContent(String StrippedTextContent) { this.StrippedTextContent = StrippedTextContent; } public String getStrippedTextContent() { return StrippedTextContent; } public byte[] getByteContent() { return ByteContent; } public void setByteContent(byte[] buffer) { this.ByteContent = buffer; } public int getOffset() { return Offset; } public String getContainingFile() { return ContainingFile; } }
shiftdirector/youseer
src/main/java/edu/psu/ist/youseer/SubmitterDocument.java
Java
apache-2.0
3,156
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Valency-Changing Operations</title> <link rel="root" href=""/> <!-- for JS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/> <link rel="stylesheet" type="text/css" href="../../css/style.css"/> <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/> <link rel="stylesheet" type="text/css" href="../../css/hint.css"/> <script type="text/javascript" src="../../lib/ext/head.load.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script> <script>document.addEventListener("DOMContentLoaded", function(event) {anchors.add();});</script> <!-- Set up this custom Google search at https://cse.google.com/cse/business/settings?cx=001145188882102106025:dl1mehhcgbo --> <!-- DZ 2021-01-22: I am temporarily hiding the search field to find out whether it slows down loading of the title page. <script> (function() { var cx = '001145188882102106025:dl1mehhcgbo'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> --> <!-- <link rel="shortcut icon" href="favicon.ico"/> --> </head> <body> <div id="main" class="center"> <div id="hp-header"> <table width="100%"><tr><td width="50%"> <span class="header-text"><a href="http://universaldependencies.org/#language-">home</a></span> <span class="header-text"><a href="https://github.com/universaldependencies/docs/edit/pages-source/workgroups/newdoc/valency_changing_operations.md" target="#">edit page</a></span> <span class="header-text"><a href="https://github.com/universaldependencies/docs/issues">issue tracker</a></span> </td><td> <gcse:search></gcse:search> </td></tr></table> </div> <hr/> <div class="v2complete"> This page pertains to UD version 2. </div> <div id="content"> <noscript> <div id="noscript"> It appears that you have Javascript disabled. Please consider enabling Javascript for this page to see the visualizations. </div> </noscript> <!-- The content may include scripts and styles, hence we must load the shared libraries before the content. --> <script type="text/javascript"> console.time('loading libraries'); var root = '../../'; // filled in by jekyll head.js( // External libraries // DZ: Copied from embedding.html. I don't know which one is needed for what, so I'm currently keeping them all. root + 'lib/ext/jquery.min.js', root + 'lib/ext/jquery.svg.min.js', root + 'lib/ext/jquery.svgdom.min.js', root + 'lib/ext/jquery.timeago.js', root + 'lib/ext/jquery-ui.min.js', root + 'lib/ext/waypoints.min.js', root + 'lib/ext/jquery.address.min.js' ); </script> <h1 id="valency-changing-operations">Valency-Changing Operations</h1> <p><span style="color:red">TO DO: This chapter has been created as leftovers from Dan’s original discussion of core vs. oblique. It should be revised.</span></p> <ul> <li><a href="#coding-strategies">Coding strategies</a> <ul> <li><a href="#english">English</a></li> <li><a href="#spanish">Spanish</a></li> <li><a href="#czech">Czech</a></li> <li><a href="#basque">Basque</a></li> <li><a href="#yidiɲ">Yidiɲ</a></li> <li><a href="#tagalog">Tagalog</a></li> <li><a href="#plains-cree">Plains Cree</a></li> </ul> </li> <li><a href="#summary-of-relations">Summary of relations</a></li> </ul> <h2 id="coding-strategies">Coding Strategies</h2> <h3 id="english">English</h3> <p>Transitive clauses (those that have an object) can be passivized, which means:</p> <ol> <li>Active verb form is replaced by passive (finite auxiliary + participle).</li> <li>Former object becomes subject.</li> <li>Former subject either disappears or becomes an oblique argument.</li> </ol> <ul> <li><em>One apple is eaten (by the boy(s)).</em></li> <li><em>Many apples are eaten (by the boy(s)).</em></li> </ul> <pre><code class="language-conllu"># text = One apple is eaten by the boy. 1 One one NUM _ _ 2 nummod _ _ 2 apple apple NOUN _ Number=Sing 4 nsubj:pass _ _ 3 is be AUX _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 4 aux:pass _ _ 4 eaten eat VERB _ Tense=Past|VerbForm=Part 0 root _ _ 5 by by ADP _ _ 7 case _ _ 6 the the DET _ Definite=Def|PronType=Art 7 det _ _ 7 boy boy NOUN _ Number=Sing 4 obl:agent _ SpaceAfter=No 8 . . PUNCT _ _ 4 punct _ _ </code></pre> <p>The inability to passivize of <em>He works the whole week</em> is an argument in support of the claim that the clause is intransitive and <em>the whole week</em> is an adjunct rather than an object. However, this test is not sufficient because there is a small set of verbs that have objects but do not passivize:</p> <ul> <li><em>John has a new car. (*A new car is had by John.)</em></li> <li><em>Friday does not suit me. (*I am not suited by Friday.)</em></li> </ul> <p>Therefore, durational temporal adjuncts have to be stated as an exception, and this is the one case where the argument/adjunct distinction cannot be avoided in UD.</p> <ul> <li><em>He works the whole week.</em></li> </ul> <pre><code class="language-conllu"># text = He works the whole week. 1 He he PRON _ Case=Nom|Gender=Masc|Number=Sing|Person=3|PronType=Prs 2 nsubj _ _ 2 works work VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ _ 3 the the DET _ Definite=Def|PronType=Art 5 det _ _ 4 whole whole ADJ _ _ 5 amod _ _ 5 week week NOUN _ Number=Sing 2 obl:tmod _ SpaceAfter=No 6 . . PUNCT _ _ 2 punct _ _ </code></pre> <p>On the other hand, even temporal noun phrases can be objects if the verb requires an object:</p> <ul> <li><em>He spent the whole week in Oslo.</em></li> </ul> <pre><code class="language-conllu"># text = He spent the whole week in Oslo. 1 He he PRON _ Case=Nom|Gender=Masc|Number=Sing|Person=3|PronType=Prs 2 nsubj _ _ 2 spent spend VERB _ Mood=Ind|Tense=Past|VerbForm=Fin 0 root _ _ 3 the the DET _ Definite=Def|PronType=Art 5 det _ _ 4 whole whole ADJ _ _ 5 amod _ _ 5 week week NOUN _ Number=Sing 2 obj _ _ 6 in in ADP _ _ 7 case _ _ 7 Oslo Oslo PROPN _ Number=Sing 2 obl _ SpaceAfter=No 8 . . PUNCT _ _ 2 punct _ _ </code></pre> <p><span style="color: blue"><b>Joakim:</b> I think word order tests can be used to distinguish these two cases (instead of appealing to the arg/adj distinction):</span></p> <ul> <li><em>John worked the whole week in Paris. John worked in Paris the whole week.</em></li> <li><em>John spent the whole week in Paris. *John spent in Paris the whole week.</em> &lt;/span&gt;</li> </ul> <p><span style="color: green"><b>Dan:</b> In English, yes. But the same adjunct appears in Spanish and Czech too.</span></p> <p>Some English verbs allow two objects (i.e., two core arguments following the verb):</p> <ul> <li><em>Peter gave Kate a book.</em></li> <li><em>Tom teaches me mathematics.</em></li> </ul> <p>The traditional approach outside UD is to call the first object <em>indirect</em> and the second object <em>direct;</em> it is often defined in terms of semantic roles, saying that the recipient is the indirect object. UD avoids referring to semantic roles and says instead that <a href="/u/dep/iobj.html">indirect object</a> is a core argument of the verb that is not its subject or direct <a href="/u/dep/obj.html">object</a>; the (direct) object is then defined as “the second most core argument of a verb after the subject.” In the above examples, the recipient <em>(Kate, me)</em> is arguably more core than the theme <em>(book, mathematics)</em> because the recipient can be promoted in passivization while the theme cannot:</p> <ul> <li><em>Kate was given a book by Peter. (*A book was given Kate by Peter.)</em> <span style="color: orange"><b>Nathan:</b> “A book was given Kate” sounds unusual or archaic but not completely ungrammatical to me. You can find examples on the web of “advice was given him/her”, for example. Some COCA examples: “how do you feel about John Poindexter and the sentence that was given him today?” (1990 spoken), “But when the rooms had been shown and the paper was given him to sign, Frisch hesitated, clutching the pen.” (1990 fiction). Not many COCA examples with by-phrases—only found this one from a 2012 interview with Sarah Palin, who is known for her colorful use of English: “And he got a standing ovation at the end of the speech, and that was given him by those who paid attention and stayed to the end, if you will, and heard what he had to say.” No examples in EWT of a passive verb with <code class="language-plaintext highlighter-rouge">iobj</code>, though.</span></li> <li><em>I am taught mathematics by Tom. (*Mathematics is taught me by Tom.)</em></li> </ul> <p>The second object can be promoted only if both the subject and the first object are recoded as oblique arguments (in the case of <em>to give</em>) or the first object is removed (in the case of <em>to teach</em>):</p> <ul> <li><em>A book was given by Peter to Kate.</em></li> <li><em>Mathematics is taught by Tom. (*Mathematics is taught by Tom to me.)</em></li> </ul> <p>Therefore, the UD v2 guidelines actually require that the second object is labeled <code class="language-plaintext highlighter-rouge">iobj</code>. Yet in the current English data (UD 2.1), it is still the first object that is labeled <code class="language-plaintext highlighter-rouge">iobj</code>, and the second object is <code class="language-plaintext highlighter-rouge">obj</code>. This has to be resolved by either modifying the guidelines, or the data (diverging from what people traditionally understand under indirect object).</p> <pre><code class="language-conllu"># text = Peter gave Kate a book. 1 Peter Peter PROPN _ Number=Sing 2 nsubj _ _ 2 gave give VERB _ Mood=Ind|Tense=Past|VerbForm=Fin 0 root _ _ 3 Kate Kate PROPN _ Number=Sing 2 obj _ _ 4 a a DET _ Definite=Ind|PronType=Art 5 det _ _ 5 book book NOUN _ Number=Sing 2 iobj _ SpaceAfter=No 6 . . PUNCT _ _ 2 punct _ _ </code></pre> <pre><code class="language-conllu"># text = Kate was given a book by Peter. 1 Kate Kate PROPN _ Number=Sing 3 nsubj:pass _ _ 2 was be AUX _ Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 3 aux:pass _ _ 3 given give VERB _ Tense=Past|VerbForm=Part 0 root _ _ 4 a a DET _ Definite=Ind|PronType=Art 5 det _ _ 5 book book NOUN _ Number=Sing 3 iobj _ _ 6 by by ADP _ _ 7 case _ _ 7 Peter Peter PROPN _ Number=Sing 3 obl:agent _ SpaceAfter=No 8 . . PUNCT _ _ 3 punct _ _ </code></pre> <p><span style="color: blue"><b>Joakim:</b> I don’t think this is specified by the v2 guidelines. I tried to argue for it on GitHub, based on syntactic criteria, but people pushed back saying that it is convenient for NLP applications to have the same relation for the recipient role in both cases. This needs to be resolved.</span></p> <p><span style="color:red">TO DO: How do we explain that an oblique nominal is annotated as subject in subordinate infinitival clause, as in <em>It was impossible <b>for him</b> to attend the meeting.</em> Some authors (I do not remember where exactly I saw it) say that it is quite common that core arguments are coded differently in subordinate clauses. But can we prove that the <em>for</em>-phrase is indeed a subject? It is not sufficient to say that it has the same semantic role as the corresponding bare nominal in a main finite clause. If it was sufficient, then the <em>by</em>-phrases in passive clauses would be subjects too!</span></p> <p><span style="color:blue"><b>Joakim:</b> We definitely need to allow different coding in subordinate clauses. That is the rule in languages like Latin and Turkish. But I think we should save this for the section on subordinate clauses.</span></p> <h3 id="spanish">Spanish</h3> <p>The behavior of Spanish core arguments is somewhat similar to English but there are differences. Like in English, it is typical for a core argument to be a bare nominal without preposition. However, prepositions are not completely excluded. If the object is a person, it is marked by the preposition <em>a</em>:</p> <ul> <li><em>Vimos a alguien.</em> “We saw somebody.”</li> </ul> <p>The subject’s person and number is cross-referenced by verbal inflection. Spanish is a pro-drop language, meaning that the subject can be omitted if it is a personal pronoun.</p> <ul> <li><em>(Yo) bebo vino.</em> “I drink wine.”</li> <li><em>(Tú) bebes vino.</em> “You drink wine.” (singular)</li> <li><em>El hombre bebe vino.</em> “The man drinks wine.”</li> <li><em>(Nosotros) bebemos vino.</em> “We drink wine.”</li> <li><em>(Vosotros) bebéis vino.</em> “You drink wine.” (plural)</li> <li><em>Los hombres beben vino.</em> “The men drink wine.”</li> </ul> <pre><code class="language-conllu"># text = Vimos a alguien. # text_en = We saw somebody. 1 Vimos ver VERB _ Mood=Ind|Number=Plur|Person=1|Tense=Imp|VerbForm=Fin 0 root _ Gloss=we-saw 2 a a ADP _ _ 3 case _ Gloss=OBJ 3 alguien alguien PRON _ Number=Sing|PronType=Ind 1 obj _ Gloss=somebody|SpaceAfter=No 4 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = El hombre bebe vino. # text_en = The man drinks wine. 1 El el DET _ Definite=Def|Gender=Masc|Number=Sing|PronType=Art 2 det _ Gloss=the 2 hombre hombre NOUN _ Gender=Masc|Number=Sing 3 nsubj _ Gloss=man 3 bebe beber VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ Gloss=drinks 4 vino vino NOUN _ Gender=Masc|Number=Sing 3 obj _ Gloss=wine|SpaceAfter=No 5 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>If the arguments are realized as personal pronouns, the subject is in the nominative form <em>(yo, tú, él, nosotros, vosotros, ellos)</em> and the object is in the accusative <em>(me, te, lo, nos, os, los).</em> Nouns do not inflect for case in Spanish.</p> <p>If both core arguments are present and if they are realized as full noun phrases, the prototypical word order is the same as in English: the subject precedes the verb and the object follows it. However, if the object is realized as a pronominal clitic (and if the verb is finite indicative), the object precedes the verb.</p> <ul> <li><em>El hombre lo bebe.</em> “The man drinks it.”</li> </ul> <pre><code class="language-conllu"># text = El hombre lo bebe. # text_en = The man drinks it. 1 El el DET _ Definite=Def|Gender=Masc|Number=Sing|PronType=Art 2 det _ Gloss=the 2 hombre hombre NOUN _ Gender=Masc|Number=Sing 4 nsubj _ Gloss=man 3 lo él PRON _ Case=Acc|Gender=Masc|Number=Sing|Person=3|PronType=Prs 4 obj _ Gloss=it 4 bebe beber VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ Gloss=drinks|SpaceAfter=No 5 . . PUNCT _ _ 4 punct _ Gloss=. </code></pre> <p>Transitive clauses (those that have an object) can be passivized.</p> <ul> <li><em>El vino es bebido por los hombres.</em> “The wine is drunk by the men.”</li> <li><em>Las bebidas son bebidas por los hombres.</em> “The drinks are drunk by the men.”</li> </ul> <pre><code class="language-conllu"># text = El vino es bebido por los hombres. # text_en = The wine is drunk by the men. 1 El el DET _ Definite=Def|Gender=Masc|Number=Sing|PronType=Art 2 det _ Gloss=the 2 vino vino NOUN _ Gender=Masc|Number=Sing 4 nsubj:pass _ Gloss=wine|SpaceAfter=No 3 es ser AUX _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 4 aux:pass _ Gloss=is 4 bebido beber VERB _ Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part 0 root _ Gloss=drunk 5 por por ADP _ _ 7 case _ Gloss=by 6 los el DET _ Definite=Def|Gender=Masc|Number=Plur|PronType=Art 7 det _ Gloss=the 7 hombres hombre NOUN _ Gender=Masc|Number=Plur 4 obl:agent _ Gloss=men|SpaceAfter=No 8 . . PUNCT _ _ 4 punct _ Gloss=. </code></pre> <p>Both coding strategies that are used for core arguments can also appear with adjuncts. Bare nominal adjuncts are rare, the exception being durational temporal adjuncts. In contrast, the preposition <em>a</em> can be used with various directional and temporal adjuncts.</p> <ul> <li><em>Él trabaja toda la semana.</em> “He works the whole week.”</li> <li><em>Subiremos al tren a las cinco.</em> “We will be boarding the train at five.”</li> </ul> <pre><code class="language-conllu"># text = Él trabaja toda la semana. # text_en = He works the whole week. 1 Él él PRON _ Case=Nom|Gender=Masc|Number=Sing|Person=3|PronType=Prs 2 nsubj _ Gloss=he 2 trabaja trabajar VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ Gloss=works 3 toda todo DET _ Gender=Fem|Number=Sing|PronType=Tot 5 det _ Gloss=all 4 la el DET _ Definite=Def|Gender=Fem|Number=Sing|PronType=Art 5 det _ Gloss=the 5 semana semana NOUN _ Gender=Fem|Number=Sing 2 obl:tmod _ Gloss=week|SpaceAfter=No 6 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Subiremos al tren a las cinco. # text_en = We will be boarding the train at five. 1 Subiremos subir VERB _ Mood=Ind|Number=Plur|Person=1|Tense=Fut|VerbForm=Fin 0 root _ Gloss=we-will-board 2-3 al _ _ _ _ _ _ _ _ 2 a a ADP _ _ 4 case _ Gloss=on 3 el el DET _ Definite=Def|Gender=Masc|Number=Sing|PronType=Art 4 det _ Gloss=the 4 tren tren NOUN _ Gender=Masc|Number=Sing 1 obl _ Gloss=train 5 a a ADP _ _ 7 case _ Gloss=at 6 las el DET _ Definite=Def|Gender=Fem|Number=Plur|PronType=Art 7 det _ Gloss=the 7 cinco cinco NUM _ NumType=Card 1 obl:tmod _ Gloss=five|SpaceAfter=No 8 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <p>Neither <em>toda la semana</em> nor <em>al tren</em> or <em>a las cinco</em> can be promoted via passivization.</p> <p>Some Spanish verbs allow two objects:</p> <ul> <li><em>Pedro dio un libro a Isabel.</em> “Pedro gave Isabel a book.”</li> <li><em>Pedro le dio un libro a Isabel.</em> “Pedro gave Isabel a book.”</li> <li><em>Pedro le dio un libro.</em> “Pedro gave her a book.”</li> <li><em>Santiago me enseña las matemáticas.</em> “Santiago teaches me mathematics.”</li> </ul> <p>One of the objects typically corresponds to the recipient semantic role and it most likely refers to a person, therefore it will be marked by the preposition <em>a</em> (if it is realized as a full noun phrase). If it is represented by a pronominal clitic, it will be in the dative form (identical with the accusative except for the third person, which is <em>le, les,</em> and does not distinguish gender). It is not uncommon that both the noun phrase and the clitic are present, as in <em>Pedro <b>le</b> dio un libro <b>a Isabel</b>.</em> (this is known as “clitic doubling”).</p> <pre><code class="language-conllu"># text = Pedro le dio un libro a Isabel. # text_en = Pedro gave Isabel a book. 1 Pedro Pedro PROPN _ Gender=Masc|Number=Sing 3 nsubj _ Gloss=Pedro 2 le él PRON _ Case=Dat|Number=Sing|Person=3|PronType=Prs 3 expl _ Gloss=her 3 dio dar VERB _ Mood=Ind|Tense=Past|VerbForm=Fin 0 root _ Gloss=gave 4 un un DET _ Definite=Ind|Gender=Masc|Number=Sing|PronType=Art 5 det _ Gloss=a 5 libro libro NOUN _ Gender=Masc|Number=Sing 3 obj _ Gloss=book 6 a a ADP _ _ 7 case _ Gloss=to 7 Isabel Isabel PROPN _ Gender=Fem|Number=Sing 3 iobj _ Gloss=Isabel|SpaceAfter=No 8 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Pedro le dio un libro. # text_en = Pedro gave her a book. 1 Pedro Pedro PROPN _ Gender=Masc|Number=Sing 3 nsubj _ Gloss=Pedro 2 le él PRON _ Case=Dat|Number=Sing|Person=3|PronType=Prs 3 iobj _ Gloss=her 3 dio dar VERB _ Mood=Ind|Tense=Past|VerbForm=Fin 0 root _ Gloss=gave 4 un un DET _ Definite=Ind|Gender=Masc|Number=Sing|PronType=Art 5 det _ Gloss=a 5 libro libro NOUN _ Gender=Masc|Number=Sing 3 obj _ Gloss=book|SpaceAfter=No 6 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>The object that is marked by the preposition <em>a</em> or by the dative case of the pronoun (i.e., the one with the recipient role) is labeled as an indirect object; the unmarked/accusative object is direct. This is in line with the UD v2 guidelines: if the clause is passivized, the direct object is promoted to the subject relation, while the indirect object stays untouched. Hence the indirect object is less core than the direct object.</p> <ul> <li><em>Un libro fue dado a Isabel por Pedro.</em> “A book was given to Isabel by Pedro.”</li> </ul> <pre><code class="language-conllu"># text = Un libro fue dado a Isabel por Pedro. # text_en = A book was given to Isabel by Pedro. 1 Un un DET _ Definite=Ind|Gender=Masc|Number=Sing|PronType=Art 2 det _ Gloss=a 2 libro libro NOUN _ Gender=Masc|Number=Sing 4 nsubj:pass _ Gloss=book 3 fue ser AUX _ Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 4 aux:pass _ Gloss=was 4 dado dar VERB _ Gender=Masc|Number=Sing|Tense=Past|VerbForm=Part 0 root _ Gloss=given 5 a a ADP _ _ 6 case _ Gloss=to 6 Isabel Isabel PROPN _ Gender=Fem|Number=Sing 4 iobj _ Gloss=Isabel 7 por por ADP _ _ 8 case _ Gloss=by 8 Pedro Pedro PROPN _ Gender=Masc|Number=Sing 4 obl:agent _ Gloss=Pedro|SpaceAfter=No 9 . . PUNCT _ _ 4 punct _ Gloss=. </code></pre> <p><span style="color: blue"><b>Joakim:</b> Why do we treat the recipient as core in Spanish but not in English when they both have prepositions? Is this because prepositions are found with direct objects in Spanish but not in English? And what would we then do in French, where the recipient takes a prepositions but where prepositions are never used with prepositions? Same as English? It would also be possible (at least in French) to argue for a mixed system, where full noun phrases are oblique (because they take a preposition) but pronouns are core (because they have dative case).</span></p> <h3 id="czech">Czech</h3> <p>Classification of verbal arguments in Czech depends on <a href="/u/feat/Case.html">case morphology</a>. There are certain anomalies of the case system when the argument is a quantified phrase (with a cardinal number or a pronominal quantifier, the head noun may have different case than the entire phrase). We exclude quantified phrases from the following overview.</p> <p>The coding strategy most typical for Czech core arguments is bare noun phrase in nominative or accusative. Some authors claim that core arguments are not marked for case. This is not true and Czech is one of the counter-examples. The nominative can be considered unmarked in the vague sense that it is the default case that is used if there are no external factors requiring another case. However, it is not unmarked in the morphological sense: many nouns must use suffixes to form the nominative (and the same holds for the accusative).</p> <p>The nominative argument is the subject, the accusative is object. The subject’s person, number, and sometimes also gender and animacy are cross-referenced by verbal inflection. Czech is a pro-drop language, meaning that the subject can be omitted if it is a personal pronoun.</p> <ul> <li><em>Snědl jsem jablko.</em> “I ate an apple.” (masculine)</li> <li><em>Snědla jsem jablko.</em> “I ate an apple.” (feminine)</li> <li><em>Snědl jsi jablko.</em> “You ate an apple.” (masculine singular)</li> <li><em>Snědla jsi jablko.</em> “You ate an apple.” (feminine singular)</li> <li><em>Chlapec snědl jablko.</em> “The boy ate an apple.”</li> <li><em>Snědl jablko.</em> “He ate an apple.”</li> <li><em>Snědla jablko.</em> “She ate an apple.”</li> <li><em>Snědlo jablko.</em> “It ate an apple.”</li> <li><em>Snědli jsme jablko.</em> “We ate an apple.” (masculine animate)</li> <li><em>Snědly jsme jablko.</em> “We ate an apple.” (feminine)</li> <li><em>Snědli jste jablko.</em> “You ate an apple.” (masculine animate plural)</li> <li><em>Snědly jste jablko.</em> “You ate an apple.” (feminine plural)</li> <li><em>Snědli jablko.</em> “They ate an apple.” (masculine animate)</li> <li><em>Snědly jablko.</em> “They ate an apple.” (feminine or masculine inanimate)</li> <li><em>Snědla jablko.</em> “They ate an apple.” (neuter)</li> </ul> <pre><code class="language-conllu"># text = Chlapec snědl jablko. # text_en = The boy ate an apple. 1 Chlapec chlapec NOUN _ Animacy=Anim|Case=Nom|Gender=Masc|Number=Sing|Polarity=Pos 2 nsubj _ Gloss=boy 2 snědl sníst VERB _ Gender=Masc|Number=Sing|Polarity=Pos|Tense=Past|VerbForm=Part 0 root _ Gloss=eaten 3 jablko jablko NOUN _ Case=Acc|Gender=Neut|Number=Sing|Polarity=Pos 2 obj _ Gloss=apple|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ _ </code></pre> <p>Czech word order is free and while the SVO order is preferred by default, other permutations are possible and may be required to distinguish topic and focus.</p> <ul> <li><em>Chlapec snědl jablko.</em> “The/a boy ate an apple.”</li> <li><em>Jablko snědl chlapec.</em> “It was a/the boy who ate the apple.”</li> <li><em>Chlapec jablko snědl.</em> “What the boy did to the apple was that he ate it.”</li> <li><em>Jablko chlapec snědl.</em> “As for the apple, what the boy did to it was that he ate it.”</li> <li><em>Snědl chlapec jablko.</em> “A boy ate an apple.”</li> <li><em>Snědl jablko chlapec.</em> “A boy ate an apple.” (Most unusual order but not impossible.)</li> </ul> <p>Transitive clauses (those that have an accusative object) can be passivized.</p> <ul> <li><em>Jablko bylo snědeno chlapcem.</em> “The apple was eaten by the boy.”</li> <li><em>Jablka byla snědena chlapcem.</em> “The apples were eaten by the boy.”</li> </ul> <pre><code class="language-conllu"># text = Jablko bylo snědeno chlapcem. # text_en = The apple was eaten by the boy. 1 Jablko jablko NOUN _ Case=Nom|Gender=Neut|Number=Sing|Polarity=Pos 3 nsubj:pass _ Gloss=apple 2 bylo být AUX _ Gender=Neut|Number=Sing|Tense=Past|VerbForm=Part 3 aux:pass _ Gloss=was 3 snědeno snědený ADJ _ Case=Nom|Gender=Neut|Number=Sing|Polarity=Pos|Variant=Short|VerbForm=Part|Voice=Pass 0 root _ Gloss=eaten 4 chlapcem chlapec NOUN _ Animacy=Anim|Case=Ins|Gender=Masc|Number=Sing|Polarity=Pos 3 obl:agent _ Gloss=by-boy|SpaceAfter=No 5 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>There are a few verbs with accusative objects that cannot passivize, for instance:</p> <ul> <li><em>Chlapec dostal čokoládu.</em> “The boy got chocolate.” <em>(*Čokoláda byla dostána chlapcem.)</em></li> <li><em>Chlapec má čokoládu.</em> “The boy has chocolate.” <em>(*Čokoláda je mána chlapcem.)</em></li> </ul> <p>It is not guaranteed that a bare accusative nominal is a core argument. It can also be a durational temporal adjunct, as in:</p> <ul> <li><em>Pracuje celý týden.</em> “He works the whole week.”</li> </ul> <pre><code class="language-conllu"># text = Pracuje celý týden. # text_en = He works the whole week. 1 Pracuje pracovat VERB _ Mood=Ind|Number=Sing|Person=3|Polarity=Pos|Tense=Pres|VerbForm=Fin 0 root _ Gloss=works 2 celý celý ADJ _ Animacy=Inan|Case=Acc|Degree=Pos|Gender=Masc|Number=Sing|Polarity=Pos 3 amod _ Gloss=whole 3 týden týden NOUN _ Animacy=Inan|Case=Acc|Gender=Masc|Number=Sing|Polarity=Pos 1 obl:tmod _ Gloss=week|SpaceAfter=No 4 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <p>The nominal <em>celý týden</em> cannot be promoted to subject via passivization, which supports the claim that it is not an object; however, this test is not sufficient because of the exceptional verbs like <em>dostat</em> “to get” and <em>mít</em> “to have”. Therefore, durational temporal adjuncts have to be stated as an exception and the argument/adjunct distinction cannot be avoided in this case.</p> <p>Many two-argument verbs in Czech specify the second argument as a bare noun phrase in a case other than accusative. Whether these arguments are core arguments is a point of disagreement among different authors. The current (UD 2.1) approach in UD for Czech and several similar Indo-European languages is to analyze them as core.</p> <p>Some of the verbs resemble prototypical transitive verbs in that their arguments have the roles of agent and patient. For instance, the verb <em>pomoci</em> “to help” takes a dative argument:</p> <ul> <li><em>Zuzka pomohla Martinovi s domácím úkolem.</em> “Zuzka helped Martin with his homework.”</li> </ul> <p>The clause can be passivized. However, the dative argument is not promoted by the passivization to the subject relation. It stays in dative and the verb does not cross-reference its person, number or gender. Instead, verbal morphology switches to the default singular neuter agreement with unexpressed subject. This suggests that the dative argument is less core-like (if at all) than a standard accusative object.</p> <ul> <li><em>Martinovi bylo pomoženo s domácím úkolem.</em> “Martin was helped with his homework.” <em>(*Martin byl pomožen s domácím úkolem.)</em></li> </ul> <pre><code class="language-conllu"># text = Zuzka pomohla Martinovi s domácím úkolem. # text_en = Zuzka helped Martin with his homework. 1 Zuzka Zuzka PROPN _ Case=Nom|Gender=Fem|Number=Sing|Polarity=Pos 2 nsubj _ Gloss=Zuzka 2 pomohla pomoci VERB _ Gender=Fem|Number=Sing|Polarity=Pos|Tense=Past|VerbForm=Part 0 root _ Gloss=helped 3 Martinovi Martin PROPN _ Animacy=Anim|Case=Dat|Gender=Masc|Number=Sing|Polarity=Pos 2 obj _ Gloss=Martin 4 s s ADP _ _ 6 case _ Gloss=with 5 domácím domácí ADJ _ Animacy=Inan|Case=Ins|Degree=Pos|Gender=Masc|Number=Sing|Polarity=Pos 6 amod _ Gloss=home 6 úkolem úkol NOUN _ Animacy=Inan|Case=Ins|Gender=Masc|Number=Sing|Polarity=Pos 2 obl:arg _ Gloss=work|SpaceAfter=No 7 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Martinovi bylo pomoženo s domácím úkolem. # text_en = Martin was helped with his homework. 1 Martinovi Martin PROPN _ Animacy=Anim|Case=Dat|Gender=Masc|Number=Sing|Polarity=Pos 3 obj _ Gloss=Martin 2 bylo být AUX _ Gender=Neut|Number=Sing|Polarity=Pos|Tense=Past|VerbForm=Part 3 aux:pass _ Gloss=was 3 pomoženo pomožený ADJ _ Gender=Neut|Number=Sing|Polarity=Pos|Variant=Short|VerbForm=Part|Voice=Pass 0 root _ Gloss=helped 4 s s ADP _ _ 6 case _ Gloss=with 5 domácím domácí ADJ _ Animacy=Inan|Case=Ins|Degree=Pos|Gender=Masc|Number=Sing|Polarity=Pos 6 amod _ Gloss=home 6 úkolem úkol NOUN _ Animacy=Inan|Case=Ins|Gender=Masc|Number=Sing|Polarity=Pos 3 obl:arg _ Gloss=work|SpaceAfter=No 7 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>If dative arguments are core objects, then we may want to distinguish them from benefactive adjuncts that are also encoded as bare nominals in the dative (that is, if we acknowledge that benefactives should be adjuncts):</p> <ul> <li><em>Zuzka Martinovi udělala večeři.</em> “Zuzka prepared a dinner for Martin.”</li> <li><em>Zuzka Martinovi koupila večeři.</em> “Zuzka bought a dinner for Martin.”</li> <li><em>Zuzka Martinovi objednala večeři.</em> “Zuzka ordered a dinner for Martin.”</li> <li><em>Zuzka Martinovi snědla večeři.</em> “Zuzka ate Martin’s dinner.”</li> </ul> <p><span style="color: blue"><b>Joakim:</b> If benefactives and datives have the same encoding, perhaps they should both be regarded as oblique (to facilitate annotation).</span></p> <p>Similarly, there are objects realized as bare genitives and even instrumentals, with the same passivization pattern as datives. Instrumental objects have to be distinguished from demoted oblique agents in passive constructions, and from instrumental adjuncts.</p> <ul> <li><em>Novináři musí dbát zásad objektivity.</em> “Journalists must observe principles of objectivity.” (genitive)</li> <li><em>Musí být dbáno zásad objektivity.</em> “Principles of objectivity must be observed.”</li> <li><em>Karel hýbal nábytkem.</em> “Karel moved furniture.” (instrumental)</li> <li><em>Nábytkem bylo hýbáno.</em> “The furniture has been moved.”</li> </ul> <p>The Czech grammar also recognizes prepositional objects but we do not consider them core (which means they are not objects in UD). In fact, the definition of object in the Czech grammar is identical with argument and leads to the argument/adjunct distinction, disfavored in UD. Most adjuncts are prepositional phrases, thus the bulk of the decisions would have to be done for prepositional phrases; that is the main reason why bare datives are analyzed as core objects while prepositional phrases are not. It is worth noting that the neuter singular passivization that is described above for bare datives, genitives and instrumentals is also available for prepositional phrases and even for some intransitive verbs, although such constructions are rare:</p> <ul> <li><em>Spoléhali na ředitelovo rozhodnutí.</em> “They relied on the director’s decision.”</li> <li><em>Na ředitelovo rozhodnutí bylo spoléháno.</em> “It was relied on the director’s decision.”</li> <li><em>Ředitel rozhodl v pátek.</em> “The director decided on Friday.”</li> <li><em>V pátek bylo rozhodnuto.</em> “It was decided on Friday.”</li> </ul> <p>Some Czech verbs allow two objects. Typically, one object is accusative and the other is dative; nevertheless, some other combinations are possible, too.</p> <ul> <li><em>Petr dal Katce knihu.</em> “Petr gave Katka a book.” (dative + accusative)</li> <li><em>Tomáš mě učí matematiku.</em> “Tomáš teaches me mathematics.” (accusative + accusative)</li> <li><em>Muž vyhrožoval sousedovi smrtí.</em> “A man threatened his neighbor with death.” (dative + instrumental)</li> </ul> <p>The dative-accusative construction can be passivized so that the accusative object is promoted to subject, the dative object stays as it is, and the former subject disappears (or, rarely, is transformed to instrumental). It is thus confirmed that the dative object is less core than the accusative, hence the dative should be labeled as indirect.</p> <ul> <li><em>Kniha byla dána Katce (Petrem).</em> “The book was given to Katka (by Petr).”</li> </ul> <p>The verb <em>učit</em> “to teach” is special in that it allows two accusatives: one representing the theme (mathematics) and the other the recipient (me). Either one can be omitted and then we have a normal transitive clause with an accusative object that can be promoted via passivization. However, if both arguments are present in the active clause, it is not possible to promote one of them and leave the other untouched; the grammar does not tolerate a bare accusative argument in a passive clause. Also note that there is a slightly archaic alternative where the theme (not the recipient!) takes the dative form. Here the passive might in theory be available but it still sounds clumsy.</p> <ul> <li><em>Tomáš učí matematiku.</em> “Tomáš teaches mathematics.”</li> <li><em>Matematika je učena Tomášem.</em> “Mathematics is taught by Tomáš.”</li> <li><em>Tomáš mě učí.</em> “Tomáš teaches me.”</li> <li><em>(Já) jsem učen Tomášem.</em> “I am taught by Tomáš.”</li> <li><em>Tomáš mě učí matematiku.</em> “Tomáš teaches me mathematics.”</li> <li><em>(*Jsem učen matematiku Tomášem. *Matematika je učena mě Tomášem.)</em></li> <li><em>Tomáš mě učí matematice.</em> “Tomáš teaches me mathematics.” (mathematics in dative)</li> <li><em>(?Jsem učen matematice (Tomášem).)</em> “I am taught mathematics (by Tomáš).”</li> </ul> <p>There thus does not seem to be any evidence that one of the accusatives is more core than the other. We have an example of a clause with two objects, neither of which is indirect.</p> <p>Finally, in the dative-instrumental construction, the passivization follows rules similar to clauses with one non-accusative object: former subject disappears but the objects stay untouched. Moreover, if the subject is not removed but transformed to an instrumental argument, it is likely that the original instrumental argument will be removed instead. Yet it is not completely ungrammatical to keep them both (see the example below; but it is highly preferred that the two instrumental arguments are not adjacent).</p> <ul> <li><em>Muž vyhrožoval sousedovi smrtí.</em> “A man threatened his neighbor with death.”</li> <li><em>Sousedovi bylo vyhrožováno smrtí.</em> “The neighbor was threatened with death.”</li> <li><em>Sousedovi bylo vyhrožováno mužem.</em> “The neighbor was threatened by the man.”</li> <li><em>Mužem bylo sousedovi vyhrožováno smrtí.</em> “The neighbor was threatened by the man with death.”</li> </ul> <p>The dative-instrumental construction is one where both objects are clearly less core than accusative objects, but none of the two is more or less core than the other. Therefore, none of them can be labeled as indirect.</p> <ul> <li><em>Petr dal Katce knihu.</em> “Petr gave Katka a book.”</li> </ul> <pre><code class="language-conllu"># text = Petr dal Katce knihu. # text_en = Petr gave Katka a book. 1 Petr Petr PROPN _ Animacy=Anim|Case=Nom|Gender=Masc|Number=Sing|Polarity=Pos 2 nsubj _ Gloss=Petr 2 dal dát VERB _ Animacy=Anim|Gender=Masc|Number=Sing|Polarity=Pos|Tense=Past|VerbForm=Part 0 root _ Gloss=gave 3 Katce Katka PROPN _ Case=Dat|Gender=Fem|Number=Sing|Polarity=Pos 2 iobj _ Gloss=to-Katka 4 knihu kniha NOUN _ Case=Acc|Gender=Fem|Number=Sing|Polarity=Pos 2 obj _ Gloss=book|SpaceAfter=No 5 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <ul> <li><em>Kniha byla dána Katce Petrem.</em> “The book was given to Katka by Petr.”</li> </ul> <pre><code class="language-conllu"># text = Kniha byla dána Katce Petrem. # text_en = The book was given to Katka by Petr. 1 Kniha kniha NOUN _ Case=Nom|Gender=Fem|Number=Sing|Polarity=Pos 3 nsubj:pass _ Gloss=book 2 byla být AUX _ Gender=Fem|Number=Sing|Polarity=Pos|Tense=Past|VerbForm=Part 3 aux:pass _ Gloss=was 3 dána daný ADJ _ Gender=Fem|Number=Sing|Polarity=Pos|Variant=Short|VerbForm=Part|Voice=Pass 0 root _ Gloss=given 4 Katce Katka PROPN _ Case=Dat|Gender=Fem|Number=Sing|Polarity=Pos 3 iobj _ Gloss=to-Katka 5 Petrem Petr PROPN _ Animacy=Anim|Case=Ins|Gender=Masc|Number=Sing|Polarity=Pos 3 obl:agent _ Gloss=by-Petr|SpaceAfter=No 6 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <ul> <li><em>Tomáš mě učí matematiku.</em> “Tomáš teaches me mathematics.”</li> </ul> <pre><code class="language-conllu"># text = Tomáš mě učí matematiku. # text_en = Tomáš teaches me mathematics. 1 Tomáš Tomáš PROPN _ Animacy=Anim|Case=Nom|Gender=Masc|Number=Sing|Polarity=Pos 3 nsubj _ Gloss=Tomáš 2 mě já PRON _ Case=Acc|Number=Sing|Person=1|PronType=Prs|Variant=Short 3 obj _ Gloss=me 3 učí učit VERB _ Mood=Ind|Number=Sing|Person=3|Polarity=Pos|Tense=Pres|VerbForm=Fin 0 root _ Gloss=teaches 4 matematiku matematika NOUN _ Case=Acc|Gender=Fem|Number=Sing|Polarity=Pos 3 obj _ Gloss=mathematics|SpaceAfter=No 5 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <h3 id="basque">Basque</h3> <p>See also: Fernando Zúñiga, Beatriz Fernández (draft 26.6.2014): <a href="http://basdisyn.net/pdf/Zuniga%20&amp;%20Fernandez%202014%20Basque%20GRs%20270614.pdf">Grammatical relations in Basque</a></p> <p>In Basque, like in Czech, nominal case morphology is essential for recognition of core argument relations. However, instead of nominative-accusative, the core pair of cases in Basque is ergative-absolutive. Most two-argument verbs have one argument in the ergative and the other in the absolutive case (but see below for other possibilities). The ergative argument is labeled as subject, the absolutive argument is object. With primary transitive verbs, the ergative argument corresponds to the agent and the absolutive argument to the patient.</p> <ul> <li><em>Ekaitzak itsasontzia hondoratu du.</em> “The storm has sunk the ship.”</li> </ul> <pre><code class="language-conllu"># text = Ekaitzak itsasontzia hondoratu du. # text_en = The storm has sunk the ship. 1 Ekaitzak ekaitz NOUN _ Animacy=Inan|Case=Erg|Definite=Def|Number=Sing 3 nsubj _ Gloss=storm 2 itsasontzia itsasontzi NOUN _ Animacy=Inan|Case=Abs|Definite=Def|Number=Sing 3 obj _ Gloss=ship 3 hondoratu hondoratu VERB _ Aspect=Perf|VerbForm=Part 0 root _ Gloss=sunk 4 du *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[erg]=Sing|Person[abs]=3|Person[erg]=3|VerbForm=Fin 3 aux _ Gloss=has|SpaceAfter=No 5 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>The single argument of intransitive verbs takes mostly the absolutive but sometimes the ergative form. It is labeled as subject in both cases.</p> <ul> <li><em>Gizona hil da.</em> “The man has died.” (absolutive)</li> </ul> <pre><code class="language-conllu"># text = Gizona hil da. # text_en = The man has died. 1 Gizona gizon NOUN _ Animacy=Anim|Case=Abs|Definite=Def|Number=Sing 2 nsubj _ Gloss=the-man 2 hil hil VERB _ Aspect=Perf|VerbForm=Part 0 root _ Gloss=died 3 da izan AUX _ Aspect=Prog|Mood=Ind|Number[abs]=Sing|Person[abs]=3|VerbForm=Fin 2 aux _ Gloss=has|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <ul> <li><em>Urak irakin du.</em> “The water has boiled.” (ergative)</li> </ul> <pre><code class="language-conllu"># text = Urak irakin du. # text_en = The water has boiled. 1 Urak ura NOUN _ Animacy=Inan|Case=Erg|Definite=Ind|Number=Sing 2 nsubj _ Gloss=water 2 irakin irakin VERB _ Aspect=Perf|VerbForm=Part 0 root _ Gloss=boiled 3 du *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[erg]=Sing|Person[abs]=3|Person[erg]=3|VerbForm=Fin 2 aux _ Gloss=has|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <p>The third core case is the dative. Arguments in all three core cases are cross-referenced on finite verbs. Thanks to cross-referencing, the arguments can be omitted if they are just personal pronouns.</p> <p>Some two-argument verbs take dative+absolutive, instead of ergative+absolutive:</p> <ul> <li><em>(Niri) ardoa gustatzen zait.</em> “I like wine.” (lit. “To-me the-wine pleasing is.”)</li> </ul> <pre><code class="language-conllu"># text = Niri ardoa gustatzen zait. # text_en = I like wine. 1 Niri ni PRON _ Case=Dat|Number=Sing|Person=1|PronType=Prs 3 nsubj _ Gloss=to-me 2 ardoa ardo NOUN _ Animacy=Inan|Case=Abs|Definite=Def|Number=Sing 3 obj _ Gloss=wine 3 gustatzen gustatzen VERB _ Aspect=Imp|VerbForm=Part 0 root _ Gloss=pleasing 4 zait izan AUX _ Mood=Ind|Number[abs]=Sing|Number[dat]=Sing|Person[abs]=3|Person[dat]=1|VerbForm=Fin 3 aux _ Gloss=is|SpaceAfter=No 5 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>In the current data (UD 2.1), the dative argument seems to be labeled <code class="language-plaintext highlighter-rouge">iobj</code> even in dative-absolutive constructions. However, Zúñiga and Fernández (2014) write that the dative encodes the A function in such constructions; that would mean that it should be <code class="language-plaintext highlighter-rouge">nsubj</code>.</p> <p>Some two-argument verbs take ergative+dative, instead of ergative+absolutive:</p> <ul> <li><em>Irakasleak haserre begiratu die ikasleei.</em> “The teacher has looked angrily at the students.”</li> </ul> <pre><code class="language-conllu"># text = Irakasleak haserre begiratu die ikasleei # text_en = The teacher has looked angrily at the students. 1 Irakasleak irakasle NOUN _ Animacy=Anim|Case=Erg|Definite=Def|Number=Sing 3 nsubj _ Gloss=the-teacher 2 haserre haserre ADV _ _ 3 advmod _ Gloss=angrily 3 begiratu begiratu VERB _ Aspect=Perf|VerbForm=Part 0 root _ Gloss=looked 4 die *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[dat]=Plur|Number[erg]=Sing|Person[abs]=3|Person[dat]=3|Person[erg]=3|VerbForm=Fin 3 aux _ Gloss=has 5 ikasleei ikasle NOUN _ Animacy=Anim|Case=Dat|Definite=Def|Number=Plur 3 obj _ Gloss=to-students|SpaceAfter=No 6 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>In the current data (UD 2.1), the dative argument seems to be labeled <code class="language-plaintext highlighter-rouge">iobj</code> even in ergative-dative constructions. However, Zúñiga and Fernández (2014) write that the dative encodes the P function in such constructions; that would mean that it should be <code class="language-plaintext highlighter-rouge">obj</code>.</p> <p>There are verbs that take all three core arguments. In such constructions, the ergative encodes the A function, absolutive the P function (also T function = theme-like), and dative the G function (goal). In terms of dependency relations, it seems reasonable to label the ergative as <code class="language-plaintext highlighter-rouge">nsubj</code>, absolutive as <code class="language-plaintext highlighter-rouge">obj</code> and dative as <code class="language-plaintext highlighter-rouge">iobj</code> just to distinguish them and to acknowledge that absolutives and ergatives are more frequent than datives; though the grammar does not seem to target the absolutive argument in specific rules, which would make it more core-like than the dative.</p> <ul> <li><em>(Nik) (zuri) liburua eman dizut.</em> “I have given you a book.”</li> </ul> <pre><code class="language-conllu"># text = Nik zuri liburua eman dizut. # text_en = I have given you a book. 1 Nik ni PRON _ Case=Erg|Number=Sing|Person=1|PronType=Prs 4 nsubj _ Gloss=I 2 zuri zu PRON _ Case=Dat|Number=Sing|Person=2|PronType=Prs 4 iobj _ Gloss=you 3 liburua liburu NOUN _ Animacy=Inan|Case=Abs|Definite=Def|Number=Sing 4 obj _ Gloss=book 4 eman eman VERB _ Aspect=Perf|VerbForm=Part 0 root _ Gloss=given 5 dizut *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[dat]=Sing|Number[erg]=Sing|Person[abs]=3|Person[dat]=2|Person[erg]=1|VerbForm=Fin 4 aux _ Gloss=have|SpaceAfter=No 6 . . PUNCT _ _ 4 punct _ Gloss=. </code></pre> <ul> <li><em>Zezenak saihetsa pitzatu zidan.</em> “The bull cracked my rib.” (ergative argument: 3 singular; absolutive argument: 3 singular; dative argument: 1 singular)</li> </ul> <pre><code class="language-conllu"># sent_id = test-s452 # text = Zezenak saihetsa pitzatu zidan. # text_en = The bull cracked my rib. 1 Zezenak zezen NOUN _ Animacy=Anim|Case=Erg|Definite=Def|Number=Sing 3 nsubj _ Gloss=bull 2 saihetsa saihets NOUN _ Animacy=Inan|Case=Abs|Definite=Def|Number=Sing 3 obj _ Gloss=rib 3 pitzatu pitzatu VERB _ Aspect=Perf|VerbForm=Part 0 root _ Gloss=cracked 4 zidan *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[dat]=Sing|Number[erg]=Sing|Person[abs]=3|Person[dat]=1|Person[erg]=3|VerbForm=Fin 3 aux _ Gloss=has-to-me|SpaceAfter=No 5 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>Basque does not have a canonical passive construction, although there are constructions that have been called passive by some authors in the past.</p> <p>While the passive, if it existed, would decrease the valency of the verb, there is another operation that increases the valency: the causative:</p> <ol> <li>Active verb form is replaced by causative.</li> <li>Former subject becomes dative object and denotes the causee.</li> <li>A new ergative subject appears and denotes the causer.</li> </ol> <p>Analogically to the passive, it is recommended that the relations with modified interpretation (if overtly present) are labeled as subtypes: the causer as <a href="/fr/dep/nsubj-caus.html">nsubj:caus</a> and the true agent as <a href="/fr/dep/iobj-agent.html">iobj:agent</a>.</p> <ul> <li><em>(Guk) arazo hau ikusi genuen.</em> “We have seen this problem.” (active)</li> <li><em>(Horiek) (guri) arazo hau ikuserazi digute.</em> “They have made us see this problem.” (causative)</li> </ul> <pre><code class="language-conllu"># text = Guk arazo hau ikusi genuen. # text_en = We have seen this problem. 1 Guk gu PRON _ Case=Erg|Number=Plur|Person=1|PronType=Prs 4 nsubj _ Gloss=we 2 arazo arazo NOUN _ Animacy=Inan|Case=Abs|Definite=Ind|Number=Sing 4 obj _ Gloss=problem 3 hau hau DET _ Case=Abs|Definite=Def|Number=Sing|PronType=Dem 2 det _ Gloss=this 4 ikusi ikusi VERB _ Aspect=Perf|VerbForm=Part 0 root _ Gloss=seen 5 genuen *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[erg]=Plur|Person[abs]=3|Person[erg]=1|VerbForm=Fin 4 aux _ Gloss=have|SpaceAfter=No 6 . . PUNCT _ _ 4 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Horiek guri arazo hau ikuserazi digute. # text_en = They have made us see this problem. 1 Horiek horiek DET _ Case=Erg|Definite=Def|Number=Plur|PronType=Dem 5 nsubj:caus _ Gloss=they 2 guri gu PRON _ Case=Dat|Number=Plur|Person=1|PronType=Prs 5 iobj:agent _ Gloss=us 3 arazo arazo NOUN _ Animacy=Inan|Case=Abs|Definite=Ind|Number=Sing 5 obj _ Gloss=problem 4 hau hau DET _ Case=Abs|Definite=Def|Number=Sing|PronType=Dem 3 det _ Gloss=this 5 ikuserazi ikusi VERB _ Aspect=Perf|VerbForm=Part|Voice=Cau 0 root _ Gloss=made-to-see 6 digute *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[dat]=Plur|Number[erg]=Plur|Person[abs]=3|Person[dat]=1|Person[erg]=3|VerbForm=Fin 5 aux _ Gloss=have|SpaceAfter=No 7 . . PUNCT _ _ 5 punct _ Gloss=. </code></pre> <p><span style="color: blue"><b>Joakim:</b> I think it might be better to use “nsubj:caus” and “iobj:caus”, indicating that these are arguments of a causative and therefore do not have the expected role but without specifying the role (cause and agent). This is more parallel with “nsubj:pass”, where we just indicate that it is the subject of a passive and therefore has an unexpected role but without specifying what the role is. </span></p> <p>The fact that the causative <a href="https://books.google.cz/books?id=nIaPL4kLt6cC&amp;pg=PA599&amp;lpg=PA599&amp;dq=gustatzen+causative&amp;source=bl&amp;ots=LcI8u2JhcB&amp;sig=LrbPxId629ESf0v70hw2EY73J70&amp;hl=cs&amp;sa=X&amp;ved=2ahUKEwjFluOAwu_aAhWFDiwKHVbXCYkQ6AEwAXoECAAQMA#v=onepage&amp;q=gustatzen%20causative&amp;f=false">is available</a> for dative-absolutive verbs supports the claim that the dative argument indeed is the subject in active voice of those verbs.</p> <ul> <li><em>Zopa izugarri gustatzen zaio mutilari.</em> “The boy likes the soup a lot.”</li> <li><em>Goseak zopa hori izugarri gustatuerazi zion mutilari.</em> “Hunger made the boy like that soup a lot.”</li> </ul> <pre><code class="language-conllu"># text = Zopa izugarri gustatzen zaio mutilari. # text_en = The boy likes the soup a lot. 1 Zopa zopa NOUN _ Animacy=Inan|Case=Abs|Definite=Def|Number=Sing 3 obj _ Gloss=soup 2 izugarri izugarri ADV _ _ 3 advmod _ Gloss=greatly 3 gustatzen gustatzen VERB _ Aspect=Imp|VerbForm=Part 0 root _ Gloss=pleasing 4 zaio izan AUX _ Mood=Ind|Number[abs]=Sing|Number[dat]=Sing|Person[abs]=3|Person[dat]=3|VerbForm=Fin 3 aux _ Gloss=is 5 mutilari mutil NOUN _ Animacy=Anim|Case=Dat|Definite=Def|Number=Sing 3 nsubj _ Gloss=to-the-boy|SpaceAfter=No 6 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Goseak zopa hori izugarri gustatuerazi zion mutilari. # text_en = Hunger made the boy like that soup a lot. 1 Goseak gose NOUN _ Animacy=Inan|Case=Erg|Definite=Def|Number=Sing 5 nsubj:caus _ Gloss=hunger 2 zopa zopa NOUN _ Animacy=Inan|Case=Abs|Definite=Def|Number=Sing 5 obj _ Gloss=soup 3 hori hori DET _ Case=Abs|Definite=Def|Number=Sing|PronType=Dem 2 det _ Gloss=that 4 izugarri izugarri ADV _ _ 5 advmod _ Gloss=greatly 5 gustatuerazi gustatzen VERB _ Aspect=Imp|VerbForm=Part|Voice=Cau 0 root _ Gloss=made-pleasing 6 zion *edun AUX _ Mood=Ind|Number[abs]=Sing|Number[dat]=Sing|Number[erg]=Sing|Person[abs]=3|Person[dat]=3|Person[erg]=3|VerbForm=Fin 5 aux _ Gloss=has 7 mutilari mutil NOUN _ Animacy=Anim|Case=Dat|Definite=Def|Number=Sing 5 iobj:agent _ Gloss=the-boy|SpaceAfter=No 8 . . PUNCT _ _ 5 punct _ Gloss=. </code></pre> <p>Causative is only marginally accepted with ditransitive verbs, apparently due to the marginal acceptance of two dative-marked arguments in the same clause.</p> <h3 id="yidiɲ">Yidiɲ</h3> <p>See also:</p> <ul> <li>Avery D. Andrews: The major functions of the noun phrase (2007). In <em>Timothy Shopen (ed.): Language Typology and Syntactic Description, second edition, volume I: Clause Structure.</em> Pp. 193-197. Cambridge University Press. ISBN 978-0-521-58156-1.</li> <li>R. M. W. Dixon: <em>A Grammar of Yidiny</em> (1977). Cambridge: Cambridge University Press. ISBN 978-0-521-21462-9.</li> </ul> <p>Yidiɲ (Pama-Nyungan, Australia) has a combination of the ergative-absolutive system (similar to Basque) and the nominative-accusative system (similar to Czech). The former pair is typical for nouns, the latter for pronouns.</p> <ul> <li><em>Ŋayu maŋga:ɲ.</em> “I laughed.” (nominative)</li> <li><em>Buɲa maŋga:ɲ.</em> “The woman laughed.” (absolutive)</li> <li><em>Ŋaɲaɲ buɲa:ŋ wuɹa:ɲ.</em> “The woman slapped me.” (ergative-accusative)</li> <li><em>Ŋayu buɲa wuɹa:ɲ.</em> “I slapped the woman.” (nominative-absolutive)</li> <li><em>Waguɖaŋgu guda:ga wawa:l.</em> “The man saw the dog.” (ergative-absolutive)</li> </ul> <pre><code class="language-conllu"># sent_id = 3.98a/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu maŋga:ɲ. # gloss = I(NOM) laugh-PAST # text_en = I laughed. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 2 nsubj _ Gloss=I|MGloss=I(NOM) 2 maŋga:ɲ maŋgan VERB _ Tense=Past 0 root _ Gloss=laughed|MSeg=maŋga:-ɲ|MGloss=laugh-PAST|SpaceAfter=No 3 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.98b/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Buɲa maŋga:ɲ. # gloss = woman(ABS) laugh-PAST # text_en = The woman laughed. 1 Buɲa buɲa NOUN _ Case=Abs|Number=Sing 2 nsubj _ Gloss=woman|MGloss=woman(ABS) 2 maŋga:ɲ maŋgan VERB _ Tense=Past 0 root _ Gloss=laughed|MSeg=maŋga:-ɲ|MGloss=laugh-PAST|SpaceAfter=No 3 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.98c/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋaɲaɲ buɲa:ŋ wuɹa:ɲ. # gloss = I(ACC) woman-ERG slap-PAST # text_en = The woman slapped me. 1 Ŋaɲaɲ ŋayu PRON _ Case=Acc|Number=Sing|Person=1|PronType=Prs 3 obj _ Gloss=me|MGloss=I(ACC) 2 buɲa:ŋ buɲa NOUN _ Case=Erg|Number=Sing 3 nsubj _ Gloss=woman|MSeg=buɲa:-ŋ|MGloss=woman-ERG 3 wuɹa:ɲ wuɹan VERB _ Tense=Past 0 root _ Gloss=slapped|MSeg=wuɹa:-ɲ|MGloss=slap-PAST|SpaceAfter=No 4 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.98d/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu buɲa wuɹa:ɲ. # gloss = I(NOM) woman(ABS) slap-PAST # text_en = I slapped the woman. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 3 nsubj _ Gloss=I|MGloss=I(NOM) 2 buɲa buɲa NOUN _ Case=Abs|Number=Sing 3 obj _ Gloss=woman|MGloss=woman(ABS) 3 wuɹa:ɲ wuɹan VERB _ Tense=Past 0 root _ Gloss=slapped|MSeg=wuɹa:-ɲ|MGloss=slap-PAST|SpaceAfter=No 4 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.98e/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Waguɖaŋgu guda:ga wawa:l. # gloss = man-ERG dog(ABS) see-PAST # text_en = The man saw the dog. 1 Waguɖaŋgu wagu:ɖa NOUN _ Case=Erg|Number=Sing 3 nsubj _ Gloss=man|MSeg=Waguɖa-ŋgu|MGloss=man-ERG 2 guda:ga guda:ga NOUN _ Case=Abs|Number=Sing 3 obj _ Gloss=dog|MGloss=dog(ABS) 3 wawa:l wawal VERB _ Tense=Past 0 root _ Gloss=saw|MSeg=wawa:-l|MGloss=see-PAST|SpaceAfter=No 4 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>There is a type of subordinate clause that is called dative subordinate (datsub) because its head verb takes a subjunctive suffix similar to the dative suffix of nouns. The clause may be analyzed as a relative clause dependent on a noun phrase in the main clause. The coreferential noun phrase in the subordinate clause may be elided. There is a near requirement (with some exceptions) that the coreferential nominal has S/P function in both clauses, i.e., it is the subject of an intransitive predicate or the object of a transitive predicate:</p> <ul> <li><em>Ŋayu maŋga:ɲ (ŋaɲaɲ) buɲa:n wuɹa:ɲunda.</em> “I, (who) was slapped by the woman, laughed.”</li> <li><em>Ŋaɲaɲ buɲa:ŋ wuɹa:ɲ (ŋayu) maŋga:ɲunda.</em> “I, (who) was lauging, was slapped by the woman.”</li> </ul> <pre><code class="language-conllu"># sent_id = 3.99aa/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu maŋga:ɲ ŋaɲaɲ buɲa:n wuɹa:ɲunda. # gloss = I(NOM) laugh-PAST I-ACC woman-ERG slap-DATSUB # text_en = I, who was slapped by the woman, laughed. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 2 nsubj _ Gloss=I|MGloss=I(NOM) 2 maŋga:ɲ maŋgan VERB _ Tense=Past 0 root _ Gloss=laughed|MSeg=maŋga:-ɲ|MGloss=laugh-PAST 3 ŋaɲaɲ ŋayu PRON _ Case=Acc|Number=Sing|Person=1|PronType=Prs 5 obj _ Gloss=me|MGloss=I(ACC) 4 buɲa:ŋ buɲa NOUN _ Case=Erg|Number=Sing 5 nsubj _ Gloss=woman|MSeg=buɲa:-n|MGloss=woman-ERG 5 wuɹa:ɲunda wuɹan VERB _ Mood=Sub 1 acl:datsub _ Gloss=slapping|MSeg=wuɹa:-ɲunda|MGloss=slap-DATSUB|SpaceAfter=No 6 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.99ba/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋaɲaɲ buɲa:ŋ wuɹa:ɲ ŋayu maŋga:ɲunda. # gloss = I-ACC woman-ERG slap-PAST I(NOM) laugh-DATSUB # text_en = I, who was laughing, was slapped by the woman. 1 Ŋaɲaɲ ŋayu PRON _ Case=Acc|Number=Sing|Person=1|PronType=Prs 3 obj _ Gloss=me|MGloss=I(ACC) 2 buɲa:ŋ buɲa NOUN _ Case=Erg|Number=Sing 3 nsubj _ Gloss=woman|MSeg=buɲa:-ŋ|MGloss=woman-ERG 3 wuɹa:ɲ wuɹan VERB _ Tense=Past 0 root _ Gloss=slapped|MSeg=wuɹa-ɲ|MGloss=slap-PAST 4 ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 5 nsubj _ Gloss=I|MGloss=I(NOM) 5 maŋga:ɲunda maŋgan VERB _ Mood=Sub 1 acl:datsub _ Gloss=laughing|MSeg=maŋga-ɲunda|MGloss=laugh-DATSUB|SpaceAfter=No 6 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>If we want to use this construction for a nominal with A function (i.e., the subject of a transitive predicate) in either of the two clauses, we must first transform the clause to antipassive, which means:</p> <ol> <li>Active verb form is replaced by antipassive.</li> <li>Former object is transformed to the dative or locative case and becomes oblique argument.</li> <li>The subject is still subject, but now of an intransitive predicate. Its function changed from A to S.</li> </ol> <p>Analogically to the passive, we may want to use a relation subtype for the demoted object: <a href="">obl:patient</a>.</p> <ul> <li><em>Waguɖaŋgu guda:ga wawa:l.</em> “The man saw the dog.” (active)</li> <li><em>Wagu:ɖa gudaganda wawa:ɖiɲu.</em> “The man saw the dog.” (antipassive)</li> </ul> <pre><code class="language-conllu"># sent_id = 3.100aa/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Wagu:ɖa gudaganda wawa:ɖiɲu. # gloss = man(ABS) dog-DAT see-ANTIPASS-PAST # text_en = The man saw the dog. 1 Wagu:ɖa wagu:ɖa NOUN _ Case=Abs|Number=Sing 3 nsubj _ Gloss=man|MGloss=man(ABS) 2 gudaganda guda:ga NOUN _ Case=Dat|Number=Sing 3 obl:patient _ Gloss=dog|MSeg=gudaga-nda|MGloss=dog-DAT 3 wawa:ɖiɲu wawal VERB _ Tense=Past|Voice=Antip 0 root _ Gloss=saw|MSeg=wawa:-ɖi-ɲu|MGloss=see-ANTIPASS-PAST|SpaceAfter=No 4 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <ul> <li><em>Ŋayu buɲa wuɹa:ɲ.</em> “I slapped the woman.” (active)</li> <li><em>Ŋayu buɲa:nda wuɹa:ɖiɲu.</em> “I slapped the woman.” (antipassive)</li> </ul> <pre><code class="language-conllu"># sent_id = 3.100b/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu buɲa:nda wuɹa:ɖiɲu. # gloss = I(NOM) woman-DAT slap-ANTIPASS-PAST # text_en = I slapped the woman. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 3 nsubj _ Gloss=I|MGloss=I(NOM) 2 buɲa:nda buɲa NOUN _ Case=Dat|Number=Sing 3 obl:patient _ Gloss=woman|MSeg=buɲa:-nda|MGloss=woman-DAT 3 wuɹa:ɖiɲu wuɹan VERB _ Tense=Past|Voice=Antip 0 root _ Gloss=slapped|MSeg=wuɹa:-ɖi-ɲu|MGloss=slap-ANTIPASS-PAST|SpaceAfter=No 4 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>It is now possible to combine clauses so that the subject of an originally transitive (now intransitive) predicate is coreferential:</p> <ul> <li><em>Ŋayu maŋga:ɲ (ŋayu) buɲa:nda wuɹa:ɖiɲunda.</em> “I, (who) was slapping the woman, laughed.”</li> </ul> <pre><code class="language-conllu"># sent_id = 3.101aa/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu maŋga:ɲ ŋayu buɲa:nda wuɹa:ɖiɲunda. # gloss = I(NOM) laugh-PAST I(NOM) woman-DAT slap-ANTIPASS-DATSUB # text_en = I, who was slapping the woman, laughed; I laughed while slapping the woman. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 2 nsubj _ Gloss=I|MGloss=I(NOM) 2 maŋga:ɲ maŋgan VERB _ Tense=Past 0 root _ Gloss=laughed|MSeg=maŋga:-ɲ|MGloss=laugh-PAST 3 ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 5 nsubj _ Gloss=I|MGloss=I(NOM) 4 buɲa:nda buɲa NOUN _ Case=Dat|Number=Sing 5 obl:patient _ Gloss=woman|MSeg=buɲa:-nda|MGloss=woman-DAT 5 wuɹa:ɖiɲunda wuɹan VERB _ Mood=Sub|Voice=Antip 1 acl:datsub _ Gloss=slapped|MSeg=wuɹa:-ɖi-ɲunda|MGloss=slap-ANTIPASS-DATSUB|SpaceAfter=No 6 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <ul> <li><em>Ŋayu buɲa:nda wuɹa:ɖiɲu (ŋayu) maŋgaɲunda.</em> “I, (who) was laughing, slapped the woman.”</li> </ul> <pre><code class="language-conllu"># sent_id = 3.101ba/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu buɲa:nda wuɹa:ɖiɲu ŋayu maŋgaɲunda. # gloss = I(NOM) woman-DAT slap-ANTIPASS-PAST I(NOM) laugh-DATSUB # text_en = I, who was laughing, slapped the woman; I slapped the woman while laughing. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 3 nsubj _ Gloss=I|MGloss=I(NOM) 2 buɲa:nda buɲa NOUN _ Case=Dat|Number=Sing 3 obl:patient _ Gloss=woman|MSeg=buɲa:-nda|MGloss=woman-DAT 3 wuɹa:ɖiɲu wuɹan VERB _ Tense=Past|Voice=Antip 0 root _ Gloss=slapped|MSeg=wuɹa:-ɖi-ɲu|MGloss=slap-ANTIPASS-PAST 4 ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 5 nsubj _ Gloss=I|MGloss=I(NOM) 5 maŋgaɲunda maŋgan VERB _ Mood=Sub 1 acl:datsub _ Gloss=laughed|MSeg=maŋga-ɲunda|MGloss=laugh-DATSUB|SpaceAfter=No 6 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <p>Andrews notes that besides the relative clause analysis, these sentences can be also interpreted adverbially. The core-oblique distinction and the antipassive stay the same but the UD trees change:</p> <ul> <li><em>Ŋayu maŋga:ɲ (ŋayu) buɲa:nda wuɹa:ɖiɲunda.</em> “I laughed while slapping the woman.”</li> </ul> <pre><code class="language-conllu"># sent_id = 3.101aa/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu maŋga:ɲ ŋayu buɲa:nda wuɹa:ɖiɲunda. # gloss = I(NOM) laugh-PAST I(NOM) woman-DAT slap-ANTIPASS-DATSUB # text_en = I, who was slapping the woman, laughed; I laughed while slapping the woman. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 2 nsubj _ Gloss=I|MGloss=I(NOM) 2 maŋga:ɲ maŋgan VERB _ Tense=Past 0 root _ Gloss=laughed|MSeg=maŋga:-ɲ|MGloss=laugh-PAST 3 ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 5 nsubj _ Gloss=I|MGloss=I(NOM) 4 buɲa:nda buɲa NOUN _ Case=Dat|Number=Sing 5 obl:patient _ Gloss=woman|MSeg=buɲa:-nda|MGloss=woman-DAT 5 wuɹa:ɖiɲunda wuɹan VERB _ Mood=Sub|Voice=Antip 2 advcl:datsub _ Gloss=slapped|MSeg=wuɹa:-ɖi-ɲunda|MGloss=slap-ANTIPASS-DATSUB|SpaceAfter=No 6 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <ul> <li><em>Ŋayu buɲa:nda wuɹa:ɖiɲu (ŋayu) maŋgaɲunda.</em> “I slapped the woman while laughing.”</li> </ul> <pre><code class="language-conllu"># sent_id = 3.101ba/yii # Yidiɲ (Pama-Nyungan, Australia) # source = Dixon, 1977 # text = Ŋayu buɲa:nda wuɹa:ɖiɲu ŋayu maŋgaɲunda. # gloss = I(NOM) woman-DAT slap-ANTIPASS-PAST I(NOM) laugh-DATSUB # text_en = I, who was laughing, slapped the woman; I slapped the woman while laughing. 1 Ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 3 nsubj _ Gloss=I|MGloss=I(NOM) 2 buɲa:nda buɲa NOUN _ Case=Dat|Number=Sing 3 obl:patient _ Gloss=woman|MSeg=buɲa:-nda|MGloss=woman-DAT 3 wuɹa:ɖiɲu wuɹan VERB _ Tense=Past|Voice=Antip 0 root _ Gloss=slapped|MSeg=wuɹa:-ɖi-ɲu|MGloss=slap-ANTIPASS-PAST 4 ŋayu ŋayu PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 5 nsubj _ Gloss=I|MGloss=I(NOM) 5 maŋgaɲunda maŋgan VERB _ Mood=Sub 3 advcl:datsub _ Gloss=laughed|MSeg=maŋga-ɲunda|MGloss=laugh-DATSUB|SpaceAfter=No 6 . . PUNCT _ _ 3 punct _ Gloss=. </code></pre> <h3 id="tagalog">Tagalog</h3> <p>Tagalog is a representative of a subset of Austronesian languages that have been described as symmetric-voice languages. There is an agent voice, where the most core argument corresponds to the agent role, and a patient voice, where the most core argument corresponds to the patient. It is tempting to reuse our labels of active and passive for these voices. There are at least two important differences from what these terms mean in Indo-European languages, though. First, the two voices in Tagalog are more symmetric and it is hard to say that the active is default, unmarked, and the passive is marked. The passive is not morphologically more complex than the passive. Both the agent and the patient regularly appear in both voices. They are coded differently, but both are coded as core, not oblique arguments. Both “active” and “passive” clauses thus can be transitive.</p> <p>The second difference is that there are more voices than the agent-oriented and the patient-oriented one. There is also a voice that fronts a locational argument, for example.</p> <p>The arguments are marked by function words that could be analyzed as either prepositions, or case-bearing determiners. Although adpositions are often associated with oblique arguments and adjuncts, we have seen that it is not a universal rule. Spanish marks a human direct object with the preposition <em>a</em>; Slavic and other languages have prepositional object that, despite not being considered core in UD, seem to work the same way as other non-accusative (but preposition-less, and currently core) arguments; and in Japanese, all arguments are marked by postpositions, including the subject and the direct object. On the other hand, if the nominal markers in Tagalog are determiners, then Tagalog somewhat resembles modern German, where nominal inflection has been greatly reduced and the varying forms of determiners are often the only clue about the case of a noun phrase. Categorizing the Tagalog markers as determiners seems to be more favored in the literature.</p> <p>The most core-like argument (also called <em>pivot</em>) is marked by the determiner <em>ang</em>. The other core argument (if any) is marked by the determiner <em>ng</em> (pronounced <em>nang</em>). A different set of determiners is used with proper nouns. No determiners are used with personal pronouns, but the pronouns themselves inflect for case.</p> <p>There have been disputes about whether the pivot is subject and whether Tagalog has a subject at all. Nevertheless, there does not seem to be any better solution than to simply identify it with the subject in UD. <span style="color:red">EDIT: Further discussion is needed. Andrews cites others and says (below examples 124) that both <em>ang</em> and <em>ng</em> arguments are core, but the actor is more subject-like regardless of whether it is pivot or not. That would mean that we should use the <code class="language-plaintext highlighter-rouge">nsubj</code> relation for the <em>ang</em> argument of agent-voice verbs, the <em>ng</em> argument of patient-voice verbs, and we would have to select one of two <em>ng</em> arguments in other voices, depending on which argument semantically fits the agent role.</span> It seems appropriate to mark the determiners and the personal pronouns with the <a href="">Case</a> feature: the pivot with nominative, and the other core argument with accusative.</p> <ul> <li><em>Nagsalita ka.</em> “You spoke.”</li> </ul> <pre><code class="language-conllu"># sent_id = 1.98d/tl # text = Nagsalita ka. # gloss = (PERF.ACTIVE)speak you # text_en = You spoke. 1 Nagsalita salita VERB _ Aspect=Perf|Mood=Ind|VerbForm=Fin|Voice=Agf 0 root _ Gloss=spoke|MSeg=nag-salita|MGloss=PERF+ACTIVE-speak 2 ka ikaw PRON _ Case=Nom|Number=Sing|Person=2|PronType=Prs 1 nsubj _ Gloss=you|SpaceAfter=No 3 . . PUNCT _ _ 1 punct _ Gloss=punct </code></pre> <ul> <li><em>Natalisod ka.</em> “You tripped.”</li> </ul> <pre><code class="language-conllu"># sent_id = 1.98f/tl # text = Natalisod ka. # gloss = (PERF.INVOL)trip you # text_en = You tripped. 1 Natalisod tisod VERB _ Aspect=Perf|Mood=Ind|VerbForm=Fin|Voice=Paf 0 root _ Gloss=tripped|MSeg=na-talisod|MGloss=PERF+INVOL-trip 2 ka ikaw PRON _ Case=Nom|Number=Sing|Person=2|PronType=Prs 1 nsubj _ Gloss=you|SpaceAfter=No 3 . . PUNCT _ _ 1 punct _ Gloss=punct </code></pre> <ul> <li><em>Natalisod ang babae.</em> “The woman tripped.”</li> </ul> <pre><code class="language-conllu"># text = Natalisod ang babae. # text_en = The woman tripped. 1 Natalisod tisod VERB _ Aspect=Perf|Mood=Ind|VerbForm=Fin|Voice=Paf 0 root _ Gloss=tripped|MSeg=na-talisod|MGloss=PERF+INVOL-trip 2 ang ang DET _ Case=Nom|Definite=Def|PronType=Art 3 det _ Gloss=the|MGloss=PIV 3 babae babae NOUN _ _ 1 nsubj _ Gloss=woman|SpaceAfter=No 4 . . PUNCT _ _ 1 punct _ Gloss=punct </code></pre> <ul> <li><em>Natalisod si Pedro.</em> “Pedro tripped.”</li> </ul> <pre><code class="language-conllu"># text = Natalisod si Pedro. # text_en = Pedro tripped. 1 Natalisod tisod VERB _ Aspect=Perf|Mood=Ind|VerbForm=Fin|Voice=Paf 0 root _ Gloss=tripped|MSeg=na-talisod|MGloss=PERF+INVOL-trip 2 si si DET _ Case=Nom|Definite=Def|PronType=Art 3 det _ Gloss=the 3 Pedro Pedro PROPN _ _ 1 nsubj _ Gloss=Pedro|SpaceAfter=No 4 . . PUNCT _ _ 1 punct _ Gloss=punct </code></pre> <!-- Tagalog personal pronouns Nom (ang) Acc (ng) Loc (sa) 1 Sing ako ko akin I 2 Sing ikaw/ka mo iyo you 3 Sing siya niya kanya he/she/it 1 Plur Ex kami namin amin we 1 Plur In tayo natin atin we 2 Plur kayo ninyo inyo you 3 Plur sila nila kanila they --> <p>Transitive (two-argument) sentences have two core arguments, one in the nominative (pronoun or determiner) and the other in the accusative. We may want to use relation subtypes for the arguments in the patient voice (similarly to what we do in the English passive): <a href="">nsubj:pass</a> for the subject and <a href="">obj:agent</a> (not <code class="language-plaintext highlighter-rouge">obl:agent</code>!) for the object. However, the subtypes should not be taken to suggest that the agent voice is default and unmarked.</p> <ul> <li><em>Naglilinis siya ng bahay.</em> “She cleans the house.” (agent voice)</li> </ul> <pre><code class="language-conllu"># text = Naglilinis siya ng bahay. # text_en = She cleans the house. 1 Naglilinis linis VERB _ Aspect=Imp|Mood=Ind|VerbForm=Fin|Voice=Agf 0 root _ Gloss=cleans 2 siya siya PRON _ Case=Nom|Number=Sing|Person=1|PronType=Prs 1 nsubj _ Gloss=he/she 3 ng ng DET _ Case=Acc|PronType=Art 4 det _ Gloss=DET 4 bahay bahay NOUN _ _ 1 obj _ Gloss=house|SpaceAfter=No 5 . . PUNCT _ _ 1 punct _ Gloss=punct </code></pre> <ul> <li><em>Nililinis niya ang bahay.</em> “She cleans the house. / The house is cleaned by her.” (patient voice)</li> </ul> <pre><code class="language-conllu"># text = Nililinis niya ang bahay. # text_en = She cleans the house. / The house is cleaned by her. 1 Nililinis linis VERB _ Aspect=Imp|Mood=Ind|VerbForm=Fin|Voice=Paf 0 root _ Gloss=cleans 2 niya siya PRON _ Case=Acc|Number=Sing|Person=1|PronType=Prs 1 obj:agent _ Gloss=he/she 3 ang ang DET _ Case=Nom|Definite=Def|PronType=Art 4 det _ Gloss=the 4 bahay bahay NOUN _ _ 1 nsubj:pass _ Gloss=house|SpaceAfter=No 5 . . PUNCT _ _ 1 punct _ Gloss=punct </code></pre> <p>Locative, directional and benefactive arguments are normally coded as oblique. However, there are additional voices where these arguments become subjects. One of the reasons why an argument is fronted as the subject is that the subject is understood as the topic of the sentence. The <em>ang</em> determiner implies definiteness (while <em>ng</em>-marked arguments can be definite or indefinite). Here is an example of a sentence in four different voices:</p> <ul> <li><em>Magaalis ang babae ng bigas sa sako para sa bata.</em> “The woman will take some rice out of a/the sack for a/the child.” (agent voice)</li> <li><em>Aalisin ng babae ang bigas sa sako para sa bata.</em> “A/the woman will take the rice out of a/the sack for a/the child.” (patient voice)</li> <li><em>Aalisan ng babae ng bigas ang sako para sa bata.</em> “A/the woman will take some rice out of the sack for a/the child.” (locative voice)</li> <li><em>Ipagaalis ng babae ng bigas sa sako ang bata.</em> “A/the woman will take some rice out of a/the sack for the child.” (benefactive voice)</li> </ul> <pre><code class="language-conllu"># sent_id = 3.111a/tl # text = Magaalis ang babae ng bigas sa sako para sa bata. # gloss = AP-FUT-take.out PIV woman OBJ rice DIR sack for BEN child # text_en = The woman will take some rice out of a/the sack for a/the child. # AP = actor pivot; PIV = pivot marker # http://www.seasite.niu.edu/Tagalog/tagalog_verbs.htm 1 Magaalis alis VERB _ Aspect=Prog|Mood=Ind|VerbForm=Fin|Voice=Agf 0 root _ Gloss=will-take-out|MSeg=mag-a-alis|MGloss=AP-FUT-take.out 2 ang ang DET _ Case=Nom|Definite=Def|PronType=Art 3 det _ Gloss=the 3 babae babae NOUN _ _ 1 nsubj _ Gloss=woman 4 ng ng DET _ Case=Acc|PronType=Art 5 det _ Gloss=DET 5 bigas bigas NOUN _ _ 1 obj _ Gloss=rice 6 sa sa DET _ Case=Loc|PronType=Art 7 det _ Gloss=DIR 7 sako sako NOUN _ _ 1 obl _ Gloss=sack 8 para para ADP _ _ 10 case _ Gloss=for 9 sa sa DET _ Case=Loc|PronType=Art 10 det _ Gloss=BEN 10 bata bata NOUN _ _ 1 obl _ Gloss=child|SpaceAfter=No 11 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.111b/tl # text = Aalisin ng babae ang bigas sa sako para sa bata. # gloss = FUT-take.out-OP ACT woman PIV rice DIR sack for BEN child # text_en = A/the woman will take the rice out of a/the sack for a/the child. # OP = object pivot; PIV = pivot marker 1 Aalisin alis VERB _ Aspect=Prog|Mood=Ind|VerbForm=Fin|Voice=Paf 0 root _ Gloss=will-take-out|MSeg=a-alis-in|MGloss=FUT-take.out-OP 2 ng ng DET _ Case=Acc|PronType=Art 3 det _ Gloss=DET 3 babae babae NOUN _ _ 1 obj:agent _ Gloss=woman 4 ang ang DET _ Case=Nom|Definite=Def|PronType=Art 5 det _ Gloss=the 5 bigas bigas NOUN _ _ 1 nsubj:pass _ Gloss=rice 6 sa sa DET _ Case=Loc|PronType=Art 7 det _ Gloss=DIR 7 sako sako NOUN _ _ 1 obl _ Gloss=sack 8 para para ADP _ _ 10 case _ Gloss=for 9 sa sa DET _ Case=Loc|PronType=Art 10 det _ Gloss=BEN 10 bata bata NOUN _ _ 1 obl _ Gloss=child|SpaceAfter=No 11 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.111c/tl # text = Aalisan ng babae ng bigas ang sako para sa bata. # gloss = FUT-take.out-DP ACT woman OBJ rice PIV sack BEN child # text_en = A/the woman will take some rice out of the sack for a/the child. # DP = directional pivot; PIV = pivot marker 1 Aalisan alis VERB _ Aspect=Prog|Mood=Ind|VerbForm=Fin|Voice=Locf 0 root _ Gloss=will-take-out|MSeg=a-alis-an|MGloss=FUT-take.out-DP 2 ng ng DET _ Case=Acc|PronType=Art 3 det _ Gloss=DET 3 babae babae NOUN _ _ 1 obj:agent _ Gloss=woman 4 ng ng DET _ Case=Acc|PronType=Art 5 det _ Gloss=DET 5 bigas bigas NOUN _ _ 1 obj:patient _ Gloss=rice 6 ang ang DET _ Case=Nom|Definite=Def|PronType=Art 7 det _ Gloss=the 7 sako sako NOUN _ _ 1 nsubj:loc _ Gloss=sack 8 para para ADP _ _ 10 case _ Gloss=for 9 sa sa DET _ Case=Loc|PronType=Art 10 det _ Gloss=BEN 10 bata bata NOUN _ _ 1 obl _ Gloss=child|SpaceAfter=No 11 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># sent_id = 3.111d/tl # text = Ipagaalis ng babae ng bigas sa sako ang bata. # gloss = BP-FUT-take.out ACT woman OBJ rice DIR sack PIV child # text_en = A/the woman will take some rice out of a/the sack for the child. # BP = benefactive pivot; PIV = pivot marker 1 Ipagaalis alis VERB _ Aspect=Prog|Mood=Ind|VerbForm=Fin|Voice=Benf 0 root _ Gloss=will-take-out|MSeg=Ipag-a-alis|MGloss=BP-FUT-take.out 2 ng ng DET _ Case=Acc|PronType=Art 3 det _ Gloss=DET 3 babae babae NOUN _ _ 1 obj:agent _ Gloss=woman 4 ng ng DET _ Case=Acc|PronType=Art 5 det _ Gloss=DET 5 bigas bigas NOUN _ _ 1 obj:patient _ Gloss=rice 6 sa sa DET _ Case=Loc|PronType=Art 7 det _ Gloss=DIR 7 sako sako NOUN _ _ 1 obl _ Gloss=sack 8 ang ang DET _ Case=Nom|Definite=Def|PronType=Art 9 det _ Gloss=the 9 bata bata NOUN _ _ 1 nsubj:ben _ Gloss=child|SpaceAfter=No 10 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <p>Since the agent and patient stay core arguments even in the locative and benefactive voices, we actually have a ditransitive clause with three core arguments. In contrast, the verbs of giving, which are typical representatives of ditransitive predicates in other languages, form a standard transitive clause in the agent and patient voices, as the recipient is coded as a directioal (locative) oblique dependent.</p> <ul> <li><em>Nagbigay ang lalaki ng libro sa babae.</em> “The man gave a book to the woman.” (agent voice)</li> </ul> <pre><code class="language-conllu"># text = Nagbigay ang lalaki ng libro sa babae. # text_en = The man gave a book to the woman. 1 Nagbigay bigay VERB _ Aspect=Perf|Mood=Ind|VerbForm=Fin|Voice=Agf 0 root _ Gloss=gave 2 ang ang DET _ Case=Nom|Definite=Def|PronType=Art 3 det _ Gloss=the 3 lalaki lalaki NOUN _ _ 1 nsubj _ Gloss=man 4 ng ng DET _ Case=Acc|PronType=Art 5 det _ Gloss=DET 5 libro libro NOUN _ _ 1 obj _ Gloss=libro 6 sa sa DET _ Case=Loc|PronType=Art 7 det _ Gloss=DIR 7 babae babae NOUN _ _ 1 obl _ Gloss=woman|SpaceAfter=No 8 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <!-- Locative voice? Binigyan ng lalaki ng libro ang babae. --> <h3 id="plains-cree">Plains Cree</h3> <p>See also:</p> <ul> <li>Arok Elessar Wolvengrey (2011): <a href="https://dare.uva.nl/search?identifier=153f3405-f029-4046-8d95-9f2a087b4123">Semantic and pragmatic functions in Plains Cree syntax</a> (PhD thesis). Utrecht: LOT. ISBN 978-94-6093-051-5.</li> </ul> <p>The Algonquian (North American) language Plains Cree is similar to Basque in its cross-referencing of both the subject and the object by verbal inflection. It is also very dissimilar to Basque due to its almost complete lack of case marking on the nouns. Yet the marking of the argument on the verbal head is sufficient to allow for a relatively free word order (unlike English).</p> <p>Like in many other languages where person and number of an argument is cross-referenced by the verb, the argument does not need to appear as a separate word if it would be just a pronoun.</p> <ul> <li><em>Niwīcihānānak.</em> “We help them.”</li> <li><em>Niwīcihikonānak.</em> “They help us.”</li> </ul> <pre><code class="language-conllu"># text = Niwīcihānānak. # text_en = We help them. 1 Niwīcihānānak wīcih VERB _ Animacy=Anim|Clusivity[high]=Ex|Mood=Ind|Number[high]=Plur|Number[low]=Plur|Person[high]=1|Person[low]=3|Tense=Pres|Voice=Dir 0 root _ Gloss=we-help-them|MSeg=ni-wīcih-ā-nān-ak|MGloss=1-help-DIR-1PL-3PL|SpaceAfter=No 2 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Niwīcihikonānak. # text_en = They help us. 1 Niwīcihikonānak wīcih VERB _ Animacy=Anim|Clusivity[high]=Ex|Mood=Ind|Number[high]=Plur|Number[low]=Plur|Person[high]=1|Person[low]=3|Tense=Pres|Voice=Inv 0 root _ Gloss=they-help-us|MSeg=ni-wīcih-iko-nān-ak|MGloss=1-help-INV-1PL-3PL|SpaceAfter=No 2 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <p>The two verb forms in the two previous examples differ in <a href="">Voice</a>. The first example is in the direct voice, where the argument higher in a language-specific obliqueness hierarchy is more agent-like and the other argument is more patient-like. First person arguments are higher than third person arguments, therefore the agent is “we” and the patient is “they”.</p> <p>In the second example, the argument-marking morphemes have not changed but the verb is in the inverse voice where the argument lower in the hierarchy (“they”) is the agent and the higher argument (“we”) is the patient.</p> <p>In a parallel to the active-passive voice system of English, we can postulate that the argument higher in the hierarchy is the subject (i.e., the most core argument), and the lower argument is the object. And like with English passives, the voice has to be considered when one wants to map the grammatical relations to semantic roles. In the two previous examples, the arguments are not overtly present and the dependency relations are not visible. However, if there are overt arguments in an inverse voice clause, we may again want to use relation subtypes to signal that the default interpretation does not apply. <span style="color:red">TBD: Should we use <a href="">nsubj:pass</a> and <a href="">obj:agent</a> as in symmetric-voice languages? Or something else? Or should we even replace <code class="language-plaintext highlighter-rouge">nsubj:pass</code> in other languages by something more neutral? Alternatively, we could make the direct-inverse voice system special in that we resolve the roles already in the relation labeling, i.e., higher-ranking argument will be labeled <code class="language-plaintext highlighter-rouge">nsubj</code> in direct voice and <code class="language-plaintext highlighter-rouge">obj</code> in inverse voice, and lower-ranking argument will be <code class="language-plaintext highlighter-rouge">obj</code> in direct voice and <code class="language-plaintext highlighter-rouge">nsubj</code> in inverse voice. That is, if there are not some typical subject tests known from other languages that will contradict our proposal. At present I do not know anything about subjecthood tests applied to Plains Cree.</span></p> <ul> <li><em>Nikī-wīcihāw Cān.</em> “I helped John.”</li> </ul> <pre><code class="language-conllu"># text = Nikī-wīcihāw Cān. # text_en = I helped John. 1 Nikī-wīcihāw wīcih VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Sing|Person[high]=1|Person[low]=3|Tense=Past|Voice=Dir 0 root _ Gloss=I-helped-him|MSeg=ni-kī-wīcih-ā-w|MGloss=1-PAST-help-DIR-3SG 2 Cān Cān PROPN _ Animacy=Anim|Number=Sing|Obviation=Prx 1 obj _ Gloss=John|SpaceAfter=No 3 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <ul> <li><em>Nikī-wīcihāwak Cān ēkwa Mēriy.</em> “I helped John and Mary.”</li> </ul> <pre><code class="language-conllu"># text = Nikī-wīcihāwak Cān ēkwa Mēriy. # text_en = I helped John and Mary. 1 Nikī-wīcihāwak wīcih VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Plur|Person[high]=1|Person[low]=3|Tense=Past|Voice=Dir 0 root _ Gloss=I-helped-them|MSeg=ni-kī-wīcih-ā-w-ak|MGloss=1-PAST-help-DIR-3-3PL 2 Cān Cān PROPN _ Animacy=Anim|Number=Sing|Obviation=Prx 1 obj _ Gloss=John 3 ēkwa ēkwa CCONJ _ _ 4 cc _ Gloss=and 4 Mēriy Mēriy PROPN _ Animacy=Anim|Number=Sing|Obviation=Prx 2 conj _ Gloss=Mary|SpaceAfter=No 5 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <!-- page 100 section 2.2.2.2 --> <p>If two third-person arguments are involved, one of them is considered <em>proximate</em> (more topical, higher in the obliqueness hierarchy) and the other is considered <em>obviative</em> (less topical, lower in the obliqueness hierarchy). The obviative noun is marked morphologically by the suffix <em>-a</em>. Note that Plains Cree distinguishes singular and plural <a href="">Number</a> for proximate but not for obviative third person arguments.</p> <p>Current UD data (as of UD 2.1) does not include languages with direct-inverse voice systems and proximate-obviative division of third-person arguments. <span style="color: blue"><b>Joakim:</b> But I think similar cases are discussed with reference to UD in <a href="http://www.aclweb.org/anthology/W16-1719">this paper on Arapaho</a>.</span> The guidelines define a special value for the “fourth person”, which could be used for obviative arguments (see <a href="">Person</a>). This value is inspired by the <a href="https://unimorph.github.io/doc/unimorph-schema.pdf#page=41">Unimorph</a> project. However, the Unimorph specification seems to favor using <code class="language-plaintext highlighter-rouge">Person=3</code> with an additional subfeature for proximate and obviative status: “In some languages, a fourth person category is used to describe an otherwise third-person referent that is differentiated from other third-person referents by a switch-reference-like distinction … or, more commonly, by a distinction in obviation status… For the purposes of morphological distinctions, these fourth person categories may call for dedicated verbal morphology. While in some cases their meaning can be captured by third person (3) plus switch-reference features or features marking pragmatic voice distinctions (such as the proximate (PRX) and obviative (OBV)), we include a fourth person category with the feature 4 to allow for identification of a fourth person category when the semantic distinctions are complicated or not strictly inflectional in nature.”</p> <p>A possible alternative would be to revoke the “fourth person” and define a separate feature <code class="language-plaintext highlighter-rouge">Obviation</code> with the values <code class="language-plaintext highlighter-rouge">Prx</code> and <code class="language-plaintext highlighter-rouge">Obv</code>. There are two places where the feature could be used: as a verbal feature (cross-referencing the argument) and as a nominal feature (marking the argument). Especially in nominal inflection it seems preferable to use a new feature rather than assert that the noun inflects for person (with values <code class="language-plaintext highlighter-rouge">3</code> and <code class="language-plaintext highlighter-rouge">4</code> only).</p> <p>Yet another option would be to include the nominal inflection under <a href="">Case</a> marking, i.e., a noun with the obviative morpheme would be <code class="language-plaintext highlighter-rouge">Case=Acc</code> and the unmarked nouns would be <code class="language-plaintext highlighter-rouge">Case=Nom</code>. However, such an extension could be perceived as stretching the usual definition of case too far. The main oddity would be that it only applies to third-person referents and only if two such referents compete as arguments of the same verb. If one argument of the verb is first-person and the other third-person, both will stay in the “nominative” regardless of their semantic roles. Therefore, defining a new feature, separate from <code class="language-plaintext highlighter-rouge">Case</code>, is probably a better and less confusing solution.</p> <!-- page 199 section 3.1 --> <ul> <li><em>Cāniy kī-wīcihēw Mērīwa.</em> “Johnny helped Mary.” (direct voice)</li> <li><em>Cānīwa kī-wīcihēw Mēriy.</em> “Mary helped Johnny.” (direct voice)</li> <li><em>Cāniy kī-wīcihik Mērīwa.</em> “Mary helped Johnny. / Johnny was helped by Mary.” (inverse voice)</li> <li><em>Cānīwa kī-wīcihik Mēriy.</em> “Johnny helped Mary. / Mary was helped by Johnny.” (inverse voice)</li> </ul> <pre><code class="language-conllu"># text = Cāniy kī-wīcihēw Mērīwa. # text_en = Johnny helped Mary. 1 Cāniy Cāniy PROPN _ Animacy=Anim|Number=Sing|Obviation=Prx 2 nsubj _ Gloss=Johnny 2 kī-wīcihēw wīcih VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Sing|Person[high]=3|Person[low]=3|Tense=Past|Voice=Dir 0 root _ Gloss=helped|MSeg=kī-wīcih-ē-w|MGloss=PAST-help-DIR-3SG 3 Mērīwa Mēriy PROPN _ Animacy=Anim|Number=Sing|Obviation=Obv 2 obj _ Gloss=Mary|MSeg=Mēriy-wa|MGloss=Mary-OBV|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Cānīwa kī-wīcihēw Mēriy. # text_en = Mary helped Johnny. 1 Cānīwa Cāniy PROPN _ Animacy=Anim|Number=Sing|Obviation=Obv 2 obj _ Gloss=Johnny|MSeg=Cāniy-wa|MGloss=Johnny-OBV 2 kī-wīcihēw wīcih VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Sing|Person[high]=3|Person[low]=3|Tense=Past|Voice=Dir 0 root _ Gloss=helped|MSeg=kī-wīcih-ē-w|MGloss=PAST-help-DIR-3SG 3 Mēriy Mēriy PROPN _ Animacy=Anim|Number=Sing|Obviation=Prx 2 nsubj _ Gloss=Mary|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Cāniy kī-wīcihik Mērīwa. # text_en = Mary helped Johnny. / Johnny was helped by Mary. 1 Cāniy Cāniy PROPN _ Animacy=Anim|Number=Sing|Obviation=Prx 2 nsubj:pass _ Gloss=Johnny 2 kī-wīcihik wīcih VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Sing|Person[high]=3|Person[low]=3|Tense=Past|Voice=Inv 0 root _ Gloss=helped|MSeg=kī-wīcih-ikw-w|MGloss=PAST-help-INV-3SG 3 Mērīwa Mēriy PROPN _ Animacy=Anim|Number=Sing|Obviation=Obv 2 obj:agent _ Gloss=Mary|MSeg=Mēriy-wa|MGloss=Mary-OBV|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <pre><code class="language-conllu"># text = Cānīwa kī-wīcihik Mēriy. # text_en = Johnny helped Mary. / Mary was helped by Johnny. 1 Cānīwa Cāniy PROPN _ Animacy=Anim|Number=Sing|Obviation=Obv 2 obj:agent _ Gloss=Johnny|MSeg=Cāniy-wa|MGloss=Johnny-OBV 2 kī-wīcihik wīcih VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Sing|Person[high]=3|Person[low]=3|Tense=Past|Voice=Inv 0 root _ Gloss=helped|MSeg=kī-wīcih-ikw-w|MGloss=PAST-help-INV-3SG 3 Mēriy Mēriy PROPN _ Animacy=Anim|Number=Sing|Obviation=Prx 2 nsubj:pass _ Gloss=Mary|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <p>Ditransitive verbs (that is, verbs with three arguments) still cross-reference only two arguments on the verb. It is always the recipient-like argument that is cross-referenced, while the theme stays outside. Hence the recipient (goal) is more core than the theme, and deserves to be labeled <a href="">obj</a>. The question is whether the theme is still a core argument (and thus labeled <a href="">iobj</a>) or it is already oblique. Allowing it the core status seems to be at a similar level of tolerance as with the non-accusative objects in languages like Czech. The themes in Plains Cree are not indexed on the verb, though their own surface form (bare nominal) is not different from the core arguments.</p> <!-- page 95 section 2.2.3.2 --> <ul> <li><em>Nikī-miyāw anima masinahikan.</em> “I gave him/her that book.” (direct voice)</li> <li><em>Nikī-miyik anima masinahikan.</em> “He/she gave me that book.” (inverse voice)</li> <li><em>Nikī-kiskinwahamawāw nēhiyawēwin.</em> “I taught him/her Cree.” (direct voice)</li> <li><em>Nikī-kiskinwahamāk nēhiyawēwin.</em> “He/she taught me Cree.” (inverse voice)</li> </ul> <pre><code class="language-conllu"># text = Nikī-miyāw anima masinahikan. # text_en = I gave him/her that book. 1 Nikī-miyāw miy VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Sing|Person[high]=1|Person[low]=3|Tense=Past|Voice=Dir 0 root _ Gloss=I-gave-him/her|MSeg=ni-kī-miy-ā-w|MGloss=1-PAST-give.to-DIR-3SG 2 anima anima DET _ Animacy=Inan|Number=Sing|PronType=Dem 3 det _ Gloss=that|MGloss=DEM.0's 3 masinahikan masinahikan NOUN _ Animacy=Inan|Number=Sing 1 iobj _ Gloss=book|SpaceAfter=No 4 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <p>In the above example, the verb stem used is for animate objects, while <em>masinahikan</em> “book” is inanimate. That is a proof that the 3rd person singular cross-reference on the verb does not refer to the book but to an animate recipient that is not overtly represented in the sentence.</p> <p>Even though Plains Cree does not use morphological cases to distinguish agents from patients, there is a form of nouns that can be classified as the locative case (<code class="language-plaintext highlighter-rouge">Case=Loc</code>). It clearly marks the noun as oblique and unable to be cross-referenced by verbal inflection. The other, bare nominal forms, could then be tagged as nominative (<code class="language-plaintext highlighter-rouge">Case=Nom</code>), or, optionally, left with the <a href="">Case</a> feature empty.</p> <ul> <li><em>Akocikanihk nikī-ahāwak nitastisak.</em> “I put my mitts on the shelf.” (mitts are grammatically animate, despite the semantics)</li> </ul> <pre><code class="language-conllu"># text = Akocikanihk nikī-ahāwak nitastisak. # text_en = I put my mitts on the shelf. 1 Akocikanihk akocikan NOUN _ Animacy=Inan|Case=Loc 2 obl _ Gloss=shelf|MSeg=akocikan-ihk|MGloss=shelf-LOC 2 nikī-ahāwak ah VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Plur|Person[high]=1|Person[low]=3|Tense=Past|Voice=Dir 0 root _ Gloss=I-put|MSeg=ni-kī-ah-ā-wak|MGloss=1-PAST-put-DIR-3PL 3 nitastisak astis NOUN _ Animacy=Anim|Number=Plur|Person[psor]=1 2 obj _ Gloss=my-mitts|MSeg=nit-astis-ak|MGloss=1-mitt-PL|SpaceAfter=No 4 . . PUNCT _ _ 2 punct _ Gloss=. </code></pre> <p>Adpositions may accompany the locative, too:</p> <ul> <li><em>Nikī-nīhtināw akocikanihk ohci.</em> “I took him/her/it down from the shelf.”</li> </ul> <pre><code class="language-conllu"># text = Nikī-nīhtināw akocikanihk ohci. # text_en = I took him/her/it down from the shelf. 1 Nikī-nīhtināw nīhtin VERB _ Animacy=Anim|Mood=Ind|Number[high]=Sing|Number[low]=Sing|Person[high]=1|Person[low]=3|Tense=Past|Voice=Dir 0 root _ Gloss=I-took-it-down|MSeg=ni-kī-nīhtin-ā-w|MGloss=1-PAST-take.down-DIR-3SG 2 akocikanihk akocikan NOUN _ Animacy=Inan|Case=Loc 1 obl _ Gloss=shelf|MSeg=akocikan-ihk|MGloss=shelf-LOC 3 ohci ohci ADP _ _ 2 case _ Gloss=from|SpaceAfter=No 4 . . PUNCT _ _ 1 punct _ Gloss=. </code></pre> <!----------------------------------------------------------------------------> <p><span style="color:red">TO DO: Discuss somewhere the layered features that are needed when multiple arguments are cross-referenced by verbal morphology. Try to standardize the layer names.</span></p> <h2 id="summary-of-relations">Summary of Relations</h2> <ul> <li><a href="">nsubj</a> — nominal subject, corresponding to the S function in intransitive clauses and to the A function in transitive clauses. If some of the <code class="language-plaintext highlighter-rouge">nsubj</code> subtypes are used in the language, then the bare <code class="language-plaintext highlighter-rouge">nsubj</code> denotes the remaining situations not covered by the subtypes. <ul> <li><a href="">nsubj:pass</a> — nominal subject in a passive clause</li> <li><a href="">nsubj:caus</a> — nominal subject in a causative clause</li> </ul> </li> <li><a href="">obj</a> — nominal object, corresponding to the P function in transitive clauses.</li> <li><a href="">iobj</a> — nominal indirect object, one of two objects in ditransitive clauses, the one that is “less core-like” of the two. If the two objects are equal in there core-likelihood, none of them is <code class="language-plaintext highlighter-rouge">iobj</code>. If some of the <code class="language-plaintext highlighter-rouge">iobj</code> subtypes are used in the language, then the bare <code class="language-plaintext highlighter-rouge">iobj</code> denotes the remaining situations not covered by the subtypes. <ul> <li><a href="">iobj:agent</a> — true agent in a causative clause, if encoded as an indirect object.</li> </ul> </li> <li><a href="">obl</a> — nominal oblique argument or adjunct. If some of the <code class="language-plaintext highlighter-rouge">obl</code> subtypes are used in the language, then the bare <code class="language-plaintext highlighter-rouge">obl</code> denotes the remaining situations not covered by the subtypes. <ul> <li><a href="">obl:agent</a> — true agent in a passive clause, demoted from active subject</li> <li><a href="">obl:arg</a> — oblique argument other than <code class="language-plaintext highlighter-rouge">obl:agent</code></li> <li><a href="">obl:tmod</a> — temporal adjunct</li> </ul> </li> </ul> </div> <!-- support for embedded visualizations --> <script type="text/javascript"> var root = '../../'; // filled in by jekyll head.js( // We assume that external libraries such as jquery.min.js have already been loaded outside! // (See _layouts/base.html.) // brat helper modules root + 'lib/brat/configuration.js', root + 'lib/brat/util.js', root + 'lib/brat/annotation_log.js', root + 'lib/ext/webfont.js', // brat modules root + 'lib/brat/dispatcher.js', root + 'lib/brat/url_monitor.js', root + 'lib/brat/visualizer.js', // embedding configuration root + 'lib/local/config.js', // project-specific collection data root + 'lib/local/collections.js', // Annodoc root + 'lib/annodoc/annodoc.js', // NOTE: non-local libraries 'https://spyysalo.github.io/conllu.js/conllu.js' ); var webFontURLs = [ // root + 'static/fonts/Astloch-Bold.ttf', root + 'static/fonts/PT_Sans-Caption-Web-Regular.ttf', root + 'static/fonts/Liberation_Sans-Regular.ttf' ]; var setupTimeago = function() { jQuery("time.timeago").timeago(); }; head.ready(function() { setupTimeago(); // mark current collection (filled in by Jekyll) Collections.listing['_current'] = ''; // perform all embedding and support functions Annodoc.activate(Config.bratCollData, Collections.listing); }); </script> <!-- google analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-55233688-1', 'auto'); ga('send', 'pageview'); </script> <div id="footer"> <p class="footer-text">&copy; 2014–2021 <a href="http://universaldependencies.org/introduction.html#contributors" style="color:gray">Universal Dependencies contributors</a>. Site powered by <a href="http://spyysalo.github.io/annodoc" style="color:gray">Annodoc</a> and <a href="http://brat.nlplab.org/" style="color:gray">brat</a></p>. </div> </div> </body> </html>
UniversalDependencies/universaldependencies.github.io
workgroups/newdoc/valency_changing_operations.html
HTML
apache-2.0
99,933
/* * Copyright (C) 2019 The Calrissian 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.calrissian.mango.criteria.domain; import java.util.ArrayList; import java.util.List; import java.util.Objects; import static java.util.stream.Collectors.joining; public class OrNode extends ParentNode { private static final long serialVersionUID = 1L; public OrNode() { this(null); } public OrNode(ParentNode parent) { this(new ArrayList<>(), parent); } public OrNode(List<Node> nodes, ParentNode parent) { super(nodes, parent); } @Override public Node clone(ParentNode node) { OrNode cloned = new OrNode(node); for (Node child : children()) cloned.addChild(child.clone(cloned)); return cloned; } @Override public String toString() { return "(" + getNodes().stream().map(Objects::toString).collect(joining(" or ")) + ")"; } }
calrissian/mango
mango-criteria/src/main/java/org/calrissian/mango/criteria/domain/OrNode.java
Java
apache-2.0
1,472
/* * Copyright 2017 JBoss 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 io.apiman.gateway.engine.vertx.polling; import io.apiman.gateway.engine.IEngineConfig; import io.apiman.gateway.engine.Version; import io.apiman.gateway.engine.async.AsyncInitialize; import io.apiman.gateway.engine.async.AsyncResultImpl; import io.apiman.gateway.engine.async.IAsyncHandler; import io.apiman.gateway.engine.async.IAsyncResultHandler; import io.apiman.gateway.engine.beans.Api; import io.apiman.gateway.engine.beans.Client; import io.apiman.gateway.engine.beans.Policy; import io.apiman.gateway.engine.impl.InMemoryRegistry; import io.apiman.gateway.engine.vertx.polling.fetchers.AccessTokenResourceFetcher; import io.apiman.gateway.engine.vertx.polling.fetchers.FileResourceFetcher; import io.apiman.gateway.engine.vertx.polling.fetchers.HttpResourceFetcher; import io.apiman.gateway.engine.vertx.polling.fetchers.threescale.beans.Content; import io.apiman.gateway.engine.vertx.polling.fetchers.threescale.beans.ProxyConfigRoot; import io.apiman.gateway.engine.vertx.polling.fetchers.threescale.beans.Service; import io.apiman.gateway.engine.vertx.polling.fetchers.threescale.beans.ServicesRoot; import io.apiman.gateway.platforms.vertx3.common.verticles.Json; import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.impl.Arguments; import io.vertx.core.json.DecodeException; import io.vertx.core.logging.Logger; import io.vertx.core.logging.LoggerFactory; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; import java.util.Deque; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; /** * URI loading registry that pulls configuration from a specified 3scale backend, this is * mapped to the internal apiman data model and * <ul> * <li>accessToken: 3scale access token</li> * <li>apiEndpoint: 3scale API endpoint</li> * <li>environment: which environment (e.g. production, staging)</li> * <li>policyConfigUri: apiman policy config to load as JSON from file * ({@link FileResourceFetcher}) or HTTP/S ({@link HttpResourceFetcher}). * See the corresponding fetcher for additional options.</li> * </ul> * * @author Marc Savy {@literal <marc@rhymewithgravy.com>} * @see FileResourceFetcher * @see HttpResourceFetcher * @see AccessTokenResourceFetcher */ @SuppressWarnings("nls") public class ThreeScaleURILoadingRegistry extends InMemoryRegistry implements AsyncInitialize { private static volatile OneShotURILoader instance; private Vertx vertx; private Map<String, String> options; public static final String DEFAULT_NS = "DEFAULT"; /** * @param vertx the vertx instance * @param vxConfig the engine config * @param options the options */ public ThreeScaleURILoadingRegistry(Vertx vertx, IEngineConfig vxConfig, Map<String, String> options) { super(); this.vertx = vertx; this.options = options; } public ThreeScaleURILoadingRegistry(Map<String, String> options) { this(Vertx.vertx(), null, options); } @Override public void initialize(IAsyncResultHandler<Void> resultHandler) { getURILoader(vertx, options).subscribe(this, resultHandler::handle); } private OneShotURILoader getURILoader(Vertx vertx, Map<String, String> options) { if (instance == null) { synchronized(ThreeScaleURILoadingRegistry.class) { if (instance == null) { instance = new OneShotURILoader(vertx, options); } } } return instance; } public static void reloadData(IAsyncHandler<Void> doneHandler) { instance.reload(doneHandler); } public static void reset() { synchronized(ThreeScaleURILoadingRegistry.class) { instance = null; } } @Override public void publishApi(Api api, IAsyncResultHandler<Void> handler) { throw new UnsupportedOperationException(); } @Override public void retireApi(Api api, IAsyncResultHandler<Void> handler) { throw new UnsupportedOperationException(); } @Override public void registerClient(Client client, IAsyncResultHandler<Void> handler) { throw new UnsupportedOperationException(); } @Override public void unregisterClient(Client client, IAsyncResultHandler<Void> handler) { throw new UnsupportedOperationException(); } protected void publishApiInternal(Api api, IAsyncResultHandler<Void> handler) { super.publishApi(api, handler); } protected void registerClientInternal(Client client, IAsyncResultHandler<Void> handler) { super.registerClient(client, handler); } private static final class OneShotURILoader { private Vertx vertx; private URI apiUri; private URI policyConfigUri; private Map<String, String> config; private List<IAsyncResultHandler<Void>> failureHandlers = new ArrayList<>(); private Deque<ThreeScaleURILoadingRegistry> awaiting = new ArrayDeque<>(); private List<ThreeScaleURILoadingRegistry> allRegistries = new ArrayList<>(); private boolean dataProcessed = false; private List<ProxyConfigRoot> configs = new ArrayList<>(); private List<Client> clients = new ArrayList<>(); private List<Api> apis = new ArrayList<>(); private Logger log = LoggerFactory.getLogger(OneShotURILoader.class); private IAsyncHandler<Void> reloadHandler; private List<Api> policyConfigApis = Collections.emptyList(); private String environment; public OneShotURILoader(Vertx vertx, Map<String, String> config) { this.config = config; this.vertx = vertx; apiUri = URI.create(requireOpt("apiEndpoint", "apiEndpoint is required in configuration")); environment = config.getOrDefault("environment", "production"); if (config.containsKey("policyConfigUri")) policyConfigUri = URI.create(config.get("policyConfigUri")); // Can be null. fetchResource(); } private String requireOpt(String key, String errorMsg) { Arguments.require(config.containsKey(key), errorMsg); return config.get(key); } // Clear all registries and add back to processing queue. public synchronized void reload(IAsyncHandler<Void> reloadHandler) { this.reloadHandler = reloadHandler; awaiting.addAll(allRegistries); apis.clear(); clients.clear(); failureHandlers.clear(); allRegistries.stream() .map(ThreeScaleURILoadingRegistry::getMap) .forEach(Map::clear); dataProcessed = false; // Load again from scratch. fetchResource(); } private void fetchResource() { log.debug("Fetching 3scale services..."); // Fetch list of all services getServicesRoot(servicesRoot -> { List<Service> services = servicesRoot.getServices(); // Get all service IDs List<Long> sids = services.stream() .map(service -> service.getService().getId()) .collect(Collectors.toList()); // Get all configs for given service IDs. @SuppressWarnings("rawtypes") List<Future> configFutures = sids.stream() .map(this::getConfig) .collect(Collectors.toList()); // If policyConfigUri is provided, then load API policy config. // NB: THESE ARE API BEANSs WITH *ONLY* POLICY CONFIG! if (policyConfigUri != null) { configFutures.add(fetchPolicyConfig()); } CompositeFuture.all(configFutures) .setHandler(result -> { if (result.succeeded()) { processData(); } else { failAll(result.cause()); } }); }); } private Future<List<Api>> fetchPolicyConfig() { log.debug("Loading policy configuration from {0}...", policyConfigUri); Future<List<Api>> apiResultFuture = Future.future(); new PolicyConfigLoader(vertx, policyConfigUri, config) .setApiResultHandler(apis -> { this.policyConfigApis = apis; apiResultFuture.complete(); }) .setExceptionHandler(apiResultFuture::fail) .load(); return apiResultFuture; } @SuppressWarnings("rawtypes") private Future getConfig(long id) { Future future = Future.future(); String path = String.format("/admin/api/services/%d/proxy/configs/%s/latest.json", id, environment); new AccessTokenResourceFetcher(vertx, config, joinPath(path)) .exceptionHandler(future::fail) .fetch(buffer -> { if (buffer.length() > 0) { ProxyConfigRoot pc = Json.decodeValue(buffer.toString(), ProxyConfigRoot.class); log.debug("Received Proxy Config: {0}", pc); configs.add(pc); } future.complete(); }); return future; } private void getServicesRoot(Handler<ServicesRoot> resultHandler) { new AccessTokenResourceFetcher(vertx, config, joinPath("/admin/api/services.json")) .exceptionHandler(this::failAll) .fetch(buffer -> { ServicesRoot sr = Json.decodeValue(buffer.toString(), ServicesRoot.class); System.out.println("Received buffer"); //log.debug("Received Services: {0}", sr); resultHandler.handle(sr); }); } // Bit messy, refactor private URI joinPath(String path) { try { return new URL(apiUri.toURL(), path).toURI(); } catch (MalformedURLException | URISyntaxException e) { throw new RuntimeException(e); } } private void processData() { if (configs.size() == 0) { log.warn("File loaded into registry was empty. No entities created."); return; } try { // Naive version initially. for (ProxyConfigRoot root : configs) { // Reflects the remote data structure. Content config = root.getProxyConfig().getContent(); Api api = new Api(); api.setApiId(config.getSystemName()); api.setOrganizationId(DEFAULT_NS); api.setEndpoint(config.getProxy().getApiBackend()); api.setEndpointContentType("text/json"); // don't think there is an equivalent of this in 3scale api.setEndpointType("rest"); //don't think there is an equivalent of this in 3scale api.setParsePayload(false); // can let user override this? api.setPublicAPI(true); // is there an equivalent of this? api.setVersion(DEFAULT_NS); // don't think this is relevant anymore setPolicies(api, root); log.info("Processing - {0}: ", config); log.info("Creating API - {0}: ", api); apis.add(api); } dataProcessed = true; checkQueue(); } catch (DecodeException e) { failAll(e); } } private void setPolicies(Api api, ProxyConfigRoot config) { // FIXME optimise // Add 3scale policy Policy pol = new Policy(); pol.setPolicyImpl(determinePolicyImpl()); // TODO get version? Hmm! Env? pol.setPolicyJsonConfig(Json.encode(config)); api.getApiPolicies().add(pol); // Add any policies user specified in remote config. policyConfigApis.stream() .filter(skeleton -> skeleton.getApiId().equals(api.getApiId())) // Apply policies from skeleton to 3scale API. .forEach(skeleton -> api.getApiPolicies().addAll(skeleton.getApiPolicies())); } private String determinePolicyImpl() { String version = config.getOrDefault("pluginVersion", Version.get().getVersionString()); return "plugin:io.apiman.plugins:apiman-plugins-3scale-auth:" + version + ":war/io.apiman.plugins.auth3scale.Auth3Scale"; } public synchronized void subscribe(ThreeScaleURILoadingRegistry registry, IAsyncResultHandler<Void> failureHandler) { Objects.requireNonNull(registry, "registry must be non-null."); Objects.requireNonNull(failureHandler, "failure handler must be non-null."); failureHandlers.add(failureHandler); allRegistries.add(registry); awaiting.add(registry); vertx.runOnContext(action -> checkQueue()); } private void checkQueue() { if (dataProcessed && awaiting.size() > 0) { loadDataIntoRegistries(); } } private void loadDataIntoRegistries() { ThreeScaleURILoadingRegistry reg = null; while ((reg = awaiting.poll()) != null) { log.debug("Loading data into registry {0}: ", reg); for (Api api : apis) { reg.publishApiInternal(api, handleAnyFailure()); log.debug("Publishing: {0} ", api); } for (Client client : clients) { reg.registerClientInternal(client, handleAnyFailure()); log.debug("Registering: {0} ", client); } } if (reloadHandler != null) reloadHandler.handle((Void) null); } private IAsyncResultHandler<Void> handleAnyFailure() { return result -> { if (result.isError()) { failAll(result.getError()); throw new RuntimeException(result.getError()); } }; } private void failAll(Throwable cause) { AsyncResultImpl<Void> failure = AsyncResultImpl.create(cause); failureHandlers.stream().forEach(failureHandler -> { vertx.runOnContext(run -> failureHandler.handle(failure)); }); } } }
kahboom/apiman
gateway/engine/vertx-polling/src/main/java/io/apiman/gateway/engine/vertx/polling/ThreeScaleURILoadingRegistry.java
Java
apache-2.0
15,720
# Copyright 2020, Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # 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 Google::Ads::GoogleAds::V10::Resources::QualityInfo; use strict; use warnings; use base qw(Google::Ads::GoogleAds::BaseEntity); use Google::Ads::GoogleAds::Utils::GoogleAdsHelper; sub new { my ($class, $args) = @_; my $self = { creativeQualityScore => $args->{creativeQualityScore}, postClickQualityScore => $args->{postClickQualityScore}, qualityScore => $args->{qualityScore}, searchPredictedCtr => $args->{searchPredictedCtr}}; # Delete the unassigned fields in this object for a more concise JSON payload remove_unassigned_fields($self, $args); bless $self, $class; return $self; } 1;
googleads/google-ads-perl
lib/Google/Ads/GoogleAds/V10/Resources/QualityInfo.pm
Perl
apache-2.0
1,220
package org.opl.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class OplUtils { private static final Logger LOGGER_CLOSE = LoggerFactory.getLogger(OplUtils.class.getName() + ".close"); private OplUtils() { // nothing to do in an utility class } public static void closeQuietly(AutoCloseable closeable) { if (closeable != null) { try { closeable.close(); } catch (Exception e) { LOGGER_CLOSE.debug("Exception on close", e); } } } public static void checkNotNull(Object o, String message) { if (o == null) { throw new IllegalArgumentException(message); } } public static void checkGreaterThanZero(long v, String message) { if (v <= 0) { throw new IllegalArgumentException(message); } } public static void checkGreaterOrEqualZero(long v, String message) { if (v < 0) { throw new IllegalArgumentException(message); } } }
mazurkin/opl
src/main/java/org/opl/util/OplUtils.java
Java
apache-2.0
1,074
/** * 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.camel.builder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.camel.CamelContext; import org.apache.camel.Component; import org.apache.camel.Endpoint; import org.apache.camel.RoutesBuilder; import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.model.FromDefinition; import org.apache.camel.model.InterceptDefinition; import org.apache.camel.model.InterceptFromDefinition; import org.apache.camel.model.InterceptSendToEndpointDefinition; import org.apache.camel.model.ModelCamelContext; import org.apache.camel.model.OnCompletionDefinition; import org.apache.camel.model.OnExceptionDefinition; import org.apache.camel.model.RouteDefinition; import org.apache.camel.model.RoutesDefinition; import org.apache.camel.model.rest.RestConfigurationDefinition; import org.apache.camel.model.rest.RestDefinition; import org.apache.camel.model.rest.RestsDefinition; import org.apache.camel.spi.RestConfiguration; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.StringHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A <a href="http://camel.apache.org/dsl.html">Java DSL</a> which is * used to build {@link org.apache.camel.impl.DefaultRoute} instances in a {@link CamelContext} for smart routing. */ public abstract class RouteBuilder extends BuilderSupport implements RoutesBuilder { protected Logger log = LoggerFactory.getLogger(getClass()); private AtomicBoolean initialized = new AtomicBoolean(false); private RestsDefinition restCollection = new RestsDefinition(); private Map<String, RestConfigurationDefinition> restConfigurations; private List<TransformerBuilder> transformerBuilders = new ArrayList<>(); private List<ValidatorBuilder> validatorBuilders = new ArrayList<>(); private RoutesDefinition routeCollection = new RoutesDefinition(); public RouteBuilder() { this(null); } public RouteBuilder(CamelContext context) { super(context); } @Override public String toString() { return getRouteCollection().toString(); } /** * <b>Called on initialization to build the routes using the fluent builder syntax.</b> * <p/> * This is a central method for RouteBuilder implementations to implement * the routes using the Java fluent builder syntax. * * @throws Exception can be thrown during configuration */ public abstract void configure() throws Exception; /** * Configures the REST services * * @return the builder */ public RestConfigurationDefinition restConfiguration() { return restConfiguration(""); } /** * Configures the REST service for the given component * * @return the builder */ public RestConfigurationDefinition restConfiguration(String component) { if (restConfigurations == null) { restConfigurations = new HashMap<>(); } RestConfigurationDefinition restConfiguration = restConfigurations.get(component); if (restConfiguration == null) { restConfiguration = new RestConfigurationDefinition(); if (!component.isEmpty()) { restConfiguration.component(component); } restConfigurations.put(component, restConfiguration); } return restConfiguration; } /** * Creates a new REST service * * @return the builder */ public RestDefinition rest() { getRestCollection().setCamelContext(getContext()); RestDefinition answer = getRestCollection().rest(); configureRest(answer); return answer; } /** * Creates a new REST service * * @param path the base path * @return the builder */ public RestDefinition rest(String path) { getRestCollection().setCamelContext(getContext()); RestDefinition answer = getRestCollection().rest(path); configureRest(answer); return answer; } /** * Create a new {@code TransformerBuilder}. * * @return the builder */ public TransformerBuilder transformer() { TransformerBuilder tdb = new TransformerBuilder(); transformerBuilders.add(tdb); return tdb; } /** * Create a new {@code ValidatorBuilder}. * * @return the builder */ public ValidatorBuilder validator() { ValidatorBuilder vb = new ValidatorBuilder(); validatorBuilders.add(vb); return vb; } /** * Creates a new route from the given URI input * * @param uri the from uri * @return the builder */ public RouteDefinition from(String uri) { getRouteCollection().setCamelContext(getContext()); RouteDefinition answer = getRouteCollection().from(uri); configureRoute(answer); return answer; } /** * Creates a new route from the given URI input * * @param uri the String formatted from uri * @param args arguments for the string formatting of the uri * @return the builder */ public RouteDefinition fromF(String uri, Object... args) { getRouteCollection().setCamelContext(getContext()); RouteDefinition answer = getRouteCollection().from(String.format(uri, args)); configureRoute(answer); return answer; } /** * Creates a new route from the given endpoint * * @param endpoint the from endpoint * @return the builder */ public RouteDefinition from(Endpoint endpoint) { getRouteCollection().setCamelContext(getContext()); RouteDefinition answer = getRouteCollection().from(endpoint); configureRoute(answer); return answer; } /** * Creates a new route from the given URIs input * * @param uris the from uris * @return the builder */ public RouteDefinition from(String... uris) { getRouteCollection().setCamelContext(getContext()); RouteDefinition answer = getRouteCollection().from(uris); configureRoute(answer); return answer; } /** * Creates a new route from the given endpoint * * @param endpoints the from endpoints * @return the builder */ public RouteDefinition from(Endpoint... endpoints) { getRouteCollection().setCamelContext(getContext()); RouteDefinition answer = getRouteCollection().from(endpoints); configureRoute(answer); return answer; } /** * Installs the given <a href="http://camel.apache.org/error-handler.html">error handler</a> builder * * @param errorHandlerBuilder the error handler to be used by default for all child routes */ public void errorHandler(ErrorHandlerBuilder errorHandlerBuilder) { if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException("errorHandler must be defined before any routes in the RouteBuilder"); } getRouteCollection().setCamelContext(getContext()); setErrorHandlerBuilder(errorHandlerBuilder); } /** * Injects a property placeholder value with the given key converted to the given type. * * @param key the property key * @param type the type to convert the value as * @return the value, or <tt>null</tt> if value is empty * @throws Exception is thrown if property with key not found or error converting to the given type. */ public <T> T propertyInject(String key, Class<T> type) throws Exception { StringHelper.notEmpty(key, "key"); ObjectHelper.notNull(type, "Class type"); // the properties component is mandatory Component component = getContext().hasComponent("properties"); if (component == null) { throw new IllegalArgumentException("PropertiesComponent with name properties must be defined" + " in CamelContext to support property placeholders in expressions"); } PropertiesComponent pc = getContext().getTypeConverter() .mandatoryConvertTo(PropertiesComponent.class, component); // enclose key with {{ }} to force parsing Object value = pc.parseUri(pc.getPrefixToken() + key + pc.getSuffixToken()); if (value != null) { return getContext().getTypeConverter().mandatoryConvertTo(type, value); } else { return null; } } /** * Adds a route for an interceptor that intercepts every processing step. * * @return the builder */ public InterceptDefinition intercept() { if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException("intercept must be defined before any routes in the RouteBuilder"); } getRouteCollection().setCamelContext(getContext()); return getRouteCollection().intercept(); } /** * Adds a route for an interceptor that intercepts incoming messages on any inputs in this route * * @return the builder */ public InterceptFromDefinition interceptFrom() { if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException("interceptFrom must be defined before any routes in the RouteBuilder"); } getRouteCollection().setCamelContext(getContext()); return getRouteCollection().interceptFrom(); } /** * Adds a route for an interceptor that intercepts incoming messages on the given endpoint. * * @param uri endpoint uri * @return the builder */ public InterceptFromDefinition interceptFrom(String uri) { if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException("interceptFrom must be defined before any routes in the RouteBuilder"); } getRouteCollection().setCamelContext(getContext()); return getRouteCollection().interceptFrom(uri); } /** * Applies a route for an interceptor if an exchange is send to the given endpoint * * @param uri endpoint uri * @return the builder */ public InterceptSendToEndpointDefinition interceptSendToEndpoint(String uri) { if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException("interceptSendToEndpoint must be defined before any routes in the RouteBuilder"); } getRouteCollection().setCamelContext(getContext()); return getRouteCollection().interceptSendToEndpoint(uri); } /** * <a href="http://camel.apache.org/exception-clause.html">Exception clause</a> * for catching certain exceptions and handling them. * * @param exception exception to catch * @return the builder */ public OnExceptionDefinition onException(Class<? extends Throwable> exception) { // is only allowed at the top currently if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException("onException must be defined before any routes in the RouteBuilder"); } getRouteCollection().setCamelContext(getContext()); return getRouteCollection().onException(exception); } /** * <a href="http://camel.apache.org/exception-clause.html">Exception clause</a> * for catching certain exceptions and handling them. * * @param exceptions list of exceptions to catch * @return the builder */ public OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) { OnExceptionDefinition last = null; for (Class<? extends Throwable> ex : exceptions) { last = last == null ? onException(ex) : last.onException(ex); } return last != null ? last : onException(Exception.class); } /** * <a href="http://camel.apache.org/oncompletion.html">On completion</a> * callback for doing custom routing when the {@link org.apache.camel.Exchange} is complete. * * @return the builder */ public OnCompletionDefinition onCompletion() { // is only allowed at the top currently if (!getRouteCollection().getRoutes().isEmpty()) { throw new IllegalArgumentException("onCompletion must be defined before any routes in the RouteBuilder"); } getRouteCollection().setCamelContext(getContext()); return getRouteCollection().onCompletion(); } public void addRoutesToCamelContext(CamelContext context) throws Exception { // must configure routes before rests configureRoutes((ModelCamelContext) context); configureRests((ModelCamelContext) context); // but populate rests before routes, as we want to turn rests into routes populateRests(); populateTransformers(); populateValidators(); populateRoutes(); } /** * Configures the routes * * @param context the Camel context * @return the routes configured * @throws Exception can be thrown during configuration */ public RoutesDefinition configureRoutes(ModelCamelContext context) throws Exception { setContext(context); checkInitialized(); routeCollection.setCamelContext(context); return routeCollection; } /** * Configures the rests * * @param context the Camel context * @return the rests configured * @throws Exception can be thrown during configuration */ public RestsDefinition configureRests(ModelCamelContext context) throws Exception { setContext(context); restCollection.setCamelContext(context); return restCollection; } /** * Includes the routes from the build to this builder. * <p/> * This allows you to use other builds as route templates. * @param routes other builder with routes to include * * @throws Exception can be thrown during configuration */ public void includeRoutes(RoutesBuilder routes) throws Exception { // TODO: We should support including multiple routes so I think invoking configure() // needs to be deferred to later if (routes instanceof RouteBuilder) { // if its a RouteBuilder then let it use my route collection and error handler // then we are integrated seamless RouteBuilder builder = (RouteBuilder) routes; builder.setContext(this.getContext()); builder.setRouteCollection(this.getRouteCollection()); builder.setRestCollection(this.getRestCollection()); builder.setErrorHandlerBuilder(this.getErrorHandlerBuilder()); // must invoke configure on the original builder so it adds its configuration to me builder.configure(); } else { getContext().addRoutes(routes); } } @Override public void setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder) { super.setErrorHandlerBuilder(errorHandlerBuilder); getRouteCollection().setErrorHandlerFactory(getErrorHandlerBuilder()); } // Implementation methods // ----------------------------------------------------------------------- protected void checkInitialized() throws Exception { if (initialized.compareAndSet(false, true)) { // Set the CamelContext ErrorHandler here ModelCamelContext camelContext = getContext(); if (camelContext.getErrorHandlerFactory() instanceof ErrorHandlerBuilder) { setErrorHandlerBuilder((ErrorHandlerBuilder) camelContext.getErrorHandlerFactory()); } configure(); // mark all route definitions as custom prepared because // a route builder prepares the route definitions correctly already for (RouteDefinition route : getRouteCollection().getRoutes()) { route.markPrepared(); } } } protected void populateRoutes() throws Exception { ModelCamelContext camelContext = getContext(); if (camelContext == null) { throw new IllegalArgumentException("CamelContext has not been injected!"); } getRouteCollection().setCamelContext(camelContext); camelContext.addRouteDefinitions(getRouteCollection().getRoutes()); } protected void populateRests() throws Exception { ModelCamelContext camelContext = getContext(); if (camelContext == null) { throw new IllegalArgumentException("CamelContext has not been injected!"); } getRestCollection().setCamelContext(camelContext); // setup rest configuration before adding the rests if (getRestConfigurations() != null) { for (Map.Entry<String, RestConfigurationDefinition> entry : getRestConfigurations().entrySet()) { RestConfiguration config = entry.getValue().asRestConfiguration(getContext()); if ("".equals(entry.getKey())) { camelContext.setRestConfiguration(config); } else { camelContext.addRestConfiguration(config); } } } camelContext.addRestDefinitions(getRestCollection().getRests()); // convert rests into routes so we they are routes for runtime List<RouteDefinition> routes = new ArrayList<>(); for (RestDefinition rest : getRestCollection().getRests()) { List<RouteDefinition> list = rest.asRouteDefinition(getContext()); routes.addAll(list); } // convert rests api-doc into routes so they are routes for runtime for (RestConfiguration config : camelContext.getRestConfigurations()) { if (config.getApiContextPath() != null) { // avoid adding rest-api multiple times, in case multiple RouteBuilder classes is added // to the CamelContext, as we only want to setup rest-api once // so we check all existing routes if they have rest-api route already added boolean hasRestApi = false; for (RouteDefinition route : camelContext.getRouteDefinitions()) { FromDefinition from = route.getInputs().get(0); if (from.getUri() != null && from.getUri().startsWith("rest-api:")) { hasRestApi = true; } } if (!hasRestApi) { RouteDefinition route = RestDefinition.asRouteApiDefinition(camelContext, config); log.debug("Adding routeId: {} as rest-api route", route.getId()); routes.add(route); } } } // add the rest routes for (RouteDefinition route : routes) { getRouteCollection().route(route); } } protected void populateTransformers() { ModelCamelContext camelContext = getContext(); if (camelContext == null) { throw new IllegalArgumentException("CamelContext has not been injected!"); } for (TransformerBuilder tdb : transformerBuilders) { tdb.configure(camelContext); } } protected void populateValidators() { ModelCamelContext camelContext = getContext(); if (camelContext == null) { throw new IllegalArgumentException("CamelContext has not been injected!"); } for (ValidatorBuilder vb : validatorBuilders) { vb.configure(camelContext); } } public RestsDefinition getRestCollection() { return restCollection; } public Map<String, RestConfigurationDefinition> getRestConfigurations() { return restConfigurations; } public void setRestCollection(RestsDefinition restCollection) { this.restCollection = restCollection; } public void setRouteCollection(RoutesDefinition routeCollection) { this.routeCollection = routeCollection; } public RoutesDefinition getRouteCollection() { return this.routeCollection; } protected void configureRest(RestDefinition rest) { // noop } protected void configureRoute(RouteDefinition route) { // noop } }
kevinearls/camel
camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
Java
apache-2.0
21,353
/* * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved. * * http://izpack.org/ * http://izpack.codehaus.org/ * * Copyright 2007 Dennis Reil * * 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.izforge.izpack.rules; import com.izforge.izpack.installer.AutomatedInstallData; import com.izforge.izpack.adaptator.IXMLElement; import java.io.Serializable; /** * Abstract base class for all conditions * * @author Dennis Reil, <Dennis.Reil@reddot.de> */ public abstract class Condition implements Serializable { protected String id; protected AutomatedInstallData installdata; public Condition() { this.id = "UNKNOWN"; this.installdata = null; } /** * @return the id */ public String getId() { return this.id; } /** * @param id the id to set */ public void setId(String id) { this.id = id; } public abstract void readFromXML(IXMLElement xmlcondition); public abstract boolean isTrue(); public AutomatedInstallData getInstalldata() { return installdata; } public void setInstalldata(AutomatedInstallData installdata) { this.installdata = installdata; } public String getDependenciesDetails() { return "No dependencies for this condition."; } }
awilhelm/izpack-with-ips
src/lib/com/izforge/izpack/rules/Condition.java
Java
apache-2.0
1,868
/* Test regular cases */ result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, ${library_name_suffix}_test_${type_name}_data1, ${test_data_size}, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = ${library_name}_${type_name}_copy_from_byte_stream( NULL, ${library_name_suffix}_test_${type_name}_data1, ${test_data_size}, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, NULL, ${test_data_size}, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, ${library_name_suffix}_test_${type_name}_data1, (size_t) SSIZE_MAX + 1, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = ${library_name}_${type_name}_copy_from_byte_stream( ${type_name}, ${library_name_suffix}_test_${type_name}_data1, 0, ${library_name_upper_case}_CODEPAGE_WINDOWS_1252, &error ); ${library_name_suffix_upper_case}_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ${library_name_suffix_upper_case}_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: test with invalid codepage */
libyal/libyal
data/source/tests/yal_test_type/function-body-copy_from_byte_stream-with_codepage.c
C
apache-2.0
2,328
-- 22295 replicates from 22294 UPDATE database_instance SET last_seen=last_checked - interval 1 minute where port=22294; UPDATE database_instance SET last_check_partial_success = 1 where port=22294;
github/orchestrator
tests/integration/analysis-unreachable-intermediate-master-partial-success/create.sql
SQL
apache-2.0
199
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_151) on Wed Jul 17 13:50:43 MST 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>LdapKeyStoreConsumer (BOM: * : All 2.5.0.Final API)</title> <meta name="date" content="2019-07-17"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="LdapKeyStoreConsumer (BOM: * : All 2.5.0.Final API)"; } } catch(err) { } //--> var methods = {"i0":6,"i1":18}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/LdapKeyStoreConsumer.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.5.0.Final</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStore.html" title="class in org.wildfly.swarm.config.elytron"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreSupplier.html" title="interface in org.wildfly.swarm.config.elytron"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" target="_top">Frames</a></li> <li><a href="LdapKeyStoreConsumer.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.wildfly.swarm.config.elytron</div> <h2 title="Interface LdapKeyStoreConsumer" class="title">Interface LdapKeyStoreConsumer&lt;T extends <a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStore.html" title="class in org.wildfly.swarm.config.elytron">LdapKeyStore</a>&lt;T&gt;&gt;</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Functional Interface:</dt> <dd>This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.</dd> </dl> <hr> <br> <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/FunctionalInterface.html?is-external=true" title="class or interface in java.lang">@FunctionalInterface</a> public interface <span class="typeNameLabel">LdapKeyStoreConsumer&lt;T extends <a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStore.html" title="class in org.wildfly.swarm.config.elytron">LdapKeyStore</a>&lt;T&gt;&gt;</span></pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html#accept-T-">accept</a></span>(<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="type parameter in LdapKeyStoreConsumer">T</a>&nbsp;value)</code> <div class="block">Configure a pre-constructed instance of LdapKeyStore resource</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>default <a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="interface in org.wildfly.swarm.config.elytron">LdapKeyStoreConsumer</a>&lt;<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="type parameter in LdapKeyStoreConsumer">T</a>&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html#andThen-org.wildfly.swarm.config.elytron.LdapKeyStoreConsumer-">andThen</a></span>(<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="interface in org.wildfly.swarm.config.elytron">LdapKeyStoreConsumer</a>&lt;<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="type parameter in LdapKeyStoreConsumer">T</a>&gt;&nbsp;after)</code>&nbsp;</td> </tr> </table> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="accept-org.wildfly.swarm.config.elytron.LdapKeyStore-"> <!-- --> </a><a name="accept-T-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>accept</h4> <pre>void&nbsp;accept(<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="type parameter in LdapKeyStoreConsumer">T</a>&nbsp;value)</pre> <div class="block">Configure a pre-constructed instance of LdapKeyStore resource</div> </li> </ul> <a name="andThen-org.wildfly.swarm.config.elytron.LdapKeyStoreConsumer-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>andThen</h4> <pre>default&nbsp;<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="interface in org.wildfly.swarm.config.elytron">LdapKeyStoreConsumer</a>&lt;<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="type parameter in LdapKeyStoreConsumer">T</a>&gt;&nbsp;andThen(<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="interface in org.wildfly.swarm.config.elytron">LdapKeyStoreConsumer</a>&lt;<a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" title="type parameter in LdapKeyStoreConsumer">T</a>&gt;&nbsp;after)</pre> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/LdapKeyStoreConsumer.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.5.0.Final</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStore.html" title="class in org.wildfly.swarm.config.elytron"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../org/wildfly/swarm/config/elytron/LdapKeyStoreSupplier.html" title="interface in org.wildfly.swarm.config.elytron"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html" target="_top">Frames</a></li> <li><a href="LdapKeyStoreConsumer.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
wildfly-swarm/wildfly-swarm-javadocs
2.5.0.Final/apidocs/org/wildfly/swarm/config/elytron/LdapKeyStoreConsumer.html
HTML
apache-2.0
11,269
#include <stdio.h> #include "db.h" class CDB : public IDB { // Interfaces public: // Interface for data access virtual HRESULT _stdcall Read(short nTable, short nRow, LPTSTR lpszData); virtual HRESULT _stdcall GetNumRows(short nTable, short &nRows); virtual HRESULT _stdcall QueryInterface(REFIID riid, void** ppObject); virtual ULONG _stdcall AddRef(); virtual ULONG _stdcall Release(); // Implementation private: CPtrArray m_arrTables; // Array of pointers to CStringArray CStringArray m_arrNames; // Array of table names ULONG m_dwRefCount; public: CDB(); virtual ~CDB(); }; class CDBSrvFactory : public IClassFactory { // Interface public: HRESULT _stdcall QueryInterface(REFIID riid, void** ppObject); ULONG _stdcall AddRef(); ULONG _stdcall Release(); HRESULT _stdcall CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppObject); HRESULT _stdcall LockServer(BOOL fLock); // Implementation private: ULONG m_dwRefCount; public: CDBSrvFactory(); }; CDB::CDB() { m_dwRefCount=0; } CDB::~CDB() { } HRESULT CDB::Read(short nTable, short nRow, LPTSTR lpszData) { printf("CDB::Read\n"); return NO_ERROR; } HRESULT CDB::GetNumRows(short nTable, short &nRows) { return NO_ERROR; } HRESULT CDB::QueryInterface(REFIID riid, void** ppObject) { if (riid==IID_IUnknown || riid==IID_IDB) { *ppObject=(IDB*) this; } else { return E_NOINTERFACE; } AddRef(); return NO_ERROR; } ULONG CDB::AddRef() { g_dwRefCount++; m_dwRefCount++; return m_dwRefCount; } ULONG CDB::Release() { g_dwRefCount--; m_dwRefCount--; if (m_dwRefCount==0) { delete this; return 0; } return m_dwRefCount; } ULONG g_dwRefCount=0; // Create a new database object and return a pointer to it. HRESULT CDBSrvFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppObject) { if (pUnkOuter!=NULL) { return CLASS_E_NOAGGREGATION; } CDB* pDB=new CDB; if (FAILED(pDB->QueryInterface(riid, ppObject))) { delete pDB; *ppObject=NULL; return E_NOINTERFACE; } return NO_ERROR; } HRESULT CDBSrvFactory::LockServer(BOOL fLock) { if (fLock) { g_dwRefCount++; } else { g_dwRefCount--; } return NO_ERROR; } CDBSrvFactory::CDBSrvFactory() { m_dwRefCount=0; } HRESULT CDBSrvFactory::QueryInterface(REFIID riid, void** ppObject) { if (riid==IID_IUnknown || riid==IID_IClassFactory) { *ppObject=(IDB*) this; } else { return E_NOINTERFACE; } AddRef(); return NO_ERROR; } ULONG CDBSrvFactory::AddRef() { g_dwRefCount++; m_dwRefCount++; return m_dwRefCount; } ULONG CDBSrvFactory::Release() { g_dwRefCount--; m_dwRefCount--; if (m_dwRefCount==0) { delete this; return 0; } return m_dwRefCount; } STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppObject) { if (rclsid!=CLSID_DBSAMPLE) { return CLASS_E_CLASSNOTAVAILABLE; } CDBSrvFactory *pFactory= new CDBSrvFactory; if (FAILED(pFactory->QueryInterface(riid, ppObject))) { delete pFactory; *ppObject=NULL; return E_INVALIDARG; } return NO_ERROR; } HRESULT _stdcall DllCanUnloadNow() { if (g_dwRefCount) { return S_FALSE; } else { return S_OK; } } STDAPI DllRegisterServer(void) { HKEY hKeyCLSID; DWORD dwDisposition; if (RegCreateKeyEx(HKEY_CLASSES_ROOT, "CLSID\\{30DF3430-0266-11cf-BAA6-00AA003E0EED}", NULL, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) { return E_UNEXPECTED; } return NOERROR; } STDAPI DllUnregisterServer(void) { if (RegDeleteKey(HKEY_CLASSES_ROOT, "CLSID\\{30DF3430-0266-11cf-BAA6-00AA003E0EED}\\InprocServer32") !=ERROR_SUCCESS) { return E_UNEXPECTED; } if (RegDeleteKey(HKEY_CLASSES_ROOT, "CLSID\\{30DF3430-0266-11cf-BAA6-00AA003E0EED}") !=ERROR_SUCCESS) { return E_UNEXPECTED; } return NOERROR; }
dbremner/ulib-win
demo/com/cxx2com/db_com/db.cpp
C++
apache-2.0
4,321
/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See * the License for the specific language governing permissions and limitations under the License. */ package io.reactivex.rxjava3.internal.subscribers; import static org.junit.Assert.*; import java.util.ArrayDeque; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.Test; import org.reactivestreams.Subscription; import io.reactivex.rxjava3.core.RxJavaTest; import io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription; import io.reactivex.rxjava3.testsupport.TestHelper; public class BlockingSubscriberTest extends RxJavaTest { @Test public void doubleOnSubscribe() { TestHelper.doubleOnSubscribe(new BlockingSubscriber<Integer>(new ArrayDeque<>())); } @Test public void cancel() { BlockingSubscriber<Integer> bq = new BlockingSubscriber<>(new ArrayDeque<>()); assertFalse(bq.isCancelled()); bq.cancel(); assertTrue(bq.isCancelled()); bq.cancel(); assertTrue(bq.isCancelled()); } @Test public void blockingFirstDoubleOnSubscribe() { TestHelper.doubleOnSubscribe(new BlockingFirstSubscriber<Integer>()); } @Test public void blockingFirstTimeout() { BlockingFirstSubscriber<Integer> bf = new BlockingFirstSubscriber<>(); Thread.currentThread().interrupt(); try { bf.blockingGet(); fail("Should have thrown!"); } catch (RuntimeException ex) { assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException); } } @Test public void blockingFirstTimeout2() { BlockingFirstSubscriber<Integer> bf = new BlockingFirstSubscriber<>(); bf.onSubscribe(new BooleanSubscription()); Thread.currentThread().interrupt(); try { bf.blockingGet(); fail("Should have thrown!"); } catch (RuntimeException ex) { assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException); } } @Test public void cancelOnRequest() { final BlockingFirstSubscriber<Integer> bf = new BlockingFirstSubscriber<>(); final AtomicBoolean b = new AtomicBoolean(); Subscription s = new Subscription() { @Override public void request(long n) { bf.cancelled = true; } @Override public void cancel() { b.set(true); } }; bf.onSubscribe(s); assertTrue(b.get()); } @Test public void cancelUpfront() { final BlockingFirstSubscriber<Integer> bf = new BlockingFirstSubscriber<>(); final AtomicBoolean b = new AtomicBoolean(); bf.cancelled = true; Subscription s = new Subscription() { @Override public void request(long n) { b.set(true); } @Override public void cancel() { } }; bf.onSubscribe(s); assertFalse(b.get()); } }
ReactiveX/RxJava
src/test/java/io/reactivex/rxjava3/internal/subscribers/BlockingSubscriberTest.java
Java
apache-2.0
3,554
# Copyright 2014 IBM # # 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 registry.ng.bluemix.net/samsungmicrosites/mysql8:new
myhong0/SEC-ASP-myhong1023-2117
Dockerfile
Dockerfile
apache-2.0
643
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package summarizer.receiver; import java.io.File; import java.util.ArrayList; import java.util.List; /** * * @author NOYAF-PC */ public class FileTest { List<File> fichiers; File dossier; public FileTest(File dossier) { fichiers = new ArrayList<>(); getAllFile(dossier); } public void getAllFile(File file){ if(file.exists()){ if(file.isFile()){ fichiers.add(file); } else if(file.isDirectory()){ File[] tabTmp = file.listFiles(); for(File f : tabTmp){ getAllFile(f); } } } } public ArrayList<String> getFilesNames(){ ArrayList<String> list = new ArrayList<>(); for(File f: fichiers){ list.add(f.getName()); } return list; } @Override public String toString(){ String s =""; for(File f: fichiers){ s += f.getName() + "\n"; } return s; } public static void main(String args[]){ FileTest testFile = new FileTest(new File("pcms/")); System.out.println(testFile); } }
REMDJESS/SUMMARIZER
src/test/java/summarizer/receiver/FileTest.java
Java
apache-2.0
1,458
package io.github.mapstream; import java.util.HashMap; import java.util.Map; class Main { public static void main(String[] args) { Map<Integer, Integer> intMap = new HashMap<>(); intMap.put(10, 10); intMap.put(20, 50); Map<Integer, Integer> map = MapStream.from(intMap) .mapKeys(x -> x * 20) .mapValues((key, value) -> value * 50) .toMap() .mapStream() .pairStream() .mapStream() .pairStream() .mapStream() .pairStream() .mapStream() .pairStream() .mapStream() .toMap(); System.out.println(map); } }
mapstream/mapstream
src/main/java/io/github/mapstream/Main.java
Java
apache-2.0
762
package com.hubspot.jinjava.lib.filter; import static org.assertj.core.api.Assertions.assertThat; import com.hubspot.jinjava.BaseInterpretingTest; import com.hubspot.jinjava.interpret.InvalidArgumentException; import com.hubspot.jinjava.interpret.InvalidInputException; import java.math.BigDecimal; import org.junit.Before; import org.junit.Test; public class LogFilterTest extends BaseInterpretingTest { LogFilter filter; @Before public void setup() { filter = new LogFilter(); } @Test public void itCalculatesLogBase2() { assertThat(filter.filter(65536, interpreter, "2")).isEqualTo(16D); } @Test public void itCalculatesLogBase10() { assertThat(filter.filter(100, interpreter, "10")).isEqualTo(2D); } @Test public void itCalculatesLogBaseN() { assertThat(filter.filter(9765625d, interpreter, "45.123")) .isEqualTo(4.224920597763891); } @Test public void itCalculatesBigDecimalLogBaseN() { BigDecimal result = (BigDecimal) filter.filter( new BigDecimal(9765625d), interpreter, "45.123" ); assertThat(result.doubleValue()).isEqualTo(4.224920597763891); } @Test(expected = InvalidInputException.class) public void itErrorsOnNegativeInput() { filter.filter(-10d, interpreter, "5.0"); } @Test(expected = InvalidInputException.class) public void itErrorsOnStringInput() { filter.filter("not a number", interpreter, "5.0"); } @Test(expected = InvalidArgumentException.class) public void itErrorsOnNegativeArgument() { filter.filter(10d, interpreter, "-5.0"); } @Test(expected = InvalidArgumentException.class) public void itErrorsOnStringArgument() { filter.filter(10d, interpreter, "not a number"); } }
HubSpot/jinjava
src/test/java/com/hubspot/jinjava/lib/filter/LogFilterTest.java
Java
apache-2.0
1,736
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_20) on Tue Jul 19 23:14:39 CEST 2011 --> <TITLE> PersistenceUnitRefTypeImpl </TITLE> <META NAME="date" CONTENT="2011-07-19"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="PersistenceUnitRefTypeImpl"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PersistenceUnitRefTypeImpl.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceContextRefTypeImpl.html" title="class in org.jboss.shrinkwrap.descriptor.impl.javaee5"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PropertyTypeImpl.html" title="class in org.jboss.shrinkwrap.descriptor.impl.javaee5"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PersistenceUnitRefTypeImpl.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.jboss.shrinkwrap.descriptor.impl.javaee5</FONT> <BR> Class PersistenceUnitRefTypeImpl&lt;T&gt;</H2> <PRE> java.lang.Object <IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.jboss.shrinkwrap.descriptor.impl.javaee5.PersistenceUnitRefTypeImpl&lt;T&gt;</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD>org.jboss.shrinkwrap.descriptor.api.Child&lt;T&gt;, <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;T&gt;</DD> </DL> <HR> <DL> <DT><PRE>public class <B>PersistenceUnitRefTypeImpl&lt;T&gt;</B><DT>extends java.lang.Object<DT>implements org.jboss.shrinkwrap.descriptor.api.Child&lt;T&gt;, <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;T&gt;</DL> </PRE> <P> This class implements the <code> persistence-unit-refType </code> xsd type <p> Original Documentation: <p> <br> <br> <br> The persistence-unit-ref element contains a declaration <br> of Deployment Component's reference to a persistence unit <br> associated within a Deployment Component's <br> environment. It consists of: <br> <br> - an optional description <br> - the persistence unit reference name <br> - an optional persistence unit name. If not specified, <br> the default persistence unit is assumed. <br> - optional injection targets <br> <br> Examples: <br> <br> <persistence-unit-ref> <br> <persistence-unit-ref-name>myPersistenceUnit <br> </persistence-unit-ref-name> <br> </persistence-unit-ref> <br> <br> <persistence-unit-ref> <br> <persistence-unit-ref-name>myPersistenceUnit <br> </persistence-unit-ref-name> <br> <persistence-unit-name>PersistenceUnit1 <br> </persistence-unit-name> <br> </persistence-unit-ref> <br> <br> <br> <br> <P> <P> <DL> <DT><B>Since:</B></DT> <DD>Generation date :2011-07-19T22:54:35.59+02:00</DD> <DT><B>Author:</B></DT> <DD><a href="mailto:ralf.battenfeld@bluewin.ch">Ralf Battenfeld</a></DD> </DL> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#PersistenceUnitRefTypeImpl(T, java.lang.String, org.jboss.shrinkwrap.descriptor.spi.Node)">PersistenceUnitRefTypeImpl</A></B>(<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&nbsp;t, java.lang.String&nbsp;nodeName, org.jboss.shrinkwrap.descriptor.spi.Node&nbsp;node)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#PersistenceUnitRefTypeImpl(T, java.lang.String, org.jboss.shrinkwrap.descriptor.spi.Node, org.jboss.shrinkwrap.descriptor.spi.Node)">PersistenceUnitRefTypeImpl</A></B>(<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&nbsp;t, java.lang.String&nbsp;nodeName, org.jboss.shrinkwrap.descriptor.spi.Node&nbsp;node, org.jboss.shrinkwrap.descriptor.spi.Node&nbsp;childNode)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.List&lt;java.lang.String&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#getDescriptionList()">getDescriptionList</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns all <code>description</code> elements</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.List&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/InjectionTargetType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">InjectionTargetType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;&gt;&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#getInjectionTargetList()">getInjectionTargetList</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns all <code>injection-target</code> elements</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#getMappedName()">getMappedName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <code>mapped-name</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#getPersistenceUnitName()">getPersistenceUnitName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <code>persistence-unit-name</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#getPersistenceUnitRefName()">getPersistenceUnitRefName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <code>persistence-unit-ref-name</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/InjectionTargetType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">InjectionTargetType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#injectionTarget()">injectionTarget</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <code>injection-target</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#removeAllDescription()">removeAllDescription</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes the <code>description</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#removeAllInjectionTarget()">removeAllInjectionTarget</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes all <code>injection-target</code> elements</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#removeMappedName()">removeMappedName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes the <code>mapped-name</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#removePersistenceUnitName()">removePersistenceUnitName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes the <code>persistence-unit-name</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#removePersistenceUnitRefName()">removePersistenceUnitRefName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Removes the <code>persistence-unit-ref-name</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#setDescription(java.lang.String)">setDescription</A></B>(java.lang.String&nbsp;description)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>description</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#setDescriptionList(java.lang.String...)">setDescriptionList</A></B>(java.lang.String...&nbsp;values)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates for all String objects representing <code>description</code> elements, a new <code>description</code> element</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#setMappedName(java.lang.String)">setMappedName</A></B>(java.lang.String&nbsp;mappedName)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If not already created, a new <code>mapped-name</code> element with the given value will be created.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#setPersistenceUnitName(java.lang.String)">setPersistenceUnitName</A></B>(java.lang.String&nbsp;persistenceUnitName)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If not already created, a new <code>persistence-unit-name</code> element with the given value will be created.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#setPersistenceUnitRefName(java.lang.String)">setPersistenceUnitRefName</A></B>(java.lang.String&nbsp;persistenceUnitRefName)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If not already created, a new <code>persistence-unit-ref-name</code> element with the given value will be created.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html#up()">up</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="PersistenceUnitRefTypeImpl(java.lang.Object,java.lang.String,org.jboss.shrinkwrap.descriptor.spi.Node)"><!-- --></A><A NAME="PersistenceUnitRefTypeImpl(T, java.lang.String, org.jboss.shrinkwrap.descriptor.spi.Node)"><!-- --></A><H3> PersistenceUnitRefTypeImpl</H3> <PRE> public <B>PersistenceUnitRefTypeImpl</B>(<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&nbsp;t, java.lang.String&nbsp;nodeName, org.jboss.shrinkwrap.descriptor.spi.Node&nbsp;node)</PRE> <DL> </DL> <HR> <A NAME="PersistenceUnitRefTypeImpl(java.lang.Object,java.lang.String,org.jboss.shrinkwrap.descriptor.spi.Node,org.jboss.shrinkwrap.descriptor.spi.Node)"><!-- --></A><A NAME="PersistenceUnitRefTypeImpl(T, java.lang.String, org.jboss.shrinkwrap.descriptor.spi.Node, org.jboss.shrinkwrap.descriptor.spi.Node)"><!-- --></A><H3> PersistenceUnitRefTypeImpl</H3> <PRE> public <B>PersistenceUnitRefTypeImpl</B>(<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&nbsp;t, java.lang.String&nbsp;nodeName, org.jboss.shrinkwrap.descriptor.spi.Node&nbsp;node, org.jboss.shrinkwrap.descriptor.spi.Node&nbsp;childNode)</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="up()"><!-- --></A><H3> up</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A> <B>up</B>()</PRE> <DL> <DD><DL> <DT><B>Specified by:</B><DD><CODE>up</CODE> in interface <CODE>org.jboss.shrinkwrap.descriptor.api.Child&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="setMappedName(java.lang.String)"><!-- --></A><H3> setMappedName</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>setMappedName</B>(java.lang.String&nbsp;mappedName)</PRE> <DL> <DD>If not already created, a new <code>mapped-name</code> element with the given value will be created. Otherwise, the existing <code>mapped-name</code> element will be updated with the given value. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#setMappedName(java.lang.String)">setMappedName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="removeMappedName()"><!-- --></A><H3> removeMappedName</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>removeMappedName</B>()</PRE> <DL> <DD>Removes the <code>mapped-name</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#removeMappedName()">removeMappedName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="getMappedName()"><!-- --></A><H3> getMappedName</H3> <PRE> public java.lang.String <B>getMappedName</B>()</PRE> <DL> <DD>Returns the <code>mapped-name</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#getMappedName()">getMappedName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the node defined for the element <code>mapped-name</code></DL> </DD> </DL> <HR> <A NAME="removeAllInjectionTarget()"><!-- --></A><H3> removeAllInjectionTarget</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>removeAllInjectionTarget</B>()</PRE> <DL> <DD>Removes all <code>injection-target</code> elements <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#removeAllInjectionTarget()">removeAllInjectionTarget</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="injectionTarget()"><!-- --></A><H3> injectionTarget</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/InjectionTargetType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">InjectionTargetType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;&gt; <B>injectionTarget</B>()</PRE> <DL> <DD>Returns the <code>injection-target</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#injectionTarget()">injectionTarget</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the node defined for the element <code>injection-target</code></DL> </DD> </DL> <HR> <A NAME="getInjectionTargetList()"><!-- --></A><H3> getInjectionTargetList</H3> <PRE> public java.util.List&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/InjectionTargetType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">InjectionTargetType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;&gt;&gt; <B>getInjectionTargetList</B>()</PRE> <DL> <DD>Returns all <code>injection-target</code> elements <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#getInjectionTargetList()">getInjectionTargetList</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>list of <code>injection-target</code></DL> </DD> </DL> <HR> <A NAME="setDescription(java.lang.String)"><!-- --></A><H3> setDescription</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>setDescription</B>(java.lang.String&nbsp;description)</PRE> <DL> <DD>Creates a new <code>description</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#setDescription(java.lang.String)">setDescription</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="setDescriptionList(java.lang.String...)"><!-- --></A><H3> setDescriptionList</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>setDescriptionList</B>(java.lang.String...&nbsp;values)</PRE> <DL> <DD>Creates for all String objects representing <code>description</code> elements, a new <code>description</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#setDescriptionList(java.lang.String...)">setDescriptionList</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>list</CODE> - of <code>description</code> objects <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="removeAllDescription()"><!-- --></A><H3> removeAllDescription</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>removeAllDescription</B>()</PRE> <DL> <DD>Removes the <code>description</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#removeAllDescription()">removeAllDescription</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="getDescriptionList()"><!-- --></A><H3> getDescriptionList</H3> <PRE> public java.util.List&lt;java.lang.String&gt; <B>getDescriptionList</B>()</PRE> <DL> <DD>Returns all <code>description</code> elements <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#getDescriptionList()">getDescriptionList</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>list of <code>description</code></DL> </DD> </DL> <HR> <A NAME="setPersistenceUnitRefName(java.lang.String)"><!-- --></A><H3> setPersistenceUnitRefName</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>setPersistenceUnitRefName</B>(java.lang.String&nbsp;persistenceUnitRefName)</PRE> <DL> <DD>If not already created, a new <code>persistence-unit-ref-name</code> element with the given value will be created. Otherwise, the existing <code>persistence-unit-ref-name</code> element will be updated with the given value. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#setPersistenceUnitRefName(java.lang.String)">setPersistenceUnitRefName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="removePersistenceUnitRefName()"><!-- --></A><H3> removePersistenceUnitRefName</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>removePersistenceUnitRefName</B>()</PRE> <DL> <DD>Removes the <code>persistence-unit-ref-name</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#removePersistenceUnitRefName()">removePersistenceUnitRefName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="getPersistenceUnitRefName()"><!-- --></A><H3> getPersistenceUnitRefName</H3> <PRE> public java.lang.String <B>getPersistenceUnitRefName</B>()</PRE> <DL> <DD>Returns the <code>persistence-unit-ref-name</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#getPersistenceUnitRefName()">getPersistenceUnitRefName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the node defined for the element <code>persistence-unit-ref-name</code></DL> </DD> </DL> <HR> <A NAME="setPersistenceUnitName(java.lang.String)"><!-- --></A><H3> setPersistenceUnitName</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>setPersistenceUnitName</B>(java.lang.String&nbsp;persistenceUnitName)</PRE> <DL> <DD>If not already created, a new <code>persistence-unit-name</code> element with the given value will be created. Otherwise, the existing <code>persistence-unit-name</code> element will be updated with the given value. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#setPersistenceUnitName(java.lang.String)">setPersistenceUnitName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="removePersistenceUnitName()"><!-- --></A><H3> removePersistenceUnitName</H3> <PRE> public <A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt; <B>removePersistenceUnitName</B>()</PRE> <DL> <DD>Removes the <code>persistence-unit-name</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#removePersistenceUnitName()">removePersistenceUnitName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the current instance of <CODE>PersistenceUnitRefType<T></CODE></DL> </DD> </DL> <HR> <A NAME="getPersistenceUnitName()"><!-- --></A><H3> getPersistenceUnitName</H3> <PRE> public java.lang.String <B>getPersistenceUnitName</B>()</PRE> <DL> <DD>Returns the <code>persistence-unit-name</code> element <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html#getPersistenceUnitName()">getPersistenceUnitName</A></CODE> in interface <CODE><A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/api/javaee5/PersistenceUnitRefType.html" title="interface in org.jboss.shrinkwrap.descriptor.api.javaee5">PersistenceUnitRefType</A>&lt;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" title="type parameter in PersistenceUnitRefTypeImpl">T</A>&gt;</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the node defined for the element <code>persistence-unit-name</code></DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PersistenceUnitRefTypeImpl.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceContextRefTypeImpl.html" title="class in org.jboss.shrinkwrap.descriptor.impl.javaee5"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../org/jboss/shrinkwrap/descriptor/impl/javaee5/PropertyTypeImpl.html" title="class in org.jboss.shrinkwrap.descriptor.impl.javaee5"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PersistenceUnitRefTypeImpl.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
shrinkwrap/descriptors
gen/doc/org/jboss/shrinkwrap/descriptor/impl/javaee5/PersistenceUnitRefTypeImpl.html
HTML
apache-2.0
48,036
body {font-family:Verdana Arial sans-serif; font-size:18px; } .main {max-width:900px; margin:0 auto 0 auto; } .tabs {margin:0; padding:0; } .tabs li {float:left; list-style:none; margin-right:10px; } .tabs a {display:block; text-decoration:none; padding:3px 5px; } .tabs a.active { background:grey; } .panelContainer {clear:left; } .panel {color:darkblue; background:#c1ed78; height:inherit; } #form { position:relative; max-width:400px; left:25%; /*border:1px solid black;*/ background:#c1ed78; } #form p { position:relative; left:30%; } #form ul li{display:block; margin:10px 10px 10px 10px; } #form .input {float:right; overflow:hidden; } #form .label{margin-right:10px; } #select {float:right; } #down {float:right; } .imgF { width:75px; height:75px; position:absolute; border:1px solid black; margin:10px 10px 10px 10px; } /*.divPic{ position:absolute; width:75px; height:75px; border:1px solid black; margin:10px 10px 10px 10px; }*/ .news{ float:right; width:85%; padding:10px; text-indent:20px; overflow:auto; resize:vertical; } .news::first-letter{ font-size:20px; } .news::selection{ color:white; background-color:white; } .news:hover { transform:scale(1.1); background:yellowgreen; opacity:0.7; } footer {padding:10px 10px 10px 10px; background:#d95353; text-align:right; } /*za AddValuta*/ #add { position:relative; max-width:400px; list-style-type:none; left:25%; /*border:1px solid black;*/ background:#c1ed78; } #add li{display:block; margin:10px 10px 10px 10px; } #add .input {float:right; overflow:hidden; } #add #btnValuta {float:right; overflow:hidden; } #dictionary { float:left; background:yellow; } .clear {clear:both; } .letters li { background:red; display:inline-block; }
donahuedtg/dtg
styleTabs.css
CSS
apache-2.0
2,498
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_151) on Wed May 02 00:35:12 MST 2018 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.wildfly.swarm.config.infinispan.cache_container.DistributedCache (BOM: * : All 2018.5.0 API)</title> <meta name="date" content="2018-05-02"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.wildfly.swarm.config.infinispan.cache_container.DistributedCache (BOM: * : All 2018.5.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">WildFly Swarm API, 2018.5.0</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?org/wildfly/swarm/config/infinispan/cache_container/class-use/DistributedCache.html" target="_top">Frames</a></li> <li><a href="DistributedCache.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.wildfly.swarm.config.infinispan.cache_container.DistributedCache" class="title">Uses of Class<br>org.wildfly.swarm.config.infinispan.cache_container.DistributedCache</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.infinispan">org.wildfly.swarm.config.infinispan</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.infinispan.cache_container">org.wildfly.swarm.config.infinispan.cache_container</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config.infinispan"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a> in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a> that return <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></code></td> <td class="colLast"><span class="typeNameLabel">CacheContainer.CacheContainerResources.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.CacheContainerResources.html#distributedCache-java.lang.String-">distributedCache</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;key)</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a> that return types with arguments of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">CacheContainer.CacheContainerResources.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.CacheContainerResources.html#distributedCaches--">distributedCaches</a></span>()</code> <div class="block">Get the list of DistributedCache resources</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a> with parameters of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html" title="type parameter in CacheContainer">T</a></code></td> <td class="colLast"><span class="typeNameLabel">CacheContainer.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html#distributedCache-org.wildfly.swarm.config.infinispan.cache_container.DistributedCache-">distributedCache</a></span>(<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a>&nbsp;value)</code> <div class="block">Add the DistributedCache object to the list of subresources</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Method parameters in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a> with type arguments of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html" title="type parameter in CacheContainer">T</a></code></td> <td class="colLast"><span class="typeNameLabel">CacheContainer.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html#distributedCaches-java.util.List-">distributedCaches</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a>&gt;&nbsp;value)</code> <div class="block">Add all DistributedCache objects to this subresource</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.wildfly.swarm.config.infinispan.cache_container"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a> in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a> with type parameters of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a>&lt;T extends <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a>&lt;T&gt;&gt;</span></code> <div class="block">A distributed cache configuration.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCacheConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">DistributedCacheConsumer</a>&lt;T extends <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCacheSupplier.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">DistributedCacheSupplier</a>&lt;T extends <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a>&gt;</span></code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a> that return <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">DistributedCache</a></code></td> <td class="colLast"><span class="typeNameLabel">DistributedCacheSupplier.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCacheSupplier.html#get--">get</a></span>()</code> <div class="block">Constructed instance of DistributedCache resource</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/DistributedCache.html" title="class in org.wildfly.swarm.config.infinispan.cache_container">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">WildFly Swarm API, 2018.5.0</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?org/wildfly/swarm/config/infinispan/cache_container/class-use/DistributedCache.html" target="_top">Frames</a></li> <li><a href="DistributedCache.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
wildfly-swarm/wildfly-swarm-javadocs
2018.5.0/apidocs/org/wildfly/swarm/config/infinispan/cache_container/class-use/DistributedCache.html
HTML
apache-2.0
17,039
/* Copyright 2022 The Kubernetes 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 io.kubernetes.client.openapi.models; /** Generated */ public class V1beta1EndpointFluentImpl< A extends io.kubernetes.client.openapi.models.V1beta1EndpointFluent<A>> extends io.kubernetes.client.fluent.BaseFluent<A> implements io.kubernetes.client.openapi.models.V1beta1EndpointFluent<A> { public V1beta1EndpointFluentImpl() {} public V1beta1EndpointFluentImpl(io.kubernetes.client.openapi.models.V1beta1Endpoint instance) { this.withAddresses(instance.getAddresses()); this.withConditions(instance.getConditions()); this.withHints(instance.getHints()); this.withHostname(instance.getHostname()); this.withNodeName(instance.getNodeName()); this.withTargetRef(instance.getTargetRef()); this.withTopology(instance.getTopology()); } private java.util.List<java.lang.String> addresses; private io.kubernetes.client.openapi.models.V1beta1EndpointConditionsBuilder conditions; private io.kubernetes.client.openapi.models.V1beta1EndpointHintsBuilder hints; private java.lang.String hostname; private java.lang.String nodeName; private io.kubernetes.client.openapi.models.V1ObjectReferenceBuilder targetRef; private java.util.Map<java.lang.String, java.lang.String> topology; public A addToAddresses(java.lang.Integer index, java.lang.String item) { if (this.addresses == null) { this.addresses = new java.util.ArrayList<java.lang.String>(); } this.addresses.add(index, item); return (A) this; } public A setToAddresses(java.lang.Integer index, java.lang.String item) { if (this.addresses == null) { this.addresses = new java.util.ArrayList<java.lang.String>(); } this.addresses.set(index, item); return (A) this; } public A addToAddresses(java.lang.String... items) { if (this.addresses == null) { this.addresses = new java.util.ArrayList<java.lang.String>(); } for (java.lang.String item : items) { this.addresses.add(item); } return (A) this; } public A addAllToAddresses(java.util.Collection<java.lang.String> items) { if (this.addresses == null) { this.addresses = new java.util.ArrayList<java.lang.String>(); } for (java.lang.String item : items) { this.addresses.add(item); } return (A) this; } public A removeFromAddresses(java.lang.String... items) { for (java.lang.String item : items) { if (this.addresses != null) { this.addresses.remove(item); } } return (A) this; } public A removeAllFromAddresses(java.util.Collection<java.lang.String> items) { for (java.lang.String item : items) { if (this.addresses != null) { this.addresses.remove(item); } } return (A) this; } public java.util.List<java.lang.String> getAddresses() { return this.addresses; } public java.lang.String getAddress(java.lang.Integer index) { return this.addresses.get(index); } public java.lang.String getFirstAddress() { return this.addresses.get(0); } public java.lang.String getLastAddress() { return this.addresses.get(addresses.size() - 1); } public java.lang.String getMatchingAddress( java.util.function.Predicate<java.lang.String> predicate) { for (java.lang.String item : addresses) { if (predicate.test(item)) { return item; } } return null; } public java.lang.Boolean hasMatchingAddress( java.util.function.Predicate<java.lang.String> predicate) { for (java.lang.String item : addresses) { if (predicate.test(item)) { return true; } } return false; } public A withAddresses(java.util.List<java.lang.String> addresses) { if (addresses != null) { this.addresses = new java.util.ArrayList(); for (java.lang.String item : addresses) { this.addToAddresses(item); } } else { this.addresses = null; } return (A) this; } public A withAddresses(java.lang.String... addresses) { if (this.addresses != null) { this.addresses.clear(); } if (addresses != null) { for (java.lang.String item : addresses) { this.addToAddresses(item); } } return (A) this; } public java.lang.Boolean hasAddresses() { return addresses != null && !addresses.isEmpty(); } public A addNewAddress(java.lang.String original) { return (A) addToAddresses(new String(original)); } /** * This method has been deprecated, please use method buildConditions instead. * * @return The buildable object. */ @java.lang.Deprecated public io.kubernetes.client.openapi.models.V1beta1EndpointConditions getConditions() { return this.conditions != null ? this.conditions.build() : null; } public io.kubernetes.client.openapi.models.V1beta1EndpointConditions buildConditions() { return this.conditions != null ? this.conditions.build() : null; } public A withConditions( io.kubernetes.client.openapi.models.V1beta1EndpointConditions conditions) { _visitables.get("conditions").remove(this.conditions); if (conditions != null) { this.conditions = new io.kubernetes.client.openapi.models.V1beta1EndpointConditionsBuilder(conditions); _visitables.get("conditions").add(this.conditions); } return (A) this; } public java.lang.Boolean hasConditions() { return this.conditions != null; } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.ConditionsNested<A> withNewConditions() { return new io.kubernetes.client.openapi.models.V1beta1EndpointFluentImpl.ConditionsNestedImpl(); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.ConditionsNested<A> withNewConditionsLike(io.kubernetes.client.openapi.models.V1beta1EndpointConditions item) { return new io.kubernetes.client.openapi.models.V1beta1EndpointFluentImpl.ConditionsNestedImpl( item); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.ConditionsNested<A> editConditions() { return withNewConditionsLike(getConditions()); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.ConditionsNested<A> editOrNewConditions() { return withNewConditionsLike( getConditions() != null ? getConditions() : new io.kubernetes.client.openapi.models.V1beta1EndpointConditionsBuilder().build()); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.ConditionsNested<A> editOrNewConditionsLike(io.kubernetes.client.openapi.models.V1beta1EndpointConditions item) { return withNewConditionsLike(getConditions() != null ? getConditions() : item); } /** * This method has been deprecated, please use method buildHints instead. * * @return The buildable object. */ @java.lang.Deprecated public io.kubernetes.client.openapi.models.V1beta1EndpointHints getHints() { return this.hints != null ? this.hints.build() : null; } public io.kubernetes.client.openapi.models.V1beta1EndpointHints buildHints() { return this.hints != null ? this.hints.build() : null; } public A withHints(io.kubernetes.client.openapi.models.V1beta1EndpointHints hints) { _visitables.get("hints").remove(this.hints); if (hints != null) { this.hints = new io.kubernetes.client.openapi.models.V1beta1EndpointHintsBuilder(hints); _visitables.get("hints").add(this.hints); } return (A) this; } public java.lang.Boolean hasHints() { return this.hints != null; } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.HintsNested<A> withNewHints() { return new io.kubernetes.client.openapi.models.V1beta1EndpointFluentImpl.HintsNestedImpl(); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.HintsNested<A> withNewHintsLike( io.kubernetes.client.openapi.models.V1beta1EndpointHints item) { return new io.kubernetes.client.openapi.models.V1beta1EndpointFluentImpl.HintsNestedImpl(item); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.HintsNested<A> editHints() { return withNewHintsLike(getHints()); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.HintsNested<A> editOrNewHints() { return withNewHintsLike( getHints() != null ? getHints() : new io.kubernetes.client.openapi.models.V1beta1EndpointHintsBuilder().build()); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.HintsNested<A> editOrNewHintsLike(io.kubernetes.client.openapi.models.V1beta1EndpointHints item) { return withNewHintsLike(getHints() != null ? getHints() : item); } public java.lang.String getHostname() { return this.hostname; } public A withHostname(java.lang.String hostname) { this.hostname = hostname; return (A) this; } public java.lang.Boolean hasHostname() { return this.hostname != null; } /** Method is deprecated. use withHostname instead. */ @java.lang.Deprecated public A withNewHostname(java.lang.String original) { return (A) withHostname(new String(original)); } public java.lang.String getNodeName() { return this.nodeName; } public A withNodeName(java.lang.String nodeName) { this.nodeName = nodeName; return (A) this; } public java.lang.Boolean hasNodeName() { return this.nodeName != null; } /** Method is deprecated. use withNodeName instead. */ @java.lang.Deprecated public A withNewNodeName(java.lang.String original) { return (A) withNodeName(new String(original)); } /** * This method has been deprecated, please use method buildTargetRef instead. * * @return The buildable object. */ @java.lang.Deprecated public io.kubernetes.client.openapi.models.V1ObjectReference getTargetRef() { return this.targetRef != null ? this.targetRef.build() : null; } public io.kubernetes.client.openapi.models.V1ObjectReference buildTargetRef() { return this.targetRef != null ? this.targetRef.build() : null; } public A withTargetRef(io.kubernetes.client.openapi.models.V1ObjectReference targetRef) { _visitables.get("targetRef").remove(this.targetRef); if (targetRef != null) { this.targetRef = new io.kubernetes.client.openapi.models.V1ObjectReferenceBuilder(targetRef); _visitables.get("targetRef").add(this.targetRef); } return (A) this; } public java.lang.Boolean hasTargetRef() { return this.targetRef != null; } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.TargetRefNested<A> withNewTargetRef() { return new io.kubernetes.client.openapi.models.V1beta1EndpointFluentImpl.TargetRefNestedImpl(); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.TargetRefNested<A> withNewTargetRefLike(io.kubernetes.client.openapi.models.V1ObjectReference item) { return new io.kubernetes.client.openapi.models.V1beta1EndpointFluentImpl.TargetRefNestedImpl( item); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.TargetRefNested<A> editTargetRef() { return withNewTargetRefLike(getTargetRef()); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.TargetRefNested<A> editOrNewTargetRef() { return withNewTargetRefLike( getTargetRef() != null ? getTargetRef() : new io.kubernetes.client.openapi.models.V1ObjectReferenceBuilder().build()); } public io.kubernetes.client.openapi.models.V1beta1EndpointFluent.TargetRefNested<A> editOrNewTargetRefLike(io.kubernetes.client.openapi.models.V1ObjectReference item) { return withNewTargetRefLike(getTargetRef() != null ? getTargetRef() : item); } public A addToTopology(java.lang.String key, java.lang.String value) { if (this.topology == null && key != null && value != null) { this.topology = new java.util.LinkedHashMap(); } if (key != null && value != null) { this.topology.put(key, value); } return (A) this; } public A addToTopology(java.util.Map<java.lang.String, java.lang.String> map) { if (this.topology == null && map != null) { this.topology = new java.util.LinkedHashMap(); } if (map != null) { this.topology.putAll(map); } return (A) this; } public A removeFromTopology(java.lang.String key) { if (this.topology == null) { return (A) this; } if (key != null && this.topology != null) { this.topology.remove(key); } return (A) this; } public A removeFromTopology(java.util.Map<java.lang.String, java.lang.String> map) { if (this.topology == null) { return (A) this; } if (map != null) { for (Object key : map.keySet()) { if (this.topology != null) { this.topology.remove(key); } } } return (A) this; } public java.util.Map<java.lang.String, java.lang.String> getTopology() { return this.topology; } public <K, V> A withTopology(java.util.Map<java.lang.String, java.lang.String> topology) { if (topology == null) { this.topology = null; } else { this.topology = new java.util.LinkedHashMap(topology); } return (A) this; } public java.lang.Boolean hasTopology() { return this.topology != null; } public boolean equals(java.lang.Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; V1beta1EndpointFluentImpl that = (V1beta1EndpointFluentImpl) o; if (addresses != null ? !addresses.equals(that.addresses) : that.addresses != null) return false; if (conditions != null ? !conditions.equals(that.conditions) : that.conditions != null) return false; if (hints != null ? !hints.equals(that.hints) : that.hints != null) return false; if (hostname != null ? !hostname.equals(that.hostname) : that.hostname != null) return false; if (nodeName != null ? !nodeName.equals(that.nodeName) : that.nodeName != null) return false; if (targetRef != null ? !targetRef.equals(that.targetRef) : that.targetRef != null) return false; if (topology != null ? !topology.equals(that.topology) : that.topology != null) return false; return true; } public int hashCode() { return java.util.Objects.hash( addresses, conditions, hints, hostname, nodeName, targetRef, topology, super.hashCode()); } public class ConditionsNestedImpl<N> extends io.kubernetes.client.openapi.models.V1beta1EndpointConditionsFluentImpl< io.kubernetes.client.openapi.models.V1beta1EndpointFluent.ConditionsNested<N>> implements io.kubernetes.client.openapi.models.V1beta1EndpointFluent.ConditionsNested<N>, io.kubernetes.client.fluent.Nested<N> { ConditionsNestedImpl(io.kubernetes.client.openapi.models.V1beta1EndpointConditions item) { this.builder = new io.kubernetes.client.openapi.models.V1beta1EndpointConditionsBuilder(this, item); } ConditionsNestedImpl() { this.builder = new io.kubernetes.client.openapi.models.V1beta1EndpointConditionsBuilder(this); } io.kubernetes.client.openapi.models.V1beta1EndpointConditionsBuilder builder; public N and() { return (N) V1beta1EndpointFluentImpl.this.withConditions(builder.build()); } public N endConditions() { return and(); } } public class HintsNestedImpl<N> extends io.kubernetes.client.openapi.models.V1beta1EndpointHintsFluentImpl< io.kubernetes.client.openapi.models.V1beta1EndpointFluent.HintsNested<N>> implements io.kubernetes.client.openapi.models.V1beta1EndpointFluent.HintsNested<N>, io.kubernetes.client.fluent.Nested<N> { HintsNestedImpl(io.kubernetes.client.openapi.models.V1beta1EndpointHints item) { this.builder = new io.kubernetes.client.openapi.models.V1beta1EndpointHintsBuilder(this, item); } HintsNestedImpl() { this.builder = new io.kubernetes.client.openapi.models.V1beta1EndpointHintsBuilder(this); } io.kubernetes.client.openapi.models.V1beta1EndpointHintsBuilder builder; public N and() { return (N) V1beta1EndpointFluentImpl.this.withHints(builder.build()); } public N endHints() { return and(); } } public class TargetRefNestedImpl<N> extends io.kubernetes.client.openapi.models.V1ObjectReferenceFluentImpl< io.kubernetes.client.openapi.models.V1beta1EndpointFluent.TargetRefNested<N>> implements io.kubernetes.client.openapi.models.V1beta1EndpointFluent.TargetRefNested<N>, io.kubernetes.client.fluent.Nested<N> { TargetRefNestedImpl(io.kubernetes.client.openapi.models.V1ObjectReference item) { this.builder = new io.kubernetes.client.openapi.models.V1ObjectReferenceBuilder(this, item); } TargetRefNestedImpl() { this.builder = new io.kubernetes.client.openapi.models.V1ObjectReferenceBuilder(this); } io.kubernetes.client.openapi.models.V1ObjectReferenceBuilder builder; public N and() { return (N) V1beta1EndpointFluentImpl.this.withTargetRef(builder.build()); } public N endTargetRef() { return and(); } } }
kubernetes-client/java
fluent/src/main/java/io/kubernetes/client/openapi/models/V1beta1EndpointFluentImpl.java
Java
apache-2.0
17,836
package com.talentica.androidkotlin.customcamera.dagger; import android.app.Activity; import android.app.Application; import androidx.annotation.NonNull; import com.talentica.androidkotlin.customcamera.BaseApplication; public class Components { private Components() { throw new AssertionError("No instances."); } public static <T> T from(@NonNull Activity activity) { return ((HasComponent<T>) activity).getComponent(); } public static ApplicationComponent from(@NonNull Application application) { return ((BaseApplication) application).getComponent(); } }
Talentica/AndroidWithKotlin
customcamera/src/main/java/com/talentica/androidkotlin/customcamera/dagger/Components.java
Java
apache-2.0
611
# Gloeomucro yakusimensis (Kobayasi) R.H. Petersen, 1980 SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in Mycologia 72(2): 303 (1980) #### Original name Myxomycidium yakusimense Kobayasi, 1954 ### Remarks null
mdoering/backbone
life/Fungi/Basidiomycota/Agaricomycetes/Cantharellales/Hydnaceae/Gloeomucro/Gloeomucro yakusimensis/README.md
Markdown
apache-2.0
270
# Tremolecia atrata (Ach.) Hertel SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in Ergebn. Forsch. Unternehmens Nepal Himal. 6(3): 351 (1977) #### Original name Gyalecta atrata Ach. ### Remarks null
mdoering/backbone
life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Hymeneliaceae/Tremolecia/Tremolecia atrata/README.md
Markdown
apache-2.0
259
# Macrolomia Schrad. ex Nees GENUS #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Liliopsida/Poales/Cyperaceae/Macrolomia/README.md
Markdown
apache-2.0
174
# Polygonum camporum Meisn. SPECIES #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Polygonaceae/Polygonum/Polygonum striatulum/ Syn. Polygonum camporum/README.md
Markdown
apache-2.0
182
# Rhizoctonia solani var. cichorii-endiviae Schultz VARIETY #### Status ACCEPTED #### According to Index Fungorum #### Published in Arb. biol. Reichsanst. Land-u. Forstw. 22: 30 (1936) #### Original name Rhizoctonia solani var. cichorii-endiviae Schultz ### Remarks null
mdoering/backbone
life/Fungi/Basidiomycota/Agaricomycetes/Cantharellales/Ceratobasidiaceae/Thanatephorus/Thanatephorus cucumeris/Rhizoctonia solani cichorii-endiviae/README.md
Markdown
apache-2.0
275
# Hieracium sparsum subsp. chromolepium (Zahn) Zahn SUBSPECIES #### Status ACCEPTED #### According to Euro+Med Plantbase #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Murorum/Murorum murorum/Murorum murorum stenocranum/Hieracium sparsum chromolepium/README.md
Markdown
apache-2.0
189
# Placocarpus schaereri (Fr.) Breuss SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in Pl. Syst. Evol. 148(3-4): 314 (1985) #### Original name Parmelia schaereri Fr. ### Remarks null
mdoering/backbone
life/Fungi/Ascomycota/Eurotiomycetes/Verrucariales/Verrucariaceae/Placocarpus/Placocarpus schaereri/README.md
Markdown
apache-2.0
242
# Acineta quadripartita Claparède & Lachmann SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Protozoa/Ciliophora/Kinetofragminophora/Suctorida/Acinetidae/Acineta/Acineta quadripartita/README.md
Markdown
apache-2.0
201
# Polygonium clarum (Fombella, 1978) Sarjeant & Stancliffe, 1994 SPECIES #### Status ACCEPTED #### According to Interim Register of Marine and Nonmarine Genera #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Protozoa/Acritarcha/Polygonium/Polygonium clarum/README.md
Markdown
apache-2.0
228
# Tristaniopsis elliptica (Stapf) Peter G.Wilson & J.T.Waterh. SPECIES #### Status ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name Tristania elliptica Stapf ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Myrtales/Myrtaceae/Tristaniopsis/Tristaniopsis elliptica/README.md
Markdown
apache-2.0
239
""" This example demonstrate how status works """ from juju import jasyncio from juju import loop import logging import sys from logging import getLogger from juju.model import Model from juju.status import formatted_status LOG = getLogger(__name__) logging.basicConfig(stream=sys.stdout, level=logging.INFO) async def main(): model = Model() await model.connect_current() application = await model.deploy( 'cs:ubuntu-10', application_name='ubuntu', series='trusty', channel='stable', ) await jasyncio.sleep(10) # Print the status to observe the evolution # during a minute for i in range(12): try: # By setting raw to True, the returned # entry contains a FullStatus object with # all the available status data. # status = await model.status(raw=True) status = await formatted_status(model) print(status) except Exception as e: print(e) await jasyncio.sleep(5) await application.remove() await model.disconnect() if __name__ == '__main__': loop.run(main())
juju/python-libjuju
examples/status.py
Python
apache-2.0
1,149
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package aip0131 import ( "testing" "github.com/googleapis/api-linter/rules/internal/testutils" ) func TestHttpNameField(t *testing.T) { tests := []struct { testName string URI string MethodName string problems testutils.Problems }{ {"Valid", "/v1/{name=publishers/*/books/*}", "GetBook", testutils.Problems{}}, {"InvalidVarName", "/v1/{book=publishers/*/books/*}", "GetBook", testutils.Problems{{Message: "`name`"}}}, {"NoVarName", "/v1/publishers/*/books/*", "GetBook", testutils.Problems{{Message: "`name`"}}}, {"Irrelevant", "/v1/{book=publishers/*/books/*}", "AcquireBook", testutils.Problems{}}, } for _, test := range tests { t.Run(test.testName, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/annotations.proto"; service Library { rpc {{.MethodName}}({{.MethodName}}Request) returns ({{.MethodName}}Response) { option (google.api.http) = { get: "{{.URI}}" }; } } message {{.MethodName}}Request {} message {{.MethodName}}Response {} `, test) method := f.GetServices()[0].GetMethods()[0] if diff := test.problems.SetDescriptor(method).Diff(httpNameField.Lint(f)); diff != "" { t.Error(diff) } }) } }
googleapis/api-linter
rules/aip0131/http_uri_name_test.go
GO
apache-2.0
1,833
// Copyright 2017 Twitter. 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. /** * 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.twitter.heron.api.utils; import com.twitter.heron.api.Constants; import com.twitter.heron.api.tuple.Tuple; public final class TupleUtils { private TupleUtils() { // No instantiation } public static boolean isTick(Tuple tuple) { return tuple != null && Constants.SYSTEM_COMPONENT_ID.equals(tuple.getSourceComponent()) && Constants.SYSTEM_TICK_STREAM_ID.equals(tuple.getSourceStreamId()); } }
lucperkins/heron
heron/api/src/java/com/twitter/heron/api/utils/TupleUtils.java
Java
apache-2.0
1,848
package com.yuqirong.rxnews; import de.greenrobot.daogenerator.DaoGenerator; import de.greenrobot.daogenerator.Entity; import de.greenrobot.daogenerator.Schema; public class GreenDaoGeneration { public static void main(String[] arg0) { try { Schema schema = new Schema(2, "com.yuqirong.greendao"); addEntity(schema); new DaoGenerator().generateAll(schema, "C:/Users/h/Desktop/RxNews/app/src/main/java-gen"); } catch (Exception e) { e.printStackTrace(); } } public static void addEntity(Schema schema) { Entity entity = schema.addEntity("ResultEntity"); entity.addIdProperty(); entity.addStringProperty("json"); entity.addStringProperty("nId"); Entity entity2 = schema.addEntity("ChannelEntity"); entity2.addIdProperty(); entity2.addStringProperty("name"); entity2.addStringProperty("tId"); entity2.addBooleanProperty("isSelect"); } }
yuqirong/RxNews
greendaogeneration/src/main/java/com/yuqirong/rxnews/GreenDaoGeneration.java
Java
apache-2.0
1,002
//===--- ModuleFile.cpp - Loading a serialized module ---------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #include "swift/Serialization/ModuleFile.h" #include "swift/Serialization/ModuleFormat.h" #include "swift/Subsystems.h" #include "swift/AST/AST.h" #include "swift/AST/ModuleLoader.h" #include "swift/AST/NameLookup.h" #include "swift/AST/USRGeneration.h" #include "swift/Basic/Range.h" #include "swift/ClangImporter/ClangImporter.h" #include "swift/Serialization/BCReadingExtras.h" #include "swift/Serialization/SerializedModuleLoader.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/OnDiskHashTable.h" #include "llvm/Support/PrettyStackTrace.h" using namespace swift; using namespace swift::serialization; using namespace llvm::support; static bool checkModuleSignature(llvm::BitstreamCursor &cursor) { for (unsigned char byte : MODULE_SIGNATURE) if (cursor.AtEndOfStream() || cursor.Read(8) != byte) return false; return true; } static bool checkModuleDocSignature(llvm::BitstreamCursor &cursor) { for (unsigned char byte : MODULE_DOC_SIGNATURE) if (cursor.AtEndOfStream() || cursor.Read(8) != byte) return false; return true; } static bool enterTopLevelModuleBlock(llvm::BitstreamCursor &cursor, unsigned ID, bool shouldReadBlockInfo = true) { auto next = cursor.advance(); if (next.Kind != llvm::BitstreamEntry::SubBlock) return false; if (next.ID == llvm::bitc::BLOCKINFO_BLOCK_ID) { if (shouldReadBlockInfo) { if (cursor.ReadBlockInfoBlock()) return false; } else { if (cursor.SkipBlock()) return false; } return enterTopLevelModuleBlock(cursor, ID, false); } if (next.ID != ID) return false; cursor.EnterSubBlock(ID); return true; } /// Populate \p extendedInfo with the data from the options block. /// /// Returns true on success. static bool readOptionsBlock(llvm::BitstreamCursor &cursor, SmallVectorImpl<uint64_t> &scratch, ExtendedValidationInfo &extendedInfo) { auto next = cursor.advance(); while (next.Kind != llvm::BitstreamEntry::EndBlock) { if (next.Kind == llvm::BitstreamEntry::Error) return false; if (next.Kind == llvm::BitstreamEntry::SubBlock) { // Unknown metadata sub-block, possibly for use by a future version of // the module format. if (cursor.SkipBlock()) return false; next = cursor.advance(); continue; } scratch.clear(); StringRef blobData; unsigned kind = cursor.readRecord(next.ID, scratch, &blobData); switch (kind) { case options_block::SDK_PATH: extendedInfo.setSDKPath(blobData); break; case options_block::XCC: extendedInfo.addExtraClangImporterOption(blobData); break; case options_block::IS_SIB: bool IsSIB; options_block::IsSIBLayout::readRecord(scratch, IsSIB); extendedInfo.setIsSIB(IsSIB); break; case options_block::IS_TESTABLE: extendedInfo.setIsTestable(true); break; case options_block::IS_RESILIENT: extendedInfo.setIsResilient(true); break; default: // Unknown options record, possibly for use by a future version of the // module format. break; } next = cursor.advance(); } return true; } static ValidationInfo validateControlBlock(llvm::BitstreamCursor &cursor, SmallVectorImpl<uint64_t> &scratch, ExtendedValidationInfo *extendedInfo) { // The control block is malformed until we've at least read a major version // number. ValidationInfo result; bool versionSeen = false; auto next = cursor.advance(); while (next.Kind != llvm::BitstreamEntry::EndBlock) { if (next.Kind == llvm::BitstreamEntry::Error) { result.status = Status::Malformed; return result; } if (next.Kind == llvm::BitstreamEntry::SubBlock) { if (next.ID == OPTIONS_BLOCK_ID && extendedInfo) { cursor.EnterSubBlock(OPTIONS_BLOCK_ID); if (!readOptionsBlock(cursor, scratch, *extendedInfo)) { result.status = Status::Malformed; return result; } } else { // Unknown metadata sub-block, possibly for use by a future version of // the module format. if (cursor.SkipBlock()) { result.status = Status::Malformed; return result; } } next = cursor.advance(); continue; } scratch.clear(); StringRef blobData; unsigned kind = cursor.readRecord(next.ID, scratch, &blobData); switch (kind) { case control_block::METADATA: { if (versionSeen) { result.status = Status::Malformed; break; } uint16_t versionMajor = scratch[0]; if (versionMajor > VERSION_MAJOR) result.status = Status::FormatTooNew; else if (versionMajor < VERSION_MAJOR) result.status = Status::FormatTooOld; else result.status = Status::Valid; // Major version 0 does not have stable minor versions. if (versionMajor == 0) { uint16_t versionMinor = scratch[1]; if (versionMinor != VERSION_MINOR) { if (versionMinor < VERSION_MINOR) result.status = Status::FormatTooOld; else result.status = Status::FormatTooNew; } } versionSeen = true; break; } case control_block::MODULE_NAME: result.name = blobData; break; case control_block::TARGET: result.targetTriple = blobData; break; default: // Unknown metadata record, possibly for use by a future version of the // module format. break; } next = cursor.advance(); } return result; } bool serialization::isSerializedAST(StringRef data) { StringRef signatureStr(reinterpret_cast<const char *>(MODULE_SIGNATURE), llvm::array_lengthof(MODULE_SIGNATURE)); return data.startswith(signatureStr); } ValidationInfo serialization::validateSerializedAST( StringRef data, ExtendedValidationInfo *extendedInfo) { ValidationInfo result; // Check 32-bit alignment. if (data.size() % 4 != 0 || reinterpret_cast<uintptr_t>(data.data()) % 4 != 0) return result; llvm::BitstreamReader reader(reinterpret_cast<const uint8_t *>(data.begin()), reinterpret_cast<const uint8_t *>(data.end())); llvm::BitstreamCursor cursor(reader); SmallVector<uint64_t, 32> scratch; if (!checkModuleSignature(cursor) || !enterTopLevelModuleBlock(cursor, MODULE_BLOCK_ID, false)) return result; auto topLevelEntry = cursor.advance(); while (topLevelEntry.Kind == llvm::BitstreamEntry::SubBlock) { if (topLevelEntry.ID == CONTROL_BLOCK_ID) { cursor.EnterSubBlock(CONTROL_BLOCK_ID); result = validateControlBlock(cursor, scratch, extendedInfo); if (result.status == Status::Malformed) return result; } else { if (cursor.SkipBlock()) { result.status = Status::Malformed; return result; } } topLevelEntry = cursor.advance(AF_DontPopBlockAtEnd); } if (topLevelEntry.Kind == llvm::BitstreamEntry::EndBlock) { cursor.ReadBlockEnd(); assert(cursor.GetCurrentBitNo() % CHAR_BIT == 0); result.bytes = cursor.GetCurrentBitNo() / CHAR_BIT; } else { result.status = Status::Malformed; } return result; } std::string ModuleFile::Dependency::getPrettyPrintedPath() const { StringRef pathWithoutScope = RawPath; if (isScoped()) { size_t splitPoint = pathWithoutScope.find_last_of('\0'); pathWithoutScope = pathWithoutScope.slice(0, splitPoint); } std::string output = pathWithoutScope.str(); std::replace(output.begin(), output.end(), '\0', '.'); return output; } namespace { class PrettyModuleFileDeserialization : public llvm::PrettyStackTraceEntry { const ModuleFile &File; public: explicit PrettyModuleFileDeserialization(const ModuleFile &file) : File(file) {} virtual void print(raw_ostream &os) const override { os << "While reading from " << File.getModuleFilename() << "\n"; } }; } // end anonymous namespace /// Used to deserialize entries in the on-disk decl hash table. class ModuleFile::DeclTableInfo { public: using internal_key_type = StringRef; using external_key_type = Identifier; using data_type = SmallVector<std::pair<uint8_t, DeclID>, 8>; using hash_value_type = uint32_t; using offset_type = unsigned; internal_key_type GetInternalKey(external_key_type ID) { return ID.str(); } hash_value_type ComputeHash(internal_key_type key) { return llvm::HashString(key); } static bool EqualKey(internal_key_type lhs, internal_key_type rhs) { return lhs == rhs; } static std::pair<unsigned, unsigned> ReadKeyDataLength(const uint8_t *&data) { unsigned keyLength = endian::readNext<uint16_t, little, unaligned>(data); unsigned dataLength = endian::readNext<uint16_t, little, unaligned>(data); return { keyLength, dataLength }; } static internal_key_type ReadKey(const uint8_t *data, unsigned length) { return StringRef(reinterpret_cast<const char *>(data), length); } static data_type ReadData(internal_key_type key, const uint8_t *data, unsigned length) { data_type result; while (length > 0) { uint8_t kind = *data++; DeclID offset = endian::readNext<uint32_t, little, unaligned>(data); result.push_back({ kind, offset }); length -= 5; } return result; } }; /// Used to deserialize entries in the on-disk decl hash table. class ModuleFile::LocalDeclTableInfo { public: using internal_key_type = StringRef; using external_key_type = internal_key_type; using data_type = std::pair<DeclID, unsigned>; // ID, local discriminator using hash_value_type = uint32_t; using offset_type = unsigned; internal_key_type GetInternalKey(external_key_type ID) { return ID; } hash_value_type ComputeHash(internal_key_type key) { return llvm::HashString(key); } static bool EqualKey(internal_key_type lhs, internal_key_type rhs) { return lhs == rhs; } static std::pair<unsigned, unsigned> ReadKeyDataLength(const uint8_t *&data) { unsigned keyLength = endian::readNext<uint16_t, little, unaligned>(data); return { keyLength, sizeof(uint32_t) + sizeof(unsigned) }; } static internal_key_type ReadKey(const uint8_t *data, unsigned length) { return StringRef(reinterpret_cast<const char *>(data), length); } static data_type ReadData(internal_key_type key, const uint8_t *data, unsigned length) { auto declID = endian::readNext<uint32_t, little, unaligned>(data); auto discriminator = endian::readNext<unsigned, little, unaligned>(data); return { declID, discriminator }; } }; std::unique_ptr<ModuleFile::SerializedDeclTable> ModuleFile::readDeclTable(ArrayRef<uint64_t> fields, StringRef blobData) { uint32_t tableOffset; index_block::DeclListLayout::readRecord(fields, tableOffset); auto base = reinterpret_cast<const uint8_t *>(blobData.data()); using OwnedTable = std::unique_ptr<SerializedDeclTable>; return OwnedTable(SerializedDeclTable::Create(base + tableOffset, base + sizeof(uint32_t), base)); } std::unique_ptr<ModuleFile::SerializedLocalDeclTable> ModuleFile::readLocalDeclTable(ArrayRef<uint64_t> fields, StringRef blobData) { uint32_t tableOffset; index_block::DeclListLayout::readRecord(fields, tableOffset); auto base = reinterpret_cast<const uint8_t *>(blobData.data()); using OwnedTable = std::unique_ptr<SerializedLocalDeclTable>; return OwnedTable(SerializedLocalDeclTable::Create(base + tableOffset, base + sizeof(uint32_t), base)); } /// Used to deserialize entries in the on-disk Objective-C method table. class ModuleFile::ObjCMethodTableInfo { public: using internal_key_type = std::string; using external_key_type = ObjCSelector; using data_type = SmallVector<std::tuple<TypeID, bool, DeclID>, 8>; using hash_value_type = uint32_t; using offset_type = unsigned; internal_key_type GetInternalKey(external_key_type ID) { llvm::SmallString<32> scratch; return ID.getString(scratch).str(); } hash_value_type ComputeHash(internal_key_type key) { return llvm::HashString(key); } static bool EqualKey(internal_key_type lhs, internal_key_type rhs) { return lhs == rhs; } static std::pair<unsigned, unsigned> ReadKeyDataLength(const uint8_t *&data) { unsigned keyLength = endian::readNext<uint16_t, little, unaligned>(data); unsigned dataLength = endian::readNext<uint16_t, little, unaligned>(data); return { keyLength, dataLength }; } static internal_key_type ReadKey(const uint8_t *data, unsigned length) { return std::string(reinterpret_cast<const char *>(data), length); } static data_type ReadData(internal_key_type key, const uint8_t *data, unsigned length) { data_type result; while (length > 0) { TypeID typeID = endian::readNext<uint32_t, little, unaligned>(data); bool isInstanceMethod = *data++ != 0; DeclID methodID = endian::readNext<uint32_t, little, unaligned>(data); result.push_back(std::make_tuple(typeID, isInstanceMethod, methodID)); length -= sizeof(uint32_t) + 1 + sizeof(uint32_t); } return result; } }; std::unique_ptr<ModuleFile::SerializedObjCMethodTable> ModuleFile::readObjCMethodTable(ArrayRef<uint64_t> fields, StringRef blobData) { uint32_t tableOffset; index_block::ObjCMethodTableLayout::readRecord(fields, tableOffset); auto base = reinterpret_cast<const uint8_t *>(blobData.data()); using OwnedTable = std::unique_ptr<SerializedObjCMethodTable>; return OwnedTable( SerializedObjCMethodTable::Create(base + tableOffset, base + sizeof(uint32_t), base)); } bool ModuleFile::readIndexBlock(llvm::BitstreamCursor &cursor) { cursor.EnterSubBlock(INDEX_BLOCK_ID); SmallVector<uint64_t, 4> scratch; StringRef blobData; while (true) { auto next = cursor.advance(); switch (next.Kind) { case llvm::BitstreamEntry::EndBlock: return true; case llvm::BitstreamEntry::Error: return false; case llvm::BitstreamEntry::SubBlock: // Unknown sub-block, which this version of the compiler won't use. if (cursor.SkipBlock()) return false; break; case llvm::BitstreamEntry::Record: scratch.clear(); blobData = {}; unsigned kind = cursor.readRecord(next.ID, scratch, &blobData); switch (kind) { case index_block::DECL_OFFSETS: assert(blobData.empty()); Decls.assign(scratch.begin(), scratch.end()); break; case index_block::DECL_CONTEXT_OFFSETS: assert(blobData.empty()); DeclContexts.assign(scratch.begin(), scratch.end()); break; case index_block::TYPE_OFFSETS: assert(blobData.empty()); Types.assign(scratch.begin(), scratch.end()); break; case index_block::IDENTIFIER_OFFSETS: assert(blobData.empty()); Identifiers.assign(scratch.begin(), scratch.end()); break; case index_block::TOP_LEVEL_DECLS: TopLevelDecls = readDeclTable(scratch, blobData); break; case index_block::OPERATORS: OperatorDecls = readDeclTable(scratch, blobData); break; case index_block::EXTENSIONS: ExtensionDecls = readDeclTable(scratch, blobData); break; case index_block::CLASS_MEMBERS: ClassMembersByName = readDeclTable(scratch, blobData); break; case index_block::OPERATOR_METHODS: OperatorMethodDecls = readDeclTable(scratch, blobData); break; case index_block::OBJC_METHODS: ObjCMethods = readObjCMethodTable(scratch, blobData); break; case index_block::ENTRY_POINT: assert(blobData.empty()); setEntryPointClassID(scratch.front()); break; case index_block::LOCAL_TYPE_DECLS: LocalTypeDecls = readLocalDeclTable(scratch, blobData); break; case index_block::LOCAL_DECL_CONTEXT_OFFSETS: assert(blobData.empty()); LocalDeclContexts.assign(scratch.begin(), scratch.end()); break; case index_block::NORMAL_CONFORMANCE_OFFSETS: assert(blobData.empty()); NormalConformances.assign(scratch.begin(), scratch.end()); break; default: // Unknown index kind, which this version of the compiler won't use. break; } break; } } } class ModuleFile::DeclCommentTableInfo { ModuleFile &F; public: using internal_key_type = StringRef; using external_key_type = StringRef; using data_type = CommentInfo; using hash_value_type = uint32_t; using offset_type = unsigned; DeclCommentTableInfo(ModuleFile &F) : F(F) {} internal_key_type GetInternalKey(external_key_type key) { return key; } hash_value_type ComputeHash(internal_key_type key) { assert(!key.empty()); return llvm::HashString(key); } static bool EqualKey(internal_key_type lhs, internal_key_type rhs) { return lhs == rhs; } static std::pair<unsigned, unsigned> ReadKeyDataLength(const uint8_t *&data) { unsigned keyLength = endian::readNext<uint32_t, little, unaligned>(data); unsigned dataLength = endian::readNext<uint32_t, little, unaligned>(data); return { keyLength, dataLength }; } static internal_key_type ReadKey(const uint8_t *data, unsigned length) { return StringRef(reinterpret_cast<const char *>(data), length); } data_type ReadData(internal_key_type key, const uint8_t *data, unsigned length) { data_type result; { unsigned BriefSize = endian::readNext<uint32_t, little, unaligned>(data); result.Brief = StringRef(reinterpret_cast<const char *>(data), BriefSize); data += BriefSize; } unsigned NumComments = endian::readNext<uint32_t, little, unaligned>(data); MutableArrayRef<SingleRawComment> Comments = F.getContext().AllocateUninitialized<SingleRawComment>(NumComments); for (unsigned i = 0; i != NumComments; ++i) { unsigned StartColumn = endian::readNext<uint32_t, little, unaligned>(data); unsigned RawSize = endian::readNext<uint32_t, little, unaligned>(data); auto RawText = StringRef(reinterpret_cast<const char *>(data), RawSize); data += RawSize; new (&Comments[i]) SingleRawComment(RawText, StartColumn); } result.Raw = RawComment(Comments); result.Group = endian::readNext<uint32_t, little, unaligned>(data); result.SourceOrder = endian::readNext<uint32_t, little, unaligned>(data); return result; } }; std::unique_ptr<ModuleFile::SerializedDeclCommentTable> ModuleFile::readDeclCommentTable(ArrayRef<uint64_t> fields, StringRef blobData) { uint32_t tableOffset; index_block::DeclListLayout::readRecord(fields, tableOffset); auto base = reinterpret_cast<const uint8_t *>(blobData.data()); return std::unique_ptr<SerializedDeclCommentTable>( SerializedDeclCommentTable::Create(base + tableOffset, base + sizeof(uint32_t), base, DeclCommentTableInfo(*this))); } std::unique_ptr<ModuleFile::GroupNameTable> ModuleFile::readGroupTable(ArrayRef<uint64_t> Fields, StringRef BlobData) { std::unique_ptr<ModuleFile::GroupNameTable> pMap( new ModuleFile::GroupNameTable); auto Data = reinterpret_cast<const uint8_t *>(BlobData.data()); unsigned GroupCount = endian::readNext<uint32_t, little, unaligned>(Data); for (unsigned I = 0; I < GroupCount; I ++) { auto RawSize = endian::readNext<uint32_t, little, unaligned>(Data); auto RawText = StringRef(reinterpret_cast<const char *>(Data), RawSize); Data += RawSize; (*pMap)[I] = RawText; } return pMap; } bool ModuleFile::readCommentBlock(llvm::BitstreamCursor &cursor) { cursor.EnterSubBlock(COMMENT_BLOCK_ID); SmallVector<uint64_t, 4> scratch; StringRef blobData; while (true) { auto next = cursor.advance(); switch (next.Kind) { case llvm::BitstreamEntry::EndBlock: return true; case llvm::BitstreamEntry::Error: return false; case llvm::BitstreamEntry::SubBlock: // Unknown sub-block, which this version of the compiler won't use. if (cursor.SkipBlock()) return false; break; case llvm::BitstreamEntry::Record: scratch.clear(); unsigned kind = cursor.readRecord(next.ID, scratch, &blobData); switch (kind) { case comment_block::DECL_COMMENTS: DeclCommentTable = readDeclCommentTable(scratch, blobData); break; case comment_block::GROUP_NAMES: GroupNamesMap = readGroupTable(scratch, blobData); break; default: // Unknown index kind, which this version of the compiler won't use. break; } break; } } } static Optional<swift::LibraryKind> getActualLibraryKind(unsigned rawKind) { auto stableKind = static_cast<serialization::LibraryKind>(rawKind); if (stableKind != rawKind) return None; switch (stableKind) { case serialization::LibraryKind::Library: return swift::LibraryKind::Library; case serialization::LibraryKind::Framework: return swift::LibraryKind::Framework; } // If there's a new case value in the module file, ignore it. return None; } static const uint8_t *getStartBytePtr(llvm::MemoryBuffer *buffer) { if (!buffer) return nullptr; return reinterpret_cast<const uint8_t *>(buffer->getBufferStart()); } static const uint8_t *getEndBytePtr(llvm::MemoryBuffer *buffer) { if (!buffer) return nullptr; return reinterpret_cast<const uint8_t *>(buffer->getBufferEnd()); } static bool areCompatibleArchitectures(const llvm::Triple &moduleTarget, const llvm::Triple &ctxTarget) { if (moduleTarget.getArch() == ctxTarget.getArch()) return true; auto archPair = std::minmax(moduleTarget.getArch(), ctxTarget.getArch()); if (archPair == std::minmax(llvm::Triple::arm, llvm::Triple::thumb)) return true; if (archPair == std::minmax(llvm::Triple::armeb, llvm::Triple::thumbeb)) return true; return false; } static bool areCompatibleOSs(const llvm::Triple &moduleTarget, const llvm::Triple &ctxTarget) { if (moduleTarget.getOS() == ctxTarget.getOS()) return true; auto osPair = std::minmax(moduleTarget.getOS(), ctxTarget.getOS()); if (osPair == std::minmax(llvm::Triple::Darwin, llvm::Triple::MacOSX)) return true; return false; } static bool isTargetTooNew(const llvm::Triple &moduleTarget, const llvm::Triple &ctxTarget) { unsigned major, minor, micro; if (moduleTarget.isMacOSX()) { moduleTarget.getMacOSXVersion(major, minor, micro); return ctxTarget.isMacOSXVersionLT(major, minor, micro); } moduleTarget.getOSVersion(major, minor, micro); return ctxTarget.isOSVersionLT(major, minor, micro); } ModuleFile::ModuleFile( std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer, bool isFramework, serialization::ExtendedValidationInfo *extInfo) : ModuleInputBuffer(std::move(moduleInputBuffer)), ModuleDocInputBuffer(std::move(moduleDocInputBuffer)), ModuleInputReader(getStartBytePtr(this->ModuleInputBuffer.get()), getEndBytePtr(this->ModuleInputBuffer.get())), ModuleDocInputReader(getStartBytePtr(this->ModuleDocInputBuffer.get()), getEndBytePtr(this->ModuleDocInputBuffer.get())) { assert(getStatus() == Status::Valid); Bits.IsFramework = isFramework; PrettyModuleFileDeserialization stackEntry(*this); llvm::BitstreamCursor cursor{ModuleInputReader}; if (!checkModuleSignature(cursor) || !enterTopLevelModuleBlock(cursor, MODULE_BLOCK_ID)) { error(); return; } // Future-proofing: make sure we validate the control block before we try to // read any other blocks. bool hasValidControlBlock = false; SmallVector<uint64_t, 64> scratch; auto topLevelEntry = cursor.advance(); while (topLevelEntry.Kind == llvm::BitstreamEntry::SubBlock) { switch (topLevelEntry.ID) { case CONTROL_BLOCK_ID: { cursor.EnterSubBlock(CONTROL_BLOCK_ID); auto info = validateControlBlock(cursor, scratch, extInfo); if (info.status != Status::Valid) { error(info.status); return; } Name = info.name; TargetTriple = info.targetTriple; hasValidControlBlock = true; break; } case INPUT_BLOCK_ID: { if (!hasValidControlBlock) { error(); return; } cursor.EnterSubBlock(INPUT_BLOCK_ID); bool seenFlags = false; auto next = cursor.advance(); while (next.Kind == llvm::BitstreamEntry::Record) { scratch.clear(); StringRef blobData; unsigned kind = cursor.readRecord(next.ID, scratch, &blobData); switch (kind) { case input_block::IMPORTED_MODULE: { bool exported, scoped; input_block::ImportedModuleLayout::readRecord(scratch, exported, scoped); Dependencies.push_back({blobData, exported, scoped}); break; } case input_block::LINK_LIBRARY: { uint8_t rawKind; bool shouldForceLink; input_block::LinkLibraryLayout::readRecord(scratch, rawKind, shouldForceLink); if (auto libKind = getActualLibraryKind(rawKind)) LinkLibraries.push_back({blobData, *libKind, shouldForceLink}); // else ignore the dependency...it'll show up as a linker error. break; } case input_block::IMPORTED_HEADER: { assert(!importedHeaderInfo.fileSize && "only one header allowed"); bool exported; input_block::ImportedHeaderLayout::readRecord(scratch, exported, importedHeaderInfo.fileSize, importedHeaderInfo.fileModTime); Dependencies.push_back(Dependency::forHeader(blobData, exported)); break; } case input_block::IMPORTED_HEADER_CONTENTS: { assert(Dependencies.back().isHeader() && "must follow header record"); assert(importedHeaderInfo.contents.empty() && "contents seen already"); importedHeaderInfo.contents = blobData; break; } case input_block::MODULE_FLAGS: { assert(!seenFlags && "only one flags record allowed"); seenFlags = true; bool hasUnderlyingModule; input_block::ModuleFlagsLayout::readRecord(scratch, hasUnderlyingModule); Bits.HasUnderlyingModule = hasUnderlyingModule; break; } case input_block::SEARCH_PATH: { bool isFramework; input_block::SearchPathLayout::readRecord(scratch, isFramework); SearchPaths.push_back({blobData, isFramework}); break; } default: // Unknown input kind, possibly for use by a future version of the // module format. // FIXME: Should we warn about this? break; } next = cursor.advance(); } if (next.Kind != llvm::BitstreamEntry::EndBlock) error(); break; } case DECLS_AND_TYPES_BLOCK_ID: { if (!hasValidControlBlock) { error(); return; } // The decls-and-types block is lazily loaded. Save the cursor and load // any abbrev records at the start of the block. DeclTypeCursor = cursor; DeclTypeCursor.EnterSubBlock(DECLS_AND_TYPES_BLOCK_ID); if (DeclTypeCursor.advance().Kind == llvm::BitstreamEntry::Error) error(); // With the main cursor, skip over the block and continue. if (cursor.SkipBlock()) { error(); return; } break; } case IDENTIFIER_DATA_BLOCK_ID: { if (!hasValidControlBlock) { error(); return; } cursor.EnterSubBlock(IDENTIFIER_DATA_BLOCK_ID); auto next = cursor.advanceSkippingSubblocks(); while (next.Kind == llvm::BitstreamEntry::Record) { scratch.clear(); StringRef blobData; unsigned kind = cursor.readRecord(next.ID, scratch, &blobData); switch (kind) { case identifier_block::IDENTIFIER_DATA: assert(scratch.empty()); IdentifierData = blobData; break; default: // Unknown identifier data, which this version of the compiler won't // use. break; } next = cursor.advanceSkippingSubblocks(); } if (next.Kind != llvm::BitstreamEntry::EndBlock) { error(); return; } break; } case INDEX_BLOCK_ID: { if (!hasValidControlBlock || !readIndexBlock(cursor)) { error(); return; } break; } case SIL_INDEX_BLOCK_ID: { // Save the cursor. SILIndexCursor = cursor; SILIndexCursor.EnterSubBlock(SIL_INDEX_BLOCK_ID); // With the main cursor, skip over the block and continue. if (cursor.SkipBlock()) { error(); return; } break; } case SIL_BLOCK_ID: { // Save the cursor. SILCursor = cursor; SILCursor.EnterSubBlock(SIL_BLOCK_ID); // With the main cursor, skip over the block and continue. if (cursor.SkipBlock()) { error(); return; } break; } default: // Unknown top-level block, possibly for use by a future version of the // module format. if (cursor.SkipBlock()) { error(); return; } break; } topLevelEntry = cursor.advance(AF_DontPopBlockAtEnd); } if (topLevelEntry.Kind != llvm::BitstreamEntry::EndBlock) { error(); return; } if (!this->ModuleDocInputBuffer) return; llvm::BitstreamCursor docCursor{ModuleDocInputReader}; if (!checkModuleDocSignature(docCursor) || !enterTopLevelModuleBlock(docCursor, MODULE_DOC_BLOCK_ID)) { error(Status::MalformedDocumentation); return; } topLevelEntry = docCursor.advance(); while (topLevelEntry.Kind == llvm::BitstreamEntry::SubBlock) { switch (topLevelEntry.ID) { case COMMENT_BLOCK_ID: { if (!hasValidControlBlock || !readCommentBlock(docCursor)) { error(Status::MalformedDocumentation); return; } break; } default: // Unknown top-level block, possibly for use by a future version of the // module format. if (docCursor.SkipBlock()) { error(Status::MalformedDocumentation); return; } break; } topLevelEntry = docCursor.advance(AF_DontPopBlockAtEnd); } if (topLevelEntry.Kind != llvm::BitstreamEntry::EndBlock) { error(Status::MalformedDocumentation); return; } } Status ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc) { PrettyModuleFileDeserialization stackEntry(*this); assert(getStatus() == Status::Valid && "invalid module file"); assert(!FileContext && "already associated with an AST module"); FileContext = file; if (file->getParentModule()->getName().str() != Name) return error(Status::NameMismatch); ASTContext &ctx = getContext(); llvm::Triple moduleTarget(llvm::Triple::normalize(TargetTriple)); if (!areCompatibleArchitectures(moduleTarget, ctx.LangOpts.Target) || !areCompatibleOSs(moduleTarget, ctx.LangOpts.Target)) { return error(Status::TargetIncompatible); } if (ctx.LangOpts.EnableTargetOSChecking && isTargetTooNew(moduleTarget, ctx.LangOpts.Target)) { return error(Status::TargetTooNew); } for (const auto &searchPathPair : SearchPaths) ctx.addSearchPath(searchPathPair.first, searchPathPair.second); auto clangImporter = static_cast<ClangImporter *>(ctx.getClangModuleLoader()); bool missingDependency = false; for (auto &dependency : Dependencies) { assert(!dependency.isLoaded() && "already loaded?"); if (dependency.isHeader()) { // The path may be empty if the file being loaded is a partial AST, // and the current compiler invocation is a merge-modules step. if (!dependency.RawPath.empty()) { bool hadError = clangImporter->importHeader(dependency.RawPath, file->getParentModule(), importedHeaderInfo.fileSize, importedHeaderInfo.fileModTime, importedHeaderInfo.contents, diagLoc); if (hadError) return error(Status::FailedToLoadBridgingHeader); } Module *importedHeaderModule = clangImporter->getImportedHeaderModule(); dependency.Import = { {}, importedHeaderModule }; continue; } StringRef modulePathStr = dependency.RawPath; StringRef scopePath; if (dependency.isScoped()) { auto splitPoint = modulePathStr.find_last_of('\0'); assert(splitPoint != StringRef::npos); scopePath = modulePathStr.substr(splitPoint+1); modulePathStr = modulePathStr.slice(0, splitPoint); } SmallVector<Identifier, 4> modulePath; while (!modulePathStr.empty()) { StringRef nextComponent; std::tie(nextComponent, modulePathStr) = modulePathStr.split('\0'); modulePath.push_back(ctx.getIdentifier(nextComponent)); assert(!modulePath.back().empty() && "invalid module name (submodules not yet supported)"); } auto module = getModule(modulePath); if (!module) { // If we're missing the module we're shadowing, treat that specially. if (modulePath.size() == 1 && modulePath.front() == file->getParentModule()->getName()) { return error(Status::MissingShadowedModule); } // Otherwise, continue trying to load dependencies, so that we can list // everything that's missing. missingDependency = true; continue; } // This is for backwards-compatibility with modules that still rely on the // "HasUnderlyingModule" flag. if (Bits.HasUnderlyingModule && module == ShadowedModule) dependency.forceExported(); if (scopePath.empty()) { dependency.Import = { {}, module }; } else { auto scopeID = ctx.getIdentifier(scopePath); assert(!scopeID.empty() && "invalid decl name (non-top-level decls not supported)"); auto path = Module::AccessPathTy({scopeID, SourceLoc()}); dependency.Import = { ctx.AllocateCopy(path), module }; } } if (missingDependency) { return error(Status::MissingDependency); } if (Bits.HasEntryPoint) { FileContext->getParentModule()->registerEntryPointFile(FileContext, SourceLoc(), None); } return getStatus(); } ModuleFile::~ModuleFile() = default; void ModuleFile::lookupValue(DeclName name, SmallVectorImpl<ValueDecl*> &results) { PrettyModuleFileDeserialization stackEntry(*this); if (TopLevelDecls) { // Find top-level declarations with the given name. // FIXME: As a bit of a hack, do lookup by the simple name, then filter // compound decls, to avoid having to completely redo how modules are // serialized. auto iter = TopLevelDecls->find(name.getBaseName()); if (iter != TopLevelDecls->end()) { if (name.isSimpleName()) { for (auto item : *iter) { auto VD = cast<ValueDecl>(getDecl(item.second)); results.push_back(VD); } } else { for (auto item : *iter) { auto VD = cast<ValueDecl>(getDecl(item.second)); if (VD->getFullName().matchesRef(name)) results.push_back(VD); } } } } // If the name is an operator name, also look for operator methods. if (name.isOperator() && OperatorMethodDecls) { auto iter = OperatorMethodDecls->find(name.getBaseName()); if (iter != OperatorMethodDecls->end()) { for (auto item : *iter) { auto VD = cast<ValueDecl>(getDecl(item.second)); results.push_back(VD); } } } } TypeDecl *ModuleFile::lookupLocalType(StringRef MangledName) { PrettyModuleFileDeserialization stackEntry(*this); if (!LocalTypeDecls) return nullptr; auto iter = LocalTypeDecls->find(MangledName); if (iter == LocalTypeDecls->end()) return nullptr; return cast<TypeDecl>(getDecl((*iter).first)); } OperatorDecl *ModuleFile::lookupOperator(Identifier name, DeclKind fixity) { PrettyModuleFileDeserialization stackEntry(*this); if (!OperatorDecls) return nullptr; auto iter = OperatorDecls->find(name); if (iter == OperatorDecls->end()) return nullptr; for (auto item : *iter) { if (getStableFixity(fixity) == item.first) return cast<OperatorDecl>(getDecl(item.second)); } // FIXME: operators re-exported from other modules? return nullptr; } void ModuleFile::getImportedModules( SmallVectorImpl<Module::ImportedModule> &results, Module::ImportFilter filter) { PrettyModuleFileDeserialization stackEntry(*this); for (auto &dep : Dependencies) { if (filter != Module::ImportFilter::All && (filter == Module::ImportFilter::Public) ^ dep.isExported()) continue; assert(dep.isLoaded()); results.push_back(dep.Import); } } void ModuleFile::getImportDecls(SmallVectorImpl<Decl *> &Results) { if (!Bits.ComputedImportDecls) { ASTContext &Ctx = getContext(); for (auto &Dep : Dependencies) { // FIXME: We need a better way to show headers, since they usually /are/ // re-exported. This isn't likely to come up much, though. if (Dep.isHeader()) continue; StringRef ModulePathStr = Dep.RawPath; StringRef ScopePath; if (Dep.isScoped()) std::tie(ModulePathStr, ScopePath) = ModulePathStr.rsplit('\0'); SmallVector<std::pair<swift::Identifier, swift::SourceLoc>, 1> AccessPath; while (!ModulePathStr.empty()) { StringRef NextComponent; std::tie(NextComponent, ModulePathStr) = ModulePathStr.split('\0'); AccessPath.push_back({Ctx.getIdentifier(NextComponent), SourceLoc()}); } if (AccessPath.size() == 1 && AccessPath[0].first == Ctx.StdlibModuleName) continue; Module *M = Ctx.getModule(AccessPath); auto Kind = ImportKind::Module; if (!ScopePath.empty()) { auto ScopeID = Ctx.getIdentifier(ScopePath); assert(!ScopeID.empty() && "invalid decl name (non-top-level decls not supported)"); if (!M) { // The dependency module could not be loaded. Just make a guess // about the import kind, we cannot do better. Kind = ImportKind::Func; } else { // Lookup the decl in the top-level module. Module *TopLevelModule = M; if (AccessPath.size() > 1) TopLevelModule = Ctx.getLoadedModule(AccessPath.front().first); SmallVector<ValueDecl *, 8> Decls; TopLevelModule->lookupQualified( ModuleType::get(TopLevelModule), ScopeID, NL_QualifiedDefault | NL_KnownNoDependency, nullptr, Decls); Optional<ImportKind> FoundKind = ImportDecl::findBestImportKind(Decls); assert(FoundKind.hasValue() && "deserialized imports should not be ambiguous"); Kind = *FoundKind; } AccessPath.push_back({ ScopeID, SourceLoc() }); } auto *ID = ImportDecl::create(Ctx, FileContext, SourceLoc(), Kind, SourceLoc(), AccessPath); ID->setModule(M); if (Dep.isExported()) ID->getAttrs().add( new (Ctx) ExportedAttr(/*IsImplicit=*/false)); ImportDecls.push_back(ID); } Bits.ComputedImportDecls = true; } Results.append(ImportDecls.begin(), ImportDecls.end()); } void ModuleFile::lookupVisibleDecls(Module::AccessPathTy accessPath, VisibleDeclConsumer &consumer, NLKind lookupKind) { PrettyModuleFileDeserialization stackEntry(*this); assert(accessPath.size() <= 1 && "can only refer to top-level decls"); if (!TopLevelDecls) return; if (!accessPath.empty()) { auto iter = TopLevelDecls->find(accessPath.front().first); if (iter == TopLevelDecls->end()) return; for (auto item : *iter) consumer.foundDecl(cast<ValueDecl>(getDecl(item.second)), DeclVisibilityKind::VisibleAtTopLevel); return; } for (auto entry : TopLevelDecls->data()) { for (auto item : entry) consumer.foundDecl(cast<ValueDecl>(getDecl(item.second)), DeclVisibilityKind::VisibleAtTopLevel); } } void ModuleFile::loadExtensions(NominalTypeDecl *nominal) { PrettyModuleFileDeserialization stackEntry(*this); if (!ExtensionDecls) return; auto iter = ExtensionDecls->find(nominal->getName()); if (iter == ExtensionDecls->end()) return; for (auto item : *iter) { if (item.first == getKindForTable(nominal)) (void)getDecl(item.second); } } void ModuleFile::loadObjCMethods( ClassDecl *classDecl, ObjCSelector selector, bool isInstanceMethod, llvm::TinyPtrVector<AbstractFunctionDecl *> &methods) { // If we don't have an Objective-C method table, there's nothing to do. if (!ObjCMethods) return; // Look for all methods in the module file with this selector. auto known = ObjCMethods->find(selector); if (known == ObjCMethods->end()) { return; } auto results = *known; for (const auto &result : results) { // If the method is the wrong kind (instance vs. class), skip it. if (isInstanceMethod != std::get<1>(result)) continue; // If the method isn't defined in the requested class, skip it. Type type = getType(std::get<0>(result)); if (type->getClassOrBoundGenericClass() != classDecl) continue; // Deserialize the method and add it to the list. if (auto func = dyn_cast_or_null<AbstractFunctionDecl>( getDecl(std::get<2>(result)))) { methods.push_back(func); } } } void ModuleFile::lookupClassMember(Module::AccessPathTy accessPath, DeclName name, SmallVectorImpl<ValueDecl*> &results) { PrettyModuleFileDeserialization stackEntry(*this); assert(accessPath.size() <= 1 && "can only refer to top-level decls"); if (!ClassMembersByName) return; auto iter = ClassMembersByName->find(name.getBaseName()); if (iter == ClassMembersByName->end()) return; if (!accessPath.empty()) { // As a hack to avoid completely redoing how the module is indexed, we take // the simple-name-based lookup then filter by the compound name if we have // one. if (name.isSimpleName()) { for (auto item : *iter) { auto vd = cast<ValueDecl>(getDecl(item.second)); auto dc = vd->getDeclContext(); while (!dc->getParent()->isModuleScopeContext()) dc = dc->getParent(); if (auto nominal = dc->getAsNominalTypeOrNominalTypeExtensionContext()) if (nominal->getName() == accessPath.front().first) results.push_back(vd); } } else { for (auto item : *iter) { auto vd = cast<ValueDecl>(getDecl(item.second)); if (!vd->getFullName().matchesRef(name)) continue; auto dc = vd->getDeclContext(); while (!dc->getParent()->isModuleScopeContext()) dc = dc->getParent(); if (auto nominal = dc->getAsNominalTypeOrNominalTypeExtensionContext()) if (nominal->getName() == accessPath.front().first) results.push_back(vd); } } return; } for (auto item : *iter) { auto vd = cast<ValueDecl>(getDecl(item.second)); results.push_back(vd); } } void ModuleFile::lookupClassMembers(Module::AccessPathTy accessPath, VisibleDeclConsumer &consumer) { PrettyModuleFileDeserialization stackEntry(*this); assert(accessPath.size() <= 1 && "can only refer to top-level decls"); if (!ClassMembersByName) return; if (!accessPath.empty()) { for (const auto &list : ClassMembersByName->data()) { for (auto item : list) { auto vd = cast<ValueDecl>(getDecl(item.second)); auto dc = vd->getDeclContext(); while (!dc->getParent()->isModuleScopeContext()) dc = dc->getParent(); if (auto nominal = dc->getAsNominalTypeOrNominalTypeExtensionContext()) if (nominal->getName() == accessPath.front().first) consumer.foundDecl(vd, DeclVisibilityKind::DynamicLookup); } } return; } for (const auto &list : ClassMembersByName->data()) { for (auto item : list) consumer.foundDecl(cast<ValueDecl>(getDecl(item.second)), DeclVisibilityKind::DynamicLookup); } } void ModuleFile::lookupObjCMethods( ObjCSelector selector, SmallVectorImpl<AbstractFunctionDecl *> &results) { // If we don't have an Objective-C method table, there's nothing to do. if (!ObjCMethods) return; // Look for all methods in the module file with this selector. auto known = ObjCMethods->find(selector); if (known == ObjCMethods->end()) return; auto found = *known; for (const auto &result : found) { // Deserialize the method and add it to the list. if (auto func = dyn_cast_or_null<AbstractFunctionDecl>( getDecl(std::get<2>(result)))) results.push_back(func); } } void ModuleFile::collectLinkLibraries(Module::LinkLibraryCallback callback) const { for (auto &lib : LinkLibraries) callback(lib); if (Bits.IsFramework) callback(LinkLibrary(Name, LibraryKind::Framework)); } void ModuleFile::getTopLevelDecls(SmallVectorImpl<Decl *> &results) { PrettyModuleFileDeserialization stackEntry(*this); if (OperatorDecls) { for (auto entry : OperatorDecls->data()) { for (auto item : entry) results.push_back(getDecl(item.second)); } } if (TopLevelDecls) { for (auto entry : TopLevelDecls->data()) { for (auto item : entry) results.push_back(getDecl(item.second)); } } if (ExtensionDecls) { for (auto entry : ExtensionDecls->data()) { for (auto item : entry) results.push_back(getDecl(item.second)); } } } void ModuleFile::getLocalTypeDecls(SmallVectorImpl<TypeDecl *> &results) { PrettyModuleFileDeserialization stackEntry(*this); if (!LocalTypeDecls) return; for (auto entry : LocalTypeDecls->data()) { auto DeclID = entry.first; auto TD = cast<TypeDecl>(getDecl(DeclID)); TD->setLocalDiscriminator(entry.second); results.push_back(TD); } } void ModuleFile::getDisplayDecls(SmallVectorImpl<Decl *> &results) { if (ShadowedModule) ShadowedModule->getDisplayDecls(results); PrettyModuleFileDeserialization stackEntry(*this); getImportDecls(results); getTopLevelDecls(results); } Optional<CommentInfo> ModuleFile::getCommentForDecl(const Decl *D) const { assert(D); // Keep these as assertions instead of early exits to ensure that we are not // doing extra work. These cases should be handled by clients of this API. assert(!D->hasClangNode() && "cannot find comments for Clang decls in Swift modules"); assert(D->getDeclContext()->getModuleScopeContext() == FileContext && "Decl is from a different serialized file"); if (!DeclCommentTable) return None; if (D->isImplicit()) return None; if (auto *ED = dyn_cast<ExtensionDecl>(D)) { // Compute the USR. llvm::SmallString<128> USRBuffer; { llvm::raw_svector_ostream OS(USRBuffer); if (ide::printExtensionUSR(ED, OS)) return None; } return getCommentForDeclByUSR(USRBuffer.str()); } auto *VD = dyn_cast<ValueDecl>(D); if (!VD) return None; // Compute the USR. llvm::SmallString<128> USRBuffer; { llvm::raw_svector_ostream OS(USRBuffer); if (ide::printDeclUSR(VD, OS)) return None; } return getCommentForDeclByUSR(USRBuffer.str()); } const static StringRef Separator = "/"; static const Decl* getGroupDecl(const Decl *D) { auto GroupD = D; // Extensions always exist in the same group with the nominal. if (auto ED = dyn_cast_or_null<ExtensionDecl>(D->getDeclContext()-> getInnermostTypeContext())) { GroupD = ED->getExtendedType()->getAnyNominal(); } return GroupD; } Optional<StringRef> ModuleFile::getGroupNameById(unsigned Id) const { if(!GroupNamesMap || GroupNamesMap->count(Id) == 0) return None; auto Original = (*GroupNamesMap)[Id]; if (Original.empty()) return None; auto SepPos = Original.find_last_of(Separator); assert(SepPos != StringRef::npos && "Cannot find Separator."); return StringRef(Original.data(), SepPos); } Optional<StringRef> ModuleFile::getSourceFileNameById(unsigned Id) const { if(!GroupNamesMap || GroupNamesMap->count(Id) == 0) return None; auto Original = (*GroupNamesMap)[Id]; if (Original.empty()) return None; auto SepPos = Original.find_last_of(Separator); assert(SepPos != StringRef::npos && "Cannot find Separator."); auto Start = Original.data() + SepPos + 1; auto Len = Original.size() - SepPos - 1; return StringRef(Start, Len); } Optional<StringRef> ModuleFile::getGroupNameForDecl(const Decl *D) const { auto GroupD = getGroupDecl(D); auto Triple = getCommentForDecl(GroupD); if (!Triple.hasValue()) { return None; } return getGroupNameById(Triple.getValue().Group); } Optional<StringRef> ModuleFile::getSourceFileNameForDecl(const Decl *D) const { auto GroupD = getGroupDecl(D); auto Triple = getCommentForDecl(GroupD); if (!Triple.hasValue()) { return None; } return getSourceFileNameById(Triple.getValue().Group); } Optional<unsigned> ModuleFile::getSourceOrderForDecl(const Decl *D) const { auto Triple = getCommentForDecl(D); if (!Triple.hasValue()) { return None; } return Triple.getValue().SourceOrder; } void ModuleFile::collectAllGroups(std::vector<StringRef> &Names) const { if (!GroupNamesMap) return; for (auto It = GroupNamesMap->begin(); It != GroupNamesMap->end(); ++ It) { StringRef FullGroupName = It->getSecond(); if (FullGroupName.empty()) continue; auto Sep = FullGroupName.find_last_of(Separator); assert(Sep != StringRef::npos); auto Group = FullGroupName.substr(0, Sep); auto Found = std::find(Names.begin(), Names.end(), Group); if (Found != Names.end()) continue; Names.push_back(Group); } } Optional<CommentInfo> ModuleFile::getCommentForDeclByUSR(StringRef USR) const { if (!DeclCommentTable) return None; auto I = DeclCommentTable->find(USR); if (I == DeclCommentTable->end()) return None; return *I; } Optional<StringRef> ModuleFile::getGroupNameByUSR(StringRef USR) const { if (auto Comment = getCommentForDeclByUSR(USR)) { return getGroupNameById(Comment.getValue().Group); } return None; } Identifier ModuleFile::getDiscriminatorForPrivateValue(const ValueDecl *D) { Identifier discriminator = PrivateDiscriminatorsByValue.lookup(D); assert(!discriminator.empty() && "no discriminator found for decl"); return discriminator; } void ModuleFile::verify() const { #ifndef NDEBUG const auto &Context = getContext(); for (const Serialized<Decl*> &next : Decls) if (next.isComplete() && swift::shouldVerify(next, Context)) swift::verify(next); #endif } bool SerializedASTFile::hasEntryPoint() const { return File.Bits.HasEntryPoint; } ClassDecl *SerializedASTFile::getMainClass() const { assert(hasEntryPoint()); return cast_or_null<ClassDecl>(File.getDecl(File.Bits.EntryPointDeclID)); }
dduan/swift
lib/Serialization/ModuleFile.cpp
C++
apache-2.0
53,259
// Copyright 2015 The Cockroach 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. // // Author: Peter Mattis (peter@cockroachlabs.com) package client import ( "strconv" "time" "golang.org/x/net/context" "github.com/cockroachdb/cockroach/roachpb" "github.com/cockroachdb/cockroach/util" "github.com/cockroachdb/cockroach/util/caller" "github.com/cockroachdb/cockroach/util/log" "github.com/cockroachdb/cockroach/util/retry" "github.com/cockroachdb/cockroach/util/tracing" "github.com/gogo/protobuf/proto" basictracer "github.com/opentracing/basictracer-go" ) // DefaultTxnRetryOptions are the standard retry options used // for transactions. // This is exported for testing purposes only. var DefaultTxnRetryOptions = retry.Options{ InitialBackoff: 50 * time.Millisecond, MaxBackoff: 5 * time.Second, Multiplier: 2, } // txnSender implements the Sender interface and is used to keep the Send // method out of the Txn method set. type txnSender Txn // Send updates the transaction on error. Depending on the error type, the // transaction might be replaced by a new one. func (ts *txnSender) Send(ctx context.Context, ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) { // Send call through wrapped sender. ba.Txn = &ts.Proto // For testing purposes, ts.UserPriority can be a negative value (see // MakePriority). if ts.UserPriority != 0 { ba.UserPriority = ts.UserPriority } br, pErr := ts.wrapped.Send(ts.Context, ba) if br != nil && br.Error != nil { panic(roachpb.ErrorUnexpectedlySet(ts.wrapped, br)) } if br != nil { for _, encSp := range br.CollectedSpans { var newSp basictracer.RawSpan if err := tracing.DecodeRawSpan(encSp, &newSp); err != nil { return nil, roachpb.NewError(err) } ts.CollectedSpans = append(ts.CollectedSpans, newSp) } } // Only successful requests can carry an updated Txn in their response // header. Any error (e.g. a restart) can have a Txn attached to them as // well; those update our local state in the same way for the next attempt. // The exception is if our transaction was aborted and needs to restart // from scratch, in which case we do just that. if pErr == nil { ts.Proto.Update(br.Txn) return br, nil } else if _, ok := pErr.GetDetail().(*roachpb.TransactionAbortedError); ok { // On Abort, reset the transaction so we start anew on restart. ts.Proto = roachpb.Transaction{ TxnMeta: roachpb.TxnMeta{ Isolation: ts.Proto.Isolation, }, Name: ts.Proto.Name, } // Acts as a minimum priority on restart. if pErr.GetTxn() != nil { ts.Proto.Priority = pErr.GetTxn().Priority } } else if pErr.TransactionRestart != roachpb.TransactionRestart_NONE { ts.Proto.Update(pErr.GetTxn()) } return nil, pErr } // Txn is an in-progress distributed database transaction. A Txn is not safe for // concurrent use by multiple goroutines. type Txn struct { db DB wrapped Sender Proto roachpb.Transaction UserPriority roachpb.UserPriority Context context.Context // must not be nil CollectedSpans []basictracer.RawSpan // systemConfigTrigger is set to true when modifying keys from the SystemConfig // span. This sets the SystemConfigTrigger on EndTransactionRequest. systemConfigTrigger bool retrying bool } // NewTxn returns a new txn. func NewTxn(db DB) *Txn { txn := &Txn{ db: db, wrapped: db.sender, Context: context.Background(), } txn.db.sender = (*txnSender)(txn) return txn } // SetDebugName sets the debug name associated with the transaction which will // appear in log files and the web UI. Each transaction starts out with an // automatically assigned debug name composed of the file and line number where // the transaction was created. func (txn *Txn) SetDebugName(name string, depth int) { file, line, fun := caller.Lookup(depth + 1) if name == "" { name = fun } txn.Proto.Name = file + ":" + strconv.Itoa(line) + " " + name } // DebugName returns the debug name associated with the transaction. func (txn *Txn) DebugName() string { return txn.Proto.Name } // SetIsolation sets the transaction's isolation type. Transactions default to // serializable isolation. The isolation must be set before any operations are // performed on the transaction. func (txn *Txn) SetIsolation(isolation roachpb.IsolationType) error { if txn.retrying { if txn.Proto.Isolation != isolation { return util.Errorf("cannot change the isolation level of a retrying transaction") } return nil } if txn.Proto.IsInitialized() { return util.Errorf("cannot change the isolation level of a running transaction") } txn.Proto.Isolation = isolation return nil } // SetUserPriority sets the transaction's user priority. Transactions default to // normal user priority. The user priority must be set before any operations are // performed on the transaction. func (txn *Txn) SetUserPriority(userPriority roachpb.UserPriority) error { if txn.retrying { if txn.UserPriority != userPriority { return util.Errorf("cannot change the user priority of a retrying transaction") } return nil } if txn.Proto.IsInitialized() { return util.Errorf("cannot change the user priority of a running transaction") } if userPriority < roachpb.MinUserPriority || userPriority > roachpb.MaxUserPriority { return util.Errorf("the given user priority %f is out of the allowed range [%f, %d]", userPriority, roachpb.MinUserPriority, roachpb.MaxUserPriority) } txn.UserPriority = userPriority return nil } // InternalSetPriority sets the transaction priority. It is intended for // internal (testing) use only. func (txn *Txn) InternalSetPriority(priority int32) { // The negative user priority is translated on the server into a positive, // non-randomized, priority for the transaction. txn.UserPriority = roachpb.UserPriority(-priority) } // SetSystemConfigTrigger sets the system db trigger to true on this transaction. // This will impact the EndTransactionRequest. func (txn *Txn) SetSystemConfigTrigger() { txn.systemConfigTrigger = true } // SystemConfigTrigger returns the systemConfigTrigger flag. func (txn *Txn) SystemConfigTrigger() bool { return txn.systemConfigTrigger } // NewBatch creates and returns a new empty batch object for use with the Txn. func (txn *Txn) NewBatch() *Batch { return &Batch{DB: &txn.db, txn: txn} } // Get retrieves the value for a key, returning the retrieved key/value or an // error. // // r, err := db.Get("a") // // string(r.Key) == "a" // // key can be either a byte slice or a string. func (txn *Txn) Get(key interface{}) (KeyValue, *roachpb.Error) { b := txn.NewBatch() b.Get(key) return runOneRow(txn, b) } // GetProto retrieves the value for a key and decodes the result as a proto // message. // // key can be either a byte slice or a string. func (txn *Txn) GetProto(key interface{}, msg proto.Message) *roachpb.Error { r, pErr := txn.Get(key) if pErr != nil { return pErr } return roachpb.NewError(r.ValueProto(msg)) } // Put sets the value for a key // // key can be either a byte slice or a string. value can be any key type, a // proto.Message or any Go primitive type (bool, int, etc). func (txn *Txn) Put(key, value interface{}) *roachpb.Error { b := txn.NewBatch() b.Put(key, value) _, pErr := runOneResult(txn, b) return pErr } // CPut conditionally sets the value for a key if the existing value is equal // to expValue. To conditionally set a value only if there is no existing entry // pass nil for expValue. Note that this must be an interface{}(nil), not a // typed nil value (e.g. []byte(nil)). // // key can be either a byte slice or a string. value can be any key type, a // proto.Message or any Go primitive type (bool, int, etc). func (txn *Txn) CPut(key, value, expValue interface{}) *roachpb.Error { b := txn.NewBatch() b.CPut(key, value, expValue) _, pErr := runOneResult(txn, b) return pErr } // Inc increments the integer value at key. If the key does not exist it will // be created with an initial value of 0 which will then be incremented. If the // key exists but was set using Put or CPut an error will be returned. // // The returned Result will contain a single row and Result.Err will indicate // success or failure. // // key can be either a byte slice or a string. func (txn *Txn) Inc(key interface{}, value int64) (KeyValue, *roachpb.Error) { b := txn.NewBatch() b.Inc(key, value) return runOneRow(txn, b) } func (txn *Txn) scan(begin, end interface{}, maxRows int64, isReverse bool) ([]KeyValue, *roachpb.Error) { b := txn.NewBatch() if !isReverse { b.Scan(begin, end, maxRows) } else { b.ReverseScan(begin, end, maxRows) } r, pErr := runOneResult(txn, b) return r.Rows, pErr } // Scan retrieves the rows between begin (inclusive) and end (exclusive) in // ascending order. // // The returned []KeyValue will contain up to maxRows elements. // // key can be either a byte slice or a string. func (txn *Txn) Scan(begin, end interface{}, maxRows int64) ([]KeyValue, *roachpb.Error) { return txn.scan(begin, end, maxRows, false) } // ReverseScan retrieves the rows between begin (inclusive) and end (exclusive) // in descending order. // // The returned []KeyValue will contain up to maxRows elements. // // key can be either a byte slice or a string. func (txn *Txn) ReverseScan(begin, end interface{}, maxRows int64) ([]KeyValue, *roachpb.Error) { return txn.scan(begin, end, maxRows, true) } // Del deletes one or more keys. // // key can be either a byte slice or a string. func (txn *Txn) Del(keys ...interface{}) *roachpb.Error { b := txn.NewBatch() b.Del(keys...) _, pErr := runOneResult(txn, b) return pErr } // DelRange deletes the rows between begin (inclusive) and end (exclusive). // // The returned Result will contain 0 rows and Result.Err will indicate success // or failure. // // key can be either a byte slice or a string. func (txn *Txn) DelRange(begin, end interface{}) *roachpb.Error { b := txn.NewBatch() b.DelRange(begin, end, false) _, pErr := runOneResult(txn, b) return pErr } // Run executes the operations queued up within a batch. Before executing any // of the operations the batch is first checked to see if there were any errors // during its construction (e.g. failure to marshal a proto message). // // The operations within a batch are run in parallel and the order is // non-deterministic. It is an unspecified behavior to modify and retrieve the // same key within a batch. // // Upon completion, Batch.Results will contain the results for each // operation. The order of the results matches the order the operations were // added to the batch. func (txn *Txn) Run(b *Batch) *roachpb.Error { _, pErr := txn.RunWithResponse(b) return pErr } // RunWithResponse is a version of Run that returns the BatchResponse. func (txn *Txn) RunWithResponse(b *Batch) (*roachpb.BatchResponse, *roachpb.Error) { tracing.AnnotateTrace() defer tracing.AnnotateTrace() if pErr := b.prepare(); pErr != nil { return nil, pErr } return sendAndFill(txn.send, b) } func (txn *Txn) commit(deadline *roachpb.Timestamp) *roachpb.Error { return txn.sendEndTxnReq(true /* commit */, deadline) } // CleanupOnError cleans up the transaction as a result of an error. func (txn *Txn) CleanupOnError(pErr *roachpb.Error) { if pErr == nil { panic("no error") } if replyErr := txn.Rollback(); replyErr != nil { log.Errorf("failure aborting transaction: %s; abort caused by: %s", replyErr, pErr) } } // CommitNoCleanup is the same as Commit but will not attempt to clean // up on failure. This can be used when the caller is prepared to do proper // cleanup. func (txn *Txn) CommitNoCleanup() *roachpb.Error { return txn.commit(nil) } // CommitInBatch executes the operations queued up within a batch and // commits the transaction. Explicitly committing a transaction is // optional, but more efficient than relying on the implicit commit // performed when the transaction function returns without error. // The batch must be created by this transaction. func (txn *Txn) CommitInBatch(b *Batch) *roachpb.Error { _, pErr := txn.CommitInBatchWithResponse(b) return pErr } // CommitInBatchWithResponse is a version of CommitInBatch that returns the // BatchResponse. func (txn *Txn) CommitInBatchWithResponse(b *Batch) (*roachpb.BatchResponse, *roachpb.Error) { if txn != b.txn { return nil, roachpb.NewErrorf("a batch b can only be committed by b.txn") } b.reqs = append(b.reqs, endTxnReq(true /* commit */, nil, txn.SystemConfigTrigger())) b.initResult(1, 0, nil) return txn.RunWithResponse(b) } // Commit sends an EndTransactionRequest with Commit=true. func (txn *Txn) Commit() *roachpb.Error { pErr := txn.commit(nil) if pErr != nil { txn.CleanupOnError(pErr) } return pErr } // CommitBy sends an EndTransactionRequest with Commit=true and // Deadline=deadline. func (txn *Txn) CommitBy(deadline roachpb.Timestamp) *roachpb.Error { pErr := txn.commit(&deadline) if pErr != nil { txn.CleanupOnError(pErr) } return pErr } // Rollback sends an EndTransactionRequest with Commit=false. func (txn *Txn) Rollback() *roachpb.Error { return txn.sendEndTxnReq(false /* commit */, nil) } func (txn *Txn) sendEndTxnReq(commit bool, deadline *roachpb.Timestamp) *roachpb.Error { _, pErr := txn.send(0, endTxnReq(commit, deadline, txn.SystemConfigTrigger())) return pErr } func endTxnReq(commit bool, deadline *roachpb.Timestamp, hasTrigger bool) roachpb.Request { req := &roachpb.EndTransactionRequest{ Commit: commit, Deadline: deadline, } if hasTrigger { req.InternalCommitTrigger = &roachpb.InternalCommitTrigger{ ModifiedSpanTrigger: &roachpb.ModifiedSpanTrigger{ SystemConfigSpan: true, }, } } return req } // TxnExecOptions controls how Exec() runs a transaction and the corresponding // closure. type TxnExecOptions struct { // If set, the transaction is automatically aborted if the closure returns any // error aside from recoverable internal errors, in which case the closure is // retried. The retryable function should have no side effects which could // cause problems in the event it must be run more than once. // If not set, all errors cause the txn to be aborted. AutoRetry bool // If set, then the txn is automatically committed if no errors are // encountered. If not set, committing or leaving open the txn is the // responsibility of the client. AutoCommit bool // Minimum initial timestamp, if so desired by a higher level (e.g. sql.Executor). MinInitialTimestamp roachpb.Timestamp } // Exec executes fn in the context of a distributed transaction. // Execution is controlled by opt (see comments in TxnExecOptions). // // opt is passed to fn, and it's valid for fn to modify opt as it sees // fit during each execution attempt. // // It's valid for txn to be nil (meaning the txn has already aborted) if fn // can handle that. This is useful for continuing transactions that have been // aborted because of an error in a previous batch of statements in the hope // that a ROLLBACK will reset the state. Neither opt.AutoRetry not opt.AutoCommit // can be set in this case. // // When this method returns, txn might be in any state; Exec does not attempt // to clean up the transaction before returning an error. In case of // TransactionAbortedError, txn is reset to a fresh transaction, ready to be // used. // // TODO(andrei): Make Exec() return error; make fn return an error + a retriable // bit. There's no reason to propagate roachpb.Error (protos) above this point. func (txn *Txn) Exec( opt TxnExecOptions, fn func(txn *Txn, opt *TxnExecOptions) *roachpb.Error) *roachpb.Error { // Run fn in a retry loop until we encounter a success or // error condition this loop isn't capable of handling. var pErr *roachpb.Error var retryOptions retry.Options if txn == nil && (opt.AutoRetry || opt.AutoCommit) { panic("asked to retry or commit a txn that is already aborted") } if txn != nil { // If we're looking at a brand new transaction, then communicate // what should be used as initial timestamp for the KV txn created // by TxnCoordSender. if txn.Proto.OrigTimestamp == roachpb.ZeroTimestamp { txn.Proto.OrigTimestamp = opt.MinInitialTimestamp } } if opt.AutoRetry { retryOptions = txn.db.txnRetryOptions } RetryLoop: for r := retry.Start(retryOptions); r.Next(); { pErr = fn(txn, &opt) if txn != nil { txn.retrying = true defer func() { txn.retrying = false }() } if (pErr == nil) && opt.AutoCommit && (txn.Proto.Status == roachpb.PENDING) { // fn succeeded, but didn't commit. pErr = txn.CommitNoCleanup() } if pErr == nil { break } // Make sure the txn record that pErr carries is for this txn. // We check only when txn.Proto.ID has been initialized after an initial successful send. if pErr.GetTxn() != nil && txn.Proto.ID != nil { if errTxn := pErr.GetTxn(); !errTxn.Equal(&txn.Proto) { return roachpb.NewErrorf("mismatching transaction record in the error:\n%s\nv.s.\n%s", errTxn, txn.Proto) } } if !opt.AutoRetry { break RetryLoop } switch pErr.TransactionRestart { case roachpb.TransactionRestart_IMMEDIATE: r.Reset() case roachpb.TransactionRestart_BACKOFF: default: break RetryLoop } if log.V(2) { log.Infof("automatically retrying transaction: %s because of error: %s", txn.DebugName(), pErr) } } if pErr != nil { pErr.StripErrorTransaction() } return pErr } // send runs the specified calls synchronously in a single batch and // returns any errors. If the transaction is read-only or has already // been successfully committed or aborted, a potential trailing // EndTransaction call is silently dropped, allowing the caller to // always commit or clean-up explicitly even when that may not be // required (or even erroneous). func (txn *Txn) send(maxScanResults int64, reqs ...roachpb.Request) ( *roachpb.BatchResponse, *roachpb.Error) { if txn.Proto.Status != roachpb.PENDING { return nil, roachpb.NewErrorf("attempting to use %s transaction", txn.Proto.Status) } lastIndex := len(reqs) - 1 if lastIndex < 0 { return &roachpb.BatchResponse{}, nil } // firstWriteIndex is set to the index of the first command which is // a transactional write. If != -1, this indicates an intention to // write. This is in contrast to txn.Proto.Writing, which is set by // the coordinator when the first intent has been created, and which // lives for the life of the transaction. firstWriteIndex := -1 var firstWriteKey roachpb.Key for i, args := range reqs { if i < lastIndex { if _, ok := args.(*roachpb.EndTransactionRequest); ok { return nil, roachpb.NewErrorf("%s sent as non-terminal call", args.Method()) } } if roachpb.IsTransactionWrite(args) && firstWriteIndex == -1 { firstWriteKey = args.Header().Key firstWriteIndex = i } } haveTxnWrite := firstWriteIndex != -1 endTxnRequest, haveEndTxn := reqs[lastIndex].(*roachpb.EndTransactionRequest) needBeginTxn := !txn.Proto.Writing && haveTxnWrite needEndTxn := txn.Proto.Writing || haveTxnWrite elideEndTxn := haveEndTxn && !needEndTxn // If we're not yet writing in this txn, but intend to, insert a // begin transaction request before the first write command. if needBeginTxn { bt := &roachpb.BeginTransactionRequest{ Span: roachpb.Span{ Key: firstWriteKey, }, } reqs = append(append(append([]roachpb.Request(nil), reqs[:firstWriteIndex]...), bt), reqs[firstWriteIndex:]...) } if elideEndTxn { reqs = reqs[:lastIndex] } br, pErr := txn.db.send(maxScanResults, reqs...) if elideEndTxn && pErr == nil { // This normally happens on the server and sent back in response // headers, but this transaction was optimized away. The caller may // still inspect the transaction struct, so we manually update it // here to emulate a true transaction. if endTxnRequest.Commit { txn.Proto.Status = roachpb.COMMITTED } else { txn.Proto.Status = roachpb.ABORTED } } // If we inserted a begin transaction request, remove it here. if needBeginTxn { if br != nil && br.Responses != nil { br.Responses = append(br.Responses[:firstWriteIndex], br.Responses[firstWriteIndex+1:]...) } // Handle case where inserted begin txn confused an indexed error. if pErr != nil && pErr.Index != nil { idx := pErr.Index.Index if idx == int32(firstWriteIndex) { // An error was encountered on begin txn; disallow the indexing. pErr.Index = nil } else if idx > int32(firstWriteIndex) { // An error was encountered after begin txn; decrement index. pErr.SetErrorIndex(idx - 1) } } } return br, pErr }
nieyy/cockroach
client/txn.go
GO
apache-2.0
21,209
// I think this file has more useless features than the Toshiba Tablet. #include "inject.h" #include <mach/mach.h> #include <mach/mach_vm.h> #include <dlfcn.h> #include <mach-o/loader.h> #include <mach-o/nlist.h> #include <stdlib.h> #include <stddef.h> #include <stdint.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include <limits.h> struct dyld_all_image_infos { uint32_t version; uint32_t infoArrayCount; uint32_t infoArray; uint32_t notification; uint8_t processDetachedFromSharedRegion; uint8_t libSystemInitialized; uint8_t pad[2]; uint32_t dyldImageLoadAddress; }; struct dyld_all_image_infos_64 { uint32_t version; uint32_t infoArrayCount; uint64_t infoArray; uint64_t notification; uint8_t processDetachedFromSharedRegion; uint8_t libSystemInitialized; uint8_t pad[6]; uint64_t dyldImageLoadAddress; }; #define ARM_THREAD_STATE 1 struct arm_thread_state { uint32_t r[13]; uint32_t sp; uint32_t lr; uint32_t pc; uint32_t cpsr; }; #define x86_THREAD_STATE32 1 struct x86_thread_state32 { uint32_t eax, ebx, ecx, edx, edi, esi, ebp, esp, ss, eflags, eip, cs, ds, es, fs, gs; }; #define x86_THREAD_STATE64 4 struct x86_thread_state64 { uint64_t rax, rbx, rcx, rdx, rdi, rsi, rbp, rsp, r8, r9, r10, r11, r12, r13, r14, r15, rip, rflags, cs, fs, gs; }; #define PPC_THREAD_STATE64 5 struct ppc_thread_state64 { uint64_t srr0, srr1; uint64_t r[32]; uint32_t cr; uint64_t xer, lr, ctr; uint32_t vrsave; }; #pragma pack(4) struct exception_message { mach_msg_header_t Head; mach_msg_body_t msgh_body; mach_msg_port_descriptor_t thread; mach_msg_port_descriptor_t task; NDR_record_t NDR; exception_type_t exception; mach_msg_type_number_t codeCnt; integer_t code[2]; int flavor; mach_msg_type_number_t old_stateCnt; natural_t old_state[144]; }; struct exception_reply { mach_msg_header_t Head; NDR_record_t NDR; kern_return_t RetCode; int flavor; mach_msg_type_number_t new_stateCnt; natural_t new_state[144]; }; #pragma pack() static const mach_vm_size_t stack_size = 32*1024; struct addr_bundle { mach_vm_address_t dlopen; mach_vm_address_t syscall; }; struct symtab_bundle { mach_vm_address_t symaddr; uint32_t nsyms; mach_vm_address_t straddr; uint32_t strsize; }; #define TRY(x) do { if(kr = x) { fprintf(stderr, "fail on line %d: %s\n", __LINE__, #x); goto bad; } } while(0) #define ASSERT(x) ASSERTR(x, KERN_INVALID_ARGUMENT) #define ASSERTR(x, err) do { if(!(x)) { fprintf(stderr, "assertion failed on line %d: %s\n", __LINE__, #x); kr = err; goto bad; } } while(0) #define address_cast(x) ((mach_vm_address_t) (uintptr_t) (x)) #define SWAP(x) (swap ? __builtin_bswap32(x) : (x)) #define SWAP64(x) (swap ? __builtin_bswap64(x) : (x)) static inline void handle_sym(const char *sym, uint32_t size, mach_vm_address_t value, struct addr_bundle *bundle) { switch(sym[1]) { case 'd': if(!strncmp(sym, "_dlopen", size)) bundle->dlopen = value; break; case 's': if(!strncmp(sym, "_syscall", size)) bundle->syscall = value; break; } } static kern_return_t find_symtab_addrs(mach_vm_address_t dyldImageLoadAddress, uint32_t ncmds, mach_vm_size_t sizeofcmds, struct load_command *cmds, bool swap, size_t nlist_size, struct symtab_bundle *symtab, mach_vm_address_t *slide_) { kern_return_t kr = 0; struct load_command *lc; uint32_t symoff = 0, stroff = 0; uint32_t cmdsleft; memset(symtab, 0, sizeof(*symtab)); mach_vm_address_t vma = 0; lc = cmds; for(cmdsleft = ncmds; cmdsleft--;) { uint32_t cmdsize = SWAP(lc->cmdsize); ASSERT(sizeofcmds >= sizeof(struct load_command) && sizeofcmds >= cmdsize); sizeofcmds -= cmdsize; if(!vma && SWAP(lc->cmd) == LC_SEGMENT) { struct segment_command *sc = (void *) lc; ASSERT(cmdsize >= sizeof(*sc)); vma = SWAP(sc->vmaddr); } else if(!vma && SWAP(lc->cmd) == LC_SEGMENT_64) { struct segment_command_64 *sc = (void *) lc; ASSERT(cmdsize >= sizeof(*sc)); vma = SWAP64(sc->vmaddr); } else if(SWAP(lc->cmd) == LC_SYMTAB) { struct symtab_command *sc = (void *) lc; ASSERT(cmdsize >= sizeof(*sc)); symoff = SWAP(sc->symoff); symtab->nsyms = SWAP(sc->nsyms); stroff = SWAP(sc->stroff); symtab->strsize = SWAP(sc->strsize); ASSERT(symtab->strsize < 10000000 && symtab->nsyms < 10000000); } lc = (void *) ((char *) lc + SWAP(lc->cmdsize)); } ASSERT(symoff); ASSERT(vma); mach_vm_address_t slide = dyldImageLoadAddress - vma; *slide_ = slide; #define CATCH(SWAP, off, size, addr) ASSERT(SWAP(sc->fileoff) + SWAP(sc->filesize) >= SWAP(sc->fileoff)); if(SWAP(sc->fileoff) <= (off) && (SWAP(sc->fileoff) + SWAP(sc->filesize) - (off)) >= (size)) (addr) = SWAP(sc->vmaddr) + slide + (off) - SWAP(sc->fileoff); lc = cmds; for(cmdsleft = ncmds; cmdsleft--;) { if(SWAP(lc->cmd) == LC_SEGMENT) { struct segment_command *sc = (void *) lc; if(!vma) vma = SWAP(sc->vmaddr); CATCH(SWAP, symoff, symtab->nsyms * nlist_size, symtab->symaddr); CATCH(SWAP, stroff, symtab->strsize, symtab->straddr); } else if(SWAP(lc->cmd) == LC_SEGMENT_64) { struct segment_command_64 *sc = (void *) lc; CATCH(SWAP64, symoff, symtab->nsyms * nlist_size, symtab->symaddr); CATCH(SWAP64, stroff, symtab->strsize, symtab->straddr); } lc = (void *) ((char *) lc + SWAP(lc->cmdsize)); } ASSERT(symtab->straddr); ASSERT(symtab->symaddr); bad: return kr; } static kern_return_t get_stuff(task_t task, cpu_type_t *cputype, struct addr_bundle *addrs) { kern_return_t kr = 0; char *strs = 0; void *syms = 0; struct load_command *cmds = 0; *cputype = 0; // make the optimizer happy task_dyld_info_data_t info; mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; union { struct dyld_all_image_infos data; struct dyld_all_image_infos_64 data64; } u; mach_vm_size_t data_size; TRY(task_info(task, TASK_DYLD_INFO, (task_info_t) &info, &count)); data_size = sizeof(u); if(info.all_image_info_size < data_size) data_size = info.all_image_info_size; TRY(mach_vm_read_overwrite(task, info.all_image_info_addr, data_size, address_cast(&u), &data_size)); if(u.data.version <= 1) return KERN_NO_SPACE; #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) // Try to guess whether the process is 64-bit, bool proc64 = info.all_image_info_addr > 0; #else bool proc64 = false; #endif mach_vm_address_t dyldImageLoadAddress = proc64 ? u.data64.dyldImageLoadAddress : u.data.dyldImageLoadAddress; struct mach_header mach_hdr; TRY(mach_vm_read_overwrite(task, dyldImageLoadAddress, sizeof(mach_hdr), address_cast(&mach_hdr), &data_size)); bool swap = mach_hdr.magic == MH_CIGAM || mach_hdr.magic == MH_CIGAM_64; bool mh64 = mach_hdr.magic == MH_MAGIC_64 || mach_hdr.magic == MH_CIGAM_64; *cputype = SWAP(mach_hdr.cputype); size_t nlist_size = mh64 ? sizeof(struct nlist_64) : sizeof(struct nlist); mach_vm_size_t sizeofcmds = SWAP(mach_hdr.sizeofcmds); cmds = malloc(sizeofcmds); TRY(mach_vm_read_overwrite(task, dyldImageLoadAddress + (mh64 ? sizeof(struct mach_header_64) : sizeof(struct mach_header)), sizeofcmds, address_cast(cmds), &sizeofcmds)); mach_vm_address_t slide; struct symtab_bundle symtab; TRY(find_symtab_addrs(dyldImageLoadAddress, mach_hdr.ncmds, sizeofcmds, cmds, swap, nlist_size, &symtab, &slide)); strs = malloc(symtab.strsize); syms = malloc(symtab.nsyms * nlist_size); TRY(mach_vm_read_overwrite(task, symtab.straddr, symtab.strsize, address_cast(strs), &data_size)); TRY(mach_vm_read_overwrite(task, symtab.symaddr, symtab.nsyms * nlist_size, address_cast(syms), &data_size)); memset(addrs, 0, sizeof(*addrs)); if(mh64) { const struct nlist_64 *nl = syms; while(symtab.nsyms--) { uint32_t strx = (uint32_t) SWAP(nl->n_un.n_strx); ASSERT(strx < symtab.strsize); handle_sym(strs + strx, symtab.strsize - strx, (mach_vm_address_t) SWAP64(nl->n_value) + slide, addrs); nl++; } } else { const struct nlist *nl = syms; while(symtab.nsyms--) { uint32_t strx = SWAP(nl->n_un.n_strx); ASSERT(strx < symtab.strsize); handle_sym(strs + strx, symtab.strsize - strx, (mach_vm_address_t) SWAP(nl->n_value) + slide, addrs); nl++; } } ASSERT(addrs->dlopen); ASSERT(addrs->syscall); bad: if(cmds) free(cmds); if(strs) free(strs); if(syms) free(syms); return kr; } kern_return_t inject(pid_t pid, const char *path) { kern_return_t kr = 0; mach_vm_address_t stack_address = 0; mach_port_t exc = 0; task_t task = 0; thread_act_t thread = 0; char path_real[PATH_MAX]; if(!realpath(path, path_real)) { perror("realpath"); ASSERT(0); } TRY(task_for_pid(mach_task_self(), (int) pid, &task)); cpu_type_t cputype; struct addr_bundle addrs; TRY(get_stuff(task, &cputype, &addrs)); TRY(mach_vm_allocate(task, &stack_address, stack_size, VM_FLAGS_ANYWHERE)); mach_vm_address_t stack_end = stack_address + stack_size - 0x100; TRY(mach_vm_write(task, stack_address, address_cast(path_real), strlen(path_real) + 1)); // the first one is the return address uint32_t args_32[] = {0, 360, 0xdeadbeef, 0xdeadbeef, 128*1024, 0, 0}; uint64_t args_64[] = {0, 360, 0xdeadbeef, 0xdeadbeef, 128*1024, 0, 0}; union { struct arm_thread_state arm; struct x86_thread_state32 x86; struct x86_thread_state64 x64; struct ppc_thread_state64 ppc; natural_t nat; } state; thread_state_flavor_t state_flavor; mach_msg_type_number_t state_count; memset(&state, 0, sizeof(state)); //printf("dlopen = %llx\n", addrs.dlopen); switch(cputype) { #ifdef __arm__ case CPU_TYPE_ARM: (void) args_64; memcpy(&state.arm.r[0], args_32 + 1, 4*4); TRY(mach_vm_write(task, stack_end, address_cast(args_32 + 5), 2*4)); state.arm.sp = (uint32_t) stack_end; state.arm.pc = (uint32_t) addrs.syscall; state.arm.lr = (uint32_t) args_32[0]; state_flavor = ARM_THREAD_STATE; state_count = sizeof(state.arm) / sizeof(state.nat); break; #endif #if defined(__i386__) || defined(__x86_64__) case CPU_TYPE_X86: TRY(mach_vm_write(task, stack_end, address_cast(args_32), 7*4)); state.x86.esp = state.x86.ebp = (uint32_t) stack_end; state.x86.eip = (uint32_t) addrs.syscall; state_flavor = x86_THREAD_STATE32; state_count = sizeof(state.x86) / sizeof(state.nat); break; case CPU_TYPE_X86_64: state.x64.rdi = args_64[1]; state.x64.rsi = args_64[2]; state.x64.rdx = args_64[3]; state.x64.rcx = args_64[4]; state.x64.r8 = args_64[5]; state.x64.r9 = args_64[6]; state.x64.rsp = state.x64.rbp = stack_end; state.x64.rip = addrs.syscall; state_flavor = x86_THREAD_STATE64; state_count = sizeof(state.x64) / sizeof(state.nat); break; #endif #ifdef __ppc__ case CPU_TYPE_POWERPC: case CPU_TYPE_POWERPC64: fprintf(stderr, "ppc is untested\n"); state.ppc.r[1] = stack_end; memcpy(&state.ppc.r[3], args_64 + 1, 6*8); state.ppc.srr0 = addrs.syscall; state_flavor = PPC_THREAD_STATE64; state_count = sizeof(state.ppc) / sizeof(state.nat); break; #endif default: abort(); } TRY(thread_create(task, &thread)); mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &exc); TRY(mach_port_insert_right(mach_task_self(), exc, exc, MACH_MSG_TYPE_MAKE_SEND)); exception_mask_t em[2]; exception_handler_t eh[2]; exception_behavior_t eb[2]; thread_state_flavor_t ef[2]; mach_msg_type_number_t em_count = 2; TRY(task_swap_exception_ports(task, EXC_MASK_BAD_ACCESS, exc, EXCEPTION_STATE_IDENTITY, state_flavor, em, &em_count, eh, eb, ef)); ASSERTR(em_count <= 1, KERN_FAILURE); TRY(thread_set_state(thread, state_flavor, &state.nat, state_count)); TRY(thread_resume(thread)); // We expect three exceptions: one from thread when it returns, one from the new thread when it calls the fake handler, and one from the new thread when it returns from dlopen. bool started_dlopen = false; while(1) { struct exception_message msg; TRY(mach_msg_overwrite(NULL, MACH_RCV_MSG, 0, sizeof(msg), exc, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL, (void *) &msg, sizeof(msg))); //fprintf(stderr, "got a message\n"); ASSERTR((msg.Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) && (msg.msgh_body.msgh_descriptor_count != 0) && (msg.Head.msgh_size >= offsetof(struct exception_message, old_state)) && (msg.old_stateCnt == state_count) && (msg.Head.msgh_size >= offsetof(struct exception_message, old_state) + msg.old_stateCnt * sizeof(natural_t)), KERN_FAILURE); memcpy(&state, msg.old_state, sizeof(state)); if(msg.thread.name == thread) { TRY(thread_terminate(thread)); } else { bool cond = false; switch(cputype) { #ifdef __arm__ case CPU_TYPE_ARM: cond = (state.arm.pc & ~1) == 0xdeadbeee; break; #endif #if defined(__i386__) || defined(__x86_64__) case CPU_TYPE_X86: cond = state.x86.eip == 0xdeadbeef; break; case CPU_TYPE_X86_64: cond = state.x64.rip == 0xdeadbeef; break; #endif #ifdef __ppc__ case CPU_TYPE_POWERPC: case CPU_TYPE_POWERPC64: cond = state.ppc.srr0 == 0xdeadbeef; break; #endif } if(!cond) { // let the normal crash mechanism handle it task_set_exception_ports(task, em[0], eh[0], eb[0], ef[0]); ASSERTR(0, KERN_FAILURE); } else if(started_dlopen) { TRY(thread_terminate(msg.thread.name)); break; } else { switch(cputype) { #ifdef __arm__ case CPU_TYPE_ARM: state.arm.r[0] = (uint32_t) stack_address; state.arm.r[1] = RTLD_LAZY; state.arm.pc = (uint32_t) addrs.dlopen; state.arm.lr = 0xdeadbeef; break; #endif #if defined(__i386__) || defined(__x86_64__) case CPU_TYPE_X86: { uint32_t stack_stuff[3] = {0xdeadbeef, (uint32_t) stack_address, RTLD_LAZY}; TRY(mach_vm_write(task, state.x86.esp, address_cast(&stack_stuff), sizeof(stack_stuff))); } state.x86.eip = (uint32_t) addrs.dlopen; break; case CPU_TYPE_X86_64: { uint64_t stack_stuff = 0xdeadbeef; TRY(mach_vm_write(task, state.x64.rsp, address_cast(&stack_stuff), sizeof(stack_stuff))); } state.x64.rip = addrs.dlopen; state.x64.rdi = stack_address; state.x64.rsi = RTLD_LAZY; break; #endif #ifdef __ppc__ case CPU_TYPE_POWERPC: case CPU_TYPE_POWERPC64: cond = state.ppc.srr0 == 0xdeadbeef; state.ppc.srr0 = addrs.dlopen; state.ppc.r[3] = stack_address; state.ppc.r[4] = RTLD_LAZY; state.ppc.lr = 0xdeadbeef; break; #endif } struct exception_reply reply; memcpy(&reply.Head, &msg.Head, sizeof(mach_msg_header_t)); reply.Head.msgh_bits &= ~MACH_MSGH_BITS_COMPLEX; reply.Head.msgh_size = offsetof(struct exception_reply, new_state) + state_count * sizeof(natural_t); reply.Head.msgh_id += 100; memcpy(&reply.NDR, &msg.NDR, sizeof(NDR_record_t)); reply.RetCode = 0; reply.flavor = state_flavor; reply.new_stateCnt = state_count; memcpy(&reply.new_state, &state, sizeof(state)); TRY(thread_set_state(msg.thread.name, state_flavor, &state.nat, state_count)); TRY(mach_msg(&reply.Head, MACH_SEND_MSG, reply.Head.msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL)); started_dlopen = true; } } } bad: if(stack_address) vm_deallocate(task, stack_address, stack_size); if(thread) { thread_terminate(thread); mach_port_deallocate(mach_task_self(), thread); } if(task) mach_port_deallocate(mach_task_self(), task); if(exc) mach_port_deallocate(mach_task_self(), exc); return kr; }
RyanTech/shadow_Tianxing
AppProxyCap/lib/inject_and_interpose/inject.c
C
apache-2.0
17,511
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="pragma" content="no-cache"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Clock</title> <link rel="stylesheet" type="text/css" href="style/clock.css"> <link rel="stylesheet" type="text/css" href="style/alarm.css"> <link rel="stylesheet" type="text/css" href="style/stopwatch.css"> <link rel="stylesheet" type="text/css" href="style/timer.css"> <link rel="stylesheet" type="text/css" href="style/tabs.css"> <link rel="stylesheet" type="text/css" href="style/views.css"> <link rel="stylesheet" type="text/css" href="style/picker/value_selector.css"> <link rel="stylesheet" type="text/css" href="style/picker/picker.css"> <!-- Shared styles --> <link rel="stylesheet" type="text/css" href="shared/style/headers.css"> <link rel="stylesheet" type="text/css" href="shared/style/status.css"> <!-- These are lazy loaded. Need to be included here so the build picks them up <link rel="stylesheet" type="text/css" href="shared/style/input_areas.css" > <link rel="stylesheet" type="text/css" href="shared/style/buttons.css" > <link rel="stylesheet" type="text/css" href="shared/style/edit_mode.css" > <link rel="stylesheet" type="text/css" href="shared/style/switches.css" > --> <!-- Shared sounds --> <link rel="resources" type="directory" href="shared/resources/media/alarms/"> <!-- Localization --> <link rel="resource" type="application/l10n" href="shared/locales/date.ini"> <link rel="resource" type="application/l10n" href="locales/locales.ini"> <script defer src="js/vendor/mapset.js"></script> <script defer src="js/vendor/date_localeformat.js"></script> <script defer src="shared/js/l10n.js"></script> <script defer src="shared/js/l10n_date.js"></script> <!-- Specific code --> <script defer src="shared/js/lazy_loader.js"></script> <script defer src="js/startup.js"></script> <!-- Lazy Loaded Scripts - Include here for build process <script defer src="shared/js/gesture_detector.js"></script> <script defer src="shared/js/async_storage.js"></script> <script defer src="shared/js/template.js"></script> <script defer src="js/emitter.js"></script> <script defer src="js/view.js"></script> <script defer src="js/panel.js"></script> <script defer src="js/constants.js"></script> <script defer src="js/utils.js"></script> <script defer src="js/alarm.js"></script> <script defer src="js/active_alarm.js"></script> <script defer src="js/alarmsdb.js"></script> <script defer src="js/banner.js"></script> <script defer src="js/clock_view.js"></script> <script defer src="js/alarm_list.js"></script> <script defer src="js/alarm_manager.js"></script> <script defer src="js/stopwatch.js"></script> <script defer src="js/stopwatch_panel.js"></script> <script defer src="js/timer.js"></script> <script defer src="js/tabs.js"></script> <script defer src="js/app.js"></script> <script defer src="js/picker/spinner.js"></script> <script defer src="js/picker/picker.js"></script> --> </head> <body> <div id="views"> <div id="main-panel-wrapper"> <div id="alarm-panel" class="active panel"> <div id="clock-view"> <div id="analog-clock"> <div id="analog-clock-container"> <svg id="analog-clock-svg" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 270 270"> <circle id="minutehandCentralPoint" cx="135" cy="135" r="9"/> <rect id="hourhand" x="131" y="135" width="8" height="92"/> <rect id="minutehand" x="131" y="135" width="8" height="113"/> <!-- This is the second hand path, Thanks illustrator! --> <path id="secondhand" d="M142.103,135c0-3.562-3.103-6.495-6.103-6.936V0h-2v128.095c-3,0.53-5.897,3.415-5.897,6.905 s2.897,6.375,5.897,6.905V161h2v-19.064C139,141.495,142.103,138.562,142.103,135z"/> </svg> </div> </div> <div id="digital-clock"> <div id="digital-clock-container"> <div id="digital-clock-display"> <span id="clock-time"></span> <span id="clock-hour24-state"></span> </div> </div> </div> <div id="clock-day-date"></div> <!-- create new alarm icon --> <button id="alarm-new"></button> <!-- list of exisiting alarms, to be populated --> <ul id="alarms"></ul> </div> <section id="banner-countdown" role="status"> <!-- this will be replaced dynamically --> </section> </div> <div id="timer-panel" class="panel hidden"> <div id="timer-active"> <div id="timer-time-display"> <div id="timer-time">00:00</div> <menu id="timer-controls"> <button id="timer-start" class="edit-button" data-l10n-id="resume"> Resume </button> <button id="timer-pause" class="edit-button" data-l10n-id="pause"> Pause </button> <button id="timer-cancel" class="danger" data-l10n-id="cancel"> Cancel </button> </menu> </div> </div> <div id="timer-dialog" class="panel"> <div id="value-selector"> <!-- Time Picker --> <div id="time-picker" data-type="picker"> <div class="picker-container"> <div class="picker-bar-background"></div> <div class="picker-hours-wrapper"> <div class="picker-hours"> </div> </div> <div class="picker-minutes-wrapper"> <div class="picker-minutes"> </div> </div> <div class="picker-seconds-wrapper"> <div class="picker-seconds"> </div> </div> <div class="value-indicator"> <div class="value-indicator-colon">:</div> <div class="value-indicator-period">.</div> </div> </div> </div> <ul id="timer-edit"> <li> <button id="timer-create" class="recommend full" data-l10n-id="start"> Start </button> </li> <li> <span data-l10n-id="sound">Sound:</span> <select id="timer-sound"> <option value="0" data-l10n-id="noSound">No Sound</option> <option value="ac_classic_clock_alarm.opus" data-l10n-id="ac_classic_clock_alarm_opus"></option> <option value="ac_classic_clock_alarm_prog.opus" data-l10n-id="ac_classic_clock_alarm_prog_opus"></option> <option value="ac_classic_clock_radio.opus" data-l10n-id="ac_classic_clock_radio_opus"></option> <option value="ac_normal_gem_echoes.opus" data-l10n-id="ac_normal_gem_echoes_opus"></option> <option value="ac_normal_ringing_strings.opus" data-l10n-id="ac_normal_ringing_strings_opus"></option> <option value="ac_soft_humming_waves.opus" data-l10n-id="ac_soft_humming_waves_opus"></option> <option value="ac_soft_into_the_void.opus" data-l10n-id="ac_soft_into_the_void_opus"></option> <option value="ac_soft_smooth_strings.opus" data-l10n-id="ac_soft_smooth_strings_opus"></option> </select> </li> <li> <span data-l10n-id="vibrate">Vibrate:</span> <label class="pack-switch"> <input type="checkbox" id="timer-vibrate" checked class="uninit" /> <span></span> </label> </li> </ul> </div> </div> </div> <div id="stopwatch-panel" class="panel hidden"> <div class="stopwatch-time"></div> <menu id="stopwatch-controls"> <button class="stopwatch-start edit-button" data-l10n-id="start">Start</button> <button class="stopwatch-pause edit-button recommend" data-l10n-id="pause">Pause</button> <button class="stopwatch-resume edit-button" data-l10n-id="resume">Resume</button> <button class="stopwatch-reset edit-button danger" data-l10n-id="reset">Reset</button> <button class="stopwatch-lap edit-button" data-l10n-id="lap">Lap</button> </menu> <div class="stopwatch-lap-list"> <!-- list of exisiting alarms, to be populated --> <ul class="stopwatch-laps"></ul> </div> </div> </div> <form id="alarm-edit-panel" role="dialog" class="panel hidden" data-type="edit"> <header> <button id="alarm-close"><span class="icon icon-close"></span></button> <menu type="toolbar"> <button id="alarm-done" data-l10n-id="done"></button> </menu> <h1 id="alarm-title"></h1> </header> <ul id="edit-alarm" class="compact"> <li> <input type="text" name="alarm.label" data-l10n-id="alarmName" placeholder="Alarm name" maxLength="50" /> </li> <li> <label data-l10n-id="time">Time</label> <input id="time-select" type="time" /> <button id="time-menu" class="icon icon-dialog"></button> </li> <li> <label data-l10n-id="repeat">Repeat</label> <select id="repeat-select" multiple="true"> <option value="0" data-l10n-id="weekday-1-long">Monday</option> <option value="1" data-l10n-id="weekday-2-long">Tuesday</option> <option value="2" data-l10n-id="weekday-3-long">Wednesday</option> <option value="3" data-l10n-id="weekday-4-long">Thursday</option> <option value="4" data-l10n-id="weekday-5-long">Friday</option> <option value="5" data-l10n-id="weekday-6-long">Saturday</option> <option value="6" data-l10n-id="weekday-0-long">Sunday</option> </select> <button id="repeat-menu" class="icon icon-dialog" data-l10n-id="never">Never</button> </li> <li> <label data-l10n-id="sound">Sound</label> <select id="sound-select"> <option value="0" data-l10n-id="noSound">No Sound</option> <option value="ac_classic_clock_alarm.opus" data-l10n-id="ac_classic_clock_alarm_opus"></option> <option value="ac_classic_clock_alarm_prog.opus" data-l10n-id="ac_classic_clock_alarm_prog_opus"></option> <option value="ac_classic_clock_radio.opus" data-l10n-id="ac_classic_clock_radio_opus"></option> <option value="ac_normal_gem_echoes.opus" data-l10n-id="ac_normal_gem_echoes_opus"></option> <option value="ac_normal_ringing_strings.opus" data-l10n-id="ac_normal_ringing_strings_opus"></option> <option value="ac_soft_humming_waves.opus" data-l10n-id="ac_soft_humming_waves_opus"></option> <option value="ac_soft_into_the_void.opus" data-l10n-id="ac_soft_into_the_void_opus"></option> <option value="ac_soft_smooth_strings.opus" data-l10n-id="ac_soft_smooth_strings_opus"></option> </select> <button id="sound-menu" class="icon icon-dialog"></button> </li> <li> <label data-l10n-id="vibrate">Vibrate</label> <select id="vibrate-select"> <option value="1" data-l10n-id="vibrateOn">On</option> <option value="0" data-l10n-id="vibrateOff">Off</option> </select> <button id="vibrate-menu" class="icon icon-dialog" data-l10n-id="vibrateOn">On</button> </li> <li> <label class="view-alarm-lbl snooze-lbl" data-l10n-id="snooze">Snooze</label> <select id="snooze-select"> <option data-l10n-id="nMinutes" data-l10n-args='{"n": "5"}' value="5"> 5 minutes</option> <option data-l10n-id="nMinutes" data-l10n-args='{"n": "10"}' value="10">10 minutes</option> <option data-l10n-id="nMinutes" data-l10n-args='{"n": "15"}' value="15">15 minutes</option> <option data-l10n-id="nMinutes" data-l10n-args='{"n": "20"}' value="20">20 minutes</option> </select> <button id="snooze-menu" class="icon icon-dialog" data-l10n-id="nMinutes" data-l10n-args='{"n": "5"}'>5 minutes</button> </li> </ul> <menu id="delete-menu"> <button id="alarm-delete" class="danger full" data-l10n-id="delete">Delete</button> </menu> </form> </div> <ul role="tablist" class="bottom" data-items="3" id="clock-tabs"> <li id="alarm-tab" role="tab" aria-selected="true"><a href="#alarm-panel" data-l10n-id="alarm">Alarm</a></li> <li id="timer-tab" role="tab"><a href="#timer-panel" data-l10n-id="timer">Timer</a></li> <li id="stopwatch-tab" role="tab"><a href="#stopwatch-panel" data-l10n-id="stopwatch">Stopwatch</a></li> </ul> <div id="alarm-list-item-tmpl" class="hide"> <!-- <label class="alarmList alarmEnable"> <input class="input-enable" data-id="${id}" type="checkbox" ${checked}> <span></span> </label> <a href="#alarm-edit-panel" class="alarm-item${withRepeat}" data-id="${id}"> <span class="time"> ${time} <span class="period">${meridian}</span> </span> <span class="label">${label}</span> <span class="repeat">${repeat}</span> </a> --> </div> <div id="banner-tmpl" class="hide"> <!-- <p>${notice}</p> --> </div> <div id="lap-list-item-tmpl" class="hide"> <!-- <div class="lap-name"> Lap ${num} </div> <div class="lap-duration"> ${time} </div> --> </div> <div id="picker-unit-tmpl" class="hide"> <!-- <div class="picker-unit">${unit}</div> --> </div> </body> </html>
telefonicaid/CrossPlatform-ClockApp
index.html
HTML
apache-2.0
14,673
package com.google.api.ads.dfp.jaxws.v201602; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * * A {@code Content} represents video metadata from a publisher's * Content Management System (CMS) that has been synced to DFP. * <p> * Video line items can be targeted to {@code Content} * to indicate what ads should match when the {@code Content} is being played. * * * <p>Java class for Content complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Content"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="status" type="{https://www.google.com/apis/ads/publisher/v201602}ContentStatus" minOccurs="0"/> * &lt;element name="statusDefinedBy" type="{https://www.google.com/apis/ads/publisher/v201602}ContentStatusDefinedBy" minOccurs="0"/> * &lt;element name="importDateTime" type="{https://www.google.com/apis/ads/publisher/v201602}DateTime" minOccurs="0"/> * &lt;element name="lastModifiedDateTime" type="{https://www.google.com/apis/ads/publisher/v201602}DateTime" minOccurs="0"/> * &lt;element name="userDefinedCustomTargetingValueIds" type="{http://www.w3.org/2001/XMLSchema}long" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="mappingRuleDefinedCustomTargetingValueIds" type="{http://www.w3.org/2001/XMLSchema}long" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="cmsSources" type="{https://www.google.com/apis/ads/publisher/v201602}CmsContent" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Content", propOrder = { "id", "name", "status", "statusDefinedBy", "importDateTime", "lastModifiedDateTime", "userDefinedCustomTargetingValueIds", "mappingRuleDefinedCustomTargetingValueIds", "cmsSources" }) public class Content { protected Long id; protected String name; @XmlSchemaType(name = "string") protected ContentStatus status; @XmlSchemaType(name = "string") protected ContentStatusDefinedBy statusDefinedBy; protected DateTime importDateTime; protected DateTime lastModifiedDateTime; @XmlElement(type = Long.class) protected List<Long> userDefinedCustomTargetingValueIds; @XmlElement(type = Long.class) protected List<Long> mappingRuleDefinedCustomTargetingValueIds; protected List<CmsContent> cmsSources; /** * Gets the value of the id property. * * @return * possible object is * {@link Long } * */ public Long getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link Long } * */ public void setId(Long value) { this.id = value; } /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } /** * Gets the value of the status property. * * @return * possible object is * {@link ContentStatus } * */ public ContentStatus getStatus() { return status; } /** * Sets the value of the status property. * * @param value * allowed object is * {@link ContentStatus } * */ public void setStatus(ContentStatus value) { this.status = value; } /** * Gets the value of the statusDefinedBy property. * * @return * possible object is * {@link ContentStatusDefinedBy } * */ public ContentStatusDefinedBy getStatusDefinedBy() { return statusDefinedBy; } /** * Sets the value of the statusDefinedBy property. * * @param value * allowed object is * {@link ContentStatusDefinedBy } * */ public void setStatusDefinedBy(ContentStatusDefinedBy value) { this.statusDefinedBy = value; } /** * Gets the value of the importDateTime property. * * @return * possible object is * {@link DateTime } * */ public DateTime getImportDateTime() { return importDateTime; } /** * Sets the value of the importDateTime property. * * @param value * allowed object is * {@link DateTime } * */ public void setImportDateTime(DateTime value) { this.importDateTime = value; } /** * Gets the value of the lastModifiedDateTime property. * * @return * possible object is * {@link DateTime } * */ public DateTime getLastModifiedDateTime() { return lastModifiedDateTime; } /** * Sets the value of the lastModifiedDateTime property. * * @param value * allowed object is * {@link DateTime } * */ public void setLastModifiedDateTime(DateTime value) { this.lastModifiedDateTime = value; } /** * Gets the value of the userDefinedCustomTargetingValueIds property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the userDefinedCustomTargetingValueIds property. * * <p> * For example, to add a new item, do as follows: * <pre> * getUserDefinedCustomTargetingValueIds().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Long } * * */ public List<Long> getUserDefinedCustomTargetingValueIds() { if (userDefinedCustomTargetingValueIds == null) { userDefinedCustomTargetingValueIds = new ArrayList<Long>(); } return this.userDefinedCustomTargetingValueIds; } /** * Gets the value of the mappingRuleDefinedCustomTargetingValueIds property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the mappingRuleDefinedCustomTargetingValueIds property. * * <p> * For example, to add a new item, do as follows: * <pre> * getMappingRuleDefinedCustomTargetingValueIds().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Long } * * */ public List<Long> getMappingRuleDefinedCustomTargetingValueIds() { if (mappingRuleDefinedCustomTargetingValueIds == null) { mappingRuleDefinedCustomTargetingValueIds = new ArrayList<Long>(); } return this.mappingRuleDefinedCustomTargetingValueIds; } /** * Gets the value of the cmsSources property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the cmsSources property. * * <p> * For example, to add a new item, do as follows: * <pre> * getCmsSources().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link CmsContent } * * */ public List<CmsContent> getCmsSources() { if (cmsSources == null) { cmsSources = new ArrayList<CmsContent>(); } return this.cmsSources; } }
gawkermedia/googleads-java-lib
modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201602/Content.java
Java
apache-2.0
8,939
@(task: Task)(content: Html) <ul> <li>@task._id.toString</li> <li>@task.taskset_id.toString</li> <li>@content</li> </ul>
BonarBeavis/veritask
app/views/template.scala.html
HTML
apache-2.0
134
package ru.stqa.pft.addressbook.model; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamOmitField; import org.hibernate.annotations.Type; import javax.persistence.*; import java.io.File; @XStreamAlias("contact") @Entity @Table(name = "addressbook") public class ContactData { @XStreamOmitField @Id @Column(name = "id") private int id = Integer.MAX_VALUE; @Column(name = "firstname") private String firstName = ""; @Column(name = "middlename") private String middleName = ""; @Column(name = "lastname") private String lastName = ""; @Column(name = "home") @Type(type = "text") private String homePhone = ""; @Column(name = "mobile") @Type(type = "text") private String mobilePhone = ""; @Column(name = "work") @Type(type = "text") private String workPhone = ""; @Transient private String allPhones = ""; @Transient private String group; @Transient private String photo; @Column(name = "nickname") private String nickName = ""; @Column(name = "company") private String company = ""; @Column(name = "address") @Type(type = "text") private String address = ""; @Column(name = "email") @Type(type = "text") private String email1 = ""; @Column(name = "email2") @Type(type = "text") private String email2 = ""; @Column(name = "email3") @Type(type = "text") private String email3 = ""; @Transient private String allEmails; @Transient private String allDetails; public ContactData withId(int id) { this.id = id; return this; } public ContactData withFirstName(String firstName) { this.firstName = firstName; return this; } public ContactData withMiddleName(String middleName) { this.middleName = middleName; return this; } public ContactData withLastName(String lastName) { this.lastName = lastName; return this; } public ContactData withNickName(String nickName) { this.nickName = nickName; return this; } public ContactData withCompany(String company) { this.company = company; return this; } public ContactData withAddress(String address) { this.address = address; return this; } public ContactData withHomePhone(String homePhone) { this.homePhone = homePhone; return this; } public ContactData withMobilePhone(String mobilePhone) { this.mobilePhone = mobilePhone; return this; } public ContactData withWorkPhone(String workPhone) { this.workPhone = workPhone; return this; } public ContactData withAllPhones(String allPhones) { this.allPhones = allPhones; return this; } public ContactData withEmail1(String email1) { this.email1 = email1; return this; } public ContactData withEmail2(String email2) { this.email2 = email2; return this; } public ContactData withEmail3(String email3) { this.email3 = email3; return this; } public ContactData withAllEmails(String allEmails) { this.allEmails = allEmails; return this; } public ContactData withGroup(String group) { this.group = group; return this; } public ContactData withAllDetails(String allDetails) { this.allDetails = allDetails; return this; } public ContactData withPhoto(File photo) { this.photo = photo.getPath(); return this; } public int getId() { return id; } public String getFirstName() { return firstName; } public String getMiddleName() { return middleName; } public String getLastName() { return lastName; } public String getNickName() { return nickName; } public String getCompany() { return company; } public String getAddress() { return address; } public String getHomePhone() { return homePhone; } public String getHomePhoneWihHint() { if (homePhone.length()>0) { return "H:"+homePhone; } else { return homePhone; } } public String getMobilePhone() { return mobilePhone; } public String getMobilePhoneWihHint() { if (mobilePhone.length()>0) { return "M:"+mobilePhone; } else { return mobilePhone; } } public String getWorkPhone() { return workPhone; } public String getWorkPhoneWihHint() { if (workPhone.length()>0) { return "W:"+workPhone; } else { return workPhone; } } public String getAllPhones() { return allPhones; } public String getEmail1() { return email1; } public String getEmail2() { return email2; } public String getEmail3() { return email3; } public String getAllEmails() { return allEmails; } public String getGroup() { return group; } public String getAllDetails() { return allDetails; } public File getPhoto() { if (photo == null) { return null; } else { return new File(photo); } } public void modifyNullStrings() { if (firstName == null) { firstName = ""; } if (middleName == null) { middleName = ""; } if (lastName == null) { lastName = ""; } if (homePhone == null) { homePhone = ""; } if (mobilePhone == null) { mobilePhone = ""; } if (workPhone == null) { workPhone = ""; } if (nickName == null) { nickName = ""; } if (company == null) { company = ""; } if (address == null) { address = ""; } if (email1 == null) { email1 = ""; } if (email2 == null) { email2 = ""; } if (email3 == null) { email3 = ""; } } @Override public String toString() { return "ContactData{" + "id=" + id + ", firstName='" + firstName + '\'' + ", middleName='" + middleName + '\'' + ", lastName='" + lastName + '\'' + ", address='" + address + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ContactData that = (ContactData) o; if (id != that.id) return false; if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) return false; if (middleName != null ? !middleName.equals(that.middleName) : that.middleName != null) return false; if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) return false; if (homePhone != null ? !homePhone.equals(that.homePhone) : that.homePhone != null) return false; if (mobilePhone != null ? !mobilePhone.equals(that.mobilePhone) : that.mobilePhone != null) return false; if (workPhone != null ? !workPhone.equals(that.workPhone) : that.workPhone != null) return false; if (nickName != null ? !nickName.equals(that.nickName) : that.nickName != null) return false; if (company != null ? !company.equals(that.company) : that.company != null) return false; if (address != null ? !address.equals(that.address) : that.address != null) return false; if (email1 != null ? !email1.equals(that.email1) : that.email1 != null) return false; if (email2 != null ? !email2.equals(that.email2) : that.email2 != null) return false; return email3 != null ? email3.equals(that.email3) : that.email3 == null; } @Override public int hashCode() { int result = id; result = 31 * result + (firstName != null ? firstName.hashCode() : 0); result = 31 * result + (middleName != null ? middleName.hashCode() : 0); result = 31 * result + (lastName != null ? lastName.hashCode() : 0); result = 31 * result + (homePhone != null ? homePhone.hashCode() : 0); result = 31 * result + (mobilePhone != null ? mobilePhone.hashCode() : 0); result = 31 * result + (workPhone != null ? workPhone.hashCode() : 0); result = 31 * result + (nickName != null ? nickName.hashCode() : 0); result = 31 * result + (company != null ? company.hashCode() : 0); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (email1 != null ? email1.hashCode() : 0); result = 31 * result + (email2 != null ? email2.hashCode() : 0); result = 31 * result + (email3 != null ? email3.hashCode() : 0); return result; } }
volter239/java_pft
addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/model/ContactData.java
Java
apache-2.0
9,235
/* * Copyright (C) 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. */ package com.google.auto.value.processor; import static com.google.auto.value.processor.AutoValueOrOneOfProcessor.hasAnnotationMirror; import static com.google.auto.value.processor.ClassNames.AUTO_VALUE_BUILDER_NAME; import static com.google.auto.value.processor.ClassNames.AUTO_VALUE_NAME; import com.google.auto.common.SuperficialValidation; import com.google.auto.service.AutoService; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Processor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; /** * Annotation processor that checks that the type that {@code AutoValue.Builder} is applied to is * nested inside an {@code @AutoValue} class. The actual code generation for builders is done in * {@link AutoValueProcessor}. * * @author Éamonn McManus */ @AutoService(Processor.class) @SupportedAnnotationTypes(AUTO_VALUE_BUILDER_NAME) public class AutoValueBuilderProcessor extends AbstractProcessor { @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.latest(); } @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { TypeElement autoValueBuilder = processingEnv.getElementUtils().getTypeElement(AUTO_VALUE_BUILDER_NAME); Set<? extends Element> builderTypes = roundEnv.getElementsAnnotatedWith(autoValueBuilder); if (!SuperficialValidation.validateElements(builderTypes)) { return false; } for (Element annotatedType : builderTypes) { // Double-check that the annotation is there. Sometimes the compiler gets confused in case of // erroneous source code. SuperficialValidation should protect us against this but it doesn't // cost anything to check again. if (hasAnnotationMirror(annotatedType, AUTO_VALUE_BUILDER_NAME)) { validate( annotatedType, "@AutoValue.Builder can only be applied to a class or interface inside an" + " @AutoValue class"); } } return false; } private void validate(Element annotatedType, String errorMessage) { Element container = annotatedType.getEnclosingElement(); if (!hasAnnotationMirror(container, AUTO_VALUE_NAME)) { processingEnv.getMessager().printMessage( Diagnostic.Kind.ERROR, errorMessage, annotatedType); } } }
MaTriXy/auto
value/src/main/java/com/google/auto/value/processor/AutoValueBuilderProcessor.java
Java
apache-2.0
3,187
using System.Threading; using System.Threading.Tasks; namespace Ditto.AsyncInit { /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(CancellationToken cancellationToken); } /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <typeparam name="TArg">The type of the initialization argument.</typeparam> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit<TArg> { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="arg">The initialization argument.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(TArg arg, CancellationToken cancellationToken); } /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <typeparam name="TArg1">The type of the first initialization argument.</typeparam> /// <typeparam name="TArg2">The type of the second initialization argument.</typeparam> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit<TArg1, TArg2> { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="arg1">The first initialization argument.</param> /// <param name="arg2">The second initialization argument.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(TArg1 arg1, TArg2 arg2, CancellationToken cancellationToken); } /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <typeparam name="TArg1">The type of the first initialization argument.</typeparam> /// <typeparam name="TArg2">The type of the second initialization argument.</typeparam> /// <typeparam name="TArg3">The type of the third initialization argument.</typeparam> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit<TArg1, TArg2, TArg3> { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="arg1">The first initialization argument.</param> /// <param name="arg2">The second initialization argument.</param> /// <param name="arg3">The third initialization argument.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(TArg1 arg1, TArg2 arg2, TArg3 arg3, CancellationToken cancellationToken); } /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <typeparam name="TArg1">The type of the first initialization argument.</typeparam> /// <typeparam name="TArg2">The type of the second initialization argument.</typeparam> /// <typeparam name="TArg3">The type of the third initialization argument.</typeparam> /// <typeparam name="TArg4">The type of the fourth initialization argument.</typeparam> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit<TArg1, TArg2, TArg3, TArg4> { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="arg1">The first initialization argument.</param> /// <param name="arg2">The second initialization argument.</param> /// <param name="arg3">The third initialization argument.</param> /// <param name="arg4">The fourth initialization argument.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, CancellationToken cancellationToken); } /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <typeparam name="TArg1">The type of the first initialization argument.</typeparam> /// <typeparam name="TArg2">The type of the second initialization argument.</typeparam> /// <typeparam name="TArg3">The type of the third initialization argument.</typeparam> /// <typeparam name="TArg4">The type of the fourth initialization argument.</typeparam> /// <typeparam name="TArg5">The type of the fifth initialization argument.</typeparam> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit<TArg1, TArg2, TArg3, TArg4, TArg5> { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="arg1">The first initialization argument.</param> /// <param name="arg2">The second initialization argument.</param> /// <param name="arg3">The third initialization argument.</param> /// <param name="arg4">The fourth initialization argument.</param> /// <param name="arg5">The fifth initialization argument.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, CancellationToken cancellationToken); } /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <typeparam name="TArg1">The type of the first initialization argument.</typeparam> /// <typeparam name="TArg2">The type of the second initialization argument.</typeparam> /// <typeparam name="TArg3">The type of the third initialization argument.</typeparam> /// <typeparam name="TArg4">The type of the fourth initialization argument.</typeparam> /// <typeparam name="TArg5">The type of the fifth initialization argument.</typeparam> /// <typeparam name="TArg6">The type of the sixth initialization argument.</typeparam> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6> { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="arg1">The first initialization argument.</param> /// <param name="arg2">The second initialization argument.</param> /// <param name="arg3">The third initialization argument.</param> /// <param name="arg4">The fourth initialization argument.</param> /// <param name="arg5">The fifth initialization argument.</param> /// <param name="arg6">The sixth initialization argument.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, CancellationToken cancellationToken); } /// <summary> /// Interface for asynchronously initialized types supporting cancellation. /// </summary> /// <typeparam name="TArg1">The type of the first initialization argument.</typeparam> /// <typeparam name="TArg2">The type of the second initialization argument.</typeparam> /// <typeparam name="TArg3">The type of the third initialization argument.</typeparam> /// <typeparam name="TArg4">The type of the fourth initialization argument.</typeparam> /// <typeparam name="TArg5">The type of the fifth initialization argument.</typeparam> /// <typeparam name="TArg6">The type of the sixth initialization argument.</typeparam> /// <typeparam name="TArg7">The type of the seventh initialization argument.</typeparam> /// <conceptualLink target="c731bb1a-010a-40c6-856b-421ebbd05a26" /> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public interface ICancelableAsyncInit<TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7> { /// <summary> /// Asynchronously initializes an instance. /// </summary> /// <param name="arg1">The first initialization argument.</param> /// <param name="arg2">The second initialization argument.</param> /// <param name="arg3">The third initialization argument.</param> /// <param name="arg4">The fourth initialization argument.</param> /// <param name="arg5">The fifth initialization argument.</param> /// <param name="arg6">The sixth initialization argument.</param> /// <param name="arg7">The seventh initialization argument.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A <see cref="Task"/> capturing the initialization.</returns> Task InitAsync(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7, CancellationToken cancellationToken); } }
dmitry-shechtman/AsyncInit
AsyncInit/Portable/ICancelableAsyncInit.cs
C#
apache-2.0
10,663
/* * Copyright © 2013-2018 camunda services GmbH and various authors (info@camunda.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 org.camunda.bpm.engine.impl; import java.util.List; import org.camunda.bpm.engine.batch.Batch; import org.camunda.bpm.engine.impl.batch.AbstractBatchJobHandler; import org.camunda.bpm.engine.impl.batch.BatchJobConfiguration; import org.camunda.bpm.engine.impl.batch.BatchJobContext; import org.camunda.bpm.engine.impl.batch.BatchJobDeclaration; import org.camunda.bpm.engine.impl.context.Context; import org.camunda.bpm.engine.impl.interceptor.CommandContext; import org.camunda.bpm.engine.impl.jobexecutor.JobDeclaration; import org.camunda.bpm.engine.impl.json.ModificationBatchConfigurationJsonConverter; import org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity; import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; import org.camunda.bpm.engine.impl.persistence.entity.JobEntity; import org.camunda.bpm.engine.impl.persistence.entity.MessageEntity; import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; public class ModificationBatchJobHandler extends AbstractBatchJobHandler<ModificationBatchConfiguration>{ public static final BatchJobDeclaration JOB_DECLARATION = new BatchJobDeclaration(Batch.TYPE_PROCESS_INSTANCE_MODIFICATION); @Override public String getType() { return Batch.TYPE_PROCESS_INSTANCE_MODIFICATION; } @Override protected void postProcessJob(ModificationBatchConfiguration configuration, JobEntity job) { CommandContext commandContext = Context.getCommandContext(); ProcessDefinitionEntity processDefinitionEntity = commandContext.getProcessEngineConfiguration().getDeploymentCache().findDeployedProcessDefinitionById(configuration.getProcessDefinitionId()); job.setDeploymentId(processDefinitionEntity.getDeploymentId()); } @Override public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) { ByteArrayEntity configurationEntity = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId()); ModificationBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes()); ModificationBuilderImpl executionBuilder = (ModificationBuilderImpl) commandContext.getProcessEngineConfiguration() .getRuntimeService() .createModification(batchConfiguration.getProcessDefinitionId()) .processInstanceIds(batchConfiguration.getIds()); executionBuilder.setInstructions(batchConfiguration.getInstructions()); if (batchConfiguration.isSkipCustomListeners()) { executionBuilder.skipCustomListeners(); } if (batchConfiguration.isSkipIoMappings()) { executionBuilder.skipIoMappings(); } executionBuilder.execute(false); commandContext.getByteArrayManager().delete(configurationEntity); } @Override public JobDeclaration<BatchJobContext, MessageEntity> getJobDeclaration() { return JOB_DECLARATION; } @Override protected ModificationBatchConfiguration createJobConfiguration(ModificationBatchConfiguration configuration, List<String> processIdsForJob) { return new ModificationBatchConfiguration( processIdsForJob, configuration.getProcessDefinitionId(), configuration.getInstructions(), configuration.isSkipCustomListeners(), configuration.isSkipIoMappings() ); } @Override protected ModificationBatchConfigurationJsonConverter getJsonConverterInstance() { return ModificationBatchConfigurationJsonConverter.INSTANCE; } protected ProcessDefinitionEntity getProcessDefinition(CommandContext commandContext, String processDefinitionId) { return commandContext.getProcessEngineConfiguration() .getDeploymentCache() .findDeployedProcessDefinitionById(processDefinitionId); } }
xasx/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/ModificationBatchJobHandler.java
Java
apache-2.0
4,497
FROM kollaglue/fedora-rdo-base MAINTAINER Dan Radez <dradez@redhat.com> RUN yum -y install \ openstack-utils \ openstack-glance \ python-keystoneclient \ mariadb; yum clean all RUN mkdir /opt/glance COPY config-glance.sh /opt/glance/config-glance.sh
jlabocki/superhappyfunshow
docker/glance/glance-base/Dockerfile
Dockerfile
apache-2.0
257
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_26) on Tue Aug 02 10:49:04 KST 2011 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Uses of Package org.jboss.netty.handler.codec.http.websocket (The Netty Project API Reference (3.2.5.Final)) </TITLE> <META NAME="date" CONTENT="2011-08-02"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Package org.jboss.netty.handler.codec.http.websocket (The Netty Project API Reference (3.2.5.Final))"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?org/jboss/netty/handler/codec/http/websocket/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Package<br>org.jboss.netty.handler.codec.http.websocket</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../../../org/jboss/netty/handler/codec/http/websocket/package-summary.html">org.jboss.netty.handler.codec.http.websocket</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.jboss.netty.handler.codec.http.websocket"><B>org.jboss.netty.handler.codec.http.websocket</B></A></TD> <TD>Encoder, decoder and their related message types for <a href="http://en.wikipedia.org/wiki/Web_Sockets">Web Socket</a> data frames.&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.jboss.netty.handler.codec.http.websocket"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../../../../../org/jboss/netty/handler/codec/http/websocket/package-summary.html">org.jboss.netty.handler.codec.http.websocket</A> used by <A HREF="../../../../../../../org/jboss/netty/handler/codec/http/websocket/package-summary.html">org.jboss.netty.handler.codec.http.websocket</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../../org/jboss/netty/handler/codec/http/websocket/class-use/WebSocketFrame.html#org.jboss.netty.handler.codec.http.websocket"><B>WebSocketFrame</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A Web Socket frame that represents either text or binary data.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?org/jboss/netty/handler/codec/http/websocket/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2008-2011 <a href="http://www.jboss.org">JBoss, a division of Red Hat, Inc.</a>. All Rights Reserved. </BODY> </HTML>
whg333/netty-3.2.5.Final
doc/api/org/jboss/netty/handler/codec/http/websocket/package-use.html
HTML
apache-2.0
7,650
package org.apache.taverna.mobile; import android.util.Log; import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; import java.io.InputStream; import java.io.InputStreamReader; public class TestDataFactory { private static final String TAG = TestDataFactory.class.getSimpleName(); public <T> T getObjectTypeBean(Class<T> model, String jsonName) { InputStream in = getClass().getClassLoader().getResourceAsStream(jsonName); Serializer serializer = new Persister(); T xmlBean = null; try { xmlBean = serializer.read(model, new InputStreamReader(in)); } catch (Exception e) { Log.e(TAG, "getObjectTypeBean: ", e); } return xmlBean; } }
sagar15795/incubator-taverna-mobile
app/src/commonTest/java/org/apache/taverna/mobile/TestDataFactory.java
Java
apache-2.0
768
great(h1,cc1). great(e1,aa1). great(u1,bb1). great(j1,y1). great(cc1,s1). great(a1,v1). great(c1,r1). great(d1,j1). great(d1,r1). great(c1,ll1). great(l1,z1). great(dd1,ll1). great(i1,v1). great(l1,ll1). great(r1,kk1). great(ee1,w1). great(kk1,aa1). great(c1,s1). great(a1,i1). great(g1,t1). great(ii1,v1). great(l1,a1). great(k1,i1). great(e1,x1). great(t1,m1). great(d1,cc1). great(r1,w1). great(r1,n1). great(a1,b1). great(e1,a1). great(j1,o1). great(a1,p1). great(dd1,bb1). great(kk1,x1). great(l1,v1). great(hh1,dd1). great(hh1,ll1). great(f1,h1). great(f1,y1). great(kk1,w1). great(ii1,k1). great(d1,ll1). great(e1,k1). great(cc1,w1). great(aa1,t1). great(hh1,h1). great(i1,w1). great(dd1,n1). great(t1,x1). great(ll1,dd1). great(a1,h1). great(aa1,y1). great(s1,a1). great(i1,z1). great(n1,ll1). great(n1,d1). great(dd1,l1). great(u1,k1). great(kk1,u1). great(p1,f1). great(o1,g1). great(i1,jj1). great(cc1,q1). great(o1,i1). great(m1,aa1). great(v1,u1).
manoelfranca/cilppp
foldsCreator/files/datasets/alzheimer_choline_0.3noisyOnTest/test6.f
FORTRAN
apache-2.0
961
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_16) on Sat Mar 06 22:12:21 IST 2010 --> <TITLE> API Help </TITLE> <META NAME="date" CONTENT="2010-03-06"> <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="API Help"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H1> How This API Document Is Organized</H1> </CENTER> This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3> Overview</H3> <BLOCKQUOTE> <P> The <A HREF="overview-summary.html">Overview</A> page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.</BLOCKQUOTE> <H3> Package</H3> <BLOCKQUOTE> <P> Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL> <LI>Interfaces (italic)<LI>Classes<LI>Enums<LI>Exceptions<LI>Errors<LI>Annotation Types</UL> </BLOCKQUOTE> <H3> Class/Interface</H3> <BLOCKQUOTE> <P> Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL> <LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description <P> <LI>Nested Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary <P> <LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL> Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE> </BLOCKQUOTE> <H3> Annotation Type</H3> <BLOCKQUOTE> <P> Each annotation type has its own separate page with the following sections:<UL> <LI>Annotation Type declaration<LI>Annotation Type description<LI>Required Element Summary<LI>Optional Element Summary<LI>Element Detail</UL> </BLOCKQUOTE> </BLOCKQUOTE> <H3> Enum</H3> <BLOCKQUOTE> <P> Each enum has its own separate page with the following sections:<UL> <LI>Enum declaration<LI>Enum description<LI>Enum Constant Summary<LI>Enum Constant Detail</UL> </BLOCKQUOTE> <H3> Use</H3> <BLOCKQUOTE> Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.</BLOCKQUOTE> <H3> Tree (Class Hierarchy)</H3> <BLOCKQUOTE> There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL> <LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL> </BLOCKQUOTE> <H3> Deprecated API</H3> <BLOCKQUOTE> The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE> <H3> Index</H3> <BLOCKQUOTE> The <A HREF="index-files/index-1.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE> <H3> Prev/Next</H3> These links take you to the next or previous class, interface, package, or related page.<H3> Frames/No Frames</H3> These links show and hide the HTML frames. All pages are available with or without frames. <P> <H3> Serialized Form</H3> Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. <P> <H3> Constant Field Values</H3> The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values. <P> <FONT SIZE="-1"> <EM> This help file applies to API documentation generated using the standard doclet.</EM> </FONT> <BR> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
DeuceSTM/DeuceSTM
doc/help-doc.html
HTML
apache-2.0
9,957
/** * Copyright (C) 2016 Oliver Schünemann * * 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. * * @since 30.10.2016 * @version 1.0 * @author oliver */ package midi.pad.ui; /** * @author oliver * */ public class Color { public static enum Brighness { OFF, LOW, NORMAL, FULL }; private final Brighness r; private final Brighness g; private final boolean flashing; private final boolean opaque; public Color(final Brighness r, final Brighness g) { super(); this.r = r; this.g = g; flashing = false; opaque = true; } public Color(final Brighness r, final Brighness g, final boolean flashing, final boolean opaque) { super(); this.r = r; this.g = g; this.flashing = flashing; this.opaque = opaque; } public Color(final Color c, final boolean flashing, final boolean opaque) { super(); r = c.r; g = c.g; this.flashing = flashing; this.opaque = opaque; } public static Color BLACK = new Color(Brighness.OFF, Brighness.OFF); public static Color LOW_RED = new Color(Brighness.LOW, Brighness.OFF); public static Color RED = new Color(Brighness.NORMAL, Brighness.OFF); public static Color FULL_RED = new Color(Brighness.FULL, Brighness.OFF); public static Color LOW_AMBER = new Color(Brighness.LOW, Brighness.LOW); public static Color FULL_AMBER = new Color(Brighness.FULL, Brighness.FULL); public static Color FULL_YELLOW = new Color(Brighness.LOW, Brighness.FULL); public static Color LOW_GREEN = new Color(Brighness.OFF, Brighness.LOW); public static Color GREEN = new Color(Brighness.OFF, Brighness.NORMAL); public static Color FULL_GREEN = new Color(Brighness.OFF, Brighness.FULL); public static Color TRANSPARENT = new Color(Brighness.OFF, Brighness.OFF, false, false); /** * @return the flashing */ public boolean isFlashing() { return flashing; } /** * @return the opaque */ public boolean isOpaque() { return opaque; } /** * @return the r */ public Brighness getRed() { return r; } /** * @return the g */ public Brighness getGreen() { return g; } public byte getMidiValue() { return (byte) (0x10 * g.ordinal() + r.ordinal()); } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "Color [r=" + r + ", g=" + g + ", flashing=" + flashing + ", opaque=" + opaque + "]"; } }
oschuen/ballin_midi
midi.pad/src/main/java/midi/pad/ui/Color.java
Java
apache-2.0
2,862
/* * Copyright 2016 The BigDL Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intel.analytics.bigdl.integration.torch import com.intel.analytics.bigdl.nn._ import com.intel.analytics.bigdl.tensor.Tensor import com.intel.analytics.bigdl.utils.RandomGenerator._ import com.intel.analytics.bigdl._ import scala.util.Random @com.intel.analytics.bigdl.tags.Serial class SpatialCrossMapLRNSpec extends TorchSpec { "A SpatialCrossMapLRN Layer" should "generate correct output" in { torchCheck() val seed = 100 RNG.setSeed(seed) val layer = new SpatialCrossMapLRN[Double](5, 1.0, 0.75, 1.0) val input = Tensor[Double](16, 3, 224, 224).rand() val output = layer.updateOutput(input) val code = "torch.manualSeed(" + seed + ")\n" + "layer = nn.SpatialCrossMapLRN(5, 1.0, 0.75, 1.0)\n" + "output = layer:forward(input) " val torchResult = TH.run(code, Map("input" -> input), Array("output"))._2 val luaOutput = torchResult("output").asInstanceOf[Tensor[Double]] output shouldEqual luaOutput } it should "generate correct output when feature map number is large" in { torchCheck() val seed = 100 RNG.setSeed(seed) val layer = new SpatialCrossMapLRN[Double](5, 1.0, 0.75, 1.0) val input = Tensor[Double](16, 32, 128, 128).rand() val output = layer.updateOutput(input) val code = "torch.manualSeed(" + seed + ")\n" + "layer = nn.SpatialCrossMapLRN(5, 1.0, 0.75, 1.0)\n" + "output = layer:forward(input) " val torchResult = TH.run(code, Map("input" -> input), Array("output"))._2 val luaOutput = torchResult("output").asInstanceOf[Tensor[Double]] output shouldEqual luaOutput } it should "generate correct gradInput" in { torchCheck() val seed = 100 RNG.setSeed(seed) val layer = new SpatialCrossMapLRN[Double](5, 1.0, 0.75, 1.0) val input = Tensor[Double](16, 3, 224, 224).rand() val gradOutput = Tensor[Double](16, 3, 224, 224).rand() layer.updateOutput(input) val output = layer.updateGradInput(input, gradOutput) val code = "torch.manualSeed(" + seed + ")\n" + "layer = nn.SpatialCrossMapLRN(5, 1.0, 0.75, 1.0)\n" + "layer:forward(input) " + "gradInput = layer:updateGradInput(input, gradOutput) " val torchResult = TH.run(code, Map("input" -> input, "gradOutput" -> gradOutput), Array("gradInput"))._2 val luaOutput = torchResult("gradInput").asInstanceOf[Tensor[Double]] output shouldEqual luaOutput } it should "generate correct gradInput when feature map number is large" in { torchCheck() val seed = 100 RNG.setSeed(seed) val layer = new SpatialCrossMapLRN[Double](5, 1.0, 0.75, 1.0) val input = Tensor[Double](16, 32, 128, 128).rand() val gradOutput = Tensor[Double](16, 32, 128, 128).rand() layer.updateOutput(input) val output = layer.updateGradInput(input, gradOutput) val code = "torch.manualSeed(" + seed + ")\n" + "layer = nn.SpatialCrossMapLRN(5, 1.0, 0.75, 1.0)\n" + "layer:forward(input) " + "gradInput = layer:updateGradInput(input, gradOutput) " val torchResult = TH.run(code, Map("input" -> input, "gradOutput" -> gradOutput), Array("gradInput"))._2 val luaOutput = torchResult("gradInput").asInstanceOf[Tensor[Double]] output shouldEqual luaOutput } "SpatialCrossMapLRN module" should "be good in gradient check for input" in { torchCheck() val seed = 100 RNG.setSeed(seed) val layer = new SpatialCrossMapLRN[Double](5, 1.0, 0.75, 1.0) val input = Tensor[Double](4, 8, 32, 32).apply1(e => Random.nextDouble()) val checker = new GradientChecker(1e-3) checker.checkLayer[Double](layer, input, 1e-3) should be(true) } "SpatialCrossMapLRN module" should "be saved to or loaded from Torch model correctly" in { torchCheck() val seed = 100 RNG.setSeed(seed) val layer = new SpatialCrossMapLRN[Double](5, 1.0, 0.75, 1.0) val tmpFile = java.io.File.createTempFile("module", ".t7." + suffix, TH.resultsRoot.toFile) val absolutePath = tmpFile.getAbsolutePath layer.saveTorch(absolutePath, true) val model = Module.loadTorch[Double](absolutePath).asInstanceOf[SpatialCrossMapLRN[Double]] model shouldEqual layer val input = Tensor[Double](16, 3, 224, 224).rand() val output = layer.updateOutput(input) val code = "torch.manualSeed(" + seed + ")\n" + "layer = torch.load(\'" + absolutePath + "\')\n" + "output = layer:forward(input) " val torchResult = TH.run(code, Map("input" -> input), Array("output"))._2 val luaOutput = torchResult("output").asInstanceOf[Tensor[Double]] output shouldEqual luaOutput } }
zhangxiaoli73/BigDL
spark/dl/src/test/scala/com/intel/analytics/bigdl/integration/torch/SpatialCrossMapLRNSpec.scala
Scala
apache-2.0
5,250
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2021 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jkiss.dbeaver.ext.sqlite.model; import org.jkiss.code.NotNull; import org.jkiss.code.Nullable; import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.ext.generic.model.GenericStructContainer; import org.jkiss.dbeaver.ext.generic.model.GenericTable; import org.jkiss.dbeaver.ext.generic.model.GenericUniqueKey; import org.jkiss.dbeaver.model.DBPNamedObject2; import org.jkiss.dbeaver.model.data.DBDPseudoAttribute; import org.jkiss.dbeaver.model.data.DBDPseudoAttributeContainer; import org.jkiss.dbeaver.model.data.DBDPseudoAttributeType; import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor; import org.jkiss.dbeaver.model.struct.DBSEntityConstraintType; import org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraint; import java.util.List; public class SQLiteTable extends GenericTable implements DBDPseudoAttributeContainer,DBPNamedObject2 { private static final DBDPseudoAttribute PSEUDO_ATTR_ROWID = new DBDPseudoAttribute( DBDPseudoAttributeType.ROWID, "rowid", "$alias.rowid", null, "Unique row identifier", true); public SQLiteTable(GenericStructContainer container, @Nullable String tableName, @Nullable String tableType, @Nullable JDBCResultSet dbResult) { super(container, tableName, tableType, dbResult); } @Override protected boolean isTruncateSupported() { return false; } // We use ROWID only if we don't have primary key. Looks like it is the only way to determine ROWID column presence. @Override public DBDPseudoAttribute[] getPseudoAttributes() throws DBException { if (hasPrimaryKey()) { return null; } return new DBDPseudoAttribute[] { PSEUDO_ATTR_ROWID }; } private boolean hasPrimaryKey() throws DBException { List<GenericUniqueKey> constraints = getConstraints(new VoidProgressMonitor()); if (constraints != null) { for (DBSTableConstraint cons : constraints) { if (cons.getConstraintType() == DBSEntityConstraintType.PRIMARY_KEY) { return true; } } } return false; } @Nullable @Override public List<SQLiteTableColumn> getAttributes(@NotNull DBRProgressMonitor monitor) throws DBException { return (List<SQLiteTableColumn>) super.getAttributes(monitor); } }
Sargul/dbeaver
plugins/org.jkiss.dbeaver.ext.sqlite/src/org/jkiss/dbeaver/ext/sqlite/model/SQLiteTable.java
Java
apache-2.0
3,168
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Middleware LLC, and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * 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.hibernate.jpamodelgen.model; /** * @author Hardy Ferentschik */ public interface MetaAttribute { String getDeclarationString(); String getMetaType(); String getPropertyName(); String getTypeDeclaration(); MetaEntity getHostingEntity(); }
hibernate/hibernate-metamodelgen
src/main/java/org/hibernate/jpamodelgen/model/MetaAttribute.java
Java
apache-2.0
1,047
--[[ Copyright (c) 2011-2016, Vsevolod Stakhov <vsevolod@highsecure.ru> 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. ]]-- -- Rules to detect forwarding rspamd_config.FWD_GOOGLE = { callback = function (task) if not (task:has_from(1) and task:has_recipients(1)) then return false end local envfrom = task:get_from(1) local envrcpts = task:get_recipients(1) -- Forwarding will only be to a single recipient if table.getn(envrcpts) > 1 then return false end -- Get recipient and compute VERP address local rcpt = envrcpts[1].addr:lower() local verp = rcpt:gsub('@','=') -- Get the user portion of the envfrom local ef_user = envfrom[1].user:lower() -- Check for a match if ef_user:find('+caf_=' .. verp, 1, true) then local _,_,user = ef_user:find('^(.+)+caf_=') if user then user = user .. '@' .. envfrom[1].domain return true, user end end return false end, score = 0.1, description = "Message was forwarded by Google", group = "forwarding" } rspamd_config.FWD_SRS = { callback = function (task) if not (task:has_from(1) and task:has_recipients(1)) then return false end local envfrom = task:get_from(1) local envrcpts = task:get_recipients(1) -- Forwarding is only to a single recipient if table.getn(envrcpts) > 1 then return false end -- Get recipient and compute rewritten SRS address local srs = '=' .. envrcpts[1].domain:lower() .. '=' .. envrcpts[1].user:lower() if envfrom[1].user:lower():find('^srs[01]=') and envfrom[1].user:lower():find(srs, 1, false) then return true end return false end, score = 0.1, description = "Message was forwarded using SRS", group = "forwarding" } rspamd_config.FORWARDED = { callback = function (task) if not task:has_recipients(1) then return false end local envrcpts = task:get_recipients(1) -- Forwarding will only be for single recipient messages if table.getn(envrcpts) > 1 then return false end -- Get any other headers we might need local lu = task:get_header('List-Unsubscribe') local to = task:get_recipients(2) local matches = 0 -- Retrieve and loop through all Received headers local rcvds = task:get_header_full('Received') if rcvds then for _, rcvd in ipairs(rcvds) do local _,_,addr = rcvd['decoded']:lower():find("%sfor%s<(.-)>") if addr then matches = matches + 1 -- Check that it doesn't match the envrcpt -- TODO: remove any plus addressing? if addr ~= envrcpts[1].addr:lower() then -- Check for mailing-lists as they will have the same signature if matches < 2 and lu and to and to[1].addr:lower() == addr then return false else return true, addr end end -- Prevent any other iterations as we only want -- process the first matching Received header return false end end end return false end, score = 0.1, description = "Message was forwarded", group = "forwarding" }
andrejzverev/rspamd
rules/forwarding.lua
Lua
apache-2.0
3,994
/* * Copyright 2017 Banco Bilbao Vizcaya Argentaria, S.A. * * 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 file is required by karma.conf.js and loads recursively all the .spec and framework files import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context);
BBVA/mirrorgate
mirrorgate-backoffice/src/test.ts
TypeScript
apache-2.0
1,264
package org.d2rq.db.op; import java.util.Collection; import java.util.Collections; import org.d2rq.db.schema.ColumnList; import org.d2rq.db.schema.ColumnName; import org.d2rq.db.schema.TableName; import org.d2rq.db.types.DataType; /** * An operator or operand in a relational algebra expression * over SQL-style tables. * * @author Richard Cyganiak (richard@cyganiak.de) */ public interface DatabaseOp { /** * @return Name in [[CATALOG.]SCHEMA.]TABLE notation, possibly <code>null</code> */ TableName getTableName(); /** * @param column A qualified or unqualified column name * @return <code>false</code> for ambiguous unqualified names */ boolean hasColumn(ColumnName column); /** * @return Fully qualified column names if possible, no duplicates */ ColumnList getColumns(); /** * Indicates whether a column may contain <code>NULL</code> values. * @param column A qualified or unqualified column name * @return <code>false</code> for non-existing columns or ambiguous unqualified names */ boolean isNullable(ColumnName column); /** * Indicates the datatype of a column. * @param column A qualified or unqualified column name * @return <code>null</code> for non-existing columns or ambiguous unqualified names */ DataType getColumnType(ColumnName column); /** * A unique key is a list of columns whose combined values are guaranteed * to be unique within the table. */ Collection<ColumnList> getUniqueKeys(); void accept(OpVisitor visitor); /** * A table with one row and no columns. Like Oracle's <code>DUAL</code> * table. The identity element of the relational cross product operation. * In many databases, this table can be accessed by simply omitting * the <code>FROM</code> clause in a <code>SELECT</code> statement. */ public DatabaseOp TRUE = new DatabaseOp() { public TableName getTableName() { return null; } public boolean hasColumn(ColumnName column) { return false; } public ColumnList getColumns() { return ColumnList.EMPTY; } public boolean isNullable(ColumnName column) { return false; } public DataType getColumnType(ColumnName column) { return null; } public Collection<ColumnList> getUniqueKeys() { return Collections.emptySet(); } public void accept(OpVisitor visitor) { visitor.visitOpTrue(); } public String toString() { return "[1ROW]"; } }; public abstract static class Wrapper implements DatabaseOp { private final DatabaseOp wrapped; public Wrapper(DatabaseOp wrapped) { this.wrapped = wrapped; } public DatabaseOp getWrapped() { return wrapped; } public TableName getTableName() { return wrapped.getTableName(); } public boolean hasColumn(ColumnName column) { return wrapped.hasColumn(column); } public ColumnList getColumns() { return wrapped.getColumns(); } public boolean isNullable(ColumnName column) { return wrapped.isNullable(column); } public DataType getColumnType(ColumnName column) { return wrapped.getColumnType(column); } public Collection<ColumnList> getUniqueKeys() { return wrapped.getUniqueKeys(); } } }
d2rq/r2rml-kit
src/main/java/org/d2rq/db/op/DatabaseOp.java
Java
apache-2.0
3,149
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_31) on Mon Oct 01 00:28:20 PDT 2012 --> <TITLE> Uses of Class org.apache.hadoop.mapreduce.lib.map.TokenCounterMapper (Hadoop 1.0.3.16 API) </TITLE> <META NAME="date" CONTENT="2012-10-01"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.hadoop.mapreduce.lib.map.TokenCounterMapper (Hadoop 1.0.3.16 API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/mapreduce/lib/map/TokenCounterMapper.html" title="class in org.apache.hadoop.mapreduce.lib.map"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?org/apache/hadoop/mapreduce/lib/map//class-useTokenCounterMapper.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="TokenCounterMapper.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.apache.hadoop.mapreduce.lib.map.TokenCounterMapper</B></H2> </CENTER> No usage of org.apache.hadoop.mapreduce.lib.map.TokenCounterMapper <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/mapreduce/lib/map/TokenCounterMapper.html" title="class in org.apache.hadoop.mapreduce.lib.map"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?org/apache/hadoop/mapreduce/lib/map//class-useTokenCounterMapper.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="TokenCounterMapper.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &copy; 2009 The Apache Software Foundation </BODY> </HTML>
davidl1/hortonworks-extension
docs/api/org/apache/hadoop/mapreduce/lib/map/class-use/TokenCounterMapper.html
HTML
apache-2.0
6,262
#!/usr/bin/env python # Cloudsnake Application server # Licensed under Apache License, see license.txt # Author: Markus Gronholm <markus@alshain.fi> Alshain Oy class Luokka( object ): def __init__( self, N ): self.luku = N def test( self ): return self.luku def test_001( data ): #print >> cloudSnake.output, "Moi kaikki" #print >> cloudSnake.output, cloudSnake.call( 'mean', [ [1,2,3,4] ] ) print >> cloudSnake.output, "Luokkakoe nro 1" otus = cloudSnake.call( 'Luokka', [7] ) print >> cloudSnake.output, otus.test()
Alshain-Oy/Cloudsnake-Application-Server
code_examples/class_test_01.py
Python
apache-2.0
546
package android.scanner.decode; import android.graphics.Bitmap; import com.google.zxing.LuminanceSource; public class BitmapLuminanceSource extends LuminanceSource { private byte bitmapPixels[]; protected BitmapLuminanceSource(Bitmap bitmap) { super(bitmap.getWidth(), bitmap.getHeight()); // 首先,要取得该图片的像素数组内容 int[] data = new int[bitmap.getWidth() * bitmap.getHeight()]; this.bitmapPixels = new byte[bitmap.getWidth() * bitmap.getHeight()]; bitmap.getPixels(data, 0, getWidth(), 0, 0, getWidth(), getHeight()); for (int i = 0; i < data.length; i++) { this.bitmapPixels[i] = (byte) data[i]; } } @Override public byte[] getMatrix() { // 返回我们生成好的像素数据 return bitmapPixels; } @Override public byte[] getRow(int y, byte[] row) { return row; } }
qwinner/SmartKey
SmartKeyDevice/app/src/main/java/android/scanner/decode/BitmapLuminanceSource.java
Java
apache-2.0
837
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title>PrivateMethod - ScalaTest 2.2.6 - org.scalatest.PrivateMethodTester.PrivateMethod</title> <meta name="description" content="PrivateMethod - ScalaTest 2.2.6 - org.scalatest.PrivateMethodTester.PrivateMethod" /> <meta name="keywords" content="PrivateMethod ScalaTest 2.2.6 org.scalatest.PrivateMethodTester.PrivateMethod" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link href="../../lib/template.css" media="screen" type="text/css" rel="stylesheet" /> <link href="../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" /> <script type="text/javascript" src="../../lib/jquery.js" id="jquery-js"></script> <script type="text/javascript" src="../../lib/jquery-ui.js"></script> <script type="text/javascript" src="../../lib/template.js"></script> <script type="text/javascript" src="../../lib/tools.tooltip.js"></script> <script type="text/javascript"> if(top === self) { var url = '../../index.html'; var hash = 'org.scalatest.PrivateMethodTester$PrivateMethod$'; var anchor = window.location.hash; var anchor_opt = ''; if (anchor.length >= 1) anchor_opt = '@' + anchor.substring(1); window.location.href = url + '#' + hash + anchor_opt; } </script> </head> <body class="value"> <!-- Top of doc.scalatest.org [javascript] --> <script type="text/javascript"> var rnd = window.rnd || Math.floor(Math.random()*10e6); var pid204546 = window.pid204546 || rnd; var plc204546 = window.plc204546 || 0; var abkw = window.abkw || ''; var absrc = 'http://ab167933.adbutler-ikon.com/adserve/;ID=167933;size=468x60;setID=204546;type=js;sw='+screen.width+';sh='+screen.height+';spr='+window.devicePixelRatio+';kw='+abkw+';pid='+pid204546+';place='+(plc204546++)+';rnd='+rnd+';click=CLICK_MACRO_PLACEHOLDER'; document.write('<scr'+'ipt src="'+absrc+'" type="text/javascript"></scr'+'ipt>'); </script> <div id="definition"> <a href="PrivateMethodTester$PrivateMethod.html" title="Go to companion"><img src="../../lib/object_to_class_big.png" /></a> <p id="owner"><a href="../package.html" class="extype" name="org">org</a>.<a href="package.html" class="extype" name="org.scalatest">scalatest</a>.<a href="PrivateMethodTester.html" class="extype" name="org.scalatest.PrivateMethodTester">PrivateMethodTester</a></p> <h1><a href="PrivateMethodTester$PrivateMethod.html" title="Go to companion">PrivateMethod</a></h1> </div> <h4 id="signature" class="signature"> <span class="modifier_kind"> <span class="modifier"></span> <span class="kind">object</span> </span> <span class="symbol"> <span class="name">PrivateMethod</span> </span> </h4> <div id="comment" class="fullcommenttop"><div class="comment cmt"><p>Contains a factory method for instantiating <code>PrivateMethod</code> objects. </p></div><dl class="attributes block"> <dt>Source</dt><dd><a href="https://github.com/scalatest/scalatest/tree/release-2.2.6-for-scala-2.11-and-2.10/src/main/scala/org/scalatest/PrivateMethodTester.scala" target="_blank">PrivateMethodTester.scala</a></dd></dl><div class="toggleContainer block"> <span class="toggle">Linear Supertypes</span> <div class="superTypes hiddenContent"><span class="extype" name="scala.AnyRef">AnyRef</span>, <span class="extype" name="scala.Any">Any</span></div> </div></div> <div id="mbrsel"> <div id="textfilter"><span class="pre"></span><span class="input"><input id="mbrsel-input" type="text" accesskey="/" /></span><span class="post"></span></div> <div id="order"> <span class="filtertype">Ordering</span> <ol> <li class="alpha in"><span>Alphabetic</span></li> <li class="inherit out"><span>By inheritance</span></li> </ol> </div> <div id="ancestors"> <span class="filtertype">Inherited<br /> </span> <ol id="linearization"> <li class="in" name="org.scalatest.PrivateMethodTester.PrivateMethod"><span>PrivateMethod</span></li><li class="in" name="scala.AnyRef"><span>AnyRef</span></li><li class="in" name="scala.Any"><span>Any</span></li> </ol> </div><div id="ancestors"> <span class="filtertype"></span> <ol> <li class="hideall out"><span>Hide All</span></li> <li class="showall in"><span>Show all</span></li> </ol> <a href="http://docs.scala-lang.org/overviews/scaladoc/usage.html#members" target="_blank">Learn more about member selection</a> </div> <div id="visbl"> <span class="filtertype">Visibility</span> <ol><li class="public in"><span>Public</span></li><li class="all out"><span>All</span></li></ol> </div> </div> <div id="template"> <div id="allMembers"> <div id="values" class="values members"> <h3>Value Members</h3> <ol><li name="scala.AnyRef#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="!=(x$1:AnyRef):Boolean"></a> <a id="!=(AnyRef):Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div> </li><li name="scala.Any#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="!=(x$1:Any):Boolean"></a> <a id="!=(Any):Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div> </li><li name="scala.AnyRef###" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="##():Int"></a> <a id="##():Int"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span title="gt4s: $hash$hash" class="name">##</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div> </li><li name="scala.AnyRef#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="==(x$1:AnyRef):Boolean"></a> <a id="==(AnyRef):Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div> </li><li name="scala.Any#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="==(x$1:Any):Boolean"></a> <a id="==(Any):Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div> </li><li name="org.scalatest.PrivateMethodTester.PrivateMethod#apply" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="apply[T](methodName:Symbol):PrivateMethodTester.this.PrivateMethod[T]"></a> <a id="apply[T](Symbol):PrivateMethod[T]"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier"></span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">apply</span><span class="tparams">[<span name="T">T</span>]</span><span class="params">(<span name="methodName">methodName: <span class="extype" name="scala.Symbol">Symbol</span></span>)</span><span class="result">: <a href="PrivateMethodTester$PrivateMethod.html" class="extype" name="org.scalatest.PrivateMethodTester.PrivateMethod">PrivateMethod</a>[<span class="extype" name="org.scalatest.PrivateMethodTester.PrivateMethod.apply.T">T</span>]</span> </span> </h4> <p class="shortcomment cmt">Construct a new <code>PrivateMethod</code> object with passed <code>methodName</code> symbol.</p><div class="fullcomment"><div class="comment cmt"><p>Construct a new <code>PrivateMethod</code> object with passed <code>methodName</code> symbol. The type parameter, <code>T</code>, is the return type of the private method. </p></div><dl class="paramcmts block"><dt class="param">methodName</dt><dd class="cmt"><p>a <code>Symbol</code> representing the name of the private method to invoke</p></dd></dl><dl class="attributes block"> <dt>Exceptions thrown</dt><dd><span class="cmt">NullPointerException<p>if <code>methodName</code> is <code>null</code> </p></span></dd></dl></div> </li><li name="scala.Any#asInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="asInstanceOf[T0]:T0"></a> <a id="asInstanceOf[T0]:T0"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">asInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Any.asInstanceOf.T0">T0</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div> </li><li name="scala.AnyRef#clone" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="clone():Object"></a> <a id="clone():AnyRef"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier"></span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">clone</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.AnyRef">AnyRef</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd> <span class="name">@throws</span><span class="args">()</span> </dd></dl></div> </li><li name="scala.AnyRef#eq" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="eq(x$1:AnyRef):Boolean"></a> <a id="eq(AnyRef):Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">eq</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div> </li><li name="scala.AnyRef#equals" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="equals(x$1:Any):Boolean"></a> <a id="equals(Any):Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier"></span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">equals</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div> </li><li name="scala.AnyRef#finalize" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="finalize():Unit"></a> <a id="finalize():Unit"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier"></span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">finalize</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd> <span class="name">@throws</span><span class="args">()</span> </dd></dl></div> </li><li name="scala.AnyRef#getClass" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="getClass():Class[_]"></a> <a id="getClass():Class[_]"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">getClass</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.Class">Class</span>[_]</span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div> </li><li name="scala.AnyRef#hashCode" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="hashCode():Int"></a> <a id="hashCode():Int"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier"></span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">hashCode</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div> </li><li name="scala.Any#isInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="isInstanceOf[T0]:Boolean"></a> <a id="isInstanceOf[T0]:Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">isInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div> </li><li name="scala.AnyRef#ne" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="ne(x$1:AnyRef):Boolean"></a> <a id="ne(AnyRef):Boolean"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">ne</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div> </li><li name="scala.AnyRef#notify" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="notify():Unit"></a> <a id="notify():Unit"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">notify</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div> </li><li name="scala.AnyRef#notifyAll" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="notifyAll():Unit"></a> <a id="notifyAll():Unit"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">notifyAll</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div> </li><li name="scala.AnyRef#synchronized" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="synchronized[T0](x$1:=&gt;T0):T0"></a> <a id="synchronized[T0](⇒T0):T0"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">synchronized</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="params">(<span name="arg0">arg0: ⇒ <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>)</span><span class="result">: <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div> </li><li name="scala.AnyRef#toString" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="toString():String"></a> <a id="toString():String"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier"></span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">toString</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.String">String</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div> </li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="wait():Unit"></a> <a id="wait():Unit"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">wait</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd> <span class="name">@throws</span><span class="args">()</span> </dd></dl></div> </li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="wait(x$1:Long,x$2:Int):Unit"></a> <a id="wait(Long,Int):Unit"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>, <span name="arg1">arg1: <span class="extype" name="scala.Int">Int</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd> <span class="name">@throws</span><span class="args">()</span> </dd></dl></div> </li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped"> <a id="wait(x$1:Long):Unit"></a> <a id="wait(Long):Unit"></a> <h4 class="signature"> <span class="modifier_kind"> <span class="modifier">final </span> <span class="kind">def</span> </span> <span class="symbol"> <span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span> </span> </h4> <div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd> <span class="name">@throws</span><span class="args">()</span> </dd></dl></div> </li></ol> </div> </div> <div id="inheritedMembers"> <div class="parent" name="scala.AnyRef"> <h3>Inherited from <span class="extype" name="scala.AnyRef">AnyRef</span></h3> </div><div class="parent" name="scala.Any"> <h3>Inherited from <span class="extype" name="scala.Any">Any</span></h3> </div> </div> <div id="groupedMembers"> <div class="group" name="Ungrouped"> <h3>Ungrouped</h3> </div> </div> </div> <div id="tooltip"></div> <div id="footer"> </div> </body> </html>
scalatest/scalatest-website
public/scaladoc/2.2.6/org/scalatest/PrivateMethodTester$PrivateMethod$.html
HTML
apache-2.0
23,942
// Copyright 2017 Jose Luis Rovira Martin // // 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. namespace Essence.Geometry.Core { public interface IOpVector2 : IVector2, IOpTuple2 { /// <summary> /// Evaluates the unit vector of <code>this</code> vector. /// </summary> void Unit(); void Add(IVector2 v2); void Add(IVector2 v1, IVector2 v2); void Sub(IVector2 v2); void Sub(IVector2 v1, IVector2 v2); void Sub(IPoint2 p1, IPoint2 p2); void Mul(double c); void Mul(IVector2 v1, double c); void Div(double c); void Div(IVector2 v1, double c); void SimpleMul(IVector2 v2); void SimpleMul(IVector2 v1, IVector2 v2); /// <summary> /// Evaluates the sign change of <code>this</code> vector. /// </summary> void Neg(); void Neg(IVector2 v1); /// <summary> /// Evaluates the absolute value of <code>this</code> vector. /// </summary> void Abs(); void Abs(IVector2 v1); /// <summary> /// Evaluates the interpolation of <code>this</code> and <code>v2</code> with <code>alpha</code>. /// If alpha = 0 then v1 else if alpha = 1 then v2. /// <pre><![CDATA[ (1 - alpha) * v1 + alpha * v2 = v1 + (v2 - v1) * alpha ]]></pre> /// </summary> void Lerp(IVector2 v2, double alpha); void Lerp(IVector2 v1, IVector2 v2, double alpha); /// <summary> /// Evaluates the lineal combination of <code>this</code> with <code>alpha</code> and <code>v2</code> /// with <code>beta</code>. /// <pre><![CDATA[ alpha * v1 + beta * v2 ]]></pre> /// </summary> void Lineal(IVector2 v2, double alpha, double beta); void Lineal(IVector2 v1, IVector2 v2, double alpha, double beta); /// <summary> /// Evaluates the projection vector of <code>v2</code> over <code>this</code>. /// <pre><![CDATA[ /// /// (-) (+) __ v2 /// | _/| /// | _/ | /// | _/ | /// | _/ | /// --------+----------->+------> v1 /// ]]></pre> /// </summary> void ProjV(IVector2 v2); void ProjV(IVector2 v1, IVector2 v2); } }
jlroviramartin/Essence
Essence.Geometry.Core/IOpVector2.cs
C#
apache-2.0
2,907
package org.ovirt.engine.ui.uicommonweb.models.datacenters; import java.util.Collections; import org.ovirt.engine.core.compat.*; import org.ovirt.engine.ui.uicompat.*; import org.ovirt.engine.core.common.businessentities.*; import org.ovirt.engine.core.common.vdscommands.*; import org.ovirt.engine.core.common.queries.*; import org.ovirt.engine.core.common.action.*; import org.ovirt.engine.ui.frontend.*; import org.ovirt.engine.ui.uicommonweb.*; import org.ovirt.engine.ui.uicommonweb.models.*; import org.ovirt.engine.core.common.*; import org.ovirt.engine.ui.uicommonweb.models.configure.*; import org.ovirt.engine.core.common.interfaces.*; import org.ovirt.engine.core.common.businessentities.*; import org.ovirt.engine.core.common.queries.*; import org.ovirt.engine.ui.uicompat.*; import org.ovirt.engine.ui.uicommonweb.*; import org.ovirt.engine.ui.uicommonweb.models.*; @SuppressWarnings("unused") public class DataCenterListModel extends ListWithDetailsModel implements ISupportSystemTreeContext { private UICommand privateNewCommand; public UICommand getNewCommand() { return privateNewCommand; } private void setNewCommand(UICommand value) { privateNewCommand = value; } private UICommand privateEditCommand; public UICommand getEditCommand() { return privateEditCommand; } private void setEditCommand(UICommand value) { privateEditCommand = value; } private UICommand privateRemoveCommand; public UICommand getRemoveCommand() { return privateRemoveCommand; } private void setRemoveCommand(UICommand value) { privateRemoveCommand = value; } private UICommand privateForceRemoveCommand; public UICommand getForceRemoveCommand() { return privateForceRemoveCommand; } private void setForceRemoveCommand(UICommand value) { privateForceRemoveCommand = value; } private UICommand privateActivateCommand; public UICommand getActivateCommand() { return privateActivateCommand; } private void setActivateCommand(UICommand value) { privateActivateCommand = value; } private UICommand privateGuideCommand; public UICommand getGuideCommand() { return privateGuideCommand; } private void setGuideCommand(UICommand value) { privateGuideCommand = value; } private UICommand privateRecoveryStorageCommand; public UICommand getRecoveryStorageCommand() { return privateRecoveryStorageCommand; } private void setRecoveryStorageCommand(UICommand value) { privateRecoveryStorageCommand = value; } //get { return SelectedItems == null ? new object[0] : SelectedItems.Cast<storage_pool>().Select(a => a.id).Cast<object>().ToArray(); } protected Object[] getSelectedKeys() { if (getSelectedItems() == null) { return new Object[0]; } else { java.util.ArrayList<Object> objL = new java.util.ArrayList<Object>(); for (storage_pool a : Linq.<storage_pool>Cast(getSelectedItems())) { objL.add(a.getId()); } return objL.toArray(new Object[]{}); } } private Object privateGuideContext; public Object getGuideContext() { return privateGuideContext; } public void setGuideContext(Object value) { privateGuideContext = value; } public DataCenterListModel() { setTitle("Data Centers"); setDefaultSearchString("DataCenter:"); setSearchString(getDefaultSearchString()); setNewCommand(new UICommand("New", this)); setEditCommand(new UICommand("Edit", this)); setRemoveCommand(new UICommand("Remove", this)); UICommand tempVar = new UICommand("ForceRemove", this); tempVar.setIsExecutionAllowed(true); setForceRemoveCommand(tempVar); setRecoveryStorageCommand(new UICommand("RecoveryStorage", this)); setActivateCommand(new UICommand("Activate", this)); setGuideCommand(new UICommand("Guide", this)); UpdateActionAvailability(); getSearchNextPageCommand().setIsAvailable(true); getSearchPreviousPageCommand().setIsAvailable(true); } public void Guide() { DataCenterGuideModel model = new DataCenterGuideModel(); setWindow(model); model.setTitle("New Data Center - Guide Me"); model.setHashName("new_data_center_-_guide_me"); model.setEntity(getGuideContext() != null ? DataProvider.GetDataCenterById(getGuideContext() instanceof Guid ? (Guid)getGuideContext() : (Guid)getGuideContext()) : null); UICommand tempVar = new UICommand("Cancel", this); tempVar.setTitle("Configure Later"); tempVar.setIsDefault(true); tempVar.setIsCancel(true); model.getCommands().add(tempVar); } @Override protected void InitDetailModels() { super.InitDetailModels(); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); list.add(new DataCenterStorageListModel()); list.add(new DataCenterNetworkListModel()); list.add(new DataCenterClusterListModel()); list.add(new PermissionListModel()); list.add(new DataCenterEventListModel()); setDetailModels(list); } @Override public boolean IsSearchStringMatch(String searchString) { return searchString.trim().toLowerCase().startsWith("datacenter"); } @Override protected void SyncSearch() { SearchParameters tempVar = new SearchParameters(getSearchString(), SearchType.StoragePool); tempVar.setMaxCount(getSearchPageSize()); super.SyncSearch(VdcQueryType.Search, tempVar); } @Override protected void AsyncSearch() { super.AsyncSearch(); setAsyncResult(Frontend.RegisterSearch(getSearchString(), SearchType.StoragePool, getSearchPageSize())); setItems(getAsyncResult().getData()); } public void New() { if (getWindow() != null) { return; } DataCenterModel model = new DataCenterModel(); setWindow(model); model.setTitle("New Data Center"); model.setHashName("new_data_center"); model.setIsNew(true); model.getStorageTypeList().setSelectedItem(StorageType.NFS); UICommand tempVar = new UICommand("OnSave", this); tempVar.setTitle("OK"); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle("Cancel"); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); } public void Edit() { storage_pool dataCenter = (storage_pool)getSelectedItem(); if (getWindow() != null) { return; } DataCenterModel model = new DataCenterModel(); setWindow(model); model.setEntity(dataCenter); model.setDataCenterId(dataCenter.getId()); model.setTitle("Edit Data Center"); model.setHashName("edit_data_center"); model.getName().setEntity(dataCenter.getname()); if (getSystemTreeSelectedItem() != null && getSystemTreeSelectedItem().getType() == SystemTreeItemType.DataCenter) { model.getName().setIsChangable(false); model.getName().setInfo("Cannot edit Data Center's Name in tree context"); } model.getDescription().setEntity(dataCenter.getdescription()); model.setOriginalName(dataCenter.getname()); if (DataProvider.GetStorageDomainList(dataCenter.getId()).size() != 0) { model.getStorageTypeList().setIsChangable(false); model.getStorageTypeList().getChangeProhibitionReasons().add("Cannot change Repository type with Storage Domains attached to it"); } model.getStorageTypeList().setSelectedItem(dataCenter.getstorage_pool_type()); //Version //foreach (object a in model.Version.Items) //{ // Version item = (Version)a; // if (item == dataCenter.compatibility_version) // { // model.Version.SelectedItem = item; // break; // } //} UICommand tempVar = new UICommand("OnSave", this); tempVar.setTitle("OK"); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle("Cancel"); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); } public void remove() { if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle("Remove Data Center(s)"); model.setHashName("remove_data_center"); model.setMessage("Data Center(s)"); java.util.ArrayList<String> list = new java.util.ArrayList<String>(); for (storage_pool a : Linq.<storage_pool>Cast(getSelectedItems())) { list.add(a.getname()); } model.setItems(list); UICommand tempVar = new UICommand("OnRemove", this); tempVar.setTitle("OK"); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle("Cancel"); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); } public void ForceRemove() { ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle("Force Remove Data Center"); model.setHashName("force_remove_data_center"); model.setMessage("Data Center(s)"); model.getLatch().setIsAvailable(true); model.getLatch().setIsChangable(true); java.util.ArrayList<String> list = new java.util.ArrayList<String>(); for (storage_pool a : Linq.<storage_pool>Cast(getSelectedItems())) { list.add(a.getname()); } model.setItems(list); UICommand tempVar = new UICommand("OnForceRemove", this); tempVar.setTitle("OK"); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle("Cancel"); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); } public void RecoveryStorage() { ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle("Data Center Re-Initialize"); model.setHashName("data_center_re-initialize"); model.getLatch().setIsAvailable(true); model.getLatch().setIsChangable(true); //IEnumerable<storage_domains> list = DataProvider.GetStorageDomainList(); //List<EntityModel> models = list // .Where(a => (a.storage_domain_type == StorageDomainType.Data && a.storage_type == ((storage_pool)SelectedItem).storage_pool_type) && // (a.storage_domain_shared_status == StorageDomainSharedStatus.Unattached) // ) // .Select(a => new EntityModel() { Entity = a }) // .ToList(); java.util.ArrayList<EntityModel> models = new java.util.ArrayList<EntityModel>(); for (storage_domains a : DataProvider.GetStorageDomainList()) { if (a.getstorage_domain_type() == StorageDomainType.Data && a.getstorage_type() == ((storage_pool)getSelectedItem()).getstorage_pool_type() && (a.getstorage_domain_shared_status() == StorageDomainSharedStatus.Unattached)) { EntityModel tempVar = new EntityModel(); tempVar.setEntity(a); models.add(tempVar); } } model.setItems(models); if (models.size() > 0) { EntityModel entityModel = models.size() != 0 ? models.get(0) : null; if (entityModel != null) { entityModel.setIsSelected(true); } } if (models.isEmpty()) { model.setMessage("There are no compatible Storage Domains to attach to this Data Center. Please add new Storage from the Storage tab."); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle("Close"); tempVar2.setIsDefault(true); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); } else { UICommand tempVar3 = new UICommand("OnRecover", this); tempVar3.setTitle("OK"); tempVar3.setIsDefault(true); model.getCommands().add(tempVar3); UICommand tempVar4 = new UICommand("Cancel", this); tempVar4.setTitle("Cancel"); tempVar4.setIsCancel(true); model.getCommands().add(tempVar4); } } public void OnRecover() { ConfirmationModel model = (ConfirmationModel)getWindow(); if (!model.Validate()) { return; } //storage_domains master = DataProvider.GetStorageDomainList(((storage_pool)SelectedItem).id).FirstOrDefault(a=>a.storage_domain_type == StorageDomainType.Master); storage_domains master = null; for (storage_domains a : DataProvider.GetStorageDomainList(((storage_pool)getSelectedItem()).getId())) { if (a.getstorage_domain_type() == StorageDomainType.Master) { master = a; break; } } java.util.ArrayList<storage_domains> items = new java.util.ArrayList<storage_domains>(); for (EntityModel a : Linq.<EntityModel>Cast(model.getItems())) { if (a.getIsSelected()) { items.add((storage_domains)a.getEntity()); } } if (items.size() > 0) { if (model.getProgress() != null) { return; } java.util.ArrayList<VdcActionParametersBase> parameters = new java.util.ArrayList<VdcActionParametersBase>(); for (storage_domains a : items) { parameters.add(new RecoveryStoragePoolParameters(((storage_pool)getSelectedItem()).getId(), a.getid())); } model.StartProgress(null); Frontend.RunMultipleAction(VdcActionType.RecoveryStoragePool, parameters, new IFrontendMultipleActionAsyncCallback() { @Override public void Executed(FrontendMultipleActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel)result.getState(); localModel.StopProgress(); Cancel(); } }, model); } else { Cancel(); } } public void Activate() { //Frontend.RunMultipleActions(VdcActionType.ActivateStoragePool, // SelectedItems.Cast<storage_pool>() // .Select(a => (VdcActionParametersBase)new StoragePoolParametersBase(a.id)) // .ToList() //); } public void OnRemove() { ConfirmationModel model = (ConfirmationModel)getWindow(); if (model.getProgress() != null) { return; } java.util.ArrayList<VdcActionParametersBase> parameters = new java.util.ArrayList<VdcActionParametersBase>(); for (storage_pool a : Linq.<storage_pool>Cast(getSelectedItems())) { parameters.add(new StoragePoolParametersBase(a.getId())); } model.StartProgress(null); Frontend.RunMultipleAction(VdcActionType.RemoveStoragePool, parameters, new IFrontendMultipleActionAsyncCallback() { @Override public void Executed(FrontendMultipleActionAsyncResult result) { ConfirmationModel localModel = (ConfirmationModel)result.getState(); localModel.StopProgress(); Cancel(); } }, model); } public void OnForceRemove() { ConfirmationModel model = (ConfirmationModel) getWindow(); if(!model.Validate()) { return; } VdcActionParametersBase parametersBase = new VdcActionParametersBase(); StoragePoolParametersBase tempVar = new StoragePoolParametersBase(((storage_pool)getSelectedItem()).getId()); tempVar.setForceDelete(true); parametersBase = tempVar; Frontend.RunAction(VdcActionType.RemoveStoragePool, parametersBase); Cancel(); } public void Cancel() { CancelConfirmation(); setGuideContext(null); setWindow(null); UpdateActionAvailability(); } public void CancelConfirmation() { setConfirmWindow(null); } public void OnSave() { DataCenterModel model = (DataCenterModel)getWindow(); if (!model.Validate()) { return; } if (!model.getIsNew() && !((Version)model.getVersion().getSelectedItem()).equals(((storage_pool)getSelectedItem()).getcompatibility_version())) { ConfirmationModel confirmModel = new ConfirmationModel(); setConfirmWindow(confirmModel); confirmModel.setTitle("Change Data Center Compatibility Version"); confirmModel.setHashName("change_data_center_compatibility_version"); confirmModel.setMessage("You are about to change the Data Center Compatibility Version. Are you sure you want to continue?"); UICommand tempVar = new UICommand("OnSaveInternal", this); tempVar.setTitle("OK"); tempVar.setIsDefault(true); confirmModel.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("CancelConfirmation", this); tempVar2.setTitle("Cancel"); tempVar2.setIsCancel(true); confirmModel.getCommands().add(tempVar2); } else { OnSaveInternal(); } } public void OnSaveInternal() { DataCenterModel model = (DataCenterModel)getWindow(); if (model.getProgress() != null) { return; } storage_pool dataCenter = model.getIsNew() ? new storage_pool() : (storage_pool)Cloner.clone(getSelectedItem()); //cancel confirm window if there is CancelConfirmation(); //Save changes. dataCenter.setname((String)model.getName().getEntity()); dataCenter.setdescription((String)model.getDescription().getEntity()); dataCenter.setstorage_pool_type((StorageType)model.getStorageTypeList().getSelectedItem()); dataCenter.setcompatibility_version((Version)model.getVersion().getSelectedItem()); model.StartProgress(null); Frontend.RunAction(model.getIsNew() ? VdcActionType.AddEmptyStoragePool : VdcActionType.UpdateStoragePool, new StoragePoolManagementParameter(dataCenter), new IFrontendActionAsyncCallback() { @Override public void Executed(FrontendActionAsyncResult result) { DataCenterListModel localModel = (DataCenterListModel)result.getState(); localModel.PostOnSaveInternal(result.getReturnValue()); } }, this); } public void PostOnSaveInternal(VdcReturnValueBase returnValue) { DataCenterModel model = (DataCenterModel)getWindow(); model.StopProgress(); if (returnValue != null && returnValue.getSucceeded()) { Cancel(); if (model.getIsNew()) { setGuideContext(returnValue.getActionReturnValue()); UpdateActionAvailability(); getGuideCommand().Execute(); } } } @Override protected void OnSelectedItemChanged() { super.OnSelectedItemChanged(); UpdateActionAvailability(); } @Override protected void SelectedItemsChanged() { super.SelectedItemsChanged(); UpdateActionAvailability(); } @Override protected void ItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) { super.ItemsCollectionChanged(sender, e); //Try to select an item corresponding to the system tree selection. if (getSystemTreeSelectedItem() != null && getSystemTreeSelectedItem().getType() == SystemTreeItemType.DataCenter) { storage_pool dataCenter = (storage_pool)getSystemTreeSelectedItem().getEntity(); setSelectedItem(Linq.FirstOrDefault(Linq.<storage_pool>Cast(getItems()), new Linq.DataCenterPredicate(dataCenter.getId()))); } } @Override protected void SelectedItemPropertyChanged(Object sender, PropertyChangedEventArgs e) { super.SelectedItemPropertyChanged(sender, e); if (e.PropertyName.equals("status")) { UpdateActionAvailability(); } } private void UpdateActionAvailability() { java.util.ArrayList<storage_pool> items = getSelectedItems() != null ? new java.util.ArrayList<storage_pool>(Linq.<storage_pool>Cast(getSelectedItems())) : new java.util.ArrayList<storage_pool>(); boolean isAllDown = true; for (storage_pool item : items) { if (item.getstatus() == StoragePoolStatus.Up || item.getstatus() == StoragePoolStatus.Contend) { isAllDown = false; break; } } getEditCommand().setIsExecutionAllowed(getSelectedItem() != null && items.size() == 1); getRemoveCommand().setIsExecutionAllowed(items.size() > 0 && isAllDown); storage_pool storagePoolItem = (getSelectedItem() != null ? (storage_pool)getSelectedItem() : null); getForceRemoveCommand().setIsExecutionAllowed(storagePoolItem != null && items.size() == 1 && storagePoolItem.getstatus() != StoragePoolStatus.Up && storagePoolItem.getstatus() != StoragePoolStatus.Contend && storagePoolItem.getstatus() != StoragePoolStatus.Uninitialized); getGuideCommand().setIsExecutionAllowed(getGuideContext() != null || (getSelectedItem() != null && getSelectedItems() != null && getSelectedItems().size() == 1)); getActivateCommand().setIsExecutionAllowed(items.size() > 0); if (getActivateCommand().getIsExecutionAllowed()) { for (storage_pool a : items) { if (a.getstatus() == StoragePoolStatus.Up || a.getstatus() == StoragePoolStatus.Uninitialized) { getActivateCommand().setIsExecutionAllowed(false); break; } } } getRecoveryStorageCommand().setIsExecutionAllowed(items != null && items.size() == 1); //System tree dependent actions. boolean isAvailable = !(getSystemTreeSelectedItem() != null && getSystemTreeSelectedItem().getType() == SystemTreeItemType.DataCenter); getNewCommand().setIsAvailable(isAvailable); getRemoveCommand().setIsAvailable(isAvailable); } @Override public void ExecuteCommand(UICommand command) { super.ExecuteCommand(command); if (command == getNewCommand()) { New(); } else if (command == getEditCommand()) { Edit(); } else if (command == getRemoveCommand()) { remove(); } else if (command == getForceRemoveCommand()) { ForceRemove(); } else if (command == getActivateCommand()) { Activate(); } else if (command == getGuideCommand()) { Guide(); } else if (command == getRecoveryStorageCommand()) { RecoveryStorage(); } else if (StringHelper.stringsEqual(command.getName(), "OnSave")) { OnSave(); } else if (StringHelper.stringsEqual(command.getName(), "Cancel")) { Cancel(); } else if (StringHelper.stringsEqual(command.getName(), "OnRemove")) { OnRemove(); } else if (StringHelper.stringsEqual(command.getName(), "OnForceRemove")) { OnForceRemove(); } else if (StringHelper.stringsEqual(command.getName(), "OnSaveInternal")) { OnSaveInternal(); } else if (StringHelper.stringsEqual(command.getName(), "CancelConfirmation")) { CancelConfirmation(); } else if (StringHelper.stringsEqual(command.getName(), "OnRecover")) { OnRecover(); } } private SystemTreeItemModel systemTreeSelectedItem; public SystemTreeItemModel getSystemTreeSelectedItem() { return systemTreeSelectedItem; } public void setSystemTreeSelectedItem(SystemTreeItemModel value) { if (systemTreeSelectedItem != value) { systemTreeSelectedItem = value; OnSystemTreeSelectedItemChanged(); } } private void OnSystemTreeSelectedItemChanged() { UpdateActionAvailability(); } @Override protected String getListName() { return "DataCenterListModel"; } }
anjalshireesh/gluster-ovirt-poc
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterListModel.java
Java
apache-2.0
21,885
/* * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.pinpoint; import javax.annotation.Generated; import com.amazonaws.ClientConfigurationFactory; import com.amazonaws.annotation.NotThreadSafe; import com.amazonaws.client.builder.AwsSyncClientBuilder; import com.amazonaws.client.AwsSyncClientParams; /** * Fluent builder for {@link com.amazonaws.services.pinpoint.AmazonPinpoint}. Use of the builder is preferred over using * constructors of the client class. **/ @NotThreadSafe @Generated("com.amazonaws:aws-java-sdk-code-generator") public final class AmazonPinpointClientBuilder extends AwsSyncClientBuilder<AmazonPinpointClientBuilder, AmazonPinpoint> { private static final ClientConfigurationFactory CLIENT_CONFIG_FACTORY = new ClientConfigurationFactory(); /** * @return Create new instance of builder with all defaults set. */ public static AmazonPinpointClientBuilder standard() { return new AmazonPinpointClientBuilder(); } /** * @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and * {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain */ public static AmazonPinpoint defaultClient() { return standard().build(); } private AmazonPinpointClientBuilder() { super(CLIENT_CONFIG_FACTORY); } /** * Construct a synchronous implementation of AmazonPinpoint using the current builder configuration. * * @param params * Current builder configuration represented as a parameter object. * @return Fully configured implementation of AmazonPinpoint. */ @Override protected AmazonPinpoint build(AwsSyncClientParams params) { return new AmazonPinpointClient(params); } }
dagnir/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/AmazonPinpointClientBuilder.java
Java
apache-2.0
2,353
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Automatic config nagios configurations. Copyright (C) 2015 Canux CHENG All rights reserved Name: __init__.py Author: Canux canuxcheng@gmail.com Version: V1.0 Time: Wed 09 Sep 2015 09:20:51 PM EDT Exaple: ./nagios -h """ __version__ = "3.1.0.0" __description__ = """Config nagios automatic. Any question contact the author Canux CHENG. Email: canuxcheng@gmail.com.""" __author__ = "Canux CHENG"
crazy-canux/xnagios
nagios/__init__.py
Python
apache-2.0
451
package de.mycrobase.ssim.ed.helper; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import com.jme3.app.SimpleApplication; import com.jme3.app.state.AppState; import de.mycrobase.ssim.ed.GameMode; import de.mycrobase.ssim.ed.GameModeListener; import de.mycrobase.ssim.ed.Main; import de.mycrobase.ssim.ed.SSimApplication; import de.mycrobase.ssim.ed.mission.Mission; import de.mycrobase.ssim.ed.settings.LayeredSettingsManager; import de.mycrobase.ssim.ed.settings.PropertiesLayer; import de.mycrobase.ssim.ed.settings.SettingsManager; public abstract class SteppedSSimApplication extends SimpleApplication implements SSimApplication { private Thread caller; private LayeredSettingsManager settingsManager; private ScheduledExecutorService executor; protected GameMode currentMode = GameMode.Running; protected List<GameModeListener> gameModeListeners = new ArrayList<GameModeListener>(); public SteppedSSimApplication() { super(new AppState[0]); caller = Thread.currentThread(); settingsManager = new LayeredSettingsManager(); settingsManager.addLayer(PropertiesLayer.fromStream(Main.class.getResourceAsStream("default.properties"))); } @Override public void simpleInitApp() { executor = Executors.newScheduledThreadPool(2); } @Override public void simpleUpdate(float tpf) { super.simpleUpdate(tpf); pause(); } @Override public void destroy() { super.destroy(); // shutdown all (non daemon) worker pool threads executor.shutdown(); } @Override public ScheduledExecutorService getExecutor() { return executor; } @Override public SettingsManager getSettingsManager() { return settingsManager; } @Override public float getSpeed() { return speed; } @Override public void setSpeed(float speed) { throw new UnsupportedOperationException(); } @Override public GameMode getCurrentMode() { return currentMode; } @Override public void addGameModeListener(GameModeListener lis) { if(!gameModeListeners.contains(lis)) { gameModeListeners.add(lis); } } @Override public void removeGameModeListener(GameModeListener lis) { if(gameModeListeners.contains(lis)) { gameModeListeners.remove(lis); } } @Override public void doGameInit(Mission mission) { throw new UnsupportedOperationException(); } @Override public void doGameInitDone() { throw new UnsupportedOperationException(); } @Override public void doGamePause() { throw new UnsupportedOperationException(); } @Override public void doGameResume() { throw new UnsupportedOperationException(); } @Override public void doGameExit() { throw new UnsupportedOperationException(); } /** * Gets called from controller/JUnit thread! */ public void waitFor() { speed = 1; try { while(true) { Thread.sleep(1000); } } catch(InterruptedException ex) { // OK let's continue } } private void pause() { speed = 0; // and notify the boss caller.interrupt(); } }
cmur2/ssim-ed
test/de/mycrobase/ssim/ed/helper/SteppedSSimApplication.java
Java
apache-2.0
3,552
// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.25.0 // protoc v3.14.0 // source: envoy/config/common/matcher/v4alpha/matcher.proto package envoy_config_common_matcher_v4alpha import ( _ "github.com/cncf/xds/go/udpa/annotations" v4alpha1 "github.com/envoyproxy/go-control-plane/envoy/config/core/v4alpha" v4alpha "github.com/envoyproxy/go-control-plane/envoy/config/route/v4alpha" v4alpha2 "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v4alpha" _ "github.com/envoyproxy/protoc-gen-validate/validate" proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" ) const ( // Verify that this generated code is sufficiently up-to-date. _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) // Verify that runtime/protoimpl is sufficiently up-to-date. _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) // This is a compile-time assertion that a sufficiently up-to-date version // of the legacy proto package is being used. const _ = proto.ProtoPackageIsVersion4 // A matcher, which may traverse a matching tree in order to result in a match action. // During matching, the tree will be traversed until a match is found, or if no match // is found the action specified by the most specific on_no_match will be evaluated. // As an on_no_match might result in another matching tree being evaluated, this process // might repeat several times until the final OnMatch (or no match) is decided. // // This API is a work in progress. type Matcher struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to MatcherType: // *Matcher_MatcherList_ // *Matcher_MatcherTree_ MatcherType isMatcher_MatcherType `protobuf_oneof:"matcher_type"` // Optional OnMatch to use if the matcher failed. // If specified, the OnMatch is used, and the matcher is considered // to have matched. // If not specified, the matcher is considered not to have matched. OnNoMatch *Matcher_OnMatch `protobuf:"bytes,3,opt,name=on_no_match,json=onNoMatch,proto3" json:"on_no_match,omitempty"` } func (x *Matcher) Reset() { *x = Matcher{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher) ProtoMessage() {} func (x *Matcher) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher.ProtoReflect.Descriptor instead. func (*Matcher) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0} } func (m *Matcher) GetMatcherType() isMatcher_MatcherType { if m != nil { return m.MatcherType } return nil } func (x *Matcher) GetMatcherList() *Matcher_MatcherList { if x, ok := x.GetMatcherType().(*Matcher_MatcherList_); ok { return x.MatcherList } return nil } func (x *Matcher) GetMatcherTree() *Matcher_MatcherTree { if x, ok := x.GetMatcherType().(*Matcher_MatcherTree_); ok { return x.MatcherTree } return nil } func (x *Matcher) GetOnNoMatch() *Matcher_OnMatch { if x != nil { return x.OnNoMatch } return nil } type isMatcher_MatcherType interface { isMatcher_MatcherType() } type Matcher_MatcherList_ struct { // A linear list of matchers to evaluate. MatcherList *Matcher_MatcherList `protobuf:"bytes,1,opt,name=matcher_list,json=matcherList,proto3,oneof"` } type Matcher_MatcherTree_ struct { // A match tree to evaluate. MatcherTree *Matcher_MatcherTree `protobuf:"bytes,2,opt,name=matcher_tree,json=matcherTree,proto3,oneof"` } func (*Matcher_MatcherList_) isMatcher_MatcherType() {} func (*Matcher_MatcherTree_) isMatcher_MatcherType() {} // Match configuration. This is a recursive structure which allows complex nested match // configurations to be built using various logical operators. // [#next-free-field: 11] type MatchPredicate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Rule: // *MatchPredicate_OrMatch // *MatchPredicate_AndMatch // *MatchPredicate_NotMatch // *MatchPredicate_AnyMatch // *MatchPredicate_HttpRequestHeadersMatch // *MatchPredicate_HttpRequestTrailersMatch // *MatchPredicate_HttpResponseHeadersMatch // *MatchPredicate_HttpResponseTrailersMatch // *MatchPredicate_HttpRequestGenericBodyMatch // *MatchPredicate_HttpResponseGenericBodyMatch Rule isMatchPredicate_Rule `protobuf_oneof:"rule"` } func (x *MatchPredicate) Reset() { *x = MatchPredicate{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MatchPredicate) String() string { return protoimpl.X.MessageStringOf(x) } func (*MatchPredicate) ProtoMessage() {} func (x *MatchPredicate) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use MatchPredicate.ProtoReflect.Descriptor instead. func (*MatchPredicate) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{1} } func (m *MatchPredicate) GetRule() isMatchPredicate_Rule { if m != nil { return m.Rule } return nil } func (x *MatchPredicate) GetOrMatch() *MatchPredicate_MatchSet { if x, ok := x.GetRule().(*MatchPredicate_OrMatch); ok { return x.OrMatch } return nil } func (x *MatchPredicate) GetAndMatch() *MatchPredicate_MatchSet { if x, ok := x.GetRule().(*MatchPredicate_AndMatch); ok { return x.AndMatch } return nil } func (x *MatchPredicate) GetNotMatch() *MatchPredicate { if x, ok := x.GetRule().(*MatchPredicate_NotMatch); ok { return x.NotMatch } return nil } func (x *MatchPredicate) GetAnyMatch() bool { if x, ok := x.GetRule().(*MatchPredicate_AnyMatch); ok { return x.AnyMatch } return false } func (x *MatchPredicate) GetHttpRequestHeadersMatch() *HttpHeadersMatch { if x, ok := x.GetRule().(*MatchPredicate_HttpRequestHeadersMatch); ok { return x.HttpRequestHeadersMatch } return nil } func (x *MatchPredicate) GetHttpRequestTrailersMatch() *HttpHeadersMatch { if x, ok := x.GetRule().(*MatchPredicate_HttpRequestTrailersMatch); ok { return x.HttpRequestTrailersMatch } return nil } func (x *MatchPredicate) GetHttpResponseHeadersMatch() *HttpHeadersMatch { if x, ok := x.GetRule().(*MatchPredicate_HttpResponseHeadersMatch); ok { return x.HttpResponseHeadersMatch } return nil } func (x *MatchPredicate) GetHttpResponseTrailersMatch() *HttpHeadersMatch { if x, ok := x.GetRule().(*MatchPredicate_HttpResponseTrailersMatch); ok { return x.HttpResponseTrailersMatch } return nil } func (x *MatchPredicate) GetHttpRequestGenericBodyMatch() *HttpGenericBodyMatch { if x, ok := x.GetRule().(*MatchPredicate_HttpRequestGenericBodyMatch); ok { return x.HttpRequestGenericBodyMatch } return nil } func (x *MatchPredicate) GetHttpResponseGenericBodyMatch() *HttpGenericBodyMatch { if x, ok := x.GetRule().(*MatchPredicate_HttpResponseGenericBodyMatch); ok { return x.HttpResponseGenericBodyMatch } return nil } type isMatchPredicate_Rule interface { isMatchPredicate_Rule() } type MatchPredicate_OrMatch struct { // A set that describes a logical OR. If any member of the set matches, the match configuration // matches. OrMatch *MatchPredicate_MatchSet `protobuf:"bytes,1,opt,name=or_match,json=orMatch,proto3,oneof"` } type MatchPredicate_AndMatch struct { // A set that describes a logical AND. If all members of the set match, the match configuration // matches. AndMatch *MatchPredicate_MatchSet `protobuf:"bytes,2,opt,name=and_match,json=andMatch,proto3,oneof"` } type MatchPredicate_NotMatch struct { // A negation match. The match configuration will match if the negated match condition matches. NotMatch *MatchPredicate `protobuf:"bytes,3,opt,name=not_match,json=notMatch,proto3,oneof"` } type MatchPredicate_AnyMatch struct { // The match configuration will always match. AnyMatch bool `protobuf:"varint,4,opt,name=any_match,json=anyMatch,proto3,oneof"` } type MatchPredicate_HttpRequestHeadersMatch struct { // HTTP request headers match configuration. HttpRequestHeadersMatch *HttpHeadersMatch `protobuf:"bytes,5,opt,name=http_request_headers_match,json=httpRequestHeadersMatch,proto3,oneof"` } type MatchPredicate_HttpRequestTrailersMatch struct { // HTTP request trailers match configuration. HttpRequestTrailersMatch *HttpHeadersMatch `protobuf:"bytes,6,opt,name=http_request_trailers_match,json=httpRequestTrailersMatch,proto3,oneof"` } type MatchPredicate_HttpResponseHeadersMatch struct { // HTTP response headers match configuration. HttpResponseHeadersMatch *HttpHeadersMatch `protobuf:"bytes,7,opt,name=http_response_headers_match,json=httpResponseHeadersMatch,proto3,oneof"` } type MatchPredicate_HttpResponseTrailersMatch struct { // HTTP response trailers match configuration. HttpResponseTrailersMatch *HttpHeadersMatch `protobuf:"bytes,8,opt,name=http_response_trailers_match,json=httpResponseTrailersMatch,proto3,oneof"` } type MatchPredicate_HttpRequestGenericBodyMatch struct { // HTTP request generic body match configuration. HttpRequestGenericBodyMatch *HttpGenericBodyMatch `protobuf:"bytes,9,opt,name=http_request_generic_body_match,json=httpRequestGenericBodyMatch,proto3,oneof"` } type MatchPredicate_HttpResponseGenericBodyMatch struct { // HTTP response generic body match configuration. HttpResponseGenericBodyMatch *HttpGenericBodyMatch `protobuf:"bytes,10,opt,name=http_response_generic_body_match,json=httpResponseGenericBodyMatch,proto3,oneof"` } func (*MatchPredicate_OrMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_AndMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_NotMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_AnyMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_HttpRequestHeadersMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_HttpRequestTrailersMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_HttpResponseHeadersMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_HttpResponseTrailersMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_HttpRequestGenericBodyMatch) isMatchPredicate_Rule() {} func (*MatchPredicate_HttpResponseGenericBodyMatch) isMatchPredicate_Rule() {} // HTTP headers match configuration. type HttpHeadersMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // HTTP headers to match. Headers []*v4alpha.HeaderMatcher `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` } func (x *HttpHeadersMatch) Reset() { *x = HttpHeadersMatch{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HttpHeadersMatch) String() string { return protoimpl.X.MessageStringOf(x) } func (*HttpHeadersMatch) ProtoMessage() {} func (x *HttpHeadersMatch) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use HttpHeadersMatch.ProtoReflect.Descriptor instead. func (*HttpHeadersMatch) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{2} } func (x *HttpHeadersMatch) GetHeaders() []*v4alpha.HeaderMatcher { if x != nil { return x.Headers } return nil } // HTTP generic body match configuration. // List of text strings and hex strings to be located in HTTP body. // All specified strings must be found in the HTTP body for positive match. // The search may be limited to specified number of bytes from the body start. // // .. attention:: // // Searching for patterns in HTTP body is potentially cpu intensive. For each specified pattern, http body is scanned byte by byte to find a match. // If multiple patterns are specified, the process is repeated for each pattern. If location of a pattern is known, ``bytes_limit`` should be specified // to scan only part of the http body. type HttpGenericBodyMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Limits search to specified number of bytes - default zero (no limit - match entire captured buffer). BytesLimit uint32 `protobuf:"varint,1,opt,name=bytes_limit,json=bytesLimit,proto3" json:"bytes_limit,omitempty"` // List of patterns to match. Patterns []*HttpGenericBodyMatch_GenericTextMatch `protobuf:"bytes,2,rep,name=patterns,proto3" json:"patterns,omitempty"` } func (x *HttpGenericBodyMatch) Reset() { *x = HttpGenericBodyMatch{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HttpGenericBodyMatch) String() string { return protoimpl.X.MessageStringOf(x) } func (*HttpGenericBodyMatch) ProtoMessage() {} func (x *HttpGenericBodyMatch) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use HttpGenericBodyMatch.ProtoReflect.Descriptor instead. func (*HttpGenericBodyMatch) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{3} } func (x *HttpGenericBodyMatch) GetBytesLimit() uint32 { if x != nil { return x.BytesLimit } return 0 } func (x *HttpGenericBodyMatch) GetPatterns() []*HttpGenericBodyMatch_GenericTextMatch { if x != nil { return x.Patterns } return nil } // What to do if a match is successful. type Matcher_OnMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to OnMatch: // *Matcher_OnMatch_Matcher // *Matcher_OnMatch_Action OnMatch isMatcher_OnMatch_OnMatch `protobuf_oneof:"on_match"` } func (x *Matcher_OnMatch) Reset() { *x = Matcher_OnMatch{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_OnMatch) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_OnMatch) ProtoMessage() {} func (x *Matcher_OnMatch) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_OnMatch.ProtoReflect.Descriptor instead. func (*Matcher_OnMatch) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 0} } func (m *Matcher_OnMatch) GetOnMatch() isMatcher_OnMatch_OnMatch { if m != nil { return m.OnMatch } return nil } func (x *Matcher_OnMatch) GetMatcher() *Matcher { if x, ok := x.GetOnMatch().(*Matcher_OnMatch_Matcher); ok { return x.Matcher } return nil } func (x *Matcher_OnMatch) GetAction() *v4alpha1.TypedExtensionConfig { if x, ok := x.GetOnMatch().(*Matcher_OnMatch_Action); ok { return x.Action } return nil } type isMatcher_OnMatch_OnMatch interface { isMatcher_OnMatch_OnMatch() } type Matcher_OnMatch_Matcher struct { // Nested matcher to evaluate. // If the nested matcher does not match and does not specify // on_no_match, then this matcher is considered not to have // matched, even if a predicate at this level or above returned // true. Matcher *Matcher `protobuf:"bytes,1,opt,name=matcher,proto3,oneof"` } type Matcher_OnMatch_Action struct { // Protocol-specific action to take. Action *v4alpha1.TypedExtensionConfig `protobuf:"bytes,2,opt,name=action,proto3,oneof"` } func (*Matcher_OnMatch_Matcher) isMatcher_OnMatch_OnMatch() {} func (*Matcher_OnMatch_Action) isMatcher_OnMatch_OnMatch() {} // A linear list of field matchers. // The field matchers are evaluated in order, and the first match // wins. type Matcher_MatcherList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // A list of matchers. First match wins. Matchers []*Matcher_MatcherList_FieldMatcher `protobuf:"bytes,1,rep,name=matchers,proto3" json:"matchers,omitempty"` } func (x *Matcher_MatcherList) Reset() { *x = Matcher_MatcherList{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_MatcherList) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_MatcherList) ProtoMessage() {} func (x *Matcher_MatcherList) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_MatcherList.ProtoReflect.Descriptor instead. func (*Matcher_MatcherList) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 1} } func (x *Matcher_MatcherList) GetMatchers() []*Matcher_MatcherList_FieldMatcher { if x != nil { return x.Matchers } return nil } type Matcher_MatcherTree struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Protocol-specific specification of input field to match on. Input *v4alpha1.TypedExtensionConfig `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` // Exact or prefix match maps in which to look up the input value. // If the lookup succeeds, the match is considered successful, and // the corresponding OnMatch is used. // // Types that are assignable to TreeType: // *Matcher_MatcherTree_ExactMatchMap // *Matcher_MatcherTree_PrefixMatchMap // *Matcher_MatcherTree_CustomMatch TreeType isMatcher_MatcherTree_TreeType `protobuf_oneof:"tree_type"` } func (x *Matcher_MatcherTree) Reset() { *x = Matcher_MatcherTree{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_MatcherTree) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_MatcherTree) ProtoMessage() {} func (x *Matcher_MatcherTree) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_MatcherTree.ProtoReflect.Descriptor instead. func (*Matcher_MatcherTree) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 2} } func (x *Matcher_MatcherTree) GetInput() *v4alpha1.TypedExtensionConfig { if x != nil { return x.Input } return nil } func (m *Matcher_MatcherTree) GetTreeType() isMatcher_MatcherTree_TreeType { if m != nil { return m.TreeType } return nil } func (x *Matcher_MatcherTree) GetExactMatchMap() *Matcher_MatcherTree_MatchMap { if x, ok := x.GetTreeType().(*Matcher_MatcherTree_ExactMatchMap); ok { return x.ExactMatchMap } return nil } func (x *Matcher_MatcherTree) GetPrefixMatchMap() *Matcher_MatcherTree_MatchMap { if x, ok := x.GetTreeType().(*Matcher_MatcherTree_PrefixMatchMap); ok { return x.PrefixMatchMap } return nil } func (x *Matcher_MatcherTree) GetCustomMatch() *v4alpha1.TypedExtensionConfig { if x, ok := x.GetTreeType().(*Matcher_MatcherTree_CustomMatch); ok { return x.CustomMatch } return nil } type isMatcher_MatcherTree_TreeType interface { isMatcher_MatcherTree_TreeType() } type Matcher_MatcherTree_ExactMatchMap struct { ExactMatchMap *Matcher_MatcherTree_MatchMap `protobuf:"bytes,2,opt,name=exact_match_map,json=exactMatchMap,proto3,oneof"` } type Matcher_MatcherTree_PrefixMatchMap struct { // Longest matching prefix wins. PrefixMatchMap *Matcher_MatcherTree_MatchMap `protobuf:"bytes,3,opt,name=prefix_match_map,json=prefixMatchMap,proto3,oneof"` } type Matcher_MatcherTree_CustomMatch struct { // Extension for custom matching logic. CustomMatch *v4alpha1.TypedExtensionConfig `protobuf:"bytes,4,opt,name=custom_match,json=customMatch,proto3,oneof"` } func (*Matcher_MatcherTree_ExactMatchMap) isMatcher_MatcherTree_TreeType() {} func (*Matcher_MatcherTree_PrefixMatchMap) isMatcher_MatcherTree_TreeType() {} func (*Matcher_MatcherTree_CustomMatch) isMatcher_MatcherTree_TreeType() {} // Predicate to determine if a match is successful. type Matcher_MatcherList_Predicate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to MatchType: // *Matcher_MatcherList_Predicate_SinglePredicate_ // *Matcher_MatcherList_Predicate_OrMatcher // *Matcher_MatcherList_Predicate_AndMatcher // *Matcher_MatcherList_Predicate_NotMatcher MatchType isMatcher_MatcherList_Predicate_MatchType `protobuf_oneof:"match_type"` } func (x *Matcher_MatcherList_Predicate) Reset() { *x = Matcher_MatcherList_Predicate{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_MatcherList_Predicate) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_MatcherList_Predicate) ProtoMessage() {} func (x *Matcher_MatcherList_Predicate) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_MatcherList_Predicate.ProtoReflect.Descriptor instead. func (*Matcher_MatcherList_Predicate) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 1, 0} } func (m *Matcher_MatcherList_Predicate) GetMatchType() isMatcher_MatcherList_Predicate_MatchType { if m != nil { return m.MatchType } return nil } func (x *Matcher_MatcherList_Predicate) GetSinglePredicate() *Matcher_MatcherList_Predicate_SinglePredicate { if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_SinglePredicate_); ok { return x.SinglePredicate } return nil } func (x *Matcher_MatcherList_Predicate) GetOrMatcher() *Matcher_MatcherList_Predicate_PredicateList { if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_OrMatcher); ok { return x.OrMatcher } return nil } func (x *Matcher_MatcherList_Predicate) GetAndMatcher() *Matcher_MatcherList_Predicate_PredicateList { if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_AndMatcher); ok { return x.AndMatcher } return nil } func (x *Matcher_MatcherList_Predicate) GetNotMatcher() *Matcher_MatcherList_Predicate { if x, ok := x.GetMatchType().(*Matcher_MatcherList_Predicate_NotMatcher); ok { return x.NotMatcher } return nil } type isMatcher_MatcherList_Predicate_MatchType interface { isMatcher_MatcherList_Predicate_MatchType() } type Matcher_MatcherList_Predicate_SinglePredicate_ struct { // A single predicate to evaluate. SinglePredicate *Matcher_MatcherList_Predicate_SinglePredicate `protobuf:"bytes,1,opt,name=single_predicate,json=singlePredicate,proto3,oneof"` } type Matcher_MatcherList_Predicate_OrMatcher struct { // A list of predicates to be OR-ed together. OrMatcher *Matcher_MatcherList_Predicate_PredicateList `protobuf:"bytes,2,opt,name=or_matcher,json=orMatcher,proto3,oneof"` } type Matcher_MatcherList_Predicate_AndMatcher struct { // A list of predicates to be AND-ed together. AndMatcher *Matcher_MatcherList_Predicate_PredicateList `protobuf:"bytes,3,opt,name=and_matcher,json=andMatcher,proto3,oneof"` } type Matcher_MatcherList_Predicate_NotMatcher struct { // The invert of a predicate NotMatcher *Matcher_MatcherList_Predicate `protobuf:"bytes,4,opt,name=not_matcher,json=notMatcher,proto3,oneof"` } func (*Matcher_MatcherList_Predicate_SinglePredicate_) isMatcher_MatcherList_Predicate_MatchType() {} func (*Matcher_MatcherList_Predicate_OrMatcher) isMatcher_MatcherList_Predicate_MatchType() {} func (*Matcher_MatcherList_Predicate_AndMatcher) isMatcher_MatcherList_Predicate_MatchType() {} func (*Matcher_MatcherList_Predicate_NotMatcher) isMatcher_MatcherList_Predicate_MatchType() {} // An individual matcher. type Matcher_MatcherList_FieldMatcher struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Determines if the match succeeds. Predicate *Matcher_MatcherList_Predicate `protobuf:"bytes,1,opt,name=predicate,proto3" json:"predicate,omitempty"` // What to do if the match succeeds. OnMatch *Matcher_OnMatch `protobuf:"bytes,2,opt,name=on_match,json=onMatch,proto3" json:"on_match,omitempty"` } func (x *Matcher_MatcherList_FieldMatcher) Reset() { *x = Matcher_MatcherList_FieldMatcher{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_MatcherList_FieldMatcher) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_MatcherList_FieldMatcher) ProtoMessage() {} func (x *Matcher_MatcherList_FieldMatcher) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_MatcherList_FieldMatcher.ProtoReflect.Descriptor instead. func (*Matcher_MatcherList_FieldMatcher) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 1, 1} } func (x *Matcher_MatcherList_FieldMatcher) GetPredicate() *Matcher_MatcherList_Predicate { if x != nil { return x.Predicate } return nil } func (x *Matcher_MatcherList_FieldMatcher) GetOnMatch() *Matcher_OnMatch { if x != nil { return x.OnMatch } return nil } // Predicate for a single input field. type Matcher_MatcherList_Predicate_SinglePredicate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Protocol-specific specification of input field to match on. // [#extension-category: envoy.matching.common_inputs] Input *v4alpha1.TypedExtensionConfig `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` // Types that are assignable to Matcher: // *Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch // *Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch Matcher isMatcher_MatcherList_Predicate_SinglePredicate_Matcher `protobuf_oneof:"matcher"` } func (x *Matcher_MatcherList_Predicate_SinglePredicate) Reset() { *x = Matcher_MatcherList_Predicate_SinglePredicate{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_MatcherList_Predicate_SinglePredicate) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_MatcherList_Predicate_SinglePredicate) ProtoMessage() {} func (x *Matcher_MatcherList_Predicate_SinglePredicate) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_MatcherList_Predicate_SinglePredicate.ProtoReflect.Descriptor instead. func (*Matcher_MatcherList_Predicate_SinglePredicate) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 1, 0, 0} } func (x *Matcher_MatcherList_Predicate_SinglePredicate) GetInput() *v4alpha1.TypedExtensionConfig { if x != nil { return x.Input } return nil } func (m *Matcher_MatcherList_Predicate_SinglePredicate) GetMatcher() isMatcher_MatcherList_Predicate_SinglePredicate_Matcher { if m != nil { return m.Matcher } return nil } func (x *Matcher_MatcherList_Predicate_SinglePredicate) GetValueMatch() *v4alpha2.StringMatcher { if x, ok := x.GetMatcher().(*Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch); ok { return x.ValueMatch } return nil } func (x *Matcher_MatcherList_Predicate_SinglePredicate) GetCustomMatch() *v4alpha1.TypedExtensionConfig { if x, ok := x.GetMatcher().(*Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch); ok { return x.CustomMatch } return nil } type isMatcher_MatcherList_Predicate_SinglePredicate_Matcher interface { isMatcher_MatcherList_Predicate_SinglePredicate_Matcher() } type Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch struct { // Built-in string matcher. ValueMatch *v4alpha2.StringMatcher `protobuf:"bytes,2,opt,name=value_match,json=valueMatch,proto3,oneof"` } type Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch struct { // Extension for custom matching logic. // [#extension-category: envoy.matching.input_matchers] CustomMatch *v4alpha1.TypedExtensionConfig `protobuf:"bytes,3,opt,name=custom_match,json=customMatch,proto3,oneof"` } func (*Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch) isMatcher_MatcherList_Predicate_SinglePredicate_Matcher() { } func (*Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch) isMatcher_MatcherList_Predicate_SinglePredicate_Matcher() { } // A list of two or more matchers. Used to allow using a list within a oneof. type Matcher_MatcherList_Predicate_PredicateList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Predicate []*Matcher_MatcherList_Predicate `protobuf:"bytes,1,rep,name=predicate,proto3" json:"predicate,omitempty"` } func (x *Matcher_MatcherList_Predicate_PredicateList) Reset() { *x = Matcher_MatcherList_Predicate_PredicateList{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_MatcherList_Predicate_PredicateList) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_MatcherList_Predicate_PredicateList) ProtoMessage() {} func (x *Matcher_MatcherList_Predicate_PredicateList) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_MatcherList_Predicate_PredicateList.ProtoReflect.Descriptor instead. func (*Matcher_MatcherList_Predicate_PredicateList) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 1, 0, 1} } func (x *Matcher_MatcherList_Predicate_PredicateList) GetPredicate() []*Matcher_MatcherList_Predicate { if x != nil { return x.Predicate } return nil } // A map of configured matchers. Used to allow using a map within a oneof. type Matcher_MatcherTree_MatchMap struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Map map[string]*Matcher_OnMatch `protobuf:"bytes,1,rep,name=map,proto3" json:"map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Matcher_MatcherTree_MatchMap) Reset() { *x = Matcher_MatcherTree_MatchMap{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Matcher_MatcherTree_MatchMap) String() string { return protoimpl.X.MessageStringOf(x) } func (*Matcher_MatcherTree_MatchMap) ProtoMessage() {} func (x *Matcher_MatcherTree_MatchMap) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Matcher_MatcherTree_MatchMap.ProtoReflect.Descriptor instead. func (*Matcher_MatcherTree_MatchMap) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{0, 2, 0} } func (x *Matcher_MatcherTree_MatchMap) GetMap() map[string]*Matcher_OnMatch { if x != nil { return x.Map } return nil } // A set of match configurations used for logical operations. type MatchPredicate_MatchSet struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The list of rules that make up the set. Rules []*MatchPredicate `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"` } func (x *MatchPredicate_MatchSet) Reset() { *x = MatchPredicate_MatchSet{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *MatchPredicate_MatchSet) String() string { return protoimpl.X.MessageStringOf(x) } func (*MatchPredicate_MatchSet) ProtoMessage() {} func (x *MatchPredicate_MatchSet) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use MatchPredicate_MatchSet.ProtoReflect.Descriptor instead. func (*MatchPredicate_MatchSet) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{1, 0} } func (x *MatchPredicate_MatchSet) GetRules() []*MatchPredicate { if x != nil { return x.Rules } return nil } type HttpGenericBodyMatch_GenericTextMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Types that are assignable to Rule: // *HttpGenericBodyMatch_GenericTextMatch_StringMatch // *HttpGenericBodyMatch_GenericTextMatch_BinaryMatch Rule isHttpGenericBodyMatch_GenericTextMatch_Rule `protobuf_oneof:"rule"` } func (x *HttpGenericBodyMatch_GenericTextMatch) Reset() { *x = HttpGenericBodyMatch_GenericTextMatch{} if protoimpl.UnsafeEnabled { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *HttpGenericBodyMatch_GenericTextMatch) String() string { return protoimpl.X.MessageStringOf(x) } func (*HttpGenericBodyMatch_GenericTextMatch) ProtoMessage() {} func (x *HttpGenericBodyMatch_GenericTextMatch) ProtoReflect() protoreflect.Message { mi := &file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use HttpGenericBodyMatch_GenericTextMatch.ProtoReflect.Descriptor instead. func (*HttpGenericBodyMatch_GenericTextMatch) Descriptor() ([]byte, []int) { return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP(), []int{3, 0} } func (m *HttpGenericBodyMatch_GenericTextMatch) GetRule() isHttpGenericBodyMatch_GenericTextMatch_Rule { if m != nil { return m.Rule } return nil } func (x *HttpGenericBodyMatch_GenericTextMatch) GetStringMatch() string { if x, ok := x.GetRule().(*HttpGenericBodyMatch_GenericTextMatch_StringMatch); ok { return x.StringMatch } return "" } func (x *HttpGenericBodyMatch_GenericTextMatch) GetBinaryMatch() []byte { if x, ok := x.GetRule().(*HttpGenericBodyMatch_GenericTextMatch_BinaryMatch); ok { return x.BinaryMatch } return nil } type isHttpGenericBodyMatch_GenericTextMatch_Rule interface { isHttpGenericBodyMatch_GenericTextMatch_Rule() } type HttpGenericBodyMatch_GenericTextMatch_StringMatch struct { // Text string to be located in HTTP body. StringMatch string `protobuf:"bytes,1,opt,name=string_match,json=stringMatch,proto3,oneof"` } type HttpGenericBodyMatch_GenericTextMatch_BinaryMatch struct { // Sequence of bytes to be located in HTTP body. BinaryMatch []byte `protobuf:"bytes,2,opt,name=binary_match,json=binaryMatch,proto3,oneof"` } func (*HttpGenericBodyMatch_GenericTextMatch_StringMatch) isHttpGenericBodyMatch_GenericTextMatch_Rule() { } func (*HttpGenericBodyMatch_GenericTextMatch_BinaryMatch) isHttpGenericBodyMatch_GenericTextMatch_Rule() { } var File_envoy_config_common_matcher_v4alpha_matcher_proto protoreflect.FileDescriptor var file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDesc = []byte{ 0x0a, 0x31, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x23, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x1a, 0x29, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x31, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x75, 0x64, 0x70, 0x61, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x17, 0x0a, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x5d, 0x0a, 0x0c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x5d, 0x0a, 0x0c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x74, 0x72, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x48, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x6f, 0x6e, 0x5f, 0x6e, 0x6f, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x09, 0x6f, 0x6e, 0x4e, 0x6f, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0xe6, 0x01, 0x0a, 0x07, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x48, 0x0a, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x35, 0x9a, 0xc5, 0x88, 0x1e, 0x30, 0x0a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0f, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0xca, 0x0c, 0x0a, 0x0b, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x6b, 0x0a, 0x08, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x73, 0x1a, 0xf2, 0x08, 0x0a, 0x09, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x7f, 0x0a, 0x10, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x52, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x71, 0x0a, 0x0a, 0x6f, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x73, 0x0a, 0x0b, 0x61, 0x6e, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x0b, 0x6e, 0x6f, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x1a, 0xeb, 0x02, 0x0a, 0x0f, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x4f, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x54, 0x0a, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x3a, 0x53, 0x9a, 0xc5, 0x88, 0x1e, 0x4e, 0x0a, 0x4c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x0e, 0x0a, 0x07, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0xce, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x6a, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x3a, 0x51, 0x9a, 0xc5, 0x88, 0x1e, 0x4c, 0x0a, 0x4a, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x3a, 0x43, 0x9a, 0xc5, 0x88, 0x1e, 0x3e, 0x0a, 0x3c, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x11, 0x0a, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x1a, 0x9d, 0x02, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x6a, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x09, 0x70, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x59, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x07, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x3a, 0x46, 0x9a, 0xc5, 0x88, 0x1e, 0x41, 0x0a, 0x3f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x3a, 0x39, 0x9a, 0xc5, 0x88, 0x1e, 0x34, 0x0a, 0x32, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x84, 0x06, 0x0a, 0x0b, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x12, 0x4f, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x6b, 0x0a, 0x0f, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x48, 0x00, 0x52, 0x0d, 0x65, 0x78, 0x61, 0x63, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x6d, 0x0a, 0x10, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x54, 0x0a, 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0xa4, 0x02, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x12, 0x66, 0x0a, 0x03, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x9a, 0x01, 0x02, 0x08, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x70, 0x1a, 0x6c, 0x0a, 0x08, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x42, 0x9a, 0xc5, 0x88, 0x1e, 0x3d, 0x0a, 0x3b, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x70, 0x3a, 0x39, 0x9a, 0xc5, 0x88, 0x1e, 0x34, 0x0a, 0x32, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x54, 0x72, 0x65, 0x65, 0x42, 0x10, 0x0a, 0x09, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x3a, 0x2d, 0x9a, 0xc5, 0x88, 0x1e, 0x28, 0x0a, 0x26, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x42, 0x13, 0x0a, 0x0c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x92, 0x0a, 0x0a, 0x0e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x59, 0x0a, 0x08, 0x6f, 0x72, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x5b, 0x0a, 0x09, 0x61, 0x6e, 0x64, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x52, 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x26, 0x0a, 0x09, 0x61, 0x6e, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x6a, 0x02, 0x08, 0x01, 0x48, 0x00, 0x52, 0x08, 0x61, 0x6e, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x74, 0x0a, 0x1a, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x17, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x76, 0x0a, 0x1b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x73, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x18, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x76, 0x0a, 0x1b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x18, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x78, 0x0a, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x73, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x19, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x81, 0x01, 0x0a, 0x1f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x1b, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x83, 0x01, 0x0a, 0x20, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x48, 0x00, 0x52, 0x1c, 0x68, 0x74, 0x74, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x9e, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x12, 0x53, 0x0a, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x02, 0x52, 0x05, 0x72, 0x75, 0x6c, 0x65, 0x73, 0x3a, 0x3d, 0x9a, 0xc5, 0x88, 0x1e, 0x38, 0x0a, 0x36, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x74, 0x3a, 0x34, 0x9a, 0xc5, 0x88, 0x1e, 0x2f, 0x0a, 0x2d, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x72, 0x65, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x0b, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x22, 0x8f, 0x01, 0x0a, 0x10, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x43, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x3a, 0x36, 0x9a, 0xc5, 0x88, 0x1e, 0x31, 0x0a, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x22, 0xb0, 0x03, 0x0a, 0x14, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x70, 0x0a, 0x08, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4a, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x54, 0x65, 0x78, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x08, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x1a, 0xc8, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x54, 0x65, 0x78, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x2c, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x2c, 0x0a, 0x0c, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x7a, 0x02, 0x10, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x3a, 0x4b, 0x9a, 0xc5, 0x88, 0x1e, 0x46, 0x0a, 0x44, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x54, 0x65, 0x78, 0x74, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x0b, 0x0a, 0x04, 0x72, 0x75, 0x6c, 0x65, 0x12, 0x03, 0xf8, 0x42, 0x01, 0x3a, 0x3a, 0x9a, 0xc5, 0x88, 0x1e, 0x35, 0x0a, 0x33, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x42, 0x6f, 0x64, 0x79, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x42, 0x4b, 0x0a, 0x31, 0x69, 0x6f, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x76, 0x34, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x42, 0x0c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0xba, 0x80, 0xc8, 0xd1, 0x06, 0x02, 0x10, 0x03, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescOnce sync.Once file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescData = file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDesc ) func file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescGZIP() []byte { file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescOnce.Do(func() { file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescData = protoimpl.X.CompressGZIP(file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescData) }) return file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDescData } var file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_envoy_config_common_matcher_v4alpha_matcher_proto_goTypes = []interface{}{ (*Matcher)(nil), // 0: envoy.config.common.matcher.v4alpha.Matcher (*MatchPredicate)(nil), // 1: envoy.config.common.matcher.v4alpha.MatchPredicate (*HttpHeadersMatch)(nil), // 2: envoy.config.common.matcher.v4alpha.HttpHeadersMatch (*HttpGenericBodyMatch)(nil), // 3: envoy.config.common.matcher.v4alpha.HttpGenericBodyMatch (*Matcher_OnMatch)(nil), // 4: envoy.config.common.matcher.v4alpha.Matcher.OnMatch (*Matcher_MatcherList)(nil), // 5: envoy.config.common.matcher.v4alpha.Matcher.MatcherList (*Matcher_MatcherTree)(nil), // 6: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree (*Matcher_MatcherList_Predicate)(nil), // 7: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate (*Matcher_MatcherList_FieldMatcher)(nil), // 8: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.FieldMatcher (*Matcher_MatcherList_Predicate_SinglePredicate)(nil), // 9: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.SinglePredicate (*Matcher_MatcherList_Predicate_PredicateList)(nil), // 10: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.PredicateList (*Matcher_MatcherTree_MatchMap)(nil), // 11: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.MatchMap nil, // 12: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.MatchMap.MapEntry (*MatchPredicate_MatchSet)(nil), // 13: envoy.config.common.matcher.v4alpha.MatchPredicate.MatchSet (*HttpGenericBodyMatch_GenericTextMatch)(nil), // 14: envoy.config.common.matcher.v4alpha.HttpGenericBodyMatch.GenericTextMatch (*v4alpha.HeaderMatcher)(nil), // 15: envoy.config.route.v4alpha.HeaderMatcher (*v4alpha1.TypedExtensionConfig)(nil), // 16: envoy.config.core.v4alpha.TypedExtensionConfig (*v4alpha2.StringMatcher)(nil), // 17: envoy.type.matcher.v4alpha.StringMatcher } var file_envoy_config_common_matcher_v4alpha_matcher_proto_depIdxs = []int32{ 5, // 0: envoy.config.common.matcher.v4alpha.Matcher.matcher_list:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList 6, // 1: envoy.config.common.matcher.v4alpha.Matcher.matcher_tree:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherTree 4, // 2: envoy.config.common.matcher.v4alpha.Matcher.on_no_match:type_name -> envoy.config.common.matcher.v4alpha.Matcher.OnMatch 13, // 3: envoy.config.common.matcher.v4alpha.MatchPredicate.or_match:type_name -> envoy.config.common.matcher.v4alpha.MatchPredicate.MatchSet 13, // 4: envoy.config.common.matcher.v4alpha.MatchPredicate.and_match:type_name -> envoy.config.common.matcher.v4alpha.MatchPredicate.MatchSet 1, // 5: envoy.config.common.matcher.v4alpha.MatchPredicate.not_match:type_name -> envoy.config.common.matcher.v4alpha.MatchPredicate 2, // 6: envoy.config.common.matcher.v4alpha.MatchPredicate.http_request_headers_match:type_name -> envoy.config.common.matcher.v4alpha.HttpHeadersMatch 2, // 7: envoy.config.common.matcher.v4alpha.MatchPredicate.http_request_trailers_match:type_name -> envoy.config.common.matcher.v4alpha.HttpHeadersMatch 2, // 8: envoy.config.common.matcher.v4alpha.MatchPredicate.http_response_headers_match:type_name -> envoy.config.common.matcher.v4alpha.HttpHeadersMatch 2, // 9: envoy.config.common.matcher.v4alpha.MatchPredicate.http_response_trailers_match:type_name -> envoy.config.common.matcher.v4alpha.HttpHeadersMatch 3, // 10: envoy.config.common.matcher.v4alpha.MatchPredicate.http_request_generic_body_match:type_name -> envoy.config.common.matcher.v4alpha.HttpGenericBodyMatch 3, // 11: envoy.config.common.matcher.v4alpha.MatchPredicate.http_response_generic_body_match:type_name -> envoy.config.common.matcher.v4alpha.HttpGenericBodyMatch 15, // 12: envoy.config.common.matcher.v4alpha.HttpHeadersMatch.headers:type_name -> envoy.config.route.v4alpha.HeaderMatcher 14, // 13: envoy.config.common.matcher.v4alpha.HttpGenericBodyMatch.patterns:type_name -> envoy.config.common.matcher.v4alpha.HttpGenericBodyMatch.GenericTextMatch 0, // 14: envoy.config.common.matcher.v4alpha.Matcher.OnMatch.matcher:type_name -> envoy.config.common.matcher.v4alpha.Matcher 16, // 15: envoy.config.common.matcher.v4alpha.Matcher.OnMatch.action:type_name -> envoy.config.core.v4alpha.TypedExtensionConfig 8, // 16: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.matchers:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList.FieldMatcher 16, // 17: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.input:type_name -> envoy.config.core.v4alpha.TypedExtensionConfig 11, // 18: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.exact_match_map:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.MatchMap 11, // 19: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.prefix_match_map:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.MatchMap 16, // 20: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.custom_match:type_name -> envoy.config.core.v4alpha.TypedExtensionConfig 9, // 21: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.single_predicate:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.SinglePredicate 10, // 22: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.or_matcher:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.PredicateList 10, // 23: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.and_matcher:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.PredicateList 7, // 24: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.not_matcher:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate 7, // 25: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.FieldMatcher.predicate:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate 4, // 26: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.FieldMatcher.on_match:type_name -> envoy.config.common.matcher.v4alpha.Matcher.OnMatch 16, // 27: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.SinglePredicate.input:type_name -> envoy.config.core.v4alpha.TypedExtensionConfig 17, // 28: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.SinglePredicate.value_match:type_name -> envoy.type.matcher.v4alpha.StringMatcher 16, // 29: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.SinglePredicate.custom_match:type_name -> envoy.config.core.v4alpha.TypedExtensionConfig 7, // 30: envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate.PredicateList.predicate:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherList.Predicate 12, // 31: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.MatchMap.map:type_name -> envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.MatchMap.MapEntry 4, // 32: envoy.config.common.matcher.v4alpha.Matcher.MatcherTree.MatchMap.MapEntry.value:type_name -> envoy.config.common.matcher.v4alpha.Matcher.OnMatch 1, // 33: envoy.config.common.matcher.v4alpha.MatchPredicate.MatchSet.rules:type_name -> envoy.config.common.matcher.v4alpha.MatchPredicate 34, // [34:34] is the sub-list for method output_type 34, // [34:34] is the sub-list for method input_type 34, // [34:34] is the sub-list for extension type_name 34, // [34:34] is the sub-list for extension extendee 0, // [0:34] is the sub-list for field type_name } func init() { file_envoy_config_common_matcher_v4alpha_matcher_proto_init() } func file_envoy_config_common_matcher_v4alpha_matcher_proto_init() { if File_envoy_config_common_matcher_v4alpha_matcher_proto != nil { return } if !protoimpl.UnsafeEnabled { file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MatchPredicate); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HttpHeadersMatch); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HttpGenericBodyMatch); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_OnMatch); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_MatcherList); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_MatcherTree); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_MatcherList_Predicate); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_MatcherList_FieldMatcher); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_MatcherList_Predicate_SinglePredicate); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_MatcherList_Predicate_PredicateList); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Matcher_MatcherTree_MatchMap); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MatchPredicate_MatchSet); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HttpGenericBodyMatch_GenericTextMatch); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[0].OneofWrappers = []interface{}{ (*Matcher_MatcherList_)(nil), (*Matcher_MatcherTree_)(nil), } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[1].OneofWrappers = []interface{}{ (*MatchPredicate_OrMatch)(nil), (*MatchPredicate_AndMatch)(nil), (*MatchPredicate_NotMatch)(nil), (*MatchPredicate_AnyMatch)(nil), (*MatchPredicate_HttpRequestHeadersMatch)(nil), (*MatchPredicate_HttpRequestTrailersMatch)(nil), (*MatchPredicate_HttpResponseHeadersMatch)(nil), (*MatchPredicate_HttpResponseTrailersMatch)(nil), (*MatchPredicate_HttpRequestGenericBodyMatch)(nil), (*MatchPredicate_HttpResponseGenericBodyMatch)(nil), } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[4].OneofWrappers = []interface{}{ (*Matcher_OnMatch_Matcher)(nil), (*Matcher_OnMatch_Action)(nil), } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[6].OneofWrappers = []interface{}{ (*Matcher_MatcherTree_ExactMatchMap)(nil), (*Matcher_MatcherTree_PrefixMatchMap)(nil), (*Matcher_MatcherTree_CustomMatch)(nil), } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[7].OneofWrappers = []interface{}{ (*Matcher_MatcherList_Predicate_SinglePredicate_)(nil), (*Matcher_MatcherList_Predicate_OrMatcher)(nil), (*Matcher_MatcherList_Predicate_AndMatcher)(nil), (*Matcher_MatcherList_Predicate_NotMatcher)(nil), } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[9].OneofWrappers = []interface{}{ (*Matcher_MatcherList_Predicate_SinglePredicate_ValueMatch)(nil), (*Matcher_MatcherList_Predicate_SinglePredicate_CustomMatch)(nil), } file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes[14].OneofWrappers = []interface{}{ (*HttpGenericBodyMatch_GenericTextMatch_StringMatch)(nil), (*HttpGenericBodyMatch_GenericTextMatch_BinaryMatch)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDesc, NumEnums: 0, NumMessages: 15, NumExtensions: 0, NumServices: 0, }, GoTypes: file_envoy_config_common_matcher_v4alpha_matcher_proto_goTypes, DependencyIndexes: file_envoy_config_common_matcher_v4alpha_matcher_proto_depIdxs, MessageInfos: file_envoy_config_common_matcher_v4alpha_matcher_proto_msgTypes, }.Build() File_envoy_config_common_matcher_v4alpha_matcher_proto = out.File file_envoy_config_common_matcher_v4alpha_matcher_proto_rawDesc = nil file_envoy_config_common_matcher_v4alpha_matcher_proto_goTypes = nil file_envoy_config_common_matcher_v4alpha_matcher_proto_depIdxs = nil }
istio/go-control-plane
envoy/config/common/matcher/v4alpha/matcher.pb.go
GO
apache-2.0
87,395
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_25) on Fri Jun 05 10:51:21 EDT 2015 --> <title>org.apache.cassandra.repair (apache-cassandra API)</title> <meta name="date" content="2015-06-05"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="org.apache.cassandra.repair (apache-cassandra API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/notifications/package-summary.html">Prev&nbsp;Package</a></li> <li><a href="../../../../org/apache/cassandra/repair/messages/package-summary.html">Next&nbsp;Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/repair/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Package" class="title">Package&nbsp;org.apache.cassandra.repair</h1> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation"> <caption><span>Interface Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Interface</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/IRepairJobEventListener.html" title="interface in org.apache.cassandra.repair">IRepairJobEventListener</a></td> <td class="colLast"> <div class="block">Implemented by the RepairSession to accept callbacks from sequential snapshot creation failure.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/IRequestCoordinator.html" title="interface in org.apache.cassandra.repair">IRequestCoordinator</a>&lt;R&gt;</td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/IRequestProcessor.html" title="interface in org.apache.cassandra.repair">IRequestProcessor</a>&lt;R&gt;</td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation"> <caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Class</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/AnticompactionTask.html" title="class in org.apache.cassandra.repair">AnticompactionTask</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/AnticompactionTask.AnticompactionCallback.html" title="class in org.apache.cassandra.repair">AnticompactionTask.AnticompactionCallback</a></td> <td class="colLast"> <div class="block">Callback for antitcompaction request.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/DatacenterAwareRequestCoordinator.html" title="class in org.apache.cassandra.repair">DatacenterAwareRequestCoordinator</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/Differencer.html" title="class in org.apache.cassandra.repair">Differencer</a></td> <td class="colLast"> <div class="block">Runs on the node that initiated a request to compare two trees, and launch repairs for disagreeing ranges.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/NodePair.html" title="class in org.apache.cassandra.repair">NodePair</a></td> <td class="colLast"> <div class="block">NodePair is used for repair message body to indicate the pair of nodes.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/NodePair.NodePairSerializer.html" title="class in org.apache.cassandra.repair">NodePair.NodePairSerializer</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/ParallelRequestCoordinator.html" title="class in org.apache.cassandra.repair">ParallelRequestCoordinator</a>&lt;R&gt;</td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/RepairFuture.html" title="class in org.apache.cassandra.repair">RepairFuture</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/RepairJob.html" title="class in org.apache.cassandra.repair">RepairJob</a></td> <td class="colLast"> <div class="block">RepairJob runs repair on given ColumnFamily.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/RepairJobDesc.html" title="class in org.apache.cassandra.repair">RepairJobDesc</a></td> <td class="colLast"> <div class="block">RepairJobDesc is used from various repair processes to distinguish one RepairJob to another.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/RepairMessageVerbHandler.html" title="class in org.apache.cassandra.repair">RepairMessageVerbHandler</a></td> <td class="colLast"> <div class="block">Handles all repair related message.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/RepairSession.html" title="class in org.apache.cassandra.repair">RepairSession</a></td> <td class="colLast"> <div class="block">Coordinates the (active) repair of a token range.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/SequentialRequestCoordinator.html" title="class in org.apache.cassandra.repair">SequentialRequestCoordinator</a>&lt;R&gt;</td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/SnapshotTask.html" title="class in org.apache.cassandra.repair">SnapshotTask</a></td> <td class="colLast"> <div class="block">SnapshotTask is a task that sends snapshot request.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/StreamingRepairTask.html" title="class in org.apache.cassandra.repair">StreamingRepairTask</a></td> <td class="colLast"> <div class="block">Task that make two nodes exchange (stream) some ranges (for a given table/cf).</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/TreeResponse.html" title="class in org.apache.cassandra.repair">TreeResponse</a></td> <td class="colLast"> <div class="block">Merkle tree response sent from given endpoint.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/Validator.html" title="class in org.apache.cassandra.repair">Validator</a></td> <td class="colLast"> <div class="block">Handles the building of a merkle tree for a column family.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Summary table, listing enums, and an explanation"> <caption><span>Enum Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Enum</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../org/apache/cassandra/repair/RepairParallelism.html" title="enum in org.apache.cassandra.repair">RepairParallelism</a></td> <td class="colLast"> <div class="block">Specify the degree of parallelism when calculating the merkle trees in a repair job.</div> </td> </tr> </tbody> </table> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/notifications/package-summary.html">Prev&nbsp;Package</a></li> <li><a href="../../../../org/apache/cassandra/repair/messages/package-summary.html">Next&nbsp;Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/repair/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &copy; 2015 The Apache Software Foundation</small></p> </body> </html>
Jcamilorada/Cassandra
Instalacion/javadoc/org/apache/cassandra/repair/package-summary.html
HTML
apache-2.0
11,593
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.securityhub.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * The insight result values returned by the <code>GetInsightResults</code> operation. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/securityhub-2018-10-26/InsightResultValue" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class InsightResultValue implements Serializable, Cloneable, StructuredPojo { /** * <p> * The value of the attribute that the findings are grouped by for the insight whose results are returned by the * <code>GetInsightResults</code> operation. * </p> */ private String groupByAttributeValue; /** * <p> * The number of findings returned for each <code>GroupByAttributeValue</code>. * </p> */ private Integer count; /** * <p> * The value of the attribute that the findings are grouped by for the insight whose results are returned by the * <code>GetInsightResults</code> operation. * </p> * * @param groupByAttributeValue * The value of the attribute that the findings are grouped by for the insight whose results are returned by * the <code>GetInsightResults</code> operation. */ public void setGroupByAttributeValue(String groupByAttributeValue) { this.groupByAttributeValue = groupByAttributeValue; } /** * <p> * The value of the attribute that the findings are grouped by for the insight whose results are returned by the * <code>GetInsightResults</code> operation. * </p> * * @return The value of the attribute that the findings are grouped by for the insight whose results are returned by * the <code>GetInsightResults</code> operation. */ public String getGroupByAttributeValue() { return this.groupByAttributeValue; } /** * <p> * The value of the attribute that the findings are grouped by for the insight whose results are returned by the * <code>GetInsightResults</code> operation. * </p> * * @param groupByAttributeValue * The value of the attribute that the findings are grouped by for the insight whose results are returned by * the <code>GetInsightResults</code> operation. * @return Returns a reference to this object so that method calls can be chained together. */ public InsightResultValue withGroupByAttributeValue(String groupByAttributeValue) { setGroupByAttributeValue(groupByAttributeValue); return this; } /** * <p> * The number of findings returned for each <code>GroupByAttributeValue</code>. * </p> * * @param count * The number of findings returned for each <code>GroupByAttributeValue</code>. */ public void setCount(Integer count) { this.count = count; } /** * <p> * The number of findings returned for each <code>GroupByAttributeValue</code>. * </p> * * @return The number of findings returned for each <code>GroupByAttributeValue</code>. */ public Integer getCount() { return this.count; } /** * <p> * The number of findings returned for each <code>GroupByAttributeValue</code>. * </p> * * @param count * The number of findings returned for each <code>GroupByAttributeValue</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public InsightResultValue withCount(Integer count) { setCount(count); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getGroupByAttributeValue() != null) sb.append("GroupByAttributeValue: ").append(getGroupByAttributeValue()).append(","); if (getCount() != null) sb.append("Count: ").append(getCount()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof InsightResultValue == false) return false; InsightResultValue other = (InsightResultValue) obj; if (other.getGroupByAttributeValue() == null ^ this.getGroupByAttributeValue() == null) return false; if (other.getGroupByAttributeValue() != null && other.getGroupByAttributeValue().equals(this.getGroupByAttributeValue()) == false) return false; if (other.getCount() == null ^ this.getCount() == null) return false; if (other.getCount() != null && other.getCount().equals(this.getCount()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getGroupByAttributeValue() == null) ? 0 : getGroupByAttributeValue().hashCode()); hashCode = prime * hashCode + ((getCount() == null) ? 0 : getCount().hashCode()); return hashCode; } @Override public InsightResultValue clone() { try { return (InsightResultValue) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.securityhub.model.transform.InsightResultValueMarshaller.getInstance().marshall(this, protocolMarshaller); } }
jentfoo/aws-sdk-java
aws-java-sdk-securityhub/src/main/java/com/amazonaws/services/securityhub/model/InsightResultValue.java
Java
apache-2.0
6,890
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.appsync.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Describes a type. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/appsync-2017-07-25/Type" target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Type implements Serializable, Cloneable, StructuredPojo { /** * <p> * The type name. * </p> */ private String name; /** * <p> * The type description. * </p> */ private String description; /** * <p> * The type ARN. * </p> */ private String arn; /** * <p> * The type definition. * </p> */ private String definition; /** * <p> * The type format: SDL or JSON. * </p> */ private String format; /** * <p> * The type name. * </p> * * @param name * The type name. */ public void setName(String name) { this.name = name; } /** * <p> * The type name. * </p> * * @return The type name. */ public String getName() { return this.name; } /** * <p> * The type name. * </p> * * @param name * The type name. * @return Returns a reference to this object so that method calls can be chained together. */ public Type withName(String name) { setName(name); return this; } /** * <p> * The type description. * </p> * * @param description * The type description. */ public void setDescription(String description) { this.description = description; } /** * <p> * The type description. * </p> * * @return The type description. */ public String getDescription() { return this.description; } /** * <p> * The type description. * </p> * * @param description * The type description. * @return Returns a reference to this object so that method calls can be chained together. */ public Type withDescription(String description) { setDescription(description); return this; } /** * <p> * The type ARN. * </p> * * @param arn * The type ARN. */ public void setArn(String arn) { this.arn = arn; } /** * <p> * The type ARN. * </p> * * @return The type ARN. */ public String getArn() { return this.arn; } /** * <p> * The type ARN. * </p> * * @param arn * The type ARN. * @return Returns a reference to this object so that method calls can be chained together. */ public Type withArn(String arn) { setArn(arn); return this; } /** * <p> * The type definition. * </p> * * @param definition * The type definition. */ public void setDefinition(String definition) { this.definition = definition; } /** * <p> * The type definition. * </p> * * @return The type definition. */ public String getDefinition() { return this.definition; } /** * <p> * The type definition. * </p> * * @param definition * The type definition. * @return Returns a reference to this object so that method calls can be chained together. */ public Type withDefinition(String definition) { setDefinition(definition); return this; } /** * <p> * The type format: SDL or JSON. * </p> * * @param format * The type format: SDL or JSON. * @see TypeDefinitionFormat */ public void setFormat(String format) { this.format = format; } /** * <p> * The type format: SDL or JSON. * </p> * * @return The type format: SDL or JSON. * @see TypeDefinitionFormat */ public String getFormat() { return this.format; } /** * <p> * The type format: SDL or JSON. * </p> * * @param format * The type format: SDL or JSON. * @return Returns a reference to this object so that method calls can be chained together. * @see TypeDefinitionFormat */ public Type withFormat(String format) { setFormat(format); return this; } /** * <p> * The type format: SDL or JSON. * </p> * * @param format * The type format: SDL or JSON. * @return Returns a reference to this object so that method calls can be chained together. * @see TypeDefinitionFormat */ public Type withFormat(TypeDefinitionFormat format) { this.format = format.toString(); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getArn() != null) sb.append("Arn: ").append(getArn()).append(","); if (getDefinition() != null) sb.append("Definition: ").append(getDefinition()).append(","); if (getFormat() != null) sb.append("Format: ").append(getFormat()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Type == false) return false; Type other = (Type) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getDescription() == null ^ this.getDescription() == null) return false; if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false) return false; if (other.getArn() == null ^ this.getArn() == null) return false; if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false; if (other.getDefinition() == null ^ this.getDefinition() == null) return false; if (other.getDefinition() != null && other.getDefinition().equals(this.getDefinition()) == false) return false; if (other.getFormat() == null ^ this.getFormat() == null) return false; if (other.getFormat() != null && other.getFormat().equals(this.getFormat()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getDefinition() == null) ? 0 : getDefinition().hashCode()); hashCode = prime * hashCode + ((getFormat() == null) ? 0 : getFormat().hashCode()); return hashCode; } @Override public Type clone() { try { return (Type) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.appsync.model.transform.TypeMarshaller.getInstance().marshall(this, protocolMarshaller); } }
jentfoo/aws-sdk-java
aws-java-sdk-appsync/src/main/java/com/amazonaws/services/appsync/model/Type.java
Java
apache-2.0
9,182
/* * Copyright 2016 Dennis Vriend * * 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.github.dnvriend.scaffold.play.enabler import com.github.dnvriend.scaffold.play.enabler.akka.AkkaEnablerResult import com.github.dnvriend.scaffold.play.enabler.all.EveryFeatureEnablerResult import com.github.dnvriend.scaffold.play.enabler.anorm.AnormEnablerResult import com.github.dnvriend.scaffold.play.enabler.buildinfo.BuildInfoEnablerResult import com.github.dnvriend.scaffold.play.enabler.circuitbreaker.CircuitBreakerEnablerResult import com.github.dnvriend.scaffold.play.enabler.conductr.ConductrEnablerResult import com.github.dnvriend.scaffold.play.enabler.docker.DockerEnablerResult import com.github.dnvriend.scaffold.play.enabler.fp.FpEnablerResult import com.github.dnvriend.scaffold.play.enabler.json.JsonEnablerResult import com.github.dnvriend.scaffold.play.enabler.kafka.KafkaEnablerResult import com.github.dnvriend.scaffold.play.enabler.logging.LoggingEnablerResult import com.github.dnvriend.scaffold.play.enabler.sbtheader.SbtHeaderEnablerResult import com.github.dnvriend.scaffold.play.enabler.scalariform.ScalariformEnablerResult import com.github.dnvriend.scaffold.play.enabler.slick.SlickEnablerResult import com.github.dnvriend.scaffold.play.enabler.spark.SparkEnablerResult import com.github.dnvriend.scaffold.play.enabler.swagger.SwaggerEnablerResult import play.api.libs.json._ import play.api.libs.json.Reads._ import play.api.libs.functional.syntax._ object EnablerResult { val reads: Reads[EnablerResult] = ((JsPath \ "class").read[String] and (JsPath \ "object").read[JsValue])((str, js) => str match { case "AnormEnablerResult" => js.as[AnormEnablerResult](AnormEnablerResult.format) case "SlickEnablerResult" => js.as[SlickEnablerResult](SlickEnablerResult.format) case "AkkaEnablerResult" => js.as[AkkaEnablerResult](AkkaEnablerResult.format) case "BuildInfoEnablerResult" => js.as[BuildInfoEnablerResult](BuildInfoEnablerResult.format) case "CircuitBreakerEnablerResult" => js.as[CircuitBreakerEnablerResult](CircuitBreakerEnablerResult.format) case "ConductrEnablerResult" => js.as[ConductrEnablerResult](ConductrEnablerResult.format) case "DockerEnablerResult" => js.as[DockerEnablerResult](DockerEnablerResult.format) case "FpEnablerResult" => js.as[FpEnablerResult](FpEnablerResult.format) case "JsonEnablerResult" => js.as[JsonEnablerResult](JsonEnablerResult.format) case "LoggingEnablerResult" => js.as[LoggingEnablerResult](LoggingEnablerResult.format) case "KafkaEnablerResult" => js.as[KafkaEnablerResult](KafkaEnablerResult.format) case "ScalariformEnablerResult" => js.as[ScalariformEnablerResult](ScalariformEnablerResult.format) case "SbtHeaderEnablerResult" => js.as[SbtHeaderEnablerResult](SbtHeaderEnablerResult.format) case "SwaggerEnablerResult" => js.as[SwaggerEnablerResult](SwaggerEnablerResult.format) case "SparkEnablerResult" => js.as[SparkEnablerResult](SparkEnablerResult.format) }) val writes: Writes[EnablerResult] = new Writes[EnablerResult] { override def writes(result: EnablerResult): JsValue = { val json: JsValue = result match { case x: AnormEnablerResult => Json.toJson(x)(AnormEnablerResult.format) case x: SlickEnablerResult => Json.toJson(x)(SlickEnablerResult.format) case x: AkkaEnablerResult => Json.toJson(x)(AkkaEnablerResult.format) case x: BuildInfoEnablerResult => Json.toJson(x)(BuildInfoEnablerResult.format) case x: CircuitBreakerEnablerResult => Json.toJson(x)(CircuitBreakerEnablerResult.format) case x: ConductrEnablerResult => Json.toJson(x)(ConductrEnablerResult.format) case x: DockerEnablerResult => Json.toJson(x)(DockerEnablerResult.format) case x: FpEnablerResult => Json.toJson(x)(FpEnablerResult.format) case x: JsonEnablerResult => Json.toJson(x)(JsonEnablerResult.format) case x: LoggingEnablerResult => Json.toJson(x)(LoggingEnablerResult.format) case x: KafkaEnablerResult => Json.toJson(x)(KafkaEnablerResult.format) case x: ScalariformEnablerResult => Json.toJson(x)(ScalariformEnablerResult.format) case x: SbtHeaderEnablerResult => Json.toJson(x)(SbtHeaderEnablerResult.format) case x: SwaggerEnablerResult => Json.toJson(x)(SwaggerEnablerResult.format) case x: SparkEnablerResult => Json.toJson(x)(SparkEnablerResult.format) } Json.obj("class" -> result.getClass.getSimpleName, "object" -> json) } } implicit val format: Format[EnablerResult] = Format(reads, writes) } trait EnablerResult
dnvriend/sbt-scaffold-play
src/main/scala/com/github/dnvriend/scaffold/play/enabler/EnablerResult.scala
Scala
apache-2.0
5,383
package com.ibm.wuhan; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Servlet implementation class TestSessionlogout */ //注销 @WebServlet("/TestSessionlogout") public class TestSessionlogout extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public TestSessionlogout() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession session = request.getSession(false); if(session == null){ response.sendRedirect("index.jsp"); return; } session.removeAttribute("user"); response.sendRedirect("index.jsp"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
junhuwh/whbusapp-01
src/main/java/com/ibm/wuhan/TestSessionlogout.java
Java
apache-2.0
1,430
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.guardduty.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.guardduty.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.protocol.*; import com.amazonaws.protocol.Protocol; import com.amazonaws.annotation.SdkInternalApi; /** * CreateThreatIntelSetRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class CreateThreatIntelSetRequestProtocolMarshaller implements Marshaller<Request<CreateThreatIntelSetRequest>, CreateThreatIntelSetRequest> { private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON) .requestUri("/detector/{detectorId}/threatintelset").httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true) .serviceName("AmazonGuardDuty").build(); private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory; public CreateThreatIntelSetRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) { this.protocolFactory = protocolFactory; } public Request<CreateThreatIntelSetRequest> marshall(CreateThreatIntelSetRequest createThreatIntelSetRequest) { if (createThreatIntelSetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { final ProtocolRequestMarshaller<CreateThreatIntelSetRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING, createThreatIntelSetRequest); protocolMarshaller.startMarshalling(); CreateThreatIntelSetRequestMarshaller.getInstance().marshall(createThreatIntelSetRequest, protocolMarshaller); return protocolMarshaller.finishMarshalling(); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
jentfoo/aws-sdk-java
aws-java-sdk-guardduty/src/main/java/com/amazonaws/services/guardduty/model/transform/CreateThreatIntelSetRequestProtocolMarshaller.java
Java
apache-2.0
2,748
/* * Copyright 2015 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.uberfire.security.impl.authz; import java.util.List; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import org.jboss.errai.security.shared.api.identity.User; import org.uberfire.security.Resource; import org.uberfire.security.ResourceAction; import org.uberfire.security.ResourceType; import org.uberfire.security.authz.AuthorizationManager; import org.uberfire.security.authz.AuthorizationResult; import org.uberfire.security.authz.Permission; import org.uberfire.security.authz.PermissionCheck; import org.uberfire.security.authz.PermissionManager; import org.uberfire.security.authz.ResourceCheck; import org.uberfire.security.authz.VotingStrategy; import static org.uberfire.commons.validation.PortablePreconditions.*; @ApplicationScoped public class DefaultAuthorizationManager implements AuthorizationManager { private PermissionManager permissionManager; public DefaultAuthorizationManager() { } @Inject public DefaultAuthorizationManager(PermissionManager permissionManager) { this.permissionManager = permissionManager; } public boolean authorize(Resource resource, User user) { return authorize(resource, null, user, null); } @Override public boolean authorize(Resource resource, ResourceAction action, User user) { return authorize(resource, action, user, null); } @Override public boolean authorize(ResourceType resourceType, ResourceAction action, User user) { return authorize(resourceType, action, user, null); } @Override public boolean authorize(Resource resource, User user, VotingStrategy votingStrategy) { return authorize(resource, null, user, votingStrategy); } @Override public boolean authorize(Resource resource, ResourceAction action, User user, VotingStrategy votingStrategy) { checkNotNull("resource", resource); checkNotNull("subject", user); // A resource may depend on others List<Resource> deps = resource.getDependencies(); if (deps != null && !deps.isEmpty()) { // One dep is accessible for (Resource dep : deps) { boolean itemAccess = authorize(dep, action, user); if (itemAccess) { return true; } } // All deps denied return false; } // Ask the permission manager about the given action Permission p = permissionManager.createPermission(resource, action, true); return authorize(p, user, votingStrategy); } @Override public boolean authorize(ResourceType resourceType, ResourceAction action, User user, VotingStrategy votingStrategy) { // Ask the permission manager about the given action Permission p = permissionManager.createPermission(resourceType, action, true); return authorize(p, user, votingStrategy); } @Override public boolean authorize(String permission, User user) { return authorize(permission, user, null); } @Override public boolean authorize(Permission permission, User user) { return authorize(permission, user, null); } @Override public boolean authorize(String permission, User user, VotingStrategy votingStrategy) { Permission p = permissionManager.createPermission(permission, true); return authorize(p, user, votingStrategy); } @Override public boolean authorize(Permission permission, User user, VotingStrategy votingStrategy) { // If granted or abstain the return true. Reasons to abstain: // - no security policy defined // - no explicit permissions assigned AuthorizationResult result = permissionManager.checkPermission(permission, user, votingStrategy); return !AuthorizationResult.ACCESS_DENIED.equals(result); } @Override public ResourceCheck check(Resource target, User user) { return check(target, user, null); } @Override public ResourceCheck check(Resource target, User user, VotingStrategy votingStrategy) { return new ResourceCheckImpl(this, target, user, votingStrategy); } @Override public ResourceCheck check(ResourceType target, User user) { return check(target, user, null); } @Override public ResourceCheck check(ResourceType target, User user, VotingStrategy votingStrategy) { return new ResourceCheckImpl(this, target, user, votingStrategy); } @Override public PermissionCheck check(String permission, User user) { return check(permission, user, null); } @Override public PermissionCheck check(String permission, User user, VotingStrategy votingStrategy) { return new PermissionCheckImpl(permissionManager, permission, user, votingStrategy); } }
Salaboy/uberfire
uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultAuthorizationManager.java
Java
apache-2.0
5,517
# Team10182 ## DRW Trading College Prep - FTC Robotics Team A new season begins! #### The 2017-18 game is called Relic Recovery. - [Video explanation](https://www.youtube.com/watch?v=4xBHfwjfQGs) - [One page overview](https://firstinspiresst01.blob.core.windows.net/ftc/first-kj-relic-recovery-onepage.pdf) - [Training Document, other materials](https://www.firstinspires.org/resource-library/ftc/game-and-season-info) Resources: - [Rules Manual, Part 1](https://firstinspiresst01.blob.core.windows.net/ftc/game-ew-manual-part-1.pdf) - [Rules Manual, Part 2](https://firstinspiresst01.blob.core.windows.net/ftc/game-manual-dw-part-2.pdf) <- Start here. - [Engineering Notebook](https://www.firstinspires.org/sites/default/files/uploads/resource_library/ftc/engineering-notebook-guidelines.pdf) - [Tech Forum](https://ftcforum.usfirst.org/) - [Team Management Resources](https://www.firstinspires.org/resource-library/ftc/team-management-resources) - Main switchboard, tons of links. - [No pause after autonomous mode](https://www.facebook.com/FTCTeams/videos/2070644152961169/) - [Game and Season Materials](https://www.firstinspires.org/resource-library/ftc/game-and-season-info) - [2017 Programming/Configuration Notes](https://www.firstinspires.org/sites/default/files/uploads/resource_library/ftc/android-studio-tutorial.pdf) - Instructions for Rev Expansion Kit. This info is also [here](https://github.com/ftctechnh/ftc_app/wiki/Configuring-Your-Hardware) - [Video Overview of Sensors](http://modernroboticsinc.com/sensors) Things we need to order: - [Relic Recover Field Kit from Andy Mark](http://www.andymark.com/FTC17-18-p/am-3600.htm). Be sure to order the version with no mats since we already have the mats. The new Rev Robotics Expansion Hub: - [Explanatory Video](https://www.youtube.com/watch?v=7FIayseEtrk) - [Expansion Hub Guide](http://www.revrobotics.com/content/docs/REV-31-1153-GS.pdf) - [Step-by-Step Guide to Configuration using the new Rev Kit](https://github.com/ftctechnh/ftc_app/wiki/Configuring-Your-Hardware) - [A longer step-by-step guide which shows how to wire up Rev components]( https://www.firstinspires.org/sites/default/files/uploads/resource_library/ftc/android-studio-tutorial.pdf) - [All Rev Resources](http://www.revrobotics.com/resources) Notes: For teams using existing Modern Robotics I2C sensors, because the Expansion Hub uses a 3.3V logic-level while the Modern Robotics sensors use a 5V logic-level. A team will need to use a special adapter cable with a logic-level converter included that will allow their 5V Modern Robotics I2C sensors to be used with the new Expansion Hub. Teams will be able to purchase the cables and adapters through the FIRST storefront. For the other Modern Robotics sensors (touch sensor and optical distance sensor) the REV Robotics Expansion Hub kit will include 3.3V alternative sensors that work directly with the Expansion Hub. Teams also have the option of using their existing Modern Robotics Core Device Interface modules in parallel to an Expansion Hub to connect their existing 5V sensors to their Robot Controller.
rwoodley/Team10182
archive/2017-18/README.md
Markdown
apache-2.0
3,116
<?php /* Smarty version Smarty-3.1.13, created on 2014-02-27 00:04:36 compiled from "./templates/mpos/login/default.tpl" */ ?> <?php /*%%SmartyHeaderCode:1858245259530e1094ecd619-87351301%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed'); $_valid = $_smarty_tpl->decodeProperties(array ( 'file_dependency' => array ( '3273bee5274e88a8ab10e873a087bafc7a2dbd32' => array ( 0 => './templates/mpos/login/default.tpl', 1 => 1393430428, 2 => 'file', ), ), 'nocache_hash' => '1858245259530e1094ecd619-87351301', 'function' => array ( ), 'has_nocache_code' => false, 'version' => 'Smarty-3.1.13', 'unifunc' => 'content_530e109501b158_83435305', ),false); /*/%%SmartyHeaderCode%%*/?> <?php if ($_valid && !is_callable('content_530e109501b158_83435305')) {function content_530e109501b158_83435305($_smarty_tpl) {?><article class="module width_half"> <form action="<?php echo $_SERVER['PHP_SELF'];?> ?page=login" method="post" id="loginForm"> <input type="hidden" name="to" value="<?php echo htmlspecialchars(((($tmp = @$_REQUEST['to'])===null||$tmp==='' ? ((string)$_SERVER['PHP_SELF'])."?page=dashboard" : $tmp)), ENT_QUOTES, 'UTF-8', true);?> " /> <header><h3>Login</h3></header> <div class="module_content"> <fieldset> <label>User or Email</label> <input type="text" name="username" size="22" maxlength="100" value="<?php echo htmlspecialchars((($tmp = @$_REQUEST['username'])===null||$tmp==='' ? '' : $tmp), ENT_QUOTES, 'UTF-8', true);?> " placeholder="Your username or email" required /> </fieldset> <fieldset> <label>Password</label> <input type="password" name="password" size="22" maxlength="100" placeholder="Your password" required /> </fieldset> <div class="clear"></div> </div> <footer> <div class="submit_link"> <a href="<?php echo $_SERVER['PHP_SELF'];?> ?page=password"><font size="1">Forgot your password?</font></a> <input type="submit" value=Login" class="alt_btn" /> </div> </footer> </form> </article> <?php }} ?>
capslockLtsPool/qbc
public/templates/compile/3273bee5274e88a8ab10e873a087bafc7a2dbd32.file.default.tpl.php
PHP
apache-2.0
2,132
# coding=utf-8 # Copyright 2022 The Google Research 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. """Program tree representation.""" # pylint: skip-file import numpy as np from aloe.rfill.utils.rfill_consts import RFILL_EDGE_TYPES, RFILL_NODE_TYPES class ProgNode(object): """Token as node in program tree/graph.""" def __init__(self, syntax, value=None, subtrees=None): """Initializer. Args: syntax: string representation of syntax value: string representation of actual value subtrees: list of tuple(edge_type, subtree nodes or single node) """ self.syntax = syntax self.value = value self.children = [] if subtrees is not None: for e_type, children in subtrees: if isinstance(children, list): for c in children: add_edge(parent_node=self, child_node=c, edge_type=e_type) else: add_edge(parent_node=self, child_node=children, edge_type=e_type) def get_name(self): if self.value is None: return self.syntax return self.syntax + '-' + str(self.value) def add_child(self, edge_type, child_node): self.children.append((edge_type, child_node)) def pprint(self, tab_cnt=0): st = ' ' * tab_cnt + self.get_name() print(st) for _, c in self.children: c.pprint(tab_cnt=tab_cnt + 1) def __str__(self): st = '(' + self.get_name() for _, c in self.children: st += c.__str__() st += ')' return st class AbsRFillNode(ProgNode): """abstract Subclass of RFillNode.""" def pprint(self, tab_cnt=0): if self.syntax == 'RegexTok' or self.syntax == 'ConstTok': st = ' ' * tab_cnt + self.syntax + '(' _, p1 = self.children[0] _, p2 = self.children[1] _, direct = self.children[2] name = p1.value st += '%s, %d, %s)' % (name, p2.value, direct.value) print(st) return st = ' ' * tab_cnt + self.get_name() print(st) for _, c in self.children: c.pprint(tab_cnt=tab_cnt + 1) def filter_tree_nodes(root_node, key_set, out_list=None): if out_list is None: out_list = [] if root_node.syntax in key_set: out_list.append(root_node) for _, c in root_node.children: filter_tree_nodes(c, key_set, out_list=out_list) return out_list def add_edge(parent_node, child_node, edge_type): parent_node.add_child(edge_type, child_node) class ProgGraph(object): """Program graph""" def __init__(self, tree_root, node_types=RFILL_NODE_TYPES, edge_types=RFILL_EDGE_TYPES, add_rev_edge=True): """Initializer. Args: tree_root: ProgNode type; the root of tree representation node_types: dict of nodetype to index edge_types: dict of edgetype to index add_rev_edge: whether add reversed edge """ self.tree_root = tree_root self.add_rev_edge = add_rev_edge self.node_types = node_types self.edge_types = edge_types # list of tree nodes self.node_list = [] # node feature index self.node_feats = [] # list of (from_idx, to_idx, etype_int) tuples self.edge_list = [] self.last_terminal = None # used for linking terminals self.build_graph(self.tree_root) self.num_nodes = len(self.node_list) self.num_edges = len(self.edge_list) # unzipped version of edge list # self.from_list, self.to_list, self.edge_feats = \ # [np.array(x, dtype=np.int32) for x in zip(*self.edge_list)] self.node_feats = np.array(self.node_feats, dtype=np.int32) self.subexpr_ids = [] for _, c in self.tree_root.children: self.subexpr_ids.append(c.index) def render(self, render_path): """Render the program graph to specified path.""" import pygraphviz as pgv ag = pgv.AGraph(directed=True) e_idx2name = {} for key in self.edge_types: e_idx2name[self.edge_types[key]] = key for i, node in enumerate(self.node_list): ag.add_node(str(i) + '-' + node.get_name()) for e in self.edge_list: x, y, et = e ename = e_idx2name[et] if ename.startswith('rev-'): continue x = str(x) + '-' + self.node_list[x].get_name() y = str(y) + '-' + self.node_list[y].get_name() ag.add_edge(x, y) ag.layout(prog='dot') ag.draw(render_path) def add_bidir_edge(self, from_idx, to_idx, etype_str): assert etype_str in self.edge_types self.edge_list.append((from_idx, to_idx, self.edge_types[etype_str])) if self.add_rev_edge: # add reversed edge rev_etype_str = 'rev-' + etype_str assert rev_etype_str in self.edge_types self.edge_list.append((to_idx, from_idx, self.edge_types[rev_etype_str])) def build_graph(self, cur_root): """recursively build program graph from program tree. Args: cur_root: current root of (sub)program Returns: index: index of this cur_root node """ cur_root.index = len(self.node_list) self.node_list.append(cur_root) name = cur_root.get_name() if name not in self.node_types: raise NotImplementedError type_idx = self.node_types[name] cur_root.node_type = type_idx self.node_feats.append(type_idx) if len(cur_root.children): # pylint: disable=g-explicit-length-test for e_type, c in cur_root.children: child_idx = self.build_graph(c) self.add_bidir_edge(cur_root.index, child_idx, e_type) else: # add possible links between adjacent terminals if self.last_terminal is not None: self.add_bidir_edge(self.last_terminal.index, cur_root.index, 'succ') self.last_terminal = cur_root return cur_root.index
google-research/google-research
aloe/aloe/rfill/utils/program_struct.py
Python
apache-2.0
6,121
// Actions specific to an NPC. #include "../../common/resource/CResourceLock.h" #include "../../common/CException.h" #include "../../network/receive.h" #include "../clients/CClient.h" #include "../CWorldGameTime.h" #include "../CWorldMap.h" #include "../triggers.h" #include "CCharNPC.h" ////////////////////////// // CChar enum NV_TYPE { NV_BUY, NV_BYE, NV_FLEE, NV_GOTO, NV_HIRE, NV_LEAVE, NV_PETRETRIEVE, NV_PETSTABLE, NV_RELEASE, NV_RESTOCK, NV_RUN, NV_RUNTO, NV_SELL, NV_SHRINK, NV_TRAIN, NV_WALK, NV_QTY }; lpctstr const CCharNPC::sm_szVerbKeys[NV_QTY+1] = { "BUY", "BYE", "FLEE", "GOTO", "HIRE", "LEAVE", "PETRETRIEVE", "PETSTABLE", "RELEASE", "RESTOCK", "RUN", "RUNTO", "SELL", "SHRINK", "TRAIN", "WALK", nullptr }; void CChar::Action_StartSpecial( CREID_TYPE id ) { ADDTOCALLSTACK("CChar::Action_StartSpecial"); ASSERT(m_pNPC); // Take the special creature action. // lay egg, breath weapon (fire, lightning, acid, code, paralyze), // create web, fire patch, fire ball, // steal, teleport, level drain, absorb magic, curse items, // rust items, stealing, charge, hiding, grab, regenerate, play dead. // Water = put out fire ! if ( !g_Cfg.IsSkillFlag( Skill_GetActive(), SKF_NOANIM ) ) UpdateAnimate( ANIM_CAST_AREA ); switch ( id ) { case CREID_FIRE_ELEM: { // Leave a fire path CItem * pItem = CItem::CreateScript( Calc_GetRandVal(2) ? ITEMID_FX_FIRE_F_EW : ITEMID_FX_FIRE_F_NS, this ); ASSERT(pItem); pItem->SetType(IT_FIRE); pItem->m_itSpell.m_spell = (word)(SPELL_Fire_Field); pItem->m_itSpell.m_spelllevel = (word)(100 + Calc_GetRandVal(500)); pItem->m_itSpell.m_spellcharges = 1; pItem->m_uidLink = GetUID(); pItem->MoveToDecay( GetTopPoint(), 10 + Calc_GetRandVal(50)*MSECS_PER_SEC); } break; case CREID_GIANT_SPIDER: { // Leave a web path CItem * pItem = CItem::CreateScript( (ITEMID_TYPE)(Calc_GetRandVal2(ITEMID_WEB1_1, ITEMID_WEB1_4)), this ); ASSERT(pItem); pItem->SetType(IT_WEB); pItem->MoveToDecay( GetTopPoint(), 10 + Calc_GetRandVal(170)*MSECS_PER_SEC); } break; default: SysMessage( "You have no special abilities" ); return; } UpdateStatVal( STAT_DEX, (ushort)(-(5 + Calc_GetRandVal(5)) )); // the stamina cost } bool CChar::NPC_OnVerb( CScript &s, CTextConsole * pSrc ) // Execute command from script { ADDTOCALLSTACK("CChar::NPC_OnVerb"); ASSERT(m_pNPC); // Stuff that only NPC's do. CChar * pCharSrc = pSrc->GetChar(); switch ( FindTableSorted( s.GetKey(), CCharNPC::sm_szVerbKeys, CountOf(CCharNPC::sm_szVerbKeys)-1 )) { case NV_BUY: { // Open up the buy dialog. if ( pCharSrc == nullptr || !pCharSrc->IsClientActive()) return false; CClient * pClientSrc = pCharSrc->GetClientActive(); ASSERT(pClientSrc != nullptr); if ( !pClientSrc->addShopMenuBuy(this) ) Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_NO_GOODS)); else pClientSrc->m_TagDefs.SetNum("BUYSELLTIME", CWorldGameTime::GetCurrentTime().GetTimeRaw()); break; } case NV_BYE: Skill_Start( SKILL_NONE ); m_Act_UID.InitUID(); break; case NV_LEAVE: case NV_FLEE: // Short amount of fleeing. m_atFlee.m_iStepsMax = s.GetArgVal(); // how long should it take to get there. if ( ! m_atFlee.m_iStepsMax ) m_atFlee.m_iStepsMax = 20; m_atFlee.m_iStepsCurrent = 0; // how long has it taken ? Skill_Start( NPCACT_FLEE ); break; case NV_GOTO: m_Act_p = g_Cfg.GetRegionPoint( s.GetArgStr()); Skill_Start( NPCACT_GOTO ); break; case NV_HIRE: return NPC_OnHireHear( pCharSrc); case NV_PETRETRIEVE: return( NPC_StablePetRetrieve( pCharSrc )); case NV_PETSTABLE: return( NPC_StablePetSelect( pCharSrc )); case NV_RELEASE: NPC_PetRelease(); break; case NV_RESTOCK: // individual restock command. return NPC_Vendor_Restock(true, s.GetArgVal() != 0); case NV_RUN: m_Act_p = GetTopPoint(); m_Act_p.Move( GetDirStr( s.GetArgRaw())); NPC_WalkToPoint( true ); break; case NV_RUNTO: m_Act_p = g_Cfg.GetRegionPoint( s.GetArgStr()); Skill_Start( NPCACT_RUNTO ); break; case NV_SELL: { // Open up the sell dialog. if ( pCharSrc == nullptr || !pCharSrc->IsClientActive() ) return false; CClient * pClientSrc = pCharSrc->GetClientActive(); ASSERT(pClientSrc != nullptr); if ( ! pClientSrc->addShopMenuSell( this )) Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_VENDOR_NOTHING_BUY)); else pClientSrc->m_TagDefs.SetNum("BUYSELLTIME", CWorldGameTime::GetCurrentTime().GetTimeRaw()); break; } case NV_SHRINK: { // we must own it. if ( !NPC_IsOwnedBy( pCharSrc )) return false; CItem * pItem = NPC_Shrink(); // this deletes the char !!! if ( pItem ) pCharSrc->m_Act_UID = pItem->GetUID(); if (s.HasArgs()) pCharSrc->ItemBounce(pItem); return ( pItem != nullptr ); } case NV_TRAIN: return( NPC_OnTrainHear( pCharSrc, s.GetArgStr())); case NV_WALK: m_Act_p = GetTopPoint(); m_Act_p.Move( GetDirStr( s.GetArgRaw())); NPC_WalkToPoint( false ); break; default: // Eat all the CClient::sm_szVerbKeys and CCharPlayer::sm_szVerbKeys verbs ? //if ( FindTableSorted(s.GetKey(), CClient::sm_szVerbKeys, CountOf(sm_szVerbKeys)-1) < 0 ) return false; } return true; } void CChar::NPC_ActStart_SpeakTo( CChar * pSrc ) { ADDTOCALLSTACK("CChar::NPC_ActStart_SpeakTo"); ASSERT(m_pNPC); // My new action is that i am speaking to this person. // Or just update the amount of time i will wait for this person. m_Act_UID = pSrc->GetUID(); m_atTalk.m_dwWaitCount = 20; m_atTalk.m_dwHearUnknown = 0; Skill_Start( ( pSrc->GetFame() > 7000 ) ? NPCACT_TALK_FOLLOW : NPCACT_TALK ); SetTimeoutS(3); UpdateDir(pSrc); } void CChar::NPC_OnHear( lpctstr pszCmd, CChar * pSrc, bool fAllPets ) { ADDTOCALLSTACK("CChar::NPC_OnHear"); ASSERT(m_pNPC); // This CChar has heard you say something. if ( !pSrc ) return; // Pets always have a basic set of actions. if ( NPC_OnHearPetCmd(pszCmd, pSrc, fAllPets) || !NPC_CanSpeak() ) return; // What where we doing ? // too busy to talk ? switch ( Skill_GetActive()) { case SKILL_BEGGING: // busy begging. (hack) if ( !g_Cfg.IsSkillFlag( SKILL_BEGGING, SKF_SCRIPTED ) ) return; break; case NPCACT_TALK: case NPCACT_TALK_FOLLOW: // Was NPC talking to someone else ? if ( m_Act_UID != pSrc->GetUID()) { if ( NPC_Act_Talk() ) { CChar * pCharOld = m_Act_UID.CharFind(); if (pCharOld != nullptr) { tchar * z = Str_GetTemp(); snprintf(z, STR_TEMPLENGTH, g_Cfg.GetDefaultMsg(DEFMSG_NPC_GENERIC_INTERRUPT), pCharOld->GetName(), pSrc->GetName()); Speak(z); } } } break; default: break; } // I've heard them for the first time. CItemMemory * pMemory = Memory_FindObjTypes( pSrc, MEMORY_SPEAK ); if ( pMemory == nullptr ) { // This or CTRIG_SeeNewPlayer will be our first contact with people. if ( IsTrigUsed(TRIGGER_NPCHEARGREETING) ) { if ( OnTrigger( CTRIG_NPCHearGreeting, pSrc ) == TRIGRET_RET_TRUE ) return; } // record that we attempted to speak to them. pMemory = Memory_AddObjTypes(pSrc, MEMORY_SPEAK); if ( pMemory ) pMemory->m_itEqMemory.m_Action = NPC_MEM_ACT_FIRSTSPEAK; } // Do the scripts want me to take some action based on this speech. SKILL_TYPE skill = m_Act_SkillCurrent; TALKMODE_TYPE mode = TALKMODE_SAY; for ( size_t i = 0; i < m_pNPC->m_Speech.size(); ++i ) { CResourceLink * pLink = m_pNPC->m_Speech[i].GetRef(); if ( !pLink ) continue; CResourceLock s; if ( !pLink->ResourceLock(s) || !pLink->HasTrigger(XTRIG_UNKNOWN) ) continue; TRIGRET_TYPE iRet = OnHearTrigger(s, pszCmd, pSrc, mode); if ( iRet == TRIGRET_ENDIF || iRet == TRIGRET_RET_FALSE ) continue; if ( iRet == TRIGRET_RET_DEFAULT && skill == m_Act_SkillCurrent ) { // You are the new speaking target. NPC_ActStart_SpeakTo( pSrc ); } return; } CCharBase * pCharDef = Char_GetDef(); ASSERT(pCharDef != nullptr); for ( size_t i = 0; i < pCharDef->m_Speech.size(); ++i ) { CResourceLink * pLink = pCharDef->m_Speech[i].GetRef(); if ( !pLink ) continue; CResourceLock s; if ( !pLink->ResourceLock(s) ) continue; TRIGRET_TYPE iRet = OnHearTrigger( s, pszCmd, pSrc, mode ); if ( iRet == TRIGRET_ENDIF || iRet == TRIGRET_RET_FALSE ) continue; if ( iRet == TRIGRET_RET_DEFAULT && skill == m_Act_SkillCurrent ) { // You are the new speaking target. NPC_ActStart_SpeakTo( pSrc ); } return; } // hard code some default reactions. if ( m_pNPC->m_Brain == NPCBRAIN_HEALER || Skill_GetBase( SKILL_SPIRITSPEAK ) >= 1000 ) { if ( NPC_LookAtChar( pSrc, 1 )) return; } // can't figure you out. if ( IsTrigUsed(TRIGGER_NPCHEARUNKNOWN) ) { if ( OnTrigger( CTRIG_NPCHearUnknown, pSrc ) == TRIGRET_RET_TRUE ) return; } if ( (Skill_GetActive() == NPCACT_TALK) || (Skill_GetActive() == NPCACT_TALK_FOLLOW) ) { ++ m_atTalk.m_dwHearUnknown; uint iMaxUnk = 4; if ( GetDist( pSrc ) > 4 ) iMaxUnk = 1; if ( m_atTalk.m_dwHearUnknown > iMaxUnk ) { Skill_Start( SKILL_NONE ); // say good by } } } void CChar::NPC_OnNoticeSnoop( const CChar * pCharThief, const CChar * pCharMark ) { ADDTOCALLSTACK("CChar::NPC_OnNoticeSnoop"); ASSERT(m_pNPC); // start making them angry at you. static uint const sm_szTextSnoop[] = { DEFMSG_NPC_GENERIC_SNOOPED_1, DEFMSG_NPC_GENERIC_SNOOPED_2, DEFMSG_NPC_GENERIC_SNOOPED_3, DEFMSG_NPC_GENERIC_SNOOPED_4 }; if ( pCharMark != this ) // not me so who cares. return; if ( NPC_CanSpeak()) { Speak( g_Cfg.GetDefaultMsg(sm_szTextSnoop[ Calc_GetRandVal( CountOf( sm_szTextSnoop )) ])); } if ( ! Calc_GetRandVal(4)) { m_Act_UID = pCharThief->GetUID(); m_atFlee.m_iStepsMax = 20; // how long should it take to get there. m_atFlee.m_iStepsCurrent = 0; // how long has it taken ? Skill_Start( NPCACT_FLEE ); } } int CChar::NPC_WalkToPoint( bool fRun ) { ADDTOCALLSTACK("CChar::NPC_WalkToPoint"); ASSERT(m_pNPC); // Move toward my target . // // RETURN: // 0 = we are here. // 1 = took the step. // 2 = can't take this step right now. (obstacle) if (Can(CAN_C_NONMOVER)) return 0; const CCharBase *pCharDef = Char_GetDef(); const CPointMap pTarg = m_Act_p; CPointMap pMe = GetTopPoint(); int iDex = Stat_GetAdjusted(STAT_DEX); int iInt = Stat_GetAdjusted(STAT_INT); DIR_TYPE Dir = pMe.GetDir(pTarg); bool fUsePathfinding = false; EXC_TRY("NPC_WalkToPoint"); if ( Dir >= DIR_QTY ) return 0; // we are already in the spot if ( iDex <= 0 ) return 2; // we cannot move now EXC_SET_BLOCK("NPC_AI_PATH"); // Use pathfinding if ( NPC_GetAiFlags() & NPC_AI_PATH ) { NPC_Pathfinding(); // walk the saved path CPointMap local; local.m_x = m_pNPC->m_nextX[0]; local.m_y = m_pNPC->m_nextY[0]; local.m_map = pMe.m_map; // no steps available yet, or pathfinding not usable in this situation // so, use default movements if (local.m_x > 0 && local.m_y > 0) { fUsePathfinding = true; if ( pMe.GetDist(local) != 1 ) { // The next step is too far away, pathfinding route has become invalid m_pNPC->m_nextPt.InitPoint(); m_pNPC->m_nextX[0] = 0; m_pNPC->m_nextY[0] = 0; } else { // Update our heading to the way we need to go Dir = pMe.GetDir(local); ASSERT(Dir > DIR_INVALID && Dir < DIR_QTY); EXC_TRYSUB("Array Shift"); // also shift the steps array for ( int j = 0; j < (MAX_NPC_PATH_STORAGE_SIZE - 1); ++j ) { m_pNPC->m_nextX[j] = m_pNPC->m_nextX[j+1]; m_pNPC->m_nextY[j] = m_pNPC->m_nextY[j+1]; } m_pNPC->m_nextX[MAX_NPC_PATH_STORAGE_SIZE - 1] = 0; m_pNPC->m_nextY[MAX_NPC_PATH_STORAGE_SIZE - 1] = 0; EXC_CATCHSUB("NPCAI"); } } } EXC_SET_BLOCK("Non-Advanced pathfinding"); pMe.Move( Dir ); if ( ! CanMoveWalkTo(pMe, true, false, Dir ) ) { CPointMap ptFirstTry = pMe; // try to step around it ? int iDiff = 0; int iRand = Calc_GetRandVal( 100 ); if ( iRand < 30 ) // do nothing. { // whilst pathfinding we should keep trying to find new ways to our destination if ( fUsePathfinding == true ) { SetTimeoutD( 5 ); // wait a moment before finding a new route return 1; } return 2; } if ( iRand < 35 ) iDiff = 4; // 5 else if ( iRand < 40 ) iDiff = 3; // 10 else if ( iRand < 65 ) iDiff = 2; else iDiff = 1; if ( iRand & 1 ) iDiff = -iDiff; pMe = GetTopPoint(); Dir = GetDirTurn( Dir, iDiff ); pMe.Move( Dir ); if ( ! CanMoveWalkTo(pMe, true, false, Dir )) { bool fClearedWay = false; // Some object in my way that i could move ? Try to move it. if ( !Can(CAN_C_USEHANDS) || Can(CAN_C_STATUE) || IsStatFlag(STATF_DEAD|STATF_SLEEPING|STATF_FREEZE|STATF_STONE) ) ; // i cannot use hands or i am frozen, so cannot move objects else if ( (NPC_GetAiFlags() & NPC_AI_MOVEOBSTACLES) && (iInt > iRand) ) { int i; CPointMap point; for ( i = 0; i < 2; ++i ) { if ( !i ) point = pMe; else point = ptFirstTry; // Scan point for items that could be moved by me and move them to my position CWorldSearch AreaItems(point); for (;;) { CItem *pItem = AreaItems.GetItem(); if ( !pItem ) break; else if ( abs(pItem->GetTopZ() - pMe.m_z) > 3 ) continue; // item is too high else if ( !pItem->Can(CAN_I_BLOCK) ) continue; // this item not blocking me else if ( !CanMove(pItem) || !CanCarry(pItem) ) fClearedWay = false; else { // move this item to the position I am currently in pItem->MoveToUpdate(GetTopPoint()); fClearedWay = true; break; } } if ( fClearedWay ) break; // If not cleared the way still, but I am still clever enough // I should try to move in the first step I was trying to move to else if ( iInt < iRand*3 ) break; } // we have just cleared our way if ( fClearedWay ) { if ( point == ptFirstTry ) { Dir = GetTopPoint().GetDir(m_Act_p); ASSERT(Dir > DIR_INVALID && Dir < DIR_QTY); if (Dir >= DIR_QTY) fClearedWay = false; } } } if ( !fClearedWay ) { // whilst pathfinding we should keep trying to find new ways to our destination if ( fUsePathfinding ) { SetTimeoutD( 5 ); // wait a moment before finding a new route return 1; } return 2; } } } EXC_SET_BLOCK("Finishing Move Action a"); //Finish Move Action // ??? Make sure we are not facing a wall. ASSERT(Dir > DIR_INVALID && Dir < DIR_QTY); m_dirFace = Dir; // Face this direction. if ( fRun && ( ! Can(CAN_C_RUN|CAN_C_FLY) || Stat_GetVal(STAT_DEX) <= 1 )) fRun = false; EXC_SET_BLOCK("StatFlag"); StatFlag_Mod(STATF_FLY, fRun); EXC_SET_BLOCK("Old Top Point"); const CPointMap ptOld = GetTopPoint(); EXC_SET_BLOCK("Reveal"); CheckRevealOnMove(); EXC_SET_BLOCK("MoveToChar"); if (!MoveToChar(pMe, false, true)) return 2; EXC_SET_BLOCK("Move Update"); UpdateMove(ptOld); EXC_SET_BLOCK("Speed counting"); // How fast can they move. int64 iTickNext; // TAG.OVERRIDE.MOVERATE int64 tTick; CVarDefCont * pVal = GetKey("OVERRIDE.MOVEDELAY", true); if (pVal) { iTickNext = pVal->GetValNum(); // foot walking speed if (IsStatFlag(STATF_ONHORSE | STATF_HOVERING)) // On Mount { if (IsStatFlag(STATF_FLY)) // Running { iTickNext /= 4; // 4 times faster when running while it's on a mount } else { iTickNext /= 2; // 2 times faster when walking while it's on a mount } } else { if (IsStatFlag(STATF_FLY)) { iTickNext /= 2; // 2 times faster when running. } } } else { CVarDefCont * pValue = GetKey("OVERRIDE.MOVERATE", true); if (pValue) tTick = pValue->GetValNum(); //Taking value from tag.override.moverate else tTick = pCharDef->m_iMoveRate; //no tag.override.moverate, we get default moverate (created from ini's one). // END TAG.OVERRIDE.MOVERATE if (fRun) { if (IsStatFlag(STATF_PET)) // pets run a little faster. { if (iDex < 75) iDex = 75; } iTickNext = MSECS_PER_SEC / 4 + Calc_GetRandLLVal((100 - (iDex*tTick) / 100) / 5) * MSECS_PER_SEC / 10; // TODO MSEC to TICK? custom timers for npc's movement? } else iTickNext = MSECS_PER_SEC + Calc_GetRandLLVal((100 - (iDex*tTick) / 100) / 3) * MSECS_PER_SEC / 10; } if (iTickNext < MSECS_PER_TENTH) // Do not allow less than a tenth of second. This may be decreased in the future to allow more precise timers, at the cost of cpu. iTickNext = MSECS_PER_TENTH; else if (iTickNext > 5 * MSECS_PER_SEC) // neither more than 5 seconds. iTickNext = 5 * MSECS_PER_SEC; SetTimeout(iTickNext); EXC_CATCH; return 1; } bool CChar::NPC_LookAtCharGuard( CChar * pChar, bool bFromTrigger ) { ADDTOCALLSTACK("CChar::NPC_LookAtCharGuard"); ASSERT(m_pNPC); // Does the guard hate the target ? // do not waste time on invul+dead, non-criminal and jailed chars if ( ((pChar->IsStatFlag(STATF_INVUL|STATF_DEAD) || pChar->Can(CAN_C_STATUE) || pChar->IsPriv(PRIV_JAILED)) && !bFromTrigger) || !(pChar->Noto_IsCriminal() || pChar->Noto_IsEvil()) ) return false; if ( ! pChar->m_pArea->IsGuarded()) { static uint const sm_szSpeakGuardJeer[] = { DEFMSG_NPC_GUARD_THREAT_1, DEFMSG_NPC_GUARD_THREAT_2, DEFMSG_NPC_GUARD_THREAT_3, DEFMSG_NPC_GUARD_THREAT_4, DEFMSG_NPC_GUARD_THREAT_5 }; // At least jeer at the criminal. if ( Calc_GetRandVal(10)) return false; tchar *pszMsg = Str_GetTemp(); snprintf(pszMsg, STR_TEMPLENGTH, g_Cfg.GetDefaultMsg(sm_szSpeakGuardJeer[ Calc_GetRandVal( CountOf( sm_szSpeakGuardJeer )) ]), pChar->GetName()); Speak(pszMsg); UpdateDir(pChar); return false; } static uint const sm_szSpeakGuardStrike[] = { DEFMSG_NPC_GUARD_STRIKE_1, DEFMSG_NPC_GUARD_STRIKE_2, DEFMSG_NPC_GUARD_STRIKE_3, DEFMSG_NPC_GUARD_STRIKE_4, DEFMSG_NPC_GUARD_STRIKE_5 }; if ( GetTopDist3D(pChar) > 1 ) { if ( g_Cfg.m_fGuardsInstantKill || pChar->Skill_GetBase(SKILL_MAGERY) ) Spell_Teleport(pChar->GetTopPoint(), false, false); // If we got intant kill guards enabled, allow the guards to swing immidiately if ( g_Cfg.m_fGuardsInstantKill ) { pChar->Stat_SetVal(STAT_STR, 1); Fight_Hit(pChar); } } if ( !IsStatFlag(STATF_WAR) || m_Act_UID != pChar->GetUID() ) { Speak(g_Cfg.GetDefaultMsg(sm_szSpeakGuardStrike[Calc_GetRandVal(CountOf(sm_szSpeakGuardStrike))])); Fight_Attack(pChar, true); } return true; } bool CChar::NPC_LookAtCharMonster( CChar * pChar ) { ADDTOCALLSTACK("CChar::NPC_LookAtCharMonster"); ASSERT(m_pNPC); // return: // true = take new action. // false = continue with any previous action. // motivation level = // 0 = not at all. // 100 = definitly. // int iFoodLevel = Food_GetLevelPercent(); // Attacks those not of my kind. if ( ! Noto_IsCriminal() && (iFoodLevel > 40) ) // Am I not evil ? return NPC_LookAtCharHuman( pChar ); // Attack if i am stronger, if it's the same target i was attacking, or i'm just stupid. int iActMotivation = NPC_GetAttackMotivation(pChar); if (iActMotivation <= 0) return false; if ( iActMotivation < m_pNPC->m_Act_Motivation ) return false; int iDist = GetTopDist3D( pChar ); if ( IsStatFlag( STATF_HIDDEN ) && ! NPC_FightMayCast() && (iDist > 1) ) return false; // element of suprise. if ( Fight_Attack( pChar ) == false ) return false; m_pNPC->m_Act_Motivation = (uchar)iActMotivation; return true; } bool CChar::NPC_LookAtCharHuman( CChar * pChar ) { ADDTOCALLSTACK("CChar::NPC_LookAtCharHuman"); ASSERT(m_pNPC); if ( IsStatFlag(STATF_DEAD) || pChar->IsStatFlag(STATF_DEAD) || pChar->Can(CAN_C_STATUE) ) return false; if ( Noto_IsEvil()) // I am evil. { // Attack others if we are evil. return NPC_LookAtCharMonster( pChar ); } if (( ! pChar->Noto_IsEvil() && g_Cfg.m_fGuardsOnMurderers) && (! pChar->IsStatFlag( STATF_CRIMINAL ))) // not interesting. return false; // Yell for guard if we see someone evil. if (m_pArea->IsGuarded()) { if (m_pNPC->m_Brain == NPCBRAIN_GUARD) { return NPC_LookAtCharGuard(pChar); } else if (NPC_CanSpeak() && !Calc_GetRandVal(3)) { // Find a guard. if (CallGuards(pChar)) { Speak(pChar->IsStatFlag(STATF_CRIMINAL) ? g_Cfg.GetDefaultMsg(DEFMSG_NPC_GENERIC_SEECRIM) : g_Cfg.GetDefaultMsg(DEFMSG_NPC_GENERIC_SEEMONS)); // only speak if can really call the guards. } if (IsStatFlag(STATF_WAR)) return false; // run away like a coward. m_Act_UID = pChar->GetUID(); m_atFlee.m_iStepsMax = 20; // how long should it take to get there. m_atFlee.m_iStepsCurrent = 0; // how long has it taken ? Skill_Start(NPCACT_FLEE); m_pNPC->m_Act_Motivation = 80; return true; } } // Attack an evil creature ? return false; } bool CChar::NPC_LookAtCharHealer( CChar * pChar ) { ADDTOCALLSTACK("CChar::NPC_LookAtCharHealer"); ASSERT(m_pNPC); if ( !pChar->IsStatFlag(STATF_DEAD) || pChar->IsStatFlag(STATF_STONE) || pChar->Can(CAN_C_STATUE) || (pChar->m_pNPC && pChar->m_pNPC->m_bonded) ) return false; static lpctstr const sm_szHealerRefuseEvils[] = { g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_EVIL_1 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_EVIL_2 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_EVIL_3 ) }; static lpctstr const sm_szHealerRefuseCriminals[] = { g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_CRIM_1 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_CRIM_2 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_CRIM_3 ) }; static lpctstr const sm_szHealerRefuseGoods[] = { g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_GOOD_1 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_GOOD_2 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_REF_GOOD_3 ) }; static lpctstr const sm_szHealer[] = { g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_RES_1 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_RES_2 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_RES_3 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_RES_4 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_RES_5 ) }; UpdateDir( pChar ); lpctstr pszRefuseMsg; int iDist = GetDist( pChar ); if ( pChar->IsStatFlag( STATF_INSUBSTANTIAL )) { pszRefuseMsg = g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_MANIFEST ); if ( Calc_GetRandVal(5) || iDist > 3 ) return false; Speak( pszRefuseMsg ); return true; } if ( iDist > 3 ) { if ( Calc_GetRandVal(5)) return false; Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_RANGE ) ); return true; } // What noto is this char to me ? bool ImEvil = Noto_IsEvil(); bool ImNeutral = Noto_IsNeutral(); NOTO_TYPE NotoThem = pChar->Noto_GetFlag( this, true ); if ( !IsStatFlag( STATF_CRIMINAL ) && NotoThem == NOTO_CRIMINAL ) { pszRefuseMsg = sm_szHealerRefuseCriminals[ Calc_GetRandVal( CountOf( sm_szHealerRefuseCriminals )) ]; if ( Calc_GetRandVal(5) || iDist > 3 ) return false; Speak( pszRefuseMsg ); return true; } if (( !ImNeutral && !ImEvil) && NotoThem >= NOTO_NEUTRAL ) { pszRefuseMsg = sm_szHealerRefuseEvils[ Calc_GetRandVal( CountOf( sm_szHealerRefuseEvils )) ]; if ( Calc_GetRandVal(5) || iDist > 3 ) return false; Speak( pszRefuseMsg ); return true; } if (( ImNeutral || ImEvil ) && NotoThem == NOTO_GOOD ) { pszRefuseMsg = sm_szHealerRefuseGoods[ Calc_GetRandVal( CountOf( sm_szHealerRefuseGoods )) ]; if ( Calc_GetRandVal(5) || iDist > 3 ) return false; Speak( pszRefuseMsg ); return true; } // Attempt to res. Speak( sm_szHealer[ Calc_GetRandVal( CountOf( sm_szHealer )) ] ); UpdateAnimate( ANIM_CAST_AREA ); if ( ! pChar->OnSpellEffect( SPELL_Resurrection, this, 1000, nullptr )) { if ( Calc_GetRandVal(2)) Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_FAIL_1 ) ); else Speak( g_Cfg.GetDefaultMsg( DEFMSG_NPC_HEALER_FAIL_2 ) ); } return true; } // I might want to go pickup this item ? bool CChar::NPC_LookAtItem( CItem * pItem, int iDist ) { ADDTOCALLSTACK("CChar::NPC_LookAtItem"); ASSERT(m_pNPC); if ( !Can(CAN_C_USEHANDS) || !CanSee(pItem) ) return false; int iWantThisItem = NPC_WantThisItem(pItem); if ( IsTrigUsed(TRIGGER_NPCLOOKATITEM) ) { if ( IsTrigUsed(TRIGGER_NPCLOOKATITEM) && !pItem->IsAttr(ATTR_MOVE_NEVER|ATTR_LOCKEDDOWN|ATTR_SECURE) ) { CScriptTriggerArgs Args(iDist, iWantThisItem, pItem); switch ( OnTrigger(CTRIG_NPCLookAtItem, this, &Args) ) { case TRIGRET_RET_TRUE: return true; case TRIGRET_RET_FALSE: return false; default: break; } iWantThisItem = (int)(Args.m_iN2); } } // Loot nearby items on ground if ( iWantThisItem > Calc_GetRandVal(100) ) { m_Act_UID = pItem->GetUID(); NPC_Act_Looting(); return true; } // Loot nearby corpses if ( pItem->IsType(IT_CORPSE) && (NPC_GetAiFlags() & NPC_AI_LOOTING) && (Memory_FindObj(pItem) == nullptr) ) { m_Act_UID = pItem->GetUID(); NPC_Act_Looting(); return true; } // Check for doors we can open if ( pItem->IsType(IT_DOOR) && GetDist(pItem) <= 1 && CanTouch(pItem) && !Calc_GetRandVal(2) ) { if ( pItem->IsDoorOpen() ) // door is already open return false; UpdateDir(pItem); if ( !Use_Item(pItem) ) // try to open it return false; // Walk through it CPointMap pt = GetTopPoint(); pt.MoveN(GetDir(pItem), 2); if ( CanMoveWalkTo(pt) ) { m_Act_p = pt; NPC_WalkToPoint(); return true; } } return false; } bool CChar::NPC_LookAtChar( CChar * pChar, int iDist ) { ADDTOCALLSTACK("CChar::NPC_LookAtChar"); ASSERT(m_pNPC); // I see a char. // Do I want to do something to this char (more that what i'm already doing ?) // RETURN: // true = yes i do want to take a new action. // Don't call this function frequently, since CanSeeLOS is an expensive function (lot of calculations but // most importantly it has to read the UO files, and file I/O is slow) if ( !pChar || ( pChar == this ) || !CanSeeLOS(pChar,LOS_NB_WINDOWS) ) //Flag - we can attack through a window return false; if ( IsTrigUsed(TRIGGER_NPCLOOKATCHAR) ) { switch ( OnTrigger(CTRIG_NPCLookAtChar, pChar) ) { case TRIGRET_RET_TRUE: return true; case TRIGRET_RET_FALSE: return false; default: break; } } if (m_pNPC->m_Brain != NPCBRAIN_BERSERK) { if ( NPC_IsOwnedBy( pChar, false )) { // follow my owner again. (Default action) m_Act_UID = pChar->GetUID(); m_pNPC->m_Act_Motivation = 50; Skill_Start( (Skill_GetActive() == NPCACT_FOLLOW_TARG) ? NPCACT_FOLLOW_TARG : NPCACT_GUARD_TARG); return true; } else { // initiate a conversation ? if ( ! IsStatFlag( STATF_WAR ) && ( (Skill_GetActive() == SKILL_NONE) || (Skill_GetActive() == NPCACT_WANDER) ) && // I'm idle pChar->m_pPlayer && ! Memory_FindObjTypes( pChar, MEMORY_SPEAK )) { if ( IsTrigUsed(TRIGGER_NPCSEENEWPLAYER) ) { if ( OnTrigger( CTRIG_NPCSeeNewPlayer, pChar ) != TRIGRET_RET_TRUE ) { // record that we attempted to speak to them. CItemMemory * pMemory = Memory_AddObjTypes( pChar, MEMORY_SPEAK ); if ( pMemory ) pMemory->m_itEqMemory.m_Action = NPC_MEM_ACT_FIRSTSPEAK; // m_Act_Hear_Unknown = 0; } } } } } if (IsStatFlag(STATF_DEAD)) return false; switch ( m_pNPC->m_Brain ) // my type of brain { case NPCBRAIN_GUARD: // Guards should look around for criminals or nasty creatures. if ( NPC_LookAtCharGuard( pChar )) return true; break; case NPCBRAIN_MONSTER: case NPCBRAIN_DRAGON: if ( NPC_LookAtCharMonster( pChar )) return true; break; case NPCBRAIN_BERSERK: // Blade Spirits or Energy Vortex. // Attack everyone you see! if ( Fight_IsActive()) // Is this a better target than my last ? { CChar * pCharTarg = m_Act_UID.CharFind(); if ( pCharTarg && (GetTopDist3D(pCharTarg) <= iDist) ) return true; } if ( Fight_Attack( pChar ) ) return true; break; case NPCBRAIN_HEALER: // Healers should look around for ghosts. if ( NPC_LookAtCharHealer( pChar )) return true; if ( NPC_LookAtCharHuman( pChar )) return true; break; case NPCBRAIN_BANKER: case NPCBRAIN_VENDOR: case NPCBRAIN_STABLE: case NPCBRAIN_ANIMAL: case NPCBRAIN_HUMAN: if ( NPC_LookAtCharHuman(pChar) ) return true; break; default: break; } return false; } bool CChar::NPC_LookAround( bool fForceCheckItems ) { ADDTOCALLSTACK("CChar::NPC_LookAround"); ASSERT(m_pNPC); // Take a look around for other people/chars. // We may be doing something already. So check current action motivation level. // RETURN: // true = found something better to do. CSector *pSector = GetTopSector(); if ( !m_pNPC || !pSector ) return false; // Call the rand function once, since repeated calls can be expensive (and this function is called a LOT of times, if there are lots of active NPCs) const int iRand = Calc_GetRandVal(UO_MAP_VIEW_RADAR); const CPointMap& ptTop = GetTopPoint(); int iRange = GetVisualRange(); if (iRange > UO_MAP_VIEW_RADAR) iRange = UO_MAP_VIEW_RADAR; int iRangeBlur = UO_MAP_VIEW_SIGHT; // If I can't move don't look too far. if ( Can(CAN_C_NONMOVER) || !Can(CAN_C_MOVEMENTCAPABLEMASK) || IsStatFlag(STATF_FREEZE|STATF_STONE) ) { if ( !NPC_FightMayCast() ) // And i have no distance attack. iRange = iRangeBlur = 2; } else { // I'm mobile. do basic check if i would move here first. if ( !NPC_CheckWalkHere(ptTop, m_pArea) ) { // I should move. Someone lit a fire under me. m_Act_p = ptTop; m_Act_p.Move((DIR_TYPE)(iRand % DIR_QTY)); NPC_WalkToPoint(true); SoundChar(CRESND_NOTICE); return true; } if ( Stat_GetAdjusted(STAT_INT) < 50 ) iRangeBlur /= 2; } // If sector is too complex, lower the number of chars we look at to keep some performance if ( pSector->GetCharComplexity() > (g_Cfg.m_iMaxCharComplexity / 2) ) iRange /= 4; // Any interesting chars here ? int iDist = 0; CChar *pChar = nullptr; CWorldSearch AreaChars(ptTop, iRange); for (;;) { pChar = AreaChars.GetChar(); if ( !pChar ) break; if ( pChar == this ) // just myself. continue; iDist = GetTopDist3D(pChar); if ( iDist > iRangeBlur ) { if (iRand % iDist ) continue; // can't see them. } if ( NPC_LookAtChar(pChar, iDist) ) // expensive function call { SoundChar(CRESND_NOTICE); return true; } } // Check the ground for good stuff. if ( !fForceCheckItems && (Stat_GetAdjusted(STAT_INT) > 10) && !IsSkillBase(Skill_GetActive()) && !(iRand % 3) ) fForceCheckItems = true; if ( fForceCheckItems ) { CItem *pItem = nullptr; CWorldSearch AreaItems(ptTop, iRange); for (;;) { pItem = AreaItems.GetItem(); if ( !pItem ) break; iDist = GetTopDist3D(pItem); if ( iDist > iRangeBlur ) { if ( iRand % iDist ) continue; // can't see them. } if ( NPC_LookAtItem(pItem, iDist) ) { if (!IsPlayableCharacter()) SoundChar(CRESND_NOTICE); return true; } } } if ( !IsPlayableCharacter() && ( (m_pNPC->m_Brain == NPCBRAIN_BERSERK) || !(iRand % 6) ) ) SoundChar(CRESND_IDLE); // Move stuff that is in our way ? (chests etc.) return false; } void CChar::NPC_Act_Wander() { ADDTOCALLSTACK("CChar::NPC_Act_Wander"); ASSERT(m_pNPC); // NPCACT_WANDER // just wander aimlessly. (but within bounds) // Stop wandering and re-eval frequently if ( Can(CAN_C_NONMOVER) ) return; // Call the rand function once, since repeated calls can be expensive (and this function is called a LOT of times, if there are lots of active NPCs) const int iRand = Calc_GetRandVal(UINT16_MAX); int iStopWandering = 0; if ( !(iRand % (7 + (Stat_GetVal(STAT_DEX) / 30))) ) iStopWandering = 1; // i'm stopping to wander "for the dexterity". if ( !(iRand % (2 + TICKS_PER_SEC/2)) ) { // NPC_LookAround() is very expensive, so since NPC_Act_Wander is called every tick for every char with ACTION == NPCACT_WANDER, // don't look around every time. if ( NPC_LookAround() ) iStopWandering = 2; // i'm stopping to wander because i have seen something interesting } // Staggering Walk around. m_Act_p = GetTopPoint(); m_Act_p.Move( GetDirTurn(m_dirFace, 1 - (iRand % 3)) ); int iReturnToHome = 0; if ( m_pNPC->m_Home_Dist_Wander && m_ptHome.IsValidPoint() ) { if ( m_Act_p.GetDist(m_ptHome) > m_pNPC->m_Home_Dist_Wander ) iReturnToHome = 1; } if (IsTrigUsed(TRIGGER_NPCACTWANDER)) { CScriptTriggerArgs Args(iStopWandering, iReturnToHome); if (OnTrigger(CTRIG_NPCActWander, this, &Args) == TRIGRET_RET_TRUE) return; iStopWandering = (int)Args.m_iN1; iReturnToHome = (int)Args.m_iN2; } if (iStopWandering) Skill_Start( SKILL_NONE ); else { if (iReturnToHome) Skill_Start(NPCACT_GO_HOME); else NPC_WalkToPoint(); } } void CChar::NPC_Act_Guard() { ADDTOCALLSTACK("CChar::NPC_Act_Guard"); ASSERT(m_pNPC); // Protect our target or owner. (m_Act_UID) CChar * pChar = m_Act_UID.CharFind(); if ( pChar != nullptr && pChar != this && CanSeeLOS(pChar, LOS_NB_WINDOWS) ) { if ( pChar->Fight_IsActive() ) // protect the target if they're in a fight { if ( Fight_Attack( pChar->m_Fight_Targ_UID.CharFind() )) return; } } // Target is out of range or doesn't need protecting, so just follow for now //NPC_LookAtChar(pChar, 1); NPC_Act_Follow(); } bool CChar::NPC_Act_Follow(bool fFlee, int maxDistance, bool fMoveAway) { ADDTOCALLSTACK("CChar::NPC_Act_Follow"); ASSERT(m_pNPC); // Follow our target or owner (m_Act_UID), we may be fighting (m_Fight_Targ_UID). // false = can't follow any more, give up. if (Can(CAN_C_NONMOVER)) return false; EXC_TRY("NPC_Act_Follow"); CChar * pChar = Fight_IsActive() ? m_Fight_Targ_UID.CharFind() : m_Act_UID.CharFind(); if (pChar == nullptr) { // free to do as i wish ! Skill_Start(SKILL_NONE); return false; } EXC_SET_BLOCK("Trigger"); if (IsTrigUsed(TRIGGER_NPCACTFOLLOW)) { CScriptTriggerArgs Args(fFlee, maxDistance, fMoveAway); switch (OnTrigger(CTRIG_NPCActFollow, pChar, &Args)) { case TRIGRET_RET_TRUE: { return false; } case TRIGRET_RET_FALSE: { return true; } default: { break; } } fFlee = (Args.m_iN1 != 0); maxDistance = static_cast<int>(Args.m_iN2); fMoveAway = (Args.m_iN3 != 0); } EXC_SET_BLOCK("CanSee"); // Have to be able to see target to follow. if (CanSee(pChar)) { m_Act_p = pChar->GetTopPoint(); } else { // Monster may get confused because he can't see you. // There is a chance they could forget about you if hidden for a while. if (fFlee || !Calc_GetRandVal(1 + ((100 - Stat_GetAdjusted(STAT_INT)) / 20))) { return false; } } EXC_SET_BLOCK("Distance checks"); const CPointMap& ptMe = GetTopPoint(); int dist = ptMe.GetDist(m_Act_p); if (dist > UO_MAP_VIEW_RADAR) // too far away ? { return false; } if (fMoveAway) { if (dist < maxDistance) { fFlee = true; // start moving away } } else { if (fFlee) { if (dist >= maxDistance) { return false; } } else if (dist <= maxDistance) { return true; } } EXC_SET_BLOCK("Fleeing"); if (fFlee) { CPointMap ptOld = m_Act_p; m_Act_p = ptMe; m_Act_p.Move(GetDirTurn(m_Act_p.GetDir(ptOld), 4 + 1 - Calc_GetRandVal(3))); int iRet = NPC_WalkToPoint(dist > 3); m_Act_p = ptOld; // last known point of the enemy. return (iRet < 2); // 2 = fail } EXC_SET_BLOCK("WalkToPoint 1"); return (NPC_WalkToPoint(IsStatFlag(STATF_WAR) ? true : (dist > 3)) < 2); // 2 = fail EXC_CATCH; return false; } bool CChar::NPC_Act_Talk() { ADDTOCALLSTACK("CChar::NPC_Act_Talk"); ASSERT(m_pNPC); // NPCACT_TALK: // NPCACT_TALK_FOLLOW // RETURN: // false = do something else. go Idle // true = just keep waiting. CChar * pChar = m_Act_UID.CharFind(); if ( pChar == nullptr ) // they are gone ? return false; // too far away. int iDist = GetTopDist3D( pChar ); if (( iDist >= UO_MAP_VIEW_SIGHT ) || ( m_ptHome.GetDist3D( pChar->GetTopPoint() ) > m_pNPC->m_Home_Dist_Wander )) // give up. return false; // can't see them if ( !CanSee( pChar ) ) return false; if ( Skill_GetActive() == NPCACT_TALK_FOLLOW && iDist > 3 ) { // try to move closer. if ( ! NPC_Act_Follow( false, 4, false ) ) return false; } if ( m_atTalk.m_dwWaitCount <= 1 ) { if ( NPC_CanSpeak() ) { static lpctstr const sm_szText[] = { g_Cfg.GetDefaultMsg( DEFMSG_NPC_GENERIC_GONE_1 ), g_Cfg.GetDefaultMsg( DEFMSG_NPC_GENERIC_GONE_2 ) }; tchar *pszMsg = Str_GetTemp(); snprintf(pszMsg, STR_TEMPLENGTH, sm_szText[ Calc_GetRandVal(CountOf(sm_szText)) ], pChar->GetName() ); Speak(pszMsg); } return false; } --m_atTalk.m_dwWaitCount; return true; // just keep waiting. } void CChar::NPC_Act_GoHome() { ADDTOCALLSTACK("CChar::NPC_Act_GoHome"); ASSERT(m_pNPC); // NPCACT_GO_HOME // If our home is not valid then if ( !Calc_GetRandVal(3) && NPC_LookAround()) return; if ( m_pNPC->m_Brain == NPCBRAIN_GUARD ) { // Had to change this guards were still roaming the forests // this goes hand in hand with the change that guards arent // called if the criminal makes it outside guarded territory. const CRegion * pAreaHome = m_ptHome.GetRegion( REGION_TYPE_AREA ); if ( pAreaHome && pAreaHome->IsGuarded()) { if ( !m_pArea || !m_pArea->IsGuarded() ) { if ( Spell_Teleport(m_ptHome, false, false) ) { Skill_Start(SKILL_NONE); return; } } } else if (!IsSetOF(OF_GuardOutsideGuardedArea)) { g_Log.Event( LOGL_WARN, "Guard 0%x '%s' has no guard post (%s)! Removing it.\n", (dword)GetUID(), GetName(), GetTopPoint().WriteUsed()); // If we arent conjured and still got no valid home // then set our status to conjured and take our life. if ( ! IsStatFlag(STATF_CONJURED)) { StatFlag_Set( STATF_CONJURED ); Stat_SetVal(STAT_STR, 0); return; } // else we are conjured and probably a timer started already. } } const CPointMap ptCurrent = GetTopPoint(); if ( !m_ptHome.IsValidPoint() || !ptCurrent.IsValidPoint() || ( ptCurrent.GetDist(m_ptHome) < m_pNPC->m_Home_Dist_Wander )) { Skill_Start(SKILL_NONE); return; } if ( g_Cfg.m_iLostNPCTeleport ) { const int iDistance = m_ptHome.GetDist( ptCurrent ); if ( (iDistance > g_Cfg.m_iLostNPCTeleport) && (iDistance > m_pNPC->m_Home_Dist_Wander) ) { if ( IsTrigUsed(TRIGGER_NPCLOSTTELEPORT) ) { CScriptTriggerArgs Args(iDistance); // ARGN1 - distance if ( OnTrigger(CTRIG_NPCLostTeleport, this, &Args) != TRIGRET_RET_TRUE ) Spell_Teleport(m_ptHome, true, false); } else { Spell_Teleport(m_ptHome, true, false); } } } m_Act_p = m_ptHome; if ( !NPC_WalkToPoint() ) // get there { Skill_Start(SKILL_NONE); return; } } void CChar::NPC_LootMemory( CItem * pItem ) { ADDTOCALLSTACK("CChar::NPC_LootMemory"); ASSERT(m_pNPC); // Create a memory of this item. // I have already looked at it. CItem * pMemory = Memory_AddObjTypes( pItem, MEMORY_SPEAK ); pMemory->m_itEqMemory.m_Action = NPC_MEM_ACT_IGNORE; // If the item is set to decay. if (pItem->IsTimerSet()) { const int64 iTimerDiff = pItem->GetTimerDiff(); if (iTimerDiff > 0) pMemory->SetTimeout(iTimerDiff); // forget about this once the item is gone } } void CChar::NPC_Act_Looting() { ADDTOCALLSTACK("CChar::NPC_Act_Looting"); ASSERT(m_pNPC); // We killed something, let's take a look on the corpse. // Or we find something interesting on ground // // m_Act_UID = UID of the item/corpse that we trying to loot if ( m_pArea->IsFlag(REGION_FLAG_SAFE|REGION_FLAG_GUARDED) ) return; if (!(NPC_GetAiFlags() & NPC_AI_LOOTING)) return; if (m_pNPC->m_Brain != NPCBRAIN_MONSTER || !Can(CAN_C_USEHANDS) || IsStatFlag(STATF_CONJURED | STATF_PET) || (GetKeyNum("DEATHFLAGS") & DEATH_NOCORPSE)) return; CItem * pItem = m_Act_UID.ItemFind(); if ( pItem == nullptr ) return; if ( GetDist(pItem) > 2 ) // move toward it { NPC_WalkToPoint(); return; } CItemCorpse * pCorpse = dynamic_cast<CItemCorpse *>(pItem); if ( pCorpse && !pCorpse->IsContainerEmpty() ) pItem = static_cast<CItem*>( pCorpse->GetContentIndex(Calc_GetRandVal( (int)pCorpse->GetContentCount() )) ); if ( !CanTouch(pItem) || !CanMove(pItem) || !CanCarry(pItem) ) { NPC_LootMemory(pItem); return; } if ( IsTrigUsed(TRIGGER_NPCSEEWANTITEM) ) { CScriptTriggerArgs Args(pItem); if ( OnTrigger(CTRIG_NPCSeeWantItem, this, &Args) == TRIGRET_RET_TRUE ) return; } if ( pCorpse ) Speak(g_Cfg.GetDefaultMsg(DEFMSG_LOOT_RUMMAGE), HUE_TEXT_DEF, TALKMODE_EMOTE); ItemBounce(pItem, false); } void CChar::NPC_Act_Flee() { ADDTOCALLSTACK("CChar::NPC_Act_Flee"); ASSERT(m_pNPC); // NPCACT_FLEE // I should move faster this way. // ??? turn to strike if they are close. if ( ++ m_atFlee.m_iStepsCurrent >= m_atFlee.m_iStepsMax ) { Skill_Start( SKILL_NONE ); return; } if ( ! NPC_Act_Follow( true, m_atFlee.m_iStepsMax )) { Skill_Start( SKILL_NONE ); return; } } void CChar::NPC_Act_Runto(int iDist) { ADDTOCALLSTACK("CChar::NPC_Act_Runto"); ASSERT(m_pNPC); // NPCACT_RUNTO: // Still trying to get to this point. switch ( NPC_WalkToPoint(true)) { case 0: // We reached our destination NPC_Act_Idle(); // look for something new to do. break; case 1: // Took a step....keep trying to get there. break; case 2: // Give it up... // Go directly there... if ( NPC_GetAiFlags() & NPC_AI_PERSISTENTPATH ) { const CPointMap& ptMe = GetTopPoint(); if (!ptMe.IsValidPoint()) { --iDist; } else { const int iPDist = m_Act_p.GetDist(ptMe); iDist = iDist > iPDist ? iPDist : iDist - 1; } if (iDist) NPC_Act_Runto(iDist); else NPC_Act_Idle(); } else { if (m_Act_p.IsValidPoint() && IsPlayableCharacter() && !IsStatFlag(STATF_FREEZE | STATF_STONE)) Spell_Teleport(m_Act_p, true, false); else NPC_Act_Idle(); } break; } } void CChar::NPC_Act_Goto(int iDist) { ADDTOCALLSTACK("CChar::NPC_Act_Goto"); ASSERT(m_pNPC); // NPCACT_GOTO: // Still trying to get to this point. switch ( NPC_WalkToPoint()) { case 0: // We reached our destination NPC_Act_Idle(); // look for something new to do. break; case 1: // Took a step....keep trying to get there. break; case 2: // Give it up... // Go directly there... if ( NPC_GetAiFlags() & NPC_AI_PERSISTENTPATH ) { const CPointMap& ptMe = GetTopPoint(); if (!ptMe.IsValidPoint()) { --iDist; } else { const int iPDist = m_Act_p.GetDist(ptMe); iDist = iDist > iPDist ? iPDist : iDist - 1; } if (iDist) NPC_Act_Runto(iDist); else NPC_Act_Idle(); } else { if (m_Act_p.IsValidPoint() && IsPlayableCharacter() && !IsStatFlag(STATF_FREEZE | STATF_STONE)) Spell_Teleport(m_Act_p, true, false); else NPC_Act_Idle(); // look for something new to do. } break; } } bool CChar::NPC_Act_Food() { ADDTOCALLSTACK("CChar::NPC_Act_Food"); ASSERT(m_pNPC); const int iFood = Stat_GetVal(STAT_FOOD); const int iFoodLevel = Food_GetLevelPercent(); if ( iFood >= 10 ) return false; // search for food is starving or very hungry if ( iFoodLevel > 40 ) return false; // and it is at least 60% hungry m_pNPC->m_Act_Motivation = (byte)(50 - (iFoodLevel / 2)); const int iMyZ = GetTopPoint().m_z; ushort uiEatAmount = 1; int iSearchDistance = 2; CItem *pClosestFood = nullptr; int iClosestFood = 100; bool fSearchGrass = false; CItem *pCropItem = nullptr; CItemContainer *pPack = GetPack(); if ( pPack ) { for (CSObjContRec* pObjRec : *pPack) { CItem* pFood = static_cast<CItem*>(pObjRec); // I have some food personaly, so no need to search for something if ( pFood->IsType(IT_FOOD) ) { if ( (uiEatAmount = Food_CanEat(pFood)) > 0 ) { Use_EatQty(pFood, uiEatAmount); return true; } } } } // Search for food nearby iSearchDistance = (UO_MAP_VIEW_SIGHT * ( 100 - iFoodLevel ) ) / 100; CWorldSearch AreaItems(GetTopPoint(), minimum(iSearchDistance,m_pNPC->m_Home_Dist_Wander)); for (;;) { CItem * pItem = AreaItems.GetItem(); if ( !pItem ) break; if ( !CanSee(pItem) ) continue; if ( pItem->IsType(IT_CROPS) || pItem->IsType(IT_FOLIAGE) ) { // is it ripe? const CItemBase * checkItemBase = pItem->Item_GetDef(); if ( checkItemBase->m_ttNormal.m_tData3 ) { // remember this, just in case we do not find any suitable food pCropItem = pItem; continue; } } const CPointMap& ptItem = pItem->GetTopPoint(); if (ptItem.m_z > (iMyZ + 10) || ptItem.m_z < (iMyZ - 1) ) continue; if ( pItem->IsAttr(ATTR_MOVE_NEVER|ATTR_STATIC|ATTR_LOCKEDDOWN|ATTR_SECURE) ) continue; if ( (uiEatAmount = Food_CanEat(pItem)) > 0 ) { const int iDist = GetDist(pItem); if ( pClosestFood ) { if ( iDist < iClosestFood ) { pClosestFood = pItem; iClosestFood = iDist; } } else { pClosestFood = pItem; iClosestFood = iDist; } } } if ( pClosestFood ) { if ( iClosestFood <= 1 ) { // can take and eat just in place ushort uiEaten = (ushort)(pClosestFood->ConsumeAmount(uiEatAmount)); EatAnim(pClosestFood->GetName(), uiEaten); if ( !pClosestFood->GetAmount() ) { pClosestFood->Plant_CropReset(); // set growth if this is a plant } } else { // move towards this item switch ( m_Act_SkillCurrent ) { case NPCACT_STAY: case NPCACT_GOTO: case NPCACT_WANDER: case NPCACT_LOOKING: case NPCACT_GO_HOME: case NPCACT_NAPPING: case NPCACT_FLEE: { CPointMap pt = pClosestFood->GetTopPoint(); if ( CanMoveWalkTo(pt) ) { m_Act_p = pt; Skill_Start(NPCACT_GOTO); return true; //NPC_WalkToPoint((iFoodLevel < 5) ? true : false); } break; } default: break; } } } else { // no food around, but maybe i am ok with grass? Or shall I try to pick crops? const NPCBRAIN_TYPE brain = GetNPCBrainGroup(); if ( brain == NPCBRAIN_ANIMAL ) // animals eat grass always fSearchGrass = true; //else if (( brain == NPCBRAIN_HUMAN ) && !iFood ) // human eat grass if starving nearly to death // fSearchGrass = true; // found any crops or foliage at least (nearby, of course)? if ( pCropItem ) { if ( GetDist(pCropItem) < 5 ) { Use_Item(pCropItem); fSearchGrass = false; // no need to eat grass if at next tick we can eat better stuff } } } if ( fSearchGrass ) { const CCharBase *pCharDef = Char_GetDef(); const CResourceID rid = CResourceID(RES_TYPEDEF, IT_GRASS); if ( pCharDef->m_FoodType.ContainsResourceID(rid) ) // do I accept grass as food? { CItem *pResBit = CWorldMap::CheckNaturalResource(GetTopPoint(), IT_GRASS, true, this); if ( pResBit && pResBit->GetAmount() && ( pResBit->GetTopPoint().m_z == iMyZ ) ) { ushort uiEaten = pResBit->ConsumeAmount(10); EatAnim("grass", uiEaten/10); // the bit is not needed in a worldsave, timeout of 10 minutes pResBit->m_TagDefs.SetNum("NOSAVE", 1); pResBit->SetTimeoutS(60*10); //DEBUG_ERR(("Starting skill food\n")); Skill_Start( NPCACT_FOOD ); SetTimeoutS(5); return true; } else // search for grass nearby { CPointMap pt = CWorldMap::FindTypeNear_Top(GetTopPoint(), IT_GRASS, minimum(iSearchDistance,m_pNPC->m_Home_Dist_Wander)); if (( pt.m_x >= 1 ) && ( pt.m_y >= 1 )) { if (( pt.m_x != GetTopPoint().m_x ) && ( pt.m_y != GetTopPoint().m_y ) && ( pt.m_map == GetTopPoint().m_map )) { if ( CanMoveWalkTo(pt) ) { m_Act_p = pt; //DEBUG_ERR(("NPCACT_GOTO started; pt.x %d pt.y %d\n",pt.m_x,pt.m_y)); Skill_Start(NPCACT_GOTO); return true; } } } } } } return false; } void CChar::NPC_Act_Idle() { ADDTOCALLSTACK("CChar::NPC_Act_Idle"); ASSERT(m_pNPC); // Free to do as we please. decide what we want to do next. // Idle NPC's should try to take some action. m_pNPC->m_Act_Motivation = 0; // we have no motivation to do anything. if ( NPC_GetAiFlags()&NPC_AI_INTFOOD ) { bool fFood = NPC_Act_Food(); //DEBUG_ERR(("fFood %d\n",fFood)); if ( fFood ) //are we hungry? return; } if ( NPC_LookAround() ) return; // found something interesting // ---------- If we found nothing else to do. do this. ----------- // If guards are found outside guarded territories, do the following. if ( m_pNPC->m_Brain == NPCBRAIN_GUARD && !m_pArea->IsGuarded() && m_ptHome.IsValidPoint()) { Skill_Start(NPCACT_GO_HOME); return; } // Specific creature random actions. if ( Stat_GetVal(STAT_DEX) >= Stat_GetAdjusted(STAT_DEX) && !Calc_GetRandVal(3) ) { if ( IsTrigUsed(TRIGGER_NPCSPECIALACTION) ) { if ( OnTrigger( CTRIG_NPCSpecialAction, this ) == TRIGRET_RET_TRUE ) return; } switch ( GetDispID()) { case CREID_FIRE_ELEM: if ( !CWorldMap::IsItemTypeNear(GetTopPoint(), IT_FIRE, 0, false) ) { Action_StartSpecial(CREID_FIRE_ELEM); return; } break; default: // TAG.OVERRIDE.SPIDERWEB CVarDefCont * pValue = GetKey("OVERRIDE.SPIDERWEB",true); if ( pValue ) { if ( GetDispID() != CREID_GIANT_SPIDER ) { Action_StartSpecial(CREID_GIANT_SPIDER); return; } } else { if ( GetDispID() == CREID_GIANT_SPIDER ) { Action_StartSpecial(CREID_GIANT_SPIDER); return; } } } } // Periodically head home. if ( m_ptHome.IsValidPoint() && ! Calc_GetRandVal( 15 )) { Skill_Start(NPCACT_GO_HOME); return; } // periodically use hiding skill if ( Skill_GetBase(SKILL_HIDING) > 30 && ! Calc_GetRandVal( 15 - Skill_GetBase(SKILL_HIDING)/100) && !m_pArea->IsGuarded()) { // Just hide here. if ( !IsStatFlag(STATF_HIDDEN) ) { Skill_Start(SKILL_HIDING); return; } } if ( Calc_GetRandVal( 100 - Stat_GetAdjusted(STAT_DEX)) < 25 ) { // dex determines how jumpy they are. // Decide to wander about ? Skill_Start( NPCACT_WANDER ); return; } // just stand here for a bit. Skill_Start(SKILL_NONE); SetTimeoutS(1 + Calc_GetRandLLVal(2)); } bool CChar::NPC_OnItemGive( CChar *pCharSrc, CItem *pItem ) { ADDTOCALLSTACK("CChar::NPC_OnItemGive"); ASSERT(m_pNPC); // Someone (Player) is giving me an item. // return true = accept if ( !pCharSrc ) return false; CScriptTriggerArgs Args(pItem); if ( IsTrigUsed(TRIGGER_RECEIVEITEM) ) { if ( OnTrigger(CTRIG_ReceiveItem, pCharSrc, &Args) == TRIGRET_RET_TRUE ) return false; } if ( pItem->IsType(IT_GOLD) ) { CItemMemory *pMemory = Memory_FindObj(pCharSrc); if ( pMemory ) { switch ( pMemory->m_itEqMemory.m_Action ) { case NPC_MEM_ACT_SPEAK_TRAIN: return NPC_OnTrainPay(pCharSrc, pMemory, pItem); case NPC_MEM_ACT_SPEAK_HIRE: return NPC_OnHirePay(pCharSrc, pMemory, pItem); default: break; } } } // Giving item to own pet if ( NPC_IsOwnedBy(pCharSrc) ) { if ( NPC_IsVendor() ) { if ( pItem->IsType(IT_GOLD) ) { int iWage = Char_GetDef()->GetHireDayWage(); iWage = pCharSrc->PayGold(this, iWage, nullptr, PAYGOLD_HIRE); if (iWage > 0) { Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_MONEY)); NPC_OnHirePayMore(pItem, iWage); return true; } } else { Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_SELL)); GetBank(LAYER_VENDOR_STOCK)->ContentAdd(pItem); return true; } } if ( Food_CanEat(pItem) ) { if ( Use_Eat(pItem, pItem->GetAmount()) ) { if ( NPC_CanSpeak() ) Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_FOOD_TY)); if ( !pItem->IsDeleted() ) // if the NPC don't eat the full stack, bounce back the remaining amount on player backpack pCharSrc->ItemBounce(pItem); return true; } if ( NPC_CanSpeak() ) Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_FOOD_NO)); return false; } if ( pCharSrc->IsPriv(PRIV_GM) ) return ItemBounce(pItem); if ( !CanCarry(pItem) ) { if ( NPC_CanSpeak() ) Speak(g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_WEAK)); return false; } // Place item on backpack CItemContainer *pPack = GetPack(); if ( !pPack ) return false; pPack->ContentAdd(pItem); return true; } if ( pItem->IsType(IT_GOLD) ) { if ( m_pNPC->m_Brain == NPCBRAIN_BANKER ) { CItemContainer *pBankBox = pCharSrc->GetPackSafe(); if ( !pBankBox ) return false; if ( NPC_CanSpeak() ) { tchar *pszMsg = Str_GetTemp(); snprintf(pszMsg, STR_TEMPLENGTH, g_Cfg.GetDefaultMsg(DEFMSG_NPC_BANKER_DEPOSIT), pItem->GetAmount()); Speak(pszMsg); } pBankBox->ContentAdd(pItem); return true; } return false; } if ( NPC_IsVendor() && !IsStatFlag(STATF_PET) ) { // Dropping item on vendor means quick sell if ( pCharSrc->IsClientActive() ) { VendorItem item; item.m_serial = pItem->GetUID(); item.m_vcAmount = pItem->GetAmount(); pCharSrc->GetClientActive()->Event_VendorSell(this, &item, 1); } return false; } if ( !NPC_WantThisItem(pItem) ) { if ( IsTrigUsed(TRIGGER_NPCREFUSEITEM) ) { if ( OnTrigger(CTRIG_NPCRefuseItem, pCharSrc, &Args) != TRIGRET_RET_TRUE ) { pCharSrc->SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_NPC_GENERIC_DONTWANT)); return false; } } else return false; } if ( IsTrigUsed(TRIGGER_NPCACCEPTITEM) ) { if ( OnTrigger(CTRIG_NPCAcceptItem, pCharSrc, &Args) == TRIGRET_RET_TRUE ) return false; } // Place item on backpack CItemContainer *pPack = GetPack(); if ( !pPack ) return false; pPack->ContentAdd(pItem); return true; } void CChar::NPC_OnTickAction() { ADDTOCALLSTACK("CChar::NPC_OnTickAction"); ASSERT(m_pNPC); // Our action timer has expired. last skill or task might be complete ? // What action should we take now ? EXC_TRY("NPC_TickAction"); if (!m_pArea) { const CPointMap& pt = GetUnkPoint(); if (pt.IsValidPoint()) DEBUG_WARN(("Trying to Tick Action on an NPC placed in an invalid area (P=%s). UID=0% " PRIx32 ", defname=%s.\n", pt.WriteUsed(), GetUID().GetObjUID(), GetResourceName())); else DEBUG_WARN(("Trying to Tick Action on unplaced NPC. UID=0% " PRIx32 ", defname=%s.\n", GetUID().GetObjUID(), GetResourceName())); return; } const SKILL_TYPE iSkillActive = Skill_GetActive(); bool fSkillFight = false; if ( g_Cfg.IsSkillFlag( iSkillActive, SKF_SCRIPTED ) ) { // SCRIPTED SKILL OnTickAction } else if (g_Cfg.IsSkillFlag(iSkillActive, SKF_FIGHT)) { EXC_SET_BLOCK("fighting"); fSkillFight = true; NPC_Act_Fight(); } else if (g_Cfg.IsSkillFlag(iSkillActive, SKF_MAGIC)) { EXC_SET_BLOCK("fighting-magic"); NPC_Act_Fight(); } else { switch ( iSkillActive ) { case SKILL_NONE: // We should try to do something new. EXC_SET_BLOCK("idle: Skill_None"); NPC_Act_Idle(); break; case SKILL_STEALTH: case SKILL_HIDING: // We are currently hidden. EXC_SET_BLOCK("look around"); if ( NPC_LookAround()) break; // just remain hidden unless we find something new to do. if ( Calc_GetRandVal( Skill_GetBase(SKILL_HIDING))) break; EXC_SET_BLOCK("idle: Hidding"); NPC_Act_Idle(); break; case SKILL_ARCHERY: case SKILL_FENCING: case SKILL_MACEFIGHTING: case SKILL_SWORDSMANSHIP: case SKILL_WRESTLING: case SKILL_THROWING: // If we are fighting . Periodically review our targets. EXC_SET_BLOCK("fight"); NPC_Act_Fight(); break; case SKILL_MAGERY: case SKILL_NECROMANCY: case SKILL_MYSTICISM: case SKILL_CHIVALRY: case SKILL_SPELLWEAVING: EXC_SET_BLOCK("magic"); NPC_Act_Fight(); // May be we can split Fight and Magic from here? break; case NPCACT_GUARD_TARG: // fight with the target, or follow it EXC_SET_BLOCK("guard"); NPC_Act_Guard(); break; case NPCACT_FOLLOW_TARG: // continue to follow our target. EXC_SET_BLOCK("look at char"); NPC_LookAtChar( m_Act_UID.CharFind(), 1 ); EXC_SET_BLOCK("follow char"); NPC_Act_Follow(); break; case NPCACT_STAY: // Just stay here til told to do otherwise. break; case NPCACT_GOTO: EXC_SET_BLOCK("goto"); NPC_Act_Goto(); break; case NPCACT_WANDER: EXC_SET_BLOCK("wander"); NPC_Act_Wander(); break; case NPCACT_FLEE: EXC_SET_BLOCK("flee"); NPC_Act_Flee(); break; case NPCACT_TALK: case NPCACT_TALK_FOLLOW: // Got bored just talking to you. EXC_SET_BLOCK("talk"); if ( ! NPC_Act_Talk()) { EXC_SET_BLOCK("idle: Talk"); NPC_Act_Idle(); // look for something new to do. } break; case NPCACT_GO_HOME: EXC_SET_BLOCK("go home"); NPC_Act_GoHome(); break; case NPCACT_LOOKING: EXC_SET_BLOCK("looking"); if ( NPC_LookAround( true ) ) break; EXC_SET_BLOCK("idle: Looking"); NPC_Act_Idle(); break; case NPCACT_FOOD: EXC_SET_BLOCK("Food Skill"); if ( NPC_GetAiFlags() & NPC_AI_INTFOOD ) { if ( ! NPC_Act_Food() ) Skill_Start(SKILL_NONE); } break; case NPCACT_RUNTO: EXC_SET_BLOCK("Run To"); NPC_Act_Runto(); break; default: if ( !IsSkillBase(iSkillActive) ) // unassigned skill ? that's weird { Skill_Start(SKILL_NONE); } break; } } EXC_SET_BLOCK("timer expired (NPC)"); if ( IsTimerExpired() && !fSkillFight) // If i'm fighting, i don't want to wait to start another swing { int64 timeout = (150-Stat_GetAdjusted(STAT_DEX))/2; timeout = maximum(timeout, 0); timeout = Calc_GetRandLLVal2(timeout/2, timeout); // default next brain/move tick SetTimeoutD(1 + timeout); // In Tenths of Second. } // vendors restock periodically if ( NPC_IsVendor() ) NPC_Vendor_Restock(); EXC_CATCH; EXC_DEBUG_START; g_Log.EventDebug("'%s' [0%x]\n", GetName(), (dword)GetUID()); EXC_DEBUG_END; } void CChar::NPC_Pathfinding() { ADDTOCALLSTACK("CChar::NPC_Pathfinding"); ASSERT(m_pNPC); const CPointMap ptLocal = GetTopPoint(); EXC_TRY("Pathfinding"); EXC_SET_BLOCK("pre-checking"); const CPointMap ptTarg = m_Act_p; const int dist = ptLocal.GetDist(ptTarg); // If NPC_AI_ALWAYSINT is set, just make it as smart as possible. const int iInt = ( NPC_GetAiFlags() & NPC_AI_ALWAYSINT ) ? 300 : Stat_GetAdjusted(STAT_INT); // do we really need to find the path? if ( iInt < 30 ) // too dumb return; if ( m_pNPC->m_nextPt == ptTarg ) // we have path to that position already saved in m_NextX/Y return; if ( !ptTarg.IsValidPoint() ) // invalid point return; if (( ptTarg.m_x == ptLocal.m_x ) && ( ptTarg.m_y == ptLocal.m_y )) // same spot return; if ( ptTarg.m_map != ptLocal.m_map ) // cannot just move to another map return; if ( dist >= MAX_NPC_PATH_STORAGE_SIZE/2 ) // skip too far locations which should be too slow return; if ( dist < 2 ) // skip too low distance (1 step) - good in default return; // pathfinding is buggy near the edges of the map, // so do not use it there if ((ptLocal.m_x <= MAX_NPC_PATH_STORAGE_SIZE / 2) || (ptLocal.m_y <= MAX_NPC_PATH_STORAGE_SIZE / 2) || (ptLocal.m_x >= (g_MapList.GetMapSizeX(ptLocal.m_map) - MAX_NPC_PATH_STORAGE_SIZE / 2)) || (ptLocal.m_y >= (g_MapList.GetMapSizeY(ptLocal.m_map) - MAX_NPC_PATH_STORAGE_SIZE / 2))) { return; } // need 300 int at least to pathfind each step, but always // search if this is a first step if (( Calc_GetRandVal(300) > iInt ) && ( m_pNPC->m_nextX[0] )) return; // clear saved steps list EXC_SET_BLOCK("clearing last steps"); memset(m_pNPC->m_nextX, 0, sizeof(m_pNPC->m_nextX)); memset(m_pNPC->m_nextY, 0, sizeof(m_pNPC->m_nextY)); // proceed with the pathfinding EXC_SET_BLOCK("filling the map"); // The pathfinder class is big, it's better to store that on the heap, instead of on the stack. std::unique_ptr<CPathFinder> path = std::make_unique<CPathFinder>(this, ptTarg); EXC_SET_BLOCK("searching the path"); if ( !path->FindPath() ) return; // save the found path EXC_SET_BLOCK("saving found path"); // Don't read the first step, it's the same as the current position, so i = 1 for ( size_t i = 1, sz = path->LastPathSize(); (i != sz) && (i < MAX_NPC_PATH_STORAGE_SIZE /* Don't overflow*/ ); ++i ) { const CPointMap& ptNext = path->ReadStep(i); m_pNPC->m_nextX[i - 1] = ptNext.m_x; m_pNPC->m_nextY[i - 1] = ptNext.m_y; } m_pNPC->m_nextPt = ptTarg; path->ClearLastPath(); // !! Use explicitly when using one CPathFinder object for more NPCs EXC_CATCH; EXC_DEBUG_START; g_Log.EventDebug("'%s' point '%d,%d,%d,%d' [0%x]\n", GetName(), ptLocal.m_x, ptLocal.m_y, ptLocal.m_z, ptLocal.m_map, (dword)GetUID()); EXC_DEBUG_END; } void CChar::NPC_Food() { ADDTOCALLSTACK("CChar::NPC_Food"); ASSERT(m_pNPC); EXC_TRY("FoodAI"); const CPointMap& ptMe = GetTopPoint(); int iFood = Stat_GetVal(STAT_FOOD); int iFoodLevel = Food_GetLevelPercent(); ushort uiEatAmount = 1; int iSearchDistance = 2; CItem *pClosestFood = nullptr; int iClosestFood = 100; int iMyZ = ptMe.m_z; bool fSearchGrass = false; if ( iFood >= 10 ) return; // search for food is starving or very hungry if ( iFoodLevel > 40 ) return; // and it is at least 60% hungry CItemContainer *pPack = GetPack(); if ( pPack ) { EXC_SET_BLOCK("searching in pack"); for (CSObjContRec* pObjRec : *pPack) { CItem* pFood = static_cast<CItem*>(pObjRec); // i have some food personaly, so no need to search for something if ( pFood->IsType(IT_FOOD) ) { if ( (uiEatAmount = Food_CanEat(pFood)) > 0 ) { EXC_SET_BLOCK("eating from pack"); Use_EatQty(pFood, uiEatAmount); return; } } } } // Search for food nearby EXC_SET_BLOCK("searching nearby"); iSearchDistance = (UO_MAP_VIEW_SIGHT * ( 100 - iFoodLevel ) ) / 100; CWorldSearch AreaItems(ptMe, minimum(iSearchDistance, m_pNPC->m_Home_Dist_Wander)); for (;;) { CItem *pItem = AreaItems.GetItem(); if ( !pItem ) break; if ( !CanSee(pItem) || pItem->IsAttr(ATTR_MOVE_NEVER|ATTR_STATIC|ATTR_LOCKEDDOWN|ATTR_SECURE) ) continue; if ( (pItem->GetTopPoint().m_z < iMyZ) || (pItem->GetTopPoint().m_z > (iMyZ + (m_height / 2))) ) continue; if ( (uiEatAmount = Food_CanEat(pItem)) > 0 ) { int iDist = GetDist(pItem); if ( pClosestFood ) { if ( iDist < iClosestFood ) { pClosestFood = pItem; iClosestFood = iDist; } } else { pClosestFood = pItem; iClosestFood = iDist; } } } if ( pClosestFood ) { if ( iClosestFood <= 1 ) { // can take and eat just in place EXC_SET_BLOCK("eating nearby"); ushort uiEaten = pClosestFood->ConsumeAmount(uiEatAmount); EatAnim(pClosestFood->GetName(), uiEaten); if ( !pClosestFood->GetAmount() ) { pClosestFood->Plant_CropReset(); // set growth if this is a plant } } else { // move towards this item switch ( m_Act_SkillCurrent ) { case NPCACT_STAY: case NPCACT_GOTO: case NPCACT_WANDER: case NPCACT_LOOKING: case NPCACT_GO_HOME: case NPCACT_NAPPING: case NPCACT_FLEE: { EXC_SET_BLOCK("walking to desired"); CPointMap pt = pClosestFood->GetTopPoint(); if ( CanMoveWalkTo(pt) ) { m_Act_p = pt; Skill_Start(NPCACT_GOTO); //NPC_WalkToPoint((iFoodLevel < 5) ? true : false); } break; } default: break; } } } // no food around, but maybe i am ok with grass? else { const NPCBRAIN_TYPE brain = GetNPCBrainGroup(); if ( brain == NPCBRAIN_ANIMAL ) // animals eat grass always fSearchGrass = true; else if (( brain == NPCBRAIN_HUMAN ) && !iFood ) // human eat grass if starving nearly dead fSearchGrass = true; } if ( fSearchGrass ) { const CCharBase *pCharDef = Char_GetDef(); const CResourceID rid = CResourceID(RES_TYPEDEF, IT_GRASS); EXC_SET_BLOCK("searching grass"); if ( pCharDef->m_FoodType.ContainsResourceID(rid) ) // do I accept grass as a food? { CItem *pResBit = CWorldMap::CheckNaturalResource(ptMe, IT_GRASS, true, this); if ( pResBit && pResBit->GetAmount() && ( pResBit->GetTopPoint().m_z == iMyZ ) ) { EXC_SET_BLOCK("eating grass"); const ushort uiEaten = pResBit->ConsumeAmount(15); EatAnim("grass", uiEaten/10); // the bit is not needed in a worldsave, timeout of 10 minutes pResBit->m_TagDefs.SetNum("NOSAVE", 1); pResBit->SetTimeoutS(60*10); return; } else // search for grass nearby { switch ( m_Act_SkillCurrent ) { case NPCACT_STAY: case NPCACT_GOTO: case NPCACT_WANDER: case NPCACT_LOOKING: case NPCACT_GO_HOME: case NPCACT_NAPPING: case NPCACT_FLEE: { EXC_SET_BLOCK("searching grass nearby"); CPointMap pt = CWorldMap::FindTypeNear_Top(ptMe, IT_GRASS, minimum(iSearchDistance, m_pNPC->m_Home_Dist_Wander)); if (( pt.m_x >= 1 ) && ( pt.m_y >= 1 )) { // we found grass nearby, but has it already been consumed? pResBit = CWorldMap::CheckNaturalResource(pt, IT_GRASS, false, this); if ( pResBit != nullptr && pResBit->GetAmount() && CanMoveWalkTo(pt) ) { EXC_SET_BLOCK("walking to grass"); pResBit->m_TagDefs.SetNum("NOSAVE", 1); pResBit->SetTimeoutS(60*10); m_Act_p = pt; Skill_Start(NPCACT_GOTO); return; } } break; } default: break; } } } } EXC_CATCH; } void CChar::NPC_ExtraAI() { ADDTOCALLSTACK("CChar::NPC_ExtraAI"); ASSERT(m_pNPC); EXC_TRY("ExtraAI"); if ( !m_pNPC ) return; if ( GetNPCBrainGroup() != NPCBRAIN_HUMAN ) return; EXC_SET_BLOCK("init"); if ( IsTrigUsed(TRIGGER_NPCACTION) ) { if ( OnTrigger( CTRIG_NPCAction, this ) == TRIGRET_RET_TRUE ) return; } if (!Can(CAN_C_EQUIP) && !Can(CAN_C_USEHANDS)) { // These are checked when trying to equip the item, so avoid further processing if we know from the start // that we won't be able to use those items. return; } // Equip weapons if possible EXC_SET_BLOCK("weapon/shield"); if ( IsStatFlag(STATF_WAR) ) { CItem *pWeapon = LayerFind(LAYER_HAND1); if ( !pWeapon || !pWeapon->IsTypeWeapon() ) ItemEquipWeapon(false); CItem *pShield = LayerFind(LAYER_HAND2); if ( !pShield || !pShield->IsTypeArmor() ) { const CItemContainer * pPack = GetPack(); if (pPack) { pShield = pPack->ContentFind(CResourceID(RES_TYPEDEF, IT_SHIELD)); if (pShield) ItemEquip(pShield); } } return; } // Equip lightsource at night time EXC_SET_BLOCK("light source"); const CPointMap& pt = GetTopPoint(); const CSector *pSector = pt.GetSector(); if ( pSector && pSector->IsDark() ) { const CItem *pLightSourceCheck = LayerFind(LAYER_HAND2); if ( !(pLightSourceCheck && (pLightSourceCheck->IsType(IT_LIGHT_OUT) || pLightSourceCheck->IsType(IT_LIGHT_LIT))) ) { CItem *pLightSource = ContentFind(CResourceID(RES_TYPEDEF, IT_LIGHT_OUT)); if ( pLightSource ) { ItemEquip(pLightSource); Use_Obj(pLightSource, false); } } } else { CItem *pLightSource = LayerFind(LAYER_HAND2); if ( pLightSource && (pLightSource->IsType(IT_LIGHT_OUT) || pLightSource->IsType(IT_LIGHT_LIT)) ) ItemBounce(pLightSource, false); } EXC_CATCH; }
Sphereserver/Source2
src/game/chars/CCharNPCAct.cpp
C++
apache-2.0
68,664
/** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib 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. */ 'use strict'; // MODULES // var bench = require( '@stdlib/bench' ); var pow = require( '@stdlib/math/base/special/pow' ); var randi = require( '@stdlib/random/base/randi' ); var isInt16Array = require( '@stdlib/assert/is-int16array' ); var pkg = require( './../package.json' ).name; var Int16Array = require( './../lib' ); // FUNCTIONS // /** * Creates a benchmark function. * * @private * @param {PositiveInteger} len - array length * @returns {Function} benchmark function */ function createBenchmark( len ) { var data; var arr; var i; data = []; for ( i = 0; i < len; i++ ) { data.push( randi() ); } arr = new Int16Array( data ); return benchmark; /** * Benchmark function. * * @private * @param {Benchmark} b - benchmark instance */ function benchmark( b ) { var out; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { arr[ i%len ] = randi(); out = arr.sort(); if ( typeof out !== 'object' ) { b.fail( 'should return an object' ); } } b.toc(); if ( !isInt16Array( out ) ) { b.fail( 'should return an Int16Array' ); } b.pass( 'benchmark finished' ); b.end(); } } // MAIN // /** * Main execution sequence. * * @private */ function main() { var len; var min; var max; var f; var i; min = 1; // 10^min max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); bench( pkg+':sort:len='+len, f ); } } main();
stdlib-js/stdlib
lib/node_modules/@stdlib/array/int16/benchmark/benchmark.sort.length.js
JavaScript
apache-2.0
2,057
using System; using System.Reactive; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Threading; namespace Aardvark.Base { public class EventSourceSlim<T> : IEvent<T> { private Subject<T> m_subject; private T m_latest; public EventSourceSlim(T defaultValue) { m_subject = new Subject<T>(); m_subject.OnNext(defaultValue); m_latest = defaultValue; } public void Emit(T v) { lock(this) { m_latest = v; m_subject.OnNext(v); } } public T Latest { get { lock(this) { return m_latest; } } } public IAwaitable<T> Next { get { throw new NotImplementedException(); } } public IObservable<T> Values { get { return m_subject; } } IAwaitable IEvent.Next { get { throw new NotImplementedException(); } } IObservable<Unit> IEvent.Values { get { throw new NotImplementedException(); } } } /// <summary> /// </summary> public static class EventSource { /// <summary> /// The type used for the Values property in non-generic event sources. /// </summary> public static readonly Type UnitEventType = typeof(Unit); /// <summary> /// Creates new EventSource with given initial value. /// </summary> public static EventSource<T> Create<T>(T initialValue) { return new EventSource<T>(initialValue); } /// <summary> /// Creates new EventSource with tuple of given initial values. /// </summary> public static EventSource<Tuple<T0, T1>> Create<T0, T1>(T0 initialValue0, T1 initialValue1) { return new EventSource<Tuple<T0, T1>>(Tuple.Create(initialValue0, initialValue1)); } /// <summary> /// Creates new EventSource with tuple of given initial values. /// </summary> public static EventSource<Tuple<T0, T1, T2>> Create<T0, T1, T2>(T0 initialValue0, T1 initialValue1, T2 initialValue2) { return new EventSource<Tuple<T0, T1, T2>>(Tuple.Create(initialValue0, initialValue1, initialValue2)); } /// <summary> /// Creates new EventSource with tuple of given initial values. /// </summary> public static EventSource<Tuple<T0, T1, T2, T3>> Create<T0, T1, T2, T3>(T0 initialValue0, T1 initialValue1, T2 initialValue2, T3 initialValue3) { return new EventSource<Tuple<T0, T1, T2, T3>>(Tuple.Create(initialValue0, initialValue1, initialValue2, initialValue3)); } /// <summary> /// Creates new EventSource with tuple of given initial values. /// </summary> public static EventSource<Tuple<T0, T1, T2, T3, T4>> Create<T0, T1, T2, T3, T4>(T0 initialValue0, T1 initialValue1, T2 initialValue2, T3 initialValue3, T4 initialValue4) { return new EventSource<Tuple<T0, T1, T2, T3, T4>>(Tuple.Create(initialValue0, initialValue1, initialValue2, initialValue3, initialValue4)); } } /// <summary> /// </summary> public class EventSource<T> : IEvent<T>, IEventEmitter<T> { private ThreadLocal<bool> m_currentThreadDoesNotOwnLock = new ThreadLocal<bool>(() => true); private SpinLock m_lock = new SpinLock(true); private T m_latest; private Awaitable<T> m_awaitable = new Awaitable<T>(); private Lazy<Subject<T>> m_eventStream = new Lazy<Subject<T>>(); /// <summary> /// Creates an EventSource with default initial value. /// </summary> public EventSource() { EventSourceTelemetry.CountConstructorDefault.Increment(); } /// <summary> /// Creates a new EventSource with specified initial value. /// </summary> public EventSource(T initialValue) { EventSourceTelemetry.CountConstructorInitialValue.Increment(); m_latest = initialValue; } /// <summary> /// Wraps an observable as an event source. /// </summary> public EventSource(IObservable<T> fromObservable) { EventSourceTelemetry.CountConstructorFromObservable.Increment(); fromObservable.Subscribe(x => Emit(x)); } /// <summary> /// Wraps an observable as an event source and sets its initial value. /// </summary> public EventSource(T initialValue, IObservable<T> fromObservable) { m_latest = initialValue; EventSourceTelemetry.CountConstructorInitialValue.Increment(); EventSourceTelemetry.CountConstructorFromObservable.Increment(); fromObservable.Subscribe(x => Emit(x)); } /// <summary> /// Gets latest value emitted by this event source, /// or default(T) if no value has been emitted so far. /// Do not set this value! Unless you have multiple /// related event sources you want to 'update' /// simultanously. In this case first set Latest for /// all related event sources to their respective new /// value, and then Emit the same values. A subscriber /// of such an event source which accesses the Latest /// property of a related event source then sees the /// correct value (independent of emit order). /// </summary> public T Latest { get { EventSourceTelemetry.CountLatestGet.Increment(); return m_latest; } set { m_latest = value; } } /// <summary> /// Gets next value that will be emitted by this event source. /// </summary> public IAwaitable<T> Next { get { EventSourceTelemetry.CountNextGet.Increment(); bool lockTaken = false; try { if (m_currentThreadDoesNotOwnLock.Value) { m_lock.Enter(ref lockTaken); m_currentThreadDoesNotOwnLock.Value = false; } return m_awaitable; } finally { if (lockTaken) { m_currentThreadDoesNotOwnLock.Value = true; m_lock.Exit(true); } } } } /// <summary> /// Gets observable stream of values emitted by this event source. /// </summary> public IObservable<T> Values { get { EventSourceTelemetry.CountValuesGet.Increment(); return m_eventStream.Value; } } /// <summary> /// Emits given value from this event source. /// </summary> public virtual void Emit(T value) { EventSourceTelemetry.CountEmit.Increment(); bool lockTaken = false; try { if (m_currentThreadDoesNotOwnLock.Value) { m_currentThreadDoesNotOwnLock.Value = false; m_lock.Enter(ref lockTaken); } var currentAwaitable = m_awaitable; // update Latest and Next // (before emitting, such that a listener immediately coming back to us already sees the updated state) m_awaitable = new Awaitable<T>(); m_latest = value; // emit value currentAwaitable.Emit(value); if (m_eventStream.IsValueCreated) m_eventStream.Value.OnNext(value); } finally { if (lockTaken) { m_currentThreadDoesNotOwnLock.Value = true; m_lock.Exit(true); } } } #region IEvent /// <summary> /// Observable notifications for all values that are emitted. /// </summary> IObservable<Unit> IEvent.Values { get { return Values.Select(_ => Unit.Default); } } IAwaitable IEvent.Next { get { return Next; } } #endregion #region IEventEmitter /// <summary> /// Emits default T. /// </summary> public void Emit() { Emit(default(T)); } #endregion } internal static class EventSourceTelemetry { public static readonly Telemetry.Counter CountConstructorDefault = new Telemetry.Counter(); public static readonly Telemetry.Counter CountConstructorInitialValue = new Telemetry.Counter(); public static readonly Telemetry.Counter CountConstructorFromObservable = new Telemetry.Counter(); public static readonly Telemetry.Counter CountEmit = new Telemetry.Counter(); public static readonly Telemetry.Counter CountNextGet = new Telemetry.Counter(); public static readonly Telemetry.Counter CountLatestGet = new Telemetry.Counter(); public static readonly Telemetry.Counter CountValuesGet = new Telemetry.Counter(); } }
vrvis/aardvark.base
src/Aardvark.Base.Essentials/System/EventSource.cs
C#
apache-2.0
10,191
package com.jianma.xtdm.util; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import java.util.Random; import javax.imageio.ImageIO; public class CaptchaUtil { private static final String RANDOM_STRS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String FONT_NAME = "Fixedsys"; private static final int FONT_SIZE = 18; private Random random = new Random(); private int width = 80; private int height = 25; private int lineNum = 50; private int strNum = 4; public BufferedImage genRandomCodeImage(StringBuffer randomCode) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); Graphics g = image.getGraphics(); g.setColor(getRandColor(200, 250)); g.fillRect(0, 0, width, height); g.setColor(getRandColor(110, 120)); for (int i = 0; i <= lineNum; i++) { drowLine(g); } g.setFont(new Font(FONT_NAME, Font.ROMAN_BASELINE, FONT_SIZE)); for (int i = 1; i <= strNum; i++) { randomCode.append(drowString(g, i)); } g.dispose(); return image; } private Color getRandColor(int fc, int bc) { if (fc > 255) fc = 255; if (bc > 255) bc = 255; int r = fc + random.nextInt(bc - fc); int g = fc + random.nextInt(bc - fc); int b = fc + random.nextInt(bc - fc); return new Color(r, g, b); } private String drowString(Graphics g, int i) { g.setColor(new Color(random.nextInt(101), random.nextInt(111), random .nextInt(121))); String rand = String.valueOf(getRandomString(random.nextInt(RANDOM_STRS .length()))); g.translate(random.nextInt(3), random.nextInt(3)); g.drawString(rand, 13 * i, 16); return rand; } private void drowLine(Graphics g) { int x = random.nextInt(width); int y = random.nextInt(height); int x0 = random.nextInt(16); int y0 = random.nextInt(16); g.drawLine(x, y, x + x0, y + y0); } private String getRandomString(int num) { return String.valueOf(RANDOM_STRS.charAt(num)); } public static void main(String[] args) { CaptchaUtil tool = new CaptchaUtil(); StringBuffer code = new StringBuffer(); BufferedImage image = tool.genRandomCodeImage(code); System.out.println("&gt;&gt;&gt; random code =: " + code); try { ImageIO.write(image, "JPEG", new FileOutputStream(new File( "random-code.jpg"))); } catch (Exception e) { e.printStackTrace(); } } }
jianmakeji/XTDM_Backend
src/main/java/com/jianma/xtdm/util/CaptchaUtil.java
Java
apache-2.0
2,471
package command import ( "fmt" "github.com/urfave/cli" ) func (f *CommandFactory) Upgrade() cli.Command { return cli.Command{ Name: "upgrade", Usage: "upgrade a Layer0 instance to a new version", ArgsUsage: "NAME VERSION", Flags: []cli.Flag{ cli.BoolFlag{ Name: "force", Usage: "skips confirmation prompt", }, }, Action: func(c *cli.Context) error { args, err := extractArgs(c.Args(), "NAME", "VERSION") if err != nil { return err } instance := f.NewInstance(args["NAME"]) if err := instance.Upgrade(args["VERSION"], c.Bool("force")); err != nil { return err } fmt.Printf("Everything looks good! You are now ready to run 'l0-setup apply %s'\n", args["NAME"]) return nil }, } }
quintilesims/layer0
setup/command/upgrade.go
GO
apache-2.0
756
// // AudioStreamer.h // StreamingAudioPlayer // // Created by Matt Gallagher on 27/09/08. // Copyright 2008 Matt Gallagher. All rights reserved. // // Permission is given to use this source code file, free of charge, in any // project, commercial or otherwise, entirely at your risk, with the condition // that any redistribution (in part or whole) of source code must retain // this copyright and permission notice. Attribution in compiled projects is // appreciated but not required. // // This file is meant to be a repository for common defintions between AudioStreamerBC (backcompat, 3.1.x) // and AudioStreamerCUR (iOS 3.2+), as well as a proxy which shunts messages to the appropriate AudioStreamer. // - SPT // Also note that we've had to change enumeration and class names here - this is because // some modules may require the use of AudioStreamer in external libraries and the // symbols cannot be changed on that end. The use of common symbols in LookPage without // namespaces is a recurring problem, and we can thank Objective-C for it. // - SPT #ifdef USE_TI_MEDIA #define LOG_QUEUED_BUFFERS 0 #define kNumAQBufs 16 // Number of audio queue buffers we allocate. // Needs to be big enough to keep audio pipeline // busy (non-zero number of queued buffers) but // not so big that audio takes too long to begin // (kNumAQBufs * kAQBufSize of data must be // loaded before playback will start). // Set LOG_QUEUED_BUFFERS to 1 to log how many // buffers are queued at any time -- if it drops // to zero too often, this value may need to // increase. Min 3, typical 8-24. #define kAQMaxPacketDescs 512 // Number of packet descriptions in our array #define kAQDefaultBufSize 2048 // Number of bytes in each audio queue buffer // Needs to be big enough to hold a packet of // audio from the audio file. If number is too // large, queuing of audio before playback starts // will take too long. // Highly compressed files can use smaller // numbers (512 or less). 2048 should hold all // but the largest packets. A buffer size error // will occur if this number is too small. typedef enum { AS_INITIALIZED = 0, AS_STARTING_FILE_THREAD, AS_WAITING_FOR_DATA, AS_WAITING_FOR_QUEUE_TO_START, AS_PLAYING, AS_BUFFERING, AS_STOPPING, AS_STOPPED, AS_PAUSED, AS_FLUSHING_EOF } AudioStreamerState; typedef enum { AS_NO_STOP = 0, AS_STOPPING_EOF, AS_STOPPING_USER_ACTION, AS_STOPPING_ERROR, AS_STOPPING_TEMPORARILY } AudioStreamerStopReason; typedef enum { AS_NO_ERROR = 0, AS_NETWORK_CONNECTION_FAILED, AS_FILE_STREAM_GET_PROPERTY_FAILED, AS_FILE_STREAM_SEEK_FAILED, AS_FILE_STREAM_PARSE_BYTES_FAILED, AS_FILE_STREAM_OPEN_FAILED, AS_FILE_STREAM_CLOSE_FAILED, AS_AUDIO_DATA_NOT_FOUND, AS_AUDIO_QUEUE_CREATION_FAILED, AS_AUDIO_QUEUE_BUFFER_ALLOCATION_FAILED, AS_AUDIO_QUEUE_ENQUEUE_FAILED, AS_AUDIO_QUEUE_ADD_LISTENER_FAILED, AS_AUDIO_QUEUE_REMOVE_LISTENER_FAILED, AS_AUDIO_QUEUE_START_FAILED, AS_AUDIO_QUEUE_PAUSE_FAILED, AS_AUDIO_QUEUE_BUFFER_MISMATCH, AS_AUDIO_QUEUE_DISPOSE_FAILED, AS_AUDIO_QUEUE_STOP_FAILED, AS_AUDIO_QUEUE_FLUSH_FAILED, AS_AUDIO_STREAMER_FAILED, AS_GET_AUDIO_TIME_FAILED, AS_AUDIO_BUFFER_TOO_SMALL } AudioStreamerErrorCode; extern NSString * const ASStatusChangedNotification; @protocol AudioStreamerDelegate<NSObject> -(void)playbackStateChanged:(id)sender; @end @protocol AudioStreamerProtocol<NSObject> @property AudioStreamerErrorCode errorCode; @property (nonatomic, readonly) AudioStreamerState state; @property (readonly) double progress; @property (readwrite) UInt32 bitRate; @property (readwrite) double volume; @property (readwrite,assign) id<AudioStreamerDelegate> delegate; @property (nonatomic,readwrite,assign) NSUInteger bufferSize; - (void)start; - (void)stop; - (void)pause; - (BOOL)isPlaying; - (BOOL)isPaused; - (BOOL)isWaiting; - (BOOL)isIdle; @end @interface AudioStreamer : NSObject<AudioStreamerProtocol,AudioStreamerDelegate> { id<AudioStreamerProtocol> streamer; id<AudioStreamerDelegate> delegate; } - (id)initWithURL:(NSURL *)aURL; + (NSString*)stringForErrorCode:(AudioStreamerErrorCode)code; @end #endif
EXDary/lookpage
build/iphone/Classes/AudioStreamer/AudioStreamer.h
C
apache-2.0
4,448