text
stringlengths
2
1.04M
meta
dict
package br.com.wmixvideo.sped.leiaute.blococ; import br.com.wmixvideo.sped.enums.SFIndicadorPeriodo; import br.com.wmixvideo.sped.enums.SFMovimentacaoFisica; import org.junit.Assert; import org.junit.Test; import java.math.BigDecimal; public class SFC170ItemDocumentoTest { @Test public void deveGerarLinhaCompleta() { final SFC170ItemDocumento linha = new SFC170ItemDocumento() .setCampo02Ordem("000000") .setCampo03Codigo("000001") .setCampo04Descricao("000010") .setCampo05Quantidade(BigDecimal.valueOf(10)) .setCampo06Unidade("000011") .setCampo07Valor(BigDecimal.valueOf(10.01)) .setCampo08ValorDesconto(BigDecimal.valueOf(10.02)) .setCampo09MovimentacaoFisica(SFMovimentacaoFisica.SIM) .setCampo10CodigoSituacaoTributaria("000100") .setCampo11CodigoFiscalOperacaoPrestacao("000101") .setCampo12CodigoNaturezaOperacao("000110") .setCampo13ValorBaseCalculoIcms(BigDecimal.valueOf(10.03)) .setCampo14ValorAliquotaIcms(BigDecimal.valueOf(10.04)) .setCampo15ValorIcms(BigDecimal.valueOf(10.05)) .setCampo16ValorBaseCalculoIcmsSt(BigDecimal.valueOf(10.06)) .setCampo17ValorAliquotaIcmsSt(BigDecimal.valueOf(10.07)) .setCampo18ValorIcmsSt(BigDecimal.valueOf(10.08)) .setCampo19IndicadorPeriodo(SFIndicadorPeriodo.MENSAL) .setCampo20CodigoSituacaoTributariaIpi("000111") .setCampo21CodigoEnquadramentoIpi("001000") .setCampo22ValorBaseCalculoIpi(BigDecimal.valueOf(10.09)) .setCampo23ValorAliquotaIpi(BigDecimal.valueOf(10.1)) .setCampo24ValorIpi(BigDecimal.valueOf(10.11)) .setCampo25CodigoStPis("001001") .setCampo26ValorBaseCalculoPis(BigDecimal.valueOf(10.12)) .setCampo27ValorAliquotaPercentualPis(BigDecimal.valueOf(10.13)) .setCampo28QuantidadeBaseCalculoPis(BigDecimal.valueOf(10.14)) .setCampo29ValorAliquotaPis(BigDecimal.valueOf(10.15)) .setCampo30ValorPis(BigDecimal.valueOf(10.16)) .setCampo31CodigoStCofins("001010") .setCampo32ValorBaseCalculoCofins(BigDecimal.valueOf(10.17)) .setCampo33ValorAliquotaPercentualCofins(BigDecimal.valueOf(10.18)) .setCampo34QuantidadeBaseCalculoCofins(BigDecimal.valueOf(10.19)) .setCampo35ValorAliquotaCofins(BigDecimal.valueOf(10.2)) .setCampo36ValorCofins(BigDecimal.valueOf(10.21)) .setCampo37ContaContabil("001011"); Assert.assertEquals("|C170|000000|000001|000010|10,00000|000011|10,01|10,02|0|000100|000101|000110|10,03|10,04|10,05|10,06|10,07|10,08|0|000111|001000|10,09|10,10|10,11|001001|10,12|10,13|10,14|10,15|10,16|001010|10,17|10,18|10,19|10,20|10,21|001011|", linha.toString()); } }
{ "content_hash": "854183857c03f5ed4e2e649904e74caf", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 279, "avg_line_length": 56.5, "alnum_prop": 0.6709275647328745, "repo_name": "wmixlabs/sped", "id": "fa9206f23641db62000fb0b032d8d523bedc4dad", "size": "3051", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/br/com/wmixvideo/sped/leiaute/blococ/SFC170ItemDocumentoTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "259597" } ], "symlink_target": "" }
WampSharp ========= [![NuGet Version][NuGetImgMaster]][NuGetLinkMaster] A C# implementation of [WAMP (The Web Application Messaging Protocol)][WampLink] The implementation supports WAMPv2 and includes both Json and MsgPack support, and both Router (Broker and Dealer roles) and Client (Publisher/Subscriber and Callee/Caller) roles. The implementation also supports WAMPv1, both client and server roles. ## Builds Master | Provider ------ | -------- [![Build Status][WinImgMaster]][WinLinkMaster] | Windows CI Provided By [CodeBetter][] and [JetBrains][] [![Build Status][AppVeyorImgMaster]][AppVeyorLinkMaster] | Windows CI Provided By [AppVeyor][] [![Build Status][MonoImgMaster]][MonoLinkMaster] | Mono CI Provided by [travis-ci][] ## WampSharp v1.2.2.8-beta WampSharp v1.2.2.8-beta released, see version [release notes](https://github.com/Code-Sharp/WampSharp/wiki/WampSharp-v1.2.2.8-beta-release-notes). ## Get Started See [Get started tutorial](https://github.com/Code-Sharp/WampSharp/wiki/Getting-started-with-WAMPv2) and * [Getting started with Callee](https://github.com/Code-Sharp/WampSharp/wiki/Getting-Started-with-Callee) * [Getting started with Caller](https://github.com/Code-Sharp/WampSharp/wiki/Getting-Started-with-Caller) * [Getting started with Subscriber](https://github.com/Code-Sharp/WampSharp/wiki/Getting-Started-with-Subscriber) * [Getting started with Publisher](https://github.com/Code-Sharp/WampSharp/wiki/Getting-Started-with-Publisher) See [Wiki documentation](https://github.com/Code-Sharp/WampSharp/wiki) for more help. ## WAMPv1 support WAMPv1 support is still available. You can read about it at the [Wiki](https://github.com/Code-Sharp/WampSharp/wiki). In order to use it, Install WampSharp.WAMP1.Default from NuGet. If you're updating from a previous WampSharp version and you're not interested yet in updating your application to WAMPv2, please read the following [notes](https://github.com/Code-Sharp/WampSharp/wiki/Notes-for-WAMPv1-users). ## Donations If you found WampSharp helpful and want to donate, you are welcome to do so via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UHRAS9KZPNPX4). Your donations help keep this project development alive. [WampLink]:http://wamp.ws [NuGetImgMaster]:http://img.shields.io/nuget/v/WampSharp.Default.svg [NuGetLinkMaster]:http://www.nuget.org/packages/WampSharp.Default/ [WinImgMaster]:https://img.shields.io/teamcity/codebetter/WampSharp_Wampv2_Build.svg [WinLinkMaster]:http://teamcity.codebetter.com/project.html?projectId=WampSharp_Wampv2&guest=1 [MonoImgMaster]:https://img.shields.io/travis/Code-Sharp/WampSharp/wampv2.svg [MonoLinkMaster]:https://travis-ci.org/Code-Sharp/WampSharp [AppVeyorLinkMaster]:https://ci.appveyor.com/project/darkl/wampsharp-759 [AppVeyorImgMaster]:https://ci.appveyor.com/api/projects/status/fgbqbgwqx4j8jain [JetBrains]:http://www.jetbrains.com/ [CodeBetter]:http://codebetter.com/ [travis-ci]:https://travis-ci.org/ [AppVeyor]:http://www.appveyor.com/
{ "content_hash": "a90a6c3de211e822fe96fc1a88d1108d", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 226, "avg_line_length": 48.79032258064516, "alnum_prop": 0.7755371900826447, "repo_name": "jmptrader/WampSharp", "id": "14baa9ab1d7489212eb4dc6657f51081efbf28c7", "size": "3025", "binary": false, "copies": "1", "ref": "refs/heads/wampv2", "path": "README.md", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C#", "bytes": "2034854" }, { "name": "JavaScript", "bytes": "16340" }, { "name": "Shell", "bytes": "731" } ], "symlink_target": "" }
#pragma once // Automatically generated header file #include "lwm2m/objects.h" namespace KnownObjects { namespace id3339 { // Custom, overrideable types for Opaque and String resources #ifndef Clip3339 class ClipType : public Opaque<30> {}; #endif #ifndef Trigger3339 class TriggerType : public Opaque<30> {}; #endif #ifndef ApplicationType3339 class ApplicationTypeType : public PreallocString<30> {}; #endif /* \brief Class for object 3339 - Audio Clip * This IPSO object should be used for a speaker that plays a pre-recorded audio clip or * an audio output that is sent elsewhere. For example, an elevator which announces the * floor of the building. A resource is provided to store the clip, a dimmer resource controls * the relative sound level of the playback, and a duration resource limits the maximum * playback time. After the duration time is reached, any remaining samples in the clip * are ignored, and the clip player will be ready to play another clip. */ class instance : public Lwm2mObjectInstance { public: // 5522 - Audio Clip that is playable (i.e. short audio recording indicating the floor in an elevator). ClipType Clip; // Optional resource // 5523 - Trigger initiating actuation. Executable Trigger; // Optional resource // 5851 - Proportional control, integer value between 0 and 100 as a percentage. int Dimmer; // Optional resource // 5524 - The duration of the sound once trigger. float Duration; // Optional resource // 5750 - The application type of the sensor or actuator as a string depending on the use case. ApplicationTypeType ApplicationType; }; enum class RESID { Clip = 5522, Trigger = 5523, Dimmer = 5851, Duration = 5524, ApplicationType = 5750, }; /* \brief Class for object 3339 - Audio Clip * This IPSO object should be used for a speaker that plays a pre-recorded audio clip or * an audio output that is sent elsewhere. For example, an elevator which announces the * floor of the building. A resource is provided to store the clip, a dimmer resource controls * the relative sound level of the playback, and a duration resource limits the maximum * playback time. After the duration time is reached, any remaining samples in the clip * are ignored, and the clip player will be ready to play another clip. */ class object : public Lwm2mObject<3339, object, instance> { public: // 5522 - Audio Clip that is playable (i.e. short audio recording indicating the floor in an elevator). Resource(5522, &instance::Clip, O_RES_RW) Clip; // Optional resource // 5523 - Trigger initiating actuation. Resource(5523, &instance::Trigger) Trigger; // Optional resource // 5851 - Proportional control, integer value between 0 and 100 as a percentage. Resource(5851, &instance::Dimmer, O_RES_RW) Dimmer; // Optional resource // 5524 - The duration of the sound once trigger. Resource(5524, &instance::Duration, O_RES_RW) Duration; // Optional resource // 5750 - The application type of the sensor or actuator as a string depending on the use case. Resource(5750, &instance::ApplicationType, O_RES_RW) ApplicationType; }; } // end of id namespace } // end of KnownObjects namespace inline bool operator== (KnownObjects::id3339::RESID c1, uint16_t c2) { return (uint16_t) c1 == c2; } inline bool operator== (uint16_t c2, KnownObjects::id3339::RESID c1) { return (uint16_t) c1 == c2; }
{ "content_hash": "7d7d7400c5f3063d80e607cb5101ed37", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 107, "avg_line_length": 36.16161616161616, "alnum_prop": 0.7041899441340782, "repo_name": "Openhab-Nodes/libWakaamaEmb", "id": "03217d4b0e994611058ae65e02d80e6afbb3bc77", "size": "3580", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/include/lwm2mObjects/3339.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "3256866" }, { "name": "C++", "bytes": "32900" }, { "name": "CMake", "bytes": "7719" }, { "name": "Makefile", "bytes": "5630" }, { "name": "Python", "bytes": "109" }, { "name": "Shell", "bytes": "3474" } ], "symlink_target": "" }
<?php namespace MyApp\UserBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class RegistrationUserOneController extends Controller { public function registerAction() { return $this->container ->get('pugx_multi_user.registration_manager') ->register('MyApp\UserBundle\Entity\UserOne'); } }
{ "content_hash": "9425ef9d807d852ffa70ea62e832d048", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 66, "avg_line_length": 25.2, "alnum_prop": 0.6798941798941799, "repo_name": "Mehrezlabidi/Mehrez", "id": "bbcf6cfd5fab4c65c588074e37d3c81226d5c1a2", "size": "378", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/MyApp/UserBundle/Controller/RegistrationUserOneController.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "193335" }, { "name": "JavaScript", "bytes": "460299" }, { "name": "PHP", "bytes": "118973" }, { "name": "Shell", "bytes": "2973" } ], "symlink_target": "" }
"use strict"; let config = require('./server_config'), Search = require('bing.search'), search = new Search(config.bing.accountKey); module.exports = function(req, cb) { search.images( req.query.query, { top: 1, skip: req.query.index }, function(err, images) { if (err) { return cb(err); } let image = images[0]; image ? cb(null, image.url) : cb(new Error('No images found')); } ); };
{ "content_hash": "410efb2b00028ff3d84b2d8c13a3df54", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 75, "avg_line_length": 22.166666666666668, "alnum_prop": 0.4830827067669173, "repo_name": "mjhasbach/material-qna", "id": "62624357aec8c38454e09f5599dbce821ffb004e", "size": "532", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/image_search.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4146" }, { "name": "HTML", "bytes": "23433" }, { "name": "JavaScript", "bytes": "59352" } ], "symlink_target": "" }
<?php class Ticket587TestCase extends PradoGenericSelenium2Test { function testKeyPress() { $base = 'ctl0_Content_'; $this->url('tickets/index.php?page=Ticket587_reopened'); $this->assertEquals($this->title(), "Verifying Ticket 587_reopened"); $this->assertText($base."label1", "Label 1"); $this->select($base."list1", "item 3"); $this->pause(800); $this->select($base."list2", "value 3 - item 4"); $this->pause(800); $this->assertText($base."label1", "Selection 2: value 3 - item 4"); $this->type($base.'text1', 't'); $this->pause(800); $this->select($base."list2", "asd 3 - item 2"); $this->pause(800); $this->assertText($base."label1", "Selection 2: asd 3 - item 2"); } function testButtonClick() { $base = 'ctl0_Content_'; $this->url('tickets/index.php?page=Ticket587_reopened'); $this->assertEquals($this->title(), "Verifying Ticket 587_reopened"); $this->assertText($base."label1", "Label 1"); $this->select($base."list1", "item 3"); $this->pause(800); $this->select($base."list2", "value 3 - item 4"); $this->pause(800); $this->assertText($base."label1", "Selection 2: value 3 - item 4"); $this->byId($base.'button6')->click(); $this->pause(800); $this->select($base."list2", "asd 3 - item 2"); $this->pause(800); $this->assertText($base."label1", "Selection 2: asd 3 - item 2"); } }
{ "content_hash": "85dcf9c74a7801089eb989a5ae6160ed", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 71, "avg_line_length": 30.886363636363637, "alnum_prop": 0.6298749080206034, "repo_name": "mmauri04/prado", "id": "cb42c3433406d474e9159c980c9b37be987e9911", "size": "1359", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "tests/FunctionalTests/tickets/tests/Ticket587TestCase.php", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "660" }, { "name": "Batchfile", "bytes": "5993" }, { "name": "CSS", "bytes": "114399" }, { "name": "HTML", "bytes": "335465" }, { "name": "JavaScript", "bytes": "961554" }, { "name": "PHP", "bytes": "6962457" }, { "name": "Smarty", "bytes": "123746" }, { "name": "TeX", "bytes": "13306" }, { "name": "XSLT", "bytes": "252" } ], "symlink_target": "" }
<?php class validate_reseller { /* Validator function to check if a given cron command is in correct form (url only). */ function limit_client($field_name, $field_value, $validator) { global $app; if($field_value <= 0) { return $app->tform->lng('limit_client_error_positive'); } else { return ''; } } }
{ "content_hash": "4e23faca05547754d077755ce6ff5a4f", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 90, "avg_line_length": 17.142857142857142, "alnum_prop": 0.5805555555555556, "repo_name": "TR-Host/THConfig", "id": "b04adb3cd34bae360700b9167a5b38eb991d2ca0", "size": "1895", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "interface/lib/classes/validate_reseller.inc.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "230028" }, { "name": "JavaScript", "bytes": "29290" }, { "name": "PHP", "bytes": "4877846" }, { "name": "Shell", "bytes": "34506" } ], "symlink_target": "" }
// AssemblyInfo.cs // (c) Copyright Cirrious Ltd. http://www.cirrious.com // MvvmCross is licensed using Microsoft Public License (Ms-PL) // Contributions and inspirations noted in readme.md and license.txt // // Project Lead - Stuart Lodge, @slodge, [email protected] using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Cirrious.MvvmCross.Plugins.Network.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Cirrious")] [assembly: AssemblyProduct("Cirrious.MvvmCross.Plugins.Network.Test")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("0b94cd82-d2f3-4433-821f-06decb80dcd0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "c78f8a373d75a6ba18a4c553e834978a", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 84, "avg_line_length": 36.73913043478261, "alnum_prop": 0.7449704142011835, "repo_name": "MatthewSannes/MvvmCross-Plugins", "id": "318651ec5a97cd5975c7aa5f031a488710ca20f3", "size": "1693", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Network/MvvmCross.Plugins.Network.Test/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "5211" }, { "name": "C#", "bytes": "885682" }, { "name": "PowerShell", "bytes": "5282" }, { "name": "Puppet", "bytes": "10798" } ], "symlink_target": "" }
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. #define CARES_STATICLIB #include "ares.h" #include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" #include "node.h" #include "req-wrap.h" #include "req-wrap-inl.h" #include "tree.h" #include "util.h" #include "util-inl.h" #include "uv.h" #include <errno.h> #include <stdlib.h> #include <string.h> #if defined(__ANDROID__) || \ defined(__MINGW32__) || \ defined(__OpenBSD__) || \ defined(_MSC_VER) # include <nameser.h> #else # include <arpa/nameser.h> #endif #if defined(__OpenBSD__) # define AI_V4MAPPED 0 #endif namespace node { namespace cares_wrap { using v8::Array; using v8::Context; using v8::EscapableHandleScope; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; using v8::Integer; using v8::Local; using v8::Null; using v8::Object; using v8::String; using v8::Value; namespace { inline const char* ToErrorCodeString(int status) { switch (status) { #define V(code) case ARES_##code: return #code; V(EADDRGETNETWORKPARAMS) V(EBADFAMILY) V(EBADFLAGS) V(EBADHINTS) V(EBADNAME) V(EBADQUERY) V(EBADRESP) V(EBADSTR) V(ECANCELLED) V(ECONNREFUSED) V(EDESTRUCTION) V(EFILE) V(EFORMERR) V(ELOADIPHLPAPI) V(ENODATA) V(ENOMEM) V(ENONAME) V(ENOTFOUND) V(ENOTIMP) V(ENOTINITIALIZED) V(EOF) V(EREFUSED) V(ESERVFAIL) V(ETIMEOUT) #undef V } return "UNKNOWN_ARES_ERROR"; } class GetAddrInfoReqWrap : public ReqWrap<uv_getaddrinfo_t> { public: GetAddrInfoReqWrap(Environment* env, Local<Object> req_wrap_obj); ~GetAddrInfoReqWrap(); size_t self_size() const override { return sizeof(*this); } }; GetAddrInfoReqWrap::GetAddrInfoReqWrap(Environment* env, Local<Object> req_wrap_obj) : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) { Wrap(req_wrap_obj, this); } GetAddrInfoReqWrap::~GetAddrInfoReqWrap() { ClearWrap(object()); } class GetNameInfoReqWrap : public ReqWrap<uv_getnameinfo_t> { public: GetNameInfoReqWrap(Environment* env, Local<Object> req_wrap_obj); ~GetNameInfoReqWrap(); size_t self_size() const override { return sizeof(*this); } }; GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env, Local<Object> req_wrap_obj) : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) { Wrap(req_wrap_obj, this); } GetNameInfoReqWrap::~GetNameInfoReqWrap() { ClearWrap(object()); } int cmp_ares_tasks(const node_ares_task* a, const node_ares_task* b) { if (a->sock < b->sock) return -1; if (a->sock > b->sock) return 1; return 0; } RB_GENERATE_STATIC(node_ares_task_list, node_ares_task, node, cmp_ares_tasks) /* This is called once per second by loop->timer. It is used to constantly */ /* call back into c-ares for possibly processing timeouts. */ void ares_timeout(uv_timer_t* handle) { Environment* env = Environment::from_cares_timer_handle(handle); CHECK_EQ(false, RB_EMPTY(env->cares_task_list())); ares_process_fd(env->cares_channel(), ARES_SOCKET_BAD, ARES_SOCKET_BAD); } void ares_poll_cb(uv_poll_t* watcher, int status, int events) { node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher, watcher); Environment* env = task->env; /* Reset the idle timer */ uv_timer_again(env->cares_timer_handle()); if (status < 0) { /* An error happened. Just pretend that the socket is both readable and */ /* writable. */ ares_process_fd(env->cares_channel(), task->sock, task->sock); return; } /* Process DNS responses */ ares_process_fd(env->cares_channel(), events & UV_READABLE ? task->sock : ARES_SOCKET_BAD, events & UV_WRITABLE ? task->sock : ARES_SOCKET_BAD); } void ares_poll_close_cb(uv_handle_t* watcher) { node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher, reinterpret_cast<uv_poll_t*>(watcher)); free(task); } /* Allocates and returns a new node_ares_task */ node_ares_task* ares_task_create(Environment* env, ares_socket_t sock) { auto task = node::UncheckedMalloc<node_ares_task>(1); if (task == nullptr) { /* Out of memory. */ return nullptr; } task->env = env; task->sock = sock; if (uv_poll_init_socket(env->event_loop(), &task->poll_watcher, sock) < 0) { /* This should never happen. */ free(task); return nullptr; } return task; } /* Callback from ares when socket operation is started */ void ares_sockstate_cb(void* data, ares_socket_t sock, int read, int write) { Environment* env = static_cast<Environment*>(data); node_ares_task* task; node_ares_task lookup_task; lookup_task.sock = sock; task = RB_FIND(node_ares_task_list, env->cares_task_list(), &lookup_task); if (read || write) { if (!task) { /* New socket */ /* If this is the first socket then start the timer. */ uv_timer_t* timer_handle = env->cares_timer_handle(); if (!uv_is_active(reinterpret_cast<uv_handle_t*>(timer_handle))) { CHECK(RB_EMPTY(env->cares_task_list())); uv_timer_start(timer_handle, ares_timeout, 1000, 1000); } task = ares_task_create(env, sock); if (task == nullptr) { /* This should never happen unless we're out of memory or something */ /* is seriously wrong. The socket won't be polled, but the query will */ /* eventually time out. */ return; } RB_INSERT(node_ares_task_list, env->cares_task_list(), task); } /* This should never fail. If it fails anyway, the query will eventually */ /* time out. */ uv_poll_start(&task->poll_watcher, (read ? UV_READABLE : 0) | (write ? UV_WRITABLE : 0), ares_poll_cb); } else { /* read == 0 and write == 0 this is c-ares's way of notifying us that */ /* the socket is now closed. We must free the data associated with */ /* socket. */ CHECK(task && "When an ares socket is closed we should have a handle for it"); RB_REMOVE(node_ares_task_list, env->cares_task_list(), task); uv_close(reinterpret_cast<uv_handle_t*>(&task->poll_watcher), ares_poll_close_cb); if (RB_EMPTY(env->cares_task_list())) { uv_timer_stop(env->cares_timer_handle()); } } } Local<Array> HostentToAddresses(Environment* env, struct hostent* host) { EscapableHandleScope scope(env->isolate()); Local<Array> addresses = Array::New(env->isolate()); char ip[INET6_ADDRSTRLEN]; for (uint32_t i = 0; host->h_addr_list[i] != nullptr; ++i) { uv_inet_ntop(host->h_addrtype, host->h_addr_list[i], ip, sizeof(ip)); Local<String> address = OneByteString(env->isolate(), ip); addresses->Set(i, address); } return scope.Escape(addresses); } Local<Array> HostentToNames(Environment* env, struct hostent* host) { EscapableHandleScope scope(env->isolate()); Local<Array> names = Array::New(env->isolate()); for (uint32_t i = 0; host->h_aliases[i] != nullptr; ++i) { Local<String> address = OneByteString(env->isolate(), host->h_aliases[i]); names->Set(i, address); } return scope.Escape(names); } void safe_free_hostent(struct hostent* host) { int idx; if (host->h_addr_list != nullptr) { idx = 0; while (host->h_addr_list[idx]) { free(host->h_addr_list[idx++]); } free(host->h_addr_list); host->h_addr_list = 0; } if (host->h_aliases != nullptr) { idx = 0; while (host->h_aliases[idx]) { free(host->h_aliases[idx++]); } free(host->h_aliases); host->h_aliases = 0; } if (host->h_name != nullptr) { free(host->h_name); } host->h_addrtype = host->h_length = 0; } void cares_wrap_hostent_cpy(struct hostent* dest, struct hostent* src) { dest->h_addr_list = nullptr; dest->h_addrtype = 0; dest->h_aliases = nullptr; dest->h_length = 0; dest->h_name = nullptr; /* copy `h_name` */ size_t name_size = strlen(src->h_name) + 1; dest->h_name = node::Malloc<char>(name_size); memcpy(dest->h_name, src->h_name, name_size); /* copy `h_aliases` */ size_t alias_count; size_t cur_alias_length; for (alias_count = 0; src->h_aliases[alias_count] != nullptr; alias_count++) { } dest->h_aliases = node::Malloc<char*>(alias_count + 1); for (size_t i = 0; i < alias_count; i++) { cur_alias_length = strlen(src->h_aliases[i]); dest->h_aliases[i] = node::Malloc(cur_alias_length + 1); memcpy(dest->h_aliases[i], src->h_aliases[i], cur_alias_length + 1); } dest->h_aliases[alias_count] = nullptr; /* copy `h_addr_list` */ size_t list_count; for (list_count = 0; src->h_addr_list[list_count] != nullptr; list_count++) { } dest->h_addr_list = node::Malloc<char*>(list_count + 1); for (size_t i = 0; i < list_count; i++) { dest->h_addr_list[i] = node::Malloc(src->h_length); memcpy(dest->h_addr_list[i], src->h_addr_list[i], src->h_length); } dest->h_addr_list[list_count] = nullptr; /* work after work */ dest->h_length = src->h_length; dest->h_addrtype = src->h_addrtype; } class QueryWrap; struct CaresAsyncData { QueryWrap* wrap; int status; bool is_host; union { hostent* host; unsigned char* buf; } data; int len; uv_async_t async_handle; }; void SetupCaresChannel(Environment* env) { struct ares_options options; memset(&options, 0, sizeof(options)); options.flags = ARES_FLAG_NOCHECKRESP; options.sock_state_cb = ares_sockstate_cb; options.sock_state_cb_data = env; /* We do the call to ares_init_option for caller. */ int r = ares_init_options(env->cares_channel_ptr(), &options, ARES_OPT_FLAGS | ARES_OPT_SOCK_STATE_CB); if (r != ARES_SUCCESS) { ares_library_cleanup(); return env->ThrowError(ToErrorCodeString(r)); } } /** * This function is to check whether current servers are fallback servers * when cares initialized. * * The fallback servers of cares is [ "127.0.0.1" ] with no user additional * setting. */ void AresEnsureServers(Environment* env) { /* if last query is OK or servers are set by user self, do not check */ if (env->cares_query_last_ok() || !env->cares_is_servers_default()) { return; } ares_channel channel = env->cares_channel(); ares_addr_node* servers = nullptr; ares_get_servers(channel, &servers); /* if no server or multi-servers, ignore */ if (servers == nullptr) return; if (servers->next != nullptr) { ares_free_data(servers); env->set_cares_is_servers_default(false); return; } /* if the only server is not 127.0.0.1, ignore */ if (servers[0].family != AF_INET || servers[0].addr.addr4.s_addr != htonl(INADDR_LOOPBACK)) { ares_free_data(servers); env->set_cares_is_servers_default(false); return; } ares_free_data(servers); servers = nullptr; /* destroy channel and reset channel */ ares_destroy(channel); SetupCaresChannel(env); } class QueryWrap : public AsyncWrap { public: QueryWrap(Environment* env, Local<Object> req_wrap_obj) : AsyncWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_QUERYWRAP) { if (env->in_domain()) req_wrap_obj->Set(env->domain_string(), env->domain_array()->Get(0)); Wrap(req_wrap_obj, this); } ~QueryWrap() override { CHECK_EQ(false, persistent().IsEmpty()); ClearWrap(object()); persistent().Reset(); } // Subclasses should implement the appropriate Send method. virtual int Send(const char* name) { UNREACHABLE(); return 0; } virtual int Send(const char* name, int family) { UNREACHABLE(); return 0; } protected: void* GetQueryArg() { return static_cast<void*>(this); } static void AresQuery(Environment* env, const char* name, int dnsclass, int type, ares_callback callback, void* arg) { AresEnsureServers(env); ares_query(env->cares_channel(), name, dnsclass, type, callback, arg); } static void CaresAsyncClose(uv_handle_t* handle) { uv_async_t* async = reinterpret_cast<uv_async_t*>(handle); auto data = static_cast<struct CaresAsyncData*>(async->data); delete data->wrap; delete data; } static void CaresAsyncCb(uv_async_t* handle) { auto data = static_cast<struct CaresAsyncData*>(handle->data); QueryWrap* wrap = data->wrap; int status = data->status; if (status != ARES_SUCCESS) { wrap->ParseError(status); } else if (!data->is_host) { unsigned char* buf = data->data.buf; wrap->Parse(buf, data->len); free(buf); } else { hostent* host = data->data.host; wrap->Parse(host); safe_free_hostent(host); free(host); } uv_close(reinterpret_cast<uv_handle_t*>(handle), CaresAsyncClose); } static void Callback(void *arg, int status, int timeouts, unsigned char* answer_buf, int answer_len) { QueryWrap* wrap = static_cast<QueryWrap*>(arg); unsigned char* buf_copy = nullptr; if (status == ARES_SUCCESS) { buf_copy = node::Malloc<unsigned char>(answer_len); memcpy(buf_copy, answer_buf, answer_len); } CaresAsyncData* data = new CaresAsyncData(); data->status = status; data->wrap = wrap; data->is_host = false; data->data.buf = buf_copy; data->len = answer_len; uv_async_t* async_handle = &data->async_handle; CHECK_EQ(0, uv_async_init(wrap->env()->event_loop(), async_handle, CaresAsyncCb)); wrap->env()->set_cares_query_last_ok(status != ARES_ECONNREFUSED); async_handle->data = data; uv_async_send(async_handle); } static void Callback(void *arg, int status, int timeouts, struct hostent* host) { QueryWrap* wrap = static_cast<QueryWrap*>(arg); struct hostent* host_copy = nullptr; if (status == ARES_SUCCESS) { host_copy = node::Malloc<hostent>(1); cares_wrap_hostent_cpy(host_copy, host); } CaresAsyncData* data = new CaresAsyncData(); data->status = status; data->data.host = host_copy; data->wrap = wrap; data->is_host = true; uv_async_t* async_handle = &data->async_handle; CHECK_EQ(0, uv_async_init(wrap->env()->event_loop(), async_handle, CaresAsyncCb)); wrap->env()->set_cares_query_last_ok(status != ARES_ECONNREFUSED); async_handle->data = data; uv_async_send(async_handle); } void CallOnComplete(Local<Value> answer, Local<Value> extra = Local<Value>()) { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); Local<Value> argv[] = { Integer::New(env()->isolate(), 0), answer, extra }; const int argc = arraysize(argv) - extra.IsEmpty(); MakeCallback(env()->oncomplete_string(), argc, argv); } void ParseError(int status) { CHECK_NE(status, ARES_SUCCESS); HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); const char* code = ToErrorCodeString(status); Local<Value> arg = OneByteString(env()->isolate(), code); MakeCallback(env()->oncomplete_string(), 1, &arg); } // Subclasses should implement the appropriate Parse method. virtual void Parse(unsigned char* buf, int len) { UNREACHABLE(); } virtual void Parse(struct hostent* host) { UNREACHABLE(); } }; class QueryAWrap: public QueryWrap { public: QueryAWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_a, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); hostent* host; ares_addrttl addrttls[256]; int naddrttls = arraysize(addrttls); int status = ares_parse_a_reply(buf, len, &host, addrttls, &naddrttls); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> addresses = HostentToAddresses(env(), host); Local<Array> ttls = Array::New(env()->isolate(), naddrttls); auto context = env()->context(); for (int i = 0; i < naddrttls; i += 1) { auto value = Integer::New(env()->isolate(), addrttls[i].ttl); ttls->Set(context, i, value).FromJust(); } ares_free_hostent(host); CallOnComplete(addresses, ttls); } }; class QueryAaaaWrap: public QueryWrap { public: QueryAaaaWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_aaaa, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); hostent* host; ares_addr6ttl addrttls[256]; int naddrttls = arraysize(addrttls); int status = ares_parse_aaaa_reply(buf, len, &host, addrttls, &naddrttls); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> addresses = HostentToAddresses(env(), host); Local<Array> ttls = Array::New(env()->isolate(), naddrttls); auto context = env()->context(); for (int i = 0; i < naddrttls; i += 1) { auto value = Integer::New(env()->isolate(), addrttls[i].ttl); ttls->Set(context, i, value).FromJust(); } ares_free_hostent(host); CallOnComplete(addresses, ttls); } }; class QueryCnameWrap: public QueryWrap { public: QueryCnameWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_cname, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); struct hostent* host; int status = ares_parse_a_reply(buf, len, &host, nullptr, nullptr); if (status != ARES_SUCCESS) { ParseError(status); return; } // A cname lookup always returns a single record but we follow the // common API here. Local<Array> result = Array::New(env()->isolate(), 1); result->Set(0, OneByteString(env()->isolate(), host->h_name)); ares_free_hostent(host); this->CallOnComplete(result); } }; class QueryMxWrap: public QueryWrap { public: QueryMxWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_mx, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); struct ares_mx_reply* mx_start; int status = ares_parse_mx_reply(buf, len, &mx_start); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> mx_records = Array::New(env()->isolate()); Local<String> exchange_symbol = env()->exchange_string(); Local<String> priority_symbol = env()->priority_string(); ares_mx_reply* current = mx_start; for (uint32_t i = 0; current != nullptr; ++i, current = current->next) { Local<Object> mx_record = Object::New(env()->isolate()); mx_record->Set(exchange_symbol, OneByteString(env()->isolate(), current->host)); mx_record->Set(priority_symbol, Integer::New(env()->isolate(), current->priority)); mx_records->Set(i, mx_record); } ares_free_data(mx_start); this->CallOnComplete(mx_records); } }; class QueryNsWrap: public QueryWrap { public: QueryNsWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_ns, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); struct hostent* host; int status = ares_parse_ns_reply(buf, len, &host); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> names = HostentToNames(env(), host); ares_free_hostent(host); this->CallOnComplete(names); } }; class QueryTxtWrap: public QueryWrap { public: QueryTxtWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_txt, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); struct ares_txt_ext* txt_out; int status = ares_parse_txt_reply_ext(buf, len, &txt_out); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> txt_records = Array::New(env()->isolate()); Local<Array> txt_chunk; struct ares_txt_ext* current = txt_out; uint32_t i = 0; for (uint32_t j = 0; current != nullptr; current = current->next) { Local<String> txt = OneByteString(env()->isolate(), current->txt); // New record found - write out the current chunk if (current->record_start) { if (!txt_chunk.IsEmpty()) txt_records->Set(i++, txt_chunk); txt_chunk = Array::New(env()->isolate()); j = 0; } txt_chunk->Set(j++, txt); } // Push last chunk if it isn't empty if (!txt_chunk.IsEmpty()) txt_records->Set(i, txt_chunk); ares_free_data(txt_out); this->CallOnComplete(txt_records); } }; class QuerySrvWrap: public QueryWrap { public: explicit QuerySrvWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_srv, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); struct ares_srv_reply* srv_start; int status = ares_parse_srv_reply(buf, len, &srv_start); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> srv_records = Array::New(env()->isolate()); Local<String> name_symbol = env()->name_string(); Local<String> port_symbol = env()->port_string(); Local<String> priority_symbol = env()->priority_string(); Local<String> weight_symbol = env()->weight_string(); ares_srv_reply* current = srv_start; for (uint32_t i = 0; current != nullptr; ++i, current = current->next) { Local<Object> srv_record = Object::New(env()->isolate()); srv_record->Set(name_symbol, OneByteString(env()->isolate(), current->host)); srv_record->Set(port_symbol, Integer::New(env()->isolate(), current->port)); srv_record->Set(priority_symbol, Integer::New(env()->isolate(), current->priority)); srv_record->Set(weight_symbol, Integer::New(env()->isolate(), current->weight)); srv_records->Set(i, srv_record); } ares_free_data(srv_start); this->CallOnComplete(srv_records); } }; class QueryPtrWrap: public QueryWrap { public: explicit QueryPtrWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_ptr, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); struct hostent* host; int status = ares_parse_ptr_reply(buf, len, NULL, 0, AF_INET, &host); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> aliases = Array::New(env()->isolate()); for (uint32_t i = 0; host->h_aliases[i] != NULL; i++) { aliases->Set(i, OneByteString(env()->isolate(), host->h_aliases[i])); } ares_free_hostent(host); this->CallOnComplete(aliases); } }; class QueryNaptrWrap: public QueryWrap { public: explicit QueryNaptrWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_naptr, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); ares_naptr_reply* naptr_start; int status = ares_parse_naptr_reply(buf, len, &naptr_start); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Array> naptr_records = Array::New(env()->isolate()); Local<String> flags_symbol = env()->flags_string(); Local<String> service_symbol = env()->service_string(); Local<String> regexp_symbol = env()->regexp_string(); Local<String> replacement_symbol = env()->replacement_string(); Local<String> order_symbol = env()->order_string(); Local<String> preference_symbol = env()->preference_string(); ares_naptr_reply* current = naptr_start; for (uint32_t i = 0; current != nullptr; ++i, current = current->next) { Local<Object> naptr_record = Object::New(env()->isolate()); naptr_record->Set(flags_symbol, OneByteString(env()->isolate(), current->flags)); naptr_record->Set(service_symbol, OneByteString(env()->isolate(), current->service)); naptr_record->Set(regexp_symbol, OneByteString(env()->isolate(), current->regexp)); naptr_record->Set(replacement_symbol, OneByteString(env()->isolate(), current->replacement)); naptr_record->Set(order_symbol, Integer::New(env()->isolate(), current->order)); naptr_record->Set(preference_symbol, Integer::New(env()->isolate(), current->preference)); naptr_records->Set(i, naptr_record); } ares_free_data(naptr_start); this->CallOnComplete(naptr_records); } }; class QuerySoaWrap: public QueryWrap { public: QuerySoaWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { AresQuery(env(), name, ns_c_in, ns_t_soa, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(unsigned char* buf, int len) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); ares_soa_reply* soa_out; int status = ares_parse_soa_reply(buf, len, &soa_out); if (status != ARES_SUCCESS) { ParseError(status); return; } Local<Object> soa_record = Object::New(env()->isolate()); soa_record->Set(env()->nsname_string(), OneByteString(env()->isolate(), soa_out->nsname)); soa_record->Set(env()->hostmaster_string(), OneByteString(env()->isolate(), soa_out->hostmaster)); soa_record->Set(env()->serial_string(), Integer::New(env()->isolate(), soa_out->serial)); soa_record->Set(env()->refresh_string(), Integer::New(env()->isolate(), soa_out->refresh)); soa_record->Set(env()->retry_string(), Integer::New(env()->isolate(), soa_out->retry)); soa_record->Set(env()->expire_string(), Integer::New(env()->isolate(), soa_out->expire)); soa_record->Set(env()->minttl_string(), Integer::New(env()->isolate(), soa_out->minttl)); ares_free_data(soa_out); this->CallOnComplete(soa_record); } }; class GetHostByAddrWrap: public QueryWrap { public: explicit GetHostByAddrWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name) override { int length, family; char address_buffer[sizeof(struct in6_addr)]; if (uv_inet_pton(AF_INET, name, &address_buffer) == 0) { length = sizeof(struct in_addr); family = AF_INET; } else if (uv_inet_pton(AF_INET6, name, &address_buffer) == 0) { length = sizeof(struct in6_addr); family = AF_INET6; } else { return UV_EINVAL; // So errnoException() reports a proper error. } ares_gethostbyaddr(env()->cares_channel(), address_buffer, length, family, Callback, GetQueryArg()); return 0; } size_t self_size() const override { return sizeof(*this); } protected: void Parse(struct hostent* host) override { HandleScope handle_scope(env()->isolate()); Context::Scope context_scope(env()->context()); this->CallOnComplete(HostentToNames(env(), host)); } }; class GetHostByNameWrap: public QueryWrap { public: explicit GetHostByNameWrap(Environment* env, Local<Object> req_wrap_obj) : QueryWrap(env, req_wrap_obj) { } int Send(const char* name, int family) override { ares_gethostbyname(env()->cares_channel(), name, family, Callback, GetQueryArg()); return 0; } protected: void Parse(struct hostent* host) override { HandleScope scope(env()->isolate()); Local<Array> addresses = HostentToAddresses(env(), host); Local<Integer> family = Integer::New(env()->isolate(), host->h_addrtype); this->CallOnComplete(addresses, family); } }; template <class Wrap> static void Query(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); CHECK_EQ(false, args.IsConstructCall()); CHECK(args[0]->IsObject()); CHECK(args[1]->IsString()); Local<Object> req_wrap_obj = args[0].As<Object>(); Local<String> string = args[1].As<String>(); Wrap* wrap = new Wrap(env, req_wrap_obj); node::Utf8Value name(env->isolate(), string); int err = wrap->Send(*name); if (err) delete wrap; args.GetReturnValue().Set(err); } void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { GetAddrInfoReqWrap* req_wrap = static_cast<GetAddrInfoReqWrap*>(req->data); Environment* env = req_wrap->env(); HandleScope handle_scope(env->isolate()); Context::Scope context_scope(env->context()); Local<Value> argv[] = { Integer::New(env->isolate(), status), Null(env->isolate()) }; if (status == 0) { // Success struct addrinfo *address; int n = 0; // Create the response array. Local<Array> results = Array::New(env->isolate()); char ip[INET6_ADDRSTRLEN]; const char *addr; // Iterate over the IPv4 responses again this time creating javascript // strings for each IP and filling the results array. address = res; while (address) { CHECK_EQ(address->ai_socktype, SOCK_STREAM); // Ignore random ai_family types. if (address->ai_family == AF_INET) { // Juggle pointers addr = reinterpret_cast<char*>(&(reinterpret_cast<struct sockaddr_in*>( address->ai_addr)->sin_addr)); int err = uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN); if (err) continue; // Create JavaScript string Local<String> s = OneByteString(env->isolate(), ip); results->Set(n, s); n++; } // Increment address = address->ai_next; } // Iterate over the IPv6 responses putting them in the array. address = res; while (address) { CHECK_EQ(address->ai_socktype, SOCK_STREAM); // Ignore random ai_family types. if (address->ai_family == AF_INET6) { // Juggle pointers addr = reinterpret_cast<char*>(&(reinterpret_cast<struct sockaddr_in6*>( address->ai_addr)->sin6_addr)); int err = uv_inet_ntop(address->ai_family, addr, ip, INET6_ADDRSTRLEN); if (err) continue; // Create JavaScript string Local<String> s = OneByteString(env->isolate(), ip); results->Set(n, s); n++; } // Increment address = address->ai_next; } // No responses were found to return if (n == 0) { argv[0] = Integer::New(env->isolate(), UV_EAI_NODATA); } argv[1] = results; } uv_freeaddrinfo(res); // Make the callback into JavaScript req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); delete req_wrap; } void AfterGetNameInfo(uv_getnameinfo_t* req, int status, const char* hostname, const char* service) { GetNameInfoReqWrap* req_wrap = static_cast<GetNameInfoReqWrap*>(req->data); Environment* env = req_wrap->env(); HandleScope handle_scope(env->isolate()); Context::Scope context_scope(env->context()); Local<Value> argv[] = { Integer::New(env->isolate(), status), Null(env->isolate()), Null(env->isolate()) }; if (status == 0) { // Success Local<String> js_hostname = OneByteString(env->isolate(), hostname); Local<String> js_service = OneByteString(env->isolate(), service); argv[1] = js_hostname; argv[2] = js_service; } // Make the callback into JavaScript req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); delete req_wrap; } void IsIP(const FunctionCallbackInfo<Value>& args) { node::Utf8Value ip(args.GetIsolate(), args[0]); char address_buffer[sizeof(struct in6_addr)]; int rc = 0; if (uv_inet_pton(AF_INET, *ip, &address_buffer) == 0) rc = 4; else if (uv_inet_pton(AF_INET6, *ip, &address_buffer) == 0) rc = 6; args.GetReturnValue().Set(rc); } void IsIPv4(const FunctionCallbackInfo<Value>& args) { node::Utf8Value ip(args.GetIsolate(), args[0]); char address_buffer[sizeof(struct in_addr)]; if (uv_inet_pton(AF_INET, *ip, &address_buffer) == 0) { args.GetReturnValue().Set(true); } else { args.GetReturnValue().Set(false); } } void IsIPv6(const FunctionCallbackInfo<Value>& args) { node::Utf8Value ip(args.GetIsolate(), args[0]); char address_buffer[sizeof(struct in6_addr)]; if (uv_inet_pton(AF_INET6, *ip, &address_buffer) == 0) { args.GetReturnValue().Set(true); } else { args.GetReturnValue().Set(false); } } void GetAddrInfo(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsObject()); CHECK(args[1]->IsString()); CHECK(args[2]->IsInt32()); Local<Object> req_wrap_obj = args[0].As<Object>(); node::Utf8Value hostname(env->isolate(), args[1]); int32_t flags = (args[3]->IsInt32()) ? args[3]->Int32Value() : 0; int family; switch (args[2]->Int32Value()) { case 0: family = AF_UNSPEC; break; case 4: family = AF_INET; break; case 6: family = AF_INET6; break; default: CHECK(0 && "bad address family"); } GetAddrInfoReqWrap* req_wrap = new GetAddrInfoReqWrap(env, req_wrap_obj); struct addrinfo hints; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = flags; int err = uv_getaddrinfo(env->event_loop(), req_wrap->req(), AfterGetAddrInfo, *hostname, nullptr, &hints); req_wrap->Dispatched(); if (err) delete req_wrap; args.GetReturnValue().Set(err); } void GetNameInfo(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsObject()); CHECK(args[1]->IsString()); CHECK(args[2]->IsUint32()); Local<Object> req_wrap_obj = args[0].As<Object>(); node::Utf8Value ip(env->isolate(), args[1]); const unsigned port = args[2]->Uint32Value(); struct sockaddr_storage addr; CHECK(uv_ip4_addr(*ip, port, reinterpret_cast<sockaddr_in*>(&addr)) == 0 || uv_ip6_addr(*ip, port, reinterpret_cast<sockaddr_in6*>(&addr)) == 0); GetNameInfoReqWrap* req_wrap = new GetNameInfoReqWrap(env, req_wrap_obj); int err = uv_getnameinfo(env->event_loop(), req_wrap->req(), AfterGetNameInfo, (struct sockaddr*)&addr, NI_NAMEREQD); req_wrap->Dispatched(); if (err) delete req_wrap; args.GetReturnValue().Set(err); } void GetServers(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); Local<Array> server_array = Array::New(env->isolate()); ares_addr_node* servers; int r = ares_get_servers(env->cares_channel(), &servers); CHECK_EQ(r, ARES_SUCCESS); ares_addr_node* cur = servers; for (uint32_t i = 0; cur != nullptr; ++i, cur = cur->next) { char ip[INET6_ADDRSTRLEN]; const void* caddr = static_cast<const void*>(&cur->addr); int err = uv_inet_ntop(cur->family, caddr, ip, sizeof(ip)); CHECK_EQ(err, 0); Local<String> addr = OneByteString(env->isolate(), ip); server_array->Set(i, addr); } ares_free_data(servers); args.GetReturnValue().Set(server_array); } void SetServers(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsArray()); Local<Array> arr = Local<Array>::Cast(args[0]); uint32_t len = arr->Length(); if (len == 0) { int rv = ares_set_servers(env->cares_channel(), nullptr); return args.GetReturnValue().Set(rv); } ares_addr_node* servers = new ares_addr_node[len]; ares_addr_node* last = nullptr; int err; for (uint32_t i = 0; i < len; i++) { CHECK(arr->Get(i)->IsArray()); Local<Array> elm = Local<Array>::Cast(arr->Get(i)); CHECK(elm->Get(0)->Int32Value()); CHECK(elm->Get(1)->IsString()); int fam = elm->Get(0)->Int32Value(); node::Utf8Value ip(env->isolate(), elm->Get(1)); ares_addr_node* cur = &servers[i]; switch (fam) { case 4: cur->family = AF_INET; err = uv_inet_pton(AF_INET, *ip, &cur->addr); break; case 6: cur->family = AF_INET6; err = uv_inet_pton(AF_INET6, *ip, &cur->addr); break; default: CHECK(0 && "Bad address family."); } if (err) break; cur->next = nullptr; if (last != nullptr) last->next = cur; last = cur; } if (err == 0) err = ares_set_servers(env->cares_channel(), &servers[0]); else err = ARES_EBADSTR; delete[] servers; if (err == ARES_SUCCESS) env->set_cares_is_servers_default(false); args.GetReturnValue().Set(err); } void StrError(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); const char* errmsg = ares_strerror(args[0]->Int32Value()); args.GetReturnValue().Set(OneByteString(env->isolate(), errmsg)); } void CaresTimerCloseCb(uv_handle_t* handle) { Environment* env = Environment::from_cares_timer_handle( reinterpret_cast<uv_timer_t*>(handle)); env->FinishHandleCleanup(handle); } void CaresTimerClose(Environment* env, uv_handle_t* handle, void* arg) { uv_close(handle, CaresTimerCloseCb); } void Initialize(Local<Object> target, Local<Value> unused, Local<Context> context) { Environment* env = Environment::GetCurrent(context); int r = ares_library_init(ARES_LIB_INIT_ALL); if (r != ARES_SUCCESS) return env->ThrowError(ToErrorCodeString(r)); SetupCaresChannel(env); /* Initialize the timeout timer. The timer won't be started until the */ /* first socket is opened. */ uv_timer_init(env->event_loop(), env->cares_timer_handle()); env->RegisterHandleCleanup( reinterpret_cast<uv_handle_t*>(env->cares_timer_handle()), CaresTimerClose, nullptr); env->SetMethod(target, "queryA", Query<QueryAWrap>); env->SetMethod(target, "queryAaaa", Query<QueryAaaaWrap>); env->SetMethod(target, "queryCname", Query<QueryCnameWrap>); env->SetMethod(target, "queryMx", Query<QueryMxWrap>); env->SetMethod(target, "queryNs", Query<QueryNsWrap>); env->SetMethod(target, "queryTxt", Query<QueryTxtWrap>); env->SetMethod(target, "querySrv", Query<QuerySrvWrap>); env->SetMethod(target, "queryPtr", Query<QueryPtrWrap>); env->SetMethod(target, "queryNaptr", Query<QueryNaptrWrap>); env->SetMethod(target, "querySoa", Query<QuerySoaWrap>); env->SetMethod(target, "getHostByAddr", Query<GetHostByAddrWrap>); env->SetMethod(target, "getaddrinfo", GetAddrInfo); env->SetMethod(target, "getnameinfo", GetNameInfo); env->SetMethod(target, "isIP", IsIP); env->SetMethod(target, "isIPv4", IsIPv4); env->SetMethod(target, "isIPv6", IsIPv6); env->SetMethod(target, "strerror", StrError); env->SetMethod(target, "getServers", GetServers); env->SetMethod(target, "setServers", SetServers); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AF_INET"), Integer::New(env->isolate(), AF_INET)); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AF_INET6"), Integer::New(env->isolate(), AF_INET6)); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AF_UNSPEC"), Integer::New(env->isolate(), AF_UNSPEC)); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AI_ADDRCONFIG"), Integer::New(env->isolate(), AI_ADDRCONFIG)); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AI_V4MAPPED"), Integer::New(env->isolate(), AI_V4MAPPED)); auto is_construct_call_callback = [](const FunctionCallbackInfo<Value>& args) { CHECK(args.IsConstructCall()); ClearWrap(args.This()); }; Local<FunctionTemplate> aiw = FunctionTemplate::New(env->isolate(), is_construct_call_callback); aiw->InstanceTemplate()->SetInternalFieldCount(1); env->SetProtoMethod(aiw, "getAsyncId", AsyncWrap::GetAsyncId); aiw->SetClassName( FIXED_ONE_BYTE_STRING(env->isolate(), "GetAddrInfoReqWrap")); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "GetAddrInfoReqWrap"), aiw->GetFunction()); Local<FunctionTemplate> niw = FunctionTemplate::New(env->isolate(), is_construct_call_callback); niw->InstanceTemplate()->SetInternalFieldCount(1); env->SetProtoMethod(niw, "getAsyncId", AsyncWrap::GetAsyncId); niw->SetClassName( FIXED_ONE_BYTE_STRING(env->isolate(), "GetNameInfoReqWrap")); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "GetNameInfoReqWrap"), niw->GetFunction()); Local<FunctionTemplate> qrw = FunctionTemplate::New(env->isolate(), is_construct_call_callback); qrw->InstanceTemplate()->SetInternalFieldCount(1); env->SetProtoMethod(qrw, "getAsyncId", AsyncWrap::GetAsyncId); qrw->SetClassName( FIXED_ONE_BYTE_STRING(env->isolate(), "QueryReqWrap")); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "QueryReqWrap"), qrw->GetFunction()); } } // anonymous namespace } // namespace cares_wrap } // namespace node NODE_MODULE_CONTEXT_AWARE_BUILTIN(cares_wrap, node::cares_wrap::Initialize)
{ "content_hash": "04ac29d3d80e969465d7ff023a0da1ca", "timestamp": "", "source": "github", "line_count": 1591, "max_line_length": 80, "avg_line_length": 28.898177247014456, "alnum_prop": 0.6225286556321639, "repo_name": "RPGOne/Skynet", "id": "62d0abd032ea735ff1b6eed747ace018a6fcf5d1", "size": "45977", "binary": false, "copies": "1", "ref": "refs/heads/Miho", "path": "node-master/src/cares_wrap.cc", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "1C Enterprise", "bytes": "36" }, { "name": "Ada", "bytes": "89079" }, { "name": "Assembly", "bytes": "11425802" }, { "name": "Batchfile", "bytes": "123467" }, { "name": "C", "bytes": "34703955" }, { "name": "C#", "bytes": "55955" }, { "name": "C++", "bytes": "84647314" }, { "name": "CMake", "bytes": "220849" }, { "name": "CSS", "bytes": "39257" }, { "name": "Cuda", "bytes": "1344541" }, { "name": "DIGITAL Command Language", "bytes": "349320" }, { "name": "DTrace", "bytes": "37428" }, { "name": "Emacs Lisp", "bytes": "19654" }, { "name": "Erlang", "bytes": "39438" }, { "name": "Fortran", "bytes": "16914" }, { "name": "HTML", "bytes": "929759" }, { "name": "Java", "bytes": "112658" }, { "name": "JavaScript", "bytes": "32806873" }, { "name": "Jupyter Notebook", "bytes": "1616334" }, { "name": "Lua", "bytes": "22549" }, { "name": "M4", "bytes": "64967" }, { "name": "Makefile", "bytes": "1046428" }, { "name": "Matlab", "bytes": "888" }, { "name": "Module Management System", "bytes": "1545" }, { "name": "NSIS", "bytes": "2860" }, { "name": "Objective-C", "bytes": "131433" }, { "name": "PHP", "bytes": "750783" }, { "name": "Pascal", "bytes": "75208" }, { "name": "Perl", "bytes": "626627" }, { "name": "Perl 6", "bytes": "2495926" }, { "name": "PowerShell", "bytes": "38374" }, { "name": "Prolog", "bytes": "300018" }, { "name": "Python", "bytes": "26363074" }, { "name": "R", "bytes": "236175" }, { "name": "Rebol", "bytes": "217" }, { "name": "Roff", "bytes": "328366" }, { "name": "SAS", "bytes": "1847" }, { "name": "Scala", "bytes": "248902" }, { "name": "Scheme", "bytes": "14853" }, { "name": "Shell", "bytes": "360815" }, { "name": "TeX", "bytes": "105346" }, { "name": "Vim script", "bytes": "6101" }, { "name": "XS", "bytes": "4319" }, { "name": "eC", "bytes": "5158" } ], "symlink_target": "" }
package org.saiku.olap.discover; import org.saiku.datasources.connection.IConnectionManager; import org.saiku.olap.dto.*; import org.saiku.olap.util.ObjectUtil; import org.saiku.olap.util.SaikuCubeCaptionComparator; import org.saiku.olap.util.SaikuDimensionCaptionComparator; import org.saiku.olap.util.exception.SaikuOlapException; import org.saiku.service.util.MondrianDictionary; import org.apache.commons.lang.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.olap4j.OlapConnection; import org.olap4j.OlapDatabaseMetaData; import org.olap4j.OlapException; import org.olap4j.mdx.IdentifierNode; import org.olap4j.mdx.IdentifierSegment; import org.olap4j.metadata.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import mondrian.olap4j.SaikuMondrianHelper; import mondrian.rolap.RolapConnection; /** * OlapMetaExplorer. */ public class OlapMetaExplorer { private static final Logger LOG = LoggerFactory.getLogger(OlapMetaExplorer.class); private final IConnectionManager connections; public OlapMetaExplorer(IConnectionManager ic) { connections = ic; } public SaikuConnection getConnection(String connectionName) throws SaikuOlapException { OlapConnection olapcon = connections.getOlapConnection(connectionName); SaikuConnection connection; if (olapcon != null) { List<SaikuCatalog> catalogs = new ArrayList<SaikuCatalog>(); try { for (Catalog cat : olapcon.getOlapCatalogs()) { List<SaikuSchema> schemas = new ArrayList<SaikuSchema>(); for (Schema schem : cat.getSchemas()) { List<SaikuCube> cubes = new ArrayList<SaikuCube>(); for (Cube cub : schem.getCubes()) { cubes.add( new SaikuCube(connectionName, cub.getUniqueName(), cub.getName(), cub.getCaption(), cat.getName(), schem.getName(), cub.isVisible())); } Collections.sort(cubes, new SaikuCubeCaptionComparator()); schemas.add(new SaikuSchema(schem.getName(), cubes)); } if (schemas.size() == 0) { OlapDatabaseMetaData olapDbMeta = olapcon.getMetaData(); ResultSet cubesResult = olapDbMeta.getCubes(cat.getName(), null, null); try { List<SaikuCube> cubes = new ArrayList<SaikuCube>(); while (cubesResult.next()) { cubes.add(new SaikuCube(connectionName, cubesResult.getString("CUBE_NAME"), cubesResult.getString("CUBE_NAME"), cubesResult.getString("CUBE_NAME"), cubesResult.getString("CATALOG_NAME"), cubesResult.getString("SCHEMA_NAME"))); } Collections.sort(cubes, new SaikuCubeCaptionComparator()); schemas.add(new SaikuSchema("", cubes)); } catch (SQLException e) { throw new OlapException(e.getMessage(), e); } finally { try { cubesResult.close(); } catch (SQLException e) { LOG.error("Could not close cubesResult", e.getNextException()); } } } Collections.sort(schemas); catalogs.add(new SaikuCatalog(cat.getName(), schemas)); } } catch (OlapException e) { throw new SaikuOlapException("Error getting objects of connection (" + connectionName + ")", e); } Collections.sort(catalogs); connection = new SaikuConnection(connectionName, catalogs); return connection; } throw new SaikuOlapException("Cannot find connection: (" + connectionName + ")"); } @NotNull public List<SaikuConnection> getConnections(@NotNull List<String> connectionNames) throws SaikuOlapException { List<SaikuConnection> connectionList = new ArrayList<SaikuConnection>(); for (String connectionName : connectionNames) { connectionList.add(getConnection(connectionName)); } return connectionList; } @NotNull public List<SaikuConnection> getAllConnections() throws SaikuOlapException { List<SaikuConnection> cubesList = new ArrayList<SaikuConnection>(); for (String connectionName : connections.getAllOlapConnections().keySet()) { cubesList.add(getConnection(connectionName)); } Collections.sort(cubesList); return cubesList; } @NotNull List<SaikuCube> getCubes(String connectionName) throws SaikuOlapException { OlapConnection olapcon = connections.getOlapConnection(connectionName); List<SaikuCube> cubes = new ArrayList<SaikuCube>(); if (olapcon != null) { try { for (Catalog cat : olapcon.getOlapCatalogs()) { for (Schema schem : cat.getSchemas()) { for (Cube cub : schem.getCubes()) { cubes.add( new SaikuCube(connectionName, cub.getUniqueName(), cub.getName(), cub.getCaption(), cat.getName(), schem.getName(), cub.isVisible())); } } } } catch (OlapException e) { LOG.error("Olap Exception", e.getCause()); } } Collections.sort(cubes, new SaikuCubeCaptionComparator()); return cubes; } @NotNull public List<SaikuCube> getCubes(@NotNull List<String> connectionNames) throws SaikuOlapException { List<SaikuCube> cubesList = new ArrayList<SaikuCube>(); for (String connectionName : connectionNames) { cubesList.addAll(getCubes(connectionName)); } Collections.sort(cubesList, new SaikuCubeCaptionComparator()); return cubesList; } @NotNull public List<SaikuCube> getAllCubes() throws SaikuOlapException { List<SaikuCube> cubes = new ArrayList<SaikuCube>(); for (String connectionName : connections.getAllOlapConnections().keySet()) { cubes.addAll(getCubes(connectionName)); } Collections.sort(cubes, new SaikuCubeCaptionComparator()); return cubes; } @NotNull public Cube getNativeCube(@NotNull SaikuCube cube) throws SaikuOlapException { try { OlapConnection con = connections.getOlapConnection(cube.getConnection()); if (con != null) { for (Database db : con.getOlapDatabases()) { Catalog cat = db.getCatalogs().get(cube.getCatalog()); if (cat != null) { for (Schema schema : cat.getSchemas()) { if (StringUtils.isBlank(cube.getSchema()) && StringUtils.isBlank(schema.getName()) || schema.getName().equals(cube.getSchema())) { for (Cube cub : schema.getCubes()) { if (cub.getName().equals(cube.getName()) || cub.getUniqueName().equals(cube.getUniqueName())) { return cub; } } } } } } } } catch (Exception e) { throw new SaikuOlapException("Cannot get native cube for ( " + cube + " )", e); } throw new SaikuOlapException("Cannot get native cube for ( " + cube + " )"); } @Nullable public OlapConnection getNativeConnection(String name) throws SaikuOlapException { try { OlapConnection con = connections.getOlapConnection(name); if (con != null) { return con; } } catch (Exception e) { throw new SaikuOlapException("Cannot get native connection for ( " + name + " )", e); } return null; } @NotNull public List<SaikuDimension> getAllDimensions(@NotNull SaikuCube cube) throws SaikuOlapException { Cube nativeCube = getNativeCube(cube); List<SaikuDimension> dimensions = ObjectUtil.convertDimensions(nativeCube.getDimensions()); for (int i = 0; i < dimensions.size(); i++) { SaikuDimension dim = dimensions.get(i); if (dim.getName().equals("Measures") || dim.getUniqueName().equals("[Measures]")) { dimensions.remove(i); break; } } Collections.sort(dimensions, new SaikuDimensionCaptionComparator()); return dimensions; } @Nullable public SaikuDimension getDimension(@NotNull SaikuCube cube, String dimensionName) throws SaikuOlapException { Cube nativeCube = getNativeCube(cube); Dimension dim = nativeCube.getDimensions().get(dimensionName); if (dim != null) { return ObjectUtil.convert(dim); } return null; } @NotNull public List<SaikuHierarchy> getAllHierarchies(@NotNull SaikuCube cube) throws SaikuOlapException { Cube nativeCube = getNativeCube(cube); return ObjectUtil.convertHierarchies(nativeCube.getHierarchies()); } @Nullable public SaikuHierarchy getHierarchy(@NotNull SaikuCube cube, String hierarchyName) throws SaikuOlapException { Cube nativeCube = getNativeCube(cube); Hierarchy h = findHierarchy(hierarchyName, nativeCube); if (h != null) { return ObjectUtil.convert(h); } return null; } @NotNull public List<SaikuMember> getHierarchyRootMembers(@NotNull SaikuCube cube, String hierarchyName) throws SaikuOlapException { Cube nativeCube = getNativeCube(cube); List<SaikuMember> members = new ArrayList<SaikuMember>(); Hierarchy h = findHierarchy(hierarchyName, nativeCube); if (h == null) { for (Hierarchy hlist : nativeCube.getHierarchies()) { if (hlist.getUniqueName().equals(hierarchyName) || hlist.getName().equals(hierarchyName)) { h = hlist; } } } if (h != null) { try { members = ObjectUtil.convertMembers(h.getRootMembers()); } catch (OlapException e) { throw new SaikuOlapException("Cannot retrieve root members of hierarchy: " + hierarchyName, e); } } return members; } @NotNull public List<SaikuLevel> getAllLevels(@NotNull SaikuCube cube, String dimension, String hierarchy) throws SaikuOlapException { Cube nativeCube = getNativeCube(cube); Dimension dim = nativeCube.getDimensions().get(dimension); if (dim != null) { Hierarchy h = dim.getHierarchies().get(hierarchy); if (h == null) { for (Hierarchy hlist : dim.getHierarchies()) { if (hlist.getUniqueName().equals(hierarchy) || hlist.getName().equals(hierarchy)) { h = hlist; } } } if (h != null) { return ObjectUtil.convertLevels(h.getLevels()); } } return new ArrayList<SaikuLevel>(); } public List<SimpleCubeElement> getAllMembers(@NotNull SaikuCube cube, String hierarchy, String level) throws SaikuOlapException { return getAllMembers(cube, hierarchy, level, null, -1); } public List<SimpleCubeElement> getAllMembers(@NotNull SaikuCube cube, String hierarchy, String level, @NotNull String searchString, int searchLimit) throws SaikuOlapException { try { Cube nativeCube = getNativeCube(cube); OlapConnection con = nativeCube.getSchema().getCatalog().getDatabase().getOlapConnection(); Hierarchy h = findHierarchy(hierarchy, nativeCube); boolean search = StringUtils.isNotBlank(searchString); int found = 0; List<SimpleCubeElement> simpleMembers; if (h != null) { Level l = h.getLevels().get(level); if (l == null) { for (Level lvl : h.getLevels()) { if (lvl.getUniqueName().equals(level) || lvl.getName().equals(level)) { l = lvl; break; } } } if (l == null) { throw new SaikuOlapException( "Cannot find level " + level + " in hierarchy " + hierarchy + " of cube " + cube.getName()); } if (isMondrian(nativeCube)) { if (SaikuMondrianHelper.hasAnnotation(l, MondrianDictionary.SQLMEMBERLOOKUP)) { if (search) { ResultSet rs = SaikuMondrianHelper.getSQLMemberLookup(con, MondrianDictionary.SQLMEMBERLOOKUP, l, searchString); simpleMembers = ObjectUtil.convert2simple(rs); LOG.debug("Found " + simpleMembers.size() + " members using SQL lookup for level " + level); return simpleMembers; } else { return new ArrayList<SimpleCubeElement>(); } } } if (search || searchLimit > 0) { List<Member> foundMembers = new ArrayList<Member>(); for (Member m : l.getMembers()) { if (search) { if (m.getName().toLowerCase().contains(searchString) || m.getCaption().toLowerCase() .contains(searchString)) { foundMembers.add(m); found++; } } else { foundMembers.add(m); found++; } if (searchLimit > 0 && found >= searchLimit) { break; } } simpleMembers = ObjectUtil.convert2Simple(foundMembers); } else { simpleMembers = ObjectUtil.convert2Simple(l.getMembers()); } return simpleMembers; } } catch (Exception e) { throw new SaikuOlapException("Cannot get all members", e); } return new ArrayList<SimpleCubeElement>(); } @NotNull public List<SaikuMember> getMemberChildren(@NotNull SaikuCube cube, String uniqueMemberName) throws SaikuOlapException { List<SaikuMember> members = new ArrayList<SaikuMember>(); try { Cube nativeCube = getNativeCube(cube); List<IdentifierSegment> memberList = IdentifierNode.parseIdentifier(uniqueMemberName).getSegmentList(); Member m = nativeCube.lookupMember(memberList); if (m != null) { for (Member c : m.getChildMembers()) { SaikuMember sm = ObjectUtil.convert(c); members.add(sm); } } } catch (OlapException e) { throw new SaikuOlapException("Cannot get child members of member:" + uniqueMemberName, e); } return members; } @NotNull public List<SaikuMember> getAllMeasures(@NotNull SaikuCube cube) throws SaikuOlapException { List<SaikuMember> measures = new ArrayList<SaikuMember>(); try { Cube nativeCube = getNativeCube(cube); for (Measure measure : nativeCube.getMeasures()) { if (measure.isVisible()) { measures.add(ObjectUtil.convertMeasure(measure)); } } if (measures.size() == 0) { Hierarchy hierarchy = nativeCube.getDimensions().get("Measures").getDefaultHierarchy(); measures = ObjectUtil.convertMembers(hierarchy.getRootMembers()); } } catch (OlapException e) { throw new SaikuOlapException("Cannot get measures for cube:" + cube.getName(), e); } //Collections.sort(measures, new SaikuMemberCaptionComparator()); return measures; } @Nullable public SaikuMember getMember(@NotNull SaikuCube cube, String uniqueMemberName) throws SaikuOlapException { try { Cube nativeCube = getNativeCube(cube); Member m = nativeCube.lookupMember(IdentifierNode.parseIdentifier(uniqueMemberName).getSegmentList()); if (m != null) { return ObjectUtil.convert(m); } return null; } catch (Exception e) { throw new SaikuOlapException("Cannot find member: " + uniqueMemberName + " in cube:" + cube.getName(), e); } } private boolean isMondrian(@NotNull Cube cube) { OlapConnection con = cube.getSchema().getCatalog().getDatabase().getOlapConnection(); try { return con.isWrapperFor(RolapConnection.class); } catch (SQLException e) { LOG.error("SQLException", e.getNextException()); } return false; } @Nullable private Hierarchy findHierarchy(String name, @NotNull Cube cube) { Hierarchy h = cube.getHierarchies().get(name); if (h != null) { return h; } for (Hierarchy hierarchy : cube.getHierarchies()) { if (hierarchy.getUniqueName().equals(name)) { return hierarchy; } } return null; } }
{ "content_hash": "cfd4a2c486a35a50260d38e31da5ae1a", "timestamp": "", "source": "github", "line_count": 454, "max_line_length": 116, "avg_line_length": 35.68502202643172, "alnum_prop": 0.6354546015678044, "repo_name": "witcxc/saiku", "id": "912ab8b6eafc76aedc01e7c7df905961140355f2", "size": "16788", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "saiku-core/saiku-service/src/main/java/org/saiku/olap/discover/OlapMetaExplorer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "130913" }, { "name": "Java", "bytes": "1246885" }, { "name": "JavaScript", "bytes": "3057545" }, { "name": "Shell", "bytes": "7375" } ], "symlink_target": "" }
FROM node:latest RUN mkdir -p /portal /home/nodejs && \ groupadd -r nodejs && \ useradd -r -g nodejs -d /home/nodejs -s /sbin/nologin nodejs && \ chown -R nodejs:nodejs /home/nodejs WORKDIR /portal COPY package.json typings.json /portal/ RUN npm install --unsafe-perm=true COPY . /portal RUN chown -R nodejs:nodejs /portal USER nodejs CMD npm start
{ "content_hash": "3bfd55fcd4b8b5613ff720c60d57f01b", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 69, "avg_line_length": 22.8125, "alnum_prop": 0.7013698630136986, "repo_name": "IoTitude/Portal", "id": "385f379d70f4510751fec21a123ab5bb042be70b", "size": "488", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Dockerfile", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "9941" }, { "name": "HTML", "bytes": "6451" }, { "name": "JavaScript", "bytes": "2799" }, { "name": "TypeScript", "bytes": "20239" } ], "symlink_target": "" }
namespace Google.Cloud.Dlp.V2.Snippets { // [START dlp_v2_generated_DlpService_CreateInspectTemplate_async_flattened_resourceNames2] using Google.Api.Gax.ResourceNames; using Google.Cloud.Dlp.V2; using System.Threading.Tasks; public sealed partial class GeneratedDlpServiceClientSnippets { /// <summary>Snippet for CreateInspectTemplateAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateInspectTemplateResourceNames2Async() { // Create client DlpServiceClient dlpServiceClient = await DlpServiceClient.CreateAsync(); // Initialize request argument(s) ProjectName parent = ProjectName.FromProject("[PROJECT]"); InspectTemplate inspectTemplate = new InspectTemplate(); // Make the request InspectTemplate response = await dlpServiceClient.CreateInspectTemplateAsync(parent, inspectTemplate); } } // [END dlp_v2_generated_DlpService_CreateInspectTemplate_async_flattened_resourceNames2] }
{ "content_hash": "b32ff3c185e3302815dc058185fc8d5b", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 114, "avg_line_length": 45.51851851851852, "alnum_prop": 0.6956875508543532, "repo_name": "jskeet/gcloud-dotnet", "id": "bf812369c624b124e1523947593f42376bcec222", "size": "1851", "binary": false, "copies": "2", "ref": "refs/heads/bq-migration", "path": "apis/Google.Cloud.Dlp.V2/Google.Cloud.Dlp.V2.GeneratedSnippets/DlpServiceClient.CreateInspectTemplateResourceNames2AsyncSnippet.g.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1725" }, { "name": "C#", "bytes": "1829733" } ], "symlink_target": "" }
from msrest.serialization import Model class Error(Model): """Error. :param code: :type code: str :param message: :type message: str :param target: :type target: str :param details: :type details: list[~azure.mgmt.network.v2017_11_01.models.ErrorDetails] :param inner_error: :type inner_error: str """ _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'details': {'key': 'details', 'type': '[ErrorDetails]'}, 'inner_error': {'key': 'innerError', 'type': 'str'}, } def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, inner_error: str=None, **kwargs) -> None: super(Error, self).__init__(**kwargs) self.code = code self.message = message self.target = target self.details = details self.inner_error = inner_error
{ "content_hash": "7c3d57a56aab0be6a9a813120fa858e7", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 134, "avg_line_length": 30.303030303030305, "alnum_prop": 0.564, "repo_name": "lmazuel/azure-sdk-for-python", "id": "89d6608d7bacd683f82f57470c55594e00321be7", "size": "1474", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/error_py3.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "42572767" } ], "symlink_target": "" }
package abi42_0_0.expo.modules.contacts.models; import android.content.ContentValues; import android.database.Cursor; import android.provider.ContactsContract; import static android.provider.ContactsContract.*; public class ImAddressModel extends BaseModel { @Override public String getContentType() { return CommonDataKinds.Im.CONTENT_ITEM_TYPE; } @Override public String getDataAlias() { return "username"; } private String serializeService(int protocol) { switch (protocol) { case CommonDataKinds.Im.PROTOCOL_AIM: return "aim"; case CommonDataKinds.Im.PROTOCOL_GOOGLE_TALK: return "googleTalk"; case CommonDataKinds.Im.PROTOCOL_ICQ: return "icq"; case CommonDataKinds.Im.PROTOCOL_JABBER: return "jabber"; case CommonDataKinds.Im.PROTOCOL_MSN: return "msn"; case CommonDataKinds.Im.PROTOCOL_NETMEETING: return "netmeeting"; case CommonDataKinds.Im.PROTOCOL_QQ: return "qq"; case CommonDataKinds.Im.PROTOCOL_SKYPE: return "skype"; case CommonDataKinds.Im.PROTOCOL_YAHOO: return "yahoo"; case CommonDataKinds.Im.PROTOCOL_CUSTOM: return "custom"; default: return "unknown"; } } @Override public void fromCursor(Cursor cursor) { super.fromCursor(cursor); map.putString("service", serializeService(cursor.getInt(cursor.getColumnIndex(CommonDataKinds.Im.PROTOCOL)))); } @Override public ContentValues getContentValues() { ContentValues values = super.getContentValues(); values.put(CommonDataKinds.Im.PROTOCOL, getString("service")); return values; } }
{ "content_hash": "760125566b64d1254b4b829bce32e5b3", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 118, "avg_line_length": 30.083333333333332, "alnum_prop": 0.6459833795013851, "repo_name": "exponentjs/exponent", "id": "4fe78eb4982faa84b4a94861d962538e1c51b7e3", "size": "1805", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "android/versioned-abis/expoview-abi42_0_0/src/main/java/abi42_0_0/expo/modules/contacts/models/ImAddressModel.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "96902" }, { "name": "Batchfile", "bytes": "382" }, { "name": "C", "bytes": "896724" }, { "name": "C++", "bytes": "867983" }, { "name": "CSS", "bytes": "6732" }, { "name": "HTML", "bytes": "152590" }, { "name": "IDL", "bytes": "897" }, { "name": "Java", "bytes": "4588748" }, { "name": "JavaScript", "bytes": "9343259" }, { "name": "Makefile", "bytes": "8790" }, { "name": "Objective-C", "bytes": "10675806" }, { "name": "Objective-C++", "bytes": "364286" }, { "name": "Perl", "bytes": "5860" }, { "name": "Prolog", "bytes": "287" }, { "name": "Python", "bytes": "97564" }, { "name": "Ruby", "bytes": "45432" }, { "name": "Shell", "bytes": "6501" } ], "symlink_target": "" }
package com.vivifram.second.hitalk; import android.os.Handler; import android.os.HandlerThread; import android.os.Message; /** * Created by zuowei on 17-3-19. */ public class HitalkMonitor extends HandlerThread{ public static final int LOOP_TIME = 5000; public static final int LOOP_IMMEDIATE = 500; public static final int LOOP_INCREAMENT = 2000; public static int IMMEDIATE_TIMES = 0; public static final int BASE_MSG_TYPE = 0x00; public static final int CHECK_HITALK_CONVERSATION = BASE_MSG_TYPE + 1; private Handler handler; private static HitalkMonitor hitalkMonitor; public static void runLoop(){ if (hitalkMonitor == null){ synchronized (HitalkMonitor.class) { if (hitalkMonitor == null) { hitalkMonitor = new HitalkMonitor("HitalkMonitor"); hitalkMonitor.start(); hitalkMonitor.init(); } } } } private HitalkMonitor(String name) { super(name); } private HitalkMonitor(String name, int priority) { super(name, priority); } private void init() { handler = new Handler(getLooper()) { @Override public void handleMessage(Message msg) { switch (msg.what){ case CHECK_HITALK_CONVERSATION: MonitorEvent monitorEvent = (MonitorEvent) msg.obj; Message newMsg = new Message(); newMsg.copyFrom(msg); if (!monitorEvent.check()) { IMMEDIATE_TIMES ++; monitorEvent.run(); handler.sendMessageDelayed(newMsg, LOOP_IMMEDIATE + (IMMEDIATE_TIMES / 3) * LOOP_INCREAMENT); } else { IMMEDIATE_TIMES = 0; handler.sendMessageDelayed(newMsg, LOOP_TIME); } break; } } }; } public static abstract class MonitorEvent { public abstract boolean check(); public abstract void run(); public abstract int getMsgType(); public boolean sendToMonitor() { if (hitalkMonitor.handler.hasMessages(getMsgType())){ return false; } Message msg = hitalkMonitor.handler.obtainMessage(getMsgType()); msg.obj = this; msg.sendToTarget(); return true; } } public static void destory(){ if (hitalkMonitor != null){ hitalkMonitor.handler.removeCallbacksAndMessages(null); } } }
{ "content_hash": "51223d3ca9cc75cf85c651d3dc9c19b1", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 98, "avg_line_length": 31.88888888888889, "alnum_prop": 0.5149825783972125, "repo_name": "zuoweitan/Hitalk", "id": "10e0882566062c6887080e89efe2ba75ce13ab35", "size": "2870", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/vivifram/second/hitalk/HitalkMonitor.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "6258" }, { "name": "Java", "bytes": "2185075" }, { "name": "Python", "bytes": "226878" }, { "name": "Shell", "bytes": "10742" } ], "symlink_target": "" }
package com.moac.android.interceptordemo.api; public class ApiConst { // Endpoints public static final String TRACKS_ENDPOINT = "/tracks"; // Query parameters public static final String CLIENT_ID_QUERY_PARAM = "client_id"; public static final String GENRES_QUERY_PARAM = "genres"; public static final String LIMIT_QUERY_PARAM = "limit"; }
{ "content_hash": "a847603dd5591f2715412dd5837c0f23", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 67, "avg_line_length": 28.23076923076923, "alnum_prop": 0.7138964577656676, "repo_name": "peter-tackage/okhttp-interceptors-demo", "id": "342c298d96b49cb61674c80669db36d43d5efec1", "size": "367", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/moac/android/interceptordemo/api/ApiConst.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "43868" } ], "symlink_target": "" }
const config = Object.assign({}, require("./webpack.config.js")); config.output.publicPath = "http://localhost:8000/assets"; config.devServer = { port: 8000, }; config.devtool = "inline-sourcemap"; module.exports = config;
{ "content_hash": "2282b653316148b8566afcd9c9a6ce1f", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 65, "avg_line_length": 25.333333333333332, "alnum_prop": 0.7017543859649122, "repo_name": "jroitgrund/hideapic", "id": "32bad3322ab4422811183236e92332b872bb35fd", "size": "228", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "hideapic-app/webpack.config.devserver.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "832" }, { "name": "Java", "bytes": "12218" }, { "name": "JavaScript", "bytes": "2858" }, { "name": "TypeScript", "bytes": "20" } ], "symlink_target": "" }
// // RFStatistics.m // RFStatistics // // Created by wiseweb on 28/11/16. // Copyright © 2016 wiseweb. All rights reserved. // #import "RFStatistics.h" #import <objc/runtime.h> #import <objc/message.h> @implementation RFStatistics + (instancetype)sharedInstance { static RFStatistics *_sharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _sharedInstance = [[self alloc]init]; }); return _sharedInstance; } - (id)displayIdentifier:(id)source { if ([source isKindOfClass:[UIView class]]) { for (UIView *next = [source superview]; next; next = next.superview) { UIResponder *nextResponder = [next nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]]) { return (id)nextResponder; } else if ([nextResponder isKindOfClass:[UIApplication class]]) { return [[UIApplication sharedApplication] topMostViewController]; } } } else if ([source isKindOfClass:[UIGestureRecognizer class]]) { UIGestureRecognizer *gestureSource = (UIGestureRecognizer *)source; if ([gestureSource.view isKindOfClass:[NSClassFromString(@"_UIAlertControllerView") class]]) { return gestureSource.view; } return [self displayIdentifier:gestureSource.view]; } return nil; } //viewController_UIControl_action_target - (void)rf_analyticsSource:(id)source action:(SEL)action target:(id)target { NSMutableString *identifierString = [[NSMutableString alloc] init]; if ([target isKindOfClass:[NSClassFromString(@"UIInterfaceActionSelectionTrackingController") class]]) {//iOS10 UIAlertController内部实现变了,所以写成这样 Ivar ivar = class_getInstanceVariable([target class], "_representationViews"); NSMutableArray *representationViews = object_getIvar(target, ivar); UIGestureRecognizer *gesture = source; for (UIView *representationView in representationViews) { CGPoint point = [gesture locationInView:representationView]; if (point.x >= 0 && point.x <= CGRectGetWidth(representationView.bounds) && point.y >= 0 && point.y <= CGRectGetHeight(representationView.bounds) && gesture.state == UIGestureRecognizerStateEnded) { Ivar ivar = class_getInstanceVariable([representationView class], "_actionContentView"); id actionContentView = object_getIvar(representationView, ivar); Ivar labelIvar = class_getInstanceVariable([actionContentView class], "_label"); UILabel *label = object_getIvar(actionContentView, labelIvar); if (NSStringFromClass([[self displayIdentifier:source] class])) { [identifierString appendString:NSStringFromClass([[self displayIdentifier:source] class])]; } if ([[self displayIdentifier:source] isKindOfClass:[UIAlertController class]]) { id viewControllerUnderAlertController = [[[UIApplication sharedApplication] currentViewController] topMostViewController]; [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([viewControllerUnderAlertController class])]]; } if (NSStringFromClass([source class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([source class])]]; } if (label.text) { [identifierString appendString:[NSString stringWithFormat:@"#%@",label.text]]; } if (NSStringFromSelector(action)) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromSelector(action)]]; } if (NSStringFromClass([target class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([target class])]]; } if (self.analyticsIdentifierBlock) { self.analyticsIdentifierBlock(identifierString); } } } } else if ([target isKindOfClass:[NSClassFromString(@"_UIAlertControllerView") class]]) { Ivar ivar = class_getInstanceVariable([target class], "_actionViews"); NSMutableArray *actionviews = object_getIvar(target, ivar); UIGestureRecognizer *gesture = source; for (UIView *subview in actionviews) { /*_UIAlertControllerActionView*/ CGPoint point = [gesture locationInView:subview]; if (point.x >= 0 && point.x <= CGRectGetWidth(subview.bounds) && point.y >= 0 && point.y <= CGRectGetHeight(subview.bounds) && gesture.state == UIGestureRecognizerStateEnded) { UILabel *titleLabel = [subview performSelector:@selector(titleLabel)]; if (NSStringFromClass([[self displayIdentifier:source] class])) { [identifierString appendString:NSStringFromClass([[self displayIdentifier:source] class])]; } if ([[self displayIdentifier:source] isKindOfClass:[NSClassFromString(@"_UIAlertControllerView") class]]) { id viewControllerUnderAlertController = [[[UIApplication sharedApplication] currentViewController] topMostViewController]; [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([viewControllerUnderAlertController class])]]; } if (NSStringFromClass([source class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([source class])]]; } if (titleLabel.text) { [identifierString appendString:[NSString stringWithFormat:@"#%@",titleLabel.text]]; } if (NSStringFromSelector(action)) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromSelector(action)]]; } if (NSStringFromClass([target class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([target class])]]; } if (self.analyticsIdentifierBlock) { self.analyticsIdentifierBlock(identifierString); } } } } else { NSString *titleString = nil; NSString *imageNameString = nil; NSString *backgroundImageName = nil; NSString *selectStateString = nil; NSString *tagString = nil; if ([source isKindOfClass:[UIButton class]]) { UIButton *btn = (UIButton *)source; titleString = btn.currentTitle; imageNameString = btn.currentImage.imageName; backgroundImageName = btn.currentBackgroundImage.imageName; selectStateString = [NSString stringWithFormat:@"isSelectState_%@", @(btn.selected)]; tagString = [NSString stringWithFormat:@"tag_%@", @(btn.tag)]; } else if ([source isKindOfClass:[UIGestureRecognizer class]]) { UIGestureRecognizer *gestureRecognizer = (UIGestureRecognizer *)source; if (gestureRecognizer.state == UIGestureRecognizerStateChanged || gestureRecognizer.state == UIGestureRecognizerStateBegan) { return; } if ([gestureRecognizer.view isKindOfClass:[UIImageView class]] ) { UIImageView *imageView = (UIImageView *)gestureRecognizer.view; imageNameString = imageView.image.imageName; } } if (NSStringFromClass([[self displayIdentifier:source] class])) { [identifierString appendString:NSStringFromClass([[self displayIdentifier:source] class])]; } if (NSStringFromClass([source class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([source class])]]; } if (titleString) { [identifierString appendString:[NSString stringWithFormat:@"#%@",titleString]]; } if (imageNameString) { [identifierString appendString:[NSString stringWithFormat:@"#%@",imageNameString]]; } if (backgroundImageName) { [identifierString appendString:[NSString stringWithFormat:@"#%@", backgroundImageName]]; } if (selectStateString) { [identifierString appendString:[NSString stringWithFormat:@"#%@", selectStateString]]; } if (tagString) { [identifierString appendString:[NSString stringWithFormat:@"#%@", tagString]]; } if (NSStringFromSelector(action)) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromSelector(action)]]; } if (NSStringFromClass([target class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([target class])]]; } if (self.analyticsIdentifierBlock) { self.analyticsIdentifierBlock(identifierString); } } } - (void)rf_analyticsSource:(id)source didSelectIndexPath:(NSIndexPath *)idxPath target:(id)target { NSString *idxPathString = [NSString stringWithFormat:@"%@-%@", @(idxPath.section), @(idxPath.row)]; NSMutableString *identifierString = [[NSMutableString alloc] init]; if (NSStringFromClass([[self displayIdentifier:source] class])) { [identifierString appendString:NSStringFromClass([[self displayIdentifier:source] class])]; } if (NSStringFromClass([source class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([source class])]]; } if (idxPathString) { [identifierString appendString:[NSString stringWithFormat:@"#%@",idxPathString]]; } if (NSStringFromClass([target class])) { [identifierString appendString:[NSString stringWithFormat:@"#%@",NSStringFromClass([target class])]]; } if (self.analyticsIdentifierBlock) { self.analyticsIdentifierBlock(identifierString); } } - (void)rf_analyticsString:(NSString *)identifierString { if (self.analyticsIdentifierBlock) { self.analyticsIdentifierBlock(identifierString); } } @end @implementation UIAlertAction (AOP) + (void)load { Method originalMethod = class_getClassMethod([self class], @selector(actionWithTitle:style:handler:)); Method swizzledMethod = class_getClassMethod([self class], @selector(rf_actionWithTitle:style:handler:)); method_exchangeImplementations(originalMethod, swizzledMethod); } + (instancetype)rf_actionWithTitle:(nullable NSString *)title style:(UIAlertActionStyle)style handler:(void (^ __nullable)(UIAlertAction *action))handler { UIAlertAction *alertAction = [[self class] rf_actionWithTitle:title style:style handler:handler]; return alertAction; } @end @implementation UIControl (AOP) + (void)load { Method initOriginalMethod = class_getInstanceMethod([self class], @selector(sendAction:to:forEvent:)); Method initSwizzledMethod = class_getInstanceMethod([self class], @selector(rf_sendAction:to:forEvent:)); method_exchangeImplementations(initOriginalMethod, initSwizzledMethod); } - (void)rf_sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event { [self rf_sendAction:action to:target forEvent:event]; [[RFStatistics sharedInstance] rf_analyticsSource:self action:action target:target]; } @end @implementation UIGestureRecognizer (AOP) + (void)load { Method initOriginalMethod = class_getInstanceMethod([self class], @selector(initWithTarget:action:)); Method initSwizzledMethod = class_getInstanceMethod([self class], @selector(rf_initWithTarget:action:)); method_exchangeImplementations(initOriginalMethod, initSwizzledMethod); } - (instancetype)rf_initWithTarget:(nullable id)target action:(nullable SEL)action { UIGestureRecognizer *selfGestureRecognizer = [self rf_initWithTarget:target action:action]; if (!target && !action) { return selfGestureRecognizer; } if ([target isKindOfClass:[UIScrollView class]]) { return selfGestureRecognizer; } Class class = [target class]; SEL originalSEL = action; SEL swizzledSEL = NSSelectorFromString([NSString stringWithFormat:@"rf_%@", NSStringFromSelector(action)]); BOOL isAddMethod = class_addMethod(class, swizzledSEL, (IMP)rf_gestureAction, "v@:@"); if (isAddMethod) { Method originalMethod = class_getInstanceMethod(class, originalSEL); Method swizzledMethod = class_getInstanceMethod(class, swizzledSEL); method_exchangeImplementations(originalMethod, swizzledMethod); } return selfGestureRecognizer; } void rf_gestureAction(id self, SEL _cmd, id sender) { SEL swizzledSEL = NSSelectorFromString([NSString stringWithFormat:@"rf_%@", NSStringFromSelector(_cmd)]); ((void(*)(id, SEL, id))objc_msgSend)(self, swizzledSEL, sender); [[RFStatistics sharedInstance] rf_analyticsSource:sender action:_cmd target:self]; } @end @implementation UITableView (AOP) + (void)load { Method delegateOriginalMethod = class_getInstanceMethod([self class], @selector(setDelegate:)); Method delegateSwizzledMethod = class_getInstanceMethod([self class], @selector(rf_setDelegate:)); method_exchangeImplementations(delegateOriginalMethod, delegateSwizzledMethod); } - (void)rf_setDelegate:(id<UITableViewDelegate>)delegate { [self rf_setDelegate:delegate]; if (class_addMethod([delegate class], NSSelectorFromString(@"rf_didSelectRowAtIndexPath"), (IMP)rf_didSelectRowAtIndexPath, "v@:@@")) { Method didSelectOriginalMethod = class_getInstanceMethod([delegate class], NSSelectorFromString(@"rf_didSelectRowAtIndexPath")); Method didSelectSwizzledMethod = class_getInstanceMethod([delegate class], @selector(tableView:didSelectRowAtIndexPath:)); method_exchangeImplementations(didSelectOriginalMethod, didSelectSwizzledMethod); } } void rf_didSelectRowAtIndexPath(id self, SEL _cmd, id tableView, id indexPath) { SEL selector = NSSelectorFromString(@"rf_didSelectRowAtIndexPath"); ((void(*)(id, SEL, id, id))objc_msgSend)(self, selector, tableView, indexPath); [[RFStatistics sharedInstance] rf_analyticsSource:tableView didSelectIndexPath:indexPath target:self]; } @end @implementation UICollectionView (AOP) + (void)load { Method originalMethod = class_getInstanceMethod([self class], @selector(setDelegate:)); Method swizzledMethod = class_getInstanceMethod([self class], @selector(rf_setDelegate:)); method_exchangeImplementations(originalMethod, swizzledMethod); } - (void)rf_setDelegate:(id<UICollectionViewDelegate>)delegate { [self rf_setDelegate:delegate]; if (class_addMethod([delegate class], NSSelectorFromString(@"rf_didSelectItemAtIndexPath"), (IMP)rf_didSelectItemAtIndexPath, "v@:@@")) { Method didSelectOriginalMethod = class_getInstanceMethod([delegate class], NSSelectorFromString(@"rf_didSelectItemAtIndexPath")); Method didSelectSwizzledMethod = class_getInstanceMethod([delegate class], @selector(collectionView:didSelectItemAtIndexPath:)); method_exchangeImplementations(didSelectOriginalMethod, didSelectSwizzledMethod); } } void rf_didSelectItemAtIndexPath(id self, SEL _cmd, id collectionView, id indexPath) { SEL selector = NSSelectorFromString(@"rf_didSelectItemAtIndexPath"); ((void(*)(id, SEL, id, id))objc_msgSend)(self, selector, collectionView, indexPath); [[RFStatistics sharedInstance] rf_analyticsSource:collectionView didSelectIndexPath:indexPath target:self]; } @end @implementation UIImage (imageName) + (void)load { //Exchange imageNamed: implementation Method imageNameOriginalMethod = class_getClassMethod([self class], @selector(imageNamed:)); Method imageNameSwizzledMethod = class_getClassMethod([self class], @selector(rf_imageNamed:)); method_exchangeImplementations(imageNameOriginalMethod, imageNameSwizzledMethod); //Exchange initWithCoder: implementation in order to get the resource file Method initWithCoderOriginalMethod = class_getInstanceMethod(NSClassFromString(@"UIImageNibPlaceholder"), @selector(initWithCoder:)); Method initWithCoderSwizzledMethod = class_getInstanceMethod([self class], @selector(rf_initWithCoder:)); method_exchangeImplementations(initWithCoderOriginalMethod, initWithCoderSwizzledMethod); //Exchange imageWithContentsOfFile: implementation Method imageWithContentsOfFileOriginalMethod = class_getClassMethod([self class], @selector(imageWithContentsOfFile:)); Method imageWithContentsOfFileSwizzledMethod = class_getClassMethod([self class], @selector(rf_imageWithContentsOfFile:)); method_exchangeImplementations(imageWithContentsOfFileOriginalMethod, imageWithContentsOfFileSwizzledMethod); } - (id)rf_initWithCoder:(NSCoder *)aDecoder { UIImage *image = [self rf_initWithCoder:aDecoder]; NSString *resourceName = [aDecoder decodeObjectForKey:@"UIResourceName"]; if ([resourceName isKindOfClass:[NSString class]] && resourceName) { image.imageName = resourceName; } return image; } + (nullable UIImage *)rf_imageNamed:(NSString *)name { UIImage *image = [UIImage rf_imageNamed:name]; image.imageName = name; return image; } + (nullable UIImage *)rf_imageWithContentsOfFile:(NSString *)path { UIImage *image = [UIImage rf_imageWithContentsOfFile:path]; NSURL *urlPath = [NSURL fileURLWithPath:path]; NSString *imageName = [[urlPath.lastPathComponent componentsSeparatedByString:@"."] firstObject]; image.imageName = imageName; return image; } - (NSString *)imageName { return objc_getAssociatedObject(self, _cmd); } - (void)setImageName:(NSString *)imageName { objc_setAssociatedObject(self, @selector(imageName), imageName, OBJC_ASSOCIATION_COPY_NONATOMIC); } @end @implementation UIViewController (AOP) + (void)load { Method viewDidLoadOriginalMethod = class_getInstanceMethod([self class], @selector(viewDidLoad)); Method viewDidLoadSwizzledMethod = class_getInstanceMethod([self class], @selector(rf_viewDidLoad)); method_exchangeImplementations(viewDidLoadOriginalMethod, viewDidLoadSwizzledMethod); Method viewWillAppearOriginalMethod = class_getInstanceMethod([self class], @selector(viewWillAppear:)); Method viewWillAppearSwizzledMethod = class_getInstanceMethod([self class], @selector(rf_viewWillAppear:)); method_exchangeImplementations(viewWillAppearOriginalMethod, viewWillAppearSwizzledMethod); Method viewDidAppearOriginalMethod = class_getInstanceMethod([self class], @selector(viewDidAppear:)); Method viewDidAppearSwizzledMethod = class_getInstanceMethod([self class], @selector(rf_viewDidAppear:)); method_exchangeImplementations(viewDidAppearOriginalMethod, viewDidAppearSwizzledMethod); } - (void)rf_viewDidLoad { [self rf_viewDidLoad]; NSString *identifier = [NSString stringWithFormat:@"%@#%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; [[RFStatistics sharedInstance] rf_analyticsString:identifier]; } - (void)rf_viewWillAppear:(BOOL)animated { [self rf_viewWillAppear:animated]; NSString *identifier = [NSString stringWithFormat:@"%@#%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; [[RFStatistics sharedInstance] rf_analyticsString:identifier]; } - (void)rf_viewDidAppear:(BOOL)animated { [self rf_viewDidAppear:animated]; NSString *identifier = [NSString stringWithFormat:@"%@#%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; [[RFStatistics sharedInstance] rf_analyticsString:identifier]; } @end @implementation UIViewController (TopMostViewController) - (UIViewController *)topMostViewController { if (self.presentedViewController == nil || [self.presentedViewController isKindOfClass:[UIImagePickerController class]]) { return self; } else if ([self.presentedViewController isKindOfClass:[UINavigationController class]]) { UINavigationController *navigationController = (UINavigationController *)self.presentedViewController; UIViewController *lastViewController = [[navigationController viewControllers] lastObject]; return [lastViewController topMostViewController]; } UIViewController *presentedViewController = (UIViewController *)self.presentedViewController; return [presentedViewController topMostViewController]; } @end @implementation UIApplication (TopMostViewController) - (UIViewController *)topMostViewController { return [self.keyWindow.rootViewController topMostViewController]; } - (UIViewController *)currentViewController { UIViewController *result = nil; UIWindow * window = [[UIApplication sharedApplication] keyWindow]; if (window.windowLevel != UIWindowLevelNormal) { NSArray *windows = [[UIApplication sharedApplication] windows]; for(UIWindow * tmpWin in windows) { if (tmpWin.windowLevel == UIWindowLevelNormal) { window = tmpWin; break; } } } UIView *frontView = [[window subviews] objectAtIndex:0]; id nextResponder = [frontView nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]]) { result = nextResponder; } else { result = window.rootViewController; } return result; } @end
{ "content_hash": "6d35b665856fd0d1107bc85a5b0d2d9b", "timestamp": "", "source": "github", "line_count": 562, "max_line_length": 153, "avg_line_length": 39.412811387900355, "alnum_prop": 0.6809480812641083, "repo_name": "DuRofei/SDK-RFStatistics", "id": "b70bdb2e32b913d3f9718a43f3a2df3e724b87c7", "size": "22177", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RFStatistics/RFStatistics/Statistics/RFStatistics.m", "mode": "33261", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "296046" }, { "name": "Ruby", "bytes": "6179" } ], "symlink_target": "" }
A starter application for student projects in Bloc's [Frontend Web Development Course](https://www.bloc.io/frontend-development-bootcamp). ## Configuration Start by cloning the repository: ``` $ git clone https://github.com/Bloc/bloc-frontend-project-starter.git <your-frontend-project-name> ``` The project uses Grunt to run tasks in development. Thoroughly review our [resource on using Grunt](https://www.bloc.io/resources/using-grunt) before using this application. It may also help to review [our resource on NPM and `package.json` files](https://www.bloc.io/resources/npm-and-package-json). Install the project dependencies by running: ``` $ npm install ``` ## Run the Application Run the application using the Gruntfile's `default` task: ``` $ grunt ``` The default task runs a simple server on port 3000. To view it in a any browser, go to [http://localhost:3000](http://localhost:3000). >Note that unless the application is run [via Live Preview in Brackets](#use-in-brackets-live-preview), the browser will need to be refreshed to view the most recent changes. ### Using without Angular By default, the application is configured to be used in a Single-Page Application (SPA) with AngularJS. If you're working on a project that doesn't use AngularJS, see the instructions below [for configuring the server to run in a non-SPA](#configure-server-for-non-spas). ## Use in Brackets Live Preview To use the application with the Live Preview functionality of the Brackets text editor, go to __File > Project Settings__ and add `http://localhost:3000` to the Base URL field. ![Screenshot of project settings URL in Brackets](https://bloc-global-assets.s3.amazonaws.com/images-frontend/screenshots/bloc-frontend-project-starter/live_preview_project_settings.png) The text in the application will not update on every keystroke, but changes will automatically push when you save the file. ## Directory Structure ``` ├── Gruntfile.js ├── LICENSE ├── Procfile ├── README.md ├── app │   ├── assets │   │   └── images │   │   └── bloc-logo-white.png │   ├── pages │   │   └── index.html │   ├── scripts │   │   └── app.js │   ├── styles │   │   └── style.css │   └── templates │   └── home.html ├── package.json └── server.js ``` All code, styles, markup, and assets should be saved to the `app` directory. Saving changes creates a new directory, `dist`, that holds final copies of the application content. `dist` is the directory the server uses to serve the content displayed by the browser. __Do not edit files in `dist`__ because it will reset changes to your work every time you save. Restrict all edits to files in the `app` directory. ### Assets/Images Add images to the `app/assets/images` directory. To reference images in HTML, use the path `/assets/images/<image file name>.jpg`. For example, to include the image called `bloc-white-logo.png`, the path for the `src` attribute in the HTML would be: ```html <img src="/assets/images/bloc-white-logo.png"> ``` __Note:__ A sample image has been added to `app/images`. To remove the image from the application, run the following command from the root of repo: ```bash $ rm -f app/assets/images/bloc-white-logo.png ``` To reference any other assets, like the music in Bloc Jams, use the path `assets/<asset-type>/<asset-file>`. The Gruntfile is pre-configured to handle assets in a subfolder with the `.mp3` extension. >See lines 14 and 35 of `Gruntfile.js` for the accepted file extensions of assets. ### Difference between Pages and Templates The `templates` directory should hold any HTML files used as templates in Angular states configured by UI Router. All other HTML files belong in the `pages` directory. ### Procfile The `Procfile` is a file for [providing instructions to Heroku servers](https://devcenter.heroku.com/articles/procfile) that run after pushing new code to the repository. __Do not change the contents of the Procfile__ or Heroku will throw an error when you attempt to visit your application. >For more information about how to use Heroku with Bloc's frontend applications, see our [resource on using Heroku](https://www.bloc.io/resources/using-heroku-frontend). ## Configure Server for Non-SPAs By default, `bloc-frontend-project-starter` is configured to be used with SPAs. If you're not building a project with Angular, then modify `server.js` with the following: ```diff var Hapi = require('hapi'), path = require('path'), port = process.env.PORT || 3000, server = new Hapi.Server(port), routes = { css: { method: 'GET', path: '/styles/{path*}', handler: createDirectoryRoute('styles') }, js: { method: 'GET', path: '/scripts/{path*}', handler: createDirectoryRoute('scripts') }, assets: { method: 'GET', path: '/assets/{path*}', handler: createDirectoryRoute('assets') }, templates: { method: 'GET', path: '/templates/{path*}', handler: createDirectoryRoute('templates') }, - spa: { + staticPages: { method: 'GET', path: '/{path*}', - handler: { - file: path.join(__dirname, '/dist/index.html') - } + handler: createDirectoryRoute('/') } }; -server.route([ routes.css, routes.js, routes.images, routes.templates, routes.spa ]); +server.route([ routes.css, routes.js, routes.images, routes.templates, routes.staticPages ]); ... ``` Optionally, delete the `templates` directory and all references to it in `Gruntfile.js` to remove unnecessary files (templates are only useful for SPAs). However, keeping them in the repository won't affect your application. ## Grunt plugins A list of the Grunt plugins in this application. #### Watch [Grunt watch](https://github.com/gruntjs/grunt-contrib-watch) watches for changes to file content and then executes Grunt tasks when a change is detected. #### Copy [Grunt copy](https://github.com/gruntjs/grunt-contrib-copy) copies files from our development folders and puts them in the folder that will be served with the frontend of your application. #### Clean [Grunt clean](https://github.com/gruntjs/grunt-contrib-clean) "cleans" or removes all files in your distribution folder (`dist`) so that logic in your stylesheets, templates, or scripts isn't accidentally overridden by previous code in the directory. #### Hapi [Grunt Hapi](https://github.com/athieriot/grunt-hapi) runs a server using [`HapiJS`](http://hapijs.com/). Happy is a Node web application framework with robust configuration options.
{ "content_hash": "a33d9042455834a7ed263aed9903d842", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 411, "avg_line_length": 41.401234567901234, "alnum_prop": 0.7000149097957358, "repo_name": "sannylin/bloc-jams-angular", "id": "c41ee07aeab29e254788e0d5151e3a64eaab701a", "size": "6921", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "9447" }, { "name": "HTML", "bytes": "1152" }, { "name": "JavaScript", "bytes": "3633" } ], "symlink_target": "" }
package com.benny.library.autoadapter; import android.os.Handler; import android.view.View; import android.view.ViewGroup; import com.benny.library.autoadapter.listener.AdapterPagingCompleteListener; import com.benny.library.autoadapter.listener.AdapterPagingListener; import com.benny.library.autoadapter.viewcreator.IViewCreator; import java.util.List; /** * Created by benny on 2/26/16. */ public class AutoListPagingAdapter<T> extends AutoListAdapter<T> implements AdapterPagingCompleteListener { private boolean hasNextPage = true; private boolean loading = false; private Handler handler = new Handler(); private AdapterPagingListener<T> pagingListener; public AutoListPagingAdapter(IAdapterItemAccessor<T> itemAccessor, IViewCreator<T> viewCreator) { super(itemAccessor, viewCreator); } public AutoListPagingAdapter(List<T> items, IViewCreator<T> viewCreator) { super(items, viewCreator); } public AutoListPagingAdapter(IAdapterItemAccessor<T> itemAccessor, IViewCreator<T> viewCreator, AdapterPagingListener<T> pagingListener) { super(itemAccessor, viewCreator); this.pagingListener = pagingListener; } public AutoListPagingAdapter(List<T> items, IViewCreator<T> viewCreator, AdapterPagingListener<T> pagingListener) { super(items, viewCreator); this.pagingListener = pagingListener; } public void setPagingListener(AdapterPagingListener<T> pagingListener) { this.pagingListener = pagingListener; } @Override public T getItem(int position) { return position < itemAccessor.size() && position >= 0 ? super.getItem(position) : null; } @Override public View getView(final int position, View convertView, ViewGroup parent) { convertView = super.getView(position, convertView, parent); if (position == getCount() - 1 && hasNextPage && !loading) { loading = true; handler.post(new Runnable() { @Override public void run() { pagingListener.onLoadPage(AutoListPagingAdapter.this, getItem(position - 1), position); } }); } return convertView; } @Override public int getCount() { return super.getCount() + (hasNextPage && pagingListener != null ? 1 : 0); } @Override public boolean isEmpty() { return getCount() == 0; } public void onPagingComplete(boolean hasNextPage) { loading = false; this.hasNextPage = hasNextPage; notifyDataSetChanged(); } }
{ "content_hash": "4fc6fe857d6b4f2ac8c4dfe82a5a536b", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 142, "avg_line_length": 31.926829268292682, "alnum_prop": 0.6818181818181818, "repo_name": "BennyWang/AutoAdapter", "id": "37a78302f53f34e13e79bc430f1ec23083e3e3f4", "size": "2618", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "autoadapter/src/main/java/com/benny/library/autoadapter/AutoListPagingAdapter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "52931" } ], "symlink_target": "" }
using System; using System.Collections.Generic; namespace Napack.Server.Utils { /// <summary> /// Defines an <see cref="IComparer{T}"/> that can compute comparisons using a lambda instead of interface implementation. /// </summary> /// <typeparam name="T">The type being compared.</typeparam> internal class LambdaComparer<T> : IComparer<T> { private readonly Func<T, T, int> lambdaFunction; /// <summary> /// Creates a new <see cref="LambdaComparer{T}"/> /// </summary> /// <param name="lambdaFunction">The function to use. Should return &lt; zero if the first parameter is less than the second, zero if they're equal, greater than zero otherwise.</param> public LambdaComparer(Func<T, T, int> lambdaFunction) { this.lambdaFunction = lambdaFunction; } public int Compare(T x, T y) { return lambdaFunction(x, y); } } }
{ "content_hash": "19dd1369fe7b6470e5ffce438b50c907", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 193, "avg_line_length": 34.392857142857146, "alnum_prop": 0.6220145379023884, "repo_name": "GuMiner/napack", "id": "655b665fd1deaa00b0a0b522f1d2bf008dc8b424", "size": "965", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/Utils/LambdaComparer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "351798" }, { "name": "CSS", "bytes": "4054" }, { "name": "HTML", "bytes": "18169" }, { "name": "JavaScript", "bytes": "214014" } ], "symlink_target": "" }
import React from 'react'; import expect from 'expect'; import { shallow } from 'enzyme'; import PosterThumbnail from './PosterThumbnail'; describe('PosterThumbnail', () => { const url = '/path/to/image/src.png'; const altText = 'image alt text'; describe('component structure', () => { it('should contain an image element', () => { let posterThumb = shallow(<PosterThumbnail src={url} alt={altText} />); expect(posterThumb.find('img').length).toEqual(1); }); }); describe('component props', () => { it('should have a src attribute', () => { let posterThumb = shallow(<PosterThumbnail src={url} alt={altText} />); expect(posterThumb.props().src).toEqual(url); }); it('should have an alt text attribute', () => { let posterThumb = shallow(<PosterThumbnail src={url} alt={altText} />); expect(posterThumb.props().alt).toEqual(altText); }); }); });
{ "content_hash": "5bb9899dd2eedf7e4bd01be6004050ec", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 77, "avg_line_length": 28.9375, "alnum_prop": 0.6231101511879049, "repo_name": "ajames72/MovieDBReact", "id": "69312b641896f26e0eadbbe0745146c9e4c4cd8d", "size": "926", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/components/results/movies/PosterThumbnail.test.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6356" }, { "name": "HTML", "bytes": "472" }, { "name": "JavaScript", "bytes": "159509" } ], "symlink_target": "" }
<?php // autoload.php @generated by Composer require_once __DIR__ . '/composer' . '/autoload_real.php'; return ComposerAutoloaderInita9dbd243450ee3cab94fe11450e5dff3::getLoader();
{ "content_hash": "8ecfdc8fd6406c12d7a481cfd007a73a", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 75, "avg_line_length": 26.142857142857142, "alnum_prop": 0.7595628415300546, "repo_name": "LybeAB/Lybe_Budbee", "id": "697bc1d21c7a4a51b1e4ba2d83746ec598ab7bee", "size": "183", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/Budbee/vendor/autoload.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "16705" }, { "name": "PHP", "bytes": "31232" } ], "symlink_target": "" }
 CKEDITOR.plugins.setLang( 'justify', 'pt', { block: 'Justificado', center: 'Alinhar ao Centro', left: 'Alinhar à Esquerda', right: 'Alinhar à Direita' } );
{ "content_hash": "c5f81176cdb9e1d47ab84004675ae0b3", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 44, "avg_line_length": 24.142857142857142, "alnum_prop": 0.6390532544378699, "repo_name": "Kunstmaan/BootstrapCK4-Skin", "id": "eb148cae7b9eb763337fda87a4b2690f15e30789", "size": "318", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "plugins/justify/lang/pt.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "245479" }, { "name": "JavaScript", "bytes": "4813019" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Sokoke pipit factsheet on ARKive - Anthus sokokensis</title> <link rel="canonical" href="http://www.arkive.org/sokoke-pipit/anthus-sokokensis/" /> <link rel="stylesheet" type="text/css" media="screen,print" href="/rcss/factsheet.css" /> <link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> </head> <body> <!-- onload="window.print()">--> <div id="container"> <div id="header"><a href="/"><img src="/rimg/factsheet/header_left.png" alt="" border="0" /><img src="/rimg/factsheet/header_logo.png" alt="" border="0" /><img src="/rimg/factsheet/header_right.png" alt="" border="0" /></a></div> <div id="content"> <h1>Sokoke pipit (<i>Anthus sokokensis</i>)</h1> <img alt="" src="/media/F5/F5D8F8FA-68AB-4E2C-9933-9EE93AB43911/Presentation.Large/Sokoke-pipit-perched-on-branch.jpg"/> <table cellspacing="0" cellpadding="0" class="alternativeSpeciesNames"><tbody> <tr><th align="left" valign="top">French:</th><td> Pipit de Sokoke </td></tr> </tbody></table> <table cellspacing="0" cellpadding="0" id="factList"> <tbody> <tr class="kingdom"><th align="left">Kingdom</th><td align="left">Animalia</td></tr> <tr class="phylum"><th align="left">Phylum</th><td align="left">Chordata</td></tr> <tr class="class"><th align="left">Class</th><td align="left">Aves</td></tr> <tr class="order"><th align="left">Order</th><td align="left">Passeriformes</td></tr> <tr class="family"><th align="left">Family</th><td align="left">Motacillidae</td></tr> <tr class="genus"><th align="left">Genus</th><td align="left"><em>Anthus (1)</em></td></tr> </tbody> </table> <h2><img src="/rimg/factsheet/Status.png" class="heading" /></h2><p class="Status"><p>The&nbsp;Sokoke pipit&nbsp;is classified as Endangered (EN) on the IUCN Red List (1).</p></p><h2><img src="/rimg/factsheet/Description.png" class="heading" /></h2><p class="Description"><p>Information on the&nbsp;Sokoke pipit&nbsp;(<em>Anthus sokokensis</em>) is currently being researched and written and will appear here shortly.</p></p><h2><img src="/rimg/factsheet/Authentication.png" class="heading" /></h2><p class="AuthenticatioModel"><p>This information is awaiting authentication by a species expert, and will be updated as soon as possible. If you are able to help please contact: <br/><a href="mailto:[email protected]">[email protected]</a></p></p><h2><img src="/rimg/factsheet/References.png" class="heading" /></h2> <ol id="references"> <li id="ref1"> <a id="reference_1" name="reference_1"></a> IUCN Red List (November, 2010) <br/><a href="http://www.iucnredlist.org" target="_blank">http://www.iucnredlist.org</a></li> </ol> </div> </div> </body> </html>
{ "content_hash": "98189dec296ffc45b7385ac5b405a544", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 837, "avg_line_length": 69.5, "alnum_prop": 0.6651406147809026, "repo_name": "andrewedstrom/cs638project", "id": "2f2e645d18137b984533555256944fd7b7f292d4", "size": "3060", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "raw_data/arkive-endangered-html/anthus-sokokensis.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "514473381" }, { "name": "Jupyter Notebook", "bytes": "2192214" }, { "name": "Python", "bytes": "30115" }, { "name": "R", "bytes": "9081" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.6"/> <title>FTGL: FTGLPixmapFont.cpp File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">FTGL &#160;<span id="projectnumber">2.1</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.6 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">FTGLPixmapFont.cpp File Reference</div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><code>#include &quot;FTGLPixmapFont.h&quot;</code><br/> <code>#include &quot;FTPixmapGlyph.h&quot;</code><br/> </div> <p><a href="FTGLPixmapFont_8cpp_source.html">Go to the source code of this file.</a></p> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Sep 16 2014 09:17:19 for FTGL by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.6 </small></address> </body> </html>
{ "content_hash": "4fef1389040aa36fe47db9120438d826", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 121, "avg_line_length": 36.546875, "alnum_prop": 0.6438648995297136, "repo_name": "TabitaPL/Pasjans", "id": "700cbc1937a1780957804e80fa4f61f02064f090", "size": "2339", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Angel-3.2/Code/Angel/Libraries/FTGL/unix/docs/html/FTGLPixmapFont_8cpp.html", "mode": "33188", "license": "mit", "language": [ { "name": "Ada", "bytes": "89080" }, { "name": "Assembly", "bytes": "143356" }, { "name": "Awk", "bytes": "3965" }, { "name": "C", "bytes": "18701685" }, { "name": "C#", "bytes": "55726" }, { "name": "C++", "bytes": "7534444" }, { "name": "CLIPS", "bytes": "6933" }, { "name": "CSS", "bytes": "66497" }, { "name": "Erlang", "bytes": "3872" }, { "name": "IDL", "bytes": "1448" }, { "name": "JavaScript", "bytes": "43025" }, { "name": "Lua", "bytes": "513526" }, { "name": "OCaml", "bytes": "6380" }, { "name": "Objective-C", "bytes": "158255" }, { "name": "PHP", "bytes": "2855" }, { "name": "Pascal", "bytes": "40318" }, { "name": "Perl", "bytes": "263955" }, { "name": "Pike", "bytes": "583" }, { "name": "Prolog", "bytes": "935" }, { "name": "Python", "bytes": "202527" }, { "name": "Ruby", "bytes": "234" }, { "name": "SAS", "bytes": "1711" }, { "name": "Scheme", "bytes": "9578" }, { "name": "Shell", "bytes": "2261018" }, { "name": "TeX", "bytes": "144346" } ], "symlink_target": "" }
import { IDisposable } from './disposable'; export interface ICommandable extends IDisposable { name: string; // tslint:disable-next-line:no-any command(...args: Array<any>): any; }
{ "content_hash": "ff3183c0e2a7ea7f0898296b0fd09abe", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 51, "avg_line_length": 27.714285714285715, "alnum_prop": 0.6907216494845361, "repo_name": "Silvenga/vscode-edi-x12-support", "id": "6089fe544892abdeebbf1ded7abd24c0f53a3ab6", "size": "194", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/interfaces/commandable.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "676" }, { "name": "TypeScript", "bytes": "71147" } ], "symlink_target": "" }
/* * Copyright 2001-2006 The Apache Software Foundation. * * 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. */ /* * $Id: UnionIterator.java 337874 2004-02-16 23:06:53Z minchau $ */ package com.sun.org.apache.xalan.internal.xsltc.dom; import com.sun.org.apache.xalan.internal.xsltc.DOM; import com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary; import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator; import com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase; /** * <p><code>MultiValuedNodeHeapIterator</code> takes a set of multi-valued * heap nodes and produces a merged NodeSet in document order with duplicates * removed.</p> * <p>Each multi-valued heap node (which might be a * {@link org.apache.xml.dtm.DTMAxisIterator}, but that's not necessary) * generates DTM node handles in document order. The class * maintains the multi-valued heap nodes in a heap, not surprisingly, sorted by * the next DTM node handle available form the heap node.</p> * <p>After a DTM node is pulled from the heap node that's at the top of the * heap, the heap node is advanced to the next DTM node handle it makes * available, and the heap nature of the heap is restored to ensure the next * DTM node handle pulled is next in document order overall. * * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen */ public abstract class MultiValuedNodeHeapIterator extends DTMAxisIteratorBase { /** wrapper for NodeIterators to support iterator comparison on the value of their next() method */ /** * An abstract representation of a set of nodes that will be retrieved in * document order. */ public abstract class HeapNode implements Cloneable { protected int _node, _markedNode; protected boolean _isStartSet = false; /** * Advance to the next node represented by this {@link HeapNode} * * @return the next DTM node. */ public abstract int step(); /** * Creates a deep copy of this {@link HeapNode}. The clone is not * reset from the current position of the original. * * @return the cloned heap node */ public HeapNode cloneHeapNode() { HeapNode clone; try { clone = (HeapNode) super.clone(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } clone._node = _node; clone._markedNode = _node; return clone; } /** * Remembers the current node for the next call to {@link #gotoMark()}. */ public void setMark() { _markedNode = _node; } /** * Restores the current node remembered by {@link #setMark()}. */ public void gotoMark() { _node = _markedNode; } /** * Performs a comparison of the two heap nodes * * @param heapNode the heap node against which to compare * @return <code>true</code> if and only if the current node for this * heap node is before the current node of the argument heap * node in document order. */ public abstract boolean isLessThan(HeapNode heapNode); /** * Sets context with respect to which this heap node is evaluated. * * @param node The new context node * @return a {@link HeapNode} which may or may not be the same as * this <code>HeapNode</code>. */ public abstract HeapNode setStartNode(int node); /** * Reset the heap node back to its beginning. * * @return a {@link HeapNode} which may or may not be the same as * this <code>HeapNode</code>. */ public abstract HeapNode reset(); } // end of HeapNode private static final int InitSize = 8; private int _heapSize = 0; private int _size = InitSize; private HeapNode[] _heap = new HeapNode[InitSize]; private int _free = 0; // Last node returned by this MultiValuedNodeHeapIterator to the caller of // next; used to prune duplicates private int _returnedLast; // cached returned last for use in gotoMark private int _cachedReturnedLast = END; // cached heap size for use in gotoMark private int _cachedHeapSize; public DTMAxisIterator cloneIterator() { _isRestartable = false; final HeapNode[] heapCopy = new HeapNode[_heap.length]; try { MultiValuedNodeHeapIterator clone = (MultiValuedNodeHeapIterator)super.clone(); for (int i = 0; i < _free; i++) { heapCopy[i] = _heap[i].cloneHeapNode(); } clone.setRestartable(false); clone._heap = heapCopy; return clone.reset(); } catch (CloneNotSupportedException e) { BasisLibrary.runTimeError(BasisLibrary.ITERATOR_CLONE_ERR, e.toString()); return null; } } protected void addHeapNode(HeapNode node) { if (_free == _size) { HeapNode[] newArray = new HeapNode[_size *= 2]; System.arraycopy(_heap, 0, newArray, 0, _free); _heap = newArray; } _heapSize++; _heap[_free++] = node; } public int next() { while (_heapSize > 0) { final int smallest = _heap[0]._node; if (smallest == END) { // iterator _heap[0] is done if (_heapSize > 1) { // Swap first and last (iterator must be restartable) final HeapNode temp = _heap[0]; _heap[0] = _heap[--_heapSize]; _heap[_heapSize] = temp; } else { return END; } } else if (smallest == _returnedLast) { // duplicate _heap[0].step(); // value consumed } else { _heap[0].step(); // value consumed heapify(0); return returnNode(_returnedLast = smallest); } // fallthrough if not returned above heapify(0); } return END; } public DTMAxisIterator setStartNode(int node) { if (_isRestartable) { _startNode = node; for (int i = 0; i < _free; i++) { if(!_heap[i]._isStartSet){ _heap[i].setStartNode(node); _heap[i].step(); // to get the first node _heap[i]._isStartSet = true; } } // build heap for (int i = (_heapSize = _free)/2; i >= 0; i--) { heapify(i); } _returnedLast = END; return resetPosition(); } return this; } protected void init() { for (int i =0; i < _free; i++) { _heap[i] = null; } _heapSize = 0; _free = 0; } /* Build a heap in document order. put the smallest node on the top. * "smallest node" means the node before other nodes in document order */ private void heapify(int i) { for (int r, l, smallest;;) { r = (i + 1) << 1; l = r - 1; smallest = l < _heapSize && _heap[l].isLessThan(_heap[i]) ? l : i; if (r < _heapSize && _heap[r].isLessThan(_heap[smallest])) { smallest = r; } if (smallest != i) { final HeapNode temp = _heap[smallest]; _heap[smallest] = _heap[i]; _heap[i] = temp; i = smallest; } else { break; } } } public void setMark() { for (int i = 0; i < _free; i++) { _heap[i].setMark(); } _cachedReturnedLast = _returnedLast; _cachedHeapSize = _heapSize; } public void gotoMark() { for (int i = 0; i < _free; i++) { _heap[i].gotoMark(); } // rebuild heap after call last() function. fix for bug 20913 for (int i = (_heapSize = _cachedHeapSize)/2; i >= 0; i--) { heapify(i); } _returnedLast = _cachedReturnedLast; } public DTMAxisIterator reset() { for (int i = 0; i < _free; i++) { _heap[i].reset(); _heap[i].step(); } // build heap for (int i = (_heapSize = _free)/2; i >= 0; i--) { heapify(i); } _returnedLast = END; return resetPosition(); } }
{ "content_hash": "7cb5940cc0b154f637aa2d1e9bb92c67", "timestamp": "", "source": "github", "line_count": 293, "max_line_length": 79, "avg_line_length": 32.37542662116041, "alnum_prop": 0.5386885937170567, "repo_name": "wapalxj/Java", "id": "ff07499f7f536e054e35eecd57e6efebcac78699", "size": "9641", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "javaworkplace/source/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultiValuedNodeHeapIterator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1" }, { "name": "C++", "bytes": "1" }, { "name": "HTML", "bytes": "200117" }, { "name": "Java", "bytes": "687071" }, { "name": "JavaScript", "bytes": "238567" }, { "name": "PHP", "bytes": "2789730" } ], "symlink_target": "" }
TestTableModel::TestTableModel(int row_count) : row_count_(row_count), observer_(nullptr) {} TestTableModel::~TestTableModel() = default; int TestTableModel::RowCount() { return row_count_; } std::u16string TestTableModel::GetText(int row, int column_id) { return base::ASCIIToUTF16(base::NumberToString(row) + "x" + base::NumberToString(column_id)); } ui::ImageModel TestTableModel::GetIcon(int row) { SkBitmap bitmap; bitmap.setInfo(SkImageInfo::MakeN32Premul(16, 16)); return ui::ImageModel::FromImageSkia( gfx::ImageSkia::CreateFrom1xBitmap(bitmap)); } void TestTableModel::SetObserver(ui::TableModelObserver* observer) { observer_ = observer; }
{ "content_hash": "698da05251ba2578cae268b67995aa6f", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 68, "avg_line_length": 29.375, "alnum_prop": 0.7063829787234043, "repo_name": "ric2b/Vivaldi-browser", "id": "99642e30e0a76e052d7698fb192a5db62871a72f", "size": "1210", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "chromium/ui/views/controls/table/test_table_model.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package layerfs import ( "errors" "os" "strings" ) const ( //PathSeparator is used to join path into database keys. Bolt stores values in a bucket in byte-order, choosing a unicode code point all the way at the end allows us to make assumptions when we use a cursor to iterate over directory entries PathSeparator = "\uFFFF" //PathPrintSeparator is used instead of the character above to print a path PathPrintSeparator = "/" //RootBasename is returned when the root is asked for its basename RootBasename = PathSeparator ) var ( // ErrInvalidPath is returned when no valid filename can be created from path components ErrInvalidPath = errors.New("invalid path components") ) //P describes a platform agnostic path on the file system and is stored as //a slice of path components type P []string var ( //Root is a path with zero components: len(Root) = 0 Root = P{} ) //PathFromKey turns a database key into its Path representation // func PathFromKey(k []byte) P { // return strings.Split(strings.TrimPrefix(string(k), PathSeparator), PathSeparator) // } //Validate is used to check if a given Path is valid, it //returns an ErrInvalidPath if the path is invalid nil otherwise func (p P) Validate() error { for _, c := range p { if strings.Contains(c, PathSeparator) { return ErrInvalidPath } } return nil } //Parent returns a path that refers to a parent, if the current //path is the root the root is still returned func (p P) Parent() P { if len(p) < 2 { return Root } return p[:len(p)-1] } //Base returns the base component of a path func (p P) Base() string { if len(p) < 1 { return PathSeparator } return p[len(p)-1] } //Equals compare paths based on their joined components func (p P) Equals(d P) bool { return (strings.Join(p, PathSeparator) == strings.Join(d, PathSeparator)) } //Key returns a byte slice used for database retrieval and storage // func (p P) Key() []byte { // return []byte(PathSeparator + strings.Join(p, PathSeparator)) // } //String implements stringer for the Path type that returns something more human friendly that shows familiar forward slashes func (p P) String() string { return PathPrintSeparator + strings.Join(p, PathPrintSeparator) } //Err allows easy creation of PathErrors func (p P) Err(op string, err error) *os.PathError { return &os.PathError{Op: op, Err: err, Path: p.String()} }
{ "content_hash": "909f93fc0d6f27119c6a40239d060aee", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 241, "avg_line_length": 27.09090909090909, "alnum_prop": 0.7244127516778524, "repo_name": "cellstate/treedb", "id": "cfafaf8ffef2ccba0129181199d6f68a0e86a6df", "size": "2384", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "layerfs/path.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "96198" } ], "symlink_target": "" }
<HTML><HEAD> <TITLE>Review for Rage: Carrie 2, The (1999)</TITLE> <LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0144814">Rage: Carrie 2, The (1999)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?DeWyNGaLe">DeWyNGaLe</A></H3><HR WIDTH="40%" SIZE="4"> <P>THE RAGE: CARRIE 2 by DeWyNGaLe Rating: A-</P> <P>Around twenty-two years ago, a movie starring Sissy Spacek, Piper Laurie, and Amy Irving was released about a girl with telekinesis that was driven to the edge, called Carrie. It was nominated for a couple of Academy Awards, a Golden Globe, and Sissy Spacek won the National Society of Film Critic's Award for Best Actress. Twenty two years later, a sequel to the classic has been made. I found myself asking the question before the movie, "Isn't it too late for a sequel?" After seeing such a great movie, I don't think it was.</P> <P>Emily Bergl shines as Rachel, the sister of Carrie. Rachel has telekinesis, just like her sister did. She does not want to admit to it, she just covers it up by saying objects fell because she bumped them off the table or another excuse. When Rachel was a little girl, her mom was admitted to an institution for the insane. She had to witness her mom get taken away, and some very strange events things, such as windows opening and shutting violently occurred when she was mad. She was forced to go to a foster home after her mom left, because she did not have a dad at the time. Growing up, Rachel has had to deal with all the weird things that go in with her telekinesis.</P> <P>Rachel has many problems at school. She isn't popular, or with the in-crowd, and she doesn't have many friends. Many people make fun of her, and don't bother to talk to her or be near her. Her best friend is Lisa, played by Mena Suvari. They seem to be the two outcasts of the school. Rachel is made fun of a lot by the popular people. </P> <P>After Lisa commits suicide, Rachel becomes very angered. Lockers and doors shut instantly when Rachel sees the sight of her dead best friend. No one knows why this happened, but it was due to Rachel's telekinesis. Having to cope with the loss, Rachel sees Sue Snell, played by Amy Irving, the guidance counselor, who reprises her role as Sue from the first Carrie film. Sue confirms that Rachel has telekinesis, and she also confirms that she is Carrie White's sister.</P> <P>Rachel's breaking point in the film is at a party at Mark's, played by Dylan Bruno, who is one of the popular people. Mark is involved in a setup to pull Rachel away from Jesse, another popular boy, played by Jason London, that all the popular kids are in. They all act like they like Rachel, and Rachel finally feels like she fits in. At the party though, she discovers the truth and beings very enraged, and as a result, some very suspenseful and eerie scenes follow. Rachel uses her telekinesis to get back at the kids who are making fun of her the best that she can.</P> <P>The Rage is somewhat predictable, but it is still fun to watch. There are a few suspenseful scenes, and also a few very frightening and disturbing images. The sound adds to the creepiness of the film, with loud effects at the right time to make you jump out of your seat. The house at which Mark's party took place in was a little extreme, but it was still a fun place to have a rage.</P> <P>In comparison to other recent horror films, The Rage is better by far. When viewing trailers for The Rage, I was expecting another teenager movie that would have a lot of blood and gore and barely any plot, but I was wrong. It completely surprised me. The Rage and In Dreams both had a similar feel to them, but I think that In Dreams was a little more clever, but certainly not as fun. I am glad to see this form of horror taking place more, rather than the slasher plot line for movies.</P> <P>The Rage: Carrie 2 is Emily Bergl's first film, and it certainly is a great one for her. She is very believable. She handles the scenes where telekinesis is kicking in very realistically and well. The character of Rachel is developed very deeply, and it is almost like we have known this character for a long time. We are given background on her, which is usually something film's don't give anymore. Amy Irving was also great as Sue Snell. It was very neat to see someone from the original Carrie return for the sequel. The acting from the popular crowd, which included Rachel Blanchard, Zachery Ty Bryan, Charlotte Lopez, and others, all did very nicely, and were all very mean characters. Although they weren't developed, they added to the film.</P> <P>The Bottom Line: Although the larger are "all going to laugh at this", this smaller critic didn't.</P> <HR><P CLASS=flush><SMALL>The review above was posted to the <A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR> The Internet Movie Database accepts no responsibility for the contents of the review and has no editorial control. Unless stated otherwise, the copyright belongs to the author.<BR> Please direct comments/criticisms of the review to relevant newsgroups.<BR> Broken URLs inthe reviews are the responsibility of the author.<BR> The formatting of the review is likely to differ from the original due to ASCII to HTML conversion. </SMALL></P> <P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P> </P></BODY></HTML>
{ "content_hash": "efb58f254c1df5af4a61942574a955df", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 199, "avg_line_length": 69.48780487804878, "alnum_prop": 0.7523692523692523, "repo_name": "xianjunzhengbackup/code", "id": "4196c3e7bb4518c0c3c07f3f32b2818023fad820", "size": "5698", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "data science/machine_learning_for_the_web/chapter_4/movie/17210.html", "mode": "33261", "license": "mit", "language": [ { "name": "BitBake", "bytes": "113" }, { "name": "BlitzBasic", "bytes": "256" }, { "name": "CSS", "bytes": "49827" }, { "name": "HTML", "bytes": "157006325" }, { "name": "JavaScript", "bytes": "14029" }, { "name": "Jupyter Notebook", "bytes": "4875399" }, { "name": "Mako", "bytes": "2060" }, { "name": "Perl", "bytes": "716" }, { "name": "Python", "bytes": "874414" }, { "name": "R", "bytes": "454" }, { "name": "Shell", "bytes": "3984" } ], "symlink_target": "" }
""" .. _tutorial-deploy-model-on-rasp: Deploy the Pretrained Model on Raspberry Pi =========================================== **Author**: `Ziheng Jiang <https://ziheng.org/>`_, \ `Hiroyuki Makino <https://makihiro.github.io/>`_ This is an example of using Relay to compile a ResNet model and deploy it on Raspberry Pi. """ import tvm import tvm.relay as relay from tvm import rpc from tvm.contrib import util, graph_runtime as runtime from tvm.contrib.download import download_testdata ###################################################################### # .. _build-tvm-runtime-on-device: # # Build TVM Runtime on Device # --------------------------- # # The first step is to build the TVM runtime on the remote device. # # .. note:: # # All instructions in both this section and next section should be # executed on the target device, e.g. Raspberry Pi. And we assume it # has Linux running. # # Since we do compilation on local machine, the remote device is only used # for running the generated code. We only need to build tvm runtime on # the remote device. # # .. code-block:: bash # # git clone --recursive https://github.com/dmlc/tvm # cd tvm # mkdir build # cp cmake/config.cmake build # cd build # cmake .. # make runtime -j4 # # After building runtime successfully, we need to set environment varibles # in :code:`~/.bashrc` file. We can edit :code:`~/.bashrc` # using :code:`vi ~/.bashrc` and add the line below (Assuming your TVM # directory is in :code:`~/tvm`): # # .. code-block:: bash # # export PYTHONPATH=$PYTHONPATH:~/tvm/python # # To update the environment variables, execute :code:`source ~/.bashrc`. ###################################################################### # Set Up RPC Server on Device # --------------------------- # To start an RPC server, run the following command on your remote device # (Which is Raspberry Pi in our example). # # .. code-block:: bash # # python -m tvm.exec.rpc_server --host 0.0.0.0 --port=9090 # # If you see the line below, it means the RPC server started # successfully on your device. # # .. code-block:: bash # # INFO:root:RPCServer: bind to 0.0.0.0:9090 # ###################################################################### # Prepare the Pre-trained Model # ----------------------------- # Back to the host machine, which should have a full TVM installed (with LLVM). # # We will use pre-trained model from # `MXNet Gluon model zoo <https://mxnet.incubator.apache.org/api/python/gluon/model_zoo.html>`_. # You can found more details about this part at tutorial :ref:`tutorial-from-mxnet`. from mxnet.gluon.model_zoo.vision import get_model from PIL import Image import numpy as np # one line to get the model block = get_model('resnet18_v1', pretrained=True) ###################################################################### # In order to test our model, here we download an image of cat and # transform its format. img_url = 'https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true' img_name = 'cat.png' img_path = download_testdata(img_url, img_name, module='data') image = Image.open(img_path).resize((224, 224)) def transform_image(image): image = np.array(image) - np.array([123., 117., 104.]) image /= np.array([58.395, 57.12, 57.375]) image = image.transpose((2, 0, 1)) image = image[np.newaxis, :] return image x = transform_image(image) ###################################################################### # synset is used to transform the label from number of ImageNet class to # the word human can understand. synset_url = ''.join(['https://gist.githubusercontent.com/zhreshold/', '4d0b62f3d01426887599d4f7ede23ee5/raw/', '596b27d23537e5a1b5751d2b0481ef172f58b539/', 'imagenet1000_clsid_to_human.txt']) synset_name = 'imagenet1000_clsid_to_human.txt' synset_path = download_testdata(synset_url, synset_name, module='data') with open(synset_path) as f: synset = eval(f.read()) ###################################################################### # Now we would like to port the Gluon model to a portable computational graph. # It's as easy as several lines. # We support MXNet static graph(symbol) and HybridBlock in mxnet.gluon shape_dict = {'data': x.shape} mod, params = relay.frontend.from_mxnet(block, shape_dict) # we want a probability so add a softmax operator func = mod["main"] func = relay.Function(func.params, relay.nn.softmax(func.body), None, func.type_params, func.attrs) ###################################################################### # Here are some basic data workload configurations. batch_size = 1 num_classes = 1000 image_shape = (3, 224, 224) data_shape = (batch_size,) + image_shape ###################################################################### # Compile The Graph # ----------------- # To compile the graph, we call the :any:`relay.build` function # with the graph configuration and parameters. However, You cannot to # deploy a x86 program on a device with ARM instruction set. It means # Relay also needs to know the compilation option of target device, # apart from arguments :code:`net` and :code:`params` to specify the # deep learning workload. Actually, the option matters, different option # will lead to very different performance. ###################################################################### # If we run the example on our x86 server for demonstration, we can simply # set it as :code:`llvm`. If running it on the Raspberry Pi, we need to # specify its instruction set. Set :code:`local_demo` to False if you want # to run this tutorial with a real device. local_demo = True if local_demo: target = tvm.target.create('llvm') else: target = tvm.target.arm_cpu('rasp3b') # The above line is a simple form of # target = tvm.target.create('llvm -device=arm_cpu -model=bcm2837 -target=armv7l-linux-gnueabihf -mattr=+neon') with relay.build_config(opt_level=3): graph, lib, params = relay.build(func, target, params=params) # After `relay.build`, you will get three return values: graph, # library and the new parameter, since we do some optimization that will # change the parameters but keep the result of model as the same. # Save the library at local temporary directory. tmp = util.tempdir() lib_fname = tmp.relpath('net.tar') lib.export_library(lib_fname) ###################################################################### # Deploy the Model Remotely by RPC # -------------------------------- # With RPC, you can deploy the model remotely from your host machine # to the remote device. # obtain an RPC session from remote device. if local_demo: remote = rpc.LocalSession() else: # The following is my environment, change this to the IP address of your target device host = '10.77.1.162' port = 9090 remote = rpc.connect(host, port) # upload the library to remote device and load it remote.upload(lib_fname) rlib = remote.load_module('net.tar') # create the remote runtime module ctx = remote.cpu(0) module = runtime.create(graph, rlib, ctx) # set parameter (upload params to the remote device. This may take a while) module.set_input(**params) # set input data module.set_input('data', tvm.nd.array(x.astype('float32'))) # run module.run() # get output out = module.get_output(0) # get top1 result top1 = np.argmax(out.asnumpy()) print('TVM prediction top-1: {}'.format(synset[top1]))
{ "content_hash": "52d2a043394559cc2c64cecf5223c511", "timestamp": "", "source": "github", "line_count": 209, "max_line_length": 115, "avg_line_length": 35.68421052631579, "alnum_prop": 0.6268436578171092, "repo_name": "mlperf/training_results_v0.7", "id": "d19805bdc2fbfabbf24f227cf9d75faa37cb1170", "size": "8243", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/tutorials/frontend/deploy_model_on_rasp.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "1731" }, { "name": "Awk", "bytes": "14530" }, { "name": "Batchfile", "bytes": "13130" }, { "name": "C", "bytes": "172914" }, { "name": "C++", "bytes": "13037795" }, { "name": "CMake", "bytes": "113458" }, { "name": "CSS", "bytes": "70255" }, { "name": "Clojure", "bytes": "622652" }, { "name": "Cuda", "bytes": "1974745" }, { "name": "Dockerfile", "bytes": "149523" }, { "name": "Groovy", "bytes": "160449" }, { "name": "HTML", "bytes": "171537" }, { "name": "Java", "bytes": "189275" }, { "name": "JavaScript", "bytes": "98224" }, { "name": "Julia", "bytes": "430755" }, { "name": "Jupyter Notebook", "bytes": "11091342" }, { "name": "Lua", "bytes": "17720" }, { "name": "MATLAB", "bytes": "34903" }, { "name": "Makefile", "bytes": "215967" }, { "name": "Perl", "bytes": "1551186" }, { "name": "PowerShell", "bytes": "13906" }, { "name": "Python", "bytes": "36943114" }, { "name": "R", "bytes": "134921" }, { "name": "Raku", "bytes": "7280" }, { "name": "Ruby", "bytes": "4930" }, { "name": "SWIG", "bytes": "140111" }, { "name": "Scala", "bytes": "1304960" }, { "name": "Shell", "bytes": "1312832" }, { "name": "Smalltalk", "bytes": "3497" }, { "name": "Starlark", "bytes": "69877" }, { "name": "TypeScript", "bytes": "243012" } ], "symlink_target": "" }
<?php namespace Phaza\LaravelPostgis\Connectors; use PDO; use Phaza\LaravelPostgis\PostgisConnection; class ConnectionFactory extends \Bosnadev\Database\Connectors\ConnectionFactory { /** * @param string $driver * @param \Closure|PDO $connection * @param string $database * @param string $prefix * @param array $config * @return \Illuminate\Database\Connection|PostgisConnection */ protected function createConnection($driver, $connection, $database, $prefix = '', array $config = []) { if ($this->container->bound($key = "db.connection.{$driver}")) { return $this->container->make($key, [$connection, $database, $prefix, $config]); } if ($driver === 'pgsql') { return new PostgisConnection($connection, $database, $prefix, $config); } return parent::createConnection($driver, $connection, $database, $prefix, $config); } }
{ "content_hash": "0d7e0e3e759ee1764847101932d12b7a", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 106, "avg_line_length": 34.57142857142857, "alnum_prop": 0.6270661157024794, "repo_name": "rogue780/laravel-postgis", "id": "715c2ccf2f85f0ce28502cadea098876df15a0e9", "size": "968", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Connectors/ConnectionFactory.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "62664" } ], "symlink_target": "" }
var ChannelModule = require("./module"); var Poll = require("../poll").Poll; const TYPE_NEW_POLL = { title: "string", timeout: "number,optional", obscured: "boolean", opts: "array" }; const TYPE_VOTE = { option: "number" }; function PollModule(channel) { ChannelModule.apply(this, arguments); this.poll = null; if (this.channel.modules.chat) { this.channel.modules.chat.registerCommand("poll", this.handlePollCmd.bind(this, false)); this.channel.modules.chat.registerCommand("hpoll", this.handlePollCmd.bind(this, true)); } } PollModule.prototype = Object.create(ChannelModule.prototype); PollModule.prototype.unload = function () { if (this.poll && this.poll.timer) { clearTimeout(this.poll.timer); } }; PollModule.prototype.load = function (data) { if ("poll" in data) { if (data.poll !== null) { this.poll = new Poll(data.poll.initiator, "", [], data.poll.obscured); this.poll.title = data.poll.title; this.poll.options = data.poll.options; this.poll.counts = data.poll.counts; this.poll.votes = data.poll.votes; } } }; PollModule.prototype.save = function (data) { if (this.poll === null) { data.poll = null; return; } data.poll = { title: this.poll.title, initiator: this.poll.initiator, options: this.poll.options, counts: this.poll.counts, votes: this.poll.votes, obscured: this.poll.obscured }; }; PollModule.prototype.onUserPostJoin = function (user) { this.sendPoll([user]); user.socket.typecheckedOn("newPoll", TYPE_NEW_POLL, this.handleNewPoll.bind(this, user)); user.socket.typecheckedOn("vote", TYPE_VOTE, this.handleVote.bind(this, user)); user.socket.on("closePoll", this.handleClosePoll.bind(this, user)); }; PollModule.prototype.onUserPart = function(user) { if (this.poll) { this.poll.unvote(user.ip); this.sendPollUpdate(this.channel.users); } }; PollModule.prototype.sendPoll = function (users) { if (!this.poll) { return; } var obscured = this.poll.packUpdate(false); var unobscured = this.poll.packUpdate(true); var perms = this.channel.modules.permissions; users.forEach(function (u) { u.socket.emit("closePoll"); if (perms.canViewHiddenPoll(u)) { u.socket.emit("newPoll", unobscured); } else { u.socket.emit("newPoll", obscured); } }); }; PollModule.prototype.sendPollUpdate = function (users) { if (!this.poll) { return; } var obscured = this.poll.packUpdate(false); var unobscured = this.poll.packUpdate(true); var perms = this.channel.modules.permissions; users.forEach(function (u) { if (perms.canViewHiddenPoll(u)) { u.socket.emit("updatePoll", unobscured); } else { u.socket.emit("updatePoll", obscured); } }); }; PollModule.prototype.handleNewPoll = function (user, data) { if (!this.channel.modules.permissions.canControlPoll(user)) { return; } var title = data.title.substring(0, 255); var opts = data.opts.map(function (x) { return (""+x).substring(0, 255); }); var obscured = data.obscured; var poll = new Poll(user.getName(), title, opts, obscured); var self = this; if (data.hasOwnProperty("timeout") && !isNaN(data.timeout) && data.timeout > 0) { poll.timer = setTimeout(function () { if (self.poll === poll) { self.handleClosePoll({ getName: function () { return "[poll timer]" }, effectiveRank: 255 }); } }, data.timeout * 1000); } this.poll = poll; this.sendPoll(this.channel.users); this.channel.logger.log("[poll] " + user.getName() + " opened poll: '" + poll.title + "'"); }; PollModule.prototype.handleVote = function (user, data) { if (!this.channel.modules.permissions.canVote(user)) { return; } if (this.poll) { this.poll.vote(user.ip, data.option); this.sendPollUpdate(this.channel.users); } }; PollModule.prototype.handleClosePoll = function (user) { if (!this.channel.modules.permissions.canControlPoll(user)) { return; } if (this.poll) { if (this.poll.obscured) { this.poll.obscured = false; this.channel.broadcastAll("updatePoll", this.poll.packUpdate(true)); } if (this.poll.timer) { clearTimeout(this.poll.timer); } this.channel.broadcastAll("closePoll"); this.channel.logger.log("[poll] " + user.getName() + " closed the active poll"); this.poll = null; } }; PollModule.prototype.handlePollCmd = function (obscured, user, msg, meta) { if (!this.channel.modules.permissions.canControlPoll(user)) { return; } msg = msg.replace(/^\/h?poll/, ""); var args = msg.split(","); var title = args.shift(); var poll = new Poll(user.getName(), title, args, obscured); this.poll = poll; this.sendPoll(this.channel.users); this.channel.logger.log("[poll] " + user.getName() + " opened poll: '" + poll.title + "'"); }; module.exports = PollModule;
{ "content_hash": "50685a2cac4b8eec772ea0566c41c7b6", "timestamp": "", "source": "github", "line_count": 186, "max_line_length": 96, "avg_line_length": 28.693548387096776, "alnum_prop": 0.6010867528574105, "repo_name": "jasonbio/tubesynch", "id": "f699132775022d3030d83574434010d285ac5209", "size": "5337", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/channel/poll.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "289553" }, { "name": "HTML", "bytes": "141741" }, { "name": "JavaScript", "bytes": "702189" }, { "name": "Python", "bytes": "2465" }, { "name": "Shell", "bytes": "58" } ], "symlink_target": "" }
SELECT Bestelling.id bestelling, Product.id product, FORMAT(Product.prijs, 2) prijs, Vertaling.inhoud inhoud, CategorieVertaling.inhoud categorienaam FROM Bestelling JOIN Product ON Bestelling.product = Product.id JOIN Vertaling ON Product.naam = Vertaling.betekenis JOIN ProductCategorie ON Product.categorie = ProductCategorie.id JOIN Vertaling CategorieVertaling ON ProductCategorie.naam = CategorieVertaling.betekenis WHERE Vertaling.taalcode = @taalcode AND CategorieVertaling.taalcode = @taalcode AND Bestelling.deelnemer = @deelnemer;
{ "content_hash": "b8a97b7dbb2e9a1843e091755558b7da", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 59, "avg_line_length": 22.214285714285715, "alnum_prop": 0.7347266881028939, "repo_name": "strandtentje/megalan", "id": "233cda5ff5434f8962fbe2ec448bed0eeb30fde2", "size": "622", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "registration/-queries/GetBestellingen.sql", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10024" }, { "name": "HTML", "bytes": "12182" }, { "name": "TeX", "bytes": "8777" } ], "symlink_target": "" }
package jais.messages.binaryaddressed; import jais.messages.AISMessageDecoder; import jais.AISPacket; import jais.exceptions.AISException; import jais.messages.BinaryAddressedMessageBase; import jais.messages.enums.FieldMap; import jais.messages.enums.BinaryAddressedMessageType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** * * @author Jonathan Machen */ public class IMO289NumberOfPersonsOnBoard extends BinaryAddressedMessageBase { private final static Logger LOG = LogManager.getLogger( IMO289NumberOfPersonsOnBoard.class ); private int _persons; /** * * @param source * @param packets * @throws jais.exceptions.AISException */ public IMO289NumberOfPersonsOnBoard( String source, AISPacket... packets ) throws AISException { super( source, BinaryAddressedMessageType.NUMBER_OF_PERSONS_ON_BOARD, packets ); } /** * * @return */ public int getPersons() { return _persons; } /** * @throws AISException */ @Override public final void decode() throws AISException { super.decode(); for( IMO289NumberOfPersonsOnBoardFieldMap field : IMO289NumberOfPersonsOnBoardFieldMap.values() ) { switch( field ) { case PERSONS: _persons = AISMessageDecoder.decodeUnsignedInt( _bits, field.getStartBit(), field.getEndBit() ); default: LOG.warn( "Ignoring field: {}", field.name() ); } } } /** * */ private enum IMO289NumberOfPersonsOnBoardFieldMap implements FieldMap { PERSONS( 88, 100 ), SPARE( 101, 135 ); private final int _startBit; private final int _endBit; /** * * @param startBit * @param endBit */ IMO289NumberOfPersonsOnBoardFieldMap( int startBit, int endBit ) { _startBit = startBit; _endBit = endBit; } /** * * @return */ @Override public int getStartBit() { return _startBit; } /** * * @return */ @Override public int getEndBit() { return _endBit; } } }
{ "content_hash": "f4eae1f277f54e5871e35767ee995090", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 97, "avg_line_length": 24.392156862745097, "alnum_prop": 0.5498392282958199, "repo_name": "vermicious/jais", "id": "e7fd42990422daf58bc0823e47a8557c4fa10447", "size": "3140", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/jais/messages/binaryaddressed/IMO289NumberOfPersonsOnBoard.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "532741" } ], "symlink_target": "" }
var express = require('express'), openport = require('openport'), request = require('request'), assert = require('assert'), testServer = require('./test-server') session = require('../lib/middleware'); var port; var host; var server; before(function(done) { testServer({ secret: 'testSecret' }, function(serverPort, serverInstance) { port = serverPort; host = 'http://localhost:' + port; server = serverInstance; done(); }); }); after(function() { server.close(); }); describe('lazy-sessions', function() { it('does not create sessions on first request', function(done) { request(host + '/', {}, function(err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(resp.headers['set-cookie'], undefined); done(err); }); }); it('creates sessions correctly', function(done) { request(host + '/session', {}, function(err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(1, resp.headers['set-cookie'].length); assert.equal(0, resp.headers['set-cookie'][0].indexOf('sessionId=c')); done(err); }); }); it('stores data between requests in a sesions', function(done) { var jar = request.jar(); request.post(host + '/store', {jar: jar}, function(err, resp, data) { assert.equal(resp.statusCode, 200); request(host + '/session', {jar: jar}, function(err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(data, '{"cookie":{"maxAge":null},"testing":"123"}'); done(err); }); }); }); it('does not expose others sessions', function(done) { request(host + '/session', {jar: false}, function(err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(data, '{"cookie":{"maxAge":null}}'); done(err); }); }); it('rejects tampered session cookies', function(done) { var jar = request.jar(); request.post(host + '/store', {jar: jar}, function(err, resp, data) { assert.equal(resp.statusCode, 200); var cookie = request.cookie(resp.headers['set-cookie'][0]); var parts = cookie.value.split('.'); parts[0] = 'nonsense'; cookie.value = parts.join('.'); jar.add(cookie); request(host + '/session', {jar: jar}, function(err, resp, data) { assert.equal(resp.statusCode, 500); assert.equal(1, resp.headers['set-cookie'].length); assert.equal('sessionId=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT', resp.headers['set-cookie'][0]); done(err); }); }); }); it('destroys sessions correctly', function(done) { request.post(host + '/destroy', {}, function(err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(1, resp.headers['set-cookie'].length); assert.equal('sessionId=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT', resp.headers['set-cookie'][0]); done(err); }); }); it('does not create sessions when destroying sessions', function(done) { var jar = request.jar(); request.post(host + '/destroy', {jar: jar}, function (err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(1, resp.headers['set-cookie'].length); done(err); }); }); describe('with time based session expiry', function() { var port, server, host; before(function(done) { testServer({ secret: 'testSecret', maxAge: 1000 * 60 * 15 //15 mins }, function(serverPort, serverInstance) { port = serverPort; host = 'http://localhost:' + port; server = serverInstance; done(); }); }); after(function() { server.close(); }); it('touches the session cookie on requests', function(done) { request(host + '/session', {}, function(err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(1, resp.headers['set-cookie'].length); assert.equal(0, resp.headers['set-cookie'][0].indexOf('sessionId=c')); request(host, {}, function(err, resp, data) { assert.equal(resp.statusCode, 200); assert.equal(1, resp.headers['set-cookie'].length); assert.equal(0, resp.headers['set-cookie'][0].indexOf('sessionId=c')); done(err); }); }); }); }); });
{ "content_hash": "be2c8091a661e7e78333d812e5759a91", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 121, "avg_line_length": 35.635714285714286, "alnum_prop": 0.5123271196632592, "repo_name": "mindcandy/lazy-sessions", "id": "26cd9c6cb2ed27845a5de0bf413f9a1c8e14d09c", "size": "4989", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/sessions.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "16113" } ], "symlink_target": "" }
// // XPathQuery.m // FuelFinder // // Created by Matt Gallagher on 4/08/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import "XPathQuery.h" #import <libxml/tree.h> #import <libxml/parser.h> #import <libxml/HTMLparser.h> #import <libxml/xpath.h> #import <libxml/xpathInternals.h> NSDictionary *DictionaryForNode(xmlNodePtr currentNode, NSMutableDictionary *parentResult,BOOL parentContent); NSArray *PerformXPathQuery(xmlDocPtr doc, NSString *query); NSDictionary *DictionaryForNode(xmlNodePtr currentNode, NSMutableDictionary *parentResult,BOOL parentContent) { NSMutableDictionary *resultForNode = [NSMutableDictionary dictionary]; if (currentNode->name) { NSString *currentNodeContent = [NSString stringWithCString:(const char *)currentNode->name encoding:NSUTF8StringEncoding]; [resultForNode setObject:currentNodeContent forKey:@"nodeName"]; } if (currentNode->content && currentNode->content != (xmlChar *)-1) { NSString *currentNodeContent = [NSString stringWithCString:(const char *)currentNode->content encoding:NSUTF8StringEncoding]; if ([[resultForNode objectForKey:@"nodeName"] isEqual:@"text"] && parentResult) { if(parentContent) { [parentResult setObject:[currentNodeContent stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:@"nodeContent"]; return nil; } [resultForNode setObject:currentNodeContent forKey:@"nodeContent"]; // NSLog(@"content: %@",currentNodeContent); return resultForNode; } else { [resultForNode setObject:currentNodeContent forKey:@"nodeContent"]; } } xmlAttr *attribute = currentNode->properties; if (attribute) { NSMutableArray *attributeArray = [NSMutableArray array]; while (attribute) { NSMutableDictionary *attributeDictionary = [NSMutableDictionary dictionary]; NSString *attributeName = [NSString stringWithCString:(const char *)attribute->name encoding:NSUTF8StringEncoding]; if (attributeName) { // NSLog(@"Attribute Name Set: %@",attributeName); [attributeDictionary setObject:attributeName forKey:@"attributeName"]; } if (attribute->children) { NSDictionary *childDictionary = DictionaryForNode(attribute->children, attributeDictionary,true); if (childDictionary) { [attributeDictionary setObject:childDictionary forKey:@"attributeContent"]; } } if ([attributeDictionary count] > 0) { [attributeArray addObject:attributeDictionary]; } attribute = attribute->next; } if ([attributeArray count] > 0) { [resultForNode setObject:attributeArray forKey:@"nodeAttributeArray"]; } } xmlNodePtr childNode = currentNode->children; if (childNode) { NSMutableArray *childContentArray = [NSMutableArray array]; while (childNode) { NSDictionary *childDictionary = DictionaryForNode(childNode, resultForNode,false); if (childDictionary) { [childContentArray addObject:childDictionary]; } childNode = childNode->next; } if ([childContentArray count] > 0) { [resultForNode setObject:childContentArray forKey:@"nodeChildArray"]; } } return resultForNode; } NSArray *PerformXPathQuery(xmlDocPtr doc, NSString *query) { xmlXPathContextPtr xpathCtx; xmlXPathObjectPtr xpathObj; /* Create xpath evaluation context */ xpathCtx = xmlXPathNewContext(doc); if(xpathCtx == NULL) { NSLog(@"Unable to create XPath context."); return nil; } /* Evaluate xpath expression */ xpathObj = xmlXPathEvalExpression((xmlChar *)[query cStringUsingEncoding:NSUTF8StringEncoding], xpathCtx); if(xpathObj == NULL) { NSLog(@"Unable to evaluate XPath."); xmlXPathFreeContext(xpathCtx); return nil; } xmlNodeSetPtr nodes = xpathObj->nodesetval; if (!nodes) { NSLog(@"Nodes was nil."); xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); return nil; } NSMutableArray *resultNodes = [NSMutableArray array]; for (NSInteger i = 0; i < nodes->nodeNr; i++) { NSDictionary *nodeDictionary = DictionaryForNode(nodes->nodeTab[i], nil,false); if (nodeDictionary) { [resultNodes addObject:nodeDictionary]; } } /* Cleanup */ xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); return resultNodes; } NSArray *PerformHTMLXPathQuery(NSData *document, NSString *query) { xmlDocPtr doc; /* Load XML document */ doc = htmlReadMemory([document bytes], (int)[document length], "", NULL, HTML_PARSE_NOWARNING | HTML_PARSE_NOERROR); if (doc == NULL) { NSLog(@"Unable to parse."); return nil; } NSArray *result = PerformXPathQuery(doc, query); xmlFreeDoc(doc); return result; } NSArray *PerformXMLXPathQuery(NSData *document, NSString *query) { xmlDocPtr doc; /* Load XML document */ doc = xmlReadMemory([document bytes], (int)[document length], "", NULL, XML_PARSE_RECOVER); if (doc == NULL) { NSLog(@"Unable to parse."); return nil; } NSArray *result = PerformXPathQuery(doc, query); xmlFreeDoc(doc); return result; }
{ "content_hash": "e9f9746e9f89e0746c9d6e4cfc28749d", "timestamp": "", "source": "github", "line_count": 197, "max_line_length": 166, "avg_line_length": 28.512690355329948, "alnum_prop": 0.645896385971159, "repo_name": "eiffelqiu/appjam", "id": "c4bedc580b69b21584ef2fe080626f70b045116c", "size": "5617", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.m", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "18797" }, { "name": "Objective-C", "bytes": "2215446" }, { "name": "Ruby", "bytes": "128219" } ], "symlink_target": "" }
package eu.bcvsolutions.idm.acc.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import java.time.ZonedDateTime; import java.time.LocalDate; import eu.bcvsolutions.idm.core.api.domain.DefaultFieldLengths; /** * Entity for test contract slice table resource * * @author svandav * */ @Entity @Table(name = TestContractSliceResource.TABLE_NAME) public class TestContractSliceResource { public static final String TABLE_NAME = "test_contract_slice_resource"; @Id @Column(name = "ID", length = DefaultFieldLengths.NAME) private String id; @Column(name = "NAME", length = DefaultFieldLengths.NAME) private String name; @Column(name = "STATE", length = DefaultFieldLengths.NAME) private String state; @Column(name = "DISABLED", length = DefaultFieldLengths.NAME) private String disabled; @Column(name = "DESCRIPTION", length = DefaultFieldLengths.NAME) private String description; @Column(name = "VALIDFROM") private LocalDate validFrom; @Column(name = "VALIDTILL") private LocalDate validTill; @Column(name = "LEADER", length = DefaultFieldLengths.NAME) private String leader; @Column(name = "MAIN", length = DefaultFieldLengths.NAME) private String main; @Column(name = "OWNER", length = DefaultFieldLengths.NAME) private String owner; @Column(name = "WORKPOSITION", length = DefaultFieldLengths.NAME) private String workposition; @Column(name = "MODIFIED") private ZonedDateTime modified; @Column(name = "VALIDFROM_SLICE") private LocalDate validFromSlice; @Column(name = "CONTRACT_CODE", length = DefaultFieldLengths.NAME) private String contractCode; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getDisabled() { return disabled; } public void setDisabled(String disabled) { this.disabled = disabled; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public LocalDate getValidFrom() { return validFrom; } public void setValidFrom(LocalDate validFrom) { this.validFrom = validFrom; } public LocalDate getValidTill() { return validTill; } public void setValidTill(LocalDate validTill) { this.validTill = validTill; } public String getLeader() { return leader; } public void setLeader(String leader) { this.leader = leader; } public String getMain() { return main; } public void setMain(String main) { this.main = main; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public ZonedDateTime getModified() { return modified; } public void setModified(ZonedDateTime modified) { this.modified = modified; } public String getWorkposition() { return workposition; } public void setWorkposition(String workposition) { this.workposition = workposition; } public LocalDate getValidFromSlice() { return validFromSlice; } public void setValidFromSlice(LocalDate validFromSlice) { this.validFromSlice = validFromSlice; } public String getContractCode() { return contractCode; } public void setContractCode(String contractCode) { this.contractCode = contractCode; } }
{ "content_hash": "faddc70c7940818a11d536a9fa3f12d6", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 72, "avg_line_length": 21.162650602409638, "alnum_prop": 0.7369769427839453, "repo_name": "bcvsolutions/CzechIdMng", "id": "4382c8c5f6d1c103a259b8f1cd1c34b886cfa295", "size": "3513", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "Realization/backend/acc/src/test/java/eu/bcvsolutions/idm/acc/entity/TestContractSliceResource.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "20553" }, { "name": "HTML", "bytes": "1826" }, { "name": "Java", "bytes": "17776464" }, { "name": "JavaScript", "bytes": "4985617" }, { "name": "Less", "bytes": "56975" }, { "name": "Shell", "bytes": "2793" }, { "name": "TSQL", "bytes": "114398" } ], "symlink_target": "" }
<?php require_once 'My/ShantyMongo/Student.php'; class My_ShantyMongo_ArtStudent extends My_ShantyMongo_Student { }
{ "content_hash": "8d7ed293d3cb554d534010c1e6151a91", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 62, "avg_line_length": 14.75, "alnum_prop": 0.7796610169491526, "repo_name": "coen-hyde/Shanty-Mongo", "id": "11772905fdd173930b072fc72c7127d23a4f4fb3", "size": "118", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/Shanty/Mongo/_files/My/ShantyMongo/ArtStudent.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "210759" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- 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 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. --> <project> <modelVersion>4.0.0</modelVersion> <packaging>war</packaging> <groupId>com.example.getstarted</groupId> <artifactId>session-handling</artifactId> <version>1.0-SNAPSHOT</version> <parent> <groupId>com.google.cloud.samples</groupId> <artifactId>shared-configuration</artifactId> <version>1.2.0</version> </parent> <properties> <gcloud.appId>MY_PROJECT</gcloud.appId> <failOnMissingWebXml>false</failOnMissingWebXml> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation> <maven.compiler.showWarnings>true</maven.compiler.showWarnings> <maven.compiler.failOnWarning>false</maven.compiler.failOnWarning> <maven.war.filteringDeploymentDescriptors>false</maven.war.filteringDeploymentDescriptors> <jetty.version>9.4.44.v20210927</jetty.version> </properties> <dependencies> <!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-firestore --> <dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-firestore</artifactId> <version>3.0.9</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>4.0.0</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>31.1-jre</version> <scope>compile</scope> </dependency> <dependency> <groupId>io.opencensus</groupId> <artifactId>opencensus-contrib-http-util</artifactId> <version>0.31.1</version> </dependency> <!-- Test dependencies --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>3.141.59</version> <scope>test</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-chrome-driver</artifactId> <version>4.1.4</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>bookshelf-session-handling</finalName> <!-- Optional - for hot reload of the web application when using an IDE Eclipse / IDEA --> <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes </outputDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.3.2</version> </plugin> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty.version}</version> </plugin> <plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>jib-maven-plugin</artifactId> <version>3.2.1</version> <configuration> <to> <image>gcr.io/${gcloud.appId}/session-handling</image> </to> </configuration> </plugin> </plugins> </build> </project>
{ "content_hash": "24baa0c4bd0b5398f04aa6d6d9df57b5", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 94, "avg_line_length": 32.79338842975206, "alnum_prop": 0.6784274193548387, "repo_name": "GoogleCloudPlatform/java-docs-samples", "id": "329edf1b37d6b9b655da1290a8e5b1c9874e24c3", "size": "3968", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "session-handling/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2405" }, { "name": "CSS", "bytes": "3173" }, { "name": "Dockerfile", "bytes": "17588" }, { "name": "Groovy", "bytes": "2906" }, { "name": "HCL", "bytes": "8428" }, { "name": "HTML", "bytes": "44551" }, { "name": "Java", "bytes": "7001177" }, { "name": "JavaScript", "bytes": "14308" }, { "name": "Kotlin", "bytes": "7435" }, { "name": "Python", "bytes": "1261" }, { "name": "Scala", "bytes": "17333" }, { "name": "Shell", "bytes": "58760" }, { "name": "XSLT", "bytes": "1055" } ], "symlink_target": "" }
/* * net/sched/sch_cbq.c Class-Based Queueing discipline. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * Authors: Alexey Kuznetsov, <[email protected]> * */ #include <linux/module.h> #include <linux/slab.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/skbuff.h> #include <net/netlink.h> #include <net/pkt_sched.h> /* Class-Based Queueing (CBQ) algorithm. ======================================= Sources: [1] Sally Floyd and Van Jacobson, "Link-sharing and Resource Management Models for Packet Networks", IEEE/ACM Transactions on Networking, Vol.3, No.4, 1995 [2] Sally Floyd, "Notes on CBQ and Guaranteed Service", 1995 [3] Sally Floyd, "Notes on Class-Based Queueing: Setting Parameters", 1996 [4] Sally Floyd and Michael Speer, "Experimental Results for Class-Based Queueing", 1998, not published. ----------------------------------------------------------------------- Algorithm skeleton was taken from NS simulator cbq.cc. If someone wants to check this code against the LBL version, he should take into account that ONLY the skeleton was borrowed, the implementation is different. Particularly: --- The WRR algorithm is different. Our version looks more reasonable (I hope) and works when quanta are allowed to be less than MTU, which is always the case when real time classes have small rates. Note, that the statement of [3] is incomplete, delay may actually be estimated even if class per-round allotment is less than MTU. Namely, if per-round allotment is W*r_i, and r_1+...+r_k = r < 1 delay_i <= ([MTU/(W*r_i)]*W*r + W*r + k*MTU)/B In the worst case we have IntServ estimate with D = W*r+k*MTU and C = MTU*r. The proof (if correct at all) is trivial. --- It seems that cbq-2.0 is not very accurate. At least, I cannot interpret some places, which look like wrong translations from NS. Anyone is advised to find these differences and explain to me, why I am wrong 8). --- Linux has no EOI event, so that we cannot estimate true class idle time. Workaround is to consider the next dequeue event as sign that previous packet is finished. This is wrong because of internal device queueing, but on a permanently loaded link it is true. Moreover, combined with clock integrator, this scheme looks very close to an ideal solution. */ struct cbq_sched_data; struct cbq_class { struct Qdisc_class_common common; struct cbq_class *next_alive; /* next class with backlog in this priority band */ /* Parameters */ unsigned char priority; /* class priority */ unsigned char priority2; /* priority to be used after overlimit */ unsigned char ewma_log; /* time constant for idle time calculation */ unsigned char ovl_strategy; #ifdef CONFIG_NET_CLS_ACT unsigned char police; #endif u32 defmap; /* Link-sharing scheduler parameters */ long maxidle; /* Class parameters: see below. */ long offtime; long minidle; u32 avpkt; struct qdisc_rate_table *R_tab; /* Overlimit strategy parameters */ void (*overlimit)(struct cbq_class *cl); psched_tdiff_t penalty; /* General scheduler (WRR) parameters */ long allot; long quantum; /* Allotment per WRR round */ long weight; /* Relative allotment: see below */ struct Qdisc *qdisc; /* Ptr to CBQ discipline */ struct cbq_class *split; /* Ptr to split node */ struct cbq_class *share; /* Ptr to LS parent in the class tree */ struct cbq_class *tparent; /* Ptr to tree parent in the class tree */ struct cbq_class *borrow; /* NULL if class is bandwidth limited; parent otherwise */ struct cbq_class *sibling; /* Sibling chain */ struct cbq_class *children; /* Pointer to children chain */ struct Qdisc *q; /* Elementary queueing discipline */ /* Variables */ unsigned char cpriority; /* Effective priority */ unsigned char delayed; unsigned char level; /* level of the class in hierarchy: 0 for leaf classes, and maximal level of children + 1 for nodes. */ psched_time_t last; /* Last end of service */ psched_time_t undertime; long avgidle; long deficit; /* Saved deficit for WRR */ psched_time_t penalized; struct gnet_stats_basic_packed bstats; struct gnet_stats_queue qstats; struct gnet_stats_rate_est rate_est; struct tc_cbq_xstats xstats; struct tcf_proto *filter_list; int refcnt; int filters; struct cbq_class *defaults[TC_PRIO_MAX + 1]; }; struct cbq_sched_data { struct Qdisc_class_hash clhash; /* Hash table of all classes */ int nclasses[TC_CBQ_MAXPRIO + 1]; unsigned int quanta[TC_CBQ_MAXPRIO + 1]; struct cbq_class link; unsigned int activemask; struct cbq_class *active[TC_CBQ_MAXPRIO + 1]; /* List of all classes with backlog */ #ifdef CONFIG_NET_CLS_ACT struct cbq_class *rx_class; #endif struct cbq_class *tx_class; struct cbq_class *tx_borrowed; int tx_len; psched_time_t now; /* Cached timestamp */ psched_time_t now_rt; /* Cached real time */ unsigned int pmask; struct hrtimer delay_timer; struct qdisc_watchdog watchdog; /* Watchdog timer, started when CBQ has backlog, but cannot transmit just now */ psched_tdiff_t wd_expires; int toplevel; u32 hgenerator; }; #define L2T(cl, len) qdisc_l2t((cl)->R_tab, len) static inline struct cbq_class * cbq_class_lookup(struct cbq_sched_data *q, u32 classid) { struct Qdisc_class_common *clc; clc = qdisc_class_find(&q->clhash, classid); if (clc == NULL) return NULL; return container_of(clc, struct cbq_class, common); } #ifdef CONFIG_NET_CLS_ACT static struct cbq_class * cbq_reclassify(struct sk_buff *skb, struct cbq_class *this) { struct cbq_class *cl; for (cl = this->tparent; cl; cl = cl->tparent) { struct cbq_class *new = cl->defaults[TC_PRIO_BESTEFFORT]; if (new != NULL && new != this) return new; } return NULL; } #endif /* Classify packet. The procedure is pretty complicated, but * it allows us to combine link sharing and priority scheduling * transparently. * * Namely, you can put link sharing rules (f.e. route based) at root of CBQ, * so that it resolves to split nodes. Then packets are classified * by logical priority, or a more specific classifier may be attached * to the split node. */ static struct cbq_class * cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *head = &q->link; struct cbq_class **defmap; struct cbq_class *cl = NULL; u32 prio = skb->priority; struct tcf_result res; /* * Step 1. If skb->priority points to one of our classes, use it. */ if (TC_H_MAJ(prio ^ sch->handle) == 0 && (cl = cbq_class_lookup(q, prio)) != NULL) return cl; *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; for (;;) { int result = 0; defmap = head->defaults; /* * Step 2+n. Apply classifier. */ if (!head->filter_list || (result = tc_classify_compat(skb, head->filter_list, &res)) < 0) goto fallback; cl = (void *)res.class; if (!cl) { if (TC_H_MAJ(res.classid)) cl = cbq_class_lookup(q, res.classid); else if ((cl = defmap[res.classid & TC_PRIO_MAX]) == NULL) cl = defmap[TC_PRIO_BESTEFFORT]; if (cl == NULL) goto fallback; } if (cl->level >= head->level) goto fallback; #ifdef CONFIG_NET_CLS_ACT switch (result) { case TC_ACT_QUEUED: case TC_ACT_STOLEN: *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; case TC_ACT_SHOT: return NULL; case TC_ACT_RECLASSIFY: return cbq_reclassify(skb, cl); } #endif if (cl->level == 0) return cl; /* * Step 3+n. If classifier selected a link sharing class, * apply agency specific classifier. * Repeat this procdure until we hit a leaf node. */ head = cl; } fallback: cl = head; /* * Step 4. No success... */ if (TC_H_MAJ(prio) == 0 && !(cl = head->defaults[prio & TC_PRIO_MAX]) && !(cl = head->defaults[TC_PRIO_BESTEFFORT])) return head; return cl; } /* * A packet has just been enqueued on the empty class. * cbq_activate_class adds it to the tail of active class list * of its priority band. */ static inline void cbq_activate_class(struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); int prio = cl->cpriority; struct cbq_class *cl_tail; cl_tail = q->active[prio]; q->active[prio] = cl; if (cl_tail != NULL) { cl->next_alive = cl_tail->next_alive; cl_tail->next_alive = cl; } else { cl->next_alive = cl; q->activemask |= (1<<prio); } } /* * Unlink class from active chain. * Note that this same procedure is done directly in cbq_dequeue* * during round-robin procedure. */ static void cbq_deactivate_class(struct cbq_class *this) { struct cbq_sched_data *q = qdisc_priv(this->qdisc); int prio = this->cpriority; struct cbq_class *cl; struct cbq_class *cl_prev = q->active[prio]; do { cl = cl_prev->next_alive; if (cl == this) { cl_prev->next_alive = cl->next_alive; cl->next_alive = NULL; if (cl == q->active[prio]) { q->active[prio] = cl_prev; if (cl == q->active[prio]) { q->active[prio] = NULL; q->activemask &= ~(1<<prio); return; } } return; } } while ((cl_prev = cl) != q->active[prio]); } static void cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl) { int toplevel = q->toplevel; if (toplevel > cl->level && !(qdisc_is_throttled(cl->q))) { psched_time_t now; psched_tdiff_t incr; now = psched_get_time(); incr = now - q->now_rt; now = q->now + incr; do { if (cl->undertime < now) { q->toplevel = cl->level; return; } } while ((cl = cl->borrow) != NULL && toplevel > cl->level); } } static int cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) { struct cbq_sched_data *q = qdisc_priv(sch); int uninitialized_var(ret); struct cbq_class *cl = cbq_classify(skb, sch, &ret); #ifdef CONFIG_NET_CLS_ACT q->rx_class = cl; #endif if (cl == NULL) { if (ret & __NET_XMIT_BYPASS) sch->qstats.drops++; kfree_skb(skb); return ret; } #ifdef CONFIG_NET_CLS_ACT cl->q->__parent = sch; #endif ret = qdisc_enqueue(skb, cl->q); if (ret == NET_XMIT_SUCCESS) { sch->q.qlen++; cbq_mark_toplevel(q, cl); if (!cl->next_alive) cbq_activate_class(cl); return ret; } if (net_xmit_drop_count(ret)) { sch->qstats.drops++; cbq_mark_toplevel(q, cl); cl->qstats.drops++; } return ret; } /* Overlimit actions */ /* TC_CBQ_OVL_CLASSIC: (default) penalize leaf class by adding offtime */ static void cbq_ovl_classic(struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); psched_tdiff_t delay = cl->undertime - q->now; if (!cl->delayed) { delay += cl->offtime; /* * Class goes to sleep, so that it will have no * chance to work avgidle. Let's forgive it 8) * * BTW cbq-2.0 has a crap in this * place, apparently they forgot to shift it by cl->ewma_log. */ if (cl->avgidle < 0) delay -= (-cl->avgidle) - ((-cl->avgidle) >> cl->ewma_log); if (cl->avgidle < cl->minidle) cl->avgidle = cl->minidle; if (delay <= 0) delay = 1; cl->undertime = q->now + delay; cl->xstats.overactions++; cl->delayed = 1; } if (q->wd_expires == 0 || q->wd_expires > delay) q->wd_expires = delay; /* Dirty work! We must schedule wakeups based on * real available rate, rather than leaf rate, * which may be tiny (even zero). */ if (q->toplevel == TC_CBQ_MAXLEVEL) { struct cbq_class *b; psched_tdiff_t base_delay = q->wd_expires; for (b = cl->borrow; b; b = b->borrow) { delay = b->undertime - q->now; if (delay < base_delay) { if (delay <= 0) delay = 1; base_delay = delay; } } q->wd_expires = base_delay; } } /* TC_CBQ_OVL_RCLASSIC: penalize by offtime classes in hierarchy, when * they go overlimit */ static void cbq_ovl_rclassic(struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); struct cbq_class *this = cl; do { if (cl->level > q->toplevel) { cl = NULL; break; } } while ((cl = cl->borrow) != NULL); if (cl == NULL) cl = this; cbq_ovl_classic(cl); } /* TC_CBQ_OVL_DELAY: delay until it will go to underlimit */ static void cbq_ovl_delay(struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); psched_tdiff_t delay = cl->undertime - q->now; if (test_bit(__QDISC_STATE_DEACTIVATED, &qdisc_root_sleeping(cl->qdisc)->state)) return; if (!cl->delayed) { psched_time_t sched = q->now; ktime_t expires; delay += cl->offtime; if (cl->avgidle < 0) delay -= (-cl->avgidle) - ((-cl->avgidle) >> cl->ewma_log); if (cl->avgidle < cl->minidle) cl->avgidle = cl->minidle; cl->undertime = q->now + delay; if (delay > 0) { sched += delay + cl->penalty; cl->penalized = sched; cl->cpriority = TC_CBQ_MAXPRIO; q->pmask |= (1<<TC_CBQ_MAXPRIO); expires = ktime_set(0, 0); expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); if (hrtimer_try_to_cancel(&q->delay_timer) && ktime_to_ns(ktime_sub( hrtimer_get_expires(&q->delay_timer), expires)) > 0) hrtimer_set_expires(&q->delay_timer, expires); hrtimer_restart(&q->delay_timer); cl->delayed = 1; cl->xstats.overactions++; return; } delay = 1; } if (q->wd_expires == 0 || q->wd_expires > delay) q->wd_expires = delay; } /* TC_CBQ_OVL_LOWPRIO: penalize class by lowering its priority band */ static void cbq_ovl_lowprio(struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); cl->penalized = q->now + cl->penalty; if (cl->cpriority != cl->priority2) { cl->cpriority = cl->priority2; q->pmask |= (1<<cl->cpriority); cl->xstats.overactions++; } cbq_ovl_classic(cl); } /* TC_CBQ_OVL_DROP: penalize class by dropping */ static void cbq_ovl_drop(struct cbq_class *cl) { if (cl->q->ops->drop) if (cl->q->ops->drop(cl->q)) cl->qdisc->q.qlen--; cl->xstats.overactions++; cbq_ovl_classic(cl); } static psched_tdiff_t cbq_undelay_prio(struct cbq_sched_data *q, int prio, psched_time_t now) { struct cbq_class *cl; struct cbq_class *cl_prev = q->active[prio]; psched_time_t sched = now; if (cl_prev == NULL) return 0; do { cl = cl_prev->next_alive; if (now - cl->penalized > 0) { cl_prev->next_alive = cl->next_alive; cl->next_alive = NULL; cl->cpriority = cl->priority; cl->delayed = 0; cbq_activate_class(cl); if (cl == q->active[prio]) { q->active[prio] = cl_prev; if (cl == q->active[prio]) { q->active[prio] = NULL; return 0; } } cl = cl_prev->next_alive; } else if (sched - cl->penalized > 0) sched = cl->penalized; } while ((cl_prev = cl) != q->active[prio]); return sched - now; } static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) { struct cbq_sched_data *q = container_of(timer, struct cbq_sched_data, delay_timer); struct Qdisc *sch = q->watchdog.qdisc; psched_time_t now; psched_tdiff_t delay = 0; unsigned int pmask; now = psched_get_time(); pmask = q->pmask; q->pmask = 0; while (pmask) { int prio = ffz(~pmask); psched_tdiff_t tmp; pmask &= ~(1<<prio); tmp = cbq_undelay_prio(q, prio, now); if (tmp > 0) { q->pmask |= 1<<prio; if (tmp < delay || delay == 0) delay = tmp; } } if (delay) { ktime_t time; time = ktime_set(0, 0); time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay)); hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS); } qdisc_unthrottled(sch); __netif_schedule(qdisc_root(sch)); return HRTIMER_NORESTART; } #ifdef CONFIG_NET_CLS_ACT static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) { struct Qdisc *sch = child->__parent; struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl = q->rx_class; q->rx_class = NULL; if (cl && (cl = cbq_reclassify(skb, cl)) != NULL) { int ret; cbq_mark_toplevel(q, cl); q->rx_class = cl; cl->q->__parent = sch; ret = qdisc_enqueue(skb, cl->q); if (ret == NET_XMIT_SUCCESS) { sch->q.qlen++; if (!cl->next_alive) cbq_activate_class(cl); return 0; } if (net_xmit_drop_count(ret)) sch->qstats.drops++; return 0; } sch->qstats.drops++; return -1; } #endif /* * It is mission critical procedure. * * We "regenerate" toplevel cutoff, if transmitting class * has backlog and it is not regulated. It is not part of * original CBQ description, but looks more reasonable. * Probably, it is wrong. This question needs further investigation. */ static inline void cbq_update_toplevel(struct cbq_sched_data *q, struct cbq_class *cl, struct cbq_class *borrowed) { if (cl && q->toplevel >= borrowed->level) { if (cl->q->q.qlen > 1) { do { if (borrowed->undertime == PSCHED_PASTPERFECT) { q->toplevel = borrowed->level; return; } } while ((borrowed = borrowed->borrow) != NULL); } #if 0 /* It is not necessary now. Uncommenting it will save CPU cycles, but decrease fairness. */ q->toplevel = TC_CBQ_MAXLEVEL; #endif } } static void cbq_update(struct cbq_sched_data *q) { struct cbq_class *this = q->tx_class; struct cbq_class *cl = this; int len = q->tx_len; q->tx_class = NULL; for ( ; cl; cl = cl->share) { long avgidle = cl->avgidle; long idle; cl->bstats.packets++; cl->bstats.bytes += len; /* * (now - last) is total time between packet right edges. * (last_pktlen/rate) is "virtual" busy time, so that * * idle = (now - last) - last_pktlen/rate */ idle = q->now - cl->last; if ((unsigned long)idle > 128*1024*1024) { avgidle = cl->maxidle; } else { idle -= L2T(cl, len); /* true_avgidle := (1-W)*true_avgidle + W*idle, * where W=2^{-ewma_log}. But cl->avgidle is scaled: * cl->avgidle == true_avgidle/W, * hence: */ avgidle += idle - (avgidle>>cl->ewma_log); } if (avgidle <= 0) { /* Overlimit or at-limit */ if (avgidle < cl->minidle) avgidle = cl->minidle; cl->avgidle = avgidle; /* Calculate expected time, when this class * will be allowed to send. * It will occur, when: * (1-W)*true_avgidle + W*delay = 0, i.e. * idle = (1/W - 1)*(-true_avgidle) * or * idle = (1 - W)*(-cl->avgidle); */ idle = (-avgidle) - ((-avgidle) >> cl->ewma_log); /* * That is not all. * To maintain the rate allocated to the class, * we add to undertime virtual clock, * necessary to complete transmitted packet. * (len/phys_bandwidth has been already passed * to the moment of cbq_update) */ idle -= L2T(&q->link, len); idle += L2T(cl, len); cl->undertime = q->now + idle; } else { /* Underlimit */ cl->undertime = PSCHED_PASTPERFECT; if (avgidle > cl->maxidle) cl->avgidle = cl->maxidle; else cl->avgidle = avgidle; } cl->last = q->now; } cbq_update_toplevel(q, this, q->tx_borrowed); } static inline struct cbq_class * cbq_under_limit(struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); struct cbq_class *this_cl = cl; if (cl->tparent == NULL) return cl; if (cl->undertime == PSCHED_PASTPERFECT || q->now >= cl->undertime) { cl->delayed = 0; return cl; } do { /* It is very suspicious place. Now overlimit * action is generated for not bounded classes * only if link is completely congested. * Though it is in agree with ancestor-only paradigm, * it looks very stupid. Particularly, * it means that this chunk of code will either * never be called or result in strong amplification * of burstiness. Dangerous, silly, and, however, * no another solution exists. */ cl = cl->borrow; if (!cl) { this_cl->qstats.overlimits++; this_cl->overlimit(this_cl); return NULL; } if (cl->level > q->toplevel) return NULL; } while (cl->undertime != PSCHED_PASTPERFECT && q->now < cl->undertime); cl->delayed = 0; return cl; } static inline struct sk_buff * cbq_dequeue_prio(struct Qdisc *sch, int prio) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl_tail, *cl_prev, *cl; struct sk_buff *skb; int deficit; cl_tail = cl_prev = q->active[prio]; cl = cl_prev->next_alive; do { deficit = 0; /* Start round */ do { struct cbq_class *borrow = cl; if (cl->q->q.qlen && (borrow = cbq_under_limit(cl)) == NULL) goto skip_class; if (cl->deficit <= 0) { /* Class exhausted its allotment per * this round. Switch to the next one. */ deficit = 1; cl->deficit += cl->quantum; goto next_class; } skb = cl->q->dequeue(cl->q); /* Class did not give us any skb :-( * It could occur even if cl->q->q.qlen != 0 * f.e. if cl->q == "tbf" */ if (skb == NULL) goto skip_class; cl->deficit -= qdisc_pkt_len(skb); q->tx_class = cl; q->tx_borrowed = borrow; if (borrow != cl) { #ifndef CBQ_XSTATS_BORROWS_BYTES borrow->xstats.borrows++; cl->xstats.borrows++; #else borrow->xstats.borrows += qdisc_pkt_len(skb); cl->xstats.borrows += qdisc_pkt_len(skb); #endif } q->tx_len = qdisc_pkt_len(skb); if (cl->deficit <= 0) { q->active[prio] = cl; cl = cl->next_alive; cl->deficit += cl->quantum; } return skb; skip_class: if (cl->q->q.qlen == 0 || prio != cl->cpriority) { /* Class is empty or penalized. * Unlink it from active chain. */ cl_prev->next_alive = cl->next_alive; cl->next_alive = NULL; /* Did cl_tail point to it? */ if (cl == cl_tail) { /* Repair it! */ cl_tail = cl_prev; /* Was it the last class in this band? */ if (cl == cl_tail) { /* Kill the band! */ q->active[prio] = NULL; q->activemask &= ~(1<<prio); if (cl->q->q.qlen) cbq_activate_class(cl); return NULL; } q->active[prio] = cl_tail; } if (cl->q->q.qlen) cbq_activate_class(cl); cl = cl_prev; } next_class: cl_prev = cl; cl = cl->next_alive; } while (cl_prev != cl_tail); } while (deficit); q->active[prio] = cl_prev; return NULL; } static inline struct sk_buff * cbq_dequeue_1(struct Qdisc *sch) { struct cbq_sched_data *q = qdisc_priv(sch); struct sk_buff *skb; unsigned int activemask; activemask = q->activemask & 0xFF; while (activemask) { int prio = ffz(~activemask); activemask &= ~(1<<prio); skb = cbq_dequeue_prio(sch, prio); if (skb) return skb; } return NULL; } static struct sk_buff * cbq_dequeue(struct Qdisc *sch) { struct sk_buff *skb; struct cbq_sched_data *q = qdisc_priv(sch); psched_time_t now; psched_tdiff_t incr; now = psched_get_time(); incr = now - q->now_rt; if (q->tx_class) { psched_tdiff_t incr2; /* Time integrator. We calculate EOS time * by adding expected packet transmission time. * If real time is greater, we warp artificial clock, * so that: * * cbq_time = max(real_time, work); */ incr2 = L2T(&q->link, q->tx_len); q->now += incr2; cbq_update(q); if ((incr -= incr2) < 0) incr = 0; q->now += incr; } else { if (now > q->now) q->now = now; } q->now_rt = now; for (;;) { q->wd_expires = 0; skb = cbq_dequeue_1(sch); if (skb) { qdisc_bstats_update(sch, skb); sch->q.qlen--; qdisc_unthrottled(sch); return skb; } /* All the classes are overlimit. * * It is possible, if: * * 1. Scheduler is empty. * 2. Toplevel cutoff inhibited borrowing. * 3. Root class is overlimit. * * Reset 2d and 3d conditions and retry. * * Note, that NS and cbq-2.0 are buggy, peeking * an arbitrary class is appropriate for ancestor-only * sharing, but not for toplevel algorithm. * * Our version is better, but slower, because it requires * two passes, but it is unavoidable with top-level sharing. */ if (q->toplevel == TC_CBQ_MAXLEVEL && q->link.undertime == PSCHED_PASTPERFECT) break; q->toplevel = TC_CBQ_MAXLEVEL; q->link.undertime = PSCHED_PASTPERFECT; } /* No packets in scheduler or nobody wants to give them to us :-( * Sigh... start watchdog timer in the last case. */ if (sch->q.qlen) { sch->qstats.overlimits++; if (q->wd_expires) qdisc_watchdog_schedule(&q->watchdog, now + q->wd_expires); } return NULL; } /* CBQ class maintanance routines */ static void cbq_adjust_levels(struct cbq_class *this) { if (this == NULL) return; do { int level = 0; struct cbq_class *cl; cl = this->children; if (cl) { do { if (cl->level > level) level = cl->level; } while ((cl = cl->sibling) != this->children); } this->level = level + 1; } while ((this = this->tparent) != NULL); } static void cbq_normalize_quanta(struct cbq_sched_data *q, int prio) { struct cbq_class *cl; struct hlist_node *n; unsigned int h; if (q->quanta[prio] == 0) return; for (h = 0; h < q->clhash.hashsize; h++) { hlist_for_each_entry(cl, n, &q->clhash.hash[h], common.hnode) { /* BUGGGG... Beware! This expression suffer of * arithmetic overflows! */ if (cl->priority == prio) { cl->quantum = (cl->weight*cl->allot*q->nclasses[prio])/ q->quanta[prio]; } if (cl->quantum <= 0 || cl->quantum>32*qdisc_dev(cl->qdisc)->mtu) { pr_warning("CBQ: class %08x has bad quantum==%ld, repaired.\n", cl->common.classid, cl->quantum); cl->quantum = qdisc_dev(cl->qdisc)->mtu/2 + 1; } } } } static void cbq_sync_defmap(struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); struct cbq_class *split = cl->split; unsigned int h; int i; if (split == NULL) return; for (i = 0; i <= TC_PRIO_MAX; i++) { if (split->defaults[i] == cl && !(cl->defmap & (1<<i))) split->defaults[i] = NULL; } for (i = 0; i <= TC_PRIO_MAX; i++) { int level = split->level; if (split->defaults[i]) continue; for (h = 0; h < q->clhash.hashsize; h++) { struct hlist_node *n; struct cbq_class *c; hlist_for_each_entry(c, n, &q->clhash.hash[h], common.hnode) { if (c->split == split && c->level < level && c->defmap & (1<<i)) { split->defaults[i] = c; level = c->level; } } } } } static void cbq_change_defmap(struct cbq_class *cl, u32 splitid, u32 def, u32 mask) { struct cbq_class *split = NULL; if (splitid == 0) { split = cl->split; if (!split) return; splitid = split->common.classid; } if (split == NULL || split->common.classid != splitid) { for (split = cl->tparent; split; split = split->tparent) if (split->common.classid == splitid) break; } if (split == NULL) return; if (cl->split != split) { cl->defmap = 0; cbq_sync_defmap(cl); cl->split = split; cl->defmap = def & mask; } else cl->defmap = (cl->defmap & ~mask) | (def & mask); cbq_sync_defmap(cl); } static void cbq_unlink_class(struct cbq_class *this) { struct cbq_class *cl, **clp; struct cbq_sched_data *q = qdisc_priv(this->qdisc); qdisc_class_hash_remove(&q->clhash, &this->common); if (this->tparent) { clp = &this->sibling; cl = *clp; do { if (cl == this) { *clp = cl->sibling; break; } clp = &cl->sibling; } while ((cl = *clp) != this->sibling); if (this->tparent->children == this) { this->tparent->children = this->sibling; if (this->sibling == this) this->tparent->children = NULL; } } else { WARN_ON(this->sibling != this); } } static void cbq_link_class(struct cbq_class *this) { struct cbq_sched_data *q = qdisc_priv(this->qdisc); struct cbq_class *parent = this->tparent; this->sibling = this; qdisc_class_hash_insert(&q->clhash, &this->common); if (parent == NULL) return; if (parent->children == NULL) { parent->children = this; } else { this->sibling = parent->children->sibling; parent->children->sibling = this; } } static unsigned int cbq_drop(struct Qdisc *sch) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl, *cl_head; int prio; unsigned int len; for (prio = TC_CBQ_MAXPRIO; prio >= 0; prio--) { cl_head = q->active[prio]; if (!cl_head) continue; cl = cl_head; do { if (cl->q->ops->drop && (len = cl->q->ops->drop(cl->q))) { sch->q.qlen--; if (!cl->q->q.qlen) cbq_deactivate_class(cl); return len; } } while ((cl = cl->next_alive) != cl_head); } return 0; } static void cbq_reset(struct Qdisc *sch) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl; struct hlist_node *n; int prio; unsigned int h; q->activemask = 0; q->pmask = 0; q->tx_class = NULL; q->tx_borrowed = NULL; qdisc_watchdog_cancel(&q->watchdog); hrtimer_cancel(&q->delay_timer); q->toplevel = TC_CBQ_MAXLEVEL; q->now = psched_get_time(); q->now_rt = q->now; for (prio = 0; prio <= TC_CBQ_MAXPRIO; prio++) q->active[prio] = NULL; for (h = 0; h < q->clhash.hashsize; h++) { hlist_for_each_entry(cl, n, &q->clhash.hash[h], common.hnode) { qdisc_reset(cl->q); cl->next_alive = NULL; cl->undertime = PSCHED_PASTPERFECT; cl->avgidle = cl->maxidle; cl->deficit = cl->quantum; cl->cpriority = cl->priority; } } sch->q.qlen = 0; } static int cbq_set_lss(struct cbq_class *cl, struct tc_cbq_lssopt *lss) { if (lss->change & TCF_CBQ_LSS_FLAGS) { cl->share = (lss->flags & TCF_CBQ_LSS_ISOLATED) ? NULL : cl->tparent; cl->borrow = (lss->flags & TCF_CBQ_LSS_BOUNDED) ? NULL : cl->tparent; } if (lss->change & TCF_CBQ_LSS_EWMA) cl->ewma_log = lss->ewma_log; if (lss->change & TCF_CBQ_LSS_AVPKT) cl->avpkt = lss->avpkt; if (lss->change & TCF_CBQ_LSS_MINIDLE) cl->minidle = -(long)lss->minidle; if (lss->change & TCF_CBQ_LSS_MAXIDLE) { cl->maxidle = lss->maxidle; cl->avgidle = lss->maxidle; } if (lss->change & TCF_CBQ_LSS_OFFTIME) cl->offtime = lss->offtime; return 0; } static void cbq_rmprio(struct cbq_sched_data *q, struct cbq_class *cl) { q->nclasses[cl->priority]--; q->quanta[cl->priority] -= cl->weight; cbq_normalize_quanta(q, cl->priority); } static void cbq_addprio(struct cbq_sched_data *q, struct cbq_class *cl) { q->nclasses[cl->priority]++; q->quanta[cl->priority] += cl->weight; cbq_normalize_quanta(q, cl->priority); } static int cbq_set_wrr(struct cbq_class *cl, struct tc_cbq_wrropt *wrr) { struct cbq_sched_data *q = qdisc_priv(cl->qdisc); if (wrr->allot) cl->allot = wrr->allot; if (wrr->weight) cl->weight = wrr->weight; if (wrr->priority) { cl->priority = wrr->priority - 1; cl->cpriority = cl->priority; if (cl->priority >= cl->priority2) cl->priority2 = TC_CBQ_MAXPRIO - 1; } cbq_addprio(q, cl); return 0; } static int cbq_set_overlimit(struct cbq_class *cl, struct tc_cbq_ovl *ovl) { switch (ovl->strategy) { case TC_CBQ_OVL_CLASSIC: cl->overlimit = cbq_ovl_classic; break; case TC_CBQ_OVL_DELAY: cl->overlimit = cbq_ovl_delay; break; case TC_CBQ_OVL_LOWPRIO: if (ovl->priority2 - 1 >= TC_CBQ_MAXPRIO || ovl->priority2 - 1 <= cl->priority) return -EINVAL; cl->priority2 = ovl->priority2 - 1; cl->overlimit = cbq_ovl_lowprio; break; case TC_CBQ_OVL_DROP: cl->overlimit = cbq_ovl_drop; break; case TC_CBQ_OVL_RCLASSIC: cl->overlimit = cbq_ovl_rclassic; break; default: return -EINVAL; } cl->penalty = ovl->penalty; return 0; } #ifdef CONFIG_NET_CLS_ACT static int cbq_set_police(struct cbq_class *cl, struct tc_cbq_police *p) { cl->police = p->police; if (cl->q->handle) { if (p->police == TC_POLICE_RECLASSIFY) cl->q->reshape_fail = cbq_reshape_fail; else cl->q->reshape_fail = NULL; } return 0; } #endif static int cbq_set_fopt(struct cbq_class *cl, struct tc_cbq_fopt *fopt) { cbq_change_defmap(cl, fopt->split, fopt->defmap, fopt->defchange); return 0; } static const struct nla_policy cbq_policy[TCA_CBQ_MAX + 1] = { [TCA_CBQ_LSSOPT] = { .len = sizeof(struct tc_cbq_lssopt) }, [TCA_CBQ_WRROPT] = { .len = sizeof(struct tc_cbq_wrropt) }, [TCA_CBQ_FOPT] = { .len = sizeof(struct tc_cbq_fopt) }, [TCA_CBQ_OVL_STRATEGY] = { .len = sizeof(struct tc_cbq_ovl) }, [TCA_CBQ_RATE] = { .len = sizeof(struct tc_ratespec) }, [TCA_CBQ_RTAB] = { .type = NLA_BINARY, .len = TC_RTAB_SIZE }, [TCA_CBQ_POLICE] = { .len = sizeof(struct tc_cbq_police) }, }; static int cbq_init(struct Qdisc *sch, struct nlattr *opt) { struct cbq_sched_data *q = qdisc_priv(sch); struct nlattr *tb[TCA_CBQ_MAX + 1]; struct tc_ratespec *r; int err; err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy); if (err < 0) return err; if (tb[TCA_CBQ_RTAB] == NULL || tb[TCA_CBQ_RATE] == NULL) return -EINVAL; r = nla_data(tb[TCA_CBQ_RATE]); if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL) return -EINVAL; err = qdisc_class_hash_init(&q->clhash); if (err < 0) goto put_rtab; q->link.refcnt = 1; q->link.sibling = &q->link; q->link.common.classid = sch->handle; q->link.qdisc = sch; q->link.q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, sch->handle); if (!q->link.q) q->link.q = &noop_qdisc; q->link.priority = TC_CBQ_MAXPRIO - 1; q->link.priority2 = TC_CBQ_MAXPRIO - 1; q->link.cpriority = TC_CBQ_MAXPRIO - 1; q->link.ovl_strategy = TC_CBQ_OVL_CLASSIC; q->link.overlimit = cbq_ovl_classic; q->link.allot = psched_mtu(qdisc_dev(sch)); q->link.quantum = q->link.allot; q->link.weight = q->link.R_tab->rate.rate; q->link.ewma_log = TC_CBQ_DEF_EWMA; q->link.avpkt = q->link.allot/2; q->link.minidle = -0x7FFFFFFF; qdisc_watchdog_init(&q->watchdog, sch); hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); q->delay_timer.function = cbq_undelay; q->toplevel = TC_CBQ_MAXLEVEL; q->now = psched_get_time(); q->now_rt = q->now; cbq_link_class(&q->link); if (tb[TCA_CBQ_LSSOPT]) cbq_set_lss(&q->link, nla_data(tb[TCA_CBQ_LSSOPT])); cbq_addprio(q, &q->link); return 0; put_rtab: qdisc_put_rtab(q->link.R_tab); return err; } static int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl) { unsigned char *b = skb_tail_pointer(skb); if (nla_put(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate)) goto nla_put_failure; return skb->len; nla_put_failure: nlmsg_trim(skb, b); return -1; } static int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl) { unsigned char *b = skb_tail_pointer(skb); struct tc_cbq_lssopt opt; opt.flags = 0; if (cl->borrow == NULL) opt.flags |= TCF_CBQ_LSS_BOUNDED; if (cl->share == NULL) opt.flags |= TCF_CBQ_LSS_ISOLATED; opt.ewma_log = cl->ewma_log; opt.level = cl->level; opt.avpkt = cl->avpkt; opt.maxidle = cl->maxidle; opt.minidle = (u32)(-cl->minidle); opt.offtime = cl->offtime; opt.change = ~0; if (nla_put(skb, TCA_CBQ_LSSOPT, sizeof(opt), &opt)) goto nla_put_failure; return skb->len; nla_put_failure: nlmsg_trim(skb, b); return -1; } static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) { unsigned char *b = skb_tail_pointer(skb); struct tc_cbq_wrropt opt; opt.flags = 0; opt.allot = cl->allot; opt.priority = cl->priority + 1; opt.cpriority = cl->cpriority + 1; opt.weight = cl->weight; if (nla_put(skb, TCA_CBQ_WRROPT, sizeof(opt), &opt)) goto nla_put_failure; return skb->len; nla_put_failure: nlmsg_trim(skb, b); return -1; } static int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl) { unsigned char *b = skb_tail_pointer(skb); struct tc_cbq_ovl opt; opt.strategy = cl->ovl_strategy; opt.priority2 = cl->priority2 + 1; opt.pad = 0; opt.penalty = cl->penalty; if (nla_put(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt)) goto nla_put_failure; return skb->len; nla_put_failure: nlmsg_trim(skb, b); return -1; } static int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl) { unsigned char *b = skb_tail_pointer(skb); struct tc_cbq_fopt opt; if (cl->split || cl->defmap) { opt.split = cl->split ? cl->split->common.classid : 0; opt.defmap = cl->defmap; opt.defchange = ~0; if (nla_put(skb, TCA_CBQ_FOPT, sizeof(opt), &opt)) goto nla_put_failure; } return skb->len; nla_put_failure: nlmsg_trim(skb, b); return -1; } #ifdef CONFIG_NET_CLS_ACT static int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) { unsigned char *b = skb_tail_pointer(skb); struct tc_cbq_police opt; if (cl->police) { opt.police = cl->police; opt.__res1 = 0; opt.__res2 = 0; if (nla_put(skb, TCA_CBQ_POLICE, sizeof(opt), &opt)) goto nla_put_failure; } return skb->len; nla_put_failure: nlmsg_trim(skb, b); return -1; } #endif static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl) { if (cbq_dump_lss(skb, cl) < 0 || cbq_dump_rate(skb, cl) < 0 || cbq_dump_wrr(skb, cl) < 0 || cbq_dump_ovl(skb, cl) < 0 || #ifdef CONFIG_NET_CLS_ACT cbq_dump_police(skb, cl) < 0 || #endif cbq_dump_fopt(skb, cl) < 0) return -1; return 0; } static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb) { struct cbq_sched_data *q = qdisc_priv(sch); struct nlattr *nest; nest = nla_nest_start(skb, TCA_OPTIONS); if (nest == NULL) goto nla_put_failure; if (cbq_dump_attr(skb, &q->link) < 0) goto nla_put_failure; nla_nest_end(skb, nest); return skb->len; nla_put_failure: nla_nest_cancel(skb, nest); return -1; } static int cbq_dump_stats(struct Qdisc *sch, struct gnet_dump *d) { struct cbq_sched_data *q = qdisc_priv(sch); q->link.xstats.avgidle = q->link.avgidle; return gnet_stats_copy_app(d, &q->link.xstats, sizeof(q->link.xstats)); } static int cbq_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, struct tcmsg *tcm) { struct cbq_class *cl = (struct cbq_class *)arg; struct nlattr *nest; if (cl->tparent) tcm->tcm_parent = cl->tparent->common.classid; else tcm->tcm_parent = TC_H_ROOT; tcm->tcm_handle = cl->common.classid; tcm->tcm_info = cl->q->handle; nest = nla_nest_start(skb, TCA_OPTIONS); if (nest == NULL) goto nla_put_failure; if (cbq_dump_attr(skb, cl) < 0) goto nla_put_failure; nla_nest_end(skb, nest); return skb->len; nla_put_failure: nla_nest_cancel(skb, nest); return -1; } static int cbq_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl = (struct cbq_class *)arg; cl->qstats.qlen = cl->q->q.qlen; cl->xstats.avgidle = cl->avgidle; cl->xstats.undertime = 0; if (cl->undertime != PSCHED_PASTPERFECT) cl->xstats.undertime = cl->undertime - q->now; if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 || gnet_stats_copy_queue(d, &cl->qstats) < 0) return -1; return gnet_stats_copy_app(d, &cl->xstats, sizeof(cl->xstats)); } static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, struct Qdisc **old) { struct cbq_class *cl = (struct cbq_class *)arg; if (new == NULL) { new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, cl->common.classid); if (new == NULL) return -ENOBUFS; } else { #ifdef CONFIG_NET_CLS_ACT if (cl->police == TC_POLICE_RECLASSIFY) new->reshape_fail = cbq_reshape_fail; #endif } sch_tree_lock(sch); *old = cl->q; cl->q = new; qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); qdisc_reset(*old); sch_tree_unlock(sch); return 0; } static struct Qdisc *cbq_leaf(struct Qdisc *sch, unsigned long arg) { struct cbq_class *cl = (struct cbq_class *)arg; return cl->q; } static void cbq_qlen_notify(struct Qdisc *sch, unsigned long arg) { struct cbq_class *cl = (struct cbq_class *)arg; if (cl->q->q.qlen == 0) cbq_deactivate_class(cl); } static unsigned long cbq_get(struct Qdisc *sch, u32 classid) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl = cbq_class_lookup(q, classid); if (cl) { cl->refcnt++; return (unsigned long)cl; } return 0; } static void cbq_destroy_class(struct Qdisc *sch, struct cbq_class *cl) { struct cbq_sched_data *q = qdisc_priv(sch); WARN_ON(cl->filters); tcf_destroy_chain(&cl->filter_list); qdisc_destroy(cl->q); qdisc_put_rtab(cl->R_tab); gen_kill_estimator(&cl->bstats, &cl->rate_est); if (cl != &q->link) kfree(cl); } static void cbq_destroy(struct Qdisc *sch) { struct cbq_sched_data *q = qdisc_priv(sch); struct hlist_node *n, *next; struct cbq_class *cl; unsigned int h; #ifdef CONFIG_NET_CLS_ACT q->rx_class = NULL; #endif /* * Filters must be destroyed first because we don't destroy the * classes from root to leafs which means that filters can still * be bound to classes which have been destroyed already. --TGR '04 */ for (h = 0; h < q->clhash.hashsize; h++) { hlist_for_each_entry(cl, n, &q->clhash.hash[h], common.hnode) tcf_destroy_chain(&cl->filter_list); } for (h = 0; h < q->clhash.hashsize; h++) { hlist_for_each_entry_safe(cl, n, next, &q->clhash.hash[h], common.hnode) cbq_destroy_class(sch, cl); } qdisc_class_hash_destroy(&q->clhash); } static void cbq_put(struct Qdisc *sch, unsigned long arg) { struct cbq_class *cl = (struct cbq_class *)arg; if (--cl->refcnt == 0) { #ifdef CONFIG_NET_CLS_ACT spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); struct cbq_sched_data *q = qdisc_priv(sch); spin_lock_bh(root_lock); if (q->rx_class == cl) q->rx_class = NULL; spin_unlock_bh(root_lock); #endif cbq_destroy_class(sch, cl); } } static int cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **tca, unsigned long *arg) { int err; struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl = (struct cbq_class *)*arg; struct nlattr *opt = tca[TCA_OPTIONS]; struct nlattr *tb[TCA_CBQ_MAX + 1]; struct cbq_class *parent; struct qdisc_rate_table *rtab = NULL; if (opt == NULL) return -EINVAL; err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy); if (err < 0) return err; if (cl) { /* Check parent */ if (parentid) { if (cl->tparent && cl->tparent->common.classid != parentid) return -EINVAL; if (!cl->tparent && parentid != TC_H_ROOT) return -EINVAL; } if (tb[TCA_CBQ_RATE]) { rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]), tb[TCA_CBQ_RTAB]); if (rtab == NULL) return -EINVAL; } if (tca[TCA_RATE]) { err = gen_replace_estimator(&cl->bstats, &cl->rate_est, qdisc_root_sleeping_lock(sch), tca[TCA_RATE]); if (err) { if (rtab) qdisc_put_rtab(rtab); return err; } } /* Change class parameters */ sch_tree_lock(sch); if (cl->next_alive != NULL) cbq_deactivate_class(cl); if (rtab) { qdisc_put_rtab(cl->R_tab); cl->R_tab = rtab; } if (tb[TCA_CBQ_LSSOPT]) cbq_set_lss(cl, nla_data(tb[TCA_CBQ_LSSOPT])); if (tb[TCA_CBQ_WRROPT]) { cbq_rmprio(q, cl); cbq_set_wrr(cl, nla_data(tb[TCA_CBQ_WRROPT])); } if (tb[TCA_CBQ_OVL_STRATEGY]) cbq_set_overlimit(cl, nla_data(tb[TCA_CBQ_OVL_STRATEGY])); #ifdef CONFIG_NET_CLS_ACT if (tb[TCA_CBQ_POLICE]) cbq_set_police(cl, nla_data(tb[TCA_CBQ_POLICE])); #endif if (tb[TCA_CBQ_FOPT]) cbq_set_fopt(cl, nla_data(tb[TCA_CBQ_FOPT])); if (cl->q->q.qlen) cbq_activate_class(cl); sch_tree_unlock(sch); return 0; } if (parentid == TC_H_ROOT) return -EINVAL; if (tb[TCA_CBQ_WRROPT] == NULL || tb[TCA_CBQ_RATE] == NULL || tb[TCA_CBQ_LSSOPT] == NULL) return -EINVAL; rtab = qdisc_get_rtab(nla_data(tb[TCA_CBQ_RATE]), tb[TCA_CBQ_RTAB]); if (rtab == NULL) return -EINVAL; if (classid) { err = -EINVAL; if (TC_H_MAJ(classid ^ sch->handle) || cbq_class_lookup(q, classid)) goto failure; } else { int i; classid = TC_H_MAKE(sch->handle, 0x8000); for (i = 0; i < 0x8000; i++) { if (++q->hgenerator >= 0x8000) q->hgenerator = 1; if (cbq_class_lookup(q, classid|q->hgenerator) == NULL) break; } err = -ENOSR; if (i >= 0x8000) goto failure; classid = classid|q->hgenerator; } parent = &q->link; if (parentid) { parent = cbq_class_lookup(q, parentid); err = -EINVAL; if (parent == NULL) goto failure; } err = -ENOBUFS; cl = kzalloc(sizeof(*cl), GFP_KERNEL); if (cl == NULL) goto failure; if (tca[TCA_RATE]) { err = gen_new_estimator(&cl->bstats, &cl->rate_est, qdisc_root_sleeping_lock(sch), tca[TCA_RATE]); if (err) { kfree(cl); goto failure; } } cl->R_tab = rtab; rtab = NULL; cl->refcnt = 1; cl->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, classid); if (!cl->q) cl->q = &noop_qdisc; cl->common.classid = classid; cl->tparent = parent; cl->qdisc = sch; cl->allot = parent->allot; cl->quantum = cl->allot; cl->weight = cl->R_tab->rate.rate; sch_tree_lock(sch); cbq_link_class(cl); cl->borrow = cl->tparent; if (cl->tparent != &q->link) cl->share = cl->tparent; cbq_adjust_levels(parent); cl->minidle = -0x7FFFFFFF; cbq_set_lss(cl, nla_data(tb[TCA_CBQ_LSSOPT])); cbq_set_wrr(cl, nla_data(tb[TCA_CBQ_WRROPT])); if (cl->ewma_log == 0) cl->ewma_log = q->link.ewma_log; if (cl->maxidle == 0) cl->maxidle = q->link.maxidle; if (cl->avpkt == 0) cl->avpkt = q->link.avpkt; cl->overlimit = cbq_ovl_classic; if (tb[TCA_CBQ_OVL_STRATEGY]) cbq_set_overlimit(cl, nla_data(tb[TCA_CBQ_OVL_STRATEGY])); #ifdef CONFIG_NET_CLS_ACT if (tb[TCA_CBQ_POLICE]) cbq_set_police(cl, nla_data(tb[TCA_CBQ_POLICE])); #endif if (tb[TCA_CBQ_FOPT]) cbq_set_fopt(cl, nla_data(tb[TCA_CBQ_FOPT])); sch_tree_unlock(sch); qdisc_class_hash_grow(sch, &q->clhash); *arg = (unsigned long)cl; return 0; failure: qdisc_put_rtab(rtab); return err; } static int cbq_delete(struct Qdisc *sch, unsigned long arg) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl = (struct cbq_class *)arg; unsigned int qlen; if (cl->filters || cl->children || cl == &q->link) return -EBUSY; sch_tree_lock(sch); qlen = cl->q->q.qlen; qdisc_reset(cl->q); qdisc_tree_decrease_qlen(cl->q, qlen); if (cl->next_alive) cbq_deactivate_class(cl); if (q->tx_borrowed == cl) q->tx_borrowed = q->tx_class; if (q->tx_class == cl) { q->tx_class = NULL; q->tx_borrowed = NULL; } #ifdef CONFIG_NET_CLS_ACT if (q->rx_class == cl) q->rx_class = NULL; #endif cbq_unlink_class(cl); cbq_adjust_levels(cl->tparent); cl->defmap = 0; cbq_sync_defmap(cl); cbq_rmprio(q, cl); sch_tree_unlock(sch); BUG_ON(--cl->refcnt == 0); /* * This shouldn't happen: we "hold" one cops->get() when called * from tc_ctl_tclass; the destroy method is done from cops->put(). */ return 0; } static struct tcf_proto **cbq_find_tcf(struct Qdisc *sch, unsigned long arg) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl = (struct cbq_class *)arg; if (cl == NULL) cl = &q->link; return &cl->filter_list; } static unsigned long cbq_bind_filter(struct Qdisc *sch, unsigned long parent, u32 classid) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *p = (struct cbq_class *)parent; struct cbq_class *cl = cbq_class_lookup(q, classid); if (cl) { if (p && p->level <= cl->level) return 0; cl->filters++; return (unsigned long)cl; } return 0; } static void cbq_unbind_filter(struct Qdisc *sch, unsigned long arg) { struct cbq_class *cl = (struct cbq_class *)arg; cl->filters--; } static void cbq_walk(struct Qdisc *sch, struct qdisc_walker *arg) { struct cbq_sched_data *q = qdisc_priv(sch); struct cbq_class *cl; struct hlist_node *n; unsigned int h; if (arg->stop) return; for (h = 0; h < q->clhash.hashsize; h++) { hlist_for_each_entry(cl, n, &q->clhash.hash[h], common.hnode) { if (arg->count < arg->skip) { arg->count++; continue; } if (arg->fn(sch, (unsigned long)cl, arg) < 0) { arg->stop = 1; return; } arg->count++; } } } static const struct Qdisc_class_ops cbq_class_ops = { .graft = cbq_graft, .leaf = cbq_leaf, .qlen_notify = cbq_qlen_notify, .get = cbq_get, .put = cbq_put, .change = cbq_change_class, .delete = cbq_delete, .walk = cbq_walk, .tcf_chain = cbq_find_tcf, .bind_tcf = cbq_bind_filter, .unbind_tcf = cbq_unbind_filter, .dump = cbq_dump_class, .dump_stats = cbq_dump_class_stats, }; static struct Qdisc_ops cbq_qdisc_ops __read_mostly = { .next = NULL, .cl_ops = &cbq_class_ops, .id = "cbq", .priv_size = sizeof(struct cbq_sched_data), .enqueue = cbq_enqueue, .dequeue = cbq_dequeue, .peek = qdisc_peek_dequeued, .drop = cbq_drop, .init = cbq_init, .reset = cbq_reset, .destroy = cbq_destroy, .change = NULL, .dump = cbq_dump, .dump_stats = cbq_dump_stats, .owner = THIS_MODULE, }; static int __init cbq_module_init(void) { return register_qdisc(&cbq_qdisc_ops); } static void __exit cbq_module_exit(void) { unregister_qdisc(&cbq_qdisc_ops); } module_init(cbq_module_init) module_exit(cbq_module_exit) MODULE_LICENSE("GPL");
{ "content_hash": "d3fb073836c808c583cc90e3c41a23fe", "timestamp": "", "source": "github", "line_count": 2085, "max_line_length": 83, "avg_line_length": 23.4378896882494, "alnum_prop": 0.6294507653270034, "repo_name": "andrewjylee/omniplay", "id": "611d5e9c913183e0b34e2f7789170bef8615c8da", "size": "48868", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "linux-lts-quantal-3.5.0/net/sched/sch_cbq.c", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "ASP", "bytes": "4528" }, { "name": "Assembly", "bytes": "8662249" }, { "name": "Awk", "bytes": "79791" }, { "name": "Batchfile", "bytes": "903" }, { "name": "C", "bytes": "451499135" }, { "name": "C++", "bytes": "6338106" }, { "name": "Groff", "bytes": "2522798" }, { "name": "HTML", "bytes": "47935" }, { "name": "Java", "bytes": "2193" }, { "name": "Lex", "bytes": "44513" }, { "name": "Logos", "bytes": "97869" }, { "name": "Makefile", "bytes": "1700085" }, { "name": "Objective-C", "bytes": "1148023" }, { "name": "Perl", "bytes": "530370" }, { "name": "Perl6", "bytes": "3727" }, { "name": "Python", "bytes": "493452" }, { "name": "Scilab", "bytes": "21433" }, { "name": "Shell", "bytes": "409014" }, { "name": "SourcePawn", "bytes": "11760" }, { "name": "TeX", "bytes": "283872" }, { "name": "UnrealScript", "bytes": "6143" }, { "name": "XS", "bytes": "1240" }, { "name": "Yacc", "bytes": "93190" } ], "symlink_target": "" }
package org.ocpsoft.rewrite.servlet.config; import static org.junit.Assert.assertThat; import org.apache.http.client.methods.HttpGet; import org.hamcrest.Matchers; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.ocpsoft.rewrite.config.ConfigurationProvider; import org.ocpsoft.rewrite.test.HttpAction; import org.ocpsoft.rewrite.test.RewriteTest; import org.ocpsoft.rewrite.servlet.config.ConfigRoot; /** * @author <a href="mailto:[email protected]">Lincoln Baxter, III</a> */ @RunWith(Arquillian.class) public class CDNConfigurationTest extends RewriteTest { @Deployment(testable = false) public static WebArchive getDeployment() { WebArchive deployment = RewriteTest .getDeployment() .addPackages(true, ConfigRoot.class.getPackage()) .addAsServiceProvider(ConfigurationProvider.class, CDNConfigurationProvider.class); return deployment; } @Test public void testCDNRelocation() throws Exception { HttpAction<HttpGet> action = get("/relocate"); Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode()); Assert.assertTrue(action.getResponseContent().contains( "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")); Assert.assertTrue(action.getResponseContent().contains( "http://mycdn.com/foo-1.2.3.js")); } @Test public void testCDNRelocationWithSchemalessURL() throws Exception { HttpAction<HttpGet> action = get("/relocate"); Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode()); assertThat(action.getResponseContent(), Matchers.containsString( "[//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js]")); } }
{ "content_hash": "c3558f4b0b4196b6ec4e75c1ee62b044", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 98, "avg_line_length": 33.54237288135593, "alnum_prop": 0.7261243052046488, "repo_name": "ocpsoft/rewrite", "id": "d2b08fe25487fdbd48f10bfde1a99311ee530dde", "size": "2626", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "config-servlet/src/test/java/org/ocpsoft/rewrite/servlet/config/CDNConfigurationTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "6794" }, { "name": "HTML", "bytes": "59894" }, { "name": "Java", "bytes": "2721796" }, { "name": "JavaScript", "bytes": "697545" }, { "name": "Less", "bytes": "383" }, { "name": "Ruby", "bytes": "1234887" }, { "name": "SCSS", "bytes": "193" }, { "name": "Shell", "bytes": "815" } ], "symlink_target": "" }
<?php namespace Altumo\Validation; /** * This class contains functions for boolean validation. * These functions will return the sanitized data too. * * @author Steve Sperandeo <[email protected]> */ class Booleans{ /** * Determines if this is a boolean value (or can be interpreted as one) * * @param mixed $value * @param string $exception_message * //custom Exception message to throw. * If null, default message will be used. * * @return boolean //the value that it interpreted * @throw \Exception //if could not be interpreted as * boolean */ static public function assertLooseBoolean( $value, $exception_message = null ){ if( is_null( $exception_message ) ){ $exception_message = 'Could not interpret as boolean.'; } if( is_bool($value) ){ return $value; } if( is_integer($value) ){ if( $value >= 1 ){ return true; } if( $value <= 0 ){ return false; } } if( is_string($value) ){ $value = strtolower($value); switch( $value ){ case 'true': case 'on': case 'yes': case '1': case 'enable': case 'enabled': case 'active': return true; case 'false': case 'off': case 'no': case '0': case 'disabled': case 'disable': case 'deactive': return false; } } throw new \Exception( $exception_message ); } }
{ "content_hash": "648a9cc1dbc47e48783125120fea0657", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 83, "avg_line_length": 24.795454545454547, "alnum_prop": 0.38359303391384053, "repo_name": "homer6/altumo", "id": "4de49f06ed1410113a571f3797473878a470308f", "size": "2469", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "source/php/Validation/Booleans.php", "mode": "33261", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "12600" }, { "name": "PHP", "bytes": "329317" }, { "name": "Perl", "bytes": "1104" }, { "name": "Shell", "bytes": "588" } ], "symlink_target": "" }
package com.mongodb.jvm.json.nashorn; import org.bson.BsonTimestamp; import com.threecrickets.jvm.json.JsonImplementation; import com.threecrickets.jvm.json.JsonTransformer; import jdk.nashorn.internal.objects.NativeNumber; import jdk.nashorn.internal.runtime.ScriptObject; /** * Transforms a Nashorn {@link ScriptObject} with a "$timestamp" key into a * {@link BsonTimestamp}. * * @author Tal Liron */ public class BsonTimestampTransformer implements JsonTransformer { // // JsonTransformer // public Object transform( Object object, JsonImplementation implementation ) { if( object instanceof ScriptObject ) { ScriptObject scriptObject = (ScriptObject) object; Object timestamp = scriptObject.get( "$timestamp" ); if( timestamp instanceof ScriptObject ) { ScriptObject timestampScriptObject = (ScriptObject) timestamp; Object time = timestampScriptObject.get( "t" ); Object inc = timestampScriptObject.get( "i" ); if( time instanceof NativeNumber ) time = ( (NativeNumber) time ).getValue(); if( inc instanceof NativeNumber ) inc = ( (NativeNumber) inc ).getValue(); if( ( time instanceof Number ) && ( inc instanceof Number ) ) return new BsonTimestamp( ( (Number) time ).intValue(), ( (Number) inc ).intValue() ); } } return null; } }
{ "content_hash": "44f0815bbc988e5a6cdf5c51744d5ca9", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 91, "avg_line_length": 27, "alnum_prop": 0.7142857142857143, "repo_name": "tliron/mongodb-jvm", "id": "6c090a93e22d266dbdf93be611c6c670c4c7c463", "size": "1716", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "components/mongodb-jvm/source/com/mongodb/jvm/json/nashorn/BsonTimestampTransformer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "14188" }, { "name": "Java", "bytes": "152505" }, { "name": "JavaScript", "bytes": "163921" } ], "symlink_target": "" }
set -o errexit -o nounset -o xtrace export ANSIBLE_INVENTORY_PLUGINS=./ export ANSIBLE_INVENTORY_ENABLED=test_inventory # check default values ansible-inventory --list -i ./config_without_parameter.yml --export | \ env python -c "import json, sys; inv = json.loads(sys.stdin.read()); \ assert set(inv['_meta']['hostvars']['test_host']['departments']) == set(['seine-et-marne', 'haute-garonne'])" # check values ansible-inventory --list -i ./config_with_parameter.yml --export | \ env python -c "import json, sys; inv = json.loads(sys.stdin.read()); \ assert set(inv['_meta']['hostvars']['test_host']['departments']) == set(['paris'])"
{ "content_hash": "edd7c1d2292da4de13dc592f2bd537fd", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 128, "avg_line_length": 48.857142857142854, "alnum_prop": 0.6461988304093568, "repo_name": "thaim/ansible", "id": "119a073ac58abb3e668f125780dc7511e3ea0fa0", "size": "705", "binary": false, "copies": "87", "ref": "refs/heads/fix-broken-link", "path": "test/integration/targets/inventory_plugin_config/runme.sh", "mode": "33261", "license": "mit", "language": [ { "name": "Python", "bytes": "7" }, { "name": "Shell", "bytes": "246" } ], "symlink_target": "" }
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateRelationshipsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('relationships', function (Blueprint $table) { $table->increments('id'); $table->string("relation_name"); $table->integer('field_id'); $table->integer('parent_id'); $table->integer('child_id'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('relationships'); } }
{ "content_hash": "71ebf0072cf7278360f78fbc5cb3190e", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 69, "avg_line_length": 22.257142857142856, "alnum_prop": 0.5622593068035944, "repo_name": "hossamhasanin/transformer", "id": "a78d8c4cf25e82a73dbfb0c73e08017d84207009", "size": "779", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "database/migrations/2017_03_28_161038_create_relationships_table.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "553" }, { "name": "HTML", "bytes": "1997371" }, { "name": "PHP", "bytes": "138886" }, { "name": "Vue", "bytes": "12924" } ], "symlink_target": "" }
package com.github.krr.mongodb.aggregate.support.beans; import com.github.krr.mongodb.aggregate.support.nonreactive.annotations.MongoId; /** * Created by rkolliva * 1/21/17. */ public class TestBucketBean extends AbstractTestAggregateBean { @MongoId private String oid; private String make; private String model; private int count; private int year; public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public String getOid() { return oid; } public void setOid(String oid) { this.oid = oid; } }
{ "content_hash": "ef952d9d64f8daccf30abbe6b87083db", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 80, "avg_line_length": 14.703125, "alnum_prop": 0.6556854410201913, "repo_name": "krraghavan/mongodb-aggregate-query-support", "id": "039a1a26434d18abd31cd6916d86627bcc6c24fc", "size": "1580", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "mongodb-aggregate-query-support-spring4/src/test/java/com/github/krr/mongodb/aggregate/support/beans/TestBucketBean.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "856401" } ], "symlink_target": "" }
Configuration SCCM_2012 { Param( ) Import-DscResource -ModuleName xNetworking, ` PSDesiredStateConfiguration, ` xWebAdministration, cNtfsAccessControl, xCertificate $DistributionPContentLocalPath = 'E:\SCCMContentLib' $WindowsDeploymentServicesFolder = 'C:\RemoteInstall' $DistributionPContentLocalPath_2008_R2 = 'C:\SCCMContentLib' $WindowsDeploymentServicesFolder_2008_R2 = 'C:\RemoteInstall' Node DP_WIN2008_R2 { WindowsFeature IIS { Ensure="Present" Name="Web-Server" } xWebSiteDefaults SiteDefaults { ApplyTo = 'Machine' LogFormat = 'IIS' AllowSubDirConfig = 'true' DependsOn = '[WindowsFeature]IIS' } xWebAppPoolDefaults PoolDefaults { ApplyTo = 'Machine' ManagedRuntimeVersion = 'v4.0' IdentityType = 'ApplicationPoolIdentity' DependsOn = '[WindowsFeature]IIS' } # Setup the 'CM' Site xWebsite DefaultSite { Ensure = 'Present' Name = 'Default Web Site' State = 'Started' PhysicalPath = 'C:\inetpub\wwwroot' BindingInfo = MSFT_xWebBindingInformation { Protocol = 'HTTP' Port = 80 } DependsOn = '[WindowsFeature]IIS' } xFirewall DefaultSCCMSiteAccess { Direction = "Inbound" Name = "Web-Server-TCP-In" DisplayName = "Web Server (TCP-In)" Description = "IIS allow incoming web site traffic." Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "80" Ensure = "Present" DependsOn = "[xWebsite]DefaultSite" } xFirewall SMB { Direction = "Inbound" Name = "Server-Message-Block" DisplayName = "Server Message Block (SMB)" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "445" Ensure = "Present" } xFirewall RPC { Direction = "Inbound" Name = "RPC-Endpoint-Manager" DisplayName = "RPC Endpoint Manager" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "135" Ensure = "Present" } File DistributionPointContentDirectory { Ensure = 'Present' DestinationPath = $DistributionPContentLocalPath_2008_R2 Type = 'Directory' } cNtfsPermissionEntry DistributionPointContentAccess { Ensure = 'Present' Path = $DistributionPContentLocalPath_2008_R2 ItemType = 'Directory' Principal = 'BUILTIN\Administrators' AccessControlInformation = @( cNtfsAccessControlInformation { AccessControlType = 'Allow' FileSystemRights = [System.Security.AccessControl.FileSystemRights]::FullControl Inheritance = 'ThisFolderSubfoldersAndFiles' NoPropagateInherit = $false } ) DependsOn = '[File]DistributionPointContentDirectory' } File CDrive_no_sms_on_drive.sms_absent { Ensure = 'Absent' DestinationPath = 'c:\no_sms_on_drive.sms' Type = 'File' Contents = [string]::Empty } # Remote Differential Compression WindowsFeature RemoteDifferentialCompression { Name = "RDC" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_RemoteDifferentialCompression.log" } # IIS ISAPI Extensions WindowsFeature WebServerISAPIExtensions { Name = "Web-ISAPI-Ext" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_Authentication.log" } # IIS Windows Authentication WindowsFeature WebServerWindowsAuth { Name = "Web-Windows-Auth" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerWindowsAuth.log" } # IIS 6 Metabase Compatibility WindowsFeature WebServerLegacyMetabaseCompatibility { Name = "Web-Metabase" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyMetabaseCompatibility.log" } # IIS 6 WMI Compatibility WindowsFeature WebServerLegacyWMICompatibility { Name = "Web-WMI" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyWMICompatibility.log" } } Node DP_WDS_WIN2008_R2 { WindowsFeature IIS { Ensure="Present" Name="Web-Server" } xWebSiteDefaults SiteDefaults { ApplyTo = 'Machine' LogFormat = 'IIS' AllowSubDirConfig = 'true' DependsOn = '[WindowsFeature]IIS' } xWebAppPoolDefaults PoolDefaults { ApplyTo = 'Machine' ManagedRuntimeVersion = 'v4.0' IdentityType = 'ApplicationPoolIdentity' DependsOn = '[WindowsFeature]IIS' } # Setup the 'CM' Site xWebsite DefaultSite { Ensure = 'Present' Name = 'Default Web Site' State = 'Started' PhysicalPath = 'C:\inetpub\wwwroot' BindingInfo = MSFT_xWebBindingInformation { Protocol = 'HTTP' Port = 80 } DependsOn = '[WindowsFeature]IIS' } xFirewall DefaultSCCMSiteAccess { Direction = "Inbound" Name = "Web-Server-TCP-In" DisplayName = "Web Server (TCP-In)" Description = "IIS allow incoming web site traffic." Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "80" Ensure = "Present" DependsOn = "[xWebsite]DefaultSite" } xFirewall SMB { Direction = "Inbound" Name = "Server-Message-Block" DisplayName = "Server Message Block (SMB)" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "445" Ensure = "Present" } xFirewall RPC { Direction = "Inbound" Name = "RPC-Endpoint-Manager" DisplayName = "RPC Endpoint Manager" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "135" Ensure = "Present" } File DistributionPointContentDirectory { Ensure = 'Present' DestinationPath = $DistributionPContentLocalPath_2008_R2 Type = 'Directory' } cNtfsPermissionEntry DistributionPointContentAccess { Ensure = 'Present' Path = $DistributionPContentLocalPath_2008_R2 ItemType = 'Directory' Principal = 'BUILTIN\Administrators' AccessControlInformation = @( cNtfsAccessControlInformation { AccessControlType = 'Allow' FileSystemRights = [System.Security.AccessControl.FileSystemRights]::FullControl Inheritance = 'ThisFolderSubfoldersAndFiles' NoPropagateInherit = $false } ) DependsOn = '[File]DistributionPointContentDirectory' } File CDrive_no_sms_on_drive.sms_absent { Ensure = 'Absent' DestinationPath = 'c:\no_sms_on_drive.sms' Type = 'File' Contents = [string]::Empty } # Remote Differential Compression WindowsFeature RemoteDifferentialCompression { Name = "RDC" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_RemoteDifferentialCompression.log" } # Windows Deployment Services WindowsFeature WindowsDeploymentServices { Name = "WDS" Ensure = "Present" IncludeAllSubFeature = $true LogPath = "C:\Windows\debug\DSC_WindowsFeature_WindowsDeploymentServices.log" } # WDS Remote Installation Folder File WindowsDeploymentServicesFolder { DependsOn = "[WindowsFeature]WindowsDeploymentServices" DestinationPath = $WindowsDeploymentServicesFolder_2008_R2 Ensure = "Present" Type = "Directory" } # WDS Initialize Server Script WindowsDeploymentServicesInitializeServer { DependsOn = "[File]WindowsDeploymentServicesFolder" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") return ($WdsServer.SetupManager.InitialSetupComplete) } SetScript = { Start-Process -FilePath "C:\Windows\System32\wdsutil.exe" -Wait ` -ArgumentList "/Initialize-Server", "/REMINST:$WindowsDeploymentServicesFolder" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # WDS Configure PXE response delay Script WindowsDeploymentServicesConfigurePXEResponseDelay { DependsOn = "[Script]WindowsDeploymentServicesInitializeServer" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy return ($Policy.ResponseDelay -eq 1) } SetScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy $Policy.ResponseDelay = 1 $Policy.Commit() } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # IIS ISAPI Extensions WindowsFeature WebServerISAPIExtensions { Name = "Web-ISAPI-Ext" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_Authentication.log" } # IIS Windows Authentication WindowsFeature WebServerWindowsAuth { Name = "Web-Windows-Auth" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerWindowsAuth.log" } # IIS 6 Metabase Compatibility WindowsFeature WebServerLegacyMetabaseCompatibility { Name = "Web-Metabase" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyMetabaseCompatibility.log" } # IIS 6 WMI Compatibility WindowsFeature WebServerLegacyWMICompatibility { Name = "Web-WMI" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyWMICompatibility.log" } } Node DP_WDS_DHCP_WIN2008_R2 { WindowsFeature IIS { Ensure="Present" Name="Web-Server" } xWebSiteDefaults SiteDefaults { ApplyTo = 'Machine' LogFormat = 'IIS' AllowSubDirConfig = 'true' DependsOn = '[WindowsFeature]IIS' } xWebAppPoolDefaults PoolDefaults { ApplyTo = 'Machine' ManagedRuntimeVersion = 'v4.0' IdentityType = 'ApplicationPoolIdentity' DependsOn = '[WindowsFeature]IIS' } # Setup the 'CM' Site xWebsite DefaultSite { Ensure = 'Present' Name = 'Default Web Site' State = 'Started' PhysicalPath = 'C:\inetpub\wwwroot' BindingInfo = MSFT_xWebBindingInformation { Protocol = 'HTTP' Port = 80 } DependsOn = '[WindowsFeature]IIS' } xFirewall DefaultSCCMSiteAccess { Direction = "Inbound" Name = "Web-Server-TCP-In" DisplayName = "Web Server (TCP-In)" Description = "IIS allow incoming web site traffic." Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "80" Ensure = "Present" DependsOn = "[xWebsite]DefaultSite" } xFirewall SMB { Direction = "Inbound" Name = "Server-Message-Block" DisplayName = "Server Message Block (SMB)" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "445" Ensure = "Present" } xFirewall RPC { Direction = "Inbound" Name = "RPC-Endpoint-Manager" DisplayName = "RPC Endpoint Manager" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "135" Ensure = "Present" } File DistributionPointContentDirectory { Ensure = 'Present' DestinationPath = $DistributionPContentLocalPath_2008_R2 Type = 'Directory' } cNtfsPermissionEntry DistributionPointContentAccess { Ensure = 'Present' Path = $DistributionPContentLocalPath_2008_R2 ItemType = 'Directory' Principal = 'BUILTIN\Administrators' AccessControlInformation = @( cNtfsAccessControlInformation { AccessControlType = 'Allow' FileSystemRights = [System.Security.AccessControl.FileSystemRights]::FullControl Inheritance = 'ThisFolderSubfoldersAndFiles' NoPropagateInherit = $false } ) DependsOn = '[File]DistributionPointContentDirectory' } File CDrive_no_sms_on_drive.sms_absent { Ensure = 'Absent' DestinationPath = 'c:\no_sms_on_drive.sms' Type = 'File' Contents = [string]::Empty } # Remote Differential Compression WindowsFeature RemoteDifferentialCompression { Name = "RDC" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_RemoteDifferentialCompression.log" } # DHCP Server WindowsFeature DhcpServer { Name = "DHCP" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_DhcpServer.log" } # DHCP Server Tools WindowsFeature DhcpServerTools { DependsOn = "[WindowsFeature]DhcpServer" Name = "RSAT-DHCP" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_DhcpServerTools.log" } # DHCP Server Option Value - 006 DNS Server Script DhcpServerOptionValue006 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) $DNSServer = ($IPConfig.DNSServer | Where-Object AddressFamily -eq 2).ServerAddresses $Option = Get-DhcpServerv4OptionValue -OptionId 6 -ErrorAction SilentlyContinue if ($Option -ne $null) { $CompareResult = Compare-Object -ReferenceObject $DNSServer ` -DifferenceObject $Option.Value return ($CompareResult.SideIndicator -eq $null) } else { return $false } } SetScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) $DNSServer = ($IPConfig.DNSServer | Where-Object AddressFamily -eq 2).ServerAddresses Set-DhcpServerv4OptionValue -DnsServer $DNSServer } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 015 DNS Domain Name Script DhcpServerOptionValue015 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $Option = Get-DhcpServerv4OptionValue -OptionId 15 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq (Get-WmiObject -Class Win32_ComputerSystem).Domain) } else { return $false } } SetScript = { Set-DhcpServerv4OptionValue -DnsDomain (Get-WmiObject -Class Win32_ComputerSystem).Domain } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 060 PXEClient Script DhcpServerOptionValue060 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $Option = Get-DhcpServerv4OptionValue -OptionId 60 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq "PXEClient") } else { return $false } } SetScript = { Set-DhcpServerv4OptionValue -OptionId 60 -Value "PXEClient" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 066 Boot Server Host Name Script DhcpServerOptionValue066 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) $Option = Get-DhcpServerv4OptionValue -OptionId 66 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq $IPConfig.IPv4Address.IPAddress) } else { return $false } } SetScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) Set-DhcpServerv4OptionValue -OptionId 66 -Value $IPConfig.IPv4Address.IPAddress } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 067 Bootfile Name Script DhcpServerOptionValue067 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $Option = Get-DhcpServerv4OptionValue -OptionId 67 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq "SMSBoot\x64\wdsnbp.com") } else { return $false } } SetScript = { Set-DhcpServerv4OptionValue -OptionId 67 -Value "SMSBoot\x64\wdsnbp.com" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # Windows Deployment Services WindowsFeature WindowsDeploymentServices { Name = "WDS" Ensure = "Present" IncludeAllSubFeature = $true LogPath = "C:\Windows\debug\DSC_WindowsFeature_WindowsDeploymentServices.log" } # WDS Remote Installation Folder File WindowsDeploymentServicesFolder { DependsOn = "[WindowsFeature]WindowsDeploymentServices" DestinationPath = $WindowsDeploymentServicesFolder_2008_R2 Ensure = "Present" Type = "Directory" } # WDS Initialize Server Script WindowsDeploymentServicesInitializeServer { DependsOn = "[File]WindowsDeploymentServicesFolder" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") return ($WdsServer.SetupManager.InitialSetupComplete) } SetScript = { Start-Process -FilePath "C:\Windows\System32\wdsutil.exe" -Wait ` -ArgumentList "/Initialize-Server", "/REMINST:$WindowsDeploymentServicesFolder" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # WDS Configure DHCP settings Script WindowsDeploymentServicesConfigureDhcpProperties { DependsOn = "[Script]WindowsDeploymentServicesInitializeServer" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $SetupManager = $WdsServer.SetupManager return ( $SetupManager.DhcpPxeOptionPresent -eq $true ` -and $SetupManager.DhcpOperationMode -eq "2" ) } SetScript = { Start-Process -FilePath "C:\Windows\System32\wdsutil.exe" -Wait ` -ArgumentList "/Set-Server", "/UseDhcpPorts:No", "/DhcpOption60:Yes" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # WDS Configure PXE response delay Script WindowsDeploymentServicesConfigurePXEResponseDelay { DependsOn = "[Script]WindowsDeploymentServicesInitializeServer" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy return ($Policy.ResponseDelay -eq 1) } SetScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy $Policy.ResponseDelay = 1 $Policy.Commit() } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # IIS ISAPI Extensions WindowsFeature WebServerISAPIExtensions { Name = "Web-ISAPI-Ext" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_Authentication.log" } # IIS Windows Authentication WindowsFeature WebServerWindowsAuth { Name = "Web-Windows-Auth" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerWindowsAuth.log" } # IIS 6 Metabase Compatibility WindowsFeature WebServerLegacyMetabaseCompatibility { Name = "Web-Metabase" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyMetabaseCompatibility.log" } # IIS 6 WMI Compatibility WindowsFeature WebServerLegacyWMICompatibility { Name = "Web-WMI" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyWMICompatibility.log" } } Node DP_WIN2012_R2 { WindowsFeature IIS { Ensure="Present" Name="Web-Server" } xWebSiteDefaults SiteDefaults { ApplyTo = 'Machine' LogFormat = 'IIS' AllowSubDirConfig = 'true' DependsOn = '[WindowsFeature]IIS' } xWebAppPoolDefaults PoolDefaults { ApplyTo = 'Machine' ManagedRuntimeVersion = 'v4.0' IdentityType = 'ApplicationPoolIdentity' DependsOn = '[WindowsFeature]IIS' } # Setup the 'CM' Site xWebsite DefaultSite { Ensure = 'Present' Name = 'Default Web Site' State = 'Started' PhysicalPath = 'C:\inetpub\wwwroot' BindingInfo = MSFT_xWebBindingInformation { Protocol = 'HTTP' Port = 80 } DependsOn = '[WindowsFeature]IIS' } xFirewall DefaultSCCMSiteAccess { Direction = "Inbound" Name = "Web-Server-TCP-In" DisplayName = "Web Server (TCP-In)" Description = "IIS allow incoming web site traffic." Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "80" Ensure = "Present" DependsOn = "[xWebsite]DefaultSite" } xFirewall SMB { Direction = "Inbound" Name = "Server-Message-Block" DisplayName = "Server Message Block (SMB)" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "445" Ensure = "Present" } xFirewall RPC { Direction = "Inbound" Name = "RPC-Endpoint-Manager" DisplayName = "RPC Endpoint Manager" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "135" Ensure = "Present" } File DistributionPointContentDirectory { Ensure = 'Present' DestinationPath = $DistributionPContentLocalPath Type = 'Directory' } cNtfsPermissionEntry DistributionPointContentAccess { Ensure = 'Present' Path = $DistributionPContentLocalPath ItemType = 'Directory' Principal = 'BUILTIN\Administrators' AccessControlInformation = @( cNtfsAccessControlInformation { AccessControlType = 'Allow' FileSystemRights = [System.Security.AccessControl.FileSystemRights]::FullControl Inheritance = 'ThisFolderSubfoldersAndFiles' NoPropagateInherit = $false } ) DependsOn = '[File]DistributionPointContentDirectory' } File CDrive_no_sms_on_drive.sms { Ensure = 'Present' DestinationPath = 'c:\no_sms_on_drive.sms' Type = 'File' Contents = [string]::Empty } # Remote Differential Compression WindowsFeature RemoteDifferentialCompression { Name = "RDC" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_RemoteDifferentialCompression.log" } # IIS ISAPI Extensions WindowsFeature WebServerISAPIExtensions { Name = "Web-ISAPI-Ext" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_Authentication.log" } # IIS Windows Authentication WindowsFeature WebServerWindowsAuth { Name = "Web-Windows-Auth" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerWindowsAuth.log" } # IIS 6 Metabase Compatibility WindowsFeature WebServerLegacyMetabaseCompatibility { Name = "Web-Metabase" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyMetabaseCompatibility.log" } # IIS 6 WMI Compatibility WindowsFeature WebServerLegacyWMICompatibility { Name = "Web-WMI" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyWMICompatibility.log" } } Node DP_WDS_WIN2012_R2 { WindowsFeature IIS { Ensure="Present" Name="Web-Server" } xWebSiteDefaults SiteDefaults { ApplyTo = 'Machine' LogFormat = 'IIS' AllowSubDirConfig = 'true' DependsOn = '[WindowsFeature]IIS' } xWebAppPoolDefaults PoolDefaults { ApplyTo = 'Machine' ManagedRuntimeVersion = 'v4.0' IdentityType = 'ApplicationPoolIdentity' DependsOn = '[WindowsFeature]IIS' } # Setup the 'CM' Site xWebsite DefaultSite { Ensure = 'Present' Name = 'Default Web Site' State = 'Started' PhysicalPath = 'C:\inetpub\wwwroot' BindingInfo = MSFT_xWebBindingInformation { Protocol = 'HTTP' Port = 80 } DependsOn = '[WindowsFeature]IIS' } xFirewall DefaultSCCMSiteAccess { Direction = "Inbound" Name = "Web-Server-TCP-In" DisplayName = "Web Server (TCP-In)" Description = "IIS allow incoming web site traffic." Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "80" Ensure = "Present" DependsOn = "[xWebsite]DefaultSite" } xFirewall SMB { Direction = "Inbound" Name = "Server-Message-Block" DisplayName = "Server Message Block (SMB)" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "445" Ensure = "Present" } xFirewall RPC { Direction = "Inbound" Name = "RPC-Endpoint-Manager" DisplayName = "RPC Endpoint Manager" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "135" Ensure = "Present" } File DistributionPointContentDirectory { Ensure = 'Present' DestinationPath = $DistributionPContentLocalPath Type = 'Directory' } cNtfsPermissionEntry DistributionPointContentAccess { Ensure = 'Present' Path = $DistributionPContentLocalPath ItemType = 'Directory' Principal = 'BUILTIN\Administrators' AccessControlInformation = @( cNtfsAccessControlInformation { AccessControlType = 'Allow' FileSystemRights = [System.Security.AccessControl.FileSystemRights]::FullControl Inheritance = 'ThisFolderSubfoldersAndFiles' NoPropagateInherit = $false } ) DependsOn = '[File]DistributionPointContentDirectory' } File CDrive_no_sms_on_drive.sms { Ensure = 'Present' DestinationPath = 'c:\no_sms_on_drive.sms' Type = 'File' Contents = [string]::Empty } # Remote Differential Compression WindowsFeature RemoteDifferentialCompression { Name = "RDC" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_RemoteDifferentialCompression.log" } # Windows Deployment Services WindowsFeature WindowsDeploymentServices { Name = "WDS" Ensure = "Present" IncludeAllSubFeature = $true LogPath = "C:\Windows\debug\DSC_WindowsFeature_WindowsDeploymentServices.log" } # WDS Remote Installation Folder File WindowsDeploymentServicesFolder { DependsOn = "[WindowsFeature]WindowsDeploymentServices" DestinationPath = $WindowsDeploymentServicesFolder Ensure = "Present" Type = "Directory" } # WDS Initialize Server Script WindowsDeploymentServicesInitializeServer { DependsOn = "[File]WindowsDeploymentServicesFolder" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") return ($WdsServer.SetupManager.InitialSetupComplete) } SetScript = { Start-Process -FilePath "C:\Windows\System32\wdsutil.exe" -Wait ` -ArgumentList "/Initialize-Server", "/REMINST:$WindowsDeploymentServicesFolder" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # WDS Configure PXE response delay Script WindowsDeploymentServicesConfigurePXEResponseDelay { DependsOn = "[Script]WindowsDeploymentServicesInitializeServer" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy return ($Policy.ResponseDelay -eq 1) } SetScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy $Policy.ResponseDelay = 1 $Policy.Commit() } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # IIS ISAPI Extensions WindowsFeature WebServerISAPIExtensions { Name = "Web-ISAPI-Ext" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_Authentication.log" } # IIS Windows Authentication WindowsFeature WebServerWindowsAuth { Name = "Web-Windows-Auth" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerWindowsAuth.log" } # IIS 6 Metabase Compatibility WindowsFeature WebServerLegacyMetabaseCompatibility { Name = "Web-Metabase" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyMetabaseCompatibility.log" } # IIS 6 WMI Compatibility WindowsFeature WebServerLegacyWMICompatibility { Name = "Web-WMI" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyWMICompatibility.log" } } Node DP_WDS_DHCP_WIN2012_R2 { WindowsFeature IIS { Ensure="Present" Name="Web-Server" } xWebSiteDefaults SiteDefaults { ApplyTo = 'Machine' LogFormat = 'IIS' AllowSubDirConfig = 'true' DependsOn = '[WindowsFeature]IIS' } xWebAppPoolDefaults PoolDefaults { ApplyTo = 'Machine' ManagedRuntimeVersion = 'v4.0' IdentityType = 'ApplicationPoolIdentity' DependsOn = '[WindowsFeature]IIS' } # Setup the 'CM' Site xWebsite DefaultSite { Ensure = 'Present' Name = 'Default Web Site' State = 'Started' PhysicalPath = 'C:\inetpub\wwwroot' BindingInfo = MSFT_xWebBindingInformation { Protocol = 'HTTP' Port = 80 } DependsOn = '[WindowsFeature]IIS' } xFirewall DefaultSCCMSiteAccess { Direction = "Inbound" Name = "Web-Server-TCP-In" DisplayName = "Web Server (TCP-In)" Description = "IIS allow incoming web site traffic." Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "80" Ensure = "Present" DependsOn = "[xWebsite]DefaultSite" } xFirewall SMB { Direction = "Inbound" Name = "Server-Message-Block" DisplayName = "Server Message Block (SMB)" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "445" Ensure = "Present" } xFirewall RPC { Direction = "Inbound" Name = "RPC-Endpoint-Manager" DisplayName = "RPC Endpoint Manager" Action = "Allow" Enabled = "True" Protocol = "TCP" LocalPort = "135" Ensure = "Present" } File DistributionPointContentDirectory { Ensure = 'Present' DestinationPath = $DistributionPContentLocalPath Type = 'Directory' } cNtfsPermissionEntry DistributionPointContentAccess { Ensure = 'Present' Path = $DistributionPContentLocalPath ItemType = 'Directory' Principal = 'BUILTIN\Administrators' AccessControlInformation = @( cNtfsAccessControlInformation { AccessControlType = 'Allow' FileSystemRights = [System.Security.AccessControl.FileSystemRights]::FullControl Inheritance = 'ThisFolderSubfoldersAndFiles' NoPropagateInherit = $false } ) DependsOn = '[File]DistributionPointContentDirectory' } File CDrive_no_sms_on_drive.sms { Ensure = 'Present' DestinationPath = 'c:\no_sms_on_drive.sms' Type = 'File' Contents = [string]::Empty } # Remote Differential Compression WindowsFeature RemoteDifferentialCompression { Name = "RDC" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_RemoteDifferentialCompression.log" } # DHCP Server WindowsFeature DhcpServer { Name = "DHCP" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_DhcpServer.log" } # DHCP Server Tools WindowsFeature DhcpServerTools { DependsOn = "[WindowsFeature]DhcpServer" Name = "RSAT-DHCP" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_DhcpServerTools.log" } # DHCP Server Option Value - 006 DNS Server Script DhcpServerOptionValue006 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) $DNSServer = ($IPConfig.DNSServer | Where-Object AddressFamily -eq 2).ServerAddresses $Option = Get-DhcpServerv4OptionValue -OptionId 6 -ErrorAction SilentlyContinue if ($Option -ne $null) { $CompareResult = Compare-Object -ReferenceObject $DNSServer ` -DifferenceObject $Option.Value return ($CompareResult.SideIndicator -eq $null) } else { return $false } } SetScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) $DNSServer = ($IPConfig.DNSServer | Where-Object AddressFamily -eq 2).ServerAddresses Set-DhcpServerv4OptionValue -DnsServer $DNSServer } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 015 DNS Domain Name Script DhcpServerOptionValue015 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $Option = Get-DhcpServerv4OptionValue -OptionId 15 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq (Get-WmiObject -Class Win32_ComputerSystem).Domain) } else { return $false } } SetScript = { Set-DhcpServerv4OptionValue -DnsDomain (Get-WmiObject -Class Win32_ComputerSystem).Domain } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 060 PXEClient Script DhcpServerOptionValue060 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $Option = Get-DhcpServerv4OptionValue -OptionId 60 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq "PXEClient") } else { return $false } } SetScript = { Set-DhcpServerv4OptionValue -OptionId 60 -Value "PXEClient" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 066 Boot Server Host Name Script DhcpServerOptionValue066 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) $Option = Get-DhcpServerv4OptionValue -OptionId 66 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq $IPConfig.IPv4Address.IPAddress) } else { return $false } } SetScript = { $IPConfig = (Get-NetIPConfiguration | Where-Object IPv4DefaultGateway) Set-DhcpServerv4OptionValue -OptionId 66 -Value $IPConfig.IPv4Address.IPAddress } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # DHCP Server Option Value - 067 Bootfile Name Script DhcpServerOptionValue067 { DependsOn = "[WindowsFeature]DhcpServer" TestScript = { $Option = Get-DhcpServerv4OptionValue -OptionId 67 -ErrorAction SilentlyContinue if ($Option -ne $null) { return [bool]($Option.Value -eq "SMSBoot\x64\wdsnbp.com") } else { return $false } } SetScript = { Set-DhcpServerv4OptionValue -OptionId 67 -Value "SMSBoot\x64\wdsnbp.com" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # Windows Deployment Services WindowsFeature WindowsDeploymentServices { Name = "WDS" Ensure = "Present" IncludeAllSubFeature = $true LogPath = "C:\Windows\debug\DSC_WindowsFeature_WindowsDeploymentServices.log" } # WDS Remote Installation Folder File WindowsDeploymentServicesFolder { DependsOn = "[WindowsFeature]WindowsDeploymentServices" DestinationPath = $WindowsDeploymentServicesFolder Ensure = "Present" Type = "Directory" } # WDS Initialize Server Script WindowsDeploymentServicesInitializeServer { DependsOn = "[File]WindowsDeploymentServicesFolder" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") return ($WdsServer.SetupManager.InitialSetupComplete) } SetScript = { Start-Process -FilePath "C:\Windows\System32\wdsutil.exe" -Wait ` -ArgumentList "/Initialize-Server", "/REMINST:$WindowsDeploymentServicesFolder" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # WDS Configure DHCP settings Script WindowsDeploymentServicesConfigureDhcpProperties { DependsOn = "[Script]WindowsDeploymentServicesInitializeServer" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $SetupManager = $WdsServer.SetupManager return ( $SetupManager.DhcpPxeOptionPresent -eq $true ` -and $SetupManager.DhcpOperationMode -eq "2" ) } SetScript = { Start-Process -FilePath "C:\Windows\System32\wdsutil.exe" -Wait ` -ArgumentList "/Set-Server", "/UseDhcpPorts:No", "/DhcpOption60:Yes" } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # WDS Configure PXE response delay Script WindowsDeploymentServicesConfigurePXEResponseDelay { DependsOn = "[Script]WindowsDeploymentServicesInitializeServer" TestScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy return ($Policy.ResponseDelay -eq 1) } SetScript = { $WdsServer = (New-Object -ComObject WdsMgmt.WdsManager).GetWdsServer("localhost") $Policy = $WdsServer.ConfigurationManager.DeviceAnswerPolicy $Policy.ResponseDelay = 1 $Policy.Commit() } GetScript = { return @{ GetScript = $GetScript SetScript = $SetScript TestScript = $TestScript Credential = $Credential Result = (Invoke-Expression $TestScript) } } } # IIS ISAPI Extensions WindowsFeature WebServerISAPIExtensions { Name = "Web-ISAPI-Ext" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_Authentication.log" } # IIS Windows Authentication WindowsFeature WebServerWindowsAuth { Name = "Web-Windows-Auth" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerWindowsAuth.log" } # IIS 6 Metabase Compatibility WindowsFeature WebServerLegacyMetabaseCompatibility { Name = "Web-Metabase" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyMetabaseCompatibility.log" } # IIS 6 WMI Compatibility WindowsFeature WebServerLegacyWMICompatibility { Name = "Web-WMI" Ensure = "Present" LogPath = "C:\Windows\debug\DSC_WindowsFeature_WebServerLegacyWMICompatibility.log" } } }
{ "content_hash": "0fc2ac0906cb5404965adeb7cbd798df", "timestamp": "", "source": "github", "line_count": 1604, "max_line_length": 105, "avg_line_length": 34.67456359102244, "alnum_prop": 0.48779172210435473, "repo_name": "randorfer/RunbookExample", "id": "6f0bcd11c79834c342ca19a9fad63e06193d6197", "size": "55620", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DSC/SCCM_2012.ps1", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "150327" }, { "name": "PHP", "bytes": "1097" }, { "name": "PowerShell", "bytes": "2137801" } ], "symlink_target": "" }
// @flow /* eslint-env mocha */ import assert from 'power-assert' import addMilliseconds from '.' describe('addMilliseconds', function() { it('adds the given number of milliseconds', function() { var result = addMilliseconds( new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 0), 750 ) assert.deepEqual(result, new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 750)) }) it('accepts a timestamp', function() { var result = addMilliseconds( new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 0).getTime(), 500 ) assert.deepEqual(result, new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 500)) }) it('converts a fractional number to an integer', function() { var result = addMilliseconds( new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 0), 750.75 ) assert.deepEqual(result, new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 750)) }) it('implicitly converts number arguments', function() { var result = addMilliseconds( new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 5), // $ExpectedMistake '750' ) assert.deepEqual(result, new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 755)) }) it('does not mutate the original date', function() { var date = new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 0) addMilliseconds(date, 250) assert.deepEqual(date, new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 0)) }) it('returns `Invalid Date` if the given date is invalid', function() { var result = addMilliseconds(new Date(NaN), 750) assert(result instanceof Date && isNaN(result)) }) it('returns `Invalid Date` if the given amount is NaN', function() { var result = addMilliseconds( new Date(2014, 6 /* Jul */, 10, 12, 45, 30, 0), NaN ) assert(result instanceof Date && isNaN(result)) }) it('throws TypeError exception if passed less than 2 arguments', function() { assert.throws(addMilliseconds.bind(null), TypeError) assert.throws(addMilliseconds.bind(null, 1), TypeError) }) })
{ "content_hash": "12561b4b8d5ee042fc18de7d6371d915", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 79, "avg_line_length": 31.421875, "alnum_prop": 0.6066633515663848, "repo_name": "js-fns/date-fns", "id": "8919bef4378232012c3612caa57f96f9c64fc3dd", "size": "2011", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/addMilliseconds/test.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "417689" }, { "name": "Shell", "bytes": "10739" } ], "symlink_target": "" }
using log4net; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tds.Engine.Exceptions; using Tds.Interfaces; using Tds.Interfaces.Model; using Tds.Types; namespace Tds.Engine.Core { class MaintenanceTask { private IRepository sourceRepository; private IRepository targetRepository; private IMetadataWorkspace metadataWorkspace; private IDependencyResolver dependencyResolver; private IEntityTypeFilter filter; private ICollection<Entity> visited; private EntityComparer entityComparer; private ILog log; public MaintenanceTask(IMetadataWorkspace metadataWorkspace, IRepository sourceRepository, IRepository targetRepository, IDependencyResolver dependencyResolver, IEntityTypeFilter filter) { this.metadataWorkspace = metadataWorkspace; this.sourceRepository = sourceRepository; this.targetRepository = targetRepository; this.dependencyResolver = dependencyResolver; this.filter = filter; this.visited = new List<Entity>(); this.entityComparer = new EntityComparer(metadataWorkspace); log4net.Config.XmlConfigurator.Configure(); this.log = LogManager.GetLogger(typeof(MaintenanceTask)); } public void Save(string entityName, ICollection<EntityKey> keyMembers) { try { Entity entity = sourceRepository.Read(entityName, keyMembers).First(); Save(entity); targetRepository.SaveChanges(); } catch (InvalidOperationException exception) { throw new EntityNotFoundInDatabaseException(entityName, keyMembers, metadataWorkspace.GetEntityType(entityName), exception); } } private class EntityComparer : IEqualityComparer<Entity> { private IMetadataWorkspace metadataWorkspace; public EntityComparer(IMetadataWorkspace metadataWorkspace) { this.metadataWorkspace = metadataWorkspace; } public bool Equals(Entity entity, Entity other) { var entityType = metadataWorkspace.GetEntityType(entity.Name); if (entityType == null) { throw new EntityTypeNotFoundException(entity.Name); } if (entity == null || other == null) { return false; } if (string.IsNullOrEmpty(entity.Name) || string.IsNullOrEmpty(other.Name) || (!entity.Name.Equals(other.Name))) { return false; } if (entity.Properties.Count != other.Properties.Count) { return false; } foreach (var property in entity.Properties) { var value = Converter.ConvertToString(entityType.Properties[property.Key], property.Value); var otherValue = Converter.ConvertToString(entityType.Properties[property.Key], other.Properties[property.Key]); if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(otherValue) || (!value.Equals(otherValue))) { return false; } } return true; } public int GetHashCode(Entity obj) { var entityType = metadataWorkspace.GetEntityType(obj.Name); if (entityType == null) { throw new EntityTypeNotFoundException(obj.Name); } unchecked { int hash = 269; int collectionHash = 0; foreach (var property in obj.Properties.OrderBy(p => p.Key)) { collectionHash ^= Converter.ConvertToString(entityType.Properties[property.Key], property.Value).GetHashCode(); } hash = (hash * 47) + obj.Name.GetHashCode(); hash = (hash * 47) + collectionHash; return hash; } } } private void Save(Entity sourceEntity) { if (visited.Contains(sourceEntity, entityComparer)) { return; } visited.Add(sourceEntity); SaveEntitiesWhereCurrentEntityIsDependent(sourceEntity); SaveCurrentEntity(sourceEntity); SaveEntitiesWhereCurrentEntityIsPrincipal(sourceEntity); } private ICollection<EntityKey> GetEntityPrimaryKey(Entity entity) { var entityType = metadataWorkspace.GetEntityType(entity.Name); if (entityType == null) { throw new EntityTypeNotFoundException(entity.Name); } var result = new EntityKey[entityType.PrimaryKey.Count]; int index = 0; foreach (var keyMember in entityType.PrimaryKey.OrderBy(member => member.Sequence)) { result[index] = new EntityKey() { Name = keyMember.Name, Value = entity.Properties[keyMember.Name] }; index++; } return result; } private void SaveCurrentEntity(Entity sourceEntity) { var primaryKey = GetEntityPrimaryKey(sourceEntity); var targetEntities = targetRepository.Read(sourceEntity.Name, primaryKey); switch (targetEntities.Count()) { case 0: targetRepository.Write(sourceEntity, primaryKey); break; case 1: var targetEntity = targetEntities.First(); if (!sourceEntity.Equals(targetEntity)) { targetRepository.Write(sourceEntity, primaryKey, EntityStatus.Modified); } break; default: break; } } private void SaveEntitiesWhereCurrentEntityIsDependent(Entity sourceEntity) { foreach (var association in metadataWorkspace.GetAssociationsWhereEntityIsDependent(sourceEntity.Name, filter)) { foreach (var entity in dependencyResolver.GetEntitiesWhereEntityIsDependent(sourceEntity, association)) { Save(entity); } } } private void SaveEntitiesWhereCurrentEntityIsPrincipal(Entity sourceEntity) { foreach (var association in metadataWorkspace.GetAssociationsWhereEntityIsPrincipal(sourceEntity.Name, filter)) { foreach (var entity in dependencyResolver.GetEntitiesWhereEntityIsPrincipal(sourceEntity, association)) { Save(entity); } } } } }
{ "content_hash": "a47c1507b2cd798b39abcaa1d72024bb", "timestamp": "", "source": "github", "line_count": 218, "max_line_length": 140, "avg_line_length": 33.65137614678899, "alnum_prop": 0.5502998909487459, "repo_name": "istvantako/TDS", "id": "8d2fff257c62054376180f33fd8775bf777c81d7", "size": "7338", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Tds.Engine/Core/MaintenanceTask.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "250548" } ], "symlink_target": "" }
<a title='Build Status' href="https://travis-ci.org/RafaelCasuso/backbone.mastermind"> <img src='https://travis-ci.org/RafaelCasuso/backbone.mastermind.svg?branch=master' /> </a> [![Coverage Status](https://coveralls.io/repos/RafaelCasuso/backbone.mastermind/badge.svg?branch=master)](https://coveralls.io/r/RafaelCasuso/backbone.mastermind?branch=master)
{ "content_hash": "e544b263a21af4ce53c0b251687ed3a9", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 176, "avg_line_length": 89.5, "alnum_prop": 0.7793296089385475, "repo_name": "RafaelCasuso/backbone.mastermind", "id": "e17cf70eb2c7ee7af38248de3fbe9d65bac7f1f7", "size": "374", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "17732" }, { "name": "JavaScript", "bytes": "10291" } ], "symlink_target": "" }
void* alloc(size_t size); double symbolsToSecondS(double syms); uint64_t secondsToTicks(double secs); uint64_t symbolsToTicks(double syms); double jiffiesToSeconds(double jiffies); uint64_t jiffiesToTicks(double jiffies); double secondsToJiffies(double seconds); double ticksToSeconds(uint64_t ticks); double ticksToJiffies(uint64_t ticks); uint32_t getCurrentTimeInJiffies(); #endif // __HPLCC2420_H
{ "content_hash": "1ebdc5b45af068b2e868430b705ba0da", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 40, "avg_line_length": 33.5, "alnum_prop": 0.8084577114427861, "repo_name": "fresskarma/tinyos-1.x", "id": "b73724db54a25ca8eadc5cdd4aebae55030444a7", "size": "667", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "contrib/SP/tos/platform/pc/TOSSIM-CC2420/HPLCC2420.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "137296" }, { "name": "Awk", "bytes": "2286" }, { "name": "C", "bytes": "10268716" }, { "name": "C#", "bytes": "140791" }, { "name": "C++", "bytes": "2931461" }, { "name": "CSS", "bytes": "19694" }, { "name": "Forth", "bytes": "101" }, { "name": "Groff", "bytes": "3149" }, { "name": "HTML", "bytes": "1387492" }, { "name": "Inno Setup", "bytes": "16361" }, { "name": "Java", "bytes": "7496416" }, { "name": "Lex", "bytes": "16806" }, { "name": "Logos", "bytes": "10058" }, { "name": "M", "bytes": "2148" }, { "name": "Makefile", "bytes": "871469" }, { "name": "Mathematica", "bytes": "164375" }, { "name": "Matlab", "bytes": "760094" }, { "name": "OCaml", "bytes": "34306" }, { "name": "Objective-C", "bytes": "1149978" }, { "name": "PHP", "bytes": "79339" }, { "name": "Perl", "bytes": "649566" }, { "name": "Perl6", "bytes": "13417" }, { "name": "PostScript", "bytes": "476077" }, { "name": "Python", "bytes": "884036" }, { "name": "Shell", "bytes": "91087" }, { "name": "Smarty", "bytes": "1515" }, { "name": "SourcePawn", "bytes": "29314" }, { "name": "Standard ML", "bytes": "2129" }, { "name": "Tcl", "bytes": "168362" }, { "name": "TeX", "bytes": "213012" }, { "name": "TypeScript", "bytes": "3834" }, { "name": "Visual Basic", "bytes": "274161" }, { "name": "Yacc", "bytes": "43956" }, { "name": "nesC", "bytes": "46659836" } ], "symlink_target": "" }
// Define DEBUG symbol to enable Debug.WriteLine to work even when Prism is compiled in Release-mode for Nuget-feed. #define DEBUG using System; using System.Diagnostics; using System.Globalization; using Prism.Properties; namespace Prism.Logging { /// <summary> /// Implementation of <see cref="ILoggerFacade"/> that logs into a message into the Debug.Listeners collection. /// </summary> public class DebugLogger : ILoggerFacade { /// <summary> /// Write a new log entry with the specified category and priority. /// </summary> /// <param name="message">Message body to log.</param> /// <param name="category">Category of the entry.</param> /// <param name="priority">The priority of the entry.</param> public void Log(string message, Category category, Priority priority) { string messageToLog = String.Format(CultureInfo.InvariantCulture, Resources.DefaultDebugLoggerPattern, DateTime.Now, category.ToString().ToUpper(), message, priority); Debug.WriteLine(messageToLog); } } }
{ "content_hash": "845a55e888b1cb78b7492c853861a8b7", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 128, "avg_line_length": 39.758620689655174, "alnum_prop": 0.6487424111014745, "repo_name": "cbordeman/gameofgo", "id": "d06a8cfa870bc5b4b42dea0b2267631ca2d3cad9", "size": "1155", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "Prism/Logging/DebugLogger.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1561" }, { "name": "C", "bytes": "185564" }, { "name": "C#", "bytes": "571008" }, { "name": "C++", "bytes": "114101755" }, { "name": "M4", "bytes": "9738" }, { "name": "Perl", "bytes": "6080" }, { "name": "Shell", "bytes": "728" } ], "symlink_target": "" }
.. meta:: :description lang=en: Collect useful snippets of SQLAlchemy :keywords: Python, Python3, SQLAlchemy Cheat Sheet ========== SQLAlchemy ========== .. contents:: Table of Contents :backlinks: none Set a database URL ------------------- .. code-block:: python from sqlalchemy.engine.url import URL postgres_db = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} print(URL(**postgres_db)) sqlite_db = {'drivername': 'sqlite', 'database': 'db.sqlite'} print(URL(**sqlite_db)) output: .. code-block:: bash $ python sqlalchemy_url.py postgres://postgres:[email protected]:5432 sqlite:///db.sqlite Sqlalchemy Support DBAPI - PEP249 ----------------------------------- .. code-block:: python from sqlalchemy import create_engine db_uri = "sqlite:///db.sqlite" engine = create_engine(db_uri) # DBAPI - PEP249 # create table engine.execute('CREATE TABLE "EX1" (' 'id INTEGER NOT NULL,' 'name VARCHAR, ' 'PRIMARY KEY (id));') # insert a raw engine.execute('INSERT INTO "EX1" ' '(id, name) ' 'VALUES (1,"raw1")') # select * result = engine.execute('SELECT * FROM ' '"EX1"') for _r in result: print(_r) # delete * engine.execute('DELETE from "EX1" where id=1;') result = engine.execute('SELECT * FROM "EX1"') print(result.fetchall()) Transaction and Connect Object -------------------------------- .. code-block:: python from sqlalchemy import create_engine db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) # Create connection conn = engine.connect() # Begin transaction trans = conn.begin() conn.execute('INSERT INTO "EX1" (name) ' 'VALUES ("Hello")') trans.commit() # Close connection conn.close() Metadata - Generating Database Schema -------------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer, String db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) # Create a metadata instance metadata = MetaData(engine) # Declare a table table = Table('Example',metadata, Column('id',Integer, primary_key=True), Column('name',String)) # Create all tables metadata.create_all() for _t in metadata.tables: print("Table: ", _t) Inspect - Get Database Information ------------------------------------ .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import inspect db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) inspector = inspect(engine) # Get table information print(inspector.get_table_names()) # Get column information print(inspector.get_columns('EX1')) Reflection - Loading Table from Existing Database --------------------------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) # Create a MetaData instance metadata = MetaData() print(metadata.tables) # reflect db schema to MetaData metadata.reflect(bind=engine) print(metadata.tables) Print Create Table Statement with Indexes (SQL DDL) ---------------------------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String def metadata_dump(sql, *multiparams, **params): print(sql.compile(dialect=engine.dialect)) meta = MetaData() example_table = Table('Example',meta, Column('id', Integer, primary_key=True), Column('name', String(10), index=True)) db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri, strategy='mock', executor=metadata_dump) meta.create_all(bind=engine, tables=[example_table]) output: .. code-block:: sql CREATE TABLE "Example" ( id INTEGER NOT NULL, name VARCHAR(10), PRIMARY KEY (id) ) CREATE INDEX "ix_Example_name" ON "Example" (name) Get Table from MetaData ------------------------ .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) # Create MetaData instance metadata = MetaData(engine).reflect() print(metadata.tables) # Get Table ex_table = metadata.tables['Example'] print(ex_table) Create all Tables Store in "MetaData" -------------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer, String db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) meta = MetaData(engine) # Register t1, t2 to metadata t1 = Table('EX1', meta, Column('id',Integer, primary_key=True), Column('name',String)) t2 = Table('EX2', meta, Column('id',Integer, primary_key=True), Column('val',Integer)) # Create all tables in meta meta.create_all() Create Specific Table ----------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer, String db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) meta = MetaData(engine) t1 = Table('Table_1', meta, Column('id', Integer, primary_key=True), Column('name',String)) t2 = Table('Table_2', meta, Column('id', Integer, primary_key=True), Column('val',Integer)) t1.create() Create table with same columns ------------------------------- .. code-block:: python from sqlalchemy import ( create_engine, inspect, Column, String, Integer) from sqlalchemy.ext.declarative import declarative_base db_url = "sqlite://" engine = create_engine(db_url) Base = declarative_base() class TemplateTable(object): id = Column(Integer, primary_key=True) name = Column(String) age = Column(Integer) class DowntownAPeople(TemplateTable, Base): __tablename__ = "downtown_a_people" class DowntownBPeople(TemplateTable, Base): __tablename__ = "downtown_b_people" Base.metadata.create_all(bind=engine) # check table exists ins = inspect(engine) for _t in ins.get_table_names(): print(_t) Drop a Table ------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import inspect from sqlalchemy import Table from sqlalchemy import Column, Integer, String from sqlalchemy.engine.url import URL db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) m = MetaData() table = Table('Test', m, Column('id', Integer, primary_key=True), Column('key', String, nullable=True), Column('val', String)) table.create(engine) inspector = inspect(engine) print('Test' in inspector.get_table_names()) table.drop(engine) inspector = inspect(engine) print('Test' in inspector.get_table_names()) output: .. code-block:: bash $ python sqlalchemy_drop.py $ True $ False Some Table Object Operation ---------------------------- .. code-block:: python from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer, String meta = MetaData() t = Table('ex_table', meta, Column('id', Integer, primary_key=True), Column('key', String), Column('val', Integer)) # Get Table Name print(t.name) # Get Columns print(t.columns.keys()) # Get Column c = t.c.key print(c.name) # Or c = t.columns.key print(c.name) # Get Table from Column print(c.table) SQL Expression Language ------------------------- .. code-block:: python # Think Column as "ColumnElement" # Implement via overwrite special function from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer, String from sqlalchemy import or_ meta = MetaData() table = Table('example', meta, Column('id', Integer, primary_key=True), Column('l_name', String), Column('f_name', String)) # sql expression binary object print(repr(table.c.l_name == 'ed')) # exhbit sql expression print(str(table.c.l_name == 'ed')) print(repr(table.c.f_name != 'ed')) # comparison operator print(repr(table.c.id > 3)) # or expression print((table.c.id > 5) | (table.c.id < 2)) # Equal to print(or_(table.c.id > 5, table.c.id < 2)) # compare to None produce IS NULL print(table.c.l_name == None) # Equal to print(table.c.l_name.is_(None)) # + means "addition" print(table.c.id + 5) # or means "string concatenation" print(table.c.l_name + "some name") # in expression print(table.c.l_name.in_(['a','b'])) insert() - Create an "INSERT" Statement ---------------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) # create table meta = MetaData(engine) table = Table('user', meta, Column('id', Integer, primary_key=True), Column('l_name', String), Column('f_name', String)) meta.create_all() # insert data via insert() construct ins = table.insert().values( l_name='Hello', f_name='World') conn = engine.connect() conn.execute(ins) # insert multiple data conn.execute(table.insert(),[ {'l_name':'Hi','f_name':'bob'}, {'l_name':'yo','f_name':'alice'}]) select() - Create a "SELECT" Statement --------------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import select from sqlalchemy import or_ db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) conn = engine.connect() meta = MetaData(engine).reflect() table = meta.tables['user'] # select * from 'user' select_st = select([table]).where( table.c.l_name == 'Hello') res = conn.execute(select_st) for _row in res: print(_row) # or equal to select_st = table.select().where( table.c.l_name == 'Hello') res = conn.execute(select_st) for _row in res: print(_row) # combine with "OR" select_st = select([ table.c.l_name, table.c.f_name]).where(or_( table.c.l_name == 'Hello', table.c.l_name == 'Hi')) res = conn.execute(select_st) for _row in res: print(_row) # combine with "ORDER_BY" select_st = select([table]).where(or_( table.c.l_name == 'Hello', table.c.l_name == 'Hi')).order_by(table.c.f_name) res = conn.execute(select_st) for _row in res: print(_row) join() - Joined Two Tables via "JOIN" Statement ------------------------------------------------ .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy import select db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) meta = MetaData(engine).reflect() email_t = Table('email_addr', meta, Column('id', Integer, primary_key=True), Column('email',String), Column('name',String)) meta.create_all() # get user table user_t = meta.tables['user'] # insert conn = engine.connect() conn.execute(email_t.insert(),[ {'email':'ker@test','name':'Hi'}, {'email':'yo@test','name':'Hello'}]) # join statement join_obj = user_t.join(email_t, email_t.c.name == user_t.c.l_name) # using select_from sel_st = select( [user_t.c.l_name, email_t.c.email]).select_from(join_obj) res = conn.execute(sel_st) for _row in res: print(_row) Fastest Bulk Insert in PostgreSQL via "COPY" Statement ------------------------------------------------------- .. code-block:: python # This method found here: https://gist.github.com/jsheedy/efa9a69926a754bebf0e9078fd085df6 import io from datetime import date from sqlalchemy.engine.url import URL from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy import Date db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) # create table meta = MetaData(engine) table = Table('userinfo', meta, Column('id', Integer, primary_key=True), Column('first_name', String), Column('age', Integer), Column('birth_day', Date), ) meta.create_all() # file-like object (tsv format) datafile = io.StringIO() # generate rows for i in range(100): line = '\t'.join( [ f'Name {i}', # first_name str(18 + i), # age str(date.today()), # birth_day ] ) datafile.write(line + '\n') # reset file to start datafile.seek(0) # bulk insert via `COPY` statement conn = engine.raw_connection() with conn.cursor() as cur: # https://www.psycopg.org/docs/cursor.html#cursor.copy_from cur.copy_from( datafile, table.name, # table name sep='\t', columns=('first_name', 'age', 'birth_day'), ) conn.commit() Bulk PostgreSQL Insert and Return Inserted IDs ----------------------------------------------- .. code-block:: python from sqlalchemy.engine.url import URL from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) # create table meta = MetaData(engine) table = Table('userinfo', meta, Column('id', Integer, primary_key=True), Column('first_name', String), Column('age', Integer), ) meta.create_all() # generate rows data = [{'first_name': f'Name {i}', 'age': 18+i} for i in range(10)] stmt = table.insert().values(data).returning(table.c.id) # converted into SQL: # INSERT INTO userinfo (first_name, age) VALUES # (%(first_name_m0)s, %(age_m0)s), (%(first_name_m1)s, %(age_m1)s), # (%(first_name_m2)s, %(age_m2)s), (%(first_name_m3)s, %(age_m3)s), # (%(first_name_m4)s, %(age_m4)s), (%(first_name_m5)s, %(age_m5)s), # (%(first_name_m6)s, %(age_m6)s), (%(first_name_m7)s, %(age_m7)s), # (%(first_name_m8)s, %(age_m8)s), (%(first_name_m9)s, %(age_m9)s) # RETURNING userinfo.id for rowid in engine.execute(stmt).fetchall(): print(rowid['id']) output: .. code-block:: bash $ python sqlalchemy_bulk.py 1 2 3 4 5 6 7 8 9 10 Update Multiple Rows --------------------- .. code-block:: python from sqlalchemy.engine.url import URL from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy.sql.expression import bindparam db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) # create table meta = MetaData(engine) table = Table('userinfo', meta, Column('id', Integer, primary_key=True), Column('first_name', String), Column('birth_year', Integer), ) meta.create_all() # update data data = [ {'_id': 1, 'first_name': 'Johnny', 'birth_year': 1975}, {'_id': 2, 'first_name': 'Jim', 'birth_year': 1973}, {'_id': 3, 'first_name': 'Kaley', 'birth_year': 1985}, {'_id': 4, 'first_name': 'Simon', 'birth_year': 1980}, {'_id': 5, 'first_name': 'Kunal', 'birth_year': 1981}, {'_id': 6, 'first_name': 'Mayim', 'birth_year': 1975}, {'_id': 7, 'first_name': 'Melissa', 'birth_year': 1980}, ] stmt = table.update().where(table.c.id == bindparam('_id')).\ values({ 'first_name': bindparam('first_name'), 'birth_year': bindparam('birth_year'), }) # conveted to SQL: # UPDATE userinfo SET first_name=%(first_name)s, birth_year=%(birth_year)s WHERE userinfo.id = %(_id)s engine.execute(stmt, data) Delete Rows from Table ------------------------ .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) conn = engine.connect() meta = MetaData(engine).reflect() user_t = meta.tables['user'] # select * from user_t sel_st = user_t.select() res = conn.execute(sel_st) for _row in res: print(_row) # delete l_name == 'Hello' del_st = user_t.delete().where( user_t.c.l_name == 'Hello') print('----- delete -----') res = conn.execute(del_st) # check rows has been delete sel_st = user_t.select() res = conn.execute(sel_st) for _row in res: print(_row) Check Table Existing ---------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Column from sqlalchemy import Integer, String from sqlalchemy import inspect from sqlalchemy.ext.declarative import declarative_base Modal = declarative_base() class Example(Modal): __tablename__ = "ex_t" id = Column(Integer, primary_key=True) name = Column(String(20)) db_uri = 'sqlite:///db.sqlite' engine = create_engine(db_uri) Modal.metadata.create_all(engine) # check register table exist to Modal for _t in Modal.metadata.tables: print(_t) # check all table in database meta = MetaData(engine).reflect() for _t in meta.tables: print(_t) # check table names exists via inspect ins = inspect(engine) for _t in ins.get_table_names(): print(_t) Create multiple tables at once ------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import Table from sqlalchemy import inspect from sqlalchemy import Column, String, Integer from sqlalchemy.engine.url import URL db = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} url = URL(**db) engine = create_engine(url) metadata = MetaData() metadata.reflect(bind=engine) def create_table(name, metadata): tables = metadata.tables.keys() if name not in tables: table = Table(name, metadata, Column('id', Integer, primary_key=True), Column('key', String), Column('val', Integer)) table.create(engine) tables = ['table1', 'table2', 'table3'] for _t in tables: create_table(_t, metadata) inspector = inspect(engine) print(inspector.get_table_names()) output: .. code-block:: bash $ python sqlalchemy_create.py [u'table1', u'table2', u'table3'] Create tables with dynamic columns (Table) -------------------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import Column, Integer, String from sqlalchemy import Table from sqlalchemy import MetaData from sqlalchemy import inspect from sqlalchemy.engine.url import URL db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) def create_table(name, *cols): meta = MetaData() meta.reflect(bind=engine) if name in meta.tables: return table = Table(name, meta, *cols) table.create(engine) create_table('Table1', Column('id', Integer, primary_key=True), Column('name', String)) create_table('Table2', Column('id', Integer, primary_key=True), Column('key', String), Column('val', String)) inspector = inspect(engine) for _t in inspector.get_table_names(): print(_t) output: .. code-block:: bash $ python sqlalchemy_dynamic.py Table1 Table2 Object Relational add data ---------------------------- .. code-block:: python from datetime import datetime from sqlalchemy import create_engine from sqlalchemy import Column, Integer, String, DateTime from sqlalchemy.orm import sessionmaker from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.engine.url import URL db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) Base = declarative_base() class TestTable(Base): __tablename__ = 'Test Table' id = Column(Integer, primary_key=True) key = Column(String, nullable=False) val = Column(String) date = Column(DateTime, default=datetime.utcnow) # create tables Base.metadata.create_all(bind=engine) # create session Session = sessionmaker() Session.configure(bind=engine) session = Session() data = {'a': 5566, 'b': 9527, 'c': 183} try: for _key, _val in data.items(): row = TestTable(key=_key, val=_val) session.add(row) session.commit() except SQLAlchemyError as e: print(e) finally: session.close() Object Relational update data ------------------------------ .. code-block:: python from datetime import datetime from sqlalchemy import create_engine from sqlalchemy import Column, Integer, String, DateTime from sqlalchemy.orm import sessionmaker from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.engine.url import URL db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) Base = declarative_base() class TestTable(Base): __tablename__ = 'Test Table' id = Column(Integer, primary_key=True) key = Column(String, nullable=False) val = Column(String) date = Column(DateTime, default=datetime.utcnow) # create tables Base.metadata.create_all(bind=engine) # create session Session = sessionmaker() Session.configure(bind=engine) session = Session() try: # add row to database row = TestTable(key="hello", val="world") session.add(row) session.commit() # update row to database row = session.query(TestTable).filter( TestTable.key == 'hello').first() print('original:', row.key, row.val) row.key = "Hello" row.val = "World" session.commit() # check update correct row = session.query(TestTable).filter( TestTable.key == 'Hello').first() print('update:', row.key, row.val) except SQLAlchemyError as e: print(e) finally: session.close() output: .. code-block:: bash $ python sqlalchemy_update.py original: hello world update: Hello World Object Relational delete row ----------------------------- .. code-block:: python from datetime import datetime from sqlalchemy import create_engine from sqlalchemy import Column, Integer, String, DateTime from sqlalchemy.orm import sessionmaker from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.engine.url import URL db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) Base = declarative_base() class TestTable(Base): __tablename__ = 'Test Table' id = Column(Integer, primary_key=True) key = Column(String, nullable=False) val = Column(String) date = Column(DateTime, default=datetime.utcnow) # create tables Base.metadata.create_all(bind=engine) # create session Session = sessionmaker() Session.configure(bind=engine) session = Session() row = TestTable(key='hello', val='world') session.add(row) query = session.query(TestTable).filter( TestTable.key=='hello') print(query.first()) query.delete() query = session.query(TestTable).filter( TestTable.key=='hello') print(query.all()) output: .. code-block:: bash $ python sqlalchemy_delete.py <__main__.TestTable object at 0x104eb8f50> [] Object Relational relationship ------------------------------- .. code-block:: python from sqlalchemy import Column, String, Integer, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): __tablename__ = 'user' id = Column(Integer, primary_key=True) name = Column(String) addresses = relationship("Address", backref="user") class Address(Base): __tablename__ = 'address' id = Column(Integer, primary_key=True) email = Column(String) user_id = Column(Integer, ForeignKey('user.id')) u1 = User() a1 = Address() print(u1.addresses) print(a1.user) u1.addresses.append(a1) print(u1.addresses) print(a1.user) output: .. code-block:: bash $ python sqlalchemy_relationship.py [] None [<__main__.Address object at 0x10c4edb50>] <__main__.User object at 0x10c4ed810> Object Relational self association ----------------------------------- .. code-block:: python import json from sqlalchemy import ( Column, Integer, String, ForeignKey, Table) from sqlalchemy.orm import ( sessionmaker, relationship) from sqlalchemy.ext.declarative import declarative_base base = declarative_base() association = Table("Association", base.metadata, Column('left', Integer, ForeignKey('node.id'), primary_key=True), Column('right', Integer, ForeignKey('node.id'), primary_key=True)) class Node(base): __tablename__ = 'node' id = Column(Integer, primary_key=True) label = Column(String) friends = relationship('Node', secondary=association, primaryjoin=id==association.c.left, secondaryjoin=id==association.c.right, backref='left') def to_json(self): return dict(id=self.id, friends=[_.label for _ in self.friends]) nodes = [Node(label='node_{}'.format(_)) for _ in range(0, 3)] nodes[0].friends.extend([nodes[1], nodes[2]]) nodes[1].friends.append(nodes[2]) print('----> right') print(json.dumps([_.to_json() for _ in nodes], indent=2)) print('----> left') print(json.dumps([_n.to_json() for _n in nodes[1].left], indent=2)) output: .. code-block:: bash ----> right [ { "friends": [ "node_1", "node_2" ], "id": null }, { "friends": [ "node_2" ], "id": null }, { "friends": [], "id": null } ] ----> left [ { "friends": [ "node_1", "node_2" ], "id": null } ] Object Relational basic query ------------------------------ .. code-block:: python from datetime import datetime from sqlalchemy import create_engine from sqlalchemy import Column, String, Integer, DateTime from sqlalchemy import or_ from sqlalchemy import desc from sqlalchemy.orm import sessionmaker from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.engine.url import URL db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} Base = declarative_base() class User(Base): __tablename__ = 'User' id = Column(Integer, primary_key=True) name = Column(String, nullable=False) fullname = Column(String, nullable=False) birth = Column(DateTime) # create tables engine = create_engine(URL(**db_url)) Base.metadata.create_all(bind=engine) users = [ User(name='ed', fullname='Ed Jones', birth=datetime(1989,7,1)), User(name='wendy', fullname='Wendy Williams', birth=datetime(1983,4,1)), User(name='mary', fullname='Mary Contrary', birth=datetime(1990,1,30)), User(name='fred', fullname='Fred Flinstone', birth=datetime(1977,3,12)), User(name='justin', fullname="Justin Bieber")] # create session Session = sessionmaker() Session.configure(bind=engine) session = Session() # add_all session.add_all(users) session.commit() print("----> order_by(id):") query = session.query(User).order_by(User.id) for _row in query.all(): print(_row.name, _row.fullname, _row.birth) print("\n----> order_by(desc(id)):") query = session.query(User).order_by(desc(User.id)) for _row in query.all(): print(_row.name, _row.fullname, _row.birth) print("\n----> order_by(date):") query = session.query(User).order_by(User.birth) for _row in query.all(): print(_row.name, _row.fullname, _row.birth) print("\n----> EQUAL:") query = session.query(User).filter(User.id == 2) _row = query.first() print(_row.name, _row.fullname, _row.birth) print("\n----> NOT EQUAL:") query = session.query(User).filter(User.id != 2) for _row in query.all(): print(_row.name, _row.fullname, _row.birth) print("\n----> IN:") query = session.query(User).filter(User.name.in_(['ed', 'wendy'])) for _row in query.all(): print(_row.name, _row.fullname, _row.birth) print("\n----> NOT IN:") query = session.query(User).filter(~User.name.in_(['ed', 'wendy'])) for _row in query.all(): print(_row.name, _row.fullname, _row.birth) print("\n----> AND:") query = session.query(User).filter( User.name=='ed', User.fullname=='Ed Jones') _row = query.first() print(_row.name, _row.fullname, _row.birth) print("\n----> OR:") query = session.query(User).filter( or_(User.name=='ed', User.name=='wendy')) for _row in query.all(): print(_row.name, _row.fullname, _row.birth) print("\n----> NULL:") query = session.query(User).filter(User.birth == None) for _row in query.all(): print(_row.name, _row.fullname) print("\n----> NOT NULL:") query = session.query(User).filter(User.birth != None) for _row in query.all(): print(_row.name, _row.fullname) print("\n----> LIKE") query = session.query(User).filter(User.name.like('%ed%')) for _row in query.all(): print(_row.name, _row.fullname) output: .. code-block:: bash ----> order_by(id): ed Ed Jones 1989-07-01 00:00:00 wendy Wendy Williams 1983-04-01 00:00:00 mary Mary Contrary 1990-01-30 00:00:00 fred Fred Flinstone 1977-03-12 00:00:00 justin Justin Bieber None ----> order_by(desc(id)): justin Justin Bieber None fred Fred Flinstone 1977-03-12 00:00:00 mary Mary Contrary 1990-01-30 00:00:00 wendy Wendy Williams 1983-04-01 00:00:00 ed Ed Jones 1989-07-01 00:00:00 ----> order_by(date): fred Fred Flinstone 1977-03-12 00:00:00 wendy Wendy Williams 1983-04-01 00:00:00 ed Ed Jones 1989-07-01 00:00:00 mary Mary Contrary 1990-01-30 00:00:00 justin Justin Bieber None ----> EQUAL: wendy Wendy Williams 1983-04-01 00:00:00 ----> NOT EQUAL: ed Ed Jones 1989-07-01 00:00:00 mary Mary Contrary 1990-01-30 00:00:00 fred Fred Flinstone 1977-03-12 00:00:00 justin Justin Bieber None ----> IN: ed Ed Jones 1989-07-01 00:00:00 wendy Wendy Williams 1983-04-01 00:00:00 ----> NOT IN: mary Mary Contrary 1990-01-30 00:00:00 fred Fred Flinstone 1977-03-12 00:00:00 justin Justin Bieber None ----> AND: ed Ed Jones 1989-07-01 00:00:00 ----> OR: ed Ed Jones 1989-07-01 00:00:00 wendy Wendy Williams 1983-04-01 00:00:00 ----> NULL: justin Justin Bieber ----> NOT NULL: ed Ed Jones wendy Wendy Williams mary Mary Contrary fred Fred Flinstone ----> LIKE ed Ed Jones fred Fred Flinstone mapper: Map ``Table`` to ``class`` ----------------------------------- .. code-block:: python from sqlalchemy import ( create_engine, Table, MetaData, Column, Integer, String, ForeignKey) from sqlalchemy.orm import ( mapper, relationship, sessionmaker) # classical mapping: map "table" to "class" db_url = 'sqlite://' engine = create_engine(db_url) meta = MetaData(bind=engine) user = Table('User', meta, Column('id', Integer, primary_key=True), Column('name', String), Column('fullname', String), Column('password', String)) addr = Table('Address', meta, Column('id', Integer, primary_key=True), Column('email', String), Column('user_id', Integer, ForeignKey('User.id'))) # map table to class class User(object): def __init__(self, name, fullname, password): self.name = name self.fullname = fullname self.password = password class Address(object): def __init__(self, email): self.email = email mapper(User, user, properties={ 'addresses': relationship(Address, backref='user')}) mapper(Address, addr) # create table meta.create_all() # create session Session = sessionmaker() Session.configure(bind=engine) session = Session() u = User(name='Hello', fullname='HelloWorld', password='ker') a = Address(email='[email protected]') u.addresses.append(a) try: session.add(u) session.commit() # query result u = session.query(User).filter(User.name == 'Hello').first() print(u.name, u.fullname, u.password) finally: session.close() output: .. code-block:: bash $ python map_table_class.py Hello HelloWorld ker Get table dynamically ---------------------- .. code-block:: python from sqlalchemy import ( create_engine, MetaData, Table, inspect, Column, String, Integer) from sqlalchemy.orm import ( mapper, scoped_session, sessionmaker) db_url = "sqlite://" engine = create_engine(db_url) metadata = MetaData(engine) class TableTemp(object): def __init__(self, name): self.name = name def get_table(name): if name in metadata.tables: table = metadata.tables[name] else: table = Table(name, metadata, Column('id', Integer, primary_key=True), Column('name', String)) table.create(engine) cls = type(name.title(), (TableTemp,), {}) mapper(cls, table) return cls # get table first times t = get_table('Hello') # get table secone times t = get_table('Hello') Session = scoped_session(sessionmaker(bind=engine)) try: Session.add(t(name='foo')) Session.add(t(name='bar')) for _ in Session.query(t).all(): print(_.name) except Exception as e: Session.rollback() finally: Session.close() output: .. code-block:: bash $ python get_table.py foo bar Object Relational join two tables ---------------------------------- .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.orm import relationship from sqlalchemy.engine.url import URL from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): __tablename__ = 'user' id = Column(Integer, primary_key=True) name = Column(String) addresses = relationship("Address", backref="user") class Address(Base): __tablename__ = 'address' id = Column(Integer, primary_key=True) email = Column(String) user_id = Column(Integer, ForeignKey('user.id')) db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} # create engine engine = create_engine(URL(**db_url)) # create tables Base.metadata.create_all(bind=engine) # create session Session = sessionmaker() Session.configure(bind=engine) session = Session() user = User(name='user1') mail1 = Address(email='[email protected]') mail2 = Address(email='[email protected]') user.addresses.extend([mail1, mail2]) session.add(user) session.add_all([mail1, mail2]) session.commit() query = session.query(Address, User).join(User) for _a, _u in query.all(): print(_u.name, _a.email) output: .. code-block:: bash $ python sqlalchemy_join.py user1 [email protected] user1 [email protected] join on relationship and group_by count ---------------------------------------- .. code-block:: python from sqlalchemy import ( create_engine, Column, String, Integer, ForeignKey, func) from sqlalchemy.orm import ( relationship, sessionmaker, scoped_session) from sqlalchemy.ext.declarative import declarative_base db_url = 'sqlite://' engine = create_engine(db_url) Base = declarative_base() class Parent(Base): __tablename__ = 'parent' id = Column(Integer, primary_key=True) name = Column(String) children = relationship('Child', back_populates='parent') class Child(Base): __tablename__ = 'child' id = Column(Integer, primary_key=True) name = Column(String) parent_id = Column(Integer, ForeignKey('parent.id')) parent = relationship('Parent', back_populates='children') Base.metadata.create_all(bind=engine) Session = scoped_session(sessionmaker(bind=engine)) p1 = Parent(name="Alice") p2 = Parent(name="Bob") c1 = Child(name="foo") c2 = Child(name="bar") c3 = Child(name="ker") c4 = Child(name="cat") p1.children.extend([c1, c2, c3]) p2.children.append(c4) try: Session.add(p1) Session.add(p2) Session.commit() # count number of children q = Session.query(Parent, func.count(Child.id))\ .join(Child)\ .group_by(Parent.id) # print result for _p, _c in q.all(): print('parent: {}, num_child: {}'.format(_p.name, _c)) finally: Session.remove() output: .. code-block:: bash $ python join_group_by.py parent: Alice, num_child: 3 parent: Bob, num_child: 1 Create tables with dynamic columns (ORM) ------------------------------------------ .. code-block:: python from sqlalchemy import create_engine from sqlalchemy import Column, Integer, String from sqlalchemy import inspect from sqlalchemy.engine.url import URL from sqlalchemy.ext.declarative import declarative_base db_url = {'drivername': 'postgres', 'username': 'postgres', 'password': 'postgres', 'host': '192.168.99.100', 'port': 5432} engine = create_engine(URL(**db_url)) Base = declarative_base() def create_table(name, cols): Base.metadata.reflect(engine) if name in Base.metadata.tables: return table = type(name, (Base,), cols) table.__table__.create(bind=engine) create_table('Table1', { '__tablename__': 'Table1', 'id': Column(Integer, primary_key=True), 'name': Column(String)}) create_table('Table2', { '__tablename__': 'Table2', 'id': Column(Integer, primary_key=True), 'key': Column(String), 'val': Column(String)}) inspector = inspect(engine) for _t in inspector.get_table_names(): print(_t) output: .. code-block:: bash $ python sqlalchemy_dynamic_orm.py Table1 Table2 Close database connection -------------------------- .. code-block:: python from sqlalchemy import ( create_engine, event, Column, Integer) from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base engine = create_engine('sqlite://') base = declarative_base() @event.listens_for(engine, 'engine_disposed') def receive_engine_disposed(engine): print("engine dispose") class Table(base): __tablename__ = 'example table' id = Column(Integer, primary_key=True) base.metadata.create_all(bind=engine) session = sessionmaker(bind=engine)() try: try: row = Table() session.add(row) except Exception as e: session.rollback() raise finally: session.close() finally: engine.dispose() output: .. code-block:: bash $ python db_dispose.py engine dispose .. warning:: Be careful. Close *session* does not mean close database connection. SQLAlchemy *session* generally represents the *transactions*, not connections. Cannot use the object after close the session ----------------------------------------------- .. code-block:: python from __future__ import print_function from sqlalchemy import ( create_engine, Column, String, Integer) from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base url = 'sqlite://' engine = create_engine(url) base = declarative_base() class Table(base): __tablename__ = 'table' id = Column(Integer, primary_key=True) key = Column(String) val = Column(String) base.metadata.create_all(bind=engine) session = sessionmaker(bind=engine)() try: t = Table(key="key", val="val") try: print(t.key, t.val) session.add(t) session.commit() except Exception as e: print(e) session.rollback() finally: session.close() print(t.key, t.val) # exception raise from here except Exception as e: print("Cannot use the object after close the session") finally: engine.dispose() output: .. code-block:: bash $ python sql.py key val Cannot use the object after close the session Hooks ----- .. code-block:: python from sqlalchemy import Column, String, Integer from sqlalchemy import create_engine from sqlalchemy import event from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import scoped_session from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): __tablename__ = "user" id = Column(Integer, primary_key=True) name = Column(String) age = Column(Integer) url = "sqlite:///:memory:" engine = create_engine(url) Base.metadata.create_all(bind=engine) Session = sessionmaker(bind=engine) @event.listens_for(User, "before_insert") def before_insert(mapper, connection, user): print(f"before insert: {user.name}") @event.listens_for(User, "after_insert") def after_insert(mapper, connection, user): print(f"after insert: {user.name}") try: session = scoped_session(Session) user = User(name="bob", age=18) session.add(user) session.commit() except SQLAlchemyError as e: session.rollback() finally: session.close()
{ "content_hash": "9c4dbe6fa035a5d7085e55ab097665f2", "timestamp": "", "source": "github", "line_count": 1874, "max_line_length": 106, "avg_line_length": 25.51120597652081, "alnum_prop": 0.5759914658634538, "repo_name": "crazyguitar/pysheeet", "id": "282ae1fa5e208bca6bad2af95629fa6c9d89ec07", "size": "47808", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/notes/python-sqlalchemy.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Makefile", "bytes": "518" }, { "name": "Procfile", "bytes": "57" }, { "name": "Python", "bytes": "7098" } ], "symlink_target": "" }
package camelinaction.timeout; import java.util.Map; import org.apache.camel.Endpoint; import org.apache.camel.impl.UriEndpointComponent; public class TimeoutComponent extends UriEndpointComponent { public TimeoutComponent() { super(TimeoutEndpoint.class); } @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { TimeoutEndpoint answer = new TimeoutEndpoint(uri, this); answer.setName(remaining); return answer; } }
{ "content_hash": "5a663c884057a3d2308fbf093810536c", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 118, "avg_line_length": 27.2, "alnum_prop": 0.7352941176470589, "repo_name": "sprklinginfo/camelinaction2", "id": "b6578f746b3fa00dcaf063b8dd8ebef81b8b7fed", "size": "544", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chapter13/scalability/src/test/java/camelinaction/timeout/TimeoutComponent.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1045311" }, { "name": "Scala", "bytes": "12829" }, { "name": "Shell", "bytes": "165" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Common.Models { // 3.2.1.5.1 Predictions about the future performance/value of funds will be available, using existing prediction algorithms. (This is the fund projector which does the calculations for the predictions.) public class FundProjector { // How many days we will project for public const int projectionLimit = 3; public FundProjector(ITimeSeriesFundData fundentity, DateTime nowDate) { NowDate = nowDate.Date; Fund = fundentity; Projection = new List<float>(); doProjection(); } private DateTime NowDate { get; set; } private ITimeSeriesFundData Fund { get; set; } public List<float> Projection { get; set; } /* * Implements the Average(Average, Average Drift Combination) prediction. * * First, claculate the Average Drift Combination prediction based on data from the last 6 months, (or less if data unavailable). * Take the average of the data (y1), pair with the midpoint (x1) of the data, and draw a line to the current value (x2, y2), extrapolate out one day. * * Second, take the Average Drift Combination, and the average value for the last 6 months and average the two values for the result. */ private void doProjection() { // Get the relevant historic data Tuple<List<float>, List<DateTime>> historic = this.Fund.GetDataInRange(this.NowDate.AddDays(-180), this.NowDate, this.NowDate); List<float> histVals = historic.Item1; List<DateTime> histDates = historic.Item2; removeNaNs(histVals, histDates); // Initialize some vars we will use float avg, count, avgDrift, result; float curVal = this.Fund.CurrentValue; // Calculate the projection for as many days as we can (somewhat reliably) project for, up to the projectionLimit for (int i = 0; i < projectionLimit; i++) { avg = histVals.Average(); count = histDates.Count; avgDrift = (curVal - avg) / ((count - 1) / 2) + curVal; result = (avgDrift + avg) / 2; histVals.Add(result); histDates.Add(histDates.Last().AddDays(1)); this.Projection.Add(result); curVal = result; } } private void removeNaNs(List<float> vals, List<DateTime> dates) { int i = 0; while (i < vals.Count) { if (float.IsNaN(vals[i])) { vals.RemoveAt(i); dates.RemoveAt(i); } else { i++; } } } } }
{ "content_hash": "4b35c606f3256661d1078ff8825d00e8", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 208, "avg_line_length": 36.864197530864196, "alnum_prop": 0.5656396517079705, "repo_name": "edegraff/FundTracker", "id": "ba891a3edaa43cc8ae3ad1ed72f3e500dc1bdc41", "size": "2988", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FundTracker/Common/Models/FundProjector.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "104" }, { "name": "C#", "bytes": "183724" }, { "name": "CSS", "bytes": "51230" }, { "name": "JavaScript", "bytes": "288945" } ], "symlink_target": "" }
<html> <head> <title> Standing up against Iraq sanctions </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php include "../../legacy-includes/Script.htmlf" ?> </head> <body bgcolor="#FFFFCC" text="000000" link="990000" vlink="660000" alink="003366" leftmargin="0" topmargin="0"> <table width="744" cellspacing="0" cellpadding="0" border="0"> <tr><td width="474"><a name="Top"></a><?php include "../../legacy-includes/TopLogo.htmlf" ?></td> <td width="270"><?php include "../../legacy-includes/TopAd.htmlf" ?> </td></tr></table> <table width="744" cellspacing="0" cellpadding="0" border="0"> <tr><td width="18" bgcolor="FFCC66"></td> <td width="108" bgcolor="FFCC66" valign=top><?php include "../../legacy-includes/LeftButtons.htmlf" ?></td> <td width="18"></td> <td width="480" valign="top"> <?php include "../../legacy-includes/BodyInsert.htmlf" ?> <P><font face="Times New Roman, Times, serif" size="4">Activist defies government prosecution threat</font><BR> <font face="Times New Roman, Times, serif" size="5"><b>Standing up against Iraq sanctions</b></font></P> <P><font face="Times New Roman, Times, serif" size="2"><b>By Elizabeth Schulte</b></font><font face="Arial, Helvetica, sans-serif" size="2"> | June 21, 2002 | Page 2</font></P> <font face="Times New Roman, Times, serif" size="3"><P>BERT SACKS could be the next stop on George W. Bush's "you're either with us or against us" witch-hunt. This week, federal prosecutors threatened Sacks with up to 12 years in jail for "aiding an enemy of the U.S." His crime? Transporting medical supplies to Iraq.</P> <P>In 1997, Sacks, a 60-year-old retired engineer from Seattle, traveled to Iraq with $40,000 worth of medicine, in violation of United Nations (UN) sanctions. He was ordered to pay a $10,000 fine by June 17 for violating the embargo --a fine he refuses to pay.</P> <P>The sanctions were imposed nearly 12 years ago. George Bush Sr.--and Bill Clinton after him--argued that the sanctions would weaken the power of Iraqi dictator Saddam Hussein. They also claimed that military sanctions were necessary to keep Saddam from manufacturing "weapons of mass destruction."</P> <P>But even an embargo on military goods would continue to ban items considered to have "dual uses"--such as cardiac machines, which are run by computers that UN officials argue could potentially be used to run weapons systems. The list of banned goods also includes vaccines to treat infant hepatitis, tetanus and diphtheria--because they could be used to produce biological weapons.</P> <P>During the 1991 Gulf War, thousands of Iraqi citizens were killed and much of the country's infrastructure destroyed in the U.S. government's relentless bombing campaign. The continued sanctions have heaped on more suffering and death.</P> <P>"We should speak in clear English," Sack said at a press conference in Washington, D.C. "It's killing 5,000 children a month. It's not honest; it's not accurate to say it penalizes the Iraqi people. It kills them."</P> <P>Sacks has made eight trips to Iraq over the last six years with several groups, including Voices in the Wilderness and Washington Physicians for Social Responsibility. His hope is that breaking the sanctions will shine a light on this sick policy. "If that truth gets out, then there's a chance for change," Sacks said.</P> <P>Sacks' case also highlights the important link to be made between Bush's war aims abroad--with Iraq on the short list of targets--and his attack on dissent at home. We have to oppose Bush's war--on all its fronts.</P> <?php include "../../legacy-includes/BottomNavLinks.htmlf" ?> <td width="12"></td> <td width="108" valign="top"> <?php include "../../legacy-includes/RightAdFolder.htmlf" ?> </td> </tr> </table> </body> </html>
{ "content_hash": "3a517db44aab0c51bd3b72a3ab7bd5f3", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 388, "avg_line_length": 73.03846153846153, "alnum_prop": 0.7332806740389679, "repo_name": "ISO-tech/sw-d8", "id": "8efbfe3fa7fce381dcb487295e5c3a95f5bd0989", "size": "3798", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "web/2002-2/411/411_02_BertSacks.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "30677" }, { "name": "Gherkin", "bytes": "3374" }, { "name": "HTML", "bytes": "269460" }, { "name": "Hack", "bytes": "35936" }, { "name": "JavaScript", "bytes": "104527" }, { "name": "PHP", "bytes": "53430607" }, { "name": "SCSS", "bytes": "50217" }, { "name": "Shell", "bytes": "8234" }, { "name": "Twig", "bytes": "57403" } ], "symlink_target": "" }
#include <iostream> using namespace std; #include <cstdlib> #include "randomindex.h" MTRand RandomIndex::mtrand_(0x12345); // Constant seed so that experiments can be repeated RandomIndex::RandomIndex(unsigned dims, unsigned *datarange, unsigned *numrind) : dims_(dims), datasat_(0), datanumel_(1), distnumel_(1), ritables_(NULL), riunroll_(NULL) { assert(__MIN(RIIndex) == 0); // Better be unsigned assert(__MIN(RIData) < 0); // Must be signed assert(dims > 0); unsigned i,j; ritables_ = new RITable* [dims]; riunroll_ = new unsigned [dims]; for(i=0; i<dims; i++) { ritables_[i] = new RITable(datarange[i], numrind[i]); datanumel_ *= datarange[i]; distnumel_ *= numrind[i]; riunroll_[i] = 1; // Lookup table for loop unrolling, row-major ordering for(j=i+1; j<dims_; j++) { riunroll_[i] *= numrind[j]; } } } RandomIndex::~RandomIndex() { if(ritables_ != NULL) { for(unsigned i=0; i<dims(); i++) { delete ritables_[i]; } delete[] ritables_; delete[] riunroll_; } } unsigned RandomIndex::setrange(unsigned dim, unsigned range) { assert(dim < dims_); return ritables_[dim]->rows(range); } unsigned RandomIndex::indexsize(void) const { unsigned i, s=0; for(i=0; i<dims_; i++) { s += ritables_[i]->size(); } return s; } void RandomIndex::encode(RIData *data, const unsigned *ind, RIData weight) { if(weight==0) return; // Nothing to do, return early unsigned i, *coli = new unsigned[dims_]; for(unsigned j=0; j<distnumel_; j++) { // Unrolled loop, row-major ordering RIData w = weight; unsigned temp=j, dataindex=0; for(i=0; i<dims_; i++) { coli[i] = temp / riunroll_[i]; temp -= coli[i] * riunroll_[i]; if(coli[i] >= ritables_[i]->numpositive()) w = -w; coli[i] = ritables_[i]->item(ind[i], coli[i]); dataindex = coli[i] + ritables_[i]->datarange()*dataindex; } long v = data[dataindex] + w; if(v >= __MIN(RIData) && v <= __MAX(RIData)) { data[dataindex] = v; } else { // Saturation logic datasat_ ++; if(v < __MIN(RIData)) { data[dataindex] = __MIN(RIData); } else { data[dataindex] = __MAX(RIData); } } } delete[] coli; } double RandomIndex::decode(const RIData *data, const unsigned *ind) const { double weight = 0; unsigned i, *coli = new unsigned[dims_]; for(unsigned j=0; j<distnumel_; j++) { // Unrolled loop, row-major ordering RIData s = 1; unsigned temp=j, dataindex=0; for(i=0; i<dims_; i++) { coli[i] = temp / riunroll_[i]; temp -= coli[i] * riunroll_[i]; if(coli[i] >= ritables_[i]->numpositive()) s = -s; coli[i] = ritables_[i]->item(ind[i], coli[i]); dataindex = coli[i] + ritables_[i]->datarange()*dataindex; } weight += s*data[dataindex]; } delete[] coli; return weight / distnumel_; } double RandomIndex::cosa(const RIData *d1, const unsigned *i1, const RIData *d2, const unsigned *i2) const { unsigned i, j, dnumel = 1; unsigned *coli1 = new unsigned[dims_]; unsigned *coli2 = new unsigned[dims_]; unsigned *unroll = new unsigned[dims_]; double weight = 0, norm1 = 0, norm2 = 0; for(i=0; i<dims_; i++) { if(i1[i]==Average || i2[i]==Average) { assert(i1[i] == i2[i]); dnumel *= ritables_[i]->datarange(); } else { dnumel *= ritables_[i]->cols(); } // Unrolling lookup table, row-major order unroll[i] = 1; for(j=i+1; j<dims_; j++) { if(i1[j] == Average) { unroll[i] *= ritables_[j]->datarange(); } else { unroll[i] *= ritables_[j]->cols(); } } } for(j=0; j<dnumel; j++) { // Unrolled loop, row-major order unsigned temp=j, dind1=0, dind2=0; for(i=0; i<dims_; i++) { coli1[i] = coli2[i] = temp / unroll[i]; temp -= coli1[i] * unroll[i]; if(i1[i] != Average) { // Get random index coli1[i] = ritables_[i]->item(i1[i], coli1[i]); coli2[i] = ritables_[i]->item(i2[i], coli2[i]); } dind1 = coli1[i] + ritables_[i]->datarange()*dind1; dind2 = coli2[i] + ritables_[i]->datarange()*dind2; } weight += d1[dind1]*d2[dind2]; // RI signs cancel norm1 += d1[dind1]*d1[dind1]; norm2 += d2[dind2]*d2[dind2]; } delete[] coli1; delete[] coli2; delete[] unroll; return weight / sqrt(norm1*norm2); } unsigned long RandomIndex::saturation(void) const { return datasat_; } RandomIndex::RITable::RITable(unsigned datarange, unsigned cols) : datarange_(datarange), cols_(cols), rows_(0), table_(NULL) { assert(datarange_ <= __MAX(RIIndex)); // Range of RIIndex type assert(!(cols_ & 0x1)); // Even number of cols assert(cols_ < datarange_); // Necessary for unique indices } RandomIndex::RITable::~RITable() { if(table_ != NULL) { free(table_); table_ = NULL; } } unsigned RandomIndex::RITable::rows(unsigned n) { unsigned i0=rows_, i, j, k, upper=datarange_-1; if(n > rows_) { // Add rows to table? if(table_ != NULL) { table_ = (RIIndex *)realloc(table_, n*cols_*sizeof(RIIndex)); } else { table_ = (RIIndex *)malloc(n*cols_*sizeof(RIIndex)); } assert(table_ != NULL); rows_ = n; for(i=i0; i<rows_; i++) { // For each new row for(j=0; j<cols_; j++) { // ... and for each random index RIIndex rnd; while(true) { // Generate unique index in [0,upper] rnd = RandomIndex::mtrand_.randInt(upper); for(k=0; k<j; k++) { if(item(i,k) == rnd) k=cols_; } if(k<cols_) break; } // Linear search, short list item(i,j) = rnd; } } } return rows_; } /* Changelog v1.0 First release on http://github.com/fresan/nri v0.4.1 - Corrected a bug in RandomIndex::RITable::rows() v0.4.0 - Rewrite of code. A RandomIndex class is defined that only specifies the random indexing tables and methods needed to encode, decode and approximate inner products given data arrays that are defined by the user. This way it becomes possible to combine explicit and random indexing without hardcoding of special cases. This design simplifies the code and makes it more flexible and easy to use. - File I/O has not been ported/implemented in this version, nor templates or the Matlab/MEX interface. v0.3.1 - Updated an assert statement in stateSize() that was incompatible with one-way indexing. v0.3.0 - Made randinit() compatible with one-way indexing. This special case was omitted in the initial implementation. Early developments not documented. EOF */
{ "content_hash": "4e2107e6cbaf824888674d1d15545985", "timestamp": "", "source": "github", "line_count": 224, "max_line_length": 92, "avg_line_length": 32.370535714285715, "alnum_prop": 0.545579920011033, "repo_name": "fresan/nri", "id": "137bd4501b84c54c262df98a4b049aa136b0ca0e", "size": "7443", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "randomindex.cc", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "15148" }, { "name": "Makefile", "bytes": "136" } ], "symlink_target": "" }
package com.danimaniarqsoft.asterix.commands; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.shell.core.CommandMarker; import com.danimaniarqsoft.asterix.core.operations.AbstractCommandOperation; import com.danimaniarqsoft.asterix.validators.MavenLayerValidator; public abstract class Command implements CommandMarker { protected AbstractCommandOperation operation; @Autowired protected MavenLayerValidator mavenValidator; }
{ "content_hash": "11126f124b579835b0d630e7927b4622", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 76, "avg_line_length": 39.416666666666664, "alnum_prop": 0.8710359408033826, "repo_name": "danimaniarqsoft/asterix-gen", "id": "f24bef80634f5e748235add0bc0104d80c2e9676", "size": "473", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "asterix-modules/asterix/src/main/java/com/danimaniarqsoft/asterix/commands/Command.java", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "8433" }, { "name": "Java", "bytes": "433405" } ], "symlink_target": "" }
class Browser; namespace content { class WebContentsDelegate; } // Listens for media devices attached to the system. When such are detected, // translates the notification into a Web Intents dispatch. // The intent payload is: // action = "chrome-extension://attach" // type = "chrome-extension://filesystem" // root_path = the File Path at which the device is accessible // filesystem_id = registered isolated file system identifier class DeviceAttachedIntentSource : public base::SystemMonitor::DevicesChangedObserver { public: DeviceAttachedIntentSource(Browser* browser, content::WebContentsDelegate* delegate); virtual ~DeviceAttachedIntentSource(); // base::SystemMonitor::DevicesChangedObserver implementation. virtual void OnMediaDeviceAttached( const std::string& id, const string16& name, base::SystemMonitor::MediaDeviceType type, const FilePath::StringType& location) OVERRIDE; private: // Weak pointer to browser to which intents will be dispatched. Browser* browser_; content::WebContentsDelegate* delegate_; DISALLOW_COPY_AND_ASSIGN(DeviceAttachedIntentSource); }; #endif // CHROME_BROWSER_INTENTS_DEVICE_ATTACHED_INTENT_SOURCE_H_
{ "content_hash": "86b571f8a78e6acc725ca8e487207d35", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 76, "avg_line_length": 34.333333333333336, "alnum_prop": 0.7419093851132686, "repo_name": "keishi/chromium", "id": "96fd51caa5c3a458ad63c085a42be1fb76847d3a", "size": "1584", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chrome/browser/intents/device_attached_intent_source.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "853" }, { "name": "Arduino", "bytes": "464" }, { "name": "Assembly", "bytes": "1172794" }, { "name": "C", "bytes": "67452317" }, { "name": "C#", "bytes": "1132" }, { "name": "C++", "bytes": "132681259" }, { "name": "F#", "bytes": "381" }, { "name": "Go", "bytes": "19048" }, { "name": "Java", "bytes": "361412" }, { "name": "JavaScript", "bytes": "16603687" }, { "name": "Objective-C", "bytes": "9609581" }, { "name": "PHP", "bytes": "97796" }, { "name": "Perl", "bytes": "918683" }, { "name": "Python", "bytes": "6407891" }, { "name": "R", "bytes": "524" }, { "name": "Shell", "bytes": "4192593" }, { "name": "Tcl", "bytes": "277077" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <Addin id="Banshee.Dap.MassStorage" version="1.0" compatVersion="1.0" copyright="Copyright 2008 Novell Inc., Copyright 2009 Jeff Wheeler. Licensed under the MIT X11 license." name="Mass Storage Media Player Support" category="Device Support" description="Support for USB-drive based devices, including many iAudio devices and Android, Pre, and Galaxy phones." author="Gabriel Burt, Aaron Bockover, Jeff Wheeler" url="http://banshee.fm/" defaultEnabled="true"> <Dependencies> <Addin id="Banshee.Dap" version="1.0"/> </Dependencies> <Extension path="/Banshee/Dap/DeviceClass"> <DeviceClass class="Banshee.Dap.MassStorage.MassStorageSource" priority="-10"/> </Extension> <ExtensionPoint path="/Banshee/Dap/MassStorage/Device"> <ExtensionNode name="MassStorageDevice" type="Banshee.Hardware.VendorProductDeviceNode"/> </ExtensionPoint> <!-- Any devices we wish to special case and support out of the box --> <Extension path="/Banshee/Dap/MassStorage/Device"> <MassStorageDevice class="Banshee.Dap.MassStorage.MaemoDevice" vendor-name="Nokia" product-name="Nokia N900 Phone" vendor-id="0x0421" product-id="0x01c7"/> <MassStorageDevice class="Banshee.Dap.MassStorage.SymbianDevice" vendor-name="Nokia" product-name="N95" vendor-id="0x0421" product-id="0x04ed"/> <!-- 0ff9 is the HTC Desire --> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="HTC" product-name="HTC Android Phone" vendor-id="0x0bb4" product-id="0x0c01,0x0c02,0x0ff9"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Google" product-name="Google Nexus One" vendor-id="0x18d1" product-id="0x4e11,0x4e12"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Google" product-name="Google Nexus S" vendor-id="0x18d1" product-id="0x4e21,0x4e22"/> <!-- 681c/d are the Galaxy Portal --> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Samsung" product-name="Samsung Galaxy" vendor-id="0x04e8" product-id="0x6603,0x6601,0x6640,0x681d,0x681c,0x685b,0x685c,0x685e,0x6860,0x689e"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Motorola" product-name="Motorola Droid" vendor-id="0x22b8" product-id="0x41d9,0x41db"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Motorola" product-name="Motorola Droid X" vendor-id="0x22b8" product-id="0x4285"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Motorola" product-name="Motorola CLIQ/DEXT" vendor-id="0x22b8" product-id="0x2d67"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Motorola" product-name="Atrix" vendor-id="0x22b8" product-id="0x7086"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Huawei" product-name="Pulse" vendor-id="0x12d1" product-id="0x1501"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Huawei" product-name="Ideos" vendor-id="0x12d1" product-id="0x1037,0x1038"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Sony Ericsson" product-name="Xperia X10" vendor-id="0x0fce" product-id="0xd12e,0xe12e,0x2138,0x3138"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Sony Ericsson" product-name="Xperia arc" vendor-id="0x0fce" product-id="0xe14f,0x614f"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="LG Electronics Inc." product-name="LG Android Phone" vendor-id="0x1004" product-id="0x618e,0x618f,61c6"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="LG Electronics Inc." product-name="LG Optimus S" vendor-id="0x1004" product-id="0x61cc"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Pantech" product-name="Sirius Alpha" vendor-id="0x10a9" product-id="0x6021"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Sharp" product-name="IS01" vendor-id="0x04dd" product-id="0x9337"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Sharp" product-name="IS03" vendor-id="0x04dd" product-id="0x939a"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Notion Ink" product-name="Adam" vendor-id="0x0955" product-id="0x7100"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="NEC Corp." product-name="LifeTouch Note" vendor-id="0x0409" product-id="0x0300,0x0301"/> <MassStorageDevice class="Banshee.Dap.MassStorage.AndroidDevice" vendor-name="Archos" product-name="Internet Tablet" vendor-id="0x0e79" product-id="0x1417"/> <MassStorageDevice class="Banshee.Dap.MassStorage.WebOSDevice" vendor-name="Palm" product-name="Pre" vendor-id="0x0830" product-id="0x8004,0x8002"/> <MassStorageDevice class="Banshee.Dap.MassStorage.NookDevice" vendor-name="Barnes and Noble" product-name="Nook Classic" vendor-id="0x2080" product-id="0x001"/> </Extension> </Addin>
{ "content_hash": "dd1b710469e09c487a4a8fefae51afdb", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 121, "avg_line_length": 52.923809523809524, "alnum_prop": 0.704876732049667, "repo_name": "Dynalon/banshee-osx", "id": "9735d33d6d66bfa0b465e9ca1047fcc8bc67cc5f", "size": "5557", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage.addin.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Boo", "bytes": "3305" }, { "name": "C", "bytes": "228979" }, { "name": "C#", "bytes": "5860829" }, { "name": "C++", "bytes": "13690" }, { "name": "JavaScript", "bytes": "7633" }, { "name": "Perl", "bytes": "6338" }, { "name": "Python", "bytes": "8488" }, { "name": "R", "bytes": "3362" }, { "name": "Shell", "bytes": "33196" } ], "symlink_target": "" }
<p>Persian calendar</p> <ngb-datepicker #dp [(ngModel)]="model" (navigate)="date = $event.next" [firstDayOfWeek]="6"> </ngb-datepicker> <hr/> <button class="btn btn-sm btn-outline-primary mr-2" (click)="selectToday()">Select Today</button> <button class="btn btn-sm btn-outline-primary mr-2" (click)="dp.navigateTo()">To current month</button> <button class="btn btn-sm btn-outline-primary mr-2" (click)="dp.navigateTo({year: 1396, month: 4})">To Tir. 1396</button> <hr/> <pre>Month: {{ date.month }}.{{ date.year }}</pre> <pre>Model: {{ model | json }}</pre>
{ "content_hash": "a18d14631bcf4b4414ac2c09ae217113", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 121, "avg_line_length": 35.11764705882353, "alnum_prop": 0.6331658291457286, "repo_name": "ktriek/ng-bootstrap", "id": "f57bda1e1e0187f357fb15c0797084a37707040c", "size": "597", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "demo/src/app/components/datepicker/demos/jalali/datepicker-jalali.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "80" }, { "name": "HTML", "bytes": "324" }, { "name": "JavaScript", "bytes": "52248" }, { "name": "Shell", "bytes": "2096" }, { "name": "TypeScript", "bytes": "1060948" } ], "symlink_target": "" }
ACCEPTED #### According to Interim Register of Marine and Nonmarine Genera #### Published in null #### Original name null ### Remarks null
{ "content_hash": "0e95632abc0f97516aef4e3efb7784f4", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 47, "avg_line_length": 10.923076923076923, "alnum_prop": 0.7183098591549296, "repo_name": "mdoering/backbone", "id": "154692ca25cdf11afb862f968f89ae11ebacaea0", "size": "198", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Protozoa/Acritarcha/Estiastra/Estiastra granulata/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?php function my_login_logo() { ?> <style type="text/css"> body.login{color: #95a1c2;background-color: #162834;} body.login div#login h1 a { background-image: url(<?php echo get_bloginfo( 'template_directory' ) ?>/images/logo-flat.png); padding-bottom: 30px; } body.login #loginform{box-shadow: none;} a{text-shadow: none;} a{color: #FFF;text-decoration: none;} a:hover{color: #ffba00;transition:color 0.5s ease;} a img:hover{opacity: 0.7;transition:opacity 0.3s ease;} </style> <?php } add_action( 'login_enqueue_scripts', 'my_login_logo' ); function my_login_logo_url() { return get_bloginfo( 'url' ); } add_filter( 'login_headerurl', 'my_login_logo_url' ); function my_login_logo_url_title() { return 'Freepod, libère ton podcast'; } add_filter( 'login_headertitle', 'my_login_logo_url_title' );
{ "content_hash": "c4341ebcecafa23cabd78ea39fa364b3", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 107, "avg_line_length": 32.851851851851855, "alnum_prop": 0.6381059751972943, "repo_name": "freepod/Freepod-Web", "id": "bba662982e3e2f46eb37064078c308a65ae7d605", "size": "888", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "functions.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "37904" }, { "name": "JavaScript", "bytes": "16490" } ], "symlink_target": "" }
<?php use yii\db\Schema; use yii\db\Migration; class m150330_223353_amilna_yes_sku extends Migration { public function safeUp() { $this->addColumn( $this->db->tablePrefix.'yes_product', 'sku', Schema::TYPE_STRING . '(65)' ); } public function safeDown() { echo "m150330_223353_amilna_yes_sku cannot be reverted.\n"; return false; } /* // Use safeUp/safeDown to run migration code within a transaction public function safeUp() { } public function safeDown() { } */ }
{ "content_hash": "ed963df844b685df1e92910935005624", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 96, "avg_line_length": 18.6, "alnum_prop": 0.600358422939068, "repo_name": "amilna/yes", "id": "2baf8a4a243d367b4f1e25994a3d1bf03fb6afab", "size": "558", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "migrations/m150330_223353_amilna_yes_sku.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "358329" } ], "symlink_target": "" }
define(['modules/converters/MusicCSLJson/src/BarModel_CSLJson', 'modules/core/src/BarModel'], function(BarModel_CSLJson, BarModel) { return { run: function() { test("BarModel_CSLJson", function(assert) { var bar = new BarModel(); var t = BarModel_CSLJson.exportToMusicCSLJSON(bar); assert.deepEqual(t, {}); var bar2 = new BarModel({ begining: undefined, clef: 'treble', ending: 'BEGIN', style: 'Pop', timeSignatureChange: '3/4', keySignatureChange: 'F', label: 'coda', sublabel: 'Ds al fine' }); t = BarModel_CSLJson.exportToMusicCSLJSON(bar2); var importBarObj = { clef: 'treble', ending: 'BEGIN', style: 'Pop', timeSignature: '3/4', keySignature: 'F', coda: 1, sublabel: 'Ds al fine' }; assert.deepEqual(t, importBarObj); var newBar = BarModel_CSLJson.importFromMusicCSLJSON(importBarObj); assert.equal(newBar.getClef(), 'treble'); assert.equal(newBar.getEnding(), 'BEGIN'); assert.equal(newBar.getStyle(), 'Pop'); assert.equal(newBar.getTimeSignatureChange(), '3/4'); assert.equal(newBar.getKeySignatureChange(), 'F'); assert.equal(newBar.getLabel(), 'coda'); assert.equal(newBar.getSublabel(), 'Ds al fine'); }); } }; });
{ "content_hash": "f85e5ae87dee04660d3d4701f2754cdc", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 132, "avg_line_length": 29.930232558139537, "alnum_prop": 0.6317016317016317, "repo_name": "dmmz/LeadsheetJS", "id": "9386d19291b30cd46043e323dc2ed1567c450f7a", "size": "1287", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "modules/converters/MusicCSLJson/test/testBarModel_CSLJson.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "9621" }, { "name": "HTML", "bytes": "25543" }, { "name": "JavaScript", "bytes": "1378477" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>PMD 5.5.1 Reference Package net.sourceforge.pmd.lang.dfa.pathfinder</title> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="style" /> </head> <body> <h3> <a href="package-summary.html" target="classFrame">net.sourceforge.pmd.lang.dfa.pathfinder</a> </h3> <h3>Classes</h3> <ul> <li> <a href="CurrentPath.html" target="classFrame">CurrentPath</a> </li> <li> <a href="DAAPathFinder.html" target="classFrame">DAAPathFinder</a> </li> <li> <a href="Executable.html" target="classFrame">Executable</a> </li> <li> <a href="PathElement.html" target="classFrame">PathElement</a> </li> </ul> </body> </html>
{ "content_hash": "3564ac1fbf685d16fd3f2b8734ecd6ea", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 121, "avg_line_length": 34.875, "alnum_prop": 0.5385304659498208, "repo_name": "jasonwee/videoOnCloud", "id": "dd9a87a7ae3758e3c04dbb21dc44f5d0d1ee6c44", "size": "1117", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pmd/pmd-doc-5.5.1/xref/net/sourceforge/pmd/lang/dfa/pathfinder/package-frame.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "116270" }, { "name": "C", "bytes": "2209717" }, { "name": "C++", "bytes": "375267" }, { "name": "CSS", "bytes": "1134648" }, { "name": "Dockerfile", "bytes": "1656" }, { "name": "HTML", "bytes": "306558398" }, { "name": "Java", "bytes": "1465506" }, { "name": "JavaScript", "bytes": "9028509" }, { "name": "Jupyter Notebook", "bytes": "30907" }, { "name": "Less", "bytes": "107003" }, { "name": "PHP", "bytes": "856" }, { "name": "PowerShell", "bytes": "77807" }, { "name": "Pug", "bytes": "2968" }, { "name": "Python", "bytes": "1001861" }, { "name": "R", "bytes": "7390" }, { "name": "Roff", "bytes": "3553" }, { "name": "Shell", "bytes": "206191" }, { "name": "Thrift", "bytes": "80564" }, { "name": "XSLT", "bytes": "4740" } ], "symlink_target": "" }
/* * Camera Following * * Author: Booil Ted Joung * Email : [email protected] * * */ using UnityEngine; using System.Collections; public class CameraBehaviour : MonoBehaviour { public GameObject target; // Update is called once per frame void Update () { this.transform.position = this.target.transform.position + (-this.target.transform.forward * 7f) + (this.target.transform.up * 4f); this.transform.LookAt(this.target.transform.position + this.target.transform.up*1f); } }
{ "content_hash": "2a05d52f9ef0137c2858181bdc422a97", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 133, "avg_line_length": 21.82608695652174, "alnum_prop": 0.7191235059760956, "repo_name": "booiljoung/unitywallclimb", "id": "427d0883dfeac314bb7a9507f454b3711f10bd9b", "size": "502", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Assets/Scripts/CameraBehaviour.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "3024" } ], "symlink_target": "" }
from django.db import models from ourplaylists.app.adapters import NETWORKS class PlaylistItem(models.Model): id = models.AutoField(primary_key=True) network_id = models.CharField(max_length=20) title = models.CharField(max_length=300) url = models.CharField(max_length=300, null=True) playlist = models.ForeignKey("app.Playlist") network = models.CharField(max_length=30, null=True, choices=zip(NETWORKS.keys(), NETWORKS.keys())) created_at = models.DateTimeField(auto_now_add=True)
{ "content_hash": "32df78d8b31d1b63f1bcac9da0c9af89", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 103, "avg_line_length": 39.61538461538461, "alnum_prop": 0.7398058252427184, "repo_name": "m-vdb/ourplaylists", "id": "a06b26e2cbdda771a4d0355aac6ca8b7ad2d6be2", "size": "515", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ourplaylists/app/models/playlist_item.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "417" }, { "name": "JavaScript", "bytes": "6977" }, { "name": "Python", "bytes": "19657" } ], "symlink_target": "" }
'use strict'; /** * Checks to see if a given object is a binary search tree. The binary search * tree must be used with .left, .right, and .value where the left and right * properties are nodes and value is a Number * * @param {Node} root * @return {Boolean} */ function isBst(root) { if (!root || root.value == null) { return false; } var prev; return (function isNode(node) { if (!node) { return true; } if (!isNode(node.left, prev)) { return false; } if (prev && prev.value >= node.value) { return false; } prev = node; return isNode(node.right); })(root); } module.exports = isBst;
{ "content_hash": "24b2ba610163515c3351ff81ea29fcf9", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 77, "avg_line_length": 25, "alnum_prop": 0.632, "repo_name": "ksmithut/problems-and-examples", "id": "09e3436fd8a7c0ca3f93e8a51909c491807edea4", "size": "625", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "solutions/javascript/binary-search-tree-check.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "18968" } ], "symlink_target": "" }
package dao; import java.util.List; import model.ActivityRecord; public interface ActivityRecordDao { public void add(ActivityRecord activityRecord); public void update(ActivityRecord activityRecord); public void delete(ActivityRecord activityRecord); public List<ActivityRecord> getActivityRecordList(String column ,Object value); public List<ActivityRecord> getAllActivityRecord(); }
{ "content_hash": "bf24abd87175963182479eb30afc80d4", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 80, "avg_line_length": 31.307692307692307, "alnum_prop": 0.800982800982801, "repo_name": "Boykilotherm/HealthClub", "id": "ca574910c8f379d89620504acd967f5aea31b77c", "size": "407", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/dao/ActivityRecordDao.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1560" }, { "name": "Java", "bytes": "44305" } ], "symlink_target": "" }
// This may look like C code, but it's really -*- C++ -*- #ifndef EXT_LAYOUT_ITEM_IMPL_H_ #define EXT_LAYOUT_ITEM_IMPL_H_ #include "Wt/WLayoutItemImpl" #include "Wt/WObject" namespace Wt { class WWidget; class DomElement; namespace Ext { class Container; class LayoutImpl; class LayoutItemImpl : public WLayoutItemImpl, public WObject { public: LayoutItemImpl(); virtual ~LayoutItemImpl(); virtual void update(WLayoutItem *); virtual Container *container() const; virtual WLayoutItem *layoutItem() const = 0; virtual WWidget *parentWidget() const; virtual void setHint(const std::string& name, const std::string& value); protected: virtual void createComponent(DomElement *parentContainer) = 0; virtual std::string componentVar() const = 0; virtual std::string componentId() const = 0; virtual void containerAddWidgets(Container *container) = 0; void addConfig(std::ostream& config); LayoutImpl *parentLayoutImpl() const; virtual void getLayoutChanges(const std::string& parentId, std::vector<DomElement *>& result); private: friend class LayoutImpl; friend class Container; }; } } #endif // EXT_LAYOUT_ITEM_IMPL_H_
{ "content_hash": "c30b0743a04381e08d1b3e95751e52fa", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 74, "avg_line_length": 23.294117647058822, "alnum_prop": 0.7188552188552189, "repo_name": "sanathkumarv/RestAPIWt", "id": "8da75a9b21cfd19d5822ed967a461288a352eec6", "size": "1293", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "tools/wt-3.3.5-rc1/src/Wt/Ext/LayoutItemImpl.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "134" }, { "name": "C++", "bytes": "154043" }, { "name": "CSS", "bytes": "59649" }, { "name": "HTML", "bytes": "2674" }, { "name": "Makefile", "bytes": "6608" }, { "name": "Shell", "bytes": "634" } ], "symlink_target": "" }
package org.gradle.api.internal.changedetection.changes; import org.gradle.StartParameter; import org.gradle.api.InvalidUserCodeException; import org.gradle.api.NonNullApi; import org.gradle.api.internal.TaskInternal; import org.gradle.api.internal.changedetection.TaskExecutionMode; import org.gradle.api.internal.changedetection.TaskExecutionModeResolver; import org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction; import org.gradle.api.internal.tasks.InputChangesAwareTaskAction; import org.gradle.api.internal.tasks.properties.TaskProperties; import org.gradle.api.specs.AndSpec; @NonNullApi public class DefaultTaskExecutionModeResolver implements TaskExecutionModeResolver { private final StartParameter startParameter; public DefaultTaskExecutionModeResolver(StartParameter startParameter) { this.startParameter = startParameter; } @Override public TaskExecutionMode getExecutionMode(TaskInternal task, TaskProperties properties) { if (task.getReasonNotToTrackState().isPresent()) { return TaskExecutionMode.UNTRACKED; } // Only false if no declared outputs AND no Task.upToDateWhen spec. We force to true for incremental tasks. AndSpec<? super TaskInternal> upToDateSpec = task.getOutputs().getUpToDateSpec(); if (!properties.hasDeclaredOutputs() && upToDateSpec.isEmpty()) { if (requiresInputChanges(task)) { throw new InvalidUserCodeException("You must declare outputs or use `TaskOutputs.upToDateWhen()` when using the incremental task API"); } else { return TaskExecutionMode.NO_OUTPUTS; } } if (startParameter.isRerunTasks()) { return TaskExecutionMode.RERUN_TASKS_ENABLED; } if (!upToDateSpec.isSatisfiedBy(task)) { return TaskExecutionMode.UP_TO_DATE_WHEN_FALSE; } return TaskExecutionMode.INCREMENTAL; } private static boolean requiresInputChanges(TaskInternal task) { for (InputChangesAwareTaskAction taskAction : task.getTaskActions()) { if (taskAction instanceof AbstractIncrementalTaskAction) { return true; } } return false; } }
{ "content_hash": "45d69d7dd7758b01367f067fa972326d", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 151, "avg_line_length": 38.644067796610166, "alnum_prop": 0.7197368421052631, "repo_name": "blindpirate/gradle", "id": "d23f9cfa2ecf58ed5507df500221c612ef925b52", "size": "2895", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "subprojects/core/src/main/java/org/gradle/api/internal/changedetection/changes/DefaultTaskExecutionModeResolver.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "277" }, { "name": "Brainfuck", "bytes": "54" }, { "name": "C", "bytes": "123600" }, { "name": "C++", "bytes": "1781062" }, { "name": "CSS", "bytes": "173356" }, { "name": "GAP", "bytes": "424" }, { "name": "Gherkin", "bytes": "191" }, { "name": "Groovy", "bytes": "30003442" }, { "name": "HTML", "bytes": "59961" }, { "name": "Java", "bytes": "28084200" }, { "name": "JavaScript", "bytes": "78583" }, { "name": "Kotlin", "bytes": "4000485" }, { "name": "Objective-C", "bytes": "652" }, { "name": "Objective-C++", "bytes": "441" }, { "name": "Python", "bytes": "57" }, { "name": "Ruby", "bytes": "16" }, { "name": "Scala", "bytes": "10840" }, { "name": "Shell", "bytes": "12897" }, { "name": "Swift", "bytes": "2040" }, { "name": "XSLT", "bytes": "42693" }, { "name": "jq", "bytes": "171" } ], "symlink_target": "" }
HTTP Server =========== Overview -------- The HTTP Server component provides an ability for running a lightweight web server on ESP32. Following are detailed steps to use the API exposed by HTTP Server: * :cpp:func:`httpd_start`: Creates an instance of HTTP server, allocate memory/resources for it depending upon the specified configuration and outputs a handle to the server instance. The server has both, a listening socket (TCP) for HTTP traffic, and a control socket (UDP) for control signals, which are selected in a round robin fashion in the server task loop. The task priority and stack size are configurable during server instance creation by passing httpd_config_t structure to httpd_start(). TCP traffic is parsed as HTTP requests and, depending on the requested URI, user registered handlers are invoked which are supposed to send back HTTP response packets. * :cpp:func:`httpd_stop`: This stops the server with the provided handle and frees up any associated memory/resources. This is a blocking function that first signals a halt to the server task and then waits for the task to terminate. While stopping, the task will close all open connections, remove registered URI handlers and reset all session context data to empty. * :cpp:func:`httpd_register_uri_handler`: A URI handler is registered by passing object of type ``httpd_uri_t`` structure which has members including ``uri`` name, ``method`` type (eg. ``HTTPD_GET/HTTPD_POST/HTTPD_PUT`` etc.), function pointer of type ``esp_err_t *handler (httpd_req_t *req)`` and ``user_ctx`` pointer to user context data. Application Example ------------------- .. highlight:: c :: /* Our URI handler function to be called during GET /uri request */ esp_err_t get_handler(httpd_req_t *req) { /* Send a simple response */ const char[] resp = "URI GET Response"; httpd_resp_send(req, resp, strlen(resp)); return ESP_OK; } /* Our URI handler function to be called during POST /uri request */ esp_err_t post_handler(httpd_req_t *req) { /* Read request content */ char[100] content; /* Truncate if content length larger than the buffer */ size_t recv_size = MIN(req->content_len, sizeof(content)); int ret = httpd_req_recv(req, content, recv_size); if (ret < 0) { /* In case of recv error, returning ESP_FAIL will * ensure that the underlying socket is closed */ return ESP_FAIL; } /* Send a simple response */ const char[] resp = "URI POST Response"; httpd_resp_send(req, resp, strlen(resp)); return ESP_OK; } /* URI handler structure for GET /uri */ httpd_uri_t uri_get = { .uri = "/uri", .method = HTTP_GET, .handler = get_handler, .user_ctx = NULL }; /* URI handler structure for POST /uri */ httpd_uri_t uri_post = { .uri = "/uri", .method = HTTP_POST, .handler = post_handler, .user_ctx = NULL }; /* Function for starting the webserver */ httpd_handle_t start_webserver(void) { /* Generate default configuration */ httpd_config_t config = HTTPD_DEFAULT_CONFIG(); /* Empty handle to http_server */ httpd_handle_t server = NULL; /* Start the httpd server */ if (httpd_start(&server, &config) == ESP_OK) { /* Register URI handlers */ httpd_register_uri_handler(server, &uri_get); httpd_register_uri_handler(server, &uri_post); } /* If server failed to start, handle will be NULL */ return server; } /* Function for stopping the webserver */ void stop_webserver(httpd_handle_t server) { if (server) { /* Stop the httpd server */ httpd_stop(server); } } Simple HTTP server example ^^^^^^^^^^^^^^^^^^^^^^^^^^ Check HTTP server example under :example:`protocols/http_server/simple` where handling of arbitrary content lengths, reading request headers and URL query parameters, and setting response headers is demonstrated. Persistent Connections ---------------------- HTTP server features persistent connections, allowing for the re-use of the same connection (session) for several transfers, all the while maintaining context specific data for the session. Context data may be allocated dynamically by the handler in which case a custom function may need to be specified for freeing this data when the connection/session is closed. Persistent Connections Example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. highlight:: c :: /* Custom function to free context */ void free_ctx_func(void *ctx) { /* Could be something other than free */ free(ctx); } esp_err_t adder_post_handler(httpd_req_t *req) { /* Create session's context if not already available */ if (! req->sess_ctx) { req->sess_ctx = malloc(sizeof(ANY_DATA_TYPE)); /*!< Pointer to context data */ req->free_ctx = free_ctx_func; /*!< Function to free context data */ } /* Access context data */ ANY_DATA_TYPE *ctx_data = (ANY_DATA_TYPE *)req->sess_ctx; /* Respond */ ............... ............... ............... return ESP_OK; } Check the example under :example:`protocols/http_server/persistent_sockets`. API Reference ------------- .. include:: /_build/inc/http_server.inc
{ "content_hash": "8dc183457905465feb2df2482724615e", "timestamp": "", "source": "github", "line_count": 146, "max_line_length": 672, "avg_line_length": 39.93835616438356, "alnum_prop": 0.599382610186932, "repo_name": "mashaoze/esp-idf", "id": "9016574e1459030a463e61b25d7fd5dc422d9aad", "size": "5831", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/en/api-reference/protocols/http_server.rst", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "142861" }, { "name": "C", "bytes": "22799712" }, { "name": "C++", "bytes": "1390945" }, { "name": "CMake", "bytes": "136271" }, { "name": "Inno Setup", "bytes": "8670" }, { "name": "Lex", "bytes": "7270" }, { "name": "Makefile", "bytes": "123250" }, { "name": "Objective-C", "bytes": "41763" }, { "name": "Perl", "bytes": "15204" }, { "name": "Python", "bytes": "701810" }, { "name": "Shell", "bytes": "66203" }, { "name": "Yacc", "bytes": "15875" } ], "symlink_target": "" }
.slide.map-canvas { height:600px; border:1px solid #EEEEEE;} .iw_poi_title {color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap} .iw_poi_content {font:12px arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word} .pop .center, .pop .bottom { box-sizing:content-box;} .office-address { position: absolute; right:40px; top:360px; z-index:1000;width:409px; background-color: #fff; border:1px solid #cccccc;-webkit-box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.1); box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.1);} .office-address .image { height:245px; overflow: hidden;} .office-address .content { padding:20px 25px} .office-address .content h3 { font-size:24px; margin:0 0 8px 0; padding:0; line-height: 32px;color:#555555;} .office-address .content span { display: block; font-size:15px; padding:1px 0; color:#a5a4a4;} .office-address .content span a { color: #a5a4a4;} .office-address .content span a:hover{ color:#555555;} .slide.about { padding:15px 0;background-color:#fbfbfb;} .about_advantage { list-style-type:none;} .about_advantage .list { list-style-type:none;padding:40px 0 25px;line-height:1.8;font-size:14px;color:#a5a4a4;border-bottom:1px solid #ececec; overflow:hidden;} .about_advantage .list .pic { float:left; margin:5px 50px 25px 0;} .about_advantage .list h3 { margin:0 0 15px; font-size:24px;color:#555555;} .about_advantage .dual .pic { float:right; margin:0 0 25px 60px;} .about_advantage li:last-child{ border:none;} .faq { padding-top:10px; padding-bottom:10px;background-color:#fbfbfb;} .faq_list .list { list-style-type:none;padding:25px 0;line-height:1.8;font-size:14px;color:#a5a4a4;border-bottom:1px solid #ececec; overflow:hidden;} .faq_list .list .name { margin:5px 0 18px;font-size:24px; color:#555555;} @media (max-width: 640px) { .slide.page-heading h1 { font-size:29px} .slide.page-heading p { font-size:14px; line-height: 19px;} .slide.map-canvas { height:300px;} .office-address { position:static; width:auto; min-width:100% !important;left:auto; right:auto;top:auto; box-shadow:none; -webkit-box-shadow:none; border:0} .office-address .image img {min-width: 100%} .about_advantage .list .pic { margin:5px 40px 15px 0;} .about_advantage .dual .pic { margin:0 0 15px 40px;} .faq { padding-top:0; padding-bottom:0;} } @media (max-width: 360px) { .about_advantage .list { text-align:center;} .about_advantage .list .pic, .about_advantage .dual .pic { float:none;width:100%;margin:0 0 30px;} } @media (max-width: 1100px) { .office-address { width:300px} }
{ "content_hash": "a471c61105a3b213b4607c44b8153f91", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 188, "avg_line_length": 54.0625, "alnum_prop": 0.7283236994219653, "repo_name": "leon776/ci", "id": "305edd33895840cf769ff2bb79c540af8d6b03fd", "size": "2595", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "documents/G-gelei/en/css/contact.css", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "83886" }, { "name": "ApacheConf", "bytes": "480" }, { "name": "CSS", "bytes": "436208" }, { "name": "HTML", "bytes": "323143" }, { "name": "Java", "bytes": "21396" }, { "name": "JavaScript", "bytes": "1389640" }, { "name": "PHP", "bytes": "4316435" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="author" content="Prasanna Balaprakash" /> <meta name="description" content="Personal web page"> <link rel="favicon" href="static/img/favicon.ico"> <title>Software</title> <link rel="stylesheet" href="academicons/css/academicons.css" /> <!-- Bootstrap --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-MfvZlkHCEqatNoGiOXveE8FIwMzZg4W85qfrfIFBfYc= sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <!-- Custom styles for this template --> <link rel="stylesheet" type="text/css" href="static/css/main.css" /> <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,200bold,400old" /> <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" /> <link rel="stylesheet" type="text/css" href="static/css/syntax.css" /> <!-- 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', '', 'auto'); ga('send', 'pageview'); </script> </head> <!-- Main Body--> <body> <!-- Wrap all page content here --> <div id="wrap"> <!-- Navbar header --> <nav class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <!-- <a class="navbar-brand" href="index.html"><i class="fa fa-home"></i></a> --> <a class="navbar-brand" href="mailto:[email protected]"><i class="fa fa-envelope"></i></a> <a class="navbar-brand" href="http://linkedin.com/in/prasannaprakash" target="blanck_"><i class="fa fa-linkedin"></i></a> <a class="navbar-brand" href="https://scholar.google.com/citations?hl=en&user=ZycQHdgAAAAJ&view_op=list_works&sortby=pubdate" target="blanck_"><i class="ai ai-google-scholar"></i></a> <a class="navbar-brand" href="https://www.researchgate.net/profile/Prasanna_Balaprakash" target="blanck_"><i class="ai ai-researchgate"></i></a> <a class="navbar-brand" href="http://github.com/pbalapra" target="blanck_"><i class="fa fa-github"></i></a> </div> <div id="navbar"> <ul class="nav navbar-nav navbar-right"> <li><a href="index.html"><i class="fa fa-home"></i>Home</a></li> <li><a href="research.html"><i class="fa fa-search-plus"></i>Research</a></li> <li><a href="team.html"><i class="fa fa-users"></i>Group</a></li> <li><a href="publications.html"><i class="fa fa-pencil"></i>Publications</a></li> <!-- <li><a href="software.html"><i class="fa fa-code"></i>Software</a></li> --> </ul> </div> </div> </nav> <section id="softwares"> <div class="container"> <div class="panel panel-default"> <div class="panel-body"> <h3>Open-source software</h3> <table> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="deephyper2018">1</a>] </td> <td class="bibtexitem" align="justify"> P.&nbsp;Balaprakash, R.&nbsp;Egele, M.&nbsp;Salim, V.&nbsp;Vishwanath, and S.&nbsp;M. Wild. DeepHyper: Scalable Asynchronous Neural Architecture and Hyperparameter Search for Deep Neural Networks, 2018. DeepHyper: Scalable automated machine learning package with two components: 1) Reinforcement-learning-based neural architecture search for automatically constructing high-performing the deep neural network architecture; 2) Asynchronous model-based search for finding high-performing hyperparameters for deep neural networks. [&nbsp;<a href="pbalapra-software_bib.html#deephyper2018">bib</a>&nbsp;| <a href="https://github.com/deephyper/deephyper">http</a>&nbsp;] </td> </tr> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="supuds2017">2</a>] </td> <td class="bibtexitem" align="justify"> P.&nbsp;Agarwal, P.&nbsp;Balaprakash, S.&nbsp;Leyffer, and S.&nbsp;M. Wild. SPUDS: Smart Pipeline for Urban Data Science, 2017. SPUDS is a machine-learning pipeline to build classification models to rank food establishments that are at most risk for the types of violations most likely to spread food-borne illness. The pipeline balances the the training data with resampling techniques, identifies the most important factors leading to critical violations via variable importance and variable selection methods, evaluates several state-of-the-art learning with cross validation, and finally combines the best performing ones via bagging. It is a customized version of AutoMOMML, exclusively designed for City of Chicago Smart Data Platform, and implemented in Python. [&nbsp;<a href="pbalapra-software_bib.html#supuds2017">bib</a>&nbsp;| <a href="https://xgitlab.cels.anl.gov/uda/ml-city">http</a>&nbsp;] </td> </tr> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="automomml2016">3</a>] </td> <td class="bibtexitem" align="justify"> P.&nbsp;Balaprakash, A.&nbsp;Tiwari, S.&nbsp;M. Wild, L.&nbsp;Carrington, and P.&nbsp;D. Hovland. AutoMOMML: Automatic Multi-objective Modeling with Machine Learning, 2016. AutoMOMML is an end-to-end, machine-learning-based framework to build predictive models for objectives such as performance, and power. The framework adopts statistical approaches to reduce the modeling complexity and automatically identifies and configures the most suitable learning algorithm to model the required objectives based on hardware and application signatures. [&nbsp;<a href="pbalapra-software_bib.html#automomml2016">bib</a>&nbsp;| <a href="https://xgitlab.cels.anl.gov/pbalapra/automomml">http</a>&nbsp;] </td> </tr> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="fpgaopt2016">4</a>] </td> <td class="bibtexitem" align="justify"> P.&nbsp;Balaprakash, A.&nbsp;Mametjanov, C.&nbsp;Choudary, P.&nbsp;D. Hovland, S.&nbsp;M. Wild, and G.&nbsp;Sabin. FPGAtuner: Autotuning FPGA Design Parameters for Performance and Power, 2016. A machine-learning-based approach to tune FPGA design parameters. It performs sampling-based reduction of the parameter space and guides the search toward promising parameter configurations. [&nbsp;<a href="pbalapra-software_bib.html#fpgaopt2016">bib</a>&nbsp;| <a href="https://xgitlab.cels.anl.gov/pbalapra/fpgaopt">http</a>&nbsp;] </td> </tr> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="surf2015">5</a>] </td> <td class="bibtexitem" align="justify"> P.&nbsp;Balaprakash. SuRF: Search using Random Forest, 2015. SuRF is a model-based search module for automatic performance tuning. It adopts random forest supervised learning algorithm for modeling the performances as a function of input parameters within the search. SuRF samples a small number of parameter configurations, empirically evaluating the corresponding code variants to obtain the corresponding performance metrics, and fitting a surrogate model over the input-output space. The surrogate model is then iteratively refined by obtaining new output metrics at unevaluated input configurations predicted to be high-performing by the model. Implemented in Python and available with the Orio autotuning framework. [&nbsp;<a href="pbalapra-software_bib.html#surf2015">bib</a>&nbsp;| <a href="https://github.com/brnorris03/Orio/tree/master/orio/main/tuner/search/mlsearch">http</a>&nbsp;] </td> </tr> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="spapt2011">6</a>] </td> <td class="bibtexitem" align="justify"> P.&nbsp;Balaprakash, S.&nbsp;M. Wild, and B.&nbsp;Norris. SPAPT: Search Problems in Automatic Performance Tuning, 2011. A set of extensible and portable search problems in automatic performance tuning whose goal is to aid in the development and improvement of search strategies and performance-improving transformations. SPAPT contains representative implementations from a number of lower-level, serial performance-tuning tasks in scientific applications. Available with the Orio autotuning framework. [&nbsp;<a href="pbalapra-software_bib.html#spapt2011">bib</a>&nbsp;| <a href="https://github.com/brnorris03/Orio/tree/master/testsuite/SPAPT">http</a>&nbsp;] </td> </tr> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="irace2010">7</a>] </td> <td class="bibtexitem" align="justify"> M.&nbsp;L. Ibanez, J.&nbsp;D. Lacoste, T.&nbsp;St&uuml;tzle, M.&nbsp;Birattari, E.&nbsp;Yuan, and P.&nbsp;Balaprakash. The irace Package: Iterated Race for Automatic Algorithm Configuration, 2010. The irace package implements the iterated racing procedure, which is an extension of the Iterated F-race procedure. Its main purpose is to automatically configure optimization algorithms by finding the most appropriate settings given a set of instances of an optimization problem. It builds upon the race package by Birattari, and it is implemented in R. [&nbsp;<a href="pbalapra-software_bib.html#irace2010">bib</a>&nbsp;| <a href="http://cran.r-project.org/web/packages/irace/">http</a>&nbsp;] </td> </tr> <tr valign="top"> <td align="right" class="bibtexnumber"> [<a name="els-ptsp2009">8</a>] </td> <td class="bibtexitem" align="justify"> P.&nbsp;Balaprakash, M.&nbsp;Birattari, and T.&nbsp;St&uuml;tzle. ELS-PTSP: Estimation-based Local Search for the Probabilistic Traveling Salesman Problem, 2009. This software package provides a high-performance implementation of the estimation-based iterative improvement algorithm to tackle the probabilistic traveling salesman problem. A key novelty of the proposed algorithm is that the cost difference between two neighbor solutions is estimated by partial evaluation, adaptive, and importance sampling. Developed in C with GNU scientific library under Linux. [&nbsp;<a href="pbalapra-software_bib.html#els-ptsp2009">bib</a>&nbsp;| <a href="https://github.com/pbalapra/els-ptsp">http</a>&nbsp;] </td> </tr> </table> </div> </div> </div> </section> </div> <!-- Footer --> <footer> <div id="footer"> <div class="container"> <p class="text-muted">© All rights reserved. Powered by <a href="http://jekyllrb.com/">Jekyll</a> and <a href="http://www.github.com/biomadeira/sustain">sustain</a> with ♥</p> </div> </div> </footer> <div class="footer"></div> <!-- <a href="https://github.com/biomadeira/sustain"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a> --> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <!-- Bootstrap core JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha256-Sk3nkD6mLTMOF0EOpNtsIry+s1CsaqQC1rVLTAy+0yc= sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="static/js/docs.min.js"></script> <script src="static/js/main.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="static/js/ie10-viewport-bug-workaround.js"></script> </body> </html>
{ "content_hash": "f37136dd2942b3e1b66e6a4281ca1704", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 454, "avg_line_length": 42.955326460481096, "alnum_prop": 0.71368, "repo_name": "pbalapra/pbalapra.github.io", "id": "70f0ce86fc81f892e59371a3e742b7e2d6b755a3", "size": "12503", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_site/software.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "23550" }, { "name": "HTML", "bytes": "1057052" }, { "name": "JavaScript", "bytes": "1960" } ], "symlink_target": "" }
package com.conveyal.r5.profile; import com.conveyal.r5.api.util.Stats; import java.util.Collection; import java.util.stream.IntStream; /** * This is used in Modeify. "Stats" summarize the travel time for a set of similar paths, giving the minimum, * maximum, and average travel and wait over all those paths, over a whole departure time window. */ public class StatsCalculator { /** * Compute statistics for this particular path over the time window. This is super simple, * we just compute how long the path takes at every possible departure minute. There's probably an * elegant theoretical way to do this, but I prefer pragmatism over theory. */ public static StatsCollection computeStatistics (ProfileRequest req, int accessTime, int egressTime, int nSegments, Collection<PathWithTimes.Itinerary> itineraries) { Stats stats = new Stats(); Stats[] rideStats = IntStream.range(0, nSegments).mapToObj(i -> new Stats()).toArray(Stats[]::new); Stats[] waitStats = IntStream.range(0, nSegments).mapToObj(i -> new Stats()).toArray(Stats[]::new); for (int start = req.fromTime; start < req.toTime; start += 60) { // TODO should board slack be applied at the origin stop? Is this done in RaptorWorker? int timeAtOriginStop = start + accessTime + FastRaptorWorker.BOARD_SLACK_SECONDS; int bestTimeAtDestinationStop = Integer.MAX_VALUE; PathWithTimes.Itinerary bestItinerary = null; for (PathWithTimes.Itinerary itin : itineraries) { // itinerary cannot be used at this time if (itin.boardTimes[0] < timeAtOriginStop) continue; if (itin.alightTimes[nSegments - 1] < bestTimeAtDestinationStop) { bestTimeAtDestinationStop = itin.alightTimes[nSegments - 1]; bestItinerary = itin; } } if (bestItinerary == null) continue; // cannot use this trip at this time int bestTimeAtDestination = bestTimeAtDestinationStop + egressTime; int travelTime = bestTimeAtDestination - start; stats.num++; stats.avg += travelTime; stats.min = Math.min(stats.min, travelTime); stats.max = Math.max(stats.max, travelTime); // accumulate stats for each leg for (int leg = 0; leg < nSegments; leg++) { Stats ride = rideStats[leg]; int rideLen = bestItinerary.alightTimes[leg] - bestItinerary.boardTimes[leg]; ride.num++; ride.avg += rideLen; ride.min = Math.min(ride.min, rideLen); ride.max = Math.max(ride.max, rideLen); Stats wait = waitStats[leg]; int arriveAtStopTime = leg == 0 ? timeAtOriginStop : bestItinerary.arriveAtBoardStopTimes[leg]; int waitTime = bestItinerary.boardTimes[leg] - arriveAtStopTime; wait.num++; wait.avg += waitTime; wait.min = Math.min(waitTime, wait.min); wait.max = Math.max(waitTime, wait.max); } } if (stats.num == 0) throw new IllegalStateException("No valid itineraries found for path computed in RaptorWorker"); stats.avg /= stats.num; for (Stats[] statSet : new Stats[][] { rideStats, waitStats }) { for (Stats s : statSet) { s.avg /= s.num; } } return new StatsCollection(stats, waitStats, rideStats); } public static class StatsCollection { public Stats stats; public Stats[] waitStats; public Stats[] rideStats; public StatsCollection (Stats stats, Stats[] waitStats, Stats[] rideStats) { this.stats = stats; this.rideStats = rideStats; this.waitStats = waitStats; } } }
{ "content_hash": "cdbcf7c5a47be8f0febff040d339f321", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 124, "avg_line_length": 41.103092783505154, "alnum_prop": 0.6037120642086782, "repo_name": "conveyal/r5", "id": "53807e1175d994f9dfe8f67acb0cc5d2aa0aad13", "size": "3987", "binary": false, "copies": "2", "ref": "refs/heads/dev", "path": "src/main/java/com/conveyal/r5/profile/StatsCalculator.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6262" }, { "name": "Dockerfile", "bytes": "640" }, { "name": "HTML", "bytes": "7164" }, { "name": "Java", "bytes": "3492376" }, { "name": "JavaScript", "bytes": "76017" }, { "name": "Python", "bytes": "5457" }, { "name": "Shell", "bytes": "924" } ], "symlink_target": "" }
import React, {PropTypes} from 'react'; import {addTask} from '../redux/actions/task-actions'; import {connect} from 'react-redux'; class TodoForm extends React.Component { constructor(props) { super(props); this.handleFormSubmit = this.handleFormSubmit.bind(this); } handleFormSubmit(e){ e.preventDefault(); var task = this.refs.task.value; this.props.addTask({ title:task, id:new Date().getTime() }); this.refs.task.value = '' } render() { return (<form onSubmit={this.handleFormSubmit}> <input placeholder='Add your todo' type='text' ref='task' /> <input type="submit" value="add Task" /> </form>); } } TodoForm.propTypes = { addTask: PropTypes.func.isRequired }; export default connect(null, {addTask})(TodoForm);
{ "content_hash": "0d6bfb158b1d1b14847564579968d856", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 74, "avg_line_length": 24.176470588235293, "alnum_prop": 0.6338199513381995, "repo_name": "veenedu/ReactReduxTodo", "id": "a1f02b982d197e79954ba3e640e054a0a34de391", "size": "822", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/components/TodoForm.react.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "408" }, { "name": "HTML", "bytes": "841" }, { "name": "JavaScript", "bytes": "3539" } ], "symlink_target": "" }
package com.cloud.utils.nicira.nvp.plugin; import org.apache.log4j.Logger; import com.cloud.maint.Version; public class NiciraNvpApiVersion { private static final Logger s_logger = Logger.getLogger(NiciraNvpApiVersion.class); private static String niciraApiVersion; public static synchronized void setNiciraApiVersion(String apiVersion){ niciraApiVersion = apiVersion; } public static synchronized boolean isApiVersionLowerThan(String apiVersion){ if (niciraApiVersion == null) return false; int compare = Version.compare(niciraApiVersion, apiVersion); return (compare < 0); } public static synchronized void logNiciraApiVersion(){ s_logger.info("NSX API VERSION: " + ((niciraApiVersion != null) ? niciraApiVersion : " NOT PRESENT")); } }
{ "content_hash": "f0cd9fdd99d260e895377326a1266987", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 110, "avg_line_length": 31.5, "alnum_prop": 0.724053724053724, "repo_name": "resmo/cloudstack", "id": "4dfd4e2b62a5c9c794d195ce694fec90d7ac5b0e", "size": "1627", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "utils/src/main/java/com/cloud/utils/nicira/nvp/plugin/NiciraNvpApiVersion.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "1451" }, { "name": "Batchfile", "bytes": "11926" }, { "name": "C#", "bytes": "2356211" }, { "name": "CSS", "bytes": "335738" }, { "name": "FreeMarker", "bytes": "4917" }, { "name": "Groovy", "bytes": "153137" }, { "name": "HTML", "bytes": "151164" }, { "name": "Java", "bytes": "33712712" }, { "name": "JavaScript", "bytes": "7719277" }, { "name": "Python", "bytes": "11019815" }, { "name": "Ruby", "bytes": "896" }, { "name": "Shell", "bytes": "770039" } ], "symlink_target": "" }
TC.each = function(collection, callback) { $.each(collection, callback); } TC.now = function() { return $.now(); }
{ "content_hash": "4b91e1f2c10eb85be0f8f7c9efdaaceb", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 42, "avg_line_length": 17.714285714285715, "alnum_prop": 0.6129032258064516, "repo_name": "lleirborras/tc", "id": "e95c185e3c64c538c25e29191587743d3f9a9cac", "size": "124", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/extends/tc.functions.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "11196" } ], "symlink_target": "" }
<?php $this->layout = 'default2'; echo("<div class=\"row\">"); echo("<div class=\"span12\">"); //titre echo("<h1 style=\"margin-top: 10%;\">"); echo __("Mot de passe oublié"); echo("</h1>"); //zone de texte où l'utilisateur doit rentrer son email pour pouvoir recevoir un lien vers un nouveau mot de passe echo $this->Form->create('User'); echo $this->Form->input('mail', array('class'=>'form-control')); echo ("<br/>"); echo $this->Form->button(__('Renvoyer un mot de passe'), array('class'=>"btn btn-lg btn-primary")); echo $this->Form->end(); echo("</div>"); echo("</div>"); ?>
{ "content_hash": "b4e20ceb584df39a5ba7f60c376301a4", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 115, "avg_line_length": 34.166666666666664, "alnum_prop": 0.591869918699187, "repo_name": "Cyanodroid/Projet_web", "id": "2c4d73b419a2810a0efb2ae5d72de01cdbe25bba", "size": "617", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sitecollaboratif/app/View/Users/forgot.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "672" }, { "name": "Batchfile", "bytes": "2785" }, { "name": "CSS", "bytes": "42404" }, { "name": "JavaScript", "bytes": "16387" }, { "name": "PHP", "bytes": "8606809" }, { "name": "Shell", "bytes": "4170" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "c05c895f131e6c836a1ecc6470819f04", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "ecd57bd522ecd1d39801679197d727569920e255", "size": "196", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Chlorophyta/Chlorophyceae/Chlorococcales/Micractiniaceae/Micractinium/Micractinium pusillum/ Syn. Micractinium eriense/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package com.esri.gdb import scala.collection.mutable /** */ class GDBTableScanWithNullValues(dataBuffer: DataBuffer, fields: Seq[Field], maxRows: Int, startID: Int = 0) extends Iterator[Map[String, Any]] with Serializable { val numFieldsWithNullAllowed = fields.count(_.nullable) val nullValueIndicators = new Array[Byte]((numFieldsWithNullAllowed / 8.0).ceil.toInt) var nextRow = 0 var objectID = startID def hasNext() = nextRow < maxRows def next() = { nextRow += 1 objectID += 1 val numBytes = dataBuffer.readBytes(4).getInt val byteBuffer = dataBuffer.readBytes(numBytes) 0 until nullValueIndicators.length foreach (nullValueIndicators(_) = byteBuffer.get) var bit = 0 val map = mutable.Map[String, Any]() fields.foreach(field => { if (field.nullable) { val i = bit >> 3 val m = 1 << (bit & 7) bit += 1 if ((nullValueIndicators(i) & m) == 0) { map(field.name) = field.readValue(byteBuffer, objectID) } } else { map(field.name) = field.readValue(byteBuffer, objectID) } } ) map.toMap } }
{ "content_hash": "04a5ce2e8511722fbe55db0ad3496061", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 108, "avg_line_length": 27.682926829268293, "alnum_prop": 0.6370044052863436, "repo_name": "mraad/spark-gdb", "id": "db7649dacc1478f6477d10a5ec6ed83426036689", "size": "1135", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/scala/com/esri/gdb/GDBTableScanWithNullValues.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "23295" }, { "name": "Scala", "bytes": "93993" }, { "name": "Shell", "bytes": "154" } ], "symlink_target": "" }
package io.enmasse.controller; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; import org.junit.jupiter.api.Test; import io.enmasse.address.model.AddressSpace; import io.enmasse.address.model.AddressSpaceBuilder; public class EqualityTest { /** * Ensure that after cloning an instance, the new instance does not influence the old one. */ @Test public void testClone() { final AddressSpace s1 = new AddressSpaceBuilder() .withNewStatus() .withMessages("foo") .endStatus() .build(); final AddressSpace s2 = new AddressSpaceBuilder(s1) .build(); // right now they s1 and s2 must be equal assertFalse(ControllerChain.hasAddressSpaceChanged(s1, s2)); assertFalse(ControllerChain.hasAddressSpaceChanged(s2, s1)); // test to see if we have the messages assertEquals(Arrays.asList("foo"), s1.getStatus().getMessages()); assertEquals(Arrays.asList("foo"), s2.getStatus().getMessages()); // we make a change to s2 s2.getStatus().clearMessages(); // now s1 and s2 must no longer be equal assertTrue(ControllerChain.hasAddressSpaceChanged(s1, s2)); assertTrue(ControllerChain.hasAddressSpaceChanged(s2, s1)); // the lists must be different assertEquals(Arrays.asList("foo"), s1.getStatus().getMessages()); assertEquals(Arrays.asList(), s2.getStatus().getMessages()); } }
{ "content_hash": "95e2e52742c73d2848cc76e8a83f27bc", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 94, "avg_line_length": 29.29824561403509, "alnum_prop": 0.6646706586826348, "repo_name": "jenmalloy/enmasse", "id": "a7a50f071eadf9268dbbd3f51fba002729599c03", "size": "1814", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "address-space-controller/src/test/java/io/enmasse/controller/EqualityTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "946" }, { "name": "Dockerfile", "bytes": "8306" }, { "name": "Go", "bytes": "1208268" }, { "name": "Groovy", "bytes": "8925" }, { "name": "HTML", "bytes": "3345" }, { "name": "Java", "bytes": "4217294" }, { "name": "JavaScript", "bytes": "922369" }, { "name": "Makefile", "bytes": "23788" }, { "name": "Python", "bytes": "6730" }, { "name": "Ragel", "bytes": "3778" }, { "name": "Shell", "bytes": "73871" }, { "name": "TSQL", "bytes": "2790" }, { "name": "TypeScript", "bytes": "407558" }, { "name": "XSLT", "bytes": "11077" }, { "name": "Yacc", "bytes": "5306" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in Publ. Puget Sound Biol. Sta. Univ. Wash. 4: 368 (1925) #### Original name Puccinia neurophila Grognot, 1863 ### Remarks null
{ "content_hash": "ff8dbc1e40f1e5a8b2f2b974758326ce", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 54, "avg_line_length": 16.307692307692307, "alnum_prop": 0.7075471698113207, "repo_name": "mdoering/backbone", "id": "d6a542dbe5d0f983bb73955650f9ce5985f831e1", "size": "279", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Basidiomycota/Pucciniomycetes/Pucciniales/Pucciniaceae/Uromyces/Uromyces trifolii/ Syn. Uromyces nerviphilus/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!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_17) on Thu Jan 14 02:04:14 PST 2010 --> <TITLE> Uses of Class gov.nasa.worldwind.applications.sar.PositionTable (NASA World Wind) </TITLE> <META NAME="date" CONTENT="2010-01-14"> <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 gov.nasa.worldwind.applications.sar.PositionTable (NASA World Wind)"; } } </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="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar"><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="../../../../../../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> NASA World Wind</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?gov/nasa/worldwind/applications/sar/\class-usePositionTable.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PositionTable.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>gov.nasa.worldwind.applications.sar.PositionTable</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="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#gov.nasa.worldwind.applications.sar"><B>gov.nasa.worldwind.applications.sar</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#gov.nasa.worldwind.applications.sar.actions"><B>gov.nasa.worldwind.applications.sar.actions</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="gov.nasa.worldwind.applications.sar"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A> in <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/package-summary.html">gov.nasa.worldwind.applications.sar</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/package-summary.html">gov.nasa.worldwind.applications.sar</A> with parameters of type <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionsContextMenu.html#PositionsContextMenu(gov.nasa.worldwind.applications.sar.PositionTable)">PositionsContextMenu</A></B>(<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A>&nbsp;positionTable)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="gov.nasa.worldwind.applications.sar.actions"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A> in <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/package-summary.html">gov.nasa.worldwind.applications.sar.actions</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/package-summary.html">gov.nasa.worldwind.applications.sar.actions</A> declared as <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></CODE></FONT></TD> <TD><CODE><B>InsertPositionAction.</B><B><A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/InsertPositionAction.html#table">table</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></CODE></FONT></TD> <TD><CODE><B>DeletePositionsAction.</B><B><A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/DeletePositionsAction.html#table">table</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></CODE></FONT></TD> <TD><CODE><B>AppendPositionAction.</B><B><A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/AppendPositionAction.html#table">table</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected &nbsp;<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></CODE></FONT></TD> <TD><CODE><B>AddOffsetToPositionsAction.</B><B><A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/AddOffsetToPositionsAction.html#table">table</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/package-summary.html">gov.nasa.worldwind.applications.sar.actions</A> with parameters of type <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../../gov/nasa/worldwind/applications/sar/actions/AddOffsetToPositionsAction.html#AddOffsetToPositionsAction(gov.nasa.worldwind.applications.sar.PositionTable)">AddOffsetToPositionsAction</A></B>(<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A>&nbsp;table)</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="../../../../../../gov/nasa/worldwind/applications/sar/actions/AppendPositionAction.html#AppendPositionAction(gov.nasa.worldwind.applications.sar.PositionTable)">AppendPositionAction</A></B>(<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A>&nbsp;table)</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="../../../../../../gov/nasa/worldwind/applications/sar/actions/DeletePositionsAction.html#DeletePositionsAction(gov.nasa.worldwind.applications.sar.PositionTable)">DeletePositionsAction</A></B>(<A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A>&nbsp;table)</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="../../../../../../gov/nasa/worldwind/applications/sar/actions/InsertPositionAction.html#InsertPositionAction(boolean, gov.nasa.worldwind.applications.sar.PositionTable)">InsertPositionAction</A></B>(boolean&nbsp;above, <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar">PositionTable</A>&nbsp;table)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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"> <A HREF="../../../../../../gov/nasa/worldwind/applications/sar/PositionTable.html" title="class in gov.nasa.worldwind.applications.sar"><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="../../../../../../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> NASA World Wind</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?gov/nasa/worldwind/applications/sar/\class-usePositionTable.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PositionTable.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>
{ "content_hash": "e0f85530d604d6bee96e41b67bfde8c6", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 402, "avg_line_length": 53.55343511450382, "alnum_prop": 0.6606086522699737, "repo_name": "caadxyz/Macro-Thinking-Micro-action", "id": "436d2162dd4d106c2c577cb847be3b3199dc17c7", "size": "14031", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/gov/nasa/worldwind/applications/sar/class-use/PositionTable.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "289" }, { "name": "HTML", "bytes": "199031" }, { "name": "Java", "bytes": "11038485" }, { "name": "Shell", "bytes": "224" } ], "symlink_target": "" }
<?php require_once 'vendor/autoload.php'; use App\Models\Dvd; // use \Symfony\Component\HTTPFoundation\Session\Session; // $session = new Session(); // $session->start(); ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>DVD Search</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> </head> <body> <?php $dvd_query = new Dvd(); $genres = $dvd_query->getGenres(); $ratings = $dvd_query->getRatings(); ?> <div class="container"> <h1>Search</h1> <p>Search for a DVD <a href="/dvds">or show them all</a></p> <br> <form action="/dvds" method="GET"> <div class="form-group"> Title: <input type="text" name="title" class="form-control"> </div> <div class="form-group"> Genre: <select name="genre" class="form-control"> <div><option value="">All</option></div> <?php foreach($genres as $genre): ?> <div><?php echo '<option value="' . $genre->id . '">' . $genre->genre_name . '</option>' ?></div> <?php endforeach; ?> </select> </div> <div class="form-group"> Rating: <select name="rating" class="form-control"> <div><option value="">All</option></div> <?php foreach($ratings as $rating): ?> <div><?php echo '<option value="' . $rating->id . '">' . $rating->rating_name . '</option>' ?></div> <?php endforeach; ?> </select> </div> <br> <button type="submit" class="btn btn-default">search it!</button> </form> </div> </body> </html>
{ "content_hash": "3b0f064b5f8d7de52cbfc57f7fc232a9", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 104, "avg_line_length": 23.873015873015873, "alnum_prop": 0.6023936170212766, "repo_name": "erikamjoh/itp405-spring2015-mvc", "id": "585c9ef71be1ec7943b38543a66c079dfdb4cd26", "size": "1504", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "resources/views/_search.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "356" }, { "name": "CSS", "bytes": "131116" }, { "name": "JavaScript", "bytes": "503" }, { "name": "PHP", "bytes": "100644" } ], "symlink_target": "" }
class Todo include Mongoid::Document include Mongoid::Versioning max_versions 0 field :title field :completed, :type => Boolean field :created_at, :type => Time validates_presence_of :title before_create :set_defaults def set_defaults self.created_at = Time.now.iso8601 self.completed = 0 # not sure why but `false` doesn't work here end end
{ "content_hash": "1acd90bdbecace6dcb45fda4f6be62a5", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 68, "avg_line_length": 20.833333333333332, "alnum_prop": 0.704, "repo_name": "acrookston/our_todo", "id": "d1f65df31ecb6451b50ce080ddc9527a6939d778", "size": "375", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/todo.rb", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "11666" }, { "name": "Ruby", "bytes": "12279" }, { "name": "Shell", "bytes": "1675" } ], "symlink_target": "" }
<?xml version='1.0' encoding='utf-8'?> <!-- 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. --> <!-- Additional config: JAVA_OPTS="-Djava.security.egd=file:/dev/urandom -Djava.awt.headless=true -Xmx320m -Xmx320m -XX:+UseG1GC" --> <Server port="-1" shutdown=""> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <Service name="Catalina"> <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="4" minSpareThreads="1"/> <Connector port="80" protocol="org.apache.coyote.http11.Http11Nio2Protocol" redirectPort="443" server="Apache" compression="8192" executor="tomcatThreadPool" URIEncoding="UTF-8"/> <Connector port="443" protocol="org.apache.coyote.http11.Http11Nio2Protocol" server="Apache" compression="8192" executor="tomcatThreadPool" SSLEnabled="true" scheme="https" secure="true" URIEncoding="UTF-8"> <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"/> <SSLHostConfig certificateKeyFile="" certificateFile="" certificateKeyPassword="" caCertificateFile=""/> </Connector> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host> </Engine> </Service> </Server>
{ "content_hash": "b91046c5e90853cc325b9a82b2267899", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 105, "avg_line_length": 42.93846153846154, "alnum_prop": 0.6857757076316733, "repo_name": "l-dobrev/zxing", "id": "34656d013f2829f34299d71e94479f7e250166d7", "size": "2791", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "zxingorg/src/main/webapp/.ebextensions/server.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3419" }, { "name": "HTML", "bytes": "98457" }, { "name": "Java", "bytes": "2361933" } ], "symlink_target": "" }
<!-- ~ Copyright (c) Meta Platforms, Inc. and 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_container_view" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > </LinearLayout>
{ "content_hash": "26bf4d136f10b487c9a7164139f04d4b", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 76, "avg_line_length": 37.416666666666664, "alnum_prop": 0.7149220489977728, "repo_name": "facebook/litho", "id": "eab531589f97901d3ff9e444bb9abd038aae2846", "size": "898", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sample/src/main/res/layout/screen_slide_fragment.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "3065" }, { "name": "C++", "bytes": "382935" }, { "name": "CMake", "bytes": "1490" }, { "name": "Haskell", "bytes": "7720" }, { "name": "Java", "bytes": "9413537" }, { "name": "JavaScript", "bytes": "28046" }, { "name": "Kotlin", "bytes": "1326831" }, { "name": "SCSS", "bytes": "5360" }, { "name": "Shell", "bytes": "12115" }, { "name": "Starlark", "bytes": "241912" } ], "symlink_target": "" }
package sphero import ( "bytes" "encoding/binary" "fmt" ) // Represents a command response. type Response struct { Sop1 byte Sop2 byte Mrsp byte Seq uint8 Dlen uint8 Data []byte Chk uint8 } // Returns the appropriate error from the message response (MRSP) field, if any. func (r *Response) Error() (err error) { switch r.Mrsp { case ORBOTIX_RSP_CODE_OK: err = nil case ORBOTIX_RSP_CODE_EGEN: err = GeneralError case ORBOTIX_RSP_CODE_ECHKSUM: err = ChecksumError case ORBOTIX_RSP_CODE_EFRAG: err = CommandFragmentError case ORBOTIX_RSP_CODE_EBAD_CMD: err = UnknownCommandError case ORBOTIX_RSP_CODE_EUNSUPP: err = UnsupportedCommandError case ORBOTIX_RSP_CODE_EBAD_MSG: err = BadMessageFormatError case ORBOTIX_RSP_CODE_EPARAM: err = InvalidParametersError case ORBOTIX_RSP_CODE_EEXEC: err = FailedExecuteCommandError case ORBOTIX_RSP_CODE_EBAD_DID: err = UnknownDeviceError case ORBOTIX_RSP_CODE_POWER_NOGOOD: err = PowerTooLowError case ORBOTIX_RSP_CODE_PAGE_ILLEGAL: err = IllegalPageError case ORBOTIX_RSP_CODE_FLASH_FAIL: err = FlashFailError case ORBOTIX_RSP_CODE_MA_CORRUPT: err = ApplicationCorruptError case ORBOTIX_RSP_CODE_MSG_TIMEOUT: err = MessageTimeoutError default: err = UnknownError } return } /* Parses the data portion of the response into a PowerState struct. This method may be inaccurate or fail if the data doesn't represent a color. */ func (r *Response) PowerState() (*PowerState, error) { ps := new(PowerState) if len(r.Data) != binary.Size(ps) { return ps, fmt.Errorf("Could not parse %#x as PowerState", ps) } buf := bytes.NewBuffer(r.Data) binary.Read(buf, binary.BigEndian, ps) return ps, nil } /* Parses the data portion of the response into a Color struct. This method may be inaccurate or fail if the data doesn't represent a color. */ func (r *Response) Color() (*Color, error) { c := new(Color) if len(r.Data) != binary.Size(c) { return c, fmt.Errorf("Could not parse %#x as Color", c) } buf := bytes.NewBuffer(r.Data) binary.Read(buf, binary.BigEndian, c) return c, nil } /* Represents an async response from one of the async data commands: - SetDataStreaming - ConfigureLocator - ConfigureCollisionDetection */ type AsyncResponse struct { Sop1 byte Sop2 byte IdCode byte Dlen uint16 Data []byte Chk uint8 } /* Unpacks sensor data from an async response. This method may be inaccurate or fail if the data doesn't represent sensor data. */ func (r *AsyncResponse) Sensors(d interface{}) error { buf := bytes.NewBuffer(r.Data) return binary.Read(buf, binary.BigEndian, d) } /* Parses the data portion of the async response into a Location struct. This method may be inaccurate or fail if the data doesn't represent a location. */ func (r *AsyncResponse) Location() (*Location, error) { loc := new(Location) if len(r.Data) != binary.Size(loc) { return loc, fmt.Errorf("Could not parse %#x as Location", loc) } buf := bytes.NewBuffer(r.Data) binary.Read(buf, binary.BigEndian, loc) return loc, nil } /* Parses the data portion of the async response into a Collision struct. This method may be inaccurate or fail if the data doesn't represent a collision. */ func (r *AsyncResponse) Collision() (*Collision, error) { c := new(Collision) if len(r.Data) != binary.Size(c) { return c, fmt.Errorf("Could not parse %#x as Collision", r.Data) } buf := bytes.NewBuffer(r.Data) binary.Read(buf, binary.BigEndian, c) return c, nil } // Simple Color struct. See GetRGBLED. type Color struct { R, G, B uint8 } // Represents the power state of the Sphero. See SetPowerNotification. type PowerState struct { RecVer, PowerState uint8 BattVoltage, NumCharges, TimeSinceChg uint16 } // Represents collision data from the Locator service. See ConfigureLocator. type Location struct { XPos, YPos, XVel, YVel, SoG uint16 } // Represents collision data from the Collision service. See ConfigureCollisionDetection. type Collision struct { X, Y, Z int16 Axis uint8 XMag, YMag int16 Speed uint8 TimeStamp int32 }
{ "content_hash": "f063a85bf19095283c011f0dd949c849", "timestamp": "", "source": "github", "line_count": 164, "max_line_length": 89, "avg_line_length": 25.079268292682926, "alnum_prop": 0.7201556041818624, "repo_name": "FreeFlow/sphero", "id": "37a1b9e1321f506574735eb69a397b36affbf898", "size": "4113", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "struct.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "25252" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "123f623033800694b3bce928ad9d5289", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "685101776e8f7803ac9c5499ab5b78ce70ae371a", "size": "190", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Apiales/Apiaceae/Hydrocotyle/Hydrocotyle gracilis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
goTo.file("/a.tsx"); verify.codeFix({ index: 0, description: [ts.Diagnostics.Import_0_from_1.message, "React", "react"], applyChanges: true, newFileContent: `import React from "react"; <Text></Text>;` }); verify.codeFix({ index: 0, description: [ts.Diagnostics.Add_import_from_0.message, "react-native"], newFileContent: `import React from "react"; import { Text } from "react-native"; <Text></Text>;` });
{ "content_hash": "97aaa65fb4c2160606c4d4974240dd28", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 76, "avg_line_length": 21.85, "alnum_prop": 0.6498855835240275, "repo_name": "weswigham/TypeScript", "id": "95dc5ff6d1bdb7df89d6045ba2326bbaa2615fc0", "size": "908", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/cases/fourslash/importNameCodeFix_jsx6.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "6259" }, { "name": "JavaScript", "bytes": "1152" }, { "name": "PowerShell", "bytes": "2855" }, { "name": "Shell", "bytes": "47" }, { "name": "TypeScript", "bytes": "121823671" } ], "symlink_target": "" }
<?php /** * Widget for inserting an ad into your sidebar * * @since 4.5.0 */ class WordAds_Sidebar_Widget extends WP_Widget { private static $allowed_tags = array( 'mrec', 'wideskyscraper' ); private static $num_widgets = 0; function __construct() { parent::__construct( 'wordads_sidebar_widget', /** This filter is documented in modules/widgets/facebook-likebox.php */ apply_filters( 'jetpack_widget_name', 'Ads' ), array( 'description' => __( 'Insert an ad unit wherever you can place a widget.', 'jetpack' ), 'customize_selective_refresh' => true, ) ); } public function widget( $args, $instance ) { global $wordads; if ( $wordads->should_bail() ) { return false; } if ( ! isset( $instance['unit'] ) ) { $instance['unit'] = 'mrec'; } self::$num_widgets++; $about = __( 'Advertisements', 'jetpack' ); $width = WordAds::$ad_tag_ids[ $instance['unit'] ]['width']; $height = WordAds::$ad_tag_ids[ $instance['unit'] ]['height']; $unit_id = 1 == self::$num_widgets ? 3 : self::$num_widgets + 3; // 2nd belowpost is '4' $section_id = 0 === $wordads->params->blog_id ? WORDADS_API_TEST_ID : $wordads->params->blog_id . $unit_id; $snippet = ''; if ( $wordads->option( 'wordads_house', true ) ) { $unit = 'mrec'; if ( 'leaderboard' == $instance['unit'] && ! $this->params->mobile_device ) { $unit = 'leaderboard'; } elseif ( 'wideskyscraper' == $instance['unit'] ) { $unit = 'widesky'; } $snippet = $wordads->get_house_ad( $unit ); } else { $snippet = $wordads->get_ad_snippet( $section_id, $height, $width, 'widget' ); } echo <<< HTML <div class="wpcnt"> <div class="wpa"> <span class="wpa-about">$about</span> <div class="u {$instance['unit']}"> $snippet </div> </div> </div> HTML; } public function form( $instance ) { // ad unit type if ( isset( $instance['unit'] ) ) { $unit = $instance['unit']; } else { $unit = 'mrec'; } ?> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'unit' ) ); ?>"><?php _e( 'Tag Dimensions:', 'jetpack' ); ?></label> <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'unit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'unit' ) ); ?>"> <?php foreach ( WordAds::$ad_tag_ids as $ad_unit => $properties ) { if ( ! in_array( $ad_unit, self::$allowed_tags ) ) { continue; } $splits = explode( '_', $properties['tag'] ); $unit_pretty = "{$splits[0]} {$splits[1]}"; $selected = selected( $ad_unit, $unit, false ); echo "<option value='", esc_attr( $ad_unit ) ,"' ", $selected, '>', esc_html( $unit_pretty ) , '</option>'; } ?> </select> </p> <?php } public function update( $new_instance, $old_instance ) { $instance = $old_instance; if ( in_array( $new_instance['unit'], self::$allowed_tags ) ) { $instance['unit'] = $new_instance['unit']; } else { $instance['unit'] = 'mrec'; } return $instance; } } function jetpack_wordads_widgets_init_callback() { return register_widget( 'WordAds_Sidebar_Widget' ); } add_action( 'widgets_init', 'jetpack_wordads_widgets_init_callback' );
{ "content_hash": "cd0323cccf21f549245e4b62dc2cc442", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 155, "avg_line_length": 27.973913043478262, "alnum_prop": 0.5725831520049736, "repo_name": "sifonsecac/capitalino-errante", "id": "782c2dcd04e65ba3b16c4dcfb7b8b282d52c1a58", "size": "3217", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "wp-content/plugins/jetpack/modules/wordads/php/widgets.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3458117" }, { "name": "HTML", "bytes": "42443" }, { "name": "Hack", "bytes": "915" }, { "name": "JavaScript", "bytes": "5543630" }, { "name": "PHP", "bytes": "22604660" }, { "name": "Ruby", "bytes": "3054" }, { "name": "Shell", "bytes": "8030" }, { "name": "Smarty", "bytes": "33" }, { "name": "XSLT", "bytes": "4267" } ], "symlink_target": "" }
from django.test.utils import override_settings from allauth.socialaccount.tests import OAuth2TestsMixin from allauth.tests import MockedResponse, TestCase from .provider import GlobusProvider class GlobusTests(OAuth2TestsMixin, TestCase): provider_id = GlobusProvider.id @override_settings(SOCIALACCOUNT_QUERY_EMAIL=True) def get_mocked_response(self): return MockedResponse(200, """ { "identity_provider_display_name": "University of Gozorpazorp", "sub": "a6fc81e-4a6c1-97ac-b4c6-84ff6a8ce662", "preferred_username": "[email protected]", "identity_provider": "9a4c8312f-9432-9a7c-1654-6a987c6531fa", "organization": "University of Gozorpazorp", "email": "[email protected]", "name": "Morty Smith" } """)
{ "content_hash": "34426ad3009bf5f4ec2119949f076830", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 74, "avg_line_length": 34.625, "alnum_prop": 0.6630565583634176, "repo_name": "lukeburden/django-allauth", "id": "3cd7a42d8eaa39cd60565cde6198c3ea9570ea8b", "size": "831", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "allauth/socialaccount/providers/globus/tests.py", "mode": "33188", "license": "mit", "language": [ { "name": "Emacs Lisp", "bytes": "104" }, { "name": "HTML", "bytes": "42255" }, { "name": "JavaScript", "bytes": "3360" }, { "name": "Makefile", "bytes": "396" }, { "name": "Python", "bytes": "776219" } ], "symlink_target": "" }
import * as fs from "fs"; import yaml from "js-yaml"; import validator from "is-my-json-valid"; import extend from "extend"; type Schema = any; interface ValidationError extends Error { _validationErrors?: validator.ValidationError[]; } export class ConfigValidator { /** * Construct a validator of YAML files. * @param schema The JSON schema file object. */ constructor (private schema: Schema) { } /** * Validate the input config. * @param inputConfig The input config file path (string) or * parsed config (Object). * @param defaultConfig The default config options. * @return The input config with defaults applied. * @throws On validation errors */ public validate(inputConfig: string|Schema, defaultConfig: Record<string, unknown> = {}) { if (typeof inputConfig === "string") { inputConfig = ConfigValidator.loadFromFile(inputConfig); } const js = validator(this.schema, { verbose: true, }); const res = js(inputConfig, this.schema); if (!res) { js.errors.forEach(error => { console.error(JSON.stringify(error)); console.error(`The field ${error.field} is ${error.value}` + ` which ${error.message}`); }); const e: ValidationError = new Error("Failed to validate file"); e._validationErrors = js.errors; throw e; } // mux in the default config return extend(true, {}, defaultConfig, inputConfig); } private static loadFromFile(filename: string): Schema { const result = yaml.load(fs.readFileSync(filename, 'utf8')); if (typeof(result) !== "object") { throw Error('Was expecting yaml as an object'); } return result; } public static fromSchemaFile(filename: string): ConfigValidator { return new ConfigValidator(ConfigValidator.loadFromFile(filename)); } }
{ "content_hash": "c813fc21fbfe73865e92aaef7f5817ef", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 94, "avg_line_length": 32.70967741935484, "alnum_prop": 0.6050295857988166, "repo_name": "matrix-org/matrix-appservice-bridge", "id": "60f1c570d5f06e404da97c7218b8fb64ac4edcf8", "size": "2606", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/components/config-validator.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "137158" }, { "name": "Shell", "bytes": "2543" }, { "name": "TypeScript", "bytes": "400943" } ], "symlink_target": "" }
PartiallySignedTransaction::PartiallySignedTransaction( const CMutableTransaction &txIn) : tx(txIn) { inputs.resize(txIn.vin.size()); outputs.resize(txIn.vout.size()); } bool PartiallySignedTransaction::IsNull() const { return !tx && inputs.empty() && outputs.empty() && unknown.empty(); } bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction &psbt) { // Prohibited to merge two PSBTs over different transactions if (tx->GetId() != psbt.tx->GetId()) { return false; } for (size_t i = 0; i < inputs.size(); ++i) { inputs[i].Merge(psbt.inputs[i]); } for (size_t i = 0; i < outputs.size(); ++i) { outputs[i].Merge(psbt.outputs[i]); } unknown.insert(psbt.unknown.begin(), psbt.unknown.end()); return true; } bool PartiallySignedTransaction::IsSane() const { for (PSBTInput input : inputs) { if (!input.IsSane()) { return false; } } return true; } bool PartiallySignedTransaction::AddInput(const CTxIn &txin, PSBTInput &psbtin) { if (std::find(tx->vin.begin(), tx->vin.end(), txin) != tx->vin.end()) { return false; } tx->vin.push_back(txin); psbtin.partial_sigs.clear(); psbtin.final_script_sig.clear(); inputs.push_back(psbtin); return true; } bool PartiallySignedTransaction::AddOutput(const CTxOut &txout, const PSBTOutput &psbtout) { tx->vout.push_back(txout); outputs.push_back(psbtout); return true; } bool PartiallySignedTransaction::GetInputUTXO(CTxOut &utxo, int input_index) const { PSBTInput input = inputs[input_index]; if (!input.utxo.IsNull()) { utxo = input.utxo; } else { return false; } return true; } bool PSBTInput::IsNull() const { return utxo.IsNull() && partial_sigs.empty() && unknown.empty() && hd_keypaths.empty() && redeem_script.empty(); } void PSBTInput::FillSignatureData(SignatureData &sigdata) const { if (!final_script_sig.empty()) { sigdata.scriptSig = final_script_sig; sigdata.complete = true; } if (sigdata.complete) { return; } sigdata.signatures.insert(partial_sigs.begin(), partial_sigs.end()); if (!redeem_script.empty()) { sigdata.redeem_script = redeem_script; } for (const auto &key_pair : hd_keypaths) { sigdata.misc_pubkeys.emplace(key_pair.first.GetID(), key_pair); } } void PSBTInput::FromSignatureData(const SignatureData &sigdata) { if (sigdata.complete) { partial_sigs.clear(); hd_keypaths.clear(); redeem_script.clear(); if (!sigdata.scriptSig.empty()) { final_script_sig = sigdata.scriptSig; } return; } partial_sigs.insert(sigdata.signatures.begin(), sigdata.signatures.end()); if (redeem_script.empty() && !sigdata.redeem_script.empty()) { redeem_script = sigdata.redeem_script; } for (const auto &entry : sigdata.misc_pubkeys) { hd_keypaths.emplace(entry.second); } } void PSBTInput::Merge(const PSBTInput &input) { if (utxo.IsNull() && !input.utxo.IsNull()) { utxo = input.utxo; } partial_sigs.insert(input.partial_sigs.begin(), input.partial_sigs.end()); hd_keypaths.insert(input.hd_keypaths.begin(), input.hd_keypaths.end()); unknown.insert(input.unknown.begin(), input.unknown.end()); if (redeem_script.empty() && !input.redeem_script.empty()) { redeem_script = input.redeem_script; } if (final_script_sig.empty() && !input.final_script_sig.empty()) { final_script_sig = input.final_script_sig; } } bool PSBTInput::IsSane() const { return true; } void PSBTOutput::FillSignatureData(SignatureData &sigdata) const { if (!redeem_script.empty()) { sigdata.redeem_script = redeem_script; } for (const auto &key_pair : hd_keypaths) { sigdata.misc_pubkeys.emplace(key_pair.first.GetID(), key_pair); } } void PSBTOutput::FromSignatureData(const SignatureData &sigdata) { if (redeem_script.empty() && !sigdata.redeem_script.empty()) { redeem_script = sigdata.redeem_script; } for (const auto &entry : sigdata.misc_pubkeys) { hd_keypaths.emplace(entry.second); } } bool PSBTOutput::IsNull() const { return redeem_script.empty() && hd_keypaths.empty() && unknown.empty(); } void PSBTOutput::Merge(const PSBTOutput &output) { hd_keypaths.insert(output.hd_keypaths.begin(), output.hd_keypaths.end()); unknown.insert(output.unknown.begin(), output.unknown.end()); if (redeem_script.empty() && !output.redeem_script.empty()) { redeem_script = output.redeem_script; } } bool PSBTInputSigned(const PSBTInput &input) { return !input.final_script_sig.empty(); } bool SignPSBTInput(const SigningProvider &provider, PartiallySignedTransaction &psbt, int index, SigHashType sighash, SignatureData *out_sigdata, bool use_dummy) { PSBTInput &input = psbt.inputs.at(index); const CMutableTransaction &tx = *psbt.tx; if (PSBTInputSigned(input)) { return true; } // Fill SignatureData with input info SignatureData sigdata; input.FillSignatureData(sigdata); // Get UTXO CTxOut utxo; // Verify input sanity if (!input.IsSane()) { return false; } if (input.utxo.IsNull()) { return false; } utxo = input.utxo; bool sig_complete{false}; if (use_dummy) { sig_complete = ProduceSignature(provider, DUMMY_SIGNATURE_CREATOR, utxo.scriptPubKey, sigdata); } else { MutableTransactionSignatureCreator creator(&tx, index, utxo.nValue, sighash); sig_complete = ProduceSignature(provider, creator, utxo.scriptPubKey, sigdata); } input.FromSignatureData(sigdata); // Fill in the missing info if (out_sigdata != nullptr) { out_sigdata->missing_pubkeys = sigdata.missing_pubkeys; out_sigdata->missing_sigs = sigdata.missing_sigs; out_sigdata->missing_redeem_script = sigdata.missing_redeem_script; } return sig_complete; } bool FinalizePSBT(PartiallySignedTransaction &psbtx) { // Finalize input signatures -- in case we have partial signatures that add // up to a complete // signature, but have not combined them yet (e.g. because the combiner // that created this PartiallySignedTransaction did not understand them), // this will combine them into a final script. bool complete = true; for (size_t i = 0; i < psbtx.tx->vin.size(); ++i) { complete &= SignPSBTInput(DUMMY_SIGNING_PROVIDER, psbtx, i, SigHashType()); } return complete; } bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result) { // It's not safe to extract a PSBT that isn't finalized, and there's no easy // way to check // whether a PSBT is finalized without finalizing it, so we just do this. if (!FinalizePSBT(psbtx)) { return false; } result = *psbtx.tx; for (size_t i = 0; i < result.vin.size(); ++i) { result.vin[i].scriptSig = psbtx.inputs[i].final_script_sig; } return true; } TransactionError CombinePSBTs(PartiallySignedTransaction &out, const std::vector<PartiallySignedTransaction> &psbtxs) { // Copy the first one out = psbtxs[0]; // Merge for (auto it = std::next(psbtxs.begin()); it != psbtxs.end(); ++it) { if (!out.Merge(*it)) { return TransactionError::PSBT_MISMATCH; } } if (!out.IsSane()) { return TransactionError::INVALID_PSBT; } return TransactionError::OK; } std::string PSBTRoleName(const PSBTRole role) { switch (role) { case PSBTRole::UPDATER: return "updater"; case PSBTRole::SIGNER: return "signer"; case PSBTRole::FINALIZER: return "finalizer"; case PSBTRole::EXTRACTOR: return "extractor"; } assert(false); } bool DecodeBase64PSBT(PartiallySignedTransaction &psbt, const std::string &base64_tx, std::string &error) { bool invalid; std::string tx_data = DecodeBase64(base64_tx, &invalid); if (invalid) { error = "invalid base64"; return false; } return DecodeRawPSBT(psbt, tx_data, error); } bool DecodeRawPSBT(PartiallySignedTransaction &psbt, const std::string &tx_data, std::string &error) { CDataStream ss_data(tx_data.data(), tx_data.data() + tx_data.size(), SER_NETWORK, PROTOCOL_VERSION); try { ss_data >> psbt; if (!ss_data.empty()) { error = "extra data after PSBT"; return false; } } catch (const std::exception &e) { error = e.what(); return false; } return true; }
{ "content_hash": "28145140691636b4d983e5497a13a179", "timestamp": "", "source": "github", "line_count": 309, "max_line_length": 80, "avg_line_length": 29.789644012944983, "alnum_prop": 0.6089082020640956, "repo_name": "cculianu/bitcoin-abc", "id": "23e13d489506186c3c8e012d6e21e75f593469ea", "size": "9470", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/psbt.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "28456" }, { "name": "C", "bytes": "676074" }, { "name": "C++", "bytes": "5385212" }, { "name": "HTML", "bytes": "20970" }, { "name": "Java", "bytes": "30290" }, { "name": "M4", "bytes": "192408" }, { "name": "Makefile", "bytes": "112555" }, { "name": "Objective-C", "bytes": "123566" }, { "name": "Objective-C++", "bytes": "7251" }, { "name": "PHP", "bytes": "4085" }, { "name": "Python", "bytes": "1027736" }, { "name": "QMake", "bytes": "756" }, { "name": "Ruby", "bytes": "740" }, { "name": "Shell", "bytes": "59432" } ], "symlink_target": "" }
#include "test-tool.h" #include "cache.h" #include "string-list.h" /* * Parse an argument into a string list. arg should either be a * ':'-separated list of strings, or "-" to indicate an empty string * list (as opposed to "", which indicates a string list containing a * single empty string). list->strdup_strings must be set. */ static void parse_string_list(struct string_list *list, const char *arg) { if (!strcmp(arg, "-")) return; (void)string_list_split(list, arg, ':', -1); } static void write_list(const struct string_list *list) { int i; for (i = 0; i < list->nr; i++) printf("[%d]: \"%s\"\n", i, list->items[i].string); } static void write_list_compact(const struct string_list *list) { int i; if (!list->nr) printf("-\n"); else { printf("%s", list->items[0].string); for (i = 1; i < list->nr; i++) printf(":%s", list->items[i].string); printf("\n"); } } static int prefix_cb(struct string_list_item *item, void *cb_data) { const char *prefix = (const char *)cb_data; return starts_with(item->string, prefix); } int cmd__string_list(int argc, const char **argv) { if (argc == 5 && !strcmp(argv[1], "split")) { struct string_list list = STRING_LIST_INIT_DUP; int i; const char *s = argv[2]; int delim = *argv[3]; int maxsplit = atoi(argv[4]); i = string_list_split(&list, s, delim, maxsplit); printf("%d\n", i); write_list(&list); string_list_clear(&list, 0); return 0; } if (argc == 5 && !strcmp(argv[1], "split_in_place")) { struct string_list list = STRING_LIST_INIT_NODUP; int i; char *s = xstrdup(argv[2]); int delim = *argv[3]; int maxsplit = atoi(argv[4]); i = string_list_split_in_place(&list, s, delim, maxsplit); printf("%d\n", i); write_list(&list); string_list_clear(&list, 0); free(s); return 0; } if (argc == 4 && !strcmp(argv[1], "filter")) { /* * Retain only the items that have the specified prefix. * Arguments: list|- prefix */ struct string_list list = STRING_LIST_INIT_DUP; const char *prefix = argv[3]; parse_string_list(&list, argv[2]); filter_string_list(&list, 0, prefix_cb, (void *)prefix); write_list_compact(&list); string_list_clear(&list, 0); return 0; } if (argc == 3 && !strcmp(argv[1], "remove_duplicates")) { struct string_list list = STRING_LIST_INIT_DUP; parse_string_list(&list, argv[2]); string_list_remove_duplicates(&list, 0); write_list_compact(&list); string_list_clear(&list, 0); return 0; } if (argc == 2 && !strcmp(argv[1], "sort")) { struct string_list list = STRING_LIST_INIT_NODUP; struct strbuf sb = STRBUF_INIT; struct string_list_item *item; strbuf_read(&sb, 0, 0); /* * Split by newline, but don't create a string_list item * for the empty string after the last separator. */ if (sb.len && sb.buf[sb.len - 1] == '\n') strbuf_setlen(&sb, sb.len - 1); string_list_split_in_place(&list, sb.buf, '\n', -1); string_list_sort(&list); for_each_string_list_item(item, &list) puts(item->string); string_list_clear(&list, 0); strbuf_release(&sb); return 0; } fprintf(stderr, "%s: unknown function name: %s\n", argv[0], argv[1] ? argv[1] : "(there was none)"); return 1; }
{ "content_hash": "c09349d4c14fd9b797dc8ea692983b8f", "timestamp": "", "source": "github", "line_count": 129, "max_line_length": 72, "avg_line_length": 24.868217054263567, "alnum_prop": 0.6234413965087282, "repo_name": "astabschneider/astabschneider.github.io", "id": "2123dda85bf10033dcbf0d801028b3705e73a507", "size": "3208", "binary": false, "copies": "49", "ref": "refs/heads/master", "path": "_site/git/t/helper/test-string-list.c", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "7443" }, { "name": "Batchfile", "bytes": "10109" }, { "name": "C", "bytes": "8451305" }, { "name": "C++", "bytes": "35298" }, { "name": "CSS", "bytes": "148582" }, { "name": "Emacs Lisp", "bytes": "660" }, { "name": "Go", "bytes": "15064" }, { "name": "HTML", "bytes": "82266" }, { "name": "JavaScript", "bytes": "49704" }, { "name": "M4", "bytes": "39402" }, { "name": "Makefile", "bytes": "144336" }, { "name": "Objective-C", "bytes": "9318" }, { "name": "PHP", "bytes": "7985" }, { "name": "Perl", "bytes": "1165406" }, { "name": "Python", "bytes": "342524" }, { "name": "Roff", "bytes": "26859" }, { "name": "Ruby", "bytes": "9304" }, { "name": "Shell", "bytes": "6191692" }, { "name": "SmPL", "bytes": "7966" }, { "name": "Tcl", "bytes": "801389" }, { "name": "sed", "bytes": "10824" } ], "symlink_target": "" }
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v12/resources/invoice.proto package com.google.ads.googleads.v12.resources; /** * <pre> * An invoice. All invoice information is snapshotted to match the PDF invoice. * For invoices older than the launch of InvoiceService, the snapshotted * information may not match the PDF invoice. * </pre> * * Protobuf type {@code google.ads.googleads.v12.resources.Invoice} */ public final class Invoice extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.ads.googleads.v12.resources.Invoice) InvoiceOrBuilder { private static final long serialVersionUID = 0L; // Use Invoice.newBuilder() to construct. private Invoice(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private Invoice() { resourceName_ = ""; id_ = ""; type_ = 0; billingSetup_ = ""; paymentsAccountId_ = ""; paymentsProfileId_ = ""; issueDate_ = ""; dueDate_ = ""; currencyCode_ = ""; correctedInvoice_ = ""; replacedInvoices_ = com.google.protobuf.LazyStringArrayList.EMPTY; pdfUrl_ = ""; accountBudgetSummaries_ = java.util.Collections.emptyList(); accountSummaries_ = java.util.Collections.emptyList(); } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new Invoice(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.resources.Invoice.class, com.google.ads.googleads.v12.resources.Invoice.Builder.class); } public interface AccountSummaryOrBuilder extends // @@protoc_insertion_point(interface_extends:google.ads.googleads.v12.resources.Invoice.AccountSummary) com.google.protobuf.MessageOrBuilder { /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customer field is set. */ boolean hasCustomer(); /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customer. */ java.lang.String getCustomer(); /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customer. */ com.google.protobuf.ByteString getCustomerBytes(); /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionSubtotalAmountMicros field is set. */ boolean hasBillingCorrectionSubtotalAmountMicros(); /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionSubtotalAmountMicros. */ long getBillingCorrectionSubtotalAmountMicros(); /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionTaxAmountMicros field is set. */ boolean hasBillingCorrectionTaxAmountMicros(); /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionTaxAmountMicros. */ long getBillingCorrectionTaxAmountMicros(); /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionTotalAmountMicros field is set. */ boolean hasBillingCorrectionTotalAmountMicros(); /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionTotalAmountMicros. */ long getBillingCorrectionTotalAmountMicros(); /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentSubtotalAmountMicros field is set. */ boolean hasCouponAdjustmentSubtotalAmountMicros(); /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentSubtotalAmountMicros. */ long getCouponAdjustmentSubtotalAmountMicros(); /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentTaxAmountMicros field is set. */ boolean hasCouponAdjustmentTaxAmountMicros(); /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentTaxAmountMicros. */ long getCouponAdjustmentTaxAmountMicros(); /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentTotalAmountMicros field is set. */ boolean hasCouponAdjustmentTotalAmountMicros(); /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentTotalAmountMicros. */ long getCouponAdjustmentTotalAmountMicros(); /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentSubtotalAmountMicros field is set. */ boolean hasExcessCreditAdjustmentSubtotalAmountMicros(); /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentSubtotalAmountMicros. */ long getExcessCreditAdjustmentSubtotalAmountMicros(); /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentTaxAmountMicros field is set. */ boolean hasExcessCreditAdjustmentTaxAmountMicros(); /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentTaxAmountMicros. */ long getExcessCreditAdjustmentTaxAmountMicros(); /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentTotalAmountMicros field is set. */ boolean hasExcessCreditAdjustmentTotalAmountMicros(); /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentTotalAmountMicros. */ long getExcessCreditAdjustmentTotalAmountMicros(); /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsSubtotalAmountMicros field is set. */ boolean hasRegulatoryCostsSubtotalAmountMicros(); /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsSubtotalAmountMicros. */ long getRegulatoryCostsSubtotalAmountMicros(); /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsTaxAmountMicros field is set. */ boolean hasRegulatoryCostsTaxAmountMicros(); /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTaxAmountMicros. */ long getRegulatoryCostsTaxAmountMicros(); /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsTotalAmountMicros field is set. */ boolean hasRegulatoryCostsTotalAmountMicros(); /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTotalAmountMicros. */ long getRegulatoryCostsTotalAmountMicros(); /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ boolean hasSubtotalAmountMicros(); /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ long getSubtotalAmountMicros(); /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ boolean hasTaxAmountMicros(); /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ long getTaxAmountMicros(); /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ boolean hasTotalAmountMicros(); /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ long getTotalAmountMicros(); } /** * <pre> * Represents a summarized view at account level. * AccountSummary fields are accessible only to customers on the allow-list. * </pre> * * Protobuf type {@code google.ads.googleads.v12.resources.Invoice.AccountSummary} */ public static final class AccountSummary extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.ads.googleads.v12.resources.Invoice.AccountSummary) AccountSummaryOrBuilder { private static final long serialVersionUID = 0L; // Use AccountSummary.newBuilder() to construct. private AccountSummary(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private AccountSummary() { customer_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new AccountSummary(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountSummary_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountSummary_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.resources.Invoice.AccountSummary.class, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder.class); } private int bitField0_; public static final int CUSTOMER_FIELD_NUMBER = 1; private volatile java.lang.Object customer_; /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customer field is set. */ @java.lang.Override public boolean hasCustomer() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customer. */ @java.lang.Override public java.lang.String getCustomer() { java.lang.Object ref = customer_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); customer_ = s; return s; } } /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customer. */ @java.lang.Override public com.google.protobuf.ByteString getCustomerBytes() { java.lang.Object ref = customer_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); customer_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int BILLING_CORRECTION_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 2; private long billingCorrectionSubtotalAmountMicros_; /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasBillingCorrectionSubtotalAmountMicros() { return ((bitField0_ & 0x00000002) != 0); } /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionSubtotalAmountMicros. */ @java.lang.Override public long getBillingCorrectionSubtotalAmountMicros() { return billingCorrectionSubtotalAmountMicros_; } public static final int BILLING_CORRECTION_TAX_AMOUNT_MICROS_FIELD_NUMBER = 3; private long billingCorrectionTaxAmountMicros_; /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionTaxAmountMicros field is set. */ @java.lang.Override public boolean hasBillingCorrectionTaxAmountMicros() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionTaxAmountMicros. */ @java.lang.Override public long getBillingCorrectionTaxAmountMicros() { return billingCorrectionTaxAmountMicros_; } public static final int BILLING_CORRECTION_TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 4; private long billingCorrectionTotalAmountMicros_; /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionTotalAmountMicros field is set. */ @java.lang.Override public boolean hasBillingCorrectionTotalAmountMicros() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionTotalAmountMicros. */ @java.lang.Override public long getBillingCorrectionTotalAmountMicros() { return billingCorrectionTotalAmountMicros_; } public static final int COUPON_ADJUSTMENT_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 5; private long couponAdjustmentSubtotalAmountMicros_; /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasCouponAdjustmentSubtotalAmountMicros() { return ((bitField0_ & 0x00000010) != 0); } /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentSubtotalAmountMicros. */ @java.lang.Override public long getCouponAdjustmentSubtotalAmountMicros() { return couponAdjustmentSubtotalAmountMicros_; } public static final int COUPON_ADJUSTMENT_TAX_AMOUNT_MICROS_FIELD_NUMBER = 6; private long couponAdjustmentTaxAmountMicros_; /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentTaxAmountMicros field is set. */ @java.lang.Override public boolean hasCouponAdjustmentTaxAmountMicros() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentTaxAmountMicros. */ @java.lang.Override public long getCouponAdjustmentTaxAmountMicros() { return couponAdjustmentTaxAmountMicros_; } public static final int COUPON_ADJUSTMENT_TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 7; private long couponAdjustmentTotalAmountMicros_; /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentTotalAmountMicros field is set. */ @java.lang.Override public boolean hasCouponAdjustmentTotalAmountMicros() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentTotalAmountMicros. */ @java.lang.Override public long getCouponAdjustmentTotalAmountMicros() { return couponAdjustmentTotalAmountMicros_; } public static final int EXCESS_CREDIT_ADJUSTMENT_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 8; private long excessCreditAdjustmentSubtotalAmountMicros_; /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasExcessCreditAdjustmentSubtotalAmountMicros() { return ((bitField0_ & 0x00000080) != 0); } /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentSubtotalAmountMicros. */ @java.lang.Override public long getExcessCreditAdjustmentSubtotalAmountMicros() { return excessCreditAdjustmentSubtotalAmountMicros_; } public static final int EXCESS_CREDIT_ADJUSTMENT_TAX_AMOUNT_MICROS_FIELD_NUMBER = 9; private long excessCreditAdjustmentTaxAmountMicros_; /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentTaxAmountMicros field is set. */ @java.lang.Override public boolean hasExcessCreditAdjustmentTaxAmountMicros() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentTaxAmountMicros. */ @java.lang.Override public long getExcessCreditAdjustmentTaxAmountMicros() { return excessCreditAdjustmentTaxAmountMicros_; } public static final int EXCESS_CREDIT_ADJUSTMENT_TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 10; private long excessCreditAdjustmentTotalAmountMicros_; /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentTotalAmountMicros field is set. */ @java.lang.Override public boolean hasExcessCreditAdjustmentTotalAmountMicros() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentTotalAmountMicros. */ @java.lang.Override public long getExcessCreditAdjustmentTotalAmountMicros() { return excessCreditAdjustmentTotalAmountMicros_; } public static final int REGULATORY_COSTS_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 11; private long regulatoryCostsSubtotalAmountMicros_; /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasRegulatoryCostsSubtotalAmountMicros() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsSubtotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsSubtotalAmountMicros() { return regulatoryCostsSubtotalAmountMicros_; } public static final int REGULATORY_COSTS_TAX_AMOUNT_MICROS_FIELD_NUMBER = 12; private long regulatoryCostsTaxAmountMicros_; /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsTaxAmountMicros field is set. */ @java.lang.Override public boolean hasRegulatoryCostsTaxAmountMicros() { return ((bitField0_ & 0x00000800) != 0); } /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTaxAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTaxAmountMicros() { return regulatoryCostsTaxAmountMicros_; } public static final int REGULATORY_COSTS_TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 13; private long regulatoryCostsTotalAmountMicros_; /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsTotalAmountMicros field is set. */ @java.lang.Override public boolean hasRegulatoryCostsTotalAmountMicros() { return ((bitField0_ & 0x00001000) != 0); } /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTotalAmountMicros() { return regulatoryCostsTotalAmountMicros_; } public static final int SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 14; private long subtotalAmountMicros_; /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ @java.lang.Override public boolean hasSubtotalAmountMicros() { return ((bitField0_ & 0x00002000) != 0); } /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ @java.lang.Override public long getSubtotalAmountMicros() { return subtotalAmountMicros_; } public static final int TAX_AMOUNT_MICROS_FIELD_NUMBER = 15; private long taxAmountMicros_; /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ @java.lang.Override public boolean hasTaxAmountMicros() { return ((bitField0_ & 0x00004000) != 0); } /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ @java.lang.Override public long getTaxAmountMicros() { return taxAmountMicros_; } public static final int TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 16; private long totalAmountMicros_; /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ @java.lang.Override public boolean hasTotalAmountMicros() { return ((bitField0_ & 0x00008000) != 0); } /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ @java.lang.Override public long getTotalAmountMicros() { return totalAmountMicros_; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, customer_); } if (((bitField0_ & 0x00000002) != 0)) { output.writeInt64(2, billingCorrectionSubtotalAmountMicros_); } if (((bitField0_ & 0x00000004) != 0)) { output.writeInt64(3, billingCorrectionTaxAmountMicros_); } if (((bitField0_ & 0x00000008) != 0)) { output.writeInt64(4, billingCorrectionTotalAmountMicros_); } if (((bitField0_ & 0x00000010) != 0)) { output.writeInt64(5, couponAdjustmentSubtotalAmountMicros_); } if (((bitField0_ & 0x00000020) != 0)) { output.writeInt64(6, couponAdjustmentTaxAmountMicros_); } if (((bitField0_ & 0x00000040) != 0)) { output.writeInt64(7, couponAdjustmentTotalAmountMicros_); } if (((bitField0_ & 0x00000080) != 0)) { output.writeInt64(8, excessCreditAdjustmentSubtotalAmountMicros_); } if (((bitField0_ & 0x00000100) != 0)) { output.writeInt64(9, excessCreditAdjustmentTaxAmountMicros_); } if (((bitField0_ & 0x00000200) != 0)) { output.writeInt64(10, excessCreditAdjustmentTotalAmountMicros_); } if (((bitField0_ & 0x00000400) != 0)) { output.writeInt64(11, regulatoryCostsSubtotalAmountMicros_); } if (((bitField0_ & 0x00000800) != 0)) { output.writeInt64(12, regulatoryCostsTaxAmountMicros_); } if (((bitField0_ & 0x00001000) != 0)) { output.writeInt64(13, regulatoryCostsTotalAmountMicros_); } if (((bitField0_ & 0x00002000) != 0)) { output.writeInt64(14, subtotalAmountMicros_); } if (((bitField0_ & 0x00004000) != 0)) { output.writeInt64(15, taxAmountMicros_); } if (((bitField0_ & 0x00008000) != 0)) { output.writeInt64(16, totalAmountMicros_); } getUnknownFields().writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, customer_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, billingCorrectionSubtotalAmountMicros_); } if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, billingCorrectionTaxAmountMicros_); } if (((bitField0_ & 0x00000008) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(4, billingCorrectionTotalAmountMicros_); } if (((bitField0_ & 0x00000010) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(5, couponAdjustmentSubtotalAmountMicros_); } if (((bitField0_ & 0x00000020) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(6, couponAdjustmentTaxAmountMicros_); } if (((bitField0_ & 0x00000040) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(7, couponAdjustmentTotalAmountMicros_); } if (((bitField0_ & 0x00000080) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(8, excessCreditAdjustmentSubtotalAmountMicros_); } if (((bitField0_ & 0x00000100) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(9, excessCreditAdjustmentTaxAmountMicros_); } if (((bitField0_ & 0x00000200) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(10, excessCreditAdjustmentTotalAmountMicros_); } if (((bitField0_ & 0x00000400) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(11, regulatoryCostsSubtotalAmountMicros_); } if (((bitField0_ & 0x00000800) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(12, regulatoryCostsTaxAmountMicros_); } if (((bitField0_ & 0x00001000) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(13, regulatoryCostsTotalAmountMicros_); } if (((bitField0_ & 0x00002000) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(14, subtotalAmountMicros_); } if (((bitField0_ & 0x00004000) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(15, taxAmountMicros_); } if (((bitField0_ & 0x00008000) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(16, totalAmountMicros_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.ads.googleads.v12.resources.Invoice.AccountSummary)) { return super.equals(obj); } com.google.ads.googleads.v12.resources.Invoice.AccountSummary other = (com.google.ads.googleads.v12.resources.Invoice.AccountSummary) obj; if (hasCustomer() != other.hasCustomer()) return false; if (hasCustomer()) { if (!getCustomer() .equals(other.getCustomer())) return false; } if (hasBillingCorrectionSubtotalAmountMicros() != other.hasBillingCorrectionSubtotalAmountMicros()) return false; if (hasBillingCorrectionSubtotalAmountMicros()) { if (getBillingCorrectionSubtotalAmountMicros() != other.getBillingCorrectionSubtotalAmountMicros()) return false; } if (hasBillingCorrectionTaxAmountMicros() != other.hasBillingCorrectionTaxAmountMicros()) return false; if (hasBillingCorrectionTaxAmountMicros()) { if (getBillingCorrectionTaxAmountMicros() != other.getBillingCorrectionTaxAmountMicros()) return false; } if (hasBillingCorrectionTotalAmountMicros() != other.hasBillingCorrectionTotalAmountMicros()) return false; if (hasBillingCorrectionTotalAmountMicros()) { if (getBillingCorrectionTotalAmountMicros() != other.getBillingCorrectionTotalAmountMicros()) return false; } if (hasCouponAdjustmentSubtotalAmountMicros() != other.hasCouponAdjustmentSubtotalAmountMicros()) return false; if (hasCouponAdjustmentSubtotalAmountMicros()) { if (getCouponAdjustmentSubtotalAmountMicros() != other.getCouponAdjustmentSubtotalAmountMicros()) return false; } if (hasCouponAdjustmentTaxAmountMicros() != other.hasCouponAdjustmentTaxAmountMicros()) return false; if (hasCouponAdjustmentTaxAmountMicros()) { if (getCouponAdjustmentTaxAmountMicros() != other.getCouponAdjustmentTaxAmountMicros()) return false; } if (hasCouponAdjustmentTotalAmountMicros() != other.hasCouponAdjustmentTotalAmountMicros()) return false; if (hasCouponAdjustmentTotalAmountMicros()) { if (getCouponAdjustmentTotalAmountMicros() != other.getCouponAdjustmentTotalAmountMicros()) return false; } if (hasExcessCreditAdjustmentSubtotalAmountMicros() != other.hasExcessCreditAdjustmentSubtotalAmountMicros()) return false; if (hasExcessCreditAdjustmentSubtotalAmountMicros()) { if (getExcessCreditAdjustmentSubtotalAmountMicros() != other.getExcessCreditAdjustmentSubtotalAmountMicros()) return false; } if (hasExcessCreditAdjustmentTaxAmountMicros() != other.hasExcessCreditAdjustmentTaxAmountMicros()) return false; if (hasExcessCreditAdjustmentTaxAmountMicros()) { if (getExcessCreditAdjustmentTaxAmountMicros() != other.getExcessCreditAdjustmentTaxAmountMicros()) return false; } if (hasExcessCreditAdjustmentTotalAmountMicros() != other.hasExcessCreditAdjustmentTotalAmountMicros()) return false; if (hasExcessCreditAdjustmentTotalAmountMicros()) { if (getExcessCreditAdjustmentTotalAmountMicros() != other.getExcessCreditAdjustmentTotalAmountMicros()) return false; } if (hasRegulatoryCostsSubtotalAmountMicros() != other.hasRegulatoryCostsSubtotalAmountMicros()) return false; if (hasRegulatoryCostsSubtotalAmountMicros()) { if (getRegulatoryCostsSubtotalAmountMicros() != other.getRegulatoryCostsSubtotalAmountMicros()) return false; } if (hasRegulatoryCostsTaxAmountMicros() != other.hasRegulatoryCostsTaxAmountMicros()) return false; if (hasRegulatoryCostsTaxAmountMicros()) { if (getRegulatoryCostsTaxAmountMicros() != other.getRegulatoryCostsTaxAmountMicros()) return false; } if (hasRegulatoryCostsTotalAmountMicros() != other.hasRegulatoryCostsTotalAmountMicros()) return false; if (hasRegulatoryCostsTotalAmountMicros()) { if (getRegulatoryCostsTotalAmountMicros() != other.getRegulatoryCostsTotalAmountMicros()) return false; } if (hasSubtotalAmountMicros() != other.hasSubtotalAmountMicros()) return false; if (hasSubtotalAmountMicros()) { if (getSubtotalAmountMicros() != other.getSubtotalAmountMicros()) return false; } if (hasTaxAmountMicros() != other.hasTaxAmountMicros()) return false; if (hasTaxAmountMicros()) { if (getTaxAmountMicros() != other.getTaxAmountMicros()) return false; } if (hasTotalAmountMicros() != other.hasTotalAmountMicros()) return false; if (hasTotalAmountMicros()) { if (getTotalAmountMicros() != other.getTotalAmountMicros()) return false; } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasCustomer()) { hash = (37 * hash) + CUSTOMER_FIELD_NUMBER; hash = (53 * hash) + getCustomer().hashCode(); } if (hasBillingCorrectionSubtotalAmountMicros()) { hash = (37 * hash) + BILLING_CORRECTION_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getBillingCorrectionSubtotalAmountMicros()); } if (hasBillingCorrectionTaxAmountMicros()) { hash = (37 * hash) + BILLING_CORRECTION_TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getBillingCorrectionTaxAmountMicros()); } if (hasBillingCorrectionTotalAmountMicros()) { hash = (37 * hash) + BILLING_CORRECTION_TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getBillingCorrectionTotalAmountMicros()); } if (hasCouponAdjustmentSubtotalAmountMicros()) { hash = (37 * hash) + COUPON_ADJUSTMENT_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getCouponAdjustmentSubtotalAmountMicros()); } if (hasCouponAdjustmentTaxAmountMicros()) { hash = (37 * hash) + COUPON_ADJUSTMENT_TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getCouponAdjustmentTaxAmountMicros()); } if (hasCouponAdjustmentTotalAmountMicros()) { hash = (37 * hash) + COUPON_ADJUSTMENT_TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getCouponAdjustmentTotalAmountMicros()); } if (hasExcessCreditAdjustmentSubtotalAmountMicros()) { hash = (37 * hash) + EXCESS_CREDIT_ADJUSTMENT_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getExcessCreditAdjustmentSubtotalAmountMicros()); } if (hasExcessCreditAdjustmentTaxAmountMicros()) { hash = (37 * hash) + EXCESS_CREDIT_ADJUSTMENT_TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getExcessCreditAdjustmentTaxAmountMicros()); } if (hasExcessCreditAdjustmentTotalAmountMicros()) { hash = (37 * hash) + EXCESS_CREDIT_ADJUSTMENT_TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getExcessCreditAdjustmentTotalAmountMicros()); } if (hasRegulatoryCostsSubtotalAmountMicros()) { hash = (37 * hash) + REGULATORY_COSTS_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getRegulatoryCostsSubtotalAmountMicros()); } if (hasRegulatoryCostsTaxAmountMicros()) { hash = (37 * hash) + REGULATORY_COSTS_TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getRegulatoryCostsTaxAmountMicros()); } if (hasRegulatoryCostsTotalAmountMicros()) { hash = (37 * hash) + REGULATORY_COSTS_TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getRegulatoryCostsTotalAmountMicros()); } if (hasSubtotalAmountMicros()) { hash = (37 * hash) + SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getSubtotalAmountMicros()); } if (hasTaxAmountMicros()) { hash = (37 * hash) + TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getTaxAmountMicros()); } if (hasTotalAmountMicros()) { hash = (37 * hash) + TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getTotalAmountMicros()); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.ads.googleads.v12.resources.Invoice.AccountSummary prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * Represents a summarized view at account level. * AccountSummary fields are accessible only to customers on the allow-list. * </pre> * * Protobuf type {@code google.ads.googleads.v12.resources.Invoice.AccountSummary} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.ads.googleads.v12.resources.Invoice.AccountSummary) com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountSummary_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountSummary_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.resources.Invoice.AccountSummary.class, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder.class); } // Construct using com.google.ads.googleads.v12.resources.Invoice.AccountSummary.newBuilder() private Builder() { } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); } @java.lang.Override public Builder clear() { super.clear(); customer_ = ""; bitField0_ = (bitField0_ & ~0x00000001); billingCorrectionSubtotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); billingCorrectionTaxAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000004); billingCorrectionTotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000008); couponAdjustmentSubtotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000010); couponAdjustmentTaxAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000020); couponAdjustmentTotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000040); excessCreditAdjustmentSubtotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000080); excessCreditAdjustmentTaxAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000100); excessCreditAdjustmentTotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000200); regulatoryCostsSubtotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000400); regulatoryCostsTaxAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000800); regulatoryCostsTotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00001000); subtotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00002000); taxAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00004000); totalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00008000); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountSummary_descriptor; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountSummary getDefaultInstanceForType() { return com.google.ads.googleads.v12.resources.Invoice.AccountSummary.getDefaultInstance(); } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountSummary build() { com.google.ads.googleads.v12.resources.Invoice.AccountSummary result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountSummary buildPartial() { com.google.ads.googleads.v12.resources.Invoice.AccountSummary result = new com.google.ads.googleads.v12.resources.Invoice.AccountSummary(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.customer_ = customer_; if (((from_bitField0_ & 0x00000002) != 0)) { result.billingCorrectionSubtotalAmountMicros_ = billingCorrectionSubtotalAmountMicros_; to_bitField0_ |= 0x00000002; } if (((from_bitField0_ & 0x00000004) != 0)) { result.billingCorrectionTaxAmountMicros_ = billingCorrectionTaxAmountMicros_; to_bitField0_ |= 0x00000004; } if (((from_bitField0_ & 0x00000008) != 0)) { result.billingCorrectionTotalAmountMicros_ = billingCorrectionTotalAmountMicros_; to_bitField0_ |= 0x00000008; } if (((from_bitField0_ & 0x00000010) != 0)) { result.couponAdjustmentSubtotalAmountMicros_ = couponAdjustmentSubtotalAmountMicros_; to_bitField0_ |= 0x00000010; } if (((from_bitField0_ & 0x00000020) != 0)) { result.couponAdjustmentTaxAmountMicros_ = couponAdjustmentTaxAmountMicros_; to_bitField0_ |= 0x00000020; } if (((from_bitField0_ & 0x00000040) != 0)) { result.couponAdjustmentTotalAmountMicros_ = couponAdjustmentTotalAmountMicros_; to_bitField0_ |= 0x00000040; } if (((from_bitField0_ & 0x00000080) != 0)) { result.excessCreditAdjustmentSubtotalAmountMicros_ = excessCreditAdjustmentSubtotalAmountMicros_; to_bitField0_ |= 0x00000080; } if (((from_bitField0_ & 0x00000100) != 0)) { result.excessCreditAdjustmentTaxAmountMicros_ = excessCreditAdjustmentTaxAmountMicros_; to_bitField0_ |= 0x00000100; } if (((from_bitField0_ & 0x00000200) != 0)) { result.excessCreditAdjustmentTotalAmountMicros_ = excessCreditAdjustmentTotalAmountMicros_; to_bitField0_ |= 0x00000200; } if (((from_bitField0_ & 0x00000400) != 0)) { result.regulatoryCostsSubtotalAmountMicros_ = regulatoryCostsSubtotalAmountMicros_; to_bitField0_ |= 0x00000400; } if (((from_bitField0_ & 0x00000800) != 0)) { result.regulatoryCostsTaxAmountMicros_ = regulatoryCostsTaxAmountMicros_; to_bitField0_ |= 0x00000800; } if (((from_bitField0_ & 0x00001000) != 0)) { result.regulatoryCostsTotalAmountMicros_ = regulatoryCostsTotalAmountMicros_; to_bitField0_ |= 0x00001000; } if (((from_bitField0_ & 0x00002000) != 0)) { result.subtotalAmountMicros_ = subtotalAmountMicros_; to_bitField0_ |= 0x00002000; } if (((from_bitField0_ & 0x00004000) != 0)) { result.taxAmountMicros_ = taxAmountMicros_; to_bitField0_ |= 0x00004000; } if (((from_bitField0_ & 0x00008000) != 0)) { result.totalAmountMicros_ = totalAmountMicros_; to_bitField0_ |= 0x00008000; } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.ads.googleads.v12.resources.Invoice.AccountSummary) { return mergeFrom((com.google.ads.googleads.v12.resources.Invoice.AccountSummary)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.ads.googleads.v12.resources.Invoice.AccountSummary other) { if (other == com.google.ads.googleads.v12.resources.Invoice.AccountSummary.getDefaultInstance()) return this; if (other.hasCustomer()) { bitField0_ |= 0x00000001; customer_ = other.customer_; onChanged(); } if (other.hasBillingCorrectionSubtotalAmountMicros()) { setBillingCorrectionSubtotalAmountMicros(other.getBillingCorrectionSubtotalAmountMicros()); } if (other.hasBillingCorrectionTaxAmountMicros()) { setBillingCorrectionTaxAmountMicros(other.getBillingCorrectionTaxAmountMicros()); } if (other.hasBillingCorrectionTotalAmountMicros()) { setBillingCorrectionTotalAmountMicros(other.getBillingCorrectionTotalAmountMicros()); } if (other.hasCouponAdjustmentSubtotalAmountMicros()) { setCouponAdjustmentSubtotalAmountMicros(other.getCouponAdjustmentSubtotalAmountMicros()); } if (other.hasCouponAdjustmentTaxAmountMicros()) { setCouponAdjustmentTaxAmountMicros(other.getCouponAdjustmentTaxAmountMicros()); } if (other.hasCouponAdjustmentTotalAmountMicros()) { setCouponAdjustmentTotalAmountMicros(other.getCouponAdjustmentTotalAmountMicros()); } if (other.hasExcessCreditAdjustmentSubtotalAmountMicros()) { setExcessCreditAdjustmentSubtotalAmountMicros(other.getExcessCreditAdjustmentSubtotalAmountMicros()); } if (other.hasExcessCreditAdjustmentTaxAmountMicros()) { setExcessCreditAdjustmentTaxAmountMicros(other.getExcessCreditAdjustmentTaxAmountMicros()); } if (other.hasExcessCreditAdjustmentTotalAmountMicros()) { setExcessCreditAdjustmentTotalAmountMicros(other.getExcessCreditAdjustmentTotalAmountMicros()); } if (other.hasRegulatoryCostsSubtotalAmountMicros()) { setRegulatoryCostsSubtotalAmountMicros(other.getRegulatoryCostsSubtotalAmountMicros()); } if (other.hasRegulatoryCostsTaxAmountMicros()) { setRegulatoryCostsTaxAmountMicros(other.getRegulatoryCostsTaxAmountMicros()); } if (other.hasRegulatoryCostsTotalAmountMicros()) { setRegulatoryCostsTotalAmountMicros(other.getRegulatoryCostsTotalAmountMicros()); } if (other.hasSubtotalAmountMicros()) { setSubtotalAmountMicros(other.getSubtotalAmountMicros()); } if (other.hasTaxAmountMicros()) { setTaxAmountMicros(other.getTaxAmountMicros()); } if (other.hasTotalAmountMicros()) { setTotalAmountMicros(other.getTotalAmountMicros()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { customer_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000001; break; } // case 10 case 16: { billingCorrectionSubtotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000002; break; } // case 16 case 24: { billingCorrectionTaxAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000004; break; } // case 24 case 32: { billingCorrectionTotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000008; break; } // case 32 case 40: { couponAdjustmentSubtotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000010; break; } // case 40 case 48: { couponAdjustmentTaxAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000020; break; } // case 48 case 56: { couponAdjustmentTotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000040; break; } // case 56 case 64: { excessCreditAdjustmentSubtotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000080; break; } // case 64 case 72: { excessCreditAdjustmentTaxAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000100; break; } // case 72 case 80: { excessCreditAdjustmentTotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000200; break; } // case 80 case 88: { regulatoryCostsSubtotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000400; break; } // case 88 case 96: { regulatoryCostsTaxAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000800; break; } // case 96 case 104: { regulatoryCostsTotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00001000; break; } // case 104 case 112: { subtotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00002000; break; } // case 112 case 120: { taxAmountMicros_ = input.readInt64(); bitField0_ |= 0x00004000; break; } // case 120 case 128: { totalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00008000; break; } // case 128 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag } break; } // default: } // switch (tag) } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.unwrapIOException(); } finally { onChanged(); } // finally return this; } private int bitField0_; private java.lang.Object customer_ = ""; /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customer field is set. */ public boolean hasCustomer() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customer. */ public java.lang.String getCustomer() { java.lang.Object ref = customer_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); customer_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customer. */ public com.google.protobuf.ByteString getCustomerBytes() { java.lang.Object ref = customer_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); customer_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The customer to set. * @return This builder for chaining. */ public Builder setCustomer( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; customer_ = value; onChanged(); return this; } /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCustomer() { bitField0_ = (bitField0_ & ~0x00000001); customer_ = getDefaultInstance().getCustomer(); onChanged(); return this; } /** * <pre> * Output only. The account associated with the account summary. * </pre> * * <code>optional string customer = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for customer to set. * @return This builder for chaining. */ public Builder setCustomerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000001; customer_ = value; onChanged(); return this; } private long billingCorrectionSubtotalAmountMicros_ ; /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasBillingCorrectionSubtotalAmountMicros() { return ((bitField0_ & 0x00000002) != 0); } /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionSubtotalAmountMicros. */ @java.lang.Override public long getBillingCorrectionSubtotalAmountMicros() { return billingCorrectionSubtotalAmountMicros_; } /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The billingCorrectionSubtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setBillingCorrectionSubtotalAmountMicros(long value) { bitField0_ |= 0x00000002; billingCorrectionSubtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Pretax billing correction subtotal amount, in micros. * </pre> * * <code>optional int64 billing_correction_subtotal_amount_micros = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearBillingCorrectionSubtotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000002); billingCorrectionSubtotalAmountMicros_ = 0L; onChanged(); return this; } private long billingCorrectionTaxAmountMicros_ ; /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionTaxAmountMicros field is set. */ @java.lang.Override public boolean hasBillingCorrectionTaxAmountMicros() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionTaxAmountMicros. */ @java.lang.Override public long getBillingCorrectionTaxAmountMicros() { return billingCorrectionTaxAmountMicros_; } /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The billingCorrectionTaxAmountMicros to set. * @return This builder for chaining. */ public Builder setBillingCorrectionTaxAmountMicros(long value) { bitField0_ |= 0x00000004; billingCorrectionTaxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Tax on billing correction, in micros. * </pre> * * <code>optional int64 billing_correction_tax_amount_micros = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearBillingCorrectionTaxAmountMicros() { bitField0_ = (bitField0_ & ~0x00000004); billingCorrectionTaxAmountMicros_ = 0L; onChanged(); return this; } private long billingCorrectionTotalAmountMicros_ ; /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingCorrectionTotalAmountMicros field is set. */ @java.lang.Override public boolean hasBillingCorrectionTotalAmountMicros() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingCorrectionTotalAmountMicros. */ @java.lang.Override public long getBillingCorrectionTotalAmountMicros() { return billingCorrectionTotalAmountMicros_; } /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The billingCorrectionTotalAmountMicros to set. * @return This builder for chaining. */ public Builder setBillingCorrectionTotalAmountMicros(long value) { bitField0_ |= 0x00000008; billingCorrectionTotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Total billing correction amount, in micros. * </pre> * * <code>optional int64 billing_correction_total_amount_micros = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearBillingCorrectionTotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000008); billingCorrectionTotalAmountMicros_ = 0L; onChanged(); return this; } private long couponAdjustmentSubtotalAmountMicros_ ; /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasCouponAdjustmentSubtotalAmountMicros() { return ((bitField0_ & 0x00000010) != 0); } /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentSubtotalAmountMicros. */ @java.lang.Override public long getCouponAdjustmentSubtotalAmountMicros() { return couponAdjustmentSubtotalAmountMicros_; } /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The couponAdjustmentSubtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setCouponAdjustmentSubtotalAmountMicros(long value) { bitField0_ |= 0x00000010; couponAdjustmentSubtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Pretax coupon adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_subtotal_amount_micros = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCouponAdjustmentSubtotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000010); couponAdjustmentSubtotalAmountMicros_ = 0L; onChanged(); return this; } private long couponAdjustmentTaxAmountMicros_ ; /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentTaxAmountMicros field is set. */ @java.lang.Override public boolean hasCouponAdjustmentTaxAmountMicros() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentTaxAmountMicros. */ @java.lang.Override public long getCouponAdjustmentTaxAmountMicros() { return couponAdjustmentTaxAmountMicros_; } /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The couponAdjustmentTaxAmountMicros to set. * @return This builder for chaining. */ public Builder setCouponAdjustmentTaxAmountMicros(long value) { bitField0_ |= 0x00000020; couponAdjustmentTaxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Tax on coupon adjustment, in micros. * </pre> * * <code>optional int64 coupon_adjustment_tax_amount_micros = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCouponAdjustmentTaxAmountMicros() { bitField0_ = (bitField0_ & ~0x00000020); couponAdjustmentTaxAmountMicros_ = 0L; onChanged(); return this; } private long couponAdjustmentTotalAmountMicros_ ; /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the couponAdjustmentTotalAmountMicros field is set. */ @java.lang.Override public boolean hasCouponAdjustmentTotalAmountMicros() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The couponAdjustmentTotalAmountMicros. */ @java.lang.Override public long getCouponAdjustmentTotalAmountMicros() { return couponAdjustmentTotalAmountMicros_; } /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The couponAdjustmentTotalAmountMicros to set. * @return This builder for chaining. */ public Builder setCouponAdjustmentTotalAmountMicros(long value) { bitField0_ |= 0x00000040; couponAdjustmentTotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Total coupon adjustment amount, in micros. * </pre> * * <code>optional int64 coupon_adjustment_total_amount_micros = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCouponAdjustmentTotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000040); couponAdjustmentTotalAmountMicros_ = 0L; onChanged(); return this; } private long excessCreditAdjustmentSubtotalAmountMicros_ ; /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasExcessCreditAdjustmentSubtotalAmountMicros() { return ((bitField0_ & 0x00000080) != 0); } /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentSubtotalAmountMicros. */ @java.lang.Override public long getExcessCreditAdjustmentSubtotalAmountMicros() { return excessCreditAdjustmentSubtotalAmountMicros_; } /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The excessCreditAdjustmentSubtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setExcessCreditAdjustmentSubtotalAmountMicros(long value) { bitField0_ |= 0x00000080; excessCreditAdjustmentSubtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Pretax excess credit adjustment subtotal amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_subtotal_amount_micros = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearExcessCreditAdjustmentSubtotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000080); excessCreditAdjustmentSubtotalAmountMicros_ = 0L; onChanged(); return this; } private long excessCreditAdjustmentTaxAmountMicros_ ; /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentTaxAmountMicros field is set. */ @java.lang.Override public boolean hasExcessCreditAdjustmentTaxAmountMicros() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentTaxAmountMicros. */ @java.lang.Override public long getExcessCreditAdjustmentTaxAmountMicros() { return excessCreditAdjustmentTaxAmountMicros_; } /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The excessCreditAdjustmentTaxAmountMicros to set. * @return This builder for chaining. */ public Builder setExcessCreditAdjustmentTaxAmountMicros(long value) { bitField0_ |= 0x00000100; excessCreditAdjustmentTaxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Tax on excess credit adjustment, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_tax_amount_micros = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearExcessCreditAdjustmentTaxAmountMicros() { bitField0_ = (bitField0_ & ~0x00000100); excessCreditAdjustmentTaxAmountMicros_ = 0L; onChanged(); return this; } private long excessCreditAdjustmentTotalAmountMicros_ ; /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the excessCreditAdjustmentTotalAmountMicros field is set. */ @java.lang.Override public boolean hasExcessCreditAdjustmentTotalAmountMicros() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The excessCreditAdjustmentTotalAmountMicros. */ @java.lang.Override public long getExcessCreditAdjustmentTotalAmountMicros() { return excessCreditAdjustmentTotalAmountMicros_; } /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The excessCreditAdjustmentTotalAmountMicros to set. * @return This builder for chaining. */ public Builder setExcessCreditAdjustmentTotalAmountMicros(long value) { bitField0_ |= 0x00000200; excessCreditAdjustmentTotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Total excess credit adjustment amount, in micros. * </pre> * * <code>optional int64 excess_credit_adjustment_total_amount_micros = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearExcessCreditAdjustmentTotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000200); excessCreditAdjustmentTotalAmountMicros_ = 0L; onChanged(); return this; } private long regulatoryCostsSubtotalAmountMicros_ ; /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsSubtotalAmountMicros field is set. */ @java.lang.Override public boolean hasRegulatoryCostsSubtotalAmountMicros() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsSubtotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsSubtotalAmountMicros() { return regulatoryCostsSubtotalAmountMicros_; } /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The regulatoryCostsSubtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setRegulatoryCostsSubtotalAmountMicros(long value) { bitField0_ |= 0x00000400; regulatoryCostsSubtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Pretax regulatory costs subtotal amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_subtotal_amount_micros = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearRegulatoryCostsSubtotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000400); regulatoryCostsSubtotalAmountMicros_ = 0L; onChanged(); return this; } private long regulatoryCostsTaxAmountMicros_ ; /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsTaxAmountMicros field is set. */ @java.lang.Override public boolean hasRegulatoryCostsTaxAmountMicros() { return ((bitField0_ & 0x00000800) != 0); } /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTaxAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTaxAmountMicros() { return regulatoryCostsTaxAmountMicros_; } /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The regulatoryCostsTaxAmountMicros to set. * @return This builder for chaining. */ public Builder setRegulatoryCostsTaxAmountMicros(long value) { bitField0_ |= 0x00000800; regulatoryCostsTaxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Tax on regulatory costs, in micros. * </pre> * * <code>optional int64 regulatory_costs_tax_amount_micros = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearRegulatoryCostsTaxAmountMicros() { bitField0_ = (bitField0_ & ~0x00000800); regulatoryCostsTaxAmountMicros_ = 0L; onChanged(); return this; } private long regulatoryCostsTotalAmountMicros_ ; /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the regulatoryCostsTotalAmountMicros field is set. */ @java.lang.Override public boolean hasRegulatoryCostsTotalAmountMicros() { return ((bitField0_ & 0x00001000) != 0); } /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTotalAmountMicros() { return regulatoryCostsTotalAmountMicros_; } /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The regulatoryCostsTotalAmountMicros to set. * @return This builder for chaining. */ public Builder setRegulatoryCostsTotalAmountMicros(long value) { bitField0_ |= 0x00001000; regulatoryCostsTotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Total regulatory costs amount, in micros. * </pre> * * <code>optional int64 regulatory_costs_total_amount_micros = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearRegulatoryCostsTotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00001000); regulatoryCostsTotalAmountMicros_ = 0L; onChanged(); return this; } private long subtotalAmountMicros_ ; /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ @java.lang.Override public boolean hasSubtotalAmountMicros() { return ((bitField0_ & 0x00002000) != 0); } /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ @java.lang.Override public long getSubtotalAmountMicros() { return subtotalAmountMicros_; } /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The subtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setSubtotalAmountMicros(long value) { bitField0_ |= 0x00002000; subtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Total pretax subtotal amount attributable to the account during the * service period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearSubtotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00002000); subtotalAmountMicros_ = 0L; onChanged(); return this; } private long taxAmountMicros_ ; /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ @java.lang.Override public boolean hasTaxAmountMicros() { return ((bitField0_ & 0x00004000) != 0); } /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ @java.lang.Override public long getTaxAmountMicros() { return taxAmountMicros_; } /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The taxAmountMicros to set. * @return This builder for chaining. */ public Builder setTaxAmountMicros(long value) { bitField0_ |= 0x00004000; taxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Total tax amount attributable to the account during the service period, * in micros. * </pre> * * <code>optional int64 tax_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearTaxAmountMicros() { bitField0_ = (bitField0_ & ~0x00004000); taxAmountMicros_ = 0L; onChanged(); return this; } private long totalAmountMicros_ ; /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ @java.lang.Override public boolean hasTotalAmountMicros() { return ((bitField0_ & 0x00008000) != 0); } /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ @java.lang.Override public long getTotalAmountMicros() { return totalAmountMicros_; } /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The totalAmountMicros to set. * @return This builder for chaining. */ public Builder setTotalAmountMicros(long value) { bitField0_ |= 0x00008000; totalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Total amount attributable to the account during the service period, in * micros. This equals the sum of the subtotal_amount_micros and * tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearTotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00008000); totalAmountMicros_ = 0L; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.ads.googleads.v12.resources.Invoice.AccountSummary) } // @@protoc_insertion_point(class_scope:google.ads.googleads.v12.resources.Invoice.AccountSummary) private static final com.google.ads.googleads.v12.resources.Invoice.AccountSummary DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.ads.googleads.v12.resources.Invoice.AccountSummary(); } public static com.google.ads.googleads.v12.resources.Invoice.AccountSummary getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<AccountSummary> PARSER = new com.google.protobuf.AbstractParser<AccountSummary>() { @java.lang.Override public AccountSummary parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { Builder builder = newBuilder(); try { builder.mergeFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(builder.buildPartial()); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(builder.buildPartial()); } return builder.buildPartial(); } }; public static com.google.protobuf.Parser<AccountSummary> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<AccountSummary> getParserForType() { return PARSER; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountSummary getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } public interface AccountBudgetSummaryOrBuilder extends // @@protoc_insertion_point(interface_extends:google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary) com.google.protobuf.MessageOrBuilder { /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customer field is set. */ boolean hasCustomer(); /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customer. */ java.lang.String getCustomer(); /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customer. */ com.google.protobuf.ByteString getCustomerBytes(); /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customerDescriptiveName field is set. */ boolean hasCustomerDescriptiveName(); /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customerDescriptiveName. */ java.lang.String getCustomerDescriptiveName(); /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customerDescriptiveName. */ com.google.protobuf.ByteString getCustomerDescriptiveNameBytes(); /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the accountBudget field is set. */ boolean hasAccountBudget(); /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The accountBudget. */ java.lang.String getAccountBudget(); /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for accountBudget. */ com.google.protobuf.ByteString getAccountBudgetBytes(); /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the accountBudgetName field is set. */ boolean hasAccountBudgetName(); /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The accountBudgetName. */ java.lang.String getAccountBudgetName(); /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for accountBudgetName. */ com.google.protobuf.ByteString getAccountBudgetNameBytes(); /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the purchaseOrderNumber field is set. */ boolean hasPurchaseOrderNumber(); /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The purchaseOrderNumber. */ java.lang.String getPurchaseOrderNumber(); /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for purchaseOrderNumber. */ com.google.protobuf.ByteString getPurchaseOrderNumberBytes(); /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ boolean hasSubtotalAmountMicros(); /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ long getSubtotalAmountMicros(); /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ boolean hasTaxAmountMicros(); /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ long getTaxAmountMicros(); /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ boolean hasTotalAmountMicros(); /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ long getTotalAmountMicros(); /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billableActivityDateRange field is set. */ boolean hasBillableActivityDateRange(); /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billableActivityDateRange. */ com.google.ads.googleads.v12.common.DateRange getBillableActivityDateRange(); /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ com.google.ads.googleads.v12.common.DateRangeOrBuilder getBillableActivityDateRangeOrBuilder(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the servedAmountMicros field is set. */ boolean hasServedAmountMicros(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The servedAmountMicros. */ long getServedAmountMicros(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billedAmountMicros field is set. */ boolean hasBilledAmountMicros(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billedAmountMicros. */ long getBilledAmountMicros(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the overdeliveryAmountMicros field is set. */ boolean hasOverdeliveryAmountMicros(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The overdeliveryAmountMicros. */ long getOverdeliveryAmountMicros(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the invalidActivityAmountMicros field is set. */ boolean hasInvalidActivityAmountMicros(); /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The invalidActivityAmountMicros. */ long getInvalidActivityAmountMicros(); } /** * <pre> * Represents a summarized account budget billable cost. * </pre> * * Protobuf type {@code google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary} */ public static final class AccountBudgetSummary extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary) AccountBudgetSummaryOrBuilder { private static final long serialVersionUID = 0L; // Use AccountBudgetSummary.newBuilder() to construct. private AccountBudgetSummary(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private AccountBudgetSummary() { customer_ = ""; customerDescriptiveName_ = ""; accountBudget_ = ""; accountBudgetName_ = ""; purchaseOrderNumber_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new AccountBudgetSummary(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountBudgetSummary_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountBudgetSummary_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.class, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder.class); } private int bitField0_; public static final int CUSTOMER_FIELD_NUMBER = 10; private volatile java.lang.Object customer_; /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customer field is set. */ @java.lang.Override public boolean hasCustomer() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customer. */ @java.lang.Override public java.lang.String getCustomer() { java.lang.Object ref = customer_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); customer_ = s; return s; } } /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customer. */ @java.lang.Override public com.google.protobuf.ByteString getCustomerBytes() { java.lang.Object ref = customer_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); customer_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int CUSTOMER_DESCRIPTIVE_NAME_FIELD_NUMBER = 11; private volatile java.lang.Object customerDescriptiveName_; /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customerDescriptiveName field is set. */ @java.lang.Override public boolean hasCustomerDescriptiveName() { return ((bitField0_ & 0x00000002) != 0); } /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customerDescriptiveName. */ @java.lang.Override public java.lang.String getCustomerDescriptiveName() { java.lang.Object ref = customerDescriptiveName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); customerDescriptiveName_ = s; return s; } } /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customerDescriptiveName. */ @java.lang.Override public com.google.protobuf.ByteString getCustomerDescriptiveNameBytes() { java.lang.Object ref = customerDescriptiveName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); customerDescriptiveName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ACCOUNT_BUDGET_FIELD_NUMBER = 12; private volatile java.lang.Object accountBudget_; /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the accountBudget field is set. */ @java.lang.Override public boolean hasAccountBudget() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The accountBudget. */ @java.lang.Override public java.lang.String getAccountBudget() { java.lang.Object ref = accountBudget_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); accountBudget_ = s; return s; } } /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for accountBudget. */ @java.lang.Override public com.google.protobuf.ByteString getAccountBudgetBytes() { java.lang.Object ref = accountBudget_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); accountBudget_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ACCOUNT_BUDGET_NAME_FIELD_NUMBER = 13; private volatile java.lang.Object accountBudgetName_; /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the accountBudgetName field is set. */ @java.lang.Override public boolean hasAccountBudgetName() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The accountBudgetName. */ @java.lang.Override public java.lang.String getAccountBudgetName() { java.lang.Object ref = accountBudgetName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); accountBudgetName_ = s; return s; } } /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for accountBudgetName. */ @java.lang.Override public com.google.protobuf.ByteString getAccountBudgetNameBytes() { java.lang.Object ref = accountBudgetName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); accountBudgetName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int PURCHASE_ORDER_NUMBER_FIELD_NUMBER = 14; private volatile java.lang.Object purchaseOrderNumber_; /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the purchaseOrderNumber field is set. */ @java.lang.Override public boolean hasPurchaseOrderNumber() { return ((bitField0_ & 0x00000010) != 0); } /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The purchaseOrderNumber. */ @java.lang.Override public java.lang.String getPurchaseOrderNumber() { java.lang.Object ref = purchaseOrderNumber_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); purchaseOrderNumber_ = s; return s; } } /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for purchaseOrderNumber. */ @java.lang.Override public com.google.protobuf.ByteString getPurchaseOrderNumberBytes() { java.lang.Object ref = purchaseOrderNumber_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); purchaseOrderNumber_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 15; private long subtotalAmountMicros_; /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ @java.lang.Override public boolean hasSubtotalAmountMicros() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ @java.lang.Override public long getSubtotalAmountMicros() { return subtotalAmountMicros_; } public static final int TAX_AMOUNT_MICROS_FIELD_NUMBER = 16; private long taxAmountMicros_; /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ @java.lang.Override public boolean hasTaxAmountMicros() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ @java.lang.Override public long getTaxAmountMicros() { return taxAmountMicros_; } public static final int TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 17; private long totalAmountMicros_; /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ @java.lang.Override public boolean hasTotalAmountMicros() { return ((bitField0_ & 0x00000080) != 0); } /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ @java.lang.Override public long getTotalAmountMicros() { return totalAmountMicros_; } public static final int BILLABLE_ACTIVITY_DATE_RANGE_FIELD_NUMBER = 9; private com.google.ads.googleads.v12.common.DateRange billableActivityDateRange_; /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billableActivityDateRange field is set. */ @java.lang.Override public boolean hasBillableActivityDateRange() { return billableActivityDateRange_ != null; } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billableActivityDateRange. */ @java.lang.Override public com.google.ads.googleads.v12.common.DateRange getBillableActivityDateRange() { return billableActivityDateRange_ == null ? com.google.ads.googleads.v12.common.DateRange.getDefaultInstance() : billableActivityDateRange_; } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public com.google.ads.googleads.v12.common.DateRangeOrBuilder getBillableActivityDateRangeOrBuilder() { return getBillableActivityDateRange(); } public static final int SERVED_AMOUNT_MICROS_FIELD_NUMBER = 18; private long servedAmountMicros_; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the servedAmountMicros field is set. */ @java.lang.Override public boolean hasServedAmountMicros() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The servedAmountMicros. */ @java.lang.Override public long getServedAmountMicros() { return servedAmountMicros_; } public static final int BILLED_AMOUNT_MICROS_FIELD_NUMBER = 19; private long billedAmountMicros_; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billedAmountMicros field is set. */ @java.lang.Override public boolean hasBilledAmountMicros() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billedAmountMicros. */ @java.lang.Override public long getBilledAmountMicros() { return billedAmountMicros_; } public static final int OVERDELIVERY_AMOUNT_MICROS_FIELD_NUMBER = 20; private long overdeliveryAmountMicros_; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the overdeliveryAmountMicros field is set. */ @java.lang.Override public boolean hasOverdeliveryAmountMicros() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The overdeliveryAmountMicros. */ @java.lang.Override public long getOverdeliveryAmountMicros() { return overdeliveryAmountMicros_; } public static final int INVALID_ACTIVITY_AMOUNT_MICROS_FIELD_NUMBER = 21; private long invalidActivityAmountMicros_; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the invalidActivityAmountMicros field is set. */ @java.lang.Override public boolean hasInvalidActivityAmountMicros() { return ((bitField0_ & 0x00000800) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The invalidActivityAmountMicros. */ @java.lang.Override public long getInvalidActivityAmountMicros() { return invalidActivityAmountMicros_; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (billableActivityDateRange_ != null) { output.writeMessage(9, getBillableActivityDateRange()); } if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 10, customer_); } if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 11, customerDescriptiveName_); } if (((bitField0_ & 0x00000004) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 12, accountBudget_); } if (((bitField0_ & 0x00000008) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 13, accountBudgetName_); } if (((bitField0_ & 0x00000010) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 14, purchaseOrderNumber_); } if (((bitField0_ & 0x00000020) != 0)) { output.writeInt64(15, subtotalAmountMicros_); } if (((bitField0_ & 0x00000040) != 0)) { output.writeInt64(16, taxAmountMicros_); } if (((bitField0_ & 0x00000080) != 0)) { output.writeInt64(17, totalAmountMicros_); } if (((bitField0_ & 0x00000100) != 0)) { output.writeInt64(18, servedAmountMicros_); } if (((bitField0_ & 0x00000200) != 0)) { output.writeInt64(19, billedAmountMicros_); } if (((bitField0_ & 0x00000400) != 0)) { output.writeInt64(20, overdeliveryAmountMicros_); } if (((bitField0_ & 0x00000800) != 0)) { output.writeInt64(21, invalidActivityAmountMicros_); } getUnknownFields().writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (billableActivityDateRange_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(9, getBillableActivityDateRange()); } if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, customer_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, customerDescriptiveName_); } if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, accountBudget_); } if (((bitField0_ & 0x00000008) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, accountBudgetName_); } if (((bitField0_ & 0x00000010) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(14, purchaseOrderNumber_); } if (((bitField0_ & 0x00000020) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(15, subtotalAmountMicros_); } if (((bitField0_ & 0x00000040) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(16, taxAmountMicros_); } if (((bitField0_ & 0x00000080) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(17, totalAmountMicros_); } if (((bitField0_ & 0x00000100) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(18, servedAmountMicros_); } if (((bitField0_ & 0x00000200) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(19, billedAmountMicros_); } if (((bitField0_ & 0x00000400) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(20, overdeliveryAmountMicros_); } if (((bitField0_ & 0x00000800) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(21, invalidActivityAmountMicros_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary)) { return super.equals(obj); } com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary other = (com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary) obj; if (hasCustomer() != other.hasCustomer()) return false; if (hasCustomer()) { if (!getCustomer() .equals(other.getCustomer())) return false; } if (hasCustomerDescriptiveName() != other.hasCustomerDescriptiveName()) return false; if (hasCustomerDescriptiveName()) { if (!getCustomerDescriptiveName() .equals(other.getCustomerDescriptiveName())) return false; } if (hasAccountBudget() != other.hasAccountBudget()) return false; if (hasAccountBudget()) { if (!getAccountBudget() .equals(other.getAccountBudget())) return false; } if (hasAccountBudgetName() != other.hasAccountBudgetName()) return false; if (hasAccountBudgetName()) { if (!getAccountBudgetName() .equals(other.getAccountBudgetName())) return false; } if (hasPurchaseOrderNumber() != other.hasPurchaseOrderNumber()) return false; if (hasPurchaseOrderNumber()) { if (!getPurchaseOrderNumber() .equals(other.getPurchaseOrderNumber())) return false; } if (hasSubtotalAmountMicros() != other.hasSubtotalAmountMicros()) return false; if (hasSubtotalAmountMicros()) { if (getSubtotalAmountMicros() != other.getSubtotalAmountMicros()) return false; } if (hasTaxAmountMicros() != other.hasTaxAmountMicros()) return false; if (hasTaxAmountMicros()) { if (getTaxAmountMicros() != other.getTaxAmountMicros()) return false; } if (hasTotalAmountMicros() != other.hasTotalAmountMicros()) return false; if (hasTotalAmountMicros()) { if (getTotalAmountMicros() != other.getTotalAmountMicros()) return false; } if (hasBillableActivityDateRange() != other.hasBillableActivityDateRange()) return false; if (hasBillableActivityDateRange()) { if (!getBillableActivityDateRange() .equals(other.getBillableActivityDateRange())) return false; } if (hasServedAmountMicros() != other.hasServedAmountMicros()) return false; if (hasServedAmountMicros()) { if (getServedAmountMicros() != other.getServedAmountMicros()) return false; } if (hasBilledAmountMicros() != other.hasBilledAmountMicros()) return false; if (hasBilledAmountMicros()) { if (getBilledAmountMicros() != other.getBilledAmountMicros()) return false; } if (hasOverdeliveryAmountMicros() != other.hasOverdeliveryAmountMicros()) return false; if (hasOverdeliveryAmountMicros()) { if (getOverdeliveryAmountMicros() != other.getOverdeliveryAmountMicros()) return false; } if (hasInvalidActivityAmountMicros() != other.hasInvalidActivityAmountMicros()) return false; if (hasInvalidActivityAmountMicros()) { if (getInvalidActivityAmountMicros() != other.getInvalidActivityAmountMicros()) return false; } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasCustomer()) { hash = (37 * hash) + CUSTOMER_FIELD_NUMBER; hash = (53 * hash) + getCustomer().hashCode(); } if (hasCustomerDescriptiveName()) { hash = (37 * hash) + CUSTOMER_DESCRIPTIVE_NAME_FIELD_NUMBER; hash = (53 * hash) + getCustomerDescriptiveName().hashCode(); } if (hasAccountBudget()) { hash = (37 * hash) + ACCOUNT_BUDGET_FIELD_NUMBER; hash = (53 * hash) + getAccountBudget().hashCode(); } if (hasAccountBudgetName()) { hash = (37 * hash) + ACCOUNT_BUDGET_NAME_FIELD_NUMBER; hash = (53 * hash) + getAccountBudgetName().hashCode(); } if (hasPurchaseOrderNumber()) { hash = (37 * hash) + PURCHASE_ORDER_NUMBER_FIELD_NUMBER; hash = (53 * hash) + getPurchaseOrderNumber().hashCode(); } if (hasSubtotalAmountMicros()) { hash = (37 * hash) + SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getSubtotalAmountMicros()); } if (hasTaxAmountMicros()) { hash = (37 * hash) + TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getTaxAmountMicros()); } if (hasTotalAmountMicros()) { hash = (37 * hash) + TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getTotalAmountMicros()); } if (hasBillableActivityDateRange()) { hash = (37 * hash) + BILLABLE_ACTIVITY_DATE_RANGE_FIELD_NUMBER; hash = (53 * hash) + getBillableActivityDateRange().hashCode(); } if (hasServedAmountMicros()) { hash = (37 * hash) + SERVED_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getServedAmountMicros()); } if (hasBilledAmountMicros()) { hash = (37 * hash) + BILLED_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getBilledAmountMicros()); } if (hasOverdeliveryAmountMicros()) { hash = (37 * hash) + OVERDELIVERY_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getOverdeliveryAmountMicros()); } if (hasInvalidActivityAmountMicros()) { hash = (37 * hash) + INVALID_ACTIVITY_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getInvalidActivityAmountMicros()); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * Represents a summarized account budget billable cost. * </pre> * * Protobuf type {@code google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary) com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountBudgetSummary_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountBudgetSummary_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.class, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder.class); } // Construct using com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.newBuilder() private Builder() { } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); } @java.lang.Override public Builder clear() { super.clear(); customer_ = ""; bitField0_ = (bitField0_ & ~0x00000001); customerDescriptiveName_ = ""; bitField0_ = (bitField0_ & ~0x00000002); accountBudget_ = ""; bitField0_ = (bitField0_ & ~0x00000004); accountBudgetName_ = ""; bitField0_ = (bitField0_ & ~0x00000008); purchaseOrderNumber_ = ""; bitField0_ = (bitField0_ & ~0x00000010); subtotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000020); taxAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000040); totalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000080); if (billableActivityDateRangeBuilder_ == null) { billableActivityDateRange_ = null; } else { billableActivityDateRange_ = null; billableActivityDateRangeBuilder_ = null; } servedAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000100); billedAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000200); overdeliveryAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000400); invalidActivityAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000800); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_AccountBudgetSummary_descriptor; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary getDefaultInstanceForType() { return com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.getDefaultInstance(); } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary build() { com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary buildPartial() { com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary result = new com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.customer_ = customer_; if (((from_bitField0_ & 0x00000002) != 0)) { to_bitField0_ |= 0x00000002; } result.customerDescriptiveName_ = customerDescriptiveName_; if (((from_bitField0_ & 0x00000004) != 0)) { to_bitField0_ |= 0x00000004; } result.accountBudget_ = accountBudget_; if (((from_bitField0_ & 0x00000008) != 0)) { to_bitField0_ |= 0x00000008; } result.accountBudgetName_ = accountBudgetName_; if (((from_bitField0_ & 0x00000010) != 0)) { to_bitField0_ |= 0x00000010; } result.purchaseOrderNumber_ = purchaseOrderNumber_; if (((from_bitField0_ & 0x00000020) != 0)) { result.subtotalAmountMicros_ = subtotalAmountMicros_; to_bitField0_ |= 0x00000020; } if (((from_bitField0_ & 0x00000040) != 0)) { result.taxAmountMicros_ = taxAmountMicros_; to_bitField0_ |= 0x00000040; } if (((from_bitField0_ & 0x00000080) != 0)) { result.totalAmountMicros_ = totalAmountMicros_; to_bitField0_ |= 0x00000080; } if (billableActivityDateRangeBuilder_ == null) { result.billableActivityDateRange_ = billableActivityDateRange_; } else { result.billableActivityDateRange_ = billableActivityDateRangeBuilder_.build(); } if (((from_bitField0_ & 0x00000100) != 0)) { result.servedAmountMicros_ = servedAmountMicros_; to_bitField0_ |= 0x00000100; } if (((from_bitField0_ & 0x00000200) != 0)) { result.billedAmountMicros_ = billedAmountMicros_; to_bitField0_ |= 0x00000200; } if (((from_bitField0_ & 0x00000400) != 0)) { result.overdeliveryAmountMicros_ = overdeliveryAmountMicros_; to_bitField0_ |= 0x00000400; } if (((from_bitField0_ & 0x00000800) != 0)) { result.invalidActivityAmountMicros_ = invalidActivityAmountMicros_; to_bitField0_ |= 0x00000800; } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary) { return mergeFrom((com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary other) { if (other == com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.getDefaultInstance()) return this; if (other.hasCustomer()) { bitField0_ |= 0x00000001; customer_ = other.customer_; onChanged(); } if (other.hasCustomerDescriptiveName()) { bitField0_ |= 0x00000002; customerDescriptiveName_ = other.customerDescriptiveName_; onChanged(); } if (other.hasAccountBudget()) { bitField0_ |= 0x00000004; accountBudget_ = other.accountBudget_; onChanged(); } if (other.hasAccountBudgetName()) { bitField0_ |= 0x00000008; accountBudgetName_ = other.accountBudgetName_; onChanged(); } if (other.hasPurchaseOrderNumber()) { bitField0_ |= 0x00000010; purchaseOrderNumber_ = other.purchaseOrderNumber_; onChanged(); } if (other.hasSubtotalAmountMicros()) { setSubtotalAmountMicros(other.getSubtotalAmountMicros()); } if (other.hasTaxAmountMicros()) { setTaxAmountMicros(other.getTaxAmountMicros()); } if (other.hasTotalAmountMicros()) { setTotalAmountMicros(other.getTotalAmountMicros()); } if (other.hasBillableActivityDateRange()) { mergeBillableActivityDateRange(other.getBillableActivityDateRange()); } if (other.hasServedAmountMicros()) { setServedAmountMicros(other.getServedAmountMicros()); } if (other.hasBilledAmountMicros()) { setBilledAmountMicros(other.getBilledAmountMicros()); } if (other.hasOverdeliveryAmountMicros()) { setOverdeliveryAmountMicros(other.getOverdeliveryAmountMicros()); } if (other.hasInvalidActivityAmountMicros()) { setInvalidActivityAmountMicros(other.getInvalidActivityAmountMicros()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 74: { input.readMessage( getBillableActivityDateRangeFieldBuilder().getBuilder(), extensionRegistry); break; } // case 74 case 82: { customer_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000001; break; } // case 82 case 90: { customerDescriptiveName_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000002; break; } // case 90 case 98: { accountBudget_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000004; break; } // case 98 case 106: { accountBudgetName_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000008; break; } // case 106 case 114: { purchaseOrderNumber_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000010; break; } // case 114 case 120: { subtotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000020; break; } // case 120 case 128: { taxAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000040; break; } // case 128 case 136: { totalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000080; break; } // case 136 case 144: { servedAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000100; break; } // case 144 case 152: { billedAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000200; break; } // case 152 case 160: { overdeliveryAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000400; break; } // case 160 case 168: { invalidActivityAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000800; break; } // case 168 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag } break; } // default: } // switch (tag) } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.unwrapIOException(); } finally { onChanged(); } // finally return this; } private int bitField0_; private java.lang.Object customer_ = ""; /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customer field is set. */ public boolean hasCustomer() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customer. */ public java.lang.String getCustomer() { java.lang.Object ref = customer_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); customer_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customer. */ public com.google.protobuf.ByteString getCustomerBytes() { java.lang.Object ref = customer_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); customer_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The customer to set. * @return This builder for chaining. */ public Builder setCustomer( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; customer_ = value; onChanged(); return this; } /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCustomer() { bitField0_ = (bitField0_ & ~0x00000001); customer_ = getDefaultInstance().getCustomer(); onChanged(); return this; } /** * <pre> * Output only. The resource name of the customer associated with this account budget. * This contains the customer ID, which appears on the invoice PDF as * "Account ID". * Customer resource names have the form: * `customers/{customer_id}` * </pre> * * <code>optional string customer = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for customer to set. * @return This builder for chaining. */ public Builder setCustomerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000001; customer_ = value; onChanged(); return this; } private java.lang.Object customerDescriptiveName_ = ""; /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the customerDescriptiveName field is set. */ public boolean hasCustomerDescriptiveName() { return ((bitField0_ & 0x00000002) != 0); } /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The customerDescriptiveName. */ public java.lang.String getCustomerDescriptiveName() { java.lang.Object ref = customerDescriptiveName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); customerDescriptiveName_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for customerDescriptiveName. */ public com.google.protobuf.ByteString getCustomerDescriptiveNameBytes() { java.lang.Object ref = customerDescriptiveName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); customerDescriptiveName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The customerDescriptiveName to set. * @return This builder for chaining. */ public Builder setCustomerDescriptiveName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; customerDescriptiveName_ = value; onChanged(); return this; } /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCustomerDescriptiveName() { bitField0_ = (bitField0_ & ~0x00000002); customerDescriptiveName_ = getDefaultInstance().getCustomerDescriptiveName(); onChanged(); return this; } /** * <pre> * Output only. The descriptive name of the account budget's customer. It appears on the * invoice PDF as "Account". * </pre> * * <code>optional string customer_descriptive_name = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for customerDescriptiveName to set. * @return This builder for chaining. */ public Builder setCustomerDescriptiveNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000002; customerDescriptiveName_ = value; onChanged(); return this; } private java.lang.Object accountBudget_ = ""; /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the accountBudget field is set. */ public boolean hasAccountBudget() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The accountBudget. */ public java.lang.String getAccountBudget() { java.lang.Object ref = accountBudget_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); accountBudget_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for accountBudget. */ public com.google.protobuf.ByteString getAccountBudgetBytes() { java.lang.Object ref = accountBudget_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); accountBudget_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The accountBudget to set. * @return This builder for chaining. */ public Builder setAccountBudget( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; accountBudget_ = value; onChanged(); return this; } /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearAccountBudget() { bitField0_ = (bitField0_ & ~0x00000004); accountBudget_ = getDefaultInstance().getAccountBudget(); onChanged(); return this; } /** * <pre> * Output only. The resource name of the account budget associated with this summarized * billable cost. * AccountBudget resource names have the form: * `customers/{customer_id}/accountBudgets/{account_budget_id}` * </pre> * * <code>optional string account_budget = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for accountBudget to set. * @return This builder for chaining. */ public Builder setAccountBudgetBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000004; accountBudget_ = value; onChanged(); return this; } private java.lang.Object accountBudgetName_ = ""; /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the accountBudgetName field is set. */ public boolean hasAccountBudgetName() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The accountBudgetName. */ public java.lang.String getAccountBudgetName() { java.lang.Object ref = accountBudgetName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); accountBudgetName_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for accountBudgetName. */ public com.google.protobuf.ByteString getAccountBudgetNameBytes() { java.lang.Object ref = accountBudgetName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); accountBudgetName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The accountBudgetName to set. * @return This builder for chaining. */ public Builder setAccountBudgetName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; accountBudgetName_ = value; onChanged(); return this; } /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearAccountBudgetName() { bitField0_ = (bitField0_ & ~0x00000008); accountBudgetName_ = getDefaultInstance().getAccountBudgetName(); onChanged(); return this; } /** * <pre> * Output only. The name of the account budget. It appears on the invoice PDF as "Account * budget". * </pre> * * <code>optional string account_budget_name = 13 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for accountBudgetName to set. * @return This builder for chaining. */ public Builder setAccountBudgetNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000008; accountBudgetName_ = value; onChanged(); return this; } private java.lang.Object purchaseOrderNumber_ = ""; /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the purchaseOrderNumber field is set. */ public boolean hasPurchaseOrderNumber() { return ((bitField0_ & 0x00000010) != 0); } /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The purchaseOrderNumber. */ public java.lang.String getPurchaseOrderNumber() { java.lang.Object ref = purchaseOrderNumber_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); purchaseOrderNumber_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for purchaseOrderNumber. */ public com.google.protobuf.ByteString getPurchaseOrderNumberBytes() { java.lang.Object ref = purchaseOrderNumber_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); purchaseOrderNumber_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The purchaseOrderNumber to set. * @return This builder for chaining. */ public Builder setPurchaseOrderNumber( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; purchaseOrderNumber_ = value; onChanged(); return this; } /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearPurchaseOrderNumber() { bitField0_ = (bitField0_ & ~0x00000010); purchaseOrderNumber_ = getDefaultInstance().getPurchaseOrderNumber(); onChanged(); return this; } /** * <pre> * Output only. The purchase order number of the account budget. It appears on the * invoice PDF as "Purchase order". * </pre> * * <code>optional string purchase_order_number = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for purchaseOrderNumber to set. * @return This builder for chaining. */ public Builder setPurchaseOrderNumberBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000010; purchaseOrderNumber_ = value; onChanged(); return this; } private long subtotalAmountMicros_ ; /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ @java.lang.Override public boolean hasSubtotalAmountMicros() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ @java.lang.Override public long getSubtotalAmountMicros() { return subtotalAmountMicros_; } /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The subtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setSubtotalAmountMicros(long value) { bitField0_ |= 0x00000020; subtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The pretax subtotal amount attributable to this budget during the service * period, in micros. * </pre> * * <code>optional int64 subtotal_amount_micros = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearSubtotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000020); subtotalAmountMicros_ = 0L; onChanged(); return this; } private long taxAmountMicros_ ; /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ @java.lang.Override public boolean hasTaxAmountMicros() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ @java.lang.Override public long getTaxAmountMicros() { return taxAmountMicros_; } /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The taxAmountMicros to set. * @return This builder for chaining. */ public Builder setTaxAmountMicros(long value) { bitField0_ |= 0x00000040; taxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The tax amount attributable to this budget during the service period, in * micros. * </pre> * * <code>optional int64 tax_amount_micros = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearTaxAmountMicros() { bitField0_ = (bitField0_ & ~0x00000040); taxAmountMicros_ = 0L; onChanged(); return this; } private long totalAmountMicros_ ; /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ @java.lang.Override public boolean hasTotalAmountMicros() { return ((bitField0_ & 0x00000080) != 0); } /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ @java.lang.Override public long getTotalAmountMicros() { return totalAmountMicros_; } /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The totalAmountMicros to set. * @return This builder for chaining. */ public Builder setTotalAmountMicros(long value) { bitField0_ |= 0x00000080; totalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The total amount attributable to this budget during the service period, * in micros. This equals the sum of the account budget subtotal amount and * the account budget tax amount. * </pre> * * <code>optional int64 total_amount_micros = 17 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearTotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000080); totalAmountMicros_ = 0L; onChanged(); return this; } private com.google.ads.googleads.v12.common.DateRange billableActivityDateRange_; private com.google.protobuf.SingleFieldBuilderV3< com.google.ads.googleads.v12.common.DateRange, com.google.ads.googleads.v12.common.DateRange.Builder, com.google.ads.googleads.v12.common.DateRangeOrBuilder> billableActivityDateRangeBuilder_; /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billableActivityDateRange field is set. */ public boolean hasBillableActivityDateRange() { return billableActivityDateRangeBuilder_ != null || billableActivityDateRange_ != null; } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billableActivityDateRange. */ public com.google.ads.googleads.v12.common.DateRange getBillableActivityDateRange() { if (billableActivityDateRangeBuilder_ == null) { return billableActivityDateRange_ == null ? com.google.ads.googleads.v12.common.DateRange.getDefaultInstance() : billableActivityDateRange_; } else { return billableActivityDateRangeBuilder_.getMessage(); } } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setBillableActivityDateRange(com.google.ads.googleads.v12.common.DateRange value) { if (billableActivityDateRangeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } billableActivityDateRange_ = value; onChanged(); } else { billableActivityDateRangeBuilder_.setMessage(value); } return this; } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setBillableActivityDateRange( com.google.ads.googleads.v12.common.DateRange.Builder builderForValue) { if (billableActivityDateRangeBuilder_ == null) { billableActivityDateRange_ = builderForValue.build(); onChanged(); } else { billableActivityDateRangeBuilder_.setMessage(builderForValue.build()); } return this; } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder mergeBillableActivityDateRange(com.google.ads.googleads.v12.common.DateRange value) { if (billableActivityDateRangeBuilder_ == null) { if (billableActivityDateRange_ != null) { billableActivityDateRange_ = com.google.ads.googleads.v12.common.DateRange.newBuilder(billableActivityDateRange_).mergeFrom(value).buildPartial(); } else { billableActivityDateRange_ = value; } onChanged(); } else { billableActivityDateRangeBuilder_.mergeFrom(value); } return this; } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder clearBillableActivityDateRange() { if (billableActivityDateRangeBuilder_ == null) { billableActivityDateRange_ = null; onChanged(); } else { billableActivityDateRange_ = null; billableActivityDateRangeBuilder_ = null; } return this; } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.common.DateRange.Builder getBillableActivityDateRangeBuilder() { onChanged(); return getBillableActivityDateRangeFieldBuilder().getBuilder(); } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.common.DateRangeOrBuilder getBillableActivityDateRangeOrBuilder() { if (billableActivityDateRangeBuilder_ != null) { return billableActivityDateRangeBuilder_.getMessageOrBuilder(); } else { return billableActivityDateRange_ == null ? com.google.ads.googleads.v12.common.DateRange.getDefaultInstance() : billableActivityDateRange_; } } /** * <pre> * Output only. The billable activity date range of the account budget, within the * service date range of this invoice. The end date is inclusive. This can * be different from the account budget's start and end time. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange billable_activity_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.ads.googleads.v12.common.DateRange, com.google.ads.googleads.v12.common.DateRange.Builder, com.google.ads.googleads.v12.common.DateRangeOrBuilder> getBillableActivityDateRangeFieldBuilder() { if (billableActivityDateRangeBuilder_ == null) { billableActivityDateRangeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.ads.googleads.v12.common.DateRange, com.google.ads.googleads.v12.common.DateRange.Builder, com.google.ads.googleads.v12.common.DateRangeOrBuilder>( getBillableActivityDateRange(), getParentForChildren(), isClean()); billableActivityDateRange_ = null; } return billableActivityDateRangeBuilder_; } private long servedAmountMicros_ ; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the servedAmountMicros field is set. */ @java.lang.Override public boolean hasServedAmountMicros() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The servedAmountMicros. */ @java.lang.Override public long getServedAmountMicros() { return servedAmountMicros_; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The servedAmountMicros to set. * @return This builder for chaining. */ public Builder setServedAmountMicros(long value) { bitField0_ |= 0x00000100; servedAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax served amount attributable to this budget during the service * period, in micros. This is only useful to reconcile invoice and delivery * data. * </pre> * * <code>optional int64 served_amount_micros = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearServedAmountMicros() { bitField0_ = (bitField0_ & ~0x00000100); servedAmountMicros_ = 0L; onChanged(); return this; } private long billedAmountMicros_ ; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billedAmountMicros field is set. */ @java.lang.Override public boolean hasBilledAmountMicros() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billedAmountMicros. */ @java.lang.Override public long getBilledAmountMicros() { return billedAmountMicros_; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The billedAmountMicros to set. * @return This builder for chaining. */ public Builder setBilledAmountMicros(long value) { bitField0_ |= 0x00000200; billedAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax billed amount attributable to this budget during the * service period, in micros. This does not account for any adjustments. * </pre> * * <code>optional int64 billed_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearBilledAmountMicros() { bitField0_ = (bitField0_ & ~0x00000200); billedAmountMicros_ = 0L; onChanged(); return this; } private long overdeliveryAmountMicros_ ; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the overdeliveryAmountMicros field is set. */ @java.lang.Override public boolean hasOverdeliveryAmountMicros() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The overdeliveryAmountMicros. */ @java.lang.Override public long getOverdeliveryAmountMicros() { return overdeliveryAmountMicros_; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The overdeliveryAmountMicros to set. * @return This builder for chaining. */ public Builder setOverdeliveryAmountMicros(long value) { bitField0_ |= 0x00000400; overdeliveryAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax overdelivery amount attributable to this budget during the * service period, in micros (negative value). * </pre> * * <code>optional int64 overdelivery_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearOverdeliveryAmountMicros() { bitField0_ = (bitField0_ & ~0x00000400); overdeliveryAmountMicros_ = 0L; onChanged(); return this; } private long invalidActivityAmountMicros_ ; /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the invalidActivityAmountMicros field is set. */ @java.lang.Override public boolean hasInvalidActivityAmountMicros() { return ((bitField0_ & 0x00000800) != 0); } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The invalidActivityAmountMicros. */ @java.lang.Override public long getInvalidActivityAmountMicros() { return invalidActivityAmountMicros_; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The invalidActivityAmountMicros to set. * @return This builder for chaining. */ public Builder setInvalidActivityAmountMicros(long value) { bitField0_ |= 0x00000800; invalidActivityAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. Accessible only to customers on the allow-list. * The pretax invalid activity amount attributable to this budget in * previous months, in micros (negative value). * </pre> * * <code>optional int64 invalid_activity_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearInvalidActivityAmountMicros() { bitField0_ = (bitField0_ & ~0x00000800); invalidActivityAmountMicros_ = 0L; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary) } // @@protoc_insertion_point(class_scope:google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary) private static final com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary(); } public static com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<AccountBudgetSummary> PARSER = new com.google.protobuf.AbstractParser<AccountBudgetSummary>() { @java.lang.Override public AccountBudgetSummary parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { Builder builder = newBuilder(); try { builder.mergeFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(builder.buildPartial()); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(builder.buildPartial()); } return builder.buildPartial(); } }; public static com.google.protobuf.Parser<AccountBudgetSummary> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<AccountBudgetSummary> getParserForType() { return PARSER; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } private int bitField0_; public static final int RESOURCE_NAME_FIELD_NUMBER = 1; private volatile java.lang.Object resourceName_; /** * <pre> * Output only. The resource name of the invoice. Multiple customers can share a given * invoice, so multiple resource names may point to the same invoice. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>string resource_name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }</code> * @return The resourceName. */ @java.lang.Override public java.lang.String getResourceName() { java.lang.Object ref = resourceName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resourceName_ = s; return s; } } /** * <pre> * Output only. The resource name of the invoice. Multiple customers can share a given * invoice, so multiple resource names may point to the same invoice. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>string resource_name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }</code> * @return The bytes for resourceName. */ @java.lang.Override public com.google.protobuf.ByteString getResourceNameBytes() { java.lang.Object ref = resourceName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); resourceName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ID_FIELD_NUMBER = 25; private volatile java.lang.Object id_; /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the id field is set. */ @java.lang.Override public boolean hasId() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The id. */ @java.lang.Override public java.lang.String getId() { java.lang.Object ref = id_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); id_ = s; return s; } } /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for id. */ @java.lang.Override public com.google.protobuf.ByteString getIdBytes() { java.lang.Object ref = id_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); id_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int TYPE_FIELD_NUMBER = 3; private int type_; /** * <pre> * Output only. The type of invoice. * </pre> * * <code>.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The enum numeric value on the wire for type. */ @java.lang.Override public int getTypeValue() { return type_; } /** * <pre> * Output only. The type of invoice. * </pre> * * <code>.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The type. */ @java.lang.Override public com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType getType() { @SuppressWarnings("deprecation") com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType result = com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType.valueOf(type_); return result == null ? com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType.UNRECOGNIZED : result; } public static final int BILLING_SETUP_FIELD_NUMBER = 26; private volatile java.lang.Object billingSetup_; /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingSetup field is set. */ @java.lang.Override public boolean hasBillingSetup() { return ((bitField0_ & 0x00000002) != 0); } /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingSetup. */ @java.lang.Override public java.lang.String getBillingSetup() { java.lang.Object ref = billingSetup_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); billingSetup_ = s; return s; } } /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for billingSetup. */ @java.lang.Override public com.google.protobuf.ByteString getBillingSetupBytes() { java.lang.Object ref = billingSetup_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); billingSetup_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int PAYMENTS_ACCOUNT_ID_FIELD_NUMBER = 27; private volatile java.lang.Object paymentsAccountId_; /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the paymentsAccountId field is set. */ @java.lang.Override public boolean hasPaymentsAccountId() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The paymentsAccountId. */ @java.lang.Override public java.lang.String getPaymentsAccountId() { java.lang.Object ref = paymentsAccountId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); paymentsAccountId_ = s; return s; } } /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for paymentsAccountId. */ @java.lang.Override public com.google.protobuf.ByteString getPaymentsAccountIdBytes() { java.lang.Object ref = paymentsAccountId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); paymentsAccountId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int PAYMENTS_PROFILE_ID_FIELD_NUMBER = 28; private volatile java.lang.Object paymentsProfileId_; /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the paymentsProfileId field is set. */ @java.lang.Override public boolean hasPaymentsProfileId() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The paymentsProfileId. */ @java.lang.Override public java.lang.String getPaymentsProfileId() { java.lang.Object ref = paymentsProfileId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); paymentsProfileId_ = s; return s; } } /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for paymentsProfileId. */ @java.lang.Override public com.google.protobuf.ByteString getPaymentsProfileIdBytes() { java.lang.Object ref = paymentsProfileId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); paymentsProfileId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ISSUE_DATE_FIELD_NUMBER = 29; private volatile java.lang.Object issueDate_; /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the issueDate field is set. */ @java.lang.Override public boolean hasIssueDate() { return ((bitField0_ & 0x00000010) != 0); } /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The issueDate. */ @java.lang.Override public java.lang.String getIssueDate() { java.lang.Object ref = issueDate_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); issueDate_ = s; return s; } } /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for issueDate. */ @java.lang.Override public com.google.protobuf.ByteString getIssueDateBytes() { java.lang.Object ref = issueDate_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); issueDate_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int DUE_DATE_FIELD_NUMBER = 30; private volatile java.lang.Object dueDate_; /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the dueDate field is set. */ @java.lang.Override public boolean hasDueDate() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The dueDate. */ @java.lang.Override public java.lang.String getDueDate() { java.lang.Object ref = dueDate_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); dueDate_ = s; return s; } } /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for dueDate. */ @java.lang.Override public com.google.protobuf.ByteString getDueDateBytes() { java.lang.Object ref = dueDate_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); dueDate_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int SERVICE_DATE_RANGE_FIELD_NUMBER = 9; private com.google.ads.googleads.v12.common.DateRange serviceDateRange_; /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the serviceDateRange field is set. */ @java.lang.Override public boolean hasServiceDateRange() { return serviceDateRange_ != null; } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The serviceDateRange. */ @java.lang.Override public com.google.ads.googleads.v12.common.DateRange getServiceDateRange() { return serviceDateRange_ == null ? com.google.ads.googleads.v12.common.DateRange.getDefaultInstance() : serviceDateRange_; } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public com.google.ads.googleads.v12.common.DateRangeOrBuilder getServiceDateRangeOrBuilder() { return getServiceDateRange(); } public static final int CURRENCY_CODE_FIELD_NUMBER = 31; private volatile java.lang.Object currencyCode_; /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the currencyCode field is set. */ @java.lang.Override public boolean hasCurrencyCode() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The currencyCode. */ @java.lang.Override public java.lang.String getCurrencyCode() { java.lang.Object ref = currencyCode_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); currencyCode_ = s; return s; } } /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for currencyCode. */ @java.lang.Override public com.google.protobuf.ByteString getCurrencyCodeBytes() { java.lang.Object ref = currencyCode_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); currencyCode_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ADJUSTMENTS_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 19; private long adjustmentsSubtotalAmountMicros_; /** * <pre> * Output only. The pretax subtotal amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_subtotal_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The adjustmentsSubtotalAmountMicros. */ @java.lang.Override public long getAdjustmentsSubtotalAmountMicros() { return adjustmentsSubtotalAmountMicros_; } public static final int ADJUSTMENTS_TAX_AMOUNT_MICROS_FIELD_NUMBER = 20; private long adjustmentsTaxAmountMicros_; /** * <pre> * Output only. The sum of taxes on the invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_tax_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The adjustmentsTaxAmountMicros. */ @java.lang.Override public long getAdjustmentsTaxAmountMicros() { return adjustmentsTaxAmountMicros_; } public static final int ADJUSTMENTS_TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 21; private long adjustmentsTotalAmountMicros_; /** * <pre> * Output only. The total amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_total_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The adjustmentsTotalAmountMicros. */ @java.lang.Override public long getAdjustmentsTotalAmountMicros() { return adjustmentsTotalAmountMicros_; } public static final int REGULATORY_COSTS_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 22; private long regulatoryCostsSubtotalAmountMicros_; /** * <pre> * Output only. The pretax subtotal amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_subtotal_amount_micros = 22 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsSubtotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsSubtotalAmountMicros() { return regulatoryCostsSubtotalAmountMicros_; } public static final int REGULATORY_COSTS_TAX_AMOUNT_MICROS_FIELD_NUMBER = 23; private long regulatoryCostsTaxAmountMicros_; /** * <pre> * Output only. The sum of taxes on the invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_tax_amount_micros = 23 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTaxAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTaxAmountMicros() { return regulatoryCostsTaxAmountMicros_; } public static final int REGULATORY_COSTS_TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 24; private long regulatoryCostsTotalAmountMicros_; /** * <pre> * Output only. The total amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_total_amount_micros = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTotalAmountMicros() { return regulatoryCostsTotalAmountMicros_; } public static final int SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER = 33; private long subtotalAmountMicros_; /** * <pre> * Output only. The pretax subtotal amount, in micros. This equals the * sum of the AccountBudgetSummary subtotal amounts, * Invoice.adjustments_subtotal_amount_micros, and * Invoice.regulatory_costs_subtotal_amount_micros. * Starting with v6, the Invoice.regulatory_costs_subtotal_amount_micros is no * longer included. * </pre> * * <code>optional int64 subtotal_amount_micros = 33 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ @java.lang.Override public boolean hasSubtotalAmountMicros() { return ((bitField0_ & 0x00000080) != 0); } /** * <pre> * Output only. The pretax subtotal amount, in micros. This equals the * sum of the AccountBudgetSummary subtotal amounts, * Invoice.adjustments_subtotal_amount_micros, and * Invoice.regulatory_costs_subtotal_amount_micros. * Starting with v6, the Invoice.regulatory_costs_subtotal_amount_micros is no * longer included. * </pre> * * <code>optional int64 subtotal_amount_micros = 33 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ @java.lang.Override public long getSubtotalAmountMicros() { return subtotalAmountMicros_; } public static final int TAX_AMOUNT_MICROS_FIELD_NUMBER = 34; private long taxAmountMicros_; /** * <pre> * Output only. The sum of all taxes on the invoice, in micros. This equals the sum of the * AccountBudgetSummary tax amounts, plus taxes not associated with a specific * account budget. * </pre> * * <code>optional int64 tax_amount_micros = 34 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ @java.lang.Override public boolean hasTaxAmountMicros() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * Output only. The sum of all taxes on the invoice, in micros. This equals the sum of the * AccountBudgetSummary tax amounts, plus taxes not associated with a specific * account budget. * </pre> * * <code>optional int64 tax_amount_micros = 34 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ @java.lang.Override public long getTaxAmountMicros() { return taxAmountMicros_; } public static final int TOTAL_AMOUNT_MICROS_FIELD_NUMBER = 35; private long totalAmountMicros_; /** * <pre> * Output only. The total amount, in micros. This equals the sum of * Invoice.subtotal_amount_micros and Invoice.tax_amount_micros. * Starting with v6, Invoice.regulatory_costs_subtotal_amount_micros is * also added as it is no longer already included in * Invoice.tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 35 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ @java.lang.Override public boolean hasTotalAmountMicros() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * Output only. The total amount, in micros. This equals the sum of * Invoice.subtotal_amount_micros and Invoice.tax_amount_micros. * Starting with v6, Invoice.regulatory_costs_subtotal_amount_micros is * also added as it is no longer already included in * Invoice.tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 35 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ @java.lang.Override public long getTotalAmountMicros() { return totalAmountMicros_; } public static final int CORRECTED_INVOICE_FIELD_NUMBER = 36; private volatile java.lang.Object correctedInvoice_; /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the correctedInvoice field is set. */ @java.lang.Override public boolean hasCorrectedInvoice() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The correctedInvoice. */ @java.lang.Override public java.lang.String getCorrectedInvoice() { java.lang.Object ref = correctedInvoice_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); correctedInvoice_ = s; return s; } } /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for correctedInvoice. */ @java.lang.Override public com.google.protobuf.ByteString getCorrectedInvoiceBytes() { java.lang.Object ref = correctedInvoice_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); correctedInvoice_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int REPLACED_INVOICES_FIELD_NUMBER = 37; private com.google.protobuf.LazyStringList replacedInvoices_; /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return A list containing the replacedInvoices. */ public com.google.protobuf.ProtocolStringList getReplacedInvoicesList() { return replacedInvoices_; } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The count of replacedInvoices. */ public int getReplacedInvoicesCount() { return replacedInvoices_.size(); } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param index The index of the element to return. * @return The replacedInvoices at the given index. */ public java.lang.String getReplacedInvoices(int index) { return replacedInvoices_.get(index); } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param index The index of the value to return. * @return The bytes of the replacedInvoices at the given index. */ public com.google.protobuf.ByteString getReplacedInvoicesBytes(int index) { return replacedInvoices_.getByteString(index); } public static final int PDF_URL_FIELD_NUMBER = 38; private volatile java.lang.Object pdfUrl_; /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the pdfUrl field is set. */ @java.lang.Override public boolean hasPdfUrl() { return ((bitField0_ & 0x00000800) != 0); } /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The pdfUrl. */ @java.lang.Override public java.lang.String getPdfUrl() { java.lang.Object ref = pdfUrl_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); pdfUrl_ = s; return s; } } /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for pdfUrl. */ @java.lang.Override public com.google.protobuf.ByteString getPdfUrlBytes() { java.lang.Object ref = pdfUrl_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); pdfUrl_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int ACCOUNT_BUDGET_SUMMARIES_FIELD_NUMBER = 18; private java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary> accountBudgetSummaries_; /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary> getAccountBudgetSummariesList() { return accountBudgetSummaries_; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public java.util.List<? extends com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder> getAccountBudgetSummariesOrBuilderList() { return accountBudgetSummaries_; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public int getAccountBudgetSummariesCount() { return accountBudgetSummaries_.size(); } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary getAccountBudgetSummaries(int index) { return accountBudgetSummaries_.get(index); } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder getAccountBudgetSummariesOrBuilder( int index) { return accountBudgetSummaries_.get(index); } public static final int ACCOUNT_SUMMARIES_FIELD_NUMBER = 39; private java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountSummary> accountSummaries_; /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountSummary> getAccountSummariesList() { return accountSummaries_; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public java.util.List<? extends com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder> getAccountSummariesOrBuilderList() { return accountSummaries_; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public int getAccountSummariesCount() { return accountSummaries_.size(); } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountSummary getAccountSummaries(int index) { return accountSummaries_.get(index); } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder getAccountSummariesOrBuilder( int index) { return accountSummaries_.get(index); } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resourceName_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, resourceName_); } if (type_ != com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType.UNSPECIFIED.getNumber()) { output.writeEnum(3, type_); } if (serviceDateRange_ != null) { output.writeMessage(9, getServiceDateRange()); } for (int i = 0; i < accountBudgetSummaries_.size(); i++) { output.writeMessage(18, accountBudgetSummaries_.get(i)); } if (adjustmentsSubtotalAmountMicros_ != 0L) { output.writeInt64(19, adjustmentsSubtotalAmountMicros_); } if (adjustmentsTaxAmountMicros_ != 0L) { output.writeInt64(20, adjustmentsTaxAmountMicros_); } if (adjustmentsTotalAmountMicros_ != 0L) { output.writeInt64(21, adjustmentsTotalAmountMicros_); } if (regulatoryCostsSubtotalAmountMicros_ != 0L) { output.writeInt64(22, regulatoryCostsSubtotalAmountMicros_); } if (regulatoryCostsTaxAmountMicros_ != 0L) { output.writeInt64(23, regulatoryCostsTaxAmountMicros_); } if (regulatoryCostsTotalAmountMicros_ != 0L) { output.writeInt64(24, regulatoryCostsTotalAmountMicros_); } if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 25, id_); } if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 26, billingSetup_); } if (((bitField0_ & 0x00000004) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 27, paymentsAccountId_); } if (((bitField0_ & 0x00000008) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 28, paymentsProfileId_); } if (((bitField0_ & 0x00000010) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 29, issueDate_); } if (((bitField0_ & 0x00000020) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 30, dueDate_); } if (((bitField0_ & 0x00000040) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 31, currencyCode_); } if (((bitField0_ & 0x00000080) != 0)) { output.writeInt64(33, subtotalAmountMicros_); } if (((bitField0_ & 0x00000100) != 0)) { output.writeInt64(34, taxAmountMicros_); } if (((bitField0_ & 0x00000200) != 0)) { output.writeInt64(35, totalAmountMicros_); } if (((bitField0_ & 0x00000400) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 36, correctedInvoice_); } for (int i = 0; i < replacedInvoices_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 37, replacedInvoices_.getRaw(i)); } if (((bitField0_ & 0x00000800) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 38, pdfUrl_); } for (int i = 0; i < accountSummaries_.size(); i++) { output.writeMessage(39, accountSummaries_.get(i)); } getUnknownFields().writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resourceName_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, resourceName_); } if (type_ != com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType.UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(3, type_); } if (serviceDateRange_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(9, getServiceDateRange()); } for (int i = 0; i < accountBudgetSummaries_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(18, accountBudgetSummaries_.get(i)); } if (adjustmentsSubtotalAmountMicros_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(19, adjustmentsSubtotalAmountMicros_); } if (adjustmentsTaxAmountMicros_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(20, adjustmentsTaxAmountMicros_); } if (adjustmentsTotalAmountMicros_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(21, adjustmentsTotalAmountMicros_); } if (regulatoryCostsSubtotalAmountMicros_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(22, regulatoryCostsSubtotalAmountMicros_); } if (regulatoryCostsTaxAmountMicros_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(23, regulatoryCostsTaxAmountMicros_); } if (regulatoryCostsTotalAmountMicros_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(24, regulatoryCostsTotalAmountMicros_); } if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(25, id_); } if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(26, billingSetup_); } if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(27, paymentsAccountId_); } if (((bitField0_ & 0x00000008) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(28, paymentsProfileId_); } if (((bitField0_ & 0x00000010) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(29, issueDate_); } if (((bitField0_ & 0x00000020) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(30, dueDate_); } if (((bitField0_ & 0x00000040) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(31, currencyCode_); } if (((bitField0_ & 0x00000080) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(33, subtotalAmountMicros_); } if (((bitField0_ & 0x00000100) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(34, taxAmountMicros_); } if (((bitField0_ & 0x00000200) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(35, totalAmountMicros_); } if (((bitField0_ & 0x00000400) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(36, correctedInvoice_); } { int dataSize = 0; for (int i = 0; i < replacedInvoices_.size(); i++) { dataSize += computeStringSizeNoTag(replacedInvoices_.getRaw(i)); } size += dataSize; size += 2 * getReplacedInvoicesList().size(); } if (((bitField0_ & 0x00000800) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(38, pdfUrl_); } for (int i = 0; i < accountSummaries_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(39, accountSummaries_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.ads.googleads.v12.resources.Invoice)) { return super.equals(obj); } com.google.ads.googleads.v12.resources.Invoice other = (com.google.ads.googleads.v12.resources.Invoice) obj; if (!getResourceName() .equals(other.getResourceName())) return false; if (hasId() != other.hasId()) return false; if (hasId()) { if (!getId() .equals(other.getId())) return false; } if (type_ != other.type_) return false; if (hasBillingSetup() != other.hasBillingSetup()) return false; if (hasBillingSetup()) { if (!getBillingSetup() .equals(other.getBillingSetup())) return false; } if (hasPaymentsAccountId() != other.hasPaymentsAccountId()) return false; if (hasPaymentsAccountId()) { if (!getPaymentsAccountId() .equals(other.getPaymentsAccountId())) return false; } if (hasPaymentsProfileId() != other.hasPaymentsProfileId()) return false; if (hasPaymentsProfileId()) { if (!getPaymentsProfileId() .equals(other.getPaymentsProfileId())) return false; } if (hasIssueDate() != other.hasIssueDate()) return false; if (hasIssueDate()) { if (!getIssueDate() .equals(other.getIssueDate())) return false; } if (hasDueDate() != other.hasDueDate()) return false; if (hasDueDate()) { if (!getDueDate() .equals(other.getDueDate())) return false; } if (hasServiceDateRange() != other.hasServiceDateRange()) return false; if (hasServiceDateRange()) { if (!getServiceDateRange() .equals(other.getServiceDateRange())) return false; } if (hasCurrencyCode() != other.hasCurrencyCode()) return false; if (hasCurrencyCode()) { if (!getCurrencyCode() .equals(other.getCurrencyCode())) return false; } if (getAdjustmentsSubtotalAmountMicros() != other.getAdjustmentsSubtotalAmountMicros()) return false; if (getAdjustmentsTaxAmountMicros() != other.getAdjustmentsTaxAmountMicros()) return false; if (getAdjustmentsTotalAmountMicros() != other.getAdjustmentsTotalAmountMicros()) return false; if (getRegulatoryCostsSubtotalAmountMicros() != other.getRegulatoryCostsSubtotalAmountMicros()) return false; if (getRegulatoryCostsTaxAmountMicros() != other.getRegulatoryCostsTaxAmountMicros()) return false; if (getRegulatoryCostsTotalAmountMicros() != other.getRegulatoryCostsTotalAmountMicros()) return false; if (hasSubtotalAmountMicros() != other.hasSubtotalAmountMicros()) return false; if (hasSubtotalAmountMicros()) { if (getSubtotalAmountMicros() != other.getSubtotalAmountMicros()) return false; } if (hasTaxAmountMicros() != other.hasTaxAmountMicros()) return false; if (hasTaxAmountMicros()) { if (getTaxAmountMicros() != other.getTaxAmountMicros()) return false; } if (hasTotalAmountMicros() != other.hasTotalAmountMicros()) return false; if (hasTotalAmountMicros()) { if (getTotalAmountMicros() != other.getTotalAmountMicros()) return false; } if (hasCorrectedInvoice() != other.hasCorrectedInvoice()) return false; if (hasCorrectedInvoice()) { if (!getCorrectedInvoice() .equals(other.getCorrectedInvoice())) return false; } if (!getReplacedInvoicesList() .equals(other.getReplacedInvoicesList())) return false; if (hasPdfUrl() != other.hasPdfUrl()) return false; if (hasPdfUrl()) { if (!getPdfUrl() .equals(other.getPdfUrl())) return false; } if (!getAccountBudgetSummariesList() .equals(other.getAccountBudgetSummariesList())) return false; if (!getAccountSummariesList() .equals(other.getAccountSummariesList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + RESOURCE_NAME_FIELD_NUMBER; hash = (53 * hash) + getResourceName().hashCode(); if (hasId()) { hash = (37 * hash) + ID_FIELD_NUMBER; hash = (53 * hash) + getId().hashCode(); } hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; if (hasBillingSetup()) { hash = (37 * hash) + BILLING_SETUP_FIELD_NUMBER; hash = (53 * hash) + getBillingSetup().hashCode(); } if (hasPaymentsAccountId()) { hash = (37 * hash) + PAYMENTS_ACCOUNT_ID_FIELD_NUMBER; hash = (53 * hash) + getPaymentsAccountId().hashCode(); } if (hasPaymentsProfileId()) { hash = (37 * hash) + PAYMENTS_PROFILE_ID_FIELD_NUMBER; hash = (53 * hash) + getPaymentsProfileId().hashCode(); } if (hasIssueDate()) { hash = (37 * hash) + ISSUE_DATE_FIELD_NUMBER; hash = (53 * hash) + getIssueDate().hashCode(); } if (hasDueDate()) { hash = (37 * hash) + DUE_DATE_FIELD_NUMBER; hash = (53 * hash) + getDueDate().hashCode(); } if (hasServiceDateRange()) { hash = (37 * hash) + SERVICE_DATE_RANGE_FIELD_NUMBER; hash = (53 * hash) + getServiceDateRange().hashCode(); } if (hasCurrencyCode()) { hash = (37 * hash) + CURRENCY_CODE_FIELD_NUMBER; hash = (53 * hash) + getCurrencyCode().hashCode(); } hash = (37 * hash) + ADJUSTMENTS_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getAdjustmentsSubtotalAmountMicros()); hash = (37 * hash) + ADJUSTMENTS_TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getAdjustmentsTaxAmountMicros()); hash = (37 * hash) + ADJUSTMENTS_TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getAdjustmentsTotalAmountMicros()); hash = (37 * hash) + REGULATORY_COSTS_SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getRegulatoryCostsSubtotalAmountMicros()); hash = (37 * hash) + REGULATORY_COSTS_TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getRegulatoryCostsTaxAmountMicros()); hash = (37 * hash) + REGULATORY_COSTS_TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getRegulatoryCostsTotalAmountMicros()); if (hasSubtotalAmountMicros()) { hash = (37 * hash) + SUBTOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getSubtotalAmountMicros()); } if (hasTaxAmountMicros()) { hash = (37 * hash) + TAX_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getTaxAmountMicros()); } if (hasTotalAmountMicros()) { hash = (37 * hash) + TOTAL_AMOUNT_MICROS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getTotalAmountMicros()); } if (hasCorrectedInvoice()) { hash = (37 * hash) + CORRECTED_INVOICE_FIELD_NUMBER; hash = (53 * hash) + getCorrectedInvoice().hashCode(); } if (getReplacedInvoicesCount() > 0) { hash = (37 * hash) + REPLACED_INVOICES_FIELD_NUMBER; hash = (53 * hash) + getReplacedInvoicesList().hashCode(); } if (hasPdfUrl()) { hash = (37 * hash) + PDF_URL_FIELD_NUMBER; hash = (53 * hash) + getPdfUrl().hashCode(); } if (getAccountBudgetSummariesCount() > 0) { hash = (37 * hash) + ACCOUNT_BUDGET_SUMMARIES_FIELD_NUMBER; hash = (53 * hash) + getAccountBudgetSummariesList().hashCode(); } if (getAccountSummariesCount() > 0) { hash = (37 * hash) + ACCOUNT_SUMMARIES_FIELD_NUMBER; hash = (53 * hash) + getAccountSummariesList().hashCode(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.resources.Invoice parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.ads.googleads.v12.resources.Invoice prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * An invoice. All invoice information is snapshotted to match the PDF invoice. * For invoices older than the launch of InvoiceService, the snapshotted * information may not match the PDF invoice. * </pre> * * Protobuf type {@code google.ads.googleads.v12.resources.Invoice} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.ads.googleads.v12.resources.Invoice) com.google.ads.googleads.v12.resources.InvoiceOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.resources.Invoice.class, com.google.ads.googleads.v12.resources.Invoice.Builder.class); } // Construct using com.google.ads.googleads.v12.resources.Invoice.newBuilder() private Builder() { } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); } @java.lang.Override public Builder clear() { super.clear(); resourceName_ = ""; id_ = ""; bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; billingSetup_ = ""; bitField0_ = (bitField0_ & ~0x00000002); paymentsAccountId_ = ""; bitField0_ = (bitField0_ & ~0x00000004); paymentsProfileId_ = ""; bitField0_ = (bitField0_ & ~0x00000008); issueDate_ = ""; bitField0_ = (bitField0_ & ~0x00000010); dueDate_ = ""; bitField0_ = (bitField0_ & ~0x00000020); if (serviceDateRangeBuilder_ == null) { serviceDateRange_ = null; } else { serviceDateRange_ = null; serviceDateRangeBuilder_ = null; } currencyCode_ = ""; bitField0_ = (bitField0_ & ~0x00000040); adjustmentsSubtotalAmountMicros_ = 0L; adjustmentsTaxAmountMicros_ = 0L; adjustmentsTotalAmountMicros_ = 0L; regulatoryCostsSubtotalAmountMicros_ = 0L; regulatoryCostsTaxAmountMicros_ = 0L; regulatoryCostsTotalAmountMicros_ = 0L; subtotalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000080); taxAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000100); totalAmountMicros_ = 0L; bitField0_ = (bitField0_ & ~0x00000200); correctedInvoice_ = ""; bitField0_ = (bitField0_ & ~0x00000400); replacedInvoices_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000800); pdfUrl_ = ""; bitField0_ = (bitField0_ & ~0x00001000); if (accountBudgetSummariesBuilder_ == null) { accountBudgetSummaries_ = java.util.Collections.emptyList(); } else { accountBudgetSummaries_ = null; accountBudgetSummariesBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00002000); if (accountSummariesBuilder_ == null) { accountSummaries_ = java.util.Collections.emptyList(); } else { accountSummaries_ = null; accountSummariesBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00004000); return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.ads.googleads.v12.resources.InvoiceProto.internal_static_google_ads_googleads_v12_resources_Invoice_descriptor; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice getDefaultInstanceForType() { return com.google.ads.googleads.v12.resources.Invoice.getDefaultInstance(); } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice build() { com.google.ads.googleads.v12.resources.Invoice result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice buildPartial() { com.google.ads.googleads.v12.resources.Invoice result = new com.google.ads.googleads.v12.resources.Invoice(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.resourceName_ = resourceName_; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.id_ = id_; result.type_ = type_; if (((from_bitField0_ & 0x00000002) != 0)) { to_bitField0_ |= 0x00000002; } result.billingSetup_ = billingSetup_; if (((from_bitField0_ & 0x00000004) != 0)) { to_bitField0_ |= 0x00000004; } result.paymentsAccountId_ = paymentsAccountId_; if (((from_bitField0_ & 0x00000008) != 0)) { to_bitField0_ |= 0x00000008; } result.paymentsProfileId_ = paymentsProfileId_; if (((from_bitField0_ & 0x00000010) != 0)) { to_bitField0_ |= 0x00000010; } result.issueDate_ = issueDate_; if (((from_bitField0_ & 0x00000020) != 0)) { to_bitField0_ |= 0x00000020; } result.dueDate_ = dueDate_; if (serviceDateRangeBuilder_ == null) { result.serviceDateRange_ = serviceDateRange_; } else { result.serviceDateRange_ = serviceDateRangeBuilder_.build(); } if (((from_bitField0_ & 0x00000040) != 0)) { to_bitField0_ |= 0x00000040; } result.currencyCode_ = currencyCode_; result.adjustmentsSubtotalAmountMicros_ = adjustmentsSubtotalAmountMicros_; result.adjustmentsTaxAmountMicros_ = adjustmentsTaxAmountMicros_; result.adjustmentsTotalAmountMicros_ = adjustmentsTotalAmountMicros_; result.regulatoryCostsSubtotalAmountMicros_ = regulatoryCostsSubtotalAmountMicros_; result.regulatoryCostsTaxAmountMicros_ = regulatoryCostsTaxAmountMicros_; result.regulatoryCostsTotalAmountMicros_ = regulatoryCostsTotalAmountMicros_; if (((from_bitField0_ & 0x00000080) != 0)) { result.subtotalAmountMicros_ = subtotalAmountMicros_; to_bitField0_ |= 0x00000080; } if (((from_bitField0_ & 0x00000100) != 0)) { result.taxAmountMicros_ = taxAmountMicros_; to_bitField0_ |= 0x00000100; } if (((from_bitField0_ & 0x00000200) != 0)) { result.totalAmountMicros_ = totalAmountMicros_; to_bitField0_ |= 0x00000200; } if (((from_bitField0_ & 0x00000400) != 0)) { to_bitField0_ |= 0x00000400; } result.correctedInvoice_ = correctedInvoice_; if (((bitField0_ & 0x00000800) != 0)) { replacedInvoices_ = replacedInvoices_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000800); } result.replacedInvoices_ = replacedInvoices_; if (((from_bitField0_ & 0x00001000) != 0)) { to_bitField0_ |= 0x00000800; } result.pdfUrl_ = pdfUrl_; if (accountBudgetSummariesBuilder_ == null) { if (((bitField0_ & 0x00002000) != 0)) { accountBudgetSummaries_ = java.util.Collections.unmodifiableList(accountBudgetSummaries_); bitField0_ = (bitField0_ & ~0x00002000); } result.accountBudgetSummaries_ = accountBudgetSummaries_; } else { result.accountBudgetSummaries_ = accountBudgetSummariesBuilder_.build(); } if (accountSummariesBuilder_ == null) { if (((bitField0_ & 0x00004000) != 0)) { accountSummaries_ = java.util.Collections.unmodifiableList(accountSummaries_); bitField0_ = (bitField0_ & ~0x00004000); } result.accountSummaries_ = accountSummaries_; } else { result.accountSummaries_ = accountSummariesBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.ads.googleads.v12.resources.Invoice) { return mergeFrom((com.google.ads.googleads.v12.resources.Invoice)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.ads.googleads.v12.resources.Invoice other) { if (other == com.google.ads.googleads.v12.resources.Invoice.getDefaultInstance()) return this; if (!other.getResourceName().isEmpty()) { resourceName_ = other.resourceName_; onChanged(); } if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } if (other.type_ != 0) { setTypeValue(other.getTypeValue()); } if (other.hasBillingSetup()) { bitField0_ |= 0x00000002; billingSetup_ = other.billingSetup_; onChanged(); } if (other.hasPaymentsAccountId()) { bitField0_ |= 0x00000004; paymentsAccountId_ = other.paymentsAccountId_; onChanged(); } if (other.hasPaymentsProfileId()) { bitField0_ |= 0x00000008; paymentsProfileId_ = other.paymentsProfileId_; onChanged(); } if (other.hasIssueDate()) { bitField0_ |= 0x00000010; issueDate_ = other.issueDate_; onChanged(); } if (other.hasDueDate()) { bitField0_ |= 0x00000020; dueDate_ = other.dueDate_; onChanged(); } if (other.hasServiceDateRange()) { mergeServiceDateRange(other.getServiceDateRange()); } if (other.hasCurrencyCode()) { bitField0_ |= 0x00000040; currencyCode_ = other.currencyCode_; onChanged(); } if (other.getAdjustmentsSubtotalAmountMicros() != 0L) { setAdjustmentsSubtotalAmountMicros(other.getAdjustmentsSubtotalAmountMicros()); } if (other.getAdjustmentsTaxAmountMicros() != 0L) { setAdjustmentsTaxAmountMicros(other.getAdjustmentsTaxAmountMicros()); } if (other.getAdjustmentsTotalAmountMicros() != 0L) { setAdjustmentsTotalAmountMicros(other.getAdjustmentsTotalAmountMicros()); } if (other.getRegulatoryCostsSubtotalAmountMicros() != 0L) { setRegulatoryCostsSubtotalAmountMicros(other.getRegulatoryCostsSubtotalAmountMicros()); } if (other.getRegulatoryCostsTaxAmountMicros() != 0L) { setRegulatoryCostsTaxAmountMicros(other.getRegulatoryCostsTaxAmountMicros()); } if (other.getRegulatoryCostsTotalAmountMicros() != 0L) { setRegulatoryCostsTotalAmountMicros(other.getRegulatoryCostsTotalAmountMicros()); } if (other.hasSubtotalAmountMicros()) { setSubtotalAmountMicros(other.getSubtotalAmountMicros()); } if (other.hasTaxAmountMicros()) { setTaxAmountMicros(other.getTaxAmountMicros()); } if (other.hasTotalAmountMicros()) { setTotalAmountMicros(other.getTotalAmountMicros()); } if (other.hasCorrectedInvoice()) { bitField0_ |= 0x00000400; correctedInvoice_ = other.correctedInvoice_; onChanged(); } if (!other.replacedInvoices_.isEmpty()) { if (replacedInvoices_.isEmpty()) { replacedInvoices_ = other.replacedInvoices_; bitField0_ = (bitField0_ & ~0x00000800); } else { ensureReplacedInvoicesIsMutable(); replacedInvoices_.addAll(other.replacedInvoices_); } onChanged(); } if (other.hasPdfUrl()) { bitField0_ |= 0x00001000; pdfUrl_ = other.pdfUrl_; onChanged(); } if (accountBudgetSummariesBuilder_ == null) { if (!other.accountBudgetSummaries_.isEmpty()) { if (accountBudgetSummaries_.isEmpty()) { accountBudgetSummaries_ = other.accountBudgetSummaries_; bitField0_ = (bitField0_ & ~0x00002000); } else { ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.addAll(other.accountBudgetSummaries_); } onChanged(); } } else { if (!other.accountBudgetSummaries_.isEmpty()) { if (accountBudgetSummariesBuilder_.isEmpty()) { accountBudgetSummariesBuilder_.dispose(); accountBudgetSummariesBuilder_ = null; accountBudgetSummaries_ = other.accountBudgetSummaries_; bitField0_ = (bitField0_ & ~0x00002000); accountBudgetSummariesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getAccountBudgetSummariesFieldBuilder() : null; } else { accountBudgetSummariesBuilder_.addAllMessages(other.accountBudgetSummaries_); } } } if (accountSummariesBuilder_ == null) { if (!other.accountSummaries_.isEmpty()) { if (accountSummaries_.isEmpty()) { accountSummaries_ = other.accountSummaries_; bitField0_ = (bitField0_ & ~0x00004000); } else { ensureAccountSummariesIsMutable(); accountSummaries_.addAll(other.accountSummaries_); } onChanged(); } } else { if (!other.accountSummaries_.isEmpty()) { if (accountSummariesBuilder_.isEmpty()) { accountSummariesBuilder_.dispose(); accountSummariesBuilder_ = null; accountSummaries_ = other.accountSummaries_; bitField0_ = (bitField0_ & ~0x00004000); accountSummariesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getAccountSummariesFieldBuilder() : null; } else { accountSummariesBuilder_.addAllMessages(other.accountSummaries_); } } } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { resourceName_ = input.readStringRequireUtf8(); break; } // case 10 case 24: { type_ = input.readEnum(); break; } // case 24 case 74: { input.readMessage( getServiceDateRangeFieldBuilder().getBuilder(), extensionRegistry); break; } // case 74 case 146: { com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary m = input.readMessage( com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.parser(), extensionRegistry); if (accountBudgetSummariesBuilder_ == null) { ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.add(m); } else { accountBudgetSummariesBuilder_.addMessage(m); } break; } // case 146 case 152: { adjustmentsSubtotalAmountMicros_ = input.readInt64(); break; } // case 152 case 160: { adjustmentsTaxAmountMicros_ = input.readInt64(); break; } // case 160 case 168: { adjustmentsTotalAmountMicros_ = input.readInt64(); break; } // case 168 case 176: { regulatoryCostsSubtotalAmountMicros_ = input.readInt64(); break; } // case 176 case 184: { regulatoryCostsTaxAmountMicros_ = input.readInt64(); break; } // case 184 case 192: { regulatoryCostsTotalAmountMicros_ = input.readInt64(); break; } // case 192 case 202: { id_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000001; break; } // case 202 case 210: { billingSetup_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000002; break; } // case 210 case 218: { paymentsAccountId_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000004; break; } // case 218 case 226: { paymentsProfileId_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000008; break; } // case 226 case 234: { issueDate_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000010; break; } // case 234 case 242: { dueDate_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000020; break; } // case 242 case 250: { currencyCode_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000040; break; } // case 250 case 264: { subtotalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000080; break; } // case 264 case 272: { taxAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000100; break; } // case 272 case 280: { totalAmountMicros_ = input.readInt64(); bitField0_ |= 0x00000200; break; } // case 280 case 290: { correctedInvoice_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000400; break; } // case 290 case 298: { java.lang.String s = input.readStringRequireUtf8(); ensureReplacedInvoicesIsMutable(); replacedInvoices_.add(s); break; } // case 298 case 306: { pdfUrl_ = input.readStringRequireUtf8(); bitField0_ |= 0x00001000; break; } // case 306 case 314: { com.google.ads.googleads.v12.resources.Invoice.AccountSummary m = input.readMessage( com.google.ads.googleads.v12.resources.Invoice.AccountSummary.parser(), extensionRegistry); if (accountSummariesBuilder_ == null) { ensureAccountSummariesIsMutable(); accountSummaries_.add(m); } else { accountSummariesBuilder_.addMessage(m); } break; } // case 314 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag } break; } // default: } // switch (tag) } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.unwrapIOException(); } finally { onChanged(); } // finally return this; } private int bitField0_; private java.lang.Object resourceName_ = ""; /** * <pre> * Output only. The resource name of the invoice. Multiple customers can share a given * invoice, so multiple resource names may point to the same invoice. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>string resource_name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }</code> * @return The resourceName. */ public java.lang.String getResourceName() { java.lang.Object ref = resourceName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resourceName_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The resource name of the invoice. Multiple customers can share a given * invoice, so multiple resource names may point to the same invoice. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>string resource_name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }</code> * @return The bytes for resourceName. */ public com.google.protobuf.ByteString getResourceNameBytes() { java.lang.Object ref = resourceName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); resourceName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The resource name of the invoice. Multiple customers can share a given * invoice, so multiple resource names may point to the same invoice. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>string resource_name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }</code> * @param value The resourceName to set. * @return This builder for chaining. */ public Builder setResourceName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } resourceName_ = value; onChanged(); return this; } /** * <pre> * Output only. The resource name of the invoice. Multiple customers can share a given * invoice, so multiple resource names may point to the same invoice. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>string resource_name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }</code> * @return This builder for chaining. */ public Builder clearResourceName() { resourceName_ = getDefaultInstance().getResourceName(); onChanged(); return this; } /** * <pre> * Output only. The resource name of the invoice. Multiple customers can share a given * invoice, so multiple resource names may point to the same invoice. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>string resource_name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... }</code> * @param value The bytes for resourceName to set. * @return This builder for chaining. */ public Builder setResourceNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); resourceName_ = value; onChanged(); return this; } private java.lang.Object id_ = ""; /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the id field is set. */ public boolean hasId() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The id. */ public java.lang.String getId() { java.lang.Object ref = id_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); id_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for id. */ public com.google.protobuf.ByteString getIdBytes() { java.lang.Object ref = id_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); id_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The id to set. * @return This builder for chaining. */ public Builder setId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = getDefaultInstance().getId(); onChanged(); return this; } /** * <pre> * Output only. The ID of the invoice. It appears on the invoice PDF as "Invoice number". * </pre> * * <code>optional string id = 25 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for id to set. * @return This builder for chaining. */ public Builder setIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } private int type_ = 0; /** * <pre> * Output only. The type of invoice. * </pre> * * <code>.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The enum numeric value on the wire for type. */ @java.lang.Override public int getTypeValue() { return type_; } /** * <pre> * Output only. The type of invoice. * </pre> * * <code>.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The enum numeric value on the wire for type to set. * @return This builder for chaining. */ public Builder setTypeValue(int value) { type_ = value; onChanged(); return this; } /** * <pre> * Output only. The type of invoice. * </pre> * * <code>.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The type. */ @java.lang.Override public com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType getType() { @SuppressWarnings("deprecation") com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType result = com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType.valueOf(type_); return result == null ? com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType.UNRECOGNIZED : result; } /** * <pre> * Output only. The type of invoice. * </pre> * * <code>.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The type to set. * @return This builder for chaining. */ public Builder setType(com.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType value) { if (value == null) { throw new NullPointerException(); } type_ = value.getNumber(); onChanged(); return this; } /** * <pre> * Output only. The type of invoice. * </pre> * * <code>.google.ads.googleads.v12.enums.InvoiceTypeEnum.InvoiceType type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearType() { type_ = 0; onChanged(); return this; } private java.lang.Object billingSetup_ = ""; /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the billingSetup field is set. */ public boolean hasBillingSetup() { return ((bitField0_ & 0x00000002) != 0); } /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The billingSetup. */ public java.lang.String getBillingSetup() { java.lang.Object ref = billingSetup_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); billingSetup_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for billingSetup. */ public com.google.protobuf.ByteString getBillingSetupBytes() { java.lang.Object ref = billingSetup_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); billingSetup_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The billingSetup to set. * @return This builder for chaining. */ public Builder setBillingSetup( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; billingSetup_ = value; onChanged(); return this; } /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearBillingSetup() { bitField0_ = (bitField0_ & ~0x00000002); billingSetup_ = getDefaultInstance().getBillingSetup(); onChanged(); return this; } /** * <pre> * Output only. The resource name of this invoice's billing setup. * `customers/{customer_id}/billingSetups/{billing_setup_id}` * </pre> * * <code>optional string billing_setup = 26 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for billingSetup to set. * @return This builder for chaining. */ public Builder setBillingSetupBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000002; billingSetup_ = value; onChanged(); return this; } private java.lang.Object paymentsAccountId_ = ""; /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the paymentsAccountId field is set. */ public boolean hasPaymentsAccountId() { return ((bitField0_ & 0x00000004) != 0); } /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The paymentsAccountId. */ public java.lang.String getPaymentsAccountId() { java.lang.Object ref = paymentsAccountId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); paymentsAccountId_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for paymentsAccountId. */ public com.google.protobuf.ByteString getPaymentsAccountIdBytes() { java.lang.Object ref = paymentsAccountId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); paymentsAccountId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The paymentsAccountId to set. * @return This builder for chaining. */ public Builder setPaymentsAccountId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; paymentsAccountId_ = value; onChanged(); return this; } /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearPaymentsAccountId() { bitField0_ = (bitField0_ & ~0x00000004); paymentsAccountId_ = getDefaultInstance().getPaymentsAccountId(); onChanged(); return this; } /** * <pre> * Output only. A 16 digit ID used to identify the payments account associated with the * billing setup, for example, "1234-5678-9012-3456". It appears on the * invoice PDF as "Billing Account Number". * </pre> * * <code>optional string payments_account_id = 27 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for paymentsAccountId to set. * @return This builder for chaining. */ public Builder setPaymentsAccountIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000004; paymentsAccountId_ = value; onChanged(); return this; } private java.lang.Object paymentsProfileId_ = ""; /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the paymentsProfileId field is set. */ public boolean hasPaymentsProfileId() { return ((bitField0_ & 0x00000008) != 0); } /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The paymentsProfileId. */ public java.lang.String getPaymentsProfileId() { java.lang.Object ref = paymentsProfileId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); paymentsProfileId_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for paymentsProfileId. */ public com.google.protobuf.ByteString getPaymentsProfileIdBytes() { java.lang.Object ref = paymentsProfileId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); paymentsProfileId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The paymentsProfileId to set. * @return This builder for chaining. */ public Builder setPaymentsProfileId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; paymentsProfileId_ = value; onChanged(); return this; } /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearPaymentsProfileId() { bitField0_ = (bitField0_ & ~0x00000008); paymentsProfileId_ = getDefaultInstance().getPaymentsProfileId(); onChanged(); return this; } /** * <pre> * Output only. A 12 digit ID used to identify the payments profile associated with the * billing setup, for example, "1234-5678-9012". It appears on the invoice PDF * as "Billing ID". * </pre> * * <code>optional string payments_profile_id = 28 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for paymentsProfileId to set. * @return This builder for chaining. */ public Builder setPaymentsProfileIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000008; paymentsProfileId_ = value; onChanged(); return this; } private java.lang.Object issueDate_ = ""; /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the issueDate field is set. */ public boolean hasIssueDate() { return ((bitField0_ & 0x00000010) != 0); } /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The issueDate. */ public java.lang.String getIssueDate() { java.lang.Object ref = issueDate_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); issueDate_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for issueDate. */ public com.google.protobuf.ByteString getIssueDateBytes() { java.lang.Object ref = issueDate_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); issueDate_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The issueDate to set. * @return This builder for chaining. */ public Builder setIssueDate( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; issueDate_ = value; onChanged(); return this; } /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearIssueDate() { bitField0_ = (bitField0_ & ~0x00000010); issueDate_ = getDefaultInstance().getIssueDate(); onChanged(); return this; } /** * <pre> * Output only. The issue date in yyyy-mm-dd format. It appears on the invoice PDF as * either "Issue date" or "Invoice date". * </pre> * * <code>optional string issue_date = 29 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for issueDate to set. * @return This builder for chaining. */ public Builder setIssueDateBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000010; issueDate_ = value; onChanged(); return this; } private java.lang.Object dueDate_ = ""; /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the dueDate field is set. */ public boolean hasDueDate() { return ((bitField0_ & 0x00000020) != 0); } /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The dueDate. */ public java.lang.String getDueDate() { java.lang.Object ref = dueDate_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); dueDate_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for dueDate. */ public com.google.protobuf.ByteString getDueDateBytes() { java.lang.Object ref = dueDate_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); dueDate_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The dueDate to set. * @return This builder for chaining. */ public Builder setDueDate( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; dueDate_ = value; onChanged(); return this; } /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearDueDate() { bitField0_ = (bitField0_ & ~0x00000020); dueDate_ = getDefaultInstance().getDueDate(); onChanged(); return this; } /** * <pre> * Output only. The due date in yyyy-mm-dd format. * </pre> * * <code>optional string due_date = 30 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for dueDate to set. * @return This builder for chaining. */ public Builder setDueDateBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000020; dueDate_ = value; onChanged(); return this; } private com.google.ads.googleads.v12.common.DateRange serviceDateRange_; private com.google.protobuf.SingleFieldBuilderV3< com.google.ads.googleads.v12.common.DateRange, com.google.ads.googleads.v12.common.DateRange.Builder, com.google.ads.googleads.v12.common.DateRangeOrBuilder> serviceDateRangeBuilder_; /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the serviceDateRange field is set. */ public boolean hasServiceDateRange() { return serviceDateRangeBuilder_ != null || serviceDateRange_ != null; } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The serviceDateRange. */ public com.google.ads.googleads.v12.common.DateRange getServiceDateRange() { if (serviceDateRangeBuilder_ == null) { return serviceDateRange_ == null ? com.google.ads.googleads.v12.common.DateRange.getDefaultInstance() : serviceDateRange_; } else { return serviceDateRangeBuilder_.getMessage(); } } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setServiceDateRange(com.google.ads.googleads.v12.common.DateRange value) { if (serviceDateRangeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } serviceDateRange_ = value; onChanged(); } else { serviceDateRangeBuilder_.setMessage(value); } return this; } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setServiceDateRange( com.google.ads.googleads.v12.common.DateRange.Builder builderForValue) { if (serviceDateRangeBuilder_ == null) { serviceDateRange_ = builderForValue.build(); onChanged(); } else { serviceDateRangeBuilder_.setMessage(builderForValue.build()); } return this; } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder mergeServiceDateRange(com.google.ads.googleads.v12.common.DateRange value) { if (serviceDateRangeBuilder_ == null) { if (serviceDateRange_ != null) { serviceDateRange_ = com.google.ads.googleads.v12.common.DateRange.newBuilder(serviceDateRange_).mergeFrom(value).buildPartial(); } else { serviceDateRange_ = value; } onChanged(); } else { serviceDateRangeBuilder_.mergeFrom(value); } return this; } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder clearServiceDateRange() { if (serviceDateRangeBuilder_ == null) { serviceDateRange_ = null; onChanged(); } else { serviceDateRange_ = null; serviceDateRangeBuilder_ = null; } return this; } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.common.DateRange.Builder getServiceDateRangeBuilder() { onChanged(); return getServiceDateRangeFieldBuilder().getBuilder(); } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.common.DateRangeOrBuilder getServiceDateRangeOrBuilder() { if (serviceDateRangeBuilder_ != null) { return serviceDateRangeBuilder_.getMessageOrBuilder(); } else { return serviceDateRange_ == null ? com.google.ads.googleads.v12.common.DateRange.getDefaultInstance() : serviceDateRange_; } } /** * <pre> * Output only. The service period date range of this invoice. The end date is inclusive. * </pre> * * <code>.google.ads.googleads.v12.common.DateRange service_date_range = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.ads.googleads.v12.common.DateRange, com.google.ads.googleads.v12.common.DateRange.Builder, com.google.ads.googleads.v12.common.DateRangeOrBuilder> getServiceDateRangeFieldBuilder() { if (serviceDateRangeBuilder_ == null) { serviceDateRangeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.ads.googleads.v12.common.DateRange, com.google.ads.googleads.v12.common.DateRange.Builder, com.google.ads.googleads.v12.common.DateRangeOrBuilder>( getServiceDateRange(), getParentForChildren(), isClean()); serviceDateRange_ = null; } return serviceDateRangeBuilder_; } private java.lang.Object currencyCode_ = ""; /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the currencyCode field is set. */ public boolean hasCurrencyCode() { return ((bitField0_ & 0x00000040) != 0); } /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The currencyCode. */ public java.lang.String getCurrencyCode() { java.lang.Object ref = currencyCode_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); currencyCode_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for currencyCode. */ public com.google.protobuf.ByteString getCurrencyCodeBytes() { java.lang.Object ref = currencyCode_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); currencyCode_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The currencyCode to set. * @return This builder for chaining. */ public Builder setCurrencyCode( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; currencyCode_ = value; onChanged(); return this; } /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCurrencyCode() { bitField0_ = (bitField0_ & ~0x00000040); currencyCode_ = getDefaultInstance().getCurrencyCode(); onChanged(); return this; } /** * <pre> * Output only. The currency code. All costs are returned in this currency. A subset of the * currency codes derived from the ISO 4217 standard is supported. * </pre> * * <code>optional string currency_code = 31 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for currencyCode to set. * @return This builder for chaining. */ public Builder setCurrencyCodeBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000040; currencyCode_ = value; onChanged(); return this; } private long adjustmentsSubtotalAmountMicros_ ; /** * <pre> * Output only. The pretax subtotal amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_subtotal_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The adjustmentsSubtotalAmountMicros. */ @java.lang.Override public long getAdjustmentsSubtotalAmountMicros() { return adjustmentsSubtotalAmountMicros_; } /** * <pre> * Output only. The pretax subtotal amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_subtotal_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The adjustmentsSubtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setAdjustmentsSubtotalAmountMicros(long value) { adjustmentsSubtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The pretax subtotal amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_subtotal_amount_micros = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearAdjustmentsSubtotalAmountMicros() { adjustmentsSubtotalAmountMicros_ = 0L; onChanged(); return this; } private long adjustmentsTaxAmountMicros_ ; /** * <pre> * Output only. The sum of taxes on the invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_tax_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The adjustmentsTaxAmountMicros. */ @java.lang.Override public long getAdjustmentsTaxAmountMicros() { return adjustmentsTaxAmountMicros_; } /** * <pre> * Output only. The sum of taxes on the invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_tax_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The adjustmentsTaxAmountMicros to set. * @return This builder for chaining. */ public Builder setAdjustmentsTaxAmountMicros(long value) { adjustmentsTaxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The sum of taxes on the invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_tax_amount_micros = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearAdjustmentsTaxAmountMicros() { adjustmentsTaxAmountMicros_ = 0L; onChanged(); return this; } private long adjustmentsTotalAmountMicros_ ; /** * <pre> * Output only. The total amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_total_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The adjustmentsTotalAmountMicros. */ @java.lang.Override public long getAdjustmentsTotalAmountMicros() { return adjustmentsTotalAmountMicros_; } /** * <pre> * Output only. The total amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_total_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The adjustmentsTotalAmountMicros to set. * @return This builder for chaining. */ public Builder setAdjustmentsTotalAmountMicros(long value) { adjustmentsTotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The total amount of invoice level adjustments, in micros. * </pre> * * <code>int64 adjustments_total_amount_micros = 21 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearAdjustmentsTotalAmountMicros() { adjustmentsTotalAmountMicros_ = 0L; onChanged(); return this; } private long regulatoryCostsSubtotalAmountMicros_ ; /** * <pre> * Output only. The pretax subtotal amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_subtotal_amount_micros = 22 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsSubtotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsSubtotalAmountMicros() { return regulatoryCostsSubtotalAmountMicros_; } /** * <pre> * Output only. The pretax subtotal amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_subtotal_amount_micros = 22 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The regulatoryCostsSubtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setRegulatoryCostsSubtotalAmountMicros(long value) { regulatoryCostsSubtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The pretax subtotal amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_subtotal_amount_micros = 22 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearRegulatoryCostsSubtotalAmountMicros() { regulatoryCostsSubtotalAmountMicros_ = 0L; onChanged(); return this; } private long regulatoryCostsTaxAmountMicros_ ; /** * <pre> * Output only. The sum of taxes on the invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_tax_amount_micros = 23 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTaxAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTaxAmountMicros() { return regulatoryCostsTaxAmountMicros_; } /** * <pre> * Output only. The sum of taxes on the invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_tax_amount_micros = 23 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The regulatoryCostsTaxAmountMicros to set. * @return This builder for chaining. */ public Builder setRegulatoryCostsTaxAmountMicros(long value) { regulatoryCostsTaxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The sum of taxes on the invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_tax_amount_micros = 23 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearRegulatoryCostsTaxAmountMicros() { regulatoryCostsTaxAmountMicros_ = 0L; onChanged(); return this; } private long regulatoryCostsTotalAmountMicros_ ; /** * <pre> * Output only. The total amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_total_amount_micros = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The regulatoryCostsTotalAmountMicros. */ @java.lang.Override public long getRegulatoryCostsTotalAmountMicros() { return regulatoryCostsTotalAmountMicros_; } /** * <pre> * Output only. The total amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_total_amount_micros = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The regulatoryCostsTotalAmountMicros to set. * @return This builder for chaining. */ public Builder setRegulatoryCostsTotalAmountMicros(long value) { regulatoryCostsTotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The total amount of invoice level regulatory costs, in micros. * </pre> * * <code>int64 regulatory_costs_total_amount_micros = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearRegulatoryCostsTotalAmountMicros() { regulatoryCostsTotalAmountMicros_ = 0L; onChanged(); return this; } private long subtotalAmountMicros_ ; /** * <pre> * Output only. The pretax subtotal amount, in micros. This equals the * sum of the AccountBudgetSummary subtotal amounts, * Invoice.adjustments_subtotal_amount_micros, and * Invoice.regulatory_costs_subtotal_amount_micros. * Starting with v6, the Invoice.regulatory_costs_subtotal_amount_micros is no * longer included. * </pre> * * <code>optional int64 subtotal_amount_micros = 33 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the subtotalAmountMicros field is set. */ @java.lang.Override public boolean hasSubtotalAmountMicros() { return ((bitField0_ & 0x00000080) != 0); } /** * <pre> * Output only. The pretax subtotal amount, in micros. This equals the * sum of the AccountBudgetSummary subtotal amounts, * Invoice.adjustments_subtotal_amount_micros, and * Invoice.regulatory_costs_subtotal_amount_micros. * Starting with v6, the Invoice.regulatory_costs_subtotal_amount_micros is no * longer included. * </pre> * * <code>optional int64 subtotal_amount_micros = 33 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The subtotalAmountMicros. */ @java.lang.Override public long getSubtotalAmountMicros() { return subtotalAmountMicros_; } /** * <pre> * Output only. The pretax subtotal amount, in micros. This equals the * sum of the AccountBudgetSummary subtotal amounts, * Invoice.adjustments_subtotal_amount_micros, and * Invoice.regulatory_costs_subtotal_amount_micros. * Starting with v6, the Invoice.regulatory_costs_subtotal_amount_micros is no * longer included. * </pre> * * <code>optional int64 subtotal_amount_micros = 33 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The subtotalAmountMicros to set. * @return This builder for chaining. */ public Builder setSubtotalAmountMicros(long value) { bitField0_ |= 0x00000080; subtotalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The pretax subtotal amount, in micros. This equals the * sum of the AccountBudgetSummary subtotal amounts, * Invoice.adjustments_subtotal_amount_micros, and * Invoice.regulatory_costs_subtotal_amount_micros. * Starting with v6, the Invoice.regulatory_costs_subtotal_amount_micros is no * longer included. * </pre> * * <code>optional int64 subtotal_amount_micros = 33 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearSubtotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000080); subtotalAmountMicros_ = 0L; onChanged(); return this; } private long taxAmountMicros_ ; /** * <pre> * Output only. The sum of all taxes on the invoice, in micros. This equals the sum of the * AccountBudgetSummary tax amounts, plus taxes not associated with a specific * account budget. * </pre> * * <code>optional int64 tax_amount_micros = 34 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the taxAmountMicros field is set. */ @java.lang.Override public boolean hasTaxAmountMicros() { return ((bitField0_ & 0x00000100) != 0); } /** * <pre> * Output only. The sum of all taxes on the invoice, in micros. This equals the sum of the * AccountBudgetSummary tax amounts, plus taxes not associated with a specific * account budget. * </pre> * * <code>optional int64 tax_amount_micros = 34 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The taxAmountMicros. */ @java.lang.Override public long getTaxAmountMicros() { return taxAmountMicros_; } /** * <pre> * Output only. The sum of all taxes on the invoice, in micros. This equals the sum of the * AccountBudgetSummary tax amounts, plus taxes not associated with a specific * account budget. * </pre> * * <code>optional int64 tax_amount_micros = 34 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The taxAmountMicros to set. * @return This builder for chaining. */ public Builder setTaxAmountMicros(long value) { bitField0_ |= 0x00000100; taxAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The sum of all taxes on the invoice, in micros. This equals the sum of the * AccountBudgetSummary tax amounts, plus taxes not associated with a specific * account budget. * </pre> * * <code>optional int64 tax_amount_micros = 34 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearTaxAmountMicros() { bitField0_ = (bitField0_ & ~0x00000100); taxAmountMicros_ = 0L; onChanged(); return this; } private long totalAmountMicros_ ; /** * <pre> * Output only. The total amount, in micros. This equals the sum of * Invoice.subtotal_amount_micros and Invoice.tax_amount_micros. * Starting with v6, Invoice.regulatory_costs_subtotal_amount_micros is * also added as it is no longer already included in * Invoice.tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 35 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the totalAmountMicros field is set. */ @java.lang.Override public boolean hasTotalAmountMicros() { return ((bitField0_ & 0x00000200) != 0); } /** * <pre> * Output only. The total amount, in micros. This equals the sum of * Invoice.subtotal_amount_micros and Invoice.tax_amount_micros. * Starting with v6, Invoice.regulatory_costs_subtotal_amount_micros is * also added as it is no longer already included in * Invoice.tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 35 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The totalAmountMicros. */ @java.lang.Override public long getTotalAmountMicros() { return totalAmountMicros_; } /** * <pre> * Output only. The total amount, in micros. This equals the sum of * Invoice.subtotal_amount_micros and Invoice.tax_amount_micros. * Starting with v6, Invoice.regulatory_costs_subtotal_amount_micros is * also added as it is no longer already included in * Invoice.tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 35 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The totalAmountMicros to set. * @return This builder for chaining. */ public Builder setTotalAmountMicros(long value) { bitField0_ |= 0x00000200; totalAmountMicros_ = value; onChanged(); return this; } /** * <pre> * Output only. The total amount, in micros. This equals the sum of * Invoice.subtotal_amount_micros and Invoice.tax_amount_micros. * Starting with v6, Invoice.regulatory_costs_subtotal_amount_micros is * also added as it is no longer already included in * Invoice.tax_amount_micros. * </pre> * * <code>optional int64 total_amount_micros = 35 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearTotalAmountMicros() { bitField0_ = (bitField0_ & ~0x00000200); totalAmountMicros_ = 0L; onChanged(); return this; } private java.lang.Object correctedInvoice_ = ""; /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the correctedInvoice field is set. */ public boolean hasCorrectedInvoice() { return ((bitField0_ & 0x00000400) != 0); } /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The correctedInvoice. */ public java.lang.String getCorrectedInvoice() { java.lang.Object ref = correctedInvoice_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); correctedInvoice_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for correctedInvoice. */ public com.google.protobuf.ByteString getCorrectedInvoiceBytes() { java.lang.Object ref = correctedInvoice_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); correctedInvoice_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The correctedInvoice to set. * @return This builder for chaining. */ public Builder setCorrectedInvoice( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000400; correctedInvoice_ = value; onChanged(); return this; } /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearCorrectedInvoice() { bitField0_ = (bitField0_ & ~0x00000400); correctedInvoice_ = getDefaultInstance().getCorrectedInvoice(); onChanged(); return this; } /** * <pre> * Output only. The resource name of the original invoice corrected, wrote off, or canceled * by this invoice, if applicable. If `corrected_invoice` is set, * `replaced_invoices` will not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>optional string corrected_invoice = 36 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for correctedInvoice to set. * @return This builder for chaining. */ public Builder setCorrectedInvoiceBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000400; correctedInvoice_ = value; onChanged(); return this; } private com.google.protobuf.LazyStringList replacedInvoices_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureReplacedInvoicesIsMutable() { if (!((bitField0_ & 0x00000800) != 0)) { replacedInvoices_ = new com.google.protobuf.LazyStringArrayList(replacedInvoices_); bitField0_ |= 0x00000800; } } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return A list containing the replacedInvoices. */ public com.google.protobuf.ProtocolStringList getReplacedInvoicesList() { return replacedInvoices_.getUnmodifiableView(); } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The count of replacedInvoices. */ public int getReplacedInvoicesCount() { return replacedInvoices_.size(); } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param index The index of the element to return. * @return The replacedInvoices at the given index. */ public java.lang.String getReplacedInvoices(int index) { return replacedInvoices_.get(index); } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param index The index of the value to return. * @return The bytes of the replacedInvoices at the given index. */ public com.google.protobuf.ByteString getReplacedInvoicesBytes(int index) { return replacedInvoices_.getByteString(index); } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param index The index to set the value at. * @param value The replacedInvoices to set. * @return This builder for chaining. */ public Builder setReplacedInvoices( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureReplacedInvoicesIsMutable(); replacedInvoices_.set(index, value); onChanged(); return this; } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The replacedInvoices to add. * @return This builder for chaining. */ public Builder addReplacedInvoices( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureReplacedInvoicesIsMutable(); replacedInvoices_.add(value); onChanged(); return this; } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param values The replacedInvoices to add. * @return This builder for chaining. */ public Builder addAllReplacedInvoices( java.lang.Iterable<java.lang.String> values) { ensureReplacedInvoicesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, replacedInvoices_); onChanged(); return this; } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearReplacedInvoices() { replacedInvoices_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000800); onChanged(); return this; } /** * <pre> * Output only. The resource name of the original invoice(s) being rebilled or replaced by * this invoice, if applicable. There might be multiple replaced invoices due * to invoice consolidation. The replaced invoices may not belong to the same * payments account. If `replaced_invoices` is set, `corrected_invoice` will * not be set. * Invoice resource names have the form: * `customers/{customer_id}/invoices/{invoice_id}` * </pre> * * <code>repeated string replaced_invoices = 37 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes of the replacedInvoices to add. * @return This builder for chaining. */ public Builder addReplacedInvoicesBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); ensureReplacedInvoicesIsMutable(); replacedInvoices_.add(value); onChanged(); return this; } private java.lang.Object pdfUrl_ = ""; /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the pdfUrl field is set. */ public boolean hasPdfUrl() { return ((bitField0_ & 0x00001000) != 0); } /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The pdfUrl. */ public java.lang.String getPdfUrl() { java.lang.Object ref = pdfUrl_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); pdfUrl_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The bytes for pdfUrl. */ public com.google.protobuf.ByteString getPdfUrlBytes() { java.lang.Object ref = pdfUrl_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); pdfUrl_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The pdfUrl to set. * @return This builder for chaining. */ public Builder setPdfUrl( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00001000; pdfUrl_ = value; onChanged(); return this; } /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return This builder for chaining. */ public Builder clearPdfUrl() { bitField0_ = (bitField0_ & ~0x00001000); pdfUrl_ = getDefaultInstance().getPdfUrl(); onChanged(); return this; } /** * <pre> * Output only. The URL to a PDF copy of the invoice. Users need to pass in their OAuth * token to request the PDF with this URL. * </pre> * * <code>optional string pdf_url = 38 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @param value The bytes for pdfUrl to set. * @return This builder for chaining. */ public Builder setPdfUrlBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00001000; pdfUrl_ = value; onChanged(); return this; } private java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary> accountBudgetSummaries_ = java.util.Collections.emptyList(); private void ensureAccountBudgetSummariesIsMutable() { if (!((bitField0_ & 0x00002000) != 0)) { accountBudgetSummaries_ = new java.util.ArrayList<com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary>(accountBudgetSummaries_); bitField0_ |= 0x00002000; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder> accountBudgetSummariesBuilder_; /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary> getAccountBudgetSummariesList() { if (accountBudgetSummariesBuilder_ == null) { return java.util.Collections.unmodifiableList(accountBudgetSummaries_); } else { return accountBudgetSummariesBuilder_.getMessageList(); } } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public int getAccountBudgetSummariesCount() { if (accountBudgetSummariesBuilder_ == null) { return accountBudgetSummaries_.size(); } else { return accountBudgetSummariesBuilder_.getCount(); } } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary getAccountBudgetSummaries(int index) { if (accountBudgetSummariesBuilder_ == null) { return accountBudgetSummaries_.get(index); } else { return accountBudgetSummariesBuilder_.getMessage(index); } } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setAccountBudgetSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary value) { if (accountBudgetSummariesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.set(index, value); onChanged(); } else { accountBudgetSummariesBuilder_.setMessage(index, value); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setAccountBudgetSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder builderForValue) { if (accountBudgetSummariesBuilder_ == null) { ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.set(index, builderForValue.build()); onChanged(); } else { accountBudgetSummariesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountBudgetSummaries(com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary value) { if (accountBudgetSummariesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.add(value); onChanged(); } else { accountBudgetSummariesBuilder_.addMessage(value); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountBudgetSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary value) { if (accountBudgetSummariesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.add(index, value); onChanged(); } else { accountBudgetSummariesBuilder_.addMessage(index, value); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountBudgetSummaries( com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder builderForValue) { if (accountBudgetSummariesBuilder_ == null) { ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.add(builderForValue.build()); onChanged(); } else { accountBudgetSummariesBuilder_.addMessage(builderForValue.build()); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountBudgetSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder builderForValue) { if (accountBudgetSummariesBuilder_ == null) { ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.add(index, builderForValue.build()); onChanged(); } else { accountBudgetSummariesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAllAccountBudgetSummaries( java.lang.Iterable<? extends com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary> values) { if (accountBudgetSummariesBuilder_ == null) { ensureAccountBudgetSummariesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, accountBudgetSummaries_); onChanged(); } else { accountBudgetSummariesBuilder_.addAllMessages(values); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder clearAccountBudgetSummaries() { if (accountBudgetSummariesBuilder_ == null) { accountBudgetSummaries_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00002000); onChanged(); } else { accountBudgetSummariesBuilder_.clear(); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder removeAccountBudgetSummaries(int index) { if (accountBudgetSummariesBuilder_ == null) { ensureAccountBudgetSummariesIsMutable(); accountBudgetSummaries_.remove(index); onChanged(); } else { accountBudgetSummariesBuilder_.remove(index); } return this; } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder getAccountBudgetSummariesBuilder( int index) { return getAccountBudgetSummariesFieldBuilder().getBuilder(index); } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder getAccountBudgetSummariesOrBuilder( int index) { if (accountBudgetSummariesBuilder_ == null) { return accountBudgetSummaries_.get(index); } else { return accountBudgetSummariesBuilder_.getMessageOrBuilder(index); } } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public java.util.List<? extends com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder> getAccountBudgetSummariesOrBuilderList() { if (accountBudgetSummariesBuilder_ != null) { return accountBudgetSummariesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(accountBudgetSummaries_); } } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder addAccountBudgetSummariesBuilder() { return getAccountBudgetSummariesFieldBuilder().addBuilder( com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.getDefaultInstance()); } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder addAccountBudgetSummariesBuilder( int index) { return getAccountBudgetSummariesFieldBuilder().addBuilder( index, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.getDefaultInstance()); } /** * <pre> * Output only. The list of summarized account budget information associated with this * invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary account_budget_summaries = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder> getAccountBudgetSummariesBuilderList() { return getAccountBudgetSummariesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder> getAccountBudgetSummariesFieldBuilder() { if (accountBudgetSummariesBuilder_ == null) { accountBudgetSummariesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummary.Builder, com.google.ads.googleads.v12.resources.Invoice.AccountBudgetSummaryOrBuilder>( accountBudgetSummaries_, ((bitField0_ & 0x00002000) != 0), getParentForChildren(), isClean()); accountBudgetSummaries_ = null; } return accountBudgetSummariesBuilder_; } private java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountSummary> accountSummaries_ = java.util.Collections.emptyList(); private void ensureAccountSummariesIsMutable() { if (!((bitField0_ & 0x00004000) != 0)) { accountSummaries_ = new java.util.ArrayList<com.google.ads.googleads.v12.resources.Invoice.AccountSummary>(accountSummaries_); bitField0_ |= 0x00004000; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v12.resources.Invoice.AccountSummary, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder, com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder> accountSummariesBuilder_; /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountSummary> getAccountSummariesList() { if (accountSummariesBuilder_ == null) { return java.util.Collections.unmodifiableList(accountSummaries_); } else { return accountSummariesBuilder_.getMessageList(); } } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public int getAccountSummariesCount() { if (accountSummariesBuilder_ == null) { return accountSummaries_.size(); } else { return accountSummariesBuilder_.getCount(); } } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountSummary getAccountSummaries(int index) { if (accountSummariesBuilder_ == null) { return accountSummaries_.get(index); } else { return accountSummariesBuilder_.getMessage(index); } } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setAccountSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountSummary value) { if (accountSummariesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAccountSummariesIsMutable(); accountSummaries_.set(index, value); onChanged(); } else { accountSummariesBuilder_.setMessage(index, value); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder setAccountSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder builderForValue) { if (accountSummariesBuilder_ == null) { ensureAccountSummariesIsMutable(); accountSummaries_.set(index, builderForValue.build()); onChanged(); } else { accountSummariesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountSummaries(com.google.ads.googleads.v12.resources.Invoice.AccountSummary value) { if (accountSummariesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAccountSummariesIsMutable(); accountSummaries_.add(value); onChanged(); } else { accountSummariesBuilder_.addMessage(value); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountSummary value) { if (accountSummariesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAccountSummariesIsMutable(); accountSummaries_.add(index, value); onChanged(); } else { accountSummariesBuilder_.addMessage(index, value); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountSummaries( com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder builderForValue) { if (accountSummariesBuilder_ == null) { ensureAccountSummariesIsMutable(); accountSummaries_.add(builderForValue.build()); onChanged(); } else { accountSummariesBuilder_.addMessage(builderForValue.build()); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAccountSummaries( int index, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder builderForValue) { if (accountSummariesBuilder_ == null) { ensureAccountSummariesIsMutable(); accountSummaries_.add(index, builderForValue.build()); onChanged(); } else { accountSummariesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder addAllAccountSummaries( java.lang.Iterable<? extends com.google.ads.googleads.v12.resources.Invoice.AccountSummary> values) { if (accountSummariesBuilder_ == null) { ensureAccountSummariesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, accountSummaries_); onChanged(); } else { accountSummariesBuilder_.addAllMessages(values); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder clearAccountSummaries() { if (accountSummariesBuilder_ == null) { accountSummaries_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00004000); onChanged(); } else { accountSummariesBuilder_.clear(); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public Builder removeAccountSummaries(int index) { if (accountSummariesBuilder_ == null) { ensureAccountSummariesIsMutable(); accountSummaries_.remove(index); onChanged(); } else { accountSummariesBuilder_.remove(index); } return this; } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder getAccountSummariesBuilder( int index) { return getAccountSummariesFieldBuilder().getBuilder(index); } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder getAccountSummariesOrBuilder( int index) { if (accountSummariesBuilder_ == null) { return accountSummaries_.get(index); } else { return accountSummariesBuilder_.getMessageOrBuilder(index); } } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public java.util.List<? extends com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder> getAccountSummariesOrBuilderList() { if (accountSummariesBuilder_ != null) { return accountSummariesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(accountSummaries_); } } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder addAccountSummariesBuilder() { return getAccountSummariesFieldBuilder().addBuilder( com.google.ads.googleads.v12.resources.Invoice.AccountSummary.getDefaultInstance()); } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder addAccountSummariesBuilder( int index) { return getAccountSummariesFieldBuilder().addBuilder( index, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.getDefaultInstance()); } /** * <pre> * Output only. The list of summarized account information associated with this invoice. * </pre> * * <code>repeated .google.ads.googleads.v12.resources.Invoice.AccountSummary account_summaries = 39 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ public java.util.List<com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder> getAccountSummariesBuilderList() { return getAccountSummariesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v12.resources.Invoice.AccountSummary, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder, com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder> getAccountSummariesFieldBuilder() { if (accountSummariesBuilder_ == null) { accountSummariesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v12.resources.Invoice.AccountSummary, com.google.ads.googleads.v12.resources.Invoice.AccountSummary.Builder, com.google.ads.googleads.v12.resources.Invoice.AccountSummaryOrBuilder>( accountSummaries_, ((bitField0_ & 0x00004000) != 0), getParentForChildren(), isClean()); accountSummaries_ = null; } return accountSummariesBuilder_; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.ads.googleads.v12.resources.Invoice) } // @@protoc_insertion_point(class_scope:google.ads.googleads.v12.resources.Invoice) private static final com.google.ads.googleads.v12.resources.Invoice DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.ads.googleads.v12.resources.Invoice(); } public static com.google.ads.googleads.v12.resources.Invoice getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<Invoice> PARSER = new com.google.protobuf.AbstractParser<Invoice>() { @java.lang.Override public Invoice parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { Builder builder = newBuilder(); try { builder.mergeFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(builder.buildPartial()); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(builder.buildPartial()); } return builder.buildPartial(); } }; public static com.google.protobuf.Parser<Invoice> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<Invoice> getParserForType() { return PARSER; } @java.lang.Override public com.google.ads.googleads.v12.resources.Invoice getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
{ "content_hash": "cfbc89ff4fe24b17442d028879a67914", "timestamp": "", "source": "github", "line_count": 10581, "max_line_length": 263, "avg_line_length": 38.14280313769965, "alnum_prop": 0.6380352289086174, "repo_name": "googleads/google-ads-java", "id": "9071b6fd3f3fcbebf1ddf32f5f11faf7ac86e7ef", "size": "403589", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "google-ads-stubs-v12/src/main/java/com/google/ads/googleads/v12/resources/Invoice.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "28701198" } ], "symlink_target": "" }