identifier
stringlengths
42
383
collection
stringclasses
1 value
open_type
stringclasses
1 value
license
stringlengths
0
1.81k
date
float64
1.99k
2.02k
title
stringlengths
0
100
creator
stringlengths
1
39
language
stringclasses
157 values
language_type
stringclasses
2 values
word_count
int64
1
20k
token_count
int64
4
1.32M
text
stringlengths
5
1.53M
__index_level_0__
int64
0
57.5k
https://github.com/WhiteGrouse/Walker/blob/master/Demangler/Program2.cs
Github Open Source
Open Source
MIT
2,022
Walker
WhiteGrouse
C#
Code
1,575
5,307
using Irony.Parsing; using System; namespace Demangler { class Program { static void Main(string[] args) { var grammar = new ManglingGrammar(); var parser = new Parser(grammar); var tree = parser.Parse("_Z1f2ab"); Console.WriteLine(); } } [Language("ManglingGrammar")] class ManglingGrammar : Grammar { public ManglingGrammar() : base(true) { var NumberL = new NumberLiteral("number", NumberOptions.IntOnly | NumberOptions.AllowLetterAfter); var SourceNameL = new StringWithLengthLiteral("source-name"); var MangledName = new NonTerminal("mangled-name"); var Encoding = new NonTerminal("encoding"); var BareFunctionType = new NonTerminal("bare-function-type"); var SpecialName = new NonTerminal("special-name"); var Name = new NonTerminal("name"); var NestedName = new NonTerminal("nested-name"); var UnscopedName = new NonTerminal("unscoped-name"); var UnscopedTemplateName = new NonTerminal("unscoped-template-name"); var TemplateArgs = new NonTerminal("template-args"); var LocalName = new NonTerminal("local-name"); var UnqualifiedName = new NonTerminal("unqualified-name"); var Substitution = new NonTerminal("substitution"); var CVQualifiers = new NonTerminal("CV-qualifiers"); var RefQualifier = new NonTerminal("ref-qualifier"); var Prefix = new NonTerminal("prefix"); var TemplatePrefix = new NonTerminal("template-prefix"); var TemplateParam = new NonTerminal("template-param"); var Decltype = new NonTerminal("decltype"); var DataMemberPrefix = new NonTerminal("data-member-prefix"); var OperatorName = new NonTerminal("operator-name"); var AbiTags = new NonTerminal("abi-tags"); var CtorDtorName = new NonTerminal("ctor-dtor-name"); var UnnamedTypeName = new NonTerminal("unnamed-type-name"); var AbiTag = new NonTerminal("abi-tag"); var SeqId = new RegexBasedTerminal("seq-id", "[0-9A-Z]+"); var Type = new NonTerminal("type"); var CallOffset = new NonTerminal("call-offset"); var NVOffset = new NonTerminal("nv-offet"); var VOffset = new NonTerminal("v-offset"); var BuiltinType = new NonTerminal("builtin-type"); var QualifiedType = new NonTerminal("qualified-type"); var FunctionType = new NonTerminal("function-type"); var ClassEnumType = new NonTerminal("class-enum-type"); var ArrayType = new NonTerminal("array-type"); var PointerToMemberType = new NonTerminal("pointer-to-member-type"); var TemplateTemplateParam = new NonTerminal("template-template-param"); var Qualifiers = new NonTerminal("qualifiers"); var ExtendedQualifier = new NonTerminal("extended-qualifier"); var ExceptionSpec = new NonTerminal("exception-spec"); var Expression = new NonTerminal("expression"); var TemplateArg = new NonTerminal("template-arg"); var ExprPrimary = new NonTerminal("expr-primary"); var BracedExpression = new NonTerminal("braced-expression"); var Initializer = new NonTerminal("initializer"); var FunctionParam = new NonTerminal("function-param"); var UnresolvedName = new NonTerminal("unresolved-name"); var BaseUnresolvedName = new NonTerminal("base-unresolved-name"); var UnresolvedType = new NonTerminal("unresolved-type"); var UnresolvedQualifierLevel = new NonTerminal("unresolved-qualifier-level"); var SimpleId = new NonTerminal("simple-id"); var DestructorName = new NonTerminal("destructor-name"); var Float = new NumberLiteral("float", NumberOptions.AllowLetterAfter); var Discriminator = new NonTerminal("discriminator"); var ClosureTypeName = new NonTerminal("closure-type-name"); var LambdaSig = new NonTerminal("lambda-sig"); var SourceNameList = new NonTerminal("source-name_plus"); SourceNameList.Rule = MakePlusRule(SourceNameList, SourceNameL); var ExtendedQualifierList = new NonTerminal("extended-qualifier_star"); ExtendedQualifierList.Rule = MakeStarRule(ExtendedQualifierList, ExtendedQualifier); var TypeList = new NonTerminal("type_plus"); TypeList.Rule = MakePlusRule(TypeList, Type); var TemplateArgPlusList = new NonTerminal("template-arg_plus"); TemplateArgPlusList.Rule = MakePlusRule(TemplateArgPlusList, TemplateArg); var TemplateArgStarList = new NonTerminal("template-arg_star"); TemplateArgStarList.Rule = MakeStarRule(TemplateArgStarList, TemplateArg); var ExpressionPlusList = new NonTerminal("expression_plus"); ExpressionPlusList.Rule = MakePlusRule(ExpressionPlusList, Expression); var ExpressionStarList = new NonTerminal("expression_star"); ExpressionStarList.Rule = MakeStarRule(ExpressionStarList, Expression); var BracedExpressionList = new NonTerminal("braced-expression_star"); BracedExpressionList.Rule = MakeStarRule(BracedExpressionList, BracedExpression); var UnresolvedQualifierLevelList = new NonTerminal("unresolved-qualifier-level_plus"); UnresolvedQualifierLevelList.Rule = MakePlusRule(UnresolvedQualifierLevelList, UnresolvedQualifierLevel); Name.Rule = NestedName | UnscopedName | (UnscopedTemplateName + TemplateArgs) | LocalName; UnscopedName.Rule = UnqualifiedName | (ToTerm("St") + UnqualifiedName); UnscopedTemplateName.Rule = UnscopedName | Substitution; NestedName.Rule = (ToTerm("N") + CVQualifiers.Q() + RefQualifier.Q() + Prefix + UnqualifiedName + ToTerm("E")) | (ToTerm("N") + CVQualifiers.Q() + RefQualifier.Q() + TemplatePrefix + TemplateArgs + ToTerm("E")); Prefix.Rule = UnqualifiedName | (Prefix + UnqualifiedName) | (TemplatePrefix + TemplateArgs) | TemplateParam | Decltype | (Prefix + DataMemberPrefix) | Substitution; TemplatePrefix.Rule = UnqualifiedName | (Prefix + UnqualifiedName) | TemplateParam | Substitution; UnqualifiedName.Rule = (OperatorName + AbiTags.Q()) | CtorDtorName | SourceNameL | UnnamedTypeName | (ToTerm("DC") + SourceNameList + ToTerm("E")); AbiTags.Rule = MakeStarRule(AbiTags, AbiTag); AbiTag.Rule = ToTerm("B") + SourceNameL; OperatorName.Rule = ToTerm("nw") | ToTerm("na") | ToTerm("dl") | ToTerm("da") | ToTerm("ps") | ToTerm("ng") | ToTerm("ad") | ToTerm("de") | ToTerm("co") | ToTerm("pl") | ToTerm("mi") | ToTerm("ml") | ToTerm("dv") | ToTerm("rm") | ToTerm("an") | ToTerm("or") | ToTerm("eo") | ToTerm("aS") | ToTerm("pL") | ToTerm("mI") | ToTerm("mL") | ToTerm("dV") | ToTerm("rM") | ToTerm("aN") | ToTerm("oR") | ToTerm("eO") | ToTerm("ls") | ToTerm("rs") | ToTerm("lS") | ToTerm("rS") | ToTerm("eq") | ToTerm("ne") | ToTerm("lt") | ToTerm("gt") | ToTerm("le") | ToTerm("ge") | ToTerm("ss") | ToTerm("nt") | ToTerm("aa") | ToTerm("oo") | ToTerm("pp") | ToTerm("mm") | ToTerm("cm") | ToTerm("pm") | ToTerm("pt") | ToTerm("cl") | ToTerm("ix") | ToTerm("qu") | (ToTerm("cv") + Type) | (ToTerm("li") + SourceNameL) | (ToTerm("v") + (ToTerm("0") | ToTerm("1") | ToTerm("2") | ToTerm("3") | ToTerm("4") | ToTerm("5") | ToTerm("6") | ToTerm("7") | ToTerm("8") | ToTerm("9")) + SourceNameL); CallOffset.Rule = (ToTerm("h") + NVOffset + ToTerm("_")) | (ToTerm("v") + VOffset + ToTerm("_")); NVOffset.Rule = NumberL; VOffset.Rule = NumberL; CtorDtorName.Rule = ToTerm("C1") | ToTerm("C2") | ToTerm("C3") | ToTerm("D0") | ToTerm("D1") | ToTerm("D2"); Type.Rule = BuiltinType | QualifiedType | FunctionType | ClassEnumType | ArrayType | PointerToMemberType | TemplateParam | (TemplateTemplateParam + TemplateArgs) | Decltype | (ToTerm("P") + Type) | (ToTerm("R") + Type) | (ToTerm("O") + Type) | (ToTerm("C") + Type) | (ToTerm("G") + Type) | Substitution | (ToTerm("Dp") + Type); QualifiedType.Rule = Qualifiers + Type; Qualifiers.Rule = ExtendedQualifierList + CVQualifiers; ExtendedQualifier.Rule = ToTerm("U") + SourceNameL + TemplateArgs.Q(); CVQualifiers.Rule = ToTerm("r").Q() + ToTerm("V").Q() + ToTerm("K").Q(); RefQualifier.Rule = ToTerm("R") | ToTerm("O"); BuiltinType.Rule = ToTerm("v") | ToTerm("w") | ToTerm("b") | ToTerm("c") | ToTerm("a") | ToTerm("h") | ToTerm("s") | ToTerm("t") | ToTerm("i") | ToTerm("j") | ToTerm("l") | ToTerm("m") | ToTerm("x") | ToTerm("y") | ToTerm("n") | ToTerm("o") | ToTerm("f") | ToTerm("d") | ToTerm("e") | ToTerm("g") | ToTerm("z") | ToTerm("Dd") | ToTerm("De") | ToTerm("Df") | ToTerm("Dh") | (ToTerm("DF") + NumberL + ToTerm("_")) | ToTerm("Di") | ToTerm("Ds") | ToTerm("Da") | ToTerm("Dc") | ToTerm("Dn") | (ToTerm("u") + SourceNameL); FunctionType.Rule = CVQualifiers.Q() + ExceptionSpec.Q() + ToTerm("Dx").Q() + ToTerm("F") + ToTerm("Y").Q() + BareFunctionType + RefQualifier.Q() + ToTerm("E"); BareFunctionType.Rule = TypeList; ExceptionSpec.Rule = ToTerm("Do") | (ToTerm("DO") + Expression + ToTerm("E")) | (ToTerm("Dw") + TypeList + ToTerm("E")); Decltype.Rule = (ToTerm("Dt") + Expression + ToTerm("E")) | (ToTerm("DT") + Expression + ToTerm("E")); ClassEnumType.Rule = Name | (ToTerm("Ts") + Name) | (ToTerm("Tu") + Name) | (ToTerm("Te") + Name); UnnamedTypeName.Rule = (ToTerm("Ut") + NumberL.Q() + ToTerm("_")) | ClosureTypeName; ArrayType.Rule = (ToTerm("A") + NumberL + ToTerm("_") + Type) | (ToTerm("A") + Expression.Q() + ToTerm("_") + Type); PointerToMemberType.Rule = ToTerm("M") + Type + Type; TemplateParam.Rule = ToTerm("T") + NumberL.Q() + ToTerm("_"); TemplateTemplateParam.Rule = TemplateParam | Substitution; FunctionParam.Rule = (ToTerm("fp") + CVQualifiers + ToTerm("_")) | (ToTerm("fp") + CVQualifiers + NumberL + ToTerm("_")) | (ToTerm("fL") + NumberL + ToTerm("p") + CVQualifiers + ToTerm("_")) | (ToTerm("fL") + NumberL + ToTerm("p") + CVQualifiers + NumberL + ToTerm("_")); TemplateArgs.Rule = ToTerm("I") + TemplateArgPlusList + ToTerm("E"); TemplateArg.Rule = Type | (ToTerm("X") + Expression + ToTerm("E")) | ExprPrimary | (ToTerm("J") + TemplateArgStarList + ToTerm("E")); Expression.Rule = (OperatorName + Expression) | (OperatorName + Expression + Expression) | (OperatorName + Expression + Expression + Expression) | (ToTerm("pp_") + Expression) | (ToTerm("mm_") + Expression) | (ToTerm("cl") + ExpressionPlusList + ToTerm("E")) | (ToTerm("cv") + Type + Expression) | (ToTerm("cv") + Type + ToTerm("_") + ExpressionStarList + ToTerm("E")) | (ToTerm("tl") + Type + BracedExpressionList + ToTerm("E")) | (ToTerm("il") + BracedExpressionList + ToTerm("E")) | (ToTerm("gs").Q() + ToTerm("nw") + ExpressionStarList + ToTerm("_") + Type + (ToTerm("E") | Initializer)) | (ToTerm("gs").Q() + ToTerm("na") + ExpressionStarList + ToTerm("_") + Type + (ToTerm("E") | Initializer)) | (ToTerm("gs").Q() + ToTerm("dl") + Expression) | (ToTerm("gs").Q() + ToTerm("da") + Expression) | (ToTerm("dc") + Type + Expression) | (ToTerm("sc") + Type + Expression) | (ToTerm("cc") + Type + Expression) | (ToTerm("rc") + Type + Expression) | (ToTerm("ti") + Type) | (ToTerm("te") + Expression) | (ToTerm("st") + Type) | (ToTerm("sz") + Expression) | (ToTerm("at") + Type) | (ToTerm("az") + Expression) | (ToTerm("nx") + Expression) | TemplateParam | FunctionParam | (ToTerm("dt") + Expression + UnresolvedName) | (ToTerm("pt") + Expression + UnresolvedName) | (ToTerm("ds") + Expression + Expression) | (ToTerm("sZ") + TemplateParam) | (ToTerm("sP") + TemplateArgStarList + ToTerm("E")) | (ToTerm("sp") + Expression) | (ToTerm("tw") + Expression) | ToTerm("tr") | UnresolvedName | ExprPrimary; UnresolvedName.Rule = (ToTerm("gs").Q() + BaseUnresolvedName) | (ToTerm("sr") + UnresolvedType + BaseUnresolvedName) | (ToTerm("srN") + UnresolvedType + UnresolvedQualifierLevelList + ToTerm("E") + BaseUnresolvedName) | (ToTerm("gs").Q() + ToTerm("sr") + UnresolvedQualifierLevelList + ToTerm("E") + BaseUnresolvedName); UnresolvedType.Rule = (TemplateParam + TemplateArgs.Q()) | Decltype | Substitution; UnresolvedQualifierLevel.Rule = SimpleId; SimpleId.Rule = SourceNameL + TemplateArgs.Q(); BaseUnresolvedName.Rule = SimpleId | (ToTerm("on") + OperatorName + TemplateArgs.Q()) | (ToTerm("dn") + DestructorName); DestructorName.Rule = UnresolvedType | SimpleId; ExprPrimary.Rule = (ToTerm("L") + Type + NumberL + ToTerm("E")) | (ToTerm("L") + Type + Float + ToTerm("E")) | (ToTerm("L") + Type + ToTerm("E")) | (ToTerm("L") + Type + ToTerm("0E")) | (ToTerm("L") + Type + Float + ToTerm("_") + Float + ToTerm("E")) | (ToTerm("L") + MangledName + ToTerm("E")); BracedExpression.Rule = Expression | (ToTerm("di") + SourceNameL + BracedExpression) | (ToTerm("dx") + Expression + BracedExpression) | (ToTerm("dX") + Expression + Expression + BracedExpression); Initializer.Rule = ToTerm("pi") + ExpressionStarList + ToTerm("E"); LocalName.Rule = (ToTerm("Z") + Encoding + ToTerm("E") + Name + Discriminator.Q()) | (ToTerm("Z") + Encoding + ToTerm("Es") + Discriminator.Q()) | (ToTerm("Z") + Encoding + ToTerm("Ed") + NumberL.Q() + ToTerm("_") + Name); Discriminator.Rule = (ToTerm("_") + NumberL) | (ToTerm("__") + NumberL + ToTerm("_")); ClosureTypeName.Rule = ToTerm("Ul") + LambdaSig + ToTerm("E") + NumberL.Q() + ToTerm("_"); LambdaSig.Rule = TypeList; DataMemberPrefix.Rule = SourceNameL + TemplateArg.Q() + ToTerm("M"); Substitution.Rule = (ToTerm("S") + SeqId.Q() + ToTerm("_")) | (ToTerm("St") + UnqualifiedName.Q()) | ToTerm("Sa") | ToTerm("Sb") | ToTerm("Ss") | ToTerm("Si") | ToTerm("So") | ToTerm("Sd"); SpecialName.Rule = (ToTerm("TV") + Type) | (ToTerm("TT") + Type) | (ToTerm("TI") + Type) | (ToTerm("TS") + Type) | (ToTerm("T") + CallOffset + Encoding) | (ToTerm("Tc") + CallOffset + Encoding) | (ToTerm("GV") + Name) | (ToTerm("GR") + Name + SeqId.Q() + ToTerm("_")); Encoding.Rule = (Name + BareFunctionType) | Name | SourceNameL; MangledName.Rule = ToTerm("_Z") + Encoding; Root = MangledName; } } class StringWithLengthLiteral : Terminal { public StringWithLengthLiteral(string name) : base(name) { } public override Token TryMatch(ParsingContext context, ISourceStream source) { int? length_ = GetLength(source); if (length_ == null) return context.CreateErrorToken("invalid StringWithLengthLiteral"); int length = length_.GetValueOrDefault(); source.Position = source.PreviewPosition; source.PreviewPosition += length; string str = source.Text.Substring(source.Location.Position, length); return source.CreateToken(this.OutputTerminal); } private int? GetLength(ISourceStream source) { int length = 0; for (; !source.EOF() && char.IsDigit(source.PreviewChar); ++source.PreviewPosition) length = length * 10 + int.Parse(source.PreviewChar.ToString()); if (length == 0 || source.PreviewPosition + length > source.Text.Length) return null; return length; } } }
10,432
https://github.com/RenCloud/geeks-diary/blob/master/src/browser/ui/datetime/calendar-table.spec.ts
Github Open Source
Open Source
MIT
2,022
geeks-diary
RenCloud
TypeScript
Code
354
816
import { datetime } from '../../../libs/datetime'; import { CalendarTable } from './calendar-table'; describe('browser.ui.datetime.CalendarTable', () => { let calendar: CalendarTable; /** Validates if calendar rendered well. */ function validateCalendar(table: (string | number)[][]): void { const errors = []; for (let i = 0; i < table.length; i++) { for (let j = 0; j < table[i].length; j++) { const cell = calendar.rows[i].cells[j]; const value = table[i][j]; if (value === 'b' && !cell.isBlank()) { errors.push(`[${i}][${j}] Not b cell.`); } if (typeof value === 'number') { const date = calendar.currentMonth; date.setDate(value); if (!datetime.isSameDay(date, cell.date)) { errors.push(`[${i}][${j}] Date not matched.`); } } } } if (errors.length > 0) { throw new Error(errors.join(', ')); } } beforeEach(() => { calendar = new CalendarTable(); }); it('should render date cells correctly at July, 2018.', () => { /** * Calendar for 2018 July. * (x = blank) * * S M T W T F S * 1 2 3 4 5 6 7 * 8 9 10 11 12 13 14 * 15 16 17 18 19 20 21 * 22 23 24 25 26 27 28 * 29 30 31 x x x x */ const table = [ [1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14], [15, 16, 17, 18, 19, 20, 21], [22, 23, 24, 25, 26, 27, 28], [29, 30, 31, 'b', 'b', 'b', 'b'], ]; calendar.render(2018, 7 - 1); validateCalendar(table); }); it('should render date cells correctly at June, 2018.', () => { /** * Calendar for 2018 June. * (x = blank) * * S M T W T F S * x x x x x 1 2 * 3 4 5 6 7 8 9 * 10 11 12 13 14 15 16 * 17 18 19 20 21 22 23 * 24 25 26 27 28 29 30 */ const table = [ ['b', 'b', 'b', 'b', 'b', 1, 2], [3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16], [17, 18, 19, 20, 21, 22, 23], [24, 25, 26, 27, 28, 29, 30], ]; calendar.render(2018, 6 - 1); validateCalendar(table); }); });
37,945
https://github.com/unrefan/goods-board/blob/master/src/middlewares/errors.js
Github Open Source
Open Source
MIT
null
goods-board
unrefan
JavaScript
Code
94
273
import ValidationError from '../exceptions/ValidationError.js'; import multer from 'multer'; export const multerError = (err, req, res, next) => { if (err instanceof multer.MulterError) { return res.status(400).json({ error: { code: err.code, message: err.message, }, }); } next(err); }; export const validationError = (err, req, res, next) => { if (err instanceof ValidationError) { return res.status(422).json(Object.entries(err.payload.errors).map(([field, messages]) => ({ field: field, message: messages[0], }))); } next(err); }; export const internalError = (err, req, res, next) => { console.error(err); // todo logger res.status(err.status || 500).json({ error: { code: err.status || err.code || 500, message: err.message, }, }); };
42,160
https://github.com/nagasrisai/food-Devilery--App/blob/master/client/src/components/pages/Home.vue
Github Open Source
Open Source
MIT
2,021
food-Devilery--App
nagasrisai
Vue
Code
129
468
<template> <div> <div class="conatiner home-conatiner"> <div class="sr-only" id="navbar__header">For Go to Top</div> <app-file-loader /> <app-product-modal /> <app-navbar /> <router-view /> </div> <app-footer /> </div> </template> <script> import ProductModal from '../layouts/ProductModal'; import Navbar from '../layouts/Navbar'; import FileLoader from '../utils/BackDrop'; import Footer from '../layouts/Footer'; export default { name: 'Home', components: { 'app-navbar': Navbar, 'app-product-modal': ProductModal, 'app-file-loader': FileLoader, 'app-footer': Footer, }, }; </script> <style> .home-conatiner { margin-bottom: 6rem; } /* Star Rating System */ .stars-inner { position: absolute; top: 0; left: 0; white-space: nowrap; overflow: hidden; } .stars-outer { position: relative; display: inline-block; } .stars-outer::before { content: '\f005 \f005 \f005 \f005 \f005'; font-family: 'Font Awesome 5 Free' !important; font-weight: 900; color: #ccc; } .stars-inner::before { content: '\f005 \f005 \f005 \f005 \f005'; font-family: 'Font Awesome 5 Free' !important; font-weight: 900; color: #f8ce0b; } </style>
46,480
https://github.com/BrunoNicolasPadin/gescol-virtual/blob/master/resources/js/Pages/Paneles/Roles.vue
Github Open Source
Open Source
MIT
2,021
gescol-virtual
BrunoNicolasPadin
Vue
Code
427
1,965
<template> <app-layout title="Panel - Roles"> <template #header> <h2 class="font-semibold text-xl text-gray-800 leading-tight"> Panel / Roles </h2> </template> <div class="py-12"> <div class="max-w-7xl mx-auto sm:px-6 md:px-8"> <div class="h-screen grid grid-cols-6 rounded-sm shadow-md border border-gray-300"> <div class="bg-gray-200 text-center p-2"> <div class="bg-gray-100 rounded-lg shadow-md my-3"> <Link :href="route('cursos.index', institucion.id)" class="hover:underline"> Cursos </Link> </div> <div class="bg-gray-100 rounded-lg shadow-md my-3"> <Link :href="route('panel.mostrarRoles', institucion.id)" class="hover:underline"> Roles </Link> </div> </div> <div class="col-span-5 bg-gray-100 px-2 text-right"> <main class="flex-1 overflow-x-hidden overflow-y-auto"> <div class="container mx-auto px-6"> <titulo-con-boton> <template #titulo> Roles </template> <template #boton> <Link :href="route('roles.create', institucion.id)"> Agregar </Link> </template> </titulo-con-boton> <estructura-tabla class="bg-gray-200 border border-gray-300 h-auto"> <template #head> <th-componente> <template #th-contenido>#</template> </th-componente> <th-componente> <template #th-contenido>Nombre</template> </th-componente> <th-componente> <template #th-contenido>Acciones</template> </th-componente> </template> <template #tr> <tr v-for="(rol, index) in roles" :key="rol.id"> <td-componente> <template #td-contenido>{{ index + 1 }}</template> </td-componente> <td-componente> <template #td-contenido> {{ rol.nombre }} </template> </td-componente> <td-componente> <template #td-contenido> <button @click="desplegarDropdown(rol.id)" class="flex flex-row items-center w-full px-4 py-2 mt-2 text-sm font-semibold text-left bg-transparent rounded-lg dark-mode:bg-transparent dark-mode:focus:text-white dark-mode:hover:text-white dark-mode:focus:bg-gray-600 dark-mode:hover:bg-gray-600 md:w-auto md:inline md:mt-0 md:ml-4 hover:text-gray-900 focus:text-gray-900 hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline"> <span>Acciones</span> <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open == rol.id, 'rotate-0': open != rol.id}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> </button> <div v-show="open == rol.id && abierto == true " class="absolute right-0 w-full mt-2 origin-top-right rounded-md shadow-lg md:w-48"> <div class="px-2 py-2 bg-white rounded-md shadow dark-mode:bg-gray-800"> <Link :href="route('rolPermisos.index', [institucion.id, rol.id])" class="block px-4 py-2 mt-2 text-sm font-semibold bg-transparent rounded-lg md:mt-0 hover:text-gray-900 focus:text-gray-900 hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline"> Permisos </Link> <Link :href="route('roles.edit', [institucion.id, rol.id])" class="block px-4 py-2 mt-2 text-sm font-semibold bg-transparent rounded-lg md:mt-0 hover:text-gray-900 focus:text-gray-900 hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline"> Editar </Link> <div class="block px-4 py-2 mt-2 text-sm font-semibold bg-transparent rounded-lg md:mt-0 hover:text-gray-900 focus:text-gray-900 hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline"> <button @click="destroy(rol)"> Eliminar </button> </div> </div> </div> </template> </td-componente> </tr> </template> </estructura-tabla> </div> </main> </div> </div> </div> </div> </app-layout> </template> <script> import { defineComponent } from 'vue' import AppLayout from '@/Layouts/AppLayout.vue' import EstructuraBuscador from '@/Shared/Paneles/EstructuraBuscador' import Eliminar from '@/Shared/Botones/Eliminar' import TituloConBoton from '@/Shared/Cabecera/TituloConBoton.vue' import { Link } from '@inertiajs/inertia-vue3'; import EstructuraTabla from '@/Shared/Tabla/EstructuraTabla' import TdComponente from '@/Shared/Tabla/Td' import ThComponente from '@/Shared/Tabla/Th' export default defineComponent({ components: { AppLayout, EstructuraBuscador, Eliminar, TituloConBoton, Link, EstructuraTabla, TdComponente, ThComponente, }, props: { institucion: Object, roles: Array, }, data() { return { open: '', abierto: false, } }, methods: { desplegarDropdown(id) { if (this.abierto == false) { this.open = id; this.abierto = true; } else { this.abierto = false; } }, destroy(rol) { if (confirm('¿Estás seguro de que deseas eliminar este rol?')) { this.$inertia.delete(this.route('roles.destroy', [rol.institucion_id, rol.id])); } } }, }) </script>
47,117
https://github.com/justin-espedal/polydes/blob/master/Data Structures Extension/src/com/polydes/datastruct/Prefs.java
Github Open Source
Open Source
MIT
2,021
polydes
justin-espedal
Java
Code
31
93
package com.polydes.datastruct; public class Prefs { public static int DEFPAGE_X; public static int DEFPAGE_Y; public static int DEFPAGE_WIDTH; public static int DEFPAGE_HEIGHT; public static int DEFPAGE_SIDEWIDTH; public static int DEFPAGE_SIDEDL; }
41,712
https://github.com/MikaFima/json-api-behat-extension/blob/master/src/Json/JsonStorageAware.php
Github Open Source
Open Source
MIT
2,015
json-api-behat-extension
MikaFima
PHP
Code
11
44
<?php namespace Rezzza\JsonApiBehatExtension\Json; interface JsonStorageAware { public function setJsonStorage(JsonStorage $jsonStorage); }
8,450
https://github.com/France-ioi/bebras-tasks/blob/master/bebras/2013/2013-FR-12/task.js
Github Open Source
Open Source
MIT
2,023
bebras-tasks
France-ioi
JavaScript
Code
888
3,617
function initTask(subTask) { var state = {}; var level; var answer = null; var data = { easy: { graph: { "vertexInfo": { "00":{}, "01":{}, "02":{}, "03":{}, "04":{}, "05":{}, "06":{}, "07":{}, "08":{}, "09":{}, "10":{}, "11":{}, "12":{} }, "edgeInfo": { "00_02":{}, "00_04":{}, "00_06":{}, "01_02":{}, "02_03":{}, "03_04":{}, "04_05":{}, "05_06":{}, "06_01":{}, "01_07":{}, "07_08":{}, "08_09":{}, "09_10":{}, "10_11":{}, "11_12":{}, "12_07":{}, "02_08":{}, "03_09":{}, "04_10":{}, "05_11":{}, "06_12":{} }, "edgeVertices": { "00_02": ["00","02"], "00_04": ["00","04"], "00_06": ["00","06"], "01_02": ["01","02"], "02_03": ["02","03"], "03_04": ["03","04"], "04_05": ["04","05"], "05_06": ["05","06"], "06_01": ["06","01"], "01_07": ["01","07"], "07_08": ["07","08"], "08_09": ["08","09"], "09_10": ["09","10"], "10_11": ["10","11"], "11_12": ["11","12"], "12_07": ["12","07"], "02_08": ["02","08"], "03_09": ["03","09"], "04_10": ["04","10"], "05_11": ["05","11"], "06_12": ["06","12"] }, "directed": false }, vertexPos: { "00":{ "x":172,"y":162 }, "01":{ "x":171,"y":91 }, "02":{ "x":233,"y":129 }, "03":{ "x":232,"y":203 }, "04":{ "x":171,"y":241 }, "05":{ "x":103,"y":203 }, "06":{ "x":103,"y":123 }, "07":{ "x":173,"y":22 }, "08":{ "x":309,"y":99 }, "09":{ "x":309,"y":233 }, "10":{ "x":170,"y":311 }, "11":{ "x":35,"y":229 }, "12":{ "x":37,"y":83 } }, maxGuests: 7, paperWidth: 345, paperHeight: 335 }, medium: { graph: { "vertexInfo": { "00":{}, "01":{}, "02":{}, "03":{}, "04":{}, "05":{}, "06":{}, "07":{}, "08":{}, "09":{}, "10":{}, "11":{}, "12":{} }, "edgeInfo": { "11_05":{}, "11_02":{}, "12_08":{}, "12_07":{}, "07_08":{}, "05_02":{}, "02_01":{}, "05_03":{}, "03_01":{}, "08_06":{}, "06_04":{}, "04_07":{}, "02_00":{}, "00_03":{}, "05_00":{}, "09_05":{}, "03_09":{}, "07_09":{}, "01_06":{}, "09_06":{}, "10_06":{}, "10_07":{}, "08_10":{}, "03_04":{}, "04_08":{} }, "edgeVertices": { "11_05": ["11","05"], "11_02": ["11","02"], "12_08": ["12","08"], "12_07": ["12","07"], "07_08": ["07","08"], "05_02": ["05","02"], "02_01": ["02","01"], "05_03": ["05","03"], "03_01": ["03","01"], "08_06": ["08","06"], "06_04": ["06","04"], "04_07": ["04","07"], "02_00": ["02","00"], "00_03": ["00","03"], "05_00": ["05","00"], "09_05": ["09","05"], "03_09": ["03","09"], "07_09": ["07","09"], "01_06": ["01","06"], "04_08": ["04","08"], "10_06": ["10","06"], "10_07": ["10","07"], "08_10": ["08","10"], "03_04": ["03","04"], "09_06": ["09","06"] }, "directed": false }, vertexPos: { "00":{ "x":130,"y":90 }, "01":{ "x":65,"y":37 }, "02":{ "x":43,"y":116 }, "03":{ "x":184,"y":74 }, "04":{ "x":234,"y":63 }, "05":{ "x":126,"y":161 }, "06":{ "x":324,"y":39 }, "07":{ "x":263,"y":216 }, "08":{ "x":367,"y":135 }, "09":{ "x":189,"y":226 }, "10":{ "x":295,"y":149 }, "11":{ "x":90,"y":212 }, "12":{ "x":402,"y":192 } }, maxGuests: 7, paperWidth: 450, paperHeight: 280 }, hard: { graph: { "vertexInfo": { "00":{}, "01":{}, "02":{}, "03":{}, "04":{}, "05":{}, "06":{}, "07":{}, "08":{}, "09":{}, "10":{}, "11":{}, "12":{}, "13":{}, "14":{}, "15":{}, "16":{} }, "edgeInfo": { "00_01":{}, "00_10":{}, "01_02":{}, "01_09":{}, "02_03":{}, "02_07":{}, "02_08":{}, "03_07":{}, "03_04":{}, "03_08":{}, "04_05":{}, "05_06":{}, "05_16":{}, "06_07":{}, "06_16":{}, "07_08":{}, "08_09":{}, "08_16":{}, "09_10":{}, "10_11":{}, "10_12":{}, "10_16":{}, "11_12":{}, "12_13":{}, "12_14":{}, "12_16":{}, "13_14":{}, "14_15":{}, "14_16":{}, "15_16":{} }, "edgeVertices": { "00_01": ["00","01"], "00_10": ["00","10"], "01_02": ["01","02"], "01_09": ["01","09"], "02_03": ["02","03"], "02_07": ["02","07"], "02_08": ["02","08"], "03_07": ["03","07"], "03_04": ["03","04"], "03_08": ["03","08"], "04_05": ["04","05"], "05_06": ["05","06"], "05_16": ["05","16"], "06_07": ["06","07"], "06_16": ["06","16"], "07_08": ["07","08"], "08_09": ["08","09"], "08_16": ["08","16"], "09_10": ["09","10"], "10_11": ["10","11"], "10_12": ["10","12"], "10_16": ["10","16"], "11_12": ["11","12"], "12_13": ["12","13"], "12_14": ["12","14"], "12_16": ["12","16"], "13_14": ["13","14"], "14_15": ["14","15"], "14_16": ["14","16"], "15_16": ["15","16"] }, "directed": false }, vertexPos: { "00":{ "x": 252, "y": 18 }, "01":{ "x": 133, "y": 24 }, "02":{ "x": 80, "y": 73 }, "03":{ "x": 28, "y": 132 }, "04":{ "x": 48, "y": 207 }, "05":{ "x": 210, "y": 259 }, "06":{ "x": 162, "y": 204 }, "07":{ "x": 102, "y": 172 }, "08":{ "x": 170, "y": 115 }, "09":{ "x": 206, "y": 63 }, "10":{ "x": 258, "y": 108 }, "11":{ "x": 351, "y": 73 }, "12":{ "x": 325, "y": 145 }, "13":{ "x": 405, "y": 160 }, "14":{ "x": 350, "y": 210 }, "15":{ "x": 293, "y": 259 }, "16":{ "x": 233, "y": 170 } }, maxGuests: 8, paperWidth: 450, paperHeight: 280 } }; var paper; var paperWidth; var paperHeight; var graph; var vGraph; var graphMouse; var vertexToggler; var vertexAttr = { r:15, "stroke-width": 2, stroke: "black", fill: "white" }; var selectedAttr = { fill: "#AAAAFF" }; var edgeAttr = { "stroke-width": 1.2, stroke: "black" }; var maxGuests; subTask.loadLevel = function(curLevel) { level = curLevel; graph = Graph.fromJSON(JSON.stringify(data[level].graph)); maxGuests = data[level].maxGuests; paperWidth = data[level].paperWidth; paperHeight = data[level].paperHeight; }; subTask.getStateObject = function() { return state; }; subTask.reloadAnswerObject = function(answerObj) { answer = answerObj; }; subTask.resetDisplay = function() { paper = subTask.raphaelFactory.create("graph_task","graph_task",paperWidth,paperHeight); initGraph(); updateMessage(); $("#error").html(""); reloadAnswer(); }; subTask.getAnswerObject = function() { return answer; }; subTask.getDefaultAnswerObject = function() { var defaultAnswer = []; return defaultAnswer; }; subTask.unloadLevel = function(callback) { callback(); }; function getResultAndMessage() { var nbGuests = answer.length; if(nbGuests === 0){ return { success: 0, message: taskStrings.click } } if(checkNeighbors()){ return { success: 0, message: taskStrings.neighbors } } if(nbGuests < (maxGuests - 1)){ return { success: 0, message: taskStrings.notEnough } } if(nbGuests === (maxGuests - 1)){ return { successRate: 0.5, message: taskStrings.partialSuccess(nbGuests) }; }else{ return { successRate: 1, message: taskStrings.success }; } }; subTask.getGrade = function(callback) { callback(getResultAndMessage()); }; function initGraph() { var graphDrawer = new SimpleGraphDrawer(vertexAttr,edgeAttr); vGraph = new VisualGraph("vGraph", paper, graph, graphDrawer, true); initVertexPos(); vGraph.redraw(); graphMouse = new GraphMouse("graphMouse", graph, vGraph); vertexToggler = new VertexToggler("vTog", graph, vGraph, graphMouse, vertexToggle, true); } function initVertexPos() { for(var id in data[level].vertexPos){ var posX = data[level].vertexPos[id].x; var posY = data[level].vertexPos[id].y; vGraph.setVertexVisualInfo(id,{"x":posX,"y":posY}); } } function vertexToggle(id,selected) { $('#error').html(""); if(selected){ var attr = selectedAttr; answer.push(id); }else{ var attr = vertexAttr; removeFromAnswer(id); } if(checkNeighbors()){ $('#error').html(taskStrings.warning); }else if(answer.length === maxGuests){ platform.validate("done"); } vGraph.getRaphaelsFromID(id)[0].attr(attr); updateMessage(); } function removeFromAnswer(id) { for(var iAnswer = 0; iAnswer < answer.length; iAnswer++){ if(answer[iAnswer] === id){ answer.splice(iAnswer,1); break; } } } function checkNeighbors() { for(var iAnswer = 0; iAnswer < answer.length; iAnswer++){ for(var jAnswer = iAnswer + 1; jAnswer < answer.length; jAnswer++){ if(graph.hasNeighbor(answer[iAnswer],answer[jAnswer])) return true; } } return false; } function updateMessage() { $('#info').html(taskStrings.numberOfGuests(answer.length)); } function reloadAnswer() { for(var iAns = 0; iAns < answer.length; iAns++) { vGraph.getRaphaelsFromID(answer[iAns])[0].attr(selectedAttr); graph.setVertexInfo(answer[iAns],{selected:true}); } if(checkNeighbors()){ $('#error').html(taskStrings.warning); } } } initWrapper(initTask, ["easy", "medium", "hard"]); displayHelper.useFullWidth();
44,264
https://github.com/chunshen1987/bayesian_analysis/blob/master/src/mcmc.py
Github Open Source
Open Source
MIT
null
bayesian_analysis
chunshen1987
Python
Code
1,189
3,839
""" Markov chain Monte Carlo model calibration using the `affine-invariant ensemble sampler (emcee) <http://dfm.io/emcee>`_. This module must be run explicitly to create the posterior distribution. Run ``python -m src.mcmc --help`` for complete usage information. On first run, the number of walkers and burn-in steps must be specified, e.g. :: python -m src.mcmc --nwalkers 500 --nburnsteps 100 200 would run 500 walkers for 100 burn-in steps followed by 200 production steps. This will create the HDF5 file :file:`mcmc/chain.hdf` (default path). On subsequent runs, the chain resumes from the last point and the number of walkers is inferred from the chain, so only the number of production steps is required, e.g. :: python -m src.mcmc 300 would run an additional 300 production steps (total of 500). To restart the chain, delete (or rename) the chain HDF5 file. """ import argparse import logging import emcee import h5py import numpy as np from scipy.linalg import lapack import matplotlib.pyplot as plt from . import workdir, parse_model_parameter_file from .emulator import Emulator def mvn_loglike(y, cov): """ Evaluate the multivariate-normal log-likelihood for difference vector `y` and covariance matrix `cov`: log_p = -1/2*[(y^T).(C^-1).y + log(det(C))] + const. The likelihood is NOT NORMALIZED, since this does not affect MCMC. The normalization const = -n/2*log(2*pi), where n is the dimensionality. Arguments `y` and `cov` MUST be np.arrays with dtype == float64 and shapes (n) and (n, n), respectively. These requirements are NOT CHECKED. The calculation follows algorithm 2.1 in Rasmussen and Williams (Gaussian Processes for Machine Learning). """ # Compute the Cholesky decomposition of the covariance. # Use bare LAPACK function to avoid scipy.linalg wrapper overhead. L, info = lapack.dpotrf(cov, clean=False) if info < 0: raise ValueError( 'lapack dpotrf error: ' 'the {}-th argument had an illegal value'.format(-info) ) elif info < 0: raise np.linalg.LinAlgError( 'lapack dpotrf error: ' 'the leading minor of order {} is not positive definite' .format(info) ) # Solve for alpha = cov^-1.y using the Cholesky decomp. alpha, info = lapack.dpotrs(L, y) if info != 0: raise ValueError( 'lapack dpotrs error: ' 'the {}-th argument had an illegal value'.format(-info) ) return -.5*np.dot(y, alpha) - np.log(L.diagonal()).sum() class LoggingEnsembleSampler(emcee.EnsembleSampler): def run_mcmc(self, X0, nsteps, status=None, **kwargs): """ Run MCMC with logging every 'status' steps (default: approx 10% of nsteps). """ logging.info('running %d walkers for %d steps', self.nwalkers, nsteps) if status is None: status = nsteps // 10 for n, result in enumerate( self.sample(X0, iterations=nsteps, **kwargs), start=1 ): if n % status == 0 or n == nsteps: af = self.acceptance_fraction logging.info( 'step %d: acceptance fraction: ' 'mean %.4f, std %.4f, min %.4f, max %.4f', n, af.mean(), af.std(), af.min(), af.max() ) return result class Chain: """ High-level interface for running MCMC calibration and accessing results. Currently all design parameters except for the normalizations are required to be the same at all beam energies. It is assumed (NOT checked) that all system designs have the same parameters and ranges (except for the norms). """ def __init__(self, mcmc_path=workdir / 'mcmc' / 'chain.h5', expdata_path="./exp_data.dat", model_parafile="./model.dat", training_data_path="./training_data", npc=10, ): logging.info('Initializing MCMC ...') self.mcmc_path = mcmc_path self.mcmc_path.parent.mkdir(exist_ok=True) logging.info('Final Markov Chain results will be saved in {}'.format( self.mcmc_path) ) # load the model parameter file logging.info('Loading the model parameters space from {} ...'.format( model_parafile) ) self.pardict = parse_model_parameter_file(model_parafile) self.ndim = len(self.pardict.keys()) self.label = [] self.min = [] self.max = [] for par, val in self.pardict.items(): self.label.append(val[0]) self.min.append(val[1]) self.max.append(val[2]) self.min = np.array(self.min) self.max = np.array(self.max) # load the experimental data to be fit logging.info( 'Loading the experiment data from {} ...'.format(expdata_path)) self.expdata, self.expdata_cov = self._read_in_exp_data(expdata_path) self.nobs = self.expdata.shape[0] self.closureTestFalg = False # setup the emulator logging.info('Initializing emulators for the training model ...') self.emu = Emulator( training_set_path=training_data_path, parameter_file=model_parafile, npc=npc ) def log_posterior(self, X, extra_std_prior_scale=.05): """ Evaluate the posterior at `X`. `extra_std_prior_scale` is the scale parameter for the prior distribution on the model sys error parameter: prior ~ sigma^2 * exp(-sigma/scale) """ X = np.array(X, copy=False, ndmin=2) lp = np.zeros(X.shape[0]) inside = np.all((X > self.min) & (X < self.max), axis=1) lp[~inside] = -np.inf nsamples = np.count_nonzero(inside) if nsamples > 0: # not sure why to use the last parameter for extra std extra_std = 0.0*X[inside, -1] model_Y, model_cov = self.emu.predict( X[inside], return_cov=True, extra_std=extra_std ) # allocate difference (model - expt) and covariance arrays dY = np.empty([nsamples, self.nobs]) cov = np.empty([nsamples, self.nobs, self.nobs]) dY = model_Y - self.expdata # add expt cov to model cov cov = model_cov + self.expdata_cov # compute log likelihood at each point lp[inside] += list(map(mvn_loglike, dY, cov)) # add prior for extra_std (model sys error) lp[inside] += (2*np.log(extra_std + 1e-16) - extra_std/extra_std_prior_scale) return lp def _read_in_exp_data(self, filepath): """This function reads in exp data and compute the covarance matrix""" data = np.loadtxt(filepath) nobs = data.shape[0] data_cov = np.zeros([nobs, nobs]) for i in range(nobs): data_cov[i, i] = (data[i, 2]/data[i, 1])**2. return np.log(data[:, 1]), data_cov def random_pos(self, n=1): """ Generate `n` random positions in parameter space. """ return np.random.uniform(self.min, self.max, (n, self.ndim)) def set_closure_test_truth(self, filename): self.closureTestFalg = True self.trueParams = [] with open(filename, "r") as parfile: for line in parfile: line = line.split() self.trueParams.append(float(line[1])) self.trueParams = np.array(self.trueParams) @staticmethod def map(f, args): """ Dummy function so that this object can be used as a 'pool' for :meth:`emcee.EnsembleSampler`. """ return f(args) def run_mcmc(self, nsteps=500, nburnsteps=None, nwalkers=None, status=None): """ Run MCMC model calibration. If the chain already exists, continue from the last point, otherwise burn-in and start the chain. """ logging.info('Starting MCMC ...') sampler = LoggingEnsembleSampler( nwalkers, self.ndim, self.log_posterior, pool=self ) logging.info('no existing chain found, starting initial burn-in') # Run first half of burn-in starting from random positions. nburn0 = nburnsteps // 2 sampler.run_mcmc( self.random_pos(nwalkers), nburn0, status=status ) logging.info('resampling walker positions') # Reposition walkers to the most likely points in the chain, # then run the second half of burn-in. This significantly # accelerates burn-in and helps prevent stuck walkers. X0 = sampler.flatchain[ np.unique( sampler.flatlnprobability, return_index=True )[1][-nwalkers:] ] sampler.reset() X0 = sampler.run_mcmc( X0, nburnsteps - nburn0, status=status, ) sampler.reset() logging.info('burn-in complete, starting production') sampler.run_mcmc(X0, nsteps, status=status) logging.info('writing chain to file') return(sampler) def make_plots(self, chains): nwalkers, nsteps, ndim = chains.shape fig, axlist = plt.subplots(ndim, 1, sharex=True) for idim in range(self.ndim): for iwalker in range(nwalkers): axlist[idim].plot(chains[iwalker, :, idim], '-k', alpha=1./nwalkers) axlist[0].set_xlim([0, nsteps]) plt.show() samples = chains[:, :, :].reshape((-1, ndim)) import corner fig = corner.corner(samples, labels=self.label) if self.closureTestFalg: corner.overplot_lines(fig, self.trueParams, color="C1") corner.overplot_points(fig, self.trueParams[None], marker="o", color="C1") plt.savefig("posterior.png") results = map(lambda v: (v[1], v[2]-v[1], v[1]-v[0]), zip(*np.percentile(samples, [16, 50, 84], axis=0))) if self.closureTestFalg: for ipar, par in enumerate(list(results)): print("%s = %.4f^{+%.4f}_{-%.4f}, truth = %.4f" % ( self.label[ipar], par[0], par[1], par[2], self.trueParams[ipar]) ) else: for ipar, par in enumerate(list(results)): print("%s = %.4f^{+%.4f}_{-%.4f}" % ( self.label[ipar], par[0], par[1], par[2]) ) fig = plt.figure() plt.errorbar(range(len(self.expdata)), self.expdata, np.sqrt(self.expdata_cov.diagonal()), linestyle='', marker='o', color='k') model_Y = self.emu.predict( samples[np.random.randint(len(samples), size=100)]) for model_res in model_Y: plt.plot(range(len(self.expdata)), model_res, color='r', alpha=0.3) plt.show() def main(): parser = argparse.ArgumentParser( description='Markov Chain Monte Carlo', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( '--nsteps', type=int, default=500, help='number of steps' ) parser.add_argument( '--nwalkers', type=int, default=100, help='number of walkers' ) parser.add_argument( '--nburnsteps', type=int, default=200, help='number of burn-in steps' ) parser.add_argument( '--status', type=int, help='number of steps between logging status' ) parser.add_argument( '--exp', type=str, default='./exp_data.dat', help="experimental data" ) parser.add_argument( '--model_design', type=str, default='model_parameter_dict_examples/ABCD.txt', help="model parameter filename" ) parser.add_argument( '--training_set', type=str, default='./training_dataset', help="model training set parameters" ) args = parser.parse_args() mymcmc = Chain(expdata_path=args.exp, model_parafile=args.model_design, training_data_path=args.training_set) mymcmc.run_mcmc(nsteps=args.nsteps, nburnsteps=args.nburnsteps, nwalkers=args.nwalkers, status=args.status) if __name__ == '__main__': main()
35,557
https://github.com/danangsptro/laravel-vue-spa/blob/master/resources/js/src/components/navbar.vue
Github Open Source
Open Source
MIT
null
laravel-vue-spa
danangsptro
Vue
Code
28
112
<template> <div> <marquee><i>Selamat Datang di halaman form pendaftaran</i></marquee> </div> </template> <style scoped> marquee { color: #fff; font-size: 20px; font-weight: bold; padding: 20px; background-color: #09379b; border-radius: 10px; } </style>
12,511
https://github.com/ahl54/Tracker/blob/master/setup.py
Github Open Source
Open Source
MIT
null
Tracker
ahl54
Python
Code
30
127
from setuptools import setup setup(name='data_tracker', version='1.0', description="An application for tracking data requests", long_description="", author='Anna Lu', author_email='lua1@email.chop.edu', license='MIT License', packages=['data_tracker'], zip_safe=False, install_requires=[ 'Django', 'Sphinx', # requirements to be added ], )
1,731
https://github.com/a619668402/DYLTool/blob/master/DYLTool/DYLTool/Test/YLTestCircleController.m
Github Open Source
Open Source
Apache-2.0
2,019
DYLTool
a619668402
Objective-C
Code
173
878
// // YLTestCircleController.m // DYLTool // // Created by sky on 2018/8/23. // Copyright © 2018年 DYL. All rights reserved. // #import "YLTestCircleController.h" #import "YLCircleView.h" #import "NSMutableAttributedString+YLTool.h" @interface YLTestCircleController () @end @implementation YLTestCircleController - (void)viewDidLoad { [super viewDidLoad]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(20, KNavAndStatusHeight + 20, 100, 44); btn.titleLabel.font = [UIFont systemFontOfSize:15.f]; [btn setTitle:@"Click" forState:UIControlStateNormal]; [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [btn addTarget:self action:@selector(_btnClick:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 200, 300, 0)]; label.numberOfLines = 0; NSMutableAttributedString *str = [NSMutableAttributedString yl_attributedWithString:@"我们发现,在遍历字典和set时,先定义了一个数组,因为根据定义,字典和set都是“无序的”,所以无法根据特定的整数下标来直接访问其中的值。于是,就必须先获取字典里的所有键或是set里的所有对象。" range:NSMakeRange(10, 20) attributed:@{NSForegroundColorAttributeName:[UIColor yellowColor], NSFontAttributeName:[UIFont systemFontOfSize:25], NSBackgroundColorAttributeName:[UIColor redColor]}]; str = [str yl_attributedWithRange:NSMakeRange(30, 40) attributed:@{NSForegroundColorAttributeName:[UIColor orangeColor]}]; NSTextAttachment *attach = [[NSTextAttachment alloc] init]; attach.image = [UIImage imageNamed:@"image_1.jpg"]; attach.bounds = CGRectMake(0, -5, 20, 200); str = [str yl_attributedWithRange:NSMakeRange(0, 0) attributed:nil attachment:attach]; str = [str yl_attributedWithRange:NSMakeRange(0, 0) attributed:nil attachment:attach atIndex:10]; label.attributedText = str; [self.view addSubview:label]; [label sizeToFit]; } - (void)_btnClick:(UIButton *)sender { YLCircleView *testView = [[YLCircleView alloc] initWithFrame:self.view.bounds]; [self.view addSubview:testView]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView animateWithDuration:.2 animations:^{ testView.alpha = 0; } completion:^(BOOL finished) { [testView removeFromSuperview]; }]; }); } @end
10,885
https://github.com/Color-Chan/Color-Chan.Discord/blob/master/src/Color-Chan.Discord/Extensions/ApplicationBuilderExtensions.cs
Github Open Source
Open Source
MIT
2,022
Color-Chan.Discord
Color-Chan
C#
Code
93
259
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; namespace Color_Chan.Discord.Extensions { /// <summary> /// Contains all the extension methods for <see cref="IApplicationBuilder" />. /// </summary> public static class ApplicationBuilderExtensions { /// <summary> /// Adds configurations needed for Color-Chan.Discord. /// </summary> /// <param name="app">The <see cref="IApplicationBuilder" />.</param> /// <returns> /// The updated <see cref="IApplicationBuilder" />. /// </returns> public static IApplicationBuilder UseColorChanDiscord(this IApplicationBuilder app) { // Enables the ability to read the raw body data in a api controller. // This is needed for the authentication. app.Use((context, next) => { context.Request.EnableBuffering(); return next(); }); return app; } } }
22,177
https://github.com/speedofit2007/duytrancs-ParentingPlus/blob/master/client/InitialDesign/RewardsToEarnViewController.m
Github Open Source
Open Source
Apache-2.0
2,014
duytrancs-ParentingPlus
speedofit2007
Objective-C
Code
1,608
6,360
// // RewardsToEarnViewController.m // Parenting+ // // Created by Neil Gebhard on 1/17/14. // Copyright (c) 2014 Capstone Team B. All rights reserved. // #import "RewardsToEarnViewController.h" #import "RewardPricesViewController.h" #import "InfoViewController.h" @interface RewardsToEarnViewController () { NSString *oldreward1; NSString *oldreward2; NSString *oldreward3; NSString *oldreward4; NSString *oldreward5; NSString *oldreward6; NSString *oldreward7; NSString *oldreward8; int textFieldNumber; int rectPosX; int rectPosY; NSMutableArray *oldrewardsArray; } @end @implementation RewardsToEarnViewController BOOL hasSavedRewardsToEarn = NO; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } -(void) fadeTextIn: (UITextField *)textFieldName withLabel:(UILabel *)labelName { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration: 1]; [textFieldName setAlpha:1]; [labelName setAlpha:1]; [UIView commitAnimations]; } -(void) fadeTextOut: (UITextField *)textFieldName withLabel:(UILabel *)labelName { [UITextField beginAnimations:nil context:NULL]; [UITextField setAnimationDuration: .5]; [textFieldName setAlpha:0]; [labelName setAlpha:0]; [UITextField commitAnimations]; } - (void)viewDidLoad { [super viewDidLoad]; [[self navigationController] setNavigationBarHidden:NO animated:NO]; if ([[_notebook getRewards] count] > 0) { oldrewardsArray = [_notebook getRewards]; for (UITextField *field in _contentView.subviews) { if ([field isKindOfClass:[UITextField class]]) { field.text = nil; [field setAlpha:0]; } } rectPosY = 40; [self LoadRewardList2]; hasSavedRewardsToEarn = YES; } else { rectPosY = 35; for (UITextField *field in _contentView.subviews) { if ([field isKindOfClass:[UITextField class]]) { textFieldNumber++; rectPosY = rectPosY + 40; } } } //Gesture recogizer to hide keyboard UITapGestureRecognizer *tapScroll = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide)]; tapScroll.cancelsTouchesInView = NO; [_nbScrollView addGestureRecognizer: tapScroll]; //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; } - (IBAction)infoClick:(id)sender { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; InfoViewController *controller = (InfoViewController *)[storyboard instantiateViewControllerWithIdentifier:@"InfoViewController"]; controller.transition = 6; controller.parent = self; [self presentViewController:controller animated:YES completion:nil]; } -(IBAction)keyboardAdapter: (UITextField*)textfieldName { if ([[UIScreen mainScreen] bounds].size.height == 568 && [textfieldName isFirstResponder]) { [_nbScrollView setContentOffset:CGPointMake(0, ((textfieldName.frame.origin.y) - 150)) animated: NO]; } if([[UIScreen mainScreen] bounds].size.height <= 480 && [textfieldName isFirstResponder]) { // add stuff for iphone 3.5in or iphone great than 4in //[UIView commitAnimations]; } } // makes the screen return to its normal position after the keyboard has retracted - (void)keyboardDidHide:(NSNotification *)notification { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration: 0.25]; if ([[UIScreen mainScreen] bounds].size.height == 568) { [_nbScrollView setContentOffset:CGPointMake(0, 20) animated: YES]; //[UIView commitAnimations]; } else { // add stuff for iphone 3.5in or iphone great than 4in //[UIView commitAnimations]; } } -(BOOL)textFieldShouldReturn:(UITextField *)textField { int tagNum = textField.tag; tagNum = tagNum + 1; [[self.view viewWithTag:tagNum] becomeFirstResponder]; //[textField resignFirstResponder]; return NO; } // hide the keyboard when user taps outside of keyboard - (void) keyboardHide { [self.view endEditing:YES]; } -(IBAction) nextTextfield: (UITextField *) textField { int tagNum = textField.tag; tagNum = tagNum + 1; [[self.view viewWithTag:tagNum] becomeFirstResponder]; } -(void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self.nbScrollView layoutIfNeeded]; self.nbScrollView.contentSize = self.contentView.bounds.size; } // work in progress! - (IBAction)createTextField { rectPosY = rectPosY + 40; [self createTextField2:rectPosY]; } - (IBAction)createTextFieldCheck: (UITextField *) textfield { if (textfield.tag == textFieldNumber) { rectPosY = rectPosY + 40; [self createTextField2:rectPosY]; } else { } } -(void)createTextFieldWithText: (NSString *) textToAdd { rectPosY = rectPosY + 40; [self createTextField2WithText: rectPosY: textToAdd]; } -(void)createTextField2: (int)withYPos { textFieldNumber++; CGRect rect = CGRectMake(20, (withYPos), 280, 30); UITextField *textField = [[UITextField alloc] initWithFrame:rect]; //textField = [[UITextField alloc] initWithFrame:rect]; textField.tag = textFieldNumber; textField.borderStyle = UITextBorderStyleRoundedRect; textField.textColor = [UIColor blackColor]; textField.backgroundColor = [UIColor whiteColor]; textField.font = [UIFont systemFontOfSize:14.0]; textField.font = [UIFont fontWithName:@"Helvetica Neue" size: 14.0 ]; textField.placeholder = [NSString stringWithFormat:@"Enter Reward %d", textFieldNumber ]; textField.returnKeyType = UIReturnKeyNext; textField.clearButtonMode = UITextFieldViewModeAlways; textField.delegate = self; textField.autocapitalizationType = UITextAutocapitalizationTypeSentences; textField.autocorrectionType = UITextAutocorrectionTypeNo; [textField addTarget:self action: @selector(createTextFieldCheck:) forControlEvents:UIControlEventEditingDidBegin]; [textField addTarget:self action: @selector(keyboardAdapter:) forControlEvents:UIControlEventEditingDidBegin]; [textField addTarget:self action: @selector(nextTextfield:) forControlEvents:UIControlEventEditingDidEndOnExit]; _nbScrollView.contentSize = CGSizeMake(320, rectPosY + 100); _contentView.frame = CGRectMake(0, 0, 320, _nbScrollView.frame.size.height + 250); [textField setAlpha:0]; [_contentView addSubview:textField]; [self fadeTextIn:textField withLabel:nil]; } -(void)createTextField2WithText: (int)withYPos: (NSString *)andTextToAdd { textFieldNumber++; CGRect rect = CGRectMake(20, (withYPos), 280, 30); UITextField *textField = [[UITextField alloc] initWithFrame:rect]; //textField = [[UITextField alloc] initWithFrame:rect]; textField.tag = textFieldNumber; textField.borderStyle = UITextBorderStyleRoundedRect; textField.textColor = [UIColor blackColor]; textField.backgroundColor = [UIColor whiteColor]; textField.font = [UIFont systemFontOfSize:14.0]; textField.font = [UIFont fontWithName:@"Helvetica Neue" size: 14.0 ]; textField.placeholder = [NSString stringWithFormat:@"Enter Reward %d", textFieldNumber ]; textField.returnKeyType = UIReturnKeyNext; textField.clearButtonMode = UITextFieldViewModeAlways; textField.delegate = self; [textField addTarget:self action: @selector(createTextFieldCheck:) forControlEvents:UIControlEventEditingDidBegin]; [textField addTarget:self action: @selector(keyboardAdapter:) forControlEvents:UIControlEventEditingDidBegin]; [textField addTarget:self action: @selector(nextTextfield:) forControlEvents:UIControlEventEditingDidEndOnExit]; _nbScrollView.contentSize = CGSizeMake(320, rectPosY + 100); _contentView.frame = CGRectMake(0, 0, 320, _nbScrollView.frame.size.height + 250); [textField setAlpha:0]; [_contentView addSubview:textField]; [self fadeTextIn:textField withLabel:nil]; textField.text = andTextToAdd; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (void)saveAllTextFields { NSMutableArray *txtArray = [[NSMutableArray alloc] init]; for (UITextField *field in _contentView.subviews) { if ([field isKindOfClass:[UITextField class]] && field.text.length > 0) { [txtArray addObject: field.text]; NSLog(@"saved reward"); } } NSEnumerator *oldRewards = [oldrewardsArray objectEnumerator]; NSMutableArray *array = [[NSMutableArray alloc] init]; for (id textField in txtArray) { if (!([textField isEqualToString:[oldRewards nextObject][@"reward_name"]])) { NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] init]; [dict1 setObject:textField forKey:@"reward_name"]; [array addObject:dict1]; } } _notebook = [_notebook setRewardsFromNotebook:_notebook andReward:array]; hasSavedRewardsToEarn = YES; oldrewardsArray = array; } - (void) updateRewardField { NSMutableArray *txtArray = [[NSMutableArray alloc] init]; BOOL change = FALSE; for (UITextField *field in _contentView.subviews) { if ([field isKindOfClass:[UITextField class]] && field.text.length > 0) { [txtArray addObject: field.text]; NSLog(@"saved reward"); } } NSEnumerator *oldRewards = [oldrewardsArray objectEnumerator]; NSMutableArray *array = [[NSMutableArray alloc] init]; if (txtArray.count > oldrewardsArray.count) { for (int i=oldrewardsArray.count; i < txtArray.count; i++){ NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] init]; [dict1 setObject:@"" forKey:@"reward_name"]; [oldrewardsArray addObject:dict1]; } } for (id textField in txtArray) { NSString *oldname = [NSString stringWithString:[oldRewards nextObject][@"reward_name"]]; if (!([textField isEqualToString:oldname])) { _notebook = [_notebook updateRewardWithOldName:oldname toNewName:textField fromNotebook:_notebook]; change = TRUE; } NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] init]; [dict1 setObject:textField forKey:@"reward_name"]; [array addObject:dict1]; } if (change == TRUE) oldrewardsArray = array; } - (void)LoadRewardList2 { NSMutableArray *rewardList = [[NSMutableArray alloc] init]; rewardList = [_notebook getRewards]; for (id obj in rewardList) { [self createTextFieldWithText:obj[@"reward_name"]]; } } /* - (void)LoadRewardList { NSMutableArray *rewardList = [[NSMutableArray alloc] init]; rewardList = [_notebook getRewards]; _reward2Txt.text = _reward3Txt.text = _reward4Txt.text = _reward5Txt.text = @""; _reward6Txt.text = _reward7Txt.text = _reward8Txt.text = @""; if ([rewardList[0][@"reward_name"] length] > 0) oldreward1 = _reward1Txt.text = rewardList[0][@"reward_name"]; if ([rewardList count] > 1) oldreward2 = _reward2Txt.text = rewardList[1][@"reward_name"]; if ([rewardList count] > 2) oldreward3 = _reward3Txt.text = rewardList[2][@"reward_name"]; if ([rewardList count] > 3) oldreward4 = _reward4Txt.text = rewardList[3][@"reward_name"]; if ([rewardList count] > 4) oldreward5 = _reward5Txt.text = rewardList[4][@"reward_name"]; if ([rewardList count] > 5) oldreward6 = _reward6Txt.text = rewardList[5][@"reward_name"]; if ([rewardList count] > 6) oldreward7 = _reward7Txt.text = rewardList[6][@"reward_name"]; if ([rewardList count] > 7) oldreward8 = _reward8Txt.text = rewardList[7][@"reward_name"]; } */ - (IBAction)saveAndContinueClick:(id)sender { /* if (hasSavedRewardsToEarn == NO) { // no function call is needed here according to Duy's database functions - Neil NSMutableArray *txtArray = [[NSMutableArray alloc] init]; if (_reward1Txt.text.length > 0)[txtArray addObject:_reward1Txt.text]; if (_reward2Txt.text.length > 0)[txtArray addObject:_reward2Txt.text]; if (_reward3Txt.text.length > 0)[txtArray addObject:_reward3Txt.text]; if (_reward4Txt.text.length > 0)[txtArray addObject:_reward4Txt.text]; if (_reward5Txt.text.length > 0)[txtArray addObject:_reward5Txt.text]; if (_reward6Txt.text.length > 0)[txtArray addObject:_reward6Txt.text]; if (_reward7Txt.text.length > 0)[txtArray addObject:_reward7Txt.text]; if (_reward8Txt.text.length > 0)[txtArray addObject:_reward8Txt.text]; NSMutableArray *array = [[NSMutableArray alloc] init]; for (id obj in txtArray) { NSMutableDictionary *dict1 = [[NSMutableDictionary alloc] init]; [dict1 setObject:obj forKey:@"reward_name"]; [array addObject:dict1]; } _notebook = [_notebook setRewardsFromNotebook:_notebook andReward:array]; hasSavedRewardsToEarn = YES; NSLog(@"saved rewards for first time"); } else { /* //[self saveAllTextFields]; // no function call is needed here according to Duy's database functions - Neil if ([oldreward1 isEqualToString:_reward1Txt.text] == FALSE) { _notebook = [_notebook updateRewardWithOldName:oldreward1 toNewName:_reward1Txt.text fromNotebook:_notebook]; } if ([oldreward2 isEqualToString:_reward2Txt.text] == FALSE && ([oldreward2 length] != 0 || [_reward2Txt.text length] != 0)) { _notebook = [_notebook updateRewardWithOldName:oldreward2 toNewName:_reward2Txt.text fromNotebook:_notebook]; } if ([oldreward3 isEqualToString:_reward3Txt.text] == FALSE && ([oldreward3 length] != 0 || [_reward3Txt.text length] != 0)) { _notebook = [_notebook updateRewardWithOldName:oldreward3 toNewName:_reward3Txt.text fromNotebook:_notebook]; } if ([oldreward4 isEqualToString:_reward4Txt.text] == FALSE && ([oldreward4 length] != 0 || [_reward4Txt.text length] != 0)) { _notebook = [_notebook updateRewardWithOldName:oldreward4 toNewName:_reward4Txt.text fromNotebook:_notebook]; } if ([oldreward5 isEqualToString:_reward5Txt.text] == FALSE && ([oldreward5 length] != 0 || [_reward5Txt.text length] != 0)) { _notebook = [_notebook updateRewardWithOldName:oldreward5 toNewName:_reward5Txt.text fromNotebook:_notebook]; } if ([oldreward6 isEqualToString:_reward6Txt.text] == FALSE && ([oldreward6 length] != 0 || [_reward6Txt.text length] != 0)) { _notebook = [_notebook updateRewardWithOldName:oldreward6 toNewName:_reward6Txt.text fromNotebook:_notebook]; } if ([oldreward7 isEqualToString:_reward7Txt.text] == FALSE && ([oldreward7 length] != 0 || [_reward7Txt.text length] != 0)) { _notebook = [_notebook updateRewardWithOldName:oldreward7 toNewName:_reward7Txt.text fromNotebook:_notebook]; } if ([oldreward8 isEqualToString:_reward8Txt.text] == FALSE && ([oldreward8 length] != 0 || [_reward8Txt.text length] != 0)) { _notebook = [_notebook updateRewardWithOldName:oldreward8 toNewName:_reward8Txt.text fromNotebook:_notebook]; } hasSavedRewardsToEarn = YES; NSLog(@"updated rewards"); } if (_reward1Txt.text > 0) { oldreward1 = _reward1Txt.text; } if (_reward2Txt.text > 0) { oldreward2 = _reward2Txt.text; } if (_reward3Txt.text > 0) { oldreward3 = _reward3Txt.text; } if (_reward4Txt.text > 0) { oldreward4 = _reward4Txt.text; } if (_reward5Txt.text > 0) { oldreward5 = _reward5Txt.text; } if (_reward6Txt.text > 0) { oldreward6 = _reward6Txt.text; } if (_reward7Txt.text > 0) { oldreward7 = _reward7Txt.text; } if (_reward8Txt.text > 0) { oldreward8 = _reward8Txt.text; } [self saveAllTextFields2]; } */ if (hasSavedRewardsToEarn == NO) // first time create rewards for this notebook { [self saveAllTextFields]; } if (hasSavedRewardsToEarn == YES) { [self updateRewardField]; } [self shouldPerformSegueWithIdentifier:@"saveRewardsToEarnGoToRewardPrices" sender:self]; } - (IBAction)closeButton:(id)sender { [self.parentViewController dismissViewControllerAnimated:YES completion:nil]; } - (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender { if ([identifier isEqualToString:@"saveRewardsToEarnGoToRewardPrices"]) { // Clear the borders in case there are no errors. _reward1Txt.layer.borderColor = [[UIColor clearColor]CGColor]; if (_reward1Txt.text.length > 0) { return YES; } if (hasSavedRewardsToEarn == YES && _reward1Txt.alpha == 0) { return YES; } else { // Set borders on the offending controls that need rectified. if (_reward1Txt.text.length == 0) { _reward1Txt.layer.borderColor = [[UIColor redColor]CGColor]; _reward1Txt.layer.borderWidth = 1.0f; } if (_reward2Txt.text.length == 0) { _reward2Txt.layer.borderColor = [[UIColor redColor]CGColor]; _reward2Txt.layer.borderWidth = 1.0f; } if (_reward3Txt.text.length == 0) { _reward3Txt.layer.borderColor = [[UIColor redColor]CGColor]; _reward3Txt.layer.borderWidth = 1.0f; } return NO; } } return NO; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // add code to pass data to another view controller during a segue if ([[segue identifier] isEqualToString:@"saveRewardsToEarnGoToRewardPrices"]) { RewardPricesViewController *controller = (RewardPricesViewController*)segue.destinationViewController; /* controller.reward1 = _reward1Txt.text; controller.reward2 = _reward2Txt.text; controller.reward3 = _reward3Txt.text; controller.reward4 = _reward4Txt.text; controller.reward5 = _reward5Txt.text; controller.reward6 = _reward6Txt.text; controller.reward7 = _reward7Txt.text; controller.reward8 = _reward8Txt.text; */ controller.notebook = _notebook; } } @end
3,868
https://github.com/wellcometrust/wellcome-patterns-node/blob/master/catalogue/webapp/components/ItemRequestModal/ConfirmedDialog.tsx
Github Open Source
Open Source
MIT
null
wellcome-patterns-node
wellcometrust
TypeScript
Code
112
340
import { FC } from 'react'; import { CTAs, CurrentRequests, Header } from './common'; import { allowedRequests } from '@weco/common/values/requests'; import ButtonSolidLink from '@weco/common/views/components/ButtonSolidLink/ButtonSolidLink'; import { useToggles } from '@weco/common/server-data/Context'; type ConfirmedDialogProps = { currentHoldNumber?: number; }; const ConfirmedDialog: FC<ConfirmedDialogProps> = ({ currentHoldNumber }) => { const { enablePickUpDate } = useToggles(); const maybeExtraText = enablePickUpDate ? ' from your selected pickup date' : ''; return ( <> <Header> <span className={`h2`}>Request confirmed</span> <CurrentRequests allowedHoldRequests={allowedRequests} currentHoldRequests={currentHoldNumber} /> </Header> <p> It will be available to pick up from the library (Rare Materials Room, level 3) for one week{maybeExtraText}. </p> <CTAs> <ButtonSolidLink text={`View your library account`} link={'/account'} /> </CTAs> </> ); }; export default ConfirmedDialog;
44,342
https://github.com/aliostad/deep-learning-lang-detection/blob/master/data/train/bash/de002e6a709f9a40e04ab3da777b46d9924114e7test.sh
Github Open Source
Open Source
MIT
2,021
deep-learning-lang-detection
aliostad
Shell
Code
169
538
vw -i s1.model -t -p s1.predictions test.vw vw -i s2.model -t -p s2.predictions test.vw vw -i s3.model -t -p s3.predictions test.vw vw -i s4.model -t -p s4.predictions test.vw vw -i s5.model -t -p s5.predictions test.vw vw -i w1.model -t -p w1.predictions test.vw vw -i w2.model -t -p w2.predictions test.vw vw -i w3.model -t -p w3.predictions test.vw vw -i w4.model -t -p w4.predictions test.vw vw -i k1.model -t -p k1.predictions test.vw vw -i k2.model -t -p k2.predictions test.vw vw -i k3.model -t -p k3.predictions test.vw vw -i k4.model -t -p k4.predictions test.vw vw -i k5.model -t -p k5.predictions test.vw vw -i k6.model -t -p k6.predictions test.vw vw -i k7.model -t -p k7.predictions test.vw vw -i k8.model -t -p k8.predictions test.vw vw -i k9.model -t -p k9.predictions test.vw vw -i k10.model -t -p k10.predictions test.vw vw -i k11.model -t -p k11.predictions test.vw vw -i k12.model -t -p k12.predictions test.vw vw -i k13.model -t -p k13.predictions test.vw vw -i k14.model -t -p k14.predictions test.vw vw -i k15.model -t -p k15.predictions test.vw ./submission.sh
24,309
https://github.com/wuyongwen/vraptor-jasperreport/blob/master/src/main/java/br/com/caelum/vraptor/jasperreports/formats/Odt.java
Github Open Source
Open Source
Apache-2.0
2,013
vraptor-jasperreport
wuyongwen
Java
Code
44
189
package br.com.caelum.vraptor.jasperreports.formats; import net.sf.jasperreports.engine.JRExporter; import net.sf.jasperreports.engine.export.oasis.JROdtExporter; import br.com.caelum.vraptor.ioc.Component; /** * @author William Pivotto */ @Component public class Odt extends AbstractExporter { public String getContentType() { return "application/vnd.oasis.opendocument.text"; } public String getExtension() { return "odt"; } public JRExporter setup() { return new JROdtExporter(); } }
1,397
https://github.com/rafmos/graphql-fhir/blob/master/src/resources/3_0_1/profiles/allergyintolerance/resolver.js
Github Open Source
Open Source
MIT
null
graphql-fhir
rafmos
JavaScript
Code
201
510
const errorUtils = require('../../../../utils/error.utils'); /** * @name exports.allergyintoleranceResolver * @static * @summary AllergyIntolerance Resolver. */ module.exports.allergyintoleranceResolver = function allergyintoleranceResolver (root, args, context, info) { let { server, req, res, version } = context; return {}; }; /** * @name exports.allergyintoleranceListResolver * @static * @summary AllergyIntolerance List Resolver. */ module.exports.allergyintoleranceListResolver = function allergyintoleranceListResolver (root, args, context, info) { let { server, req, res, version } = context; return {}; }; /** * @name exports.allergyintoleranceInstanceResolver * @static * @summary AllergyIntolerance Instance Resolver. */ module.exports.allergyintoleranceInstanceResolver = function allergyintoleranceInstanceResolver (root, args, context, info) { let { server, req, res, version } = context; return {}; }; /** * @name exports.allergyintoleranceCreateResolver * @static * @summary AllergyIntolerance Create Resolver. */ module.exports.allergyintoleranceCreateResolver = function allergyintoleranceCreateResolver (root, args, context, info) { let { server, req, res, version } = context; return {}; }; /** * @name exports.allergyintoleranceUpdateResolver * @static * @summary AllergyIntolerance Update Resolver. */ module.exports.allergyintoleranceUpdateResolver = function allergyintoleranceUpdateResolver (root, args, context, info) { let { server, req, res, version } = context; return {}; }; /** * @name exports.allergyintoleranceDeleteResolver * @static * @summary AllergyIntolerance Delete Resolver. */ module.exports.allergyintoleranceDeleteResolver = function allergyintoleranceDeleteResolver (root, args, context, info) { let { server, req, res, version } = context; return {}; };
9,290
https://github.com/joelea/bootstraps/blob/master/coffeescript/gulp/tasks/nice-test.js
Github Open Source
Open Source
Apache-2.0
2,015
bootstraps
joelea
JavaScript
Code
20
77
var gulp = require('gulp'); var config = require('../config'); var mocha = require('gulp-mocha'); gulp.task('nice-test', ['compile-js'], function() { return gulp.src(config.build.test) .pipe(mocha({})); });
36,004
https://github.com/JGCRI/gcam-core/blob/master/cvs/objects/marketplace/source/normal_market.cpp
Github Open Source
Open Source
ECL-2.0, LicenseRef-scancode-unknown-license-reference
2,023
gcam-core
JGCRI
C++
Code
420
932
/* * LEGAL NOTICE * This computer software was prepared by Battelle Memorial Institute, * hereinafter the Contractor, under Contract No. DE-AC05-76RL0 1830 * with the Department of Energy (DOE). NEITHER THE GOVERNMENT NOR THE * CONTRACTOR MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY * LIABILITY FOR THE USE OF THIS SOFTWARE. This notice including this * sentence must appear on any copies of this computer software. * * EXPORT CONTROL * User agrees that the Software will not be shipped, transferred or * exported into any country or used in any manner prohibited by the * United States Export Administration Act or any other applicable * export laws, restrictions or regulations (collectively the "Export Laws"). * Export of the Software may require some form of license or other * authority from the U.S. Government, and failure to obtain such * export control license may result in criminal liability under * U.S. laws. In addition, if the Software is identified as export controlled * items under the Export Laws, User represents and warrants that User * is not a citizen, or otherwise located within, an embargoed nation * (including without limitation Iran, Syria, Sudan, Cuba, and North Korea) * and that User is not otherwise prohibited * under the Export Laws from receiving the Software. * * Copyright 2011 Battelle Memorial Institute. All Rights Reserved. * Distributed as open-source under the terms of the Educational Community * License version 2.0 (ECL 2.0). http://www.opensource.org/licenses/ecl2.php * * For further details, see: http://www.globalchange.umd.edu/models/gcam/ * */ /*! * \file normal_market.cpp * \ingroup Objects * \brief NormalMarket class source file. * \author Sonny Kim */ #include <string> #include "util/base/include/definitions.h" #include "util/base/include/util.h" #include "marketplace/include/normal_market.h" using namespace std; //! Constructor NormalMarket::NormalMarket( const MarketContainer* aContainer ) : Market( aContainer ) { } void NormalMarket::toDebugXMLDerived( ostream& out, Tabs* tabs ) const { } IMarketType::Type NormalMarket::getType() const { return IMarketType::NORMAL; } void NormalMarket::initPrice() { Market::initPrice(); } void NormalMarket::setPrice( const double priceIn ) { Market::setPrice( priceIn ); } void NormalMarket::set_price_to_last_if_default( const double lastPrice ) { Market::set_price_to_last_if_default( lastPrice ); } void NormalMarket::set_price_to_last( const double lastPrice ) { Market::set_price_to_last( lastPrice ); } double NormalMarket::getPrice() const { return Market::getPrice(); } void NormalMarket::addToDemand( const double demandIn ) { Market::addToDemand( demandIn ); } double NormalMarket::getDemand() const { return Market::getDemand(); } void NormalMarket::nullSupply() { Market::nullSupply(); } double NormalMarket::getSupply() const { return Market::getSupply(); } void NormalMarket::addToSupply( const double supplyIn ) { Market::addToSupply( supplyIn ); } bool NormalMarket::meetsSpecialSolutionCriteria() const { return Market::meetsSpecialSolutionCriteria(); } bool NormalMarket::shouldSolve() const { return mSolveMarket; } bool NormalMarket::shouldSolveNR() const { return Market::shouldSolveNR(); }
39,532
https://github.com/horzel/foursquare-palmpre/blob/master/Foursquare/app/assistants/friends-map-assistant.js
Github Open Source
Open Source
Apache-2.0
2,014
foursquare-palmpre
horzel
JavaScript
Code
645
4,279
function FriendsMapAssistant(lat,long,f,u,p,uid,ps,what) { this.lat=lat; this.long=long; this.friends=f; this.username=u; this.password=p; this.uid=uid; this.prevScene=ps; this.what=what; _globals.curmap=this; } FriendsMapAssistant.prototype.aboutToActivate = function(callback) { callback.defer(); //makes the setup behave like it should. }; FriendsMapAssistant.prototype.setup = function() { // Code from Google Sample NavMenu.setup(this,{buttons:'navOnly'}); var script = document.createElement("script"); script.src = "http://maps.google.com/maps/api/js?sensor=true&key=ABQIAAAAfKBxdZJp1ib9EdLiKILvVxTDKxkGVU7_DJQo4uQ9UVD-uuNX9xRhyapmRm_kPta_TaiHDSkmvypxPQ&callback=mapLoaded"; script.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); this.controller.setupWidget("mapSpinner", this.spinnerAttributes = { spinnerSize: 'large' }, this.spinnerModel = { spinning: true }); this.controller.setupWidget(Mojo.Menu.appMenu, _globals.amattributes, _globals.ammodel ); this.handleGestureStartBound=this.handleGestureStart.bindAsEventListener(this); this.handleGestureChangeBound=this.handleGestureChange.bindAsEventListener(this); this.handleGestureEndBound=this.handleGestureEnd.bindAsEventListener(this); this.showFriendInfoBound=this.showFriendInfo.bind(this); Mojo.Event.listen(this.controller.document, 'gesturestart', this.handleGestureStartBound, false); Mojo.Event.listen(this.controller.document, 'gesturechange', this.handleGestureChangeBound, false); Mojo.Event.listen(this.controller.document, 'gestureend', this.handleGestureEndBound, false); Mojo.Event.listen(this.controller.get("map_info"),Mojo.Event.tap, this.showFriendInfoBound); _globals.ammodel.items[0].disabled=true; this.controller.modelChanged(_globals.ammodel); this.lastScale=0; this.inGesture=false; this.zoom=15; this.origZoom=15; } FriendsMapAssistant.prototype.handleGestureStart = function(e) { this.map.setOptions({draggable:false}); this.previousScale=e.scale; } FriendsMapAssistant.prototype.handleGestureChange = function(e) { e.stop(); var d=this.previousScale-e.scale; if(Math.abs(d)>0.25){ var z=this.map.getZoom()+(d>0?-1:+1); this.map.setZoom(z); this.previousScale=e.scale; } } FriendsMapAssistant.prototype.handleGestureEnd = function(e) { e.stop(); this.map.setOptions({draggable:true}); } FriendsMapAssistant.prototype.setMarkers = function(map) { var cimage = new google.maps.MarkerImage('http://google-maps-icons.googlecode.com/files/leftthendown.png', new google.maps.Size(32, 37), new google.maps.Point(0,0), new google.maps.Point(0, 27)); var friendsfaces=[]; var cmarker = new google.maps.Marker({ position: new google.maps.LatLng(_globals.lat,_globals.long), map: map, icon: cimage }); var shadow = new google.maps.MarkerImage('images/map-marker-bg.png', new google.maps.Size(58, 65), new google.maps.Point(0,0), new google.maps.Point(22, 45)); for(var v=0;v<this.friends.length;v++) { if(this.friends[v].geolat!=0 && this.friends[v].geolat!=undefined) { //don't show friends that haven't done anything friendsfaces[v] = new google.maps.MarkerImage(this.friends[v].photo, new google.maps.Size(43, 43), new google.maps.Point(0,0), new google.maps.Point(17, 40)); var point = new google.maps.LatLng(this.friends[v].geolat,this.friends[v].geolong); var marker=new google.maps.Marker({ position: point, map: map, icon: friendsfaces[v], shadow: shadow, friend: this.friends[v], vindex: v, username: this.username, password: this.password, uid: this.uid }); this.attachBubble(marker, v); } } this.spinnerModel.spinning = false; this.controller.modelChanged(this.spinnerModel); this.controller.get("mapSpinner").hide(); } FriendsMapAssistant.prototype.attachBubble = function(marker,i) { var infowindow = new google.maps.InfoWindow( /*{ content: '<div id="iw-'+this.friends[i].id+'" style="min-height: 200px !important;"><b>'+this.friends[i].firstname+"</b><br/>"+ this.friends[i].checkin+"<br/></div>"+ '<a href="javascript:;" id="friend-'+this.friends[i].id+'" class="friendLink" data="'+i+'">Friend Info</a>' }*/ {content: 'khjfhjkdshgfkjhg dsfgh fjksd gfds ghjfdsjkgf gfsdhgkjlsdfhg sdfkg fjkg dfsjk ghkjsdfgh fkjsg dskljhgjksfdg sfg fghkjfdhgkjsdf gkljfdhs' } ); google.maps.event.addListener(marker, 'click', function(e) { //infowindow.open(this.map,marker); //logthis(this.getMarkerPixels(marker)); //var infoBox = new InfoBubble(this.controller.document,this.getMarkerPixels(marker),{content:'here\'s some content!'}); var html='<div class="mi-left"><img src="'+this.friends[i].photo+'" width="48" height="48"></div>'; html+='<div class="mi-right"><b>'+this.friends[i].firstname+'</b><br/>@ '+this.friends[i].checkin+'</div>'; this.controller.get("map_info").innerHTML=html; this.controller.get("map_info").writeAttribute("data",i); this.controller.get("map_info").style.opacity=1; this.controller.get("map_info").show(); window.clearTimeout(this.infoTimer); this.infoTimer=window.setTimeout(function(){this.fadeInfo();}.bind(this),5000); }.bind(this) ); /*google.maps.event.addListener(infowindow,"domready", function(){ }.bind(this) );*/ } FriendsMapAssistant.prototype.fadeInfo = function(){ Mojo.Animation.animateStyle(this.controller.get("map_info"),'opacity','bezier',{from:100, to:0, duration:1, curve:Mojo.Animation.easeIn, styleSetter:function(value){ this.controller.get("map_info").style.opacity=value/100; }.bind(this), onComplete:function(el){ el.hide(); } }); }; FriendsMapAssistant.prototype.getMarkerPixels = function(marker) { var map=marker.getMap(); var scale = Math.pow(2, map.getZoom()); var nw = new google.maps.LatLng( map.getBounds().getNorthEast().lat(), map.getBounds().getSouthWest().lng() ); var worldCoordinateNW = map.getProjection().fromLatLngToPoint(nw); var worldCoordinate = map.getProjection().fromLatLngToPoint(marker.getPosition()); var pixelOffset = new google.maps.Point( Math.floor((worldCoordinate.x - worldCoordinateNW.x) * scale), Math.floor((worldCoordinate.y - worldCoordinateNW.y) * scale) ); var po=pixelOffset; pixelOffset=pixelOffset.toString().replace("(","").replace(")",""); pixelOffset=pixelOffset.split(","); var ret={ left: pixelOffset[0], top: pixelOffset[1] }; return po; }; FriendsMapAssistant.prototype.initMap = function(event) { var myOptions = { zoom: 15, center: new google.maps.LatLng(_globals.lat, _globals.long), mapTypeId: google.maps.MapTypeId.ROADMAP } this.map = new google.maps.Map(this.controller.get("map_canvas"), myOptions); this.setMarkers(this.map); } var auth; function make_base_auth(user, pass) { var tok = user + ':' + pass; var hash = Base64.encode(tok); return "Basic " + hash; } FriendsMapAssistant.prototype.showFriendInfo = function(event) { var v=this.controller.get("map_info").readAttribute("data"); this.controller.stageController.pushScene({name: "user-info", transition: Mojo.Transition.zoomFade, disableSceneScroller: false},make_base_auth(this.username,this.password),this.friends[v].id,null,true); } FriendsMapAssistant.prototype.activate = function(event) { if (this.map === undefined) { // Kick off google maps initialization if(!Maps.isLoaded()) { this.spinnerModel.spinning = true; this.controller.modelChanged(this.spinnerModel); this.controller.get("statusinfo").update("Loading Google Maps..."); Maps.loadedCallback(this.initMap.bind(this)); initLoader(); }else{ this.initMap(); } } } FriendsMapAssistant.prototype.handleCommand = function(event) { if (event.type === Mojo.Event.command) { switch (event.command) { case "friends-search": var thisauth=_globals.auth; this.controller.stageController.swapScene({name: "friends-list", transition: Mojo.Transition.crossFade}, thisauth,userData,this.username,this.password,this.uid,this.lat,this.long,this,true); break; case "friends-list": var thisauth=_globals.auth; this.controller.stageController.swapScene({name: "friends-list", transition: Mojo.Transition.crossFade},thisauth,userData,this.username,this.password,this.uid,this.lat,this.long,this); break; case "friend-map": break; case "do-Friends": this.controller.stageController.popScene(); break; case "do-Venues": var thisauth=_globals.auth; this.controller.stageController.popScene(); this.prevScene.controller.stageController.swapScene({name: "nearby-venues", transition: Mojo.Transition.crossFade},thisauth,userData,this.username,this.password,this.uid); break; case "do-Profile": case "do-Badges": var thisauth=_globals.auth; this.controller.stageController.popScene(); this.prevScene.controller.stageController.swapScene({name: "user-info", transition: Mojo.Transition.crossFade},thisauth,""); break; case "do-Shout": var thisauth=_globals.auth; this.controller.stageController.popScene(); this.prevScene.controller.stageController.swapScene({name: "shout", transition: Mojo.Transition.crossFade},thisauth,"",this); break; case "do-Leaderboard": var thisauth=_globals.auth; this.controller.stageController.popScene(); this.prevScene.controller.stageController.swapScene({name: "leaderboard", transition: Mojo.Transition.crossFade},thisauth,"",this); break; case "do-Tips": var thisauth=_globals.auth; this.controller.stageController.popScene(); this.prevScene.controller.stageController.swapScene({name: "nearby-tips", transition: Mojo.Transition.crossFade},thisauth,"",this); break; case "do-Todos": var thisauth=auth; this.controller.stageController.popScene(); this.prevScene.controller.stageController.swapScene({name: "todos", transition: Mojo.Transition.crossFade},thisauth,"",this); break; case "do-About": this.controller.stageController.pushScene({name: "about", transition: Mojo.Transition.crossFade}); break; case "do-Donate": _globals.doDonate(); break; case "do-Update": _globals.checkUpdate(this); break; case "do-Prefs": this.controller.stageController.pushScene({name: "preferences", transition: Mojo.Transition.crossFade}); break; case "toggleMenu": NavMenu.toggleMenu(); break; } }else if(event.type===Mojo.Event.back) { event.preventDefault(); this.controller.stageController.popScene(); if(NavMenu.showing==true){ event.preventDefault(); NavMenu.hideMenu(); } } } FriendsMapAssistant.prototype.deactivate = function(event) { } FriendsMapAssistant.prototype.cleanup = function(event) { Mojo.Event.stopListening(this.controller.document, 'gesturestart', this.handleGestureStartBound, false); Mojo.Event.stopListening(this.controller.document, 'gesturechange', this.handleGestureChangeBound, false); Mojo.Event.stopListening(this.controller.document, 'gestureend', this.handleGestureEndBound, false); Mojo.Event.stopListening(this.controller.get("map_info"),Mojo.Event.tap, this.showFriendInfoBound); } /*info window stuff*/ function InfoBubble(doc,anchor,params) { var bubble=doc.createElement("div"); bubble.addClassName("info-bubble"); bubble.innerHTML=params.content; logthis("ax="+anchor.x); bubble.style.left=anchor.x+'px'; bubble.style.top=anchor.y+'px'; var mc=doc.getElementById("map_canvas"); mc.appendChild(bubble); }
13,956
https://github.com/RichardBoyewa/choice/blob/master/.dockerignore
Github Open Source
Open Source
MIT
2,018
choice
RichardBoyewa
Ignore List
Code
5
23
.idea/ node_modules/ .gitignore .dockerignore LICENCE
49,566
https://github.com/mgijax/mgv/blob/master/src/components/FindGenes.vue
Github Open Source
Open Source
MIT
2,022
mgv
mgijax
Vue
Code
148
563
<template> <div class="find-genes flexcolumn"> <select @change="selectSearch($event.target.value)" > <option v-for="search in searches" :key="search.label" :value="search.label" >{{search.label}}</option> </select> <input ref="searchTerm" size=30 :placeholder="selection.placeholder" @keypress="submitOnEnter" /> <span class="help-text" v-html="selection.helpText" ></span> </div> </template> <script> import MComponent from '@/components/MComponent' import MouseMineQueries from '@/lib/MouseMineQueries' export default MComponent({ name: 'FindGenes', data: function () { return { searches: (new MouseMineQueries()).getQueries(), selection: { label: '' } } }, methods: { selectSearch: function (val) { this.selection = this.searches.filter(s => s.label === val)[0] }, tellBusy (bool) { this.$parent.$parent.isBusy = bool }, doSearch () { let s = this.$refs.searchTerm.value s = s.trim() if (!s) return let cs = this.selection this.tellBusy(true) cs.handler && cs.handler(s).then(data => { this.$root.$emit('query-returned', { queryType: this.selection, query: s, results: data }) this.$refs.searchTerm.value = '' this.tellBusy(false) }).catch(() => { this.tellBusy(false) }) }, submitOnEnter (e) { if (e.keyCode === 13) this.doSearch() } }, mounted: function () { this.selection = this.searches[0] } }) </script> <style scoped> .help-text { font-size: 10px; } </style>
37,227
https://github.com/rlperez/stock-ticker/blob/master/db/schema.rb
Github Open Source
Open Source
MIT
null
stock-ticker
rlperez
Ruby
Code
235
595
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `rails # db:schema:load`. When creating a new database, `rails db:schema:load` tends to # be faster and is potentially less error prone than running all of your # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2019_12_23_161611) do create_table "stock_users", force: :cascade do |t| t.integer "user_id", null: false t.integer "stock_id", null: false t.index ["user_id", "stock_id"], name: "index_stock_users_on_user_id_and_stock_id", unique: true end create_table "stocks", force: :cascade do |t| t.string "symbol", limit: 10 t.string "company_name" t.string "exchange" t.string "industry" t.string "website" t.text "description" t.string "ceo" t.string "issue_type" t.string "sector" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.index ["symbol"], name: "index_stocks_on_symbol", unique: true end create_table "users", force: :cascade do |t| t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "email", null: false t.string "encrypted_password", limit: 128, null: false t.string "confirmation_token", limit: 128 t.string "remember_token", limit: 128, null: false t.index ["email"], name: "index_users_on_email", unique: true t.index ["remember_token"], name: "index_users_on_remember_token" end end
48,805
https://github.com/MaVdbussche/nozc/blob/master/nozc/src/main/java/com/barassolutions/FunctionDef.java
Github Open Source
Open Source
BSD-2-Clause
2,021
nozc
MaVdbussche
Java
Code
253
927
package com.barassolutions; import com.barassolutions.util.Logger; import com.barassolutions.util.Utils; import java.util.List; public class FunctionDef extends Declaration { /** * The function's name. */ private final String name; /** * The arguments of this function. */ private final List<Pattern> args; /** * The expression constituting the function's body. */ private InExpression expression; private final boolean lazy; private Type returnType; public FunctionDef(int line, String name, List<Pattern> args, InExpression expression, boolean lazy) { super(line); this.name = name; this.args = args; this.expression = expression; this.lazy = lazy; this.returnType = Type.ANY; } public FunctionDef(FunctionDefAnonym f) { this(f.line(), f.name(), f.args(), f.expression(), f.lazy()); } public Type returnType() { return returnType; } public void setReturnType(Type t) { this.returnType = t; } public String name() { return name; } public int nbArgs() { return args.size(); } @Override public AST analyze(Context context) { MethodContext methContext = new MethodContext(context); //Temporary assigning a type to allow analysis of potential recursive calls methContext.setReturnType(returnType); Logger.debug("Temporarily assigned a type to FunctionDef"); args.forEach(a -> { a = (Pattern) a.analyze(context); methContext.addArgument(a); }); context.addFunction(this, methContext); expression = (InExpression) expression.analyze(methContext); returnType = expression.type(); Logger.debug("Function return type is now " + returnType); methContext.setReturnType(returnType); return this; } @Override public void codegen(Emitter output) { output.token(TokenOz.FUN); if (lazy) { output.space(); output.token(TokenOz.LAZY); output.space(); } output.token(TokenOz.LCURLY); output.literal(Utils.ozFriendlyName(name)); args.forEach(a -> { output.space(); a.codegen(output); }); output.token(TokenOz.RCURLY); output.newLine(); output.indentRight(); expression.codegen(output); output.newLine(); output.indentLeft(); output.token(TokenOz.END); output.newLine(); } @Override public void writeToStdOut(PrettyPrinter p) { if (lazy) { p.printf("<FunctionDeclaration line=\"%d\" name=\"%s\" lazy>\n", line(), name); } else { p.printf("<FunctionDeclaration line=\"%d\" name=\"%s\">\n", line(), name); } p.indentRight(); args.forEach(a -> { p.printf("<Argument>\n"); p.indentRight(); a.writeToStdOut(p); p.indentLeft(); p.printf("</Argument>\n"); }); expression.writeToStdOut(p); p.indentLeft(); p.printf("</FunctionDeclaration>\n"); } }
44,762
https://github.com/SauloCav/OOP-Experiments/blob/master/Final Project OOP src/Calculos_Salariais/Vend.java
Github Open Source
Open Source
MIT
null
OOP-Experiments
SauloCav
Java
Code
57
174
package Calculos_Salariais; public class Vend extends Vendedor { public Vend() { super(); } public Vend(String nome, double salBase, double totalVendas, double numeroDeDependentes) { super(nome, salBase, totalVendas, numeroDeDependentes); } @Override public String toString() { return "Vend [getNome()=" + getNome() + ", isSalBase()=" + isSalBase() + ", isTotalVendas()=" + isTotalVendas() + ", getNumeroDeDependentes()=" + getNumeroDeDependentes() + "]"; } }
9,873
https://github.com/gutierrezps/NeuroKit/blob/master/neurokit2/misc/parallel_run.py
Github Open Source
Open Source
MIT
2,022
NeuroKit
gutierrezps
Python
Code
175
438
def parallel_run(function, arguments_list, n_jobs=-2, **kwargs): """Parallel processing utility function (requires the ```joblib`` package). Parameters ----------- function : function A callable function. arguments_list : list A list of dictionaries. The function will iterate through this list and pass each dictionary inside as ``**kwargs`` to the main function. n_jobs : int Number of cores to use. ``-2`` means all but 1. See ``joblib.Parallel()``. **kwargs Other arguments that can be passed to ``joblib.Parallel()``. Returns ------- list A list of outputs. Examples --------- >>> import neurokit2 as nk >>> import time >>> >>> # The function simply returns the input (but waits 3 seconds.) >>> def my_function(x): ... time.sleep(3) ... return x >>> >>> arguments_list = [{"x": 1}, {"x": 2}, {"x": 3}] >>> >>> nk.parallel_run(my_function, arguments_list) #doctest: +SKIP """ # Try loading mne try: import joblib except ImportError as e: raise ImportError( "NeuroKit error: parallel_run(): the 'joblib' module is required for this function to run. ", "Please install it first (`pip install joblib`).", ) from e parallel = joblib.Parallel(n_jobs=n_jobs, **kwargs) funs = (joblib.delayed(function)(**arguments) for arguments in arguments_list) return parallel(funs)
34,288
https://github.com/James4Deutschland/lazer/blob/master/GeneralUsageLister/MainIndex/two/llvm-cxxmap
Github Open Source
Open Source
WTFPL, GPL-1.0-or-later
2,020
lazer
James4Deutschland
Shell
Code
5
32
#!/bin/bash llvm-cxxmap --help &> ../two-log/llvm-cxxmap.log
29,033
https://github.com/ShAlireza/ML-Tries/blob/master/O4/_23_select_meaningful_features/doc.py
Github Open Source
Open Source
MIT
null
ML-Tries
ShAlireza
Python
Code
161
225
""" If we notice that a model performs much better on a training dataset than on the test dataset, this observation is a strong indicator of overfitting. the model fits the parameters too closely with regard to the particular observations in the training dataset, but does not generalize well to new data; we say that the model has a high variance. The reason for the overfitting is that our model is too complex for the given training data. Common solutions to reduce the generalization error are as follows: • Collect more training data • Introduce a penalty for complexity via regularization • Choose a simpler model with fewer parameters • Reduce the dimensionality of the data Collecting more training data is often not applicable. In the following sections, we will look at common ways to reduce overfitting by regularization and dimensionality reduction via feature selection, which leads to simpler models by requiring fewer parameters to be fitted to the data. """
36,761
https://github.com/dnguyen87/ng-fly/blob/master/server/models/drone.js
Github Open Source
Open Source
MIT
2,016
ng-fly
dnguyen87
JavaScript
Code
244
948
var arDrone = require('ar-drone'); var parrot = new Drone(arDrone); function Drone(drone) { this.drone = drone.createClient(); this.pos = [0, 0, 0]; this.airborne = false; } Drone.prototype.command = function(command) { switch(command) { case 'up': console.log('up'); this.pos[1] += 1; this.drone.up(0.1); break; case 'right': console.log('right'); this.pos[0] += 1; this.drone.right(0.1); break; case 'down': console.log('down'); this.pos[1] -= 1; this.drone.down(0.1); break; case 'left': console.log('left'); this.pos[0] -= 1; this.drone.left(0.1); break; case 'turn right': console.log('turn right'); this.drone.clockwise(0.1); break; case 'turn left': console.log('turn left'); this.drone.counterClockwise(0.1); break; case 'front': console.log('front'); this.pos[2] -= 1; this.drone.front(0.1); break; case 'back': console.log('back'); this.pos[2] += 1; this.drone.back(0.1); break; case 'stop': console.log('stop'); this.drone.stop(); break; case 'takeoff': console.log('takeoff'); this.airborne = true; this.drone.takeoff(); break; case 'land': console.log('land'); this.airborne = false; this.drone.land(); break; case 'order66': console.log('execute order 66'); let client = this.drone; client.takeoff(); client .after(500, function() { this.stop(); }) .after(1000, function() { this.front(0.1); }) .after(1000, function() { this.back(0.1); }) .after(500, function() { this.stop(); this.up(0.1); }) .after(2000, function() { this.animate('flipLeft', 15); }) .after(500, function() { this.stop(); this.land(); }); } }; Drone.prototype.centerFace = function(x, y) { if (x < 20) { console.log(`Face detected at x=${x} is far left. Adjusting drone to the left.`); this.drone.left(0.3); } else if (x > 170) { console.log(`Face detected at x=${x} is far right. Adjusting drone to the right.`); this.drone.right(0.3); } else if (y < 10) { console.log(`Face detected at y=${y} is far up. Adjusting drone up.`); this.drone.up(0.3); } else if (y > 30) { console.log(`Face detected at y=${y} is far down. Adjusting drone down.`); this.drone.down(0.3); } this.drone.stop(); }; module.exports = parrot;
18,087
https://github.com/kfzxleibin/Generic-Clean-Architecture/blob/master/MyApplication/app/src/main/java/com/zeyad/cleanarchitecture/data/db/generalize/GeneralRealmManager.java
Github Open Source
Open Source
MIT
2,016
Generic-Clean-Architecture
kfzxleibin
Java
Code
225
571
package com.zeyad.cleanarchitecture.data.db.generalize; import android.content.Context; import org.json.JSONObject; import java.util.List; import io.realm.RealmObject; import io.realm.RealmQuery; import rx.Observable; public interface GeneralRealmManager { /** * Gets an {@link Observable} which will emit an Object. * * @param userId The user id to retrieve data. */ Observable<?> getById(final int userId, Class clazz); /** * Gets an {@link Observable} which will emit a List of Objects. */ Observable<List> getAll(Class clazz); /** * Puts and element into the cache. * * @param realmModel Element to insert in the cache. */ Observable<?> put(RealmObject realmModel); Observable<?> put(JSONObject realmObject, Class dataClass); /** * Puts and element into the cache. * * @param realmModels Element to insert in the cache. */ void putAll(List<RealmObject> realmModels); /** * Checks if an element (User) exists in the cache. * * @param itemId The id used to look for inside the cache. * @return true if the element is cached, otherwise false. */ boolean isCached(final int itemId, Class clazz); /** * Checks if the cache is expired. * * @return true, the cache is expired, otherwise false. */ boolean isItemValid(final int itemId, Class clazz); boolean areItemsValid(String destination); /** * Evict all elements of the cache. */ void evictAll(Class clazz); void evict(final RealmObject realmModel, Class clazz); boolean evictById(final int itemId, Class clazz); Observable<?> evictCollection(List<Integer> list, Class dataClass); Context getContext(); Observable<List> getWhere(Class clazz, String query, String filterKey); Observable<List> getWhere(Class clazz, RealmQuery realmQuery); }
19,011
https://github.com/andrewboudreau/AdventOfCode_2020/blob/master/Day04/Day04.cs
Github Open Source
Open Source
MIT
null
AdventOfCode_2020
andrewboudreau
C#
Code
128
463
using System; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging; namespace AdventOfCode_2020.Week01 { public class Day04 : Day00 { public Day04(IServiceProvider serviceProvider, ILogger<Day04> logger) : base(serviceProvider, logger) { DirectInput = ExampleInput; IgnoreDirectInput(); } protected override string Solve(IEnumerable<string> inputs) { var passports = inputs.ToPassports().ToList(); var valid = passports.Count(p => p.HasAllRequiredFields()); return $"{valid} of {passports.Count} passports have all the required fields."; } protected override string Solve2(IEnumerable<string> inputs) { var passports = inputs.ToPassports().ToList(); var valid = passports.Count(p => p.IsValid()); return $"{valid} of {passports.Count} passports are valid."; } /// <summary> /// The tutorial input from https://adventofcode.com/2020/day/4 /// </summary> private static readonly string[] ExampleInput = @"ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929 hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm hcl:#cfa07d eyr:2025 pid:166559648 iyr:2011 ecl:brn hgt:59in".Split("\r\n"); } }
23,571
https://github.com/3025066980/MatTuGames/blob/master/mat_tugames/@TuGame/Gap.m
Github Open Source
Open Source
BSD-2-Clause-Views, BSD-2-Clause
2,021
MatTuGames
3025066980
MATLAB
Code
140
439
function [g bv lv]=Gap(clv) % GAP computes the gap function from game v. % % Usage: [g bv lv]=Gap(clv) % % Define variables: % output: % g -- The gap function of game v. A vector of length 2^n-1. % bv -- The upper vector/payoff of game v. % lv -- The lower/concession vector of game v. % % input: % clv -- TuGame class object. % % % Author: Holger I. Meinhardt (hme) % E-Mail: Holger.Meinhardt@wiwi.uni-karlsruhe.de % Institution: University of Karlsruhe (KIT) % % Record of revisions: % Date Version Programmer % ==================================================== % 10/29/2012 0.3 hme % v=clv.tuvalues; N=clv.tusize; n=clv.tuplayers; Si=clv.tuSi; % upper vector bv=v(N)-v(Si); % Computing the gap function w.r.t. v. g=zeros(1,N); % the gap vector w.r.t. v. S=1:N; Bm=bv(1); for ii=2:n, Bm=[Bm bv(ii) Bm+bv(ii)]; end g=Bm-v; a=cell(n,1); lv=zeros(1,n); % concession vector for i=1:n a{i}=bitget(S,i)==1; lv(i)=min(g(a{i})); end
17,541
https://github.com/aliyun/aliyun-tablestore-java-sdk/blob/master/src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelServiceApi.java
Github Open Source
Open Source
Apache-2.0
2,021
aliyun-tablestore-java-sdk
aliyun
Java
Code
20,000
68,514
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: tunnel_service_api.proto package com.alicloud.openservices.tablestore.core.protocol; public final class TunnelServiceApi { private TunnelServiceApi() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } public enum TunnelType implements com.google.protobuf.ProtocolMessageEnum { BaseData(0, 1), Stream(1, 2), BaseAndStream(2, 3), ; public static final int BaseData_VALUE = 1; public static final int Stream_VALUE = 2; public static final int BaseAndStream_VALUE = 3; public final int getNumber() { return value; } public static TunnelType valueOf(int value) { switch (value) { case 1: return BaseData; case 2: return Stream; case 3: return BaseAndStream; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<TunnelType> internalGetValueMap() { return internalValueMap; } private static com.google.protobuf.Internal.EnumLiteMap<TunnelType> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<TunnelType>() { public TunnelType findValueByNumber(int number) { return TunnelType.valueOf(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.getDescriptor().getEnumTypes().get(0); } private static final TunnelType[] VALUES = { BaseData, Stream, BaseAndStream, }; public static TunnelType valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; } private final int index; private final int value; private TunnelType(int index, int value) { this.index = index; this.value = value; } // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.TunnelType) } public enum ChannelStatus implements com.google.protobuf.ProtocolMessageEnum { OPEN(0, 1), CLOSING(1, 2), CLOSE(2, 3), TERMINATED(3, 4), ; public static final int OPEN_VALUE = 1; public static final int CLOSING_VALUE = 2; public static final int CLOSE_VALUE = 3; public static final int TERMINATED_VALUE = 4; public final int getNumber() { return value; } public static ChannelStatus valueOf(int value) { switch (value) { case 1: return OPEN; case 2: return CLOSING; case 3: return CLOSE; case 4: return TERMINATED; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<ChannelStatus> internalGetValueMap() { return internalValueMap; } private static com.google.protobuf.Internal.EnumLiteMap<ChannelStatus> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<ChannelStatus>() { public ChannelStatus findValueByNumber(int number) { return ChannelStatus.valueOf(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.getDescriptor().getEnumTypes().get(1); } private static final ChannelStatus[] VALUES = { OPEN, CLOSING, CLOSE, TERMINATED, }; public static ChannelStatus valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; } private final int index; private final int value; private ChannelStatus(int index, int value) { this.index = index; this.value = value; } // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ChannelStatus) } public enum ActionType implements com.google.protobuf.ProtocolMessageEnum { PUT_ROW(0, 1), UPDATE_ROW(1, 2), DELETE_ROW(2, 3), ; public static final int PUT_ROW_VALUE = 1; public static final int UPDATE_ROW_VALUE = 2; public static final int DELETE_ROW_VALUE = 3; public final int getNumber() { return value; } public static ActionType valueOf(int value) { switch (value) { case 1: return PUT_ROW; case 2: return UPDATE_ROW; case 3: return DELETE_ROW; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap<ActionType> internalGetValueMap() { return internalValueMap; } private static com.google.protobuf.Internal.EnumLiteMap<ActionType> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap<ActionType>() { public ActionType findValueByNumber(int number) { return ActionType.valueOf(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.getDescriptor().getEnumTypes().get(2); } private static final ActionType[] VALUES = { PUT_ROW, UPDATE_ROW, DELETE_ROW, }; public static ActionType valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } return VALUES[desc.getIndex()]; } private final int index; private final int value; private ActionType(int index, int value) { this.index = index; this.value = value; } // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ActionType) } public interface ErrorOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string code = 1; boolean hasCode(); String getCode(); // optional string message = 2; boolean hasMessage(); String getMessage(); // optional string tunnel_id = 3; boolean hasTunnelId(); String getTunnelId(); } public static final class Error extends com.google.protobuf.GeneratedMessage implements ErrorOrBuilder { // Use Error.newBuilder() to construct. private Error(Builder builder) { super(builder); } private Error(boolean noInit) {} private static final Error defaultInstance; public static Error getDefaultInstance() { return defaultInstance; } public Error getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; } private int bitField0_; // required string code = 1; public static final int CODE_FIELD_NUMBER = 1; private java.lang.Object code_; public boolean hasCode() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getCode() { java.lang.Object ref = code_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { code_ = s; } return s; } } private com.google.protobuf.ByteString getCodeBytes() { java.lang.Object ref = code_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); code_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string message = 2; public static final int MESSAGE_FIELD_NUMBER = 2; private java.lang.Object message_; public boolean hasMessage() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getMessage() { java.lang.Object ref = message_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { message_ = s; } return s; } } private com.google.protobuf.ByteString getMessageBytes() { java.lang.Object ref = message_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); message_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string tunnel_id = 3; public static final int TUNNEL_ID_FIELD_NUMBER = 3; private java.lang.Object tunnelId_; public boolean hasTunnelId() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelId_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelIdBytes() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { code_ = ""; message_ = ""; tunnelId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasCode()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getCodeBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getMessageBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getTunnelIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getCodeBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getMessageBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getTunnelIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ErrorOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); code_ = ""; bitField0_ = (bitField0_ & ~0x00000001); message_ = ""; bitField0_ = (bitField0_ & ~0x00000002); tunnelId_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.code_ = code_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.message_ = message_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.tunnelId_ = tunnelId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.getDefaultInstance()) return this; if (other.hasCode()) { setCode(other.getCode()); } if (other.hasMessage()) { setMessage(other.getMessage()); } if (other.hasTunnelId()) { setTunnelId(other.getTunnelId()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasCode()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; code_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; message_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; tunnelId_ = input.readBytes(); break; } } } } private int bitField0_; // required string code = 1; private java.lang.Object code_ = ""; public boolean hasCode() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getCode() { java.lang.Object ref = code_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); code_ = s; return s; } else { return (String) ref; } } public Builder setCode(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; code_ = value; onChanged(); return this; } public Builder clearCode() { bitField0_ = (bitField0_ & ~0x00000001); code_ = getDefaultInstance().getCode(); onChanged(); return this; } void setCode(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; code_ = value; onChanged(); } // optional string message = 2; private java.lang.Object message_ = ""; public boolean hasMessage() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getMessage() { java.lang.Object ref = message_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); message_ = s; return s; } else { return (String) ref; } } public Builder setMessage(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; message_ = value; onChanged(); return this; } public Builder clearMessage() { bitField0_ = (bitField0_ & ~0x00000002); message_ = getDefaultInstance().getMessage(); onChanged(); return this; } void setMessage(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000002; message_ = value; onChanged(); } // optional string tunnel_id = 3; private java.lang.Object tunnelId_ = ""; public boolean hasTunnelId() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelId_ = s; return s; } else { return (String) ref; } } public Builder setTunnelId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; tunnelId_ = value; onChanged(); return this; } public Builder clearTunnelId() { bitField0_ = (bitField0_ & ~0x00000004); tunnelId_ = getDefaultInstance().getTunnelId(); onChanged(); return this; } void setTunnelId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000004; tunnelId_ = value; onChanged(); } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Error) } static { defaultInstance = new Error(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Error) } public interface TunnelOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string table_name = 1; boolean hasTableName(); String getTableName(); // required string tunnel_name = 3; boolean hasTunnelName(); String getTunnelName(); // required .com.alicloud.openservices.tablestore.core.protocol.TunnelType tunnel_type = 4; boolean hasTunnelType(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType getTunnelType(); } public static final class Tunnel extends com.google.protobuf.GeneratedMessage implements TunnelOrBuilder { // Use Tunnel.newBuilder() to construct. private Tunnel(Builder builder) { super(builder); } private Tunnel(boolean noInit) {} private static final Tunnel defaultInstance; public static Tunnel getDefaultInstance() { return defaultInstance; } public Tunnel getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_fieldAccessorTable; } private int bitField0_; // required string table_name = 1; public static final int TABLE_NAME_FIELD_NUMBER = 1; private java.lang.Object tableName_; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tableName_ = s; } return s; } } private com.google.protobuf.ByteString getTableNameBytes() { java.lang.Object ref = tableName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tableName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string tunnel_name = 3; public static final int TUNNEL_NAME_FIELD_NUMBER = 3; private java.lang.Object tunnelName_; public boolean hasTunnelName() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelName_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelNameBytes() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required .com.alicloud.openservices.tablestore.core.protocol.TunnelType tunnel_type = 4; public static final int TUNNEL_TYPE_FIELD_NUMBER = 4; private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType tunnelType_; public boolean hasTunnelType() { return ((bitField0_ & 0x00000004) == 0x00000004); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType getTunnelType() { return tunnelType_; } private void initFields() { tableName_ = ""; tunnelName_ = ""; tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTableName()) { memoizedIsInitialized = 0; return false; } if (!hasTunnelName()) { memoizedIsInitialized = 0; return false; } if (!hasTunnelType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTableNameBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(3, getTunnelNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeEnum(4, tunnelType_.getNumber()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTableNameBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getTunnelNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(4, tunnelType_.getNumber()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); tableName_ = ""; bitField0_ = (bitField0_ & ~0x00000001); tunnelName_ = ""; bitField0_ = (bitField0_ & ~0x00000002); tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tableName_ = tableName_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.tunnelName_ = tunnelName_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.tunnelType_ = tunnelType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance()) return this; if (other.hasTableName()) { setTableName(other.getTableName()); } if (other.hasTunnelName()) { setTunnelName(other.getTunnelName()); } if (other.hasTunnelType()) { setTunnelType(other.getTunnelType()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTableName()) { return false; } if (!hasTunnelName()) { return false; } if (!hasTunnelType()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; tableName_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000002; tunnelName_ = input.readBytes(); break; } case 32: { int rawValue = input.readEnum(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType value = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.valueOf(rawValue); if (value == null) { unknownFields.mergeVarintField(4, rawValue); } else { bitField0_ |= 0x00000004; tunnelType_ = value; } break; } } } } private int bitField0_; // required string table_name = 1; private java.lang.Object tableName_ = ""; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tableName_ = s; return s; } else { return (String) ref; } } public Builder setTableName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; tableName_ = value; onChanged(); return this; } public Builder clearTableName() { bitField0_ = (bitField0_ & ~0x00000001); tableName_ = getDefaultInstance().getTableName(); onChanged(); return this; } void setTableName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; tableName_ = value; onChanged(); } // required string tunnel_name = 3; private java.lang.Object tunnelName_ = ""; public boolean hasTunnelName() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelName_ = s; return s; } else { return (String) ref; } } public Builder setTunnelName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; tunnelName_ = value; onChanged(); return this; } public Builder clearTunnelName() { bitField0_ = (bitField0_ & ~0x00000002); tunnelName_ = getDefaultInstance().getTunnelName(); onChanged(); return this; } void setTunnelName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000002; tunnelName_ = value; onChanged(); } // required .com.alicloud.openservices.tablestore.core.protocol.TunnelType tunnel_type = 4; private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; public boolean hasTunnelType() { return ((bitField0_ & 0x00000004) == 0x00000004); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType getTunnelType() { return tunnelType_; } public Builder setTunnelType(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; tunnelType_ = value; onChanged(); return this; } public Builder clearTunnelType() { bitField0_ = (bitField0_ & ~0x00000004); tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Tunnel) } static { defaultInstance = new Tunnel(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Tunnel) } public interface CreateTunnelRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required .com.alicloud.openservices.tablestore.core.protocol.Tunnel tunnel = 1; boolean hasTunnel(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getTunnel(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder getTunnelOrBuilder(); } public static final class CreateTunnelRequest extends com.google.protobuf.GeneratedMessage implements CreateTunnelRequestOrBuilder { // Use CreateTunnelRequest.newBuilder() to construct. private CreateTunnelRequest(Builder builder) { super(builder); } private CreateTunnelRequest(boolean noInit) {} private static final CreateTunnelRequest defaultInstance; public static CreateTunnelRequest getDefaultInstance() { return defaultInstance; } public CreateTunnelRequest getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_fieldAccessorTable; } private int bitField0_; // required .com.alicloud.openservices.tablestore.core.protocol.Tunnel tunnel = 1; public static final int TUNNEL_FIELD_NUMBER = 1; private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel tunnel_; public boolean hasTunnel() { return ((bitField0_ & 0x00000001) == 0x00000001); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getTunnel() { return tunnel_; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder getTunnelOrBuilder() { return tunnel_; } private void initFields() { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTunnel()) { memoizedIsInitialized = 0; return false; } if (!getTunnel().isInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, tunnel_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, tunnel_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getTunnelFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (tunnelBuilder_ == null) { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); } else { tunnelBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (tunnelBuilder_ == null) { result.tunnel_ = tunnel_; } else { result.tunnel_ = tunnelBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.getDefaultInstance()) return this; if (other.hasTunnel()) { mergeTunnel(other.getTunnel()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTunnel()) { return false; } if (!getTunnel().isInitialized()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.newBuilder(); if (hasTunnel()) { subBuilder.mergeFrom(getTunnel()); } input.readMessage(subBuilder, extensionRegistry); setTunnel(subBuilder.buildPartial()); break; } } } } private int bitField0_; // required .com.alicloud.openservices.tablestore.core.protocol.Tunnel tunnel = 1; private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder> tunnelBuilder_; public boolean hasTunnel() { return ((bitField0_ & 0x00000001) == 0x00000001); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getTunnel() { if (tunnelBuilder_ == null) { return tunnel_; } else { return tunnelBuilder_.getMessage(); } } public Builder setTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel value) { if (tunnelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } tunnel_ = value; onChanged(); } else { tunnelBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } public Builder setTunnel( com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder builderForValue) { if (tunnelBuilder_ == null) { tunnel_ = builderForValue.build(); onChanged(); } else { tunnelBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } public Builder mergeTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel value) { if (tunnelBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && tunnel_ != com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance()) { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.newBuilder(tunnel_).mergeFrom(value).buildPartial(); } else { tunnel_ = value; } onChanged(); } else { tunnelBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } public Builder clearTunnel() { if (tunnelBuilder_ == null) { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); onChanged(); } else { tunnelBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder getTunnelBuilder() { bitField0_ |= 0x00000001; onChanged(); return getTunnelFieldBuilder().getBuilder(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder getTunnelOrBuilder() { if (tunnelBuilder_ != null) { return tunnelBuilder_.getMessageOrBuilder(); } else { return tunnel_; } } private com.google.protobuf.SingleFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder> getTunnelFieldBuilder() { if (tunnelBuilder_ == null) { tunnelBuilder_ = new com.google.protobuf.SingleFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder>( tunnel_, getParentForChildren(), isClean()); tunnel_ = null; } return tunnelBuilder_; } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelRequest) } static { defaultInstance = new CreateTunnelRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelRequest) } public interface CreateTunnelResponseOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string tunnel_id = 1; boolean hasTunnelId(); String getTunnelId(); } public static final class CreateTunnelResponse extends com.google.protobuf.GeneratedMessage implements CreateTunnelResponseOrBuilder { // Use CreateTunnelResponse.newBuilder() to construct. private CreateTunnelResponse(Builder builder) { super(builder); } private CreateTunnelResponse(boolean noInit) {} private static final CreateTunnelResponse defaultInstance; public static CreateTunnelResponse getDefaultInstance() { return defaultInstance; } public CreateTunnelResponse getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_fieldAccessorTable; } private int bitField0_; // required string tunnel_id = 1; public static final int TUNNEL_ID_FIELD_NUMBER = 1; private java.lang.Object tunnelId_; public boolean hasTunnelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelId_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelIdBytes() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { tunnelId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTunnelId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTunnelIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTunnelIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); tunnelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tunnelId_ = tunnelId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.getDefaultInstance()) return this; if (other.hasTunnelId()) { setTunnelId(other.getTunnelId()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTunnelId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; tunnelId_ = input.readBytes(); break; } } } } private int bitField0_; // required string tunnel_id = 1; private java.lang.Object tunnelId_ = ""; public boolean hasTunnelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelId_ = s; return s; } else { return (String) ref; } } public Builder setTunnelId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; tunnelId_ = value; onChanged(); return this; } public Builder clearTunnelId() { bitField0_ = (bitField0_ & ~0x00000001); tunnelId_ = getDefaultInstance().getTunnelId(); onChanged(); return this; } void setTunnelId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; tunnelId_ = value; onChanged(); } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelResponse) } static { defaultInstance = new CreateTunnelResponse(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelResponse) } public interface DeleteTunnelRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string table_name = 1; boolean hasTableName(); String getTableName(); // required string tunnel_name = 2; boolean hasTunnelName(); String getTunnelName(); // optional string tunnel_id = 3; boolean hasTunnelId(); String getTunnelId(); } public static final class DeleteTunnelRequest extends com.google.protobuf.GeneratedMessage implements DeleteTunnelRequestOrBuilder { // Use DeleteTunnelRequest.newBuilder() to construct. private DeleteTunnelRequest(Builder builder) { super(builder); } private DeleteTunnelRequest(boolean noInit) {} private static final DeleteTunnelRequest defaultInstance; public static DeleteTunnelRequest getDefaultInstance() { return defaultInstance; } public DeleteTunnelRequest getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_fieldAccessorTable; } private int bitField0_; // required string table_name = 1; public static final int TABLE_NAME_FIELD_NUMBER = 1; private java.lang.Object tableName_; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tableName_ = s; } return s; } } private com.google.protobuf.ByteString getTableNameBytes() { java.lang.Object ref = tableName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tableName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string tunnel_name = 2; public static final int TUNNEL_NAME_FIELD_NUMBER = 2; private java.lang.Object tunnelName_; public boolean hasTunnelName() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelName_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelNameBytes() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string tunnel_id = 3; public static final int TUNNEL_ID_FIELD_NUMBER = 3; private java.lang.Object tunnelId_; public boolean hasTunnelId() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelId_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelIdBytes() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { tableName_ = ""; tunnelName_ = ""; tunnelId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTableName()) { memoizedIsInitialized = 0; return false; } if (!hasTunnelName()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTableNameBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getTunnelNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getTunnelIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTableNameBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getTunnelNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getTunnelIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); tableName_ = ""; bitField0_ = (bitField0_ & ~0x00000001); tunnelName_ = ""; bitField0_ = (bitField0_ & ~0x00000002); tunnelId_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tableName_ = tableName_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.tunnelName_ = tunnelName_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.tunnelId_ = tunnelId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.getDefaultInstance()) return this; if (other.hasTableName()) { setTableName(other.getTableName()); } if (other.hasTunnelName()) { setTunnelName(other.getTunnelName()); } if (other.hasTunnelId()) { setTunnelId(other.getTunnelId()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTableName()) { return false; } if (!hasTunnelName()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; tableName_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; tunnelName_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; tunnelId_ = input.readBytes(); break; } } } } private int bitField0_; // required string table_name = 1; private java.lang.Object tableName_ = ""; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tableName_ = s; return s; } else { return (String) ref; } } public Builder setTableName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; tableName_ = value; onChanged(); return this; } public Builder clearTableName() { bitField0_ = (bitField0_ & ~0x00000001); tableName_ = getDefaultInstance().getTableName(); onChanged(); return this; } void setTableName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; tableName_ = value; onChanged(); } // required string tunnel_name = 2; private java.lang.Object tunnelName_ = ""; public boolean hasTunnelName() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelName_ = s; return s; } else { return (String) ref; } } public Builder setTunnelName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; tunnelName_ = value; onChanged(); return this; } public Builder clearTunnelName() { bitField0_ = (bitField0_ & ~0x00000002); tunnelName_ = getDefaultInstance().getTunnelName(); onChanged(); return this; } void setTunnelName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000002; tunnelName_ = value; onChanged(); } // optional string tunnel_id = 3; private java.lang.Object tunnelId_ = ""; public boolean hasTunnelId() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelId_ = s; return s; } else { return (String) ref; } } public Builder setTunnelId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; tunnelId_ = value; onChanged(); return this; } public Builder clearTunnelId() { bitField0_ = (bitField0_ & ~0x00000004); tunnelId_ = getDefaultInstance().getTunnelId(); onChanged(); return this; } void setTunnelId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000004; tunnelId_ = value; onChanged(); } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelRequest) } static { defaultInstance = new DeleteTunnelRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelRequest) } public interface DeleteTunnelResponseOrBuilder extends com.google.protobuf.MessageOrBuilder { } public static final class DeleteTunnelResponse extends com.google.protobuf.GeneratedMessage implements DeleteTunnelResponseOrBuilder { // Use DeleteTunnelResponse.newBuilder() to construct. private DeleteTunnelResponse(Builder builder) { super(builder); } private DeleteTunnelResponse(boolean noInit) {} private static final DeleteTunnelResponse defaultInstance; public static DeleteTunnelResponse getDefaultInstance() { return defaultInstance; } public DeleteTunnelResponse getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_fieldAccessorTable; } private void initFields() { } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse(this); onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.getDefaultInstance()) return this; this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } } } } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelResponse) } static { defaultInstance = new DeleteTunnelResponse(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelResponse) } public interface ListTunnelRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional string table_name = 1; boolean hasTableName(); String getTableName(); } public static final class ListTunnelRequest extends com.google.protobuf.GeneratedMessage implements ListTunnelRequestOrBuilder { // Use ListTunnelRequest.newBuilder() to construct. private ListTunnelRequest(Builder builder) { super(builder); } private ListTunnelRequest(boolean noInit) {} private static final ListTunnelRequest defaultInstance; public static ListTunnelRequest getDefaultInstance() { return defaultInstance; } public ListTunnelRequest getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_fieldAccessorTable; } private int bitField0_; // optional string table_name = 1; public static final int TABLE_NAME_FIELD_NUMBER = 1; private java.lang.Object tableName_; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tableName_ = s; } return s; } } private com.google.protobuf.ByteString getTableNameBytes() { java.lang.Object ref = tableName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tableName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { tableName_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTableNameBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTableNameBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); tableName_ = ""; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tableName_ = tableName_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.getDefaultInstance()) return this; if (other.hasTableName()) { setTableName(other.getTableName()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; tableName_ = input.readBytes(); break; } } } } private int bitField0_; // optional string table_name = 1; private java.lang.Object tableName_ = ""; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tableName_ = s; return s; } else { return (String) ref; } } public Builder setTableName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; tableName_ = value; onChanged(); return this; } public Builder clearTableName() { bitField0_ = (bitField0_ & ~0x00000001); tableName_ = getDefaultInstance().getTableName(); onChanged(); return this; } void setTableName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; tableName_ = value; onChanged(); } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelRequest) } static { defaultInstance = new ListTunnelRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelRequest) } public interface TunnelInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string tunnel_id = 1; boolean hasTunnelId(); String getTunnelId(); // required string tunnel_type = 2; boolean hasTunnelType(); String getTunnelType(); // required string table_name = 3; boolean hasTableName(); String getTableName(); // required string instance_name = 4; boolean hasInstanceName(); String getInstanceName(); // required string stream_id = 5; boolean hasStreamId(); String getStreamId(); // required string stage = 6; boolean hasStage(); String getStage(); // optional bool expired = 7; boolean hasExpired(); boolean getExpired(); // optional string tunnel_name = 8; boolean hasTunnelName(); String getTunnelName(); // optional bool public = 9; boolean hasPublic(); boolean getPublic(); } public static final class TunnelInfo extends com.google.protobuf.GeneratedMessage implements TunnelInfoOrBuilder { // Use TunnelInfo.newBuilder() to construct. private TunnelInfo(Builder builder) { super(builder); } private TunnelInfo(boolean noInit) {} private static final TunnelInfo defaultInstance; public static TunnelInfo getDefaultInstance() { return defaultInstance; } public TunnelInfo getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_fieldAccessorTable; } private int bitField0_; // required string tunnel_id = 1; public static final int TUNNEL_ID_FIELD_NUMBER = 1; private java.lang.Object tunnelId_; public boolean hasTunnelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelId_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelIdBytes() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string tunnel_type = 2; public static final int TUNNEL_TYPE_FIELD_NUMBER = 2; private java.lang.Object tunnelType_; public boolean hasTunnelType() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelType() { java.lang.Object ref = tunnelType_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelType_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelTypeBytes() { java.lang.Object ref = tunnelType_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelType_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string table_name = 3; public static final int TABLE_NAME_FIELD_NUMBER = 3; private java.lang.Object tableName_; public boolean hasTableName() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTableName() { java.lang.Object ref = tableName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tableName_ = s; } return s; } } private com.google.protobuf.ByteString getTableNameBytes() { java.lang.Object ref = tableName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tableName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string instance_name = 4; public static final int INSTANCE_NAME_FIELD_NUMBER = 4; private java.lang.Object instanceName_; public boolean hasInstanceName() { return ((bitField0_ & 0x00000008) == 0x00000008); } public String getInstanceName() { java.lang.Object ref = instanceName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { instanceName_ = s; } return s; } } private com.google.protobuf.ByteString getInstanceNameBytes() { java.lang.Object ref = instanceName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); instanceName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string stream_id = 5; public static final int STREAM_ID_FIELD_NUMBER = 5; private java.lang.Object streamId_; public boolean hasStreamId() { return ((bitField0_ & 0x00000010) == 0x00000010); } public String getStreamId() { java.lang.Object ref = streamId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { streamId_ = s; } return s; } } private com.google.protobuf.ByteString getStreamIdBytes() { java.lang.Object ref = streamId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); streamId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string stage = 6; public static final int STAGE_FIELD_NUMBER = 6; private java.lang.Object stage_; public boolean hasStage() { return ((bitField0_ & 0x00000020) == 0x00000020); } public String getStage() { java.lang.Object ref = stage_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { stage_ = s; } return s; } } private com.google.protobuf.ByteString getStageBytes() { java.lang.Object ref = stage_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); stage_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional bool expired = 7; public static final int EXPIRED_FIELD_NUMBER = 7; private boolean expired_; public boolean hasExpired() { return ((bitField0_ & 0x00000040) == 0x00000040); } public boolean getExpired() { return expired_; } // optional string tunnel_name = 8; public static final int TUNNEL_NAME_FIELD_NUMBER = 8; private java.lang.Object tunnelName_; public boolean hasTunnelName() { return ((bitField0_ & 0x00000080) == 0x00000080); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelName_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelNameBytes() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional bool public = 9; public static final int PUBLIC_FIELD_NUMBER = 9; private boolean public_; public boolean hasPublic() { return ((bitField0_ & 0x00000100) == 0x00000100); } public boolean getPublic() { return public_; } private void initFields() { tunnelId_ = ""; tunnelType_ = ""; tableName_ = ""; instanceName_ = ""; streamId_ = ""; stage_ = ""; expired_ = false; tunnelName_ = ""; public_ = false; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTunnelId()) { memoizedIsInitialized = 0; return false; } if (!hasTunnelType()) { memoizedIsInitialized = 0; return false; } if (!hasTableName()) { memoizedIsInitialized = 0; return false; } if (!hasInstanceName()) { memoizedIsInitialized = 0; return false; } if (!hasStreamId()) { memoizedIsInitialized = 0; return false; } if (!hasStage()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTunnelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getTunnelTypeBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getTableNameBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getInstanceNameBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, getStreamIdBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getStageBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBool(7, expired_); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBytes(8, getTunnelNameBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBool(9, public_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTunnelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getTunnelTypeBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getTableNameBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getInstanceNameBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getStreamIdBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getStageBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(7, expired_); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(8, getTunnelNameBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(9, public_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); tunnelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); tunnelType_ = ""; bitField0_ = (bitField0_ & ~0x00000002); tableName_ = ""; bitField0_ = (bitField0_ & ~0x00000004); instanceName_ = ""; bitField0_ = (bitField0_ & ~0x00000008); streamId_ = ""; bitField0_ = (bitField0_ & ~0x00000010); stage_ = ""; bitField0_ = (bitField0_ & ~0x00000020); expired_ = false; bitField0_ = (bitField0_ & ~0x00000040); tunnelName_ = ""; bitField0_ = (bitField0_ & ~0x00000080); public_ = false; bitField0_ = (bitField0_ & ~0x00000100); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tunnelId_ = tunnelId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.tunnelType_ = tunnelType_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.tableName_ = tableName_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.instanceName_ = instanceName_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.streamId_ = streamId_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.stage_ = stage_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.expired_ = expired_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.tunnelName_ = tunnelName_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000100; } result.public_ = public_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()) return this; if (other.hasTunnelId()) { setTunnelId(other.getTunnelId()); } if (other.hasTunnelType()) { setTunnelType(other.getTunnelType()); } if (other.hasTableName()) { setTableName(other.getTableName()); } if (other.hasInstanceName()) { setInstanceName(other.getInstanceName()); } if (other.hasStreamId()) { setStreamId(other.getStreamId()); } if (other.hasStage()) { setStage(other.getStage()); } if (other.hasExpired()) { setExpired(other.getExpired()); } if (other.hasTunnelName()) { setTunnelName(other.getTunnelName()); } if (other.hasPublic()) { setPublic(other.getPublic()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTunnelId()) { return false; } if (!hasTunnelType()) { return false; } if (!hasTableName()) { return false; } if (!hasInstanceName()) { return false; } if (!hasStreamId()) { return false; } if (!hasStage()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; tunnelId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; tunnelType_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; tableName_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; instanceName_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000010; streamId_ = input.readBytes(); break; } case 50: { bitField0_ |= 0x00000020; stage_ = input.readBytes(); break; } case 56: { bitField0_ |= 0x00000040; expired_ = input.readBool(); break; } case 66: { bitField0_ |= 0x00000080; tunnelName_ = input.readBytes(); break; } case 72: { bitField0_ |= 0x00000100; public_ = input.readBool(); break; } } } } private int bitField0_; // required string tunnel_id = 1; private java.lang.Object tunnelId_ = ""; public boolean hasTunnelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelId_ = s; return s; } else { return (String) ref; } } public Builder setTunnelId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; tunnelId_ = value; onChanged(); return this; } public Builder clearTunnelId() { bitField0_ = (bitField0_ & ~0x00000001); tunnelId_ = getDefaultInstance().getTunnelId(); onChanged(); return this; } void setTunnelId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; tunnelId_ = value; onChanged(); } // required string tunnel_type = 2; private java.lang.Object tunnelType_ = ""; public boolean hasTunnelType() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelType() { java.lang.Object ref = tunnelType_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelType_ = s; return s; } else { return (String) ref; } } public Builder setTunnelType(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; tunnelType_ = value; onChanged(); return this; } public Builder clearTunnelType() { bitField0_ = (bitField0_ & ~0x00000002); tunnelType_ = getDefaultInstance().getTunnelType(); onChanged(); return this; } void setTunnelType(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000002; tunnelType_ = value; onChanged(); } // required string table_name = 3; private java.lang.Object tableName_ = ""; public boolean hasTableName() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTableName() { java.lang.Object ref = tableName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tableName_ = s; return s; } else { return (String) ref; } } public Builder setTableName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; tableName_ = value; onChanged(); return this; } public Builder clearTableName() { bitField0_ = (bitField0_ & ~0x00000004); tableName_ = getDefaultInstance().getTableName(); onChanged(); return this; } void setTableName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000004; tableName_ = value; onChanged(); } // required string instance_name = 4; private java.lang.Object instanceName_ = ""; public boolean hasInstanceName() { return ((bitField0_ & 0x00000008) == 0x00000008); } public String getInstanceName() { java.lang.Object ref = instanceName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); instanceName_ = s; return s; } else { return (String) ref; } } public Builder setInstanceName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; instanceName_ = value; onChanged(); return this; } public Builder clearInstanceName() { bitField0_ = (bitField0_ & ~0x00000008); instanceName_ = getDefaultInstance().getInstanceName(); onChanged(); return this; } void setInstanceName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000008; instanceName_ = value; onChanged(); } // required string stream_id = 5; private java.lang.Object streamId_ = ""; public boolean hasStreamId() { return ((bitField0_ & 0x00000010) == 0x00000010); } public String getStreamId() { java.lang.Object ref = streamId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); streamId_ = s; return s; } else { return (String) ref; } } public Builder setStreamId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; streamId_ = value; onChanged(); return this; } public Builder clearStreamId() { bitField0_ = (bitField0_ & ~0x00000010); streamId_ = getDefaultInstance().getStreamId(); onChanged(); return this; } void setStreamId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000010; streamId_ = value; onChanged(); } // required string stage = 6; private java.lang.Object stage_ = ""; public boolean hasStage() { return ((bitField0_ & 0x00000020) == 0x00000020); } public String getStage() { java.lang.Object ref = stage_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); stage_ = s; return s; } else { return (String) ref; } } public Builder setStage(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; stage_ = value; onChanged(); return this; } public Builder clearStage() { bitField0_ = (bitField0_ & ~0x00000020); stage_ = getDefaultInstance().getStage(); onChanged(); return this; } void setStage(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000020; stage_ = value; onChanged(); } // optional bool expired = 7; private boolean expired_ ; public boolean hasExpired() { return ((bitField0_ & 0x00000040) == 0x00000040); } public boolean getExpired() { return expired_; } public Builder setExpired(boolean value) { bitField0_ |= 0x00000040; expired_ = value; onChanged(); return this; } public Builder clearExpired() { bitField0_ = (bitField0_ & ~0x00000040); expired_ = false; onChanged(); return this; } // optional string tunnel_name = 8; private java.lang.Object tunnelName_ = ""; public boolean hasTunnelName() { return ((bitField0_ & 0x00000080) == 0x00000080); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelName_ = s; return s; } else { return (String) ref; } } public Builder setTunnelName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; tunnelName_ = value; onChanged(); return this; } public Builder clearTunnelName() { bitField0_ = (bitField0_ & ~0x00000080); tunnelName_ = getDefaultInstance().getTunnelName(); onChanged(); return this; } void setTunnelName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000080; tunnelName_ = value; onChanged(); } // optional bool public = 9; private boolean public_ ; public boolean hasPublic() { return ((bitField0_ & 0x00000100) == 0x00000100); } public boolean getPublic() { return public_; } public Builder setPublic(boolean value) { bitField0_ |= 0x00000100; public_ = value; onChanged(); return this; } public Builder clearPublic() { bitField0_ = (bitField0_ & ~0x00000100); public_ = false; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TunnelInfo) } static { defaultInstance = new TunnelInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TunnelInfo) } public interface ListTunnelResponseOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnels = 1; java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo> getTunnelsList(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnels(int index); int getTunnelsCount(); java.util.List<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> getTunnelsOrBuilderList(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelsOrBuilder( int index); } public static final class ListTunnelResponse extends com.google.protobuf.GeneratedMessage implements ListTunnelResponseOrBuilder { // Use ListTunnelResponse.newBuilder() to construct. private ListTunnelResponse(Builder builder) { super(builder); } private ListTunnelResponse(boolean noInit) {} private static final ListTunnelResponse defaultInstance; public static ListTunnelResponse getDefaultInstance() { return defaultInstance; } public ListTunnelResponse getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_fieldAccessorTable; } // repeated .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnels = 1; public static final int TUNNELS_FIELD_NUMBER = 1; private java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo> tunnels_; public java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo> getTunnelsList() { return tunnels_; } public java.util.List<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> getTunnelsOrBuilderList() { return tunnels_; } public int getTunnelsCount() { return tunnels_.size(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnels(int index) { return tunnels_.get(index); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelsOrBuilder( int index) { return tunnels_.get(index); } private void initFields() { tunnels_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getTunnelsCount(); i++) { if (!getTunnels(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < tunnels_.size(); i++) { output.writeMessage(1, tunnels_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < tunnels_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, tunnels_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getTunnelsFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (tunnelsBuilder_ == null) { tunnels_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { tunnelsBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse(this); int from_bitField0_ = bitField0_; if (tunnelsBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { tunnels_ = java.util.Collections.unmodifiableList(tunnels_); bitField0_ = (bitField0_ & ~0x00000001); } result.tunnels_ = tunnels_; } else { result.tunnels_ = tunnelsBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.getDefaultInstance()) return this; if (tunnelsBuilder_ == null) { if (!other.tunnels_.isEmpty()) { if (tunnels_.isEmpty()) { tunnels_ = other.tunnels_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureTunnelsIsMutable(); tunnels_.addAll(other.tunnels_); } onChanged(); } } else { if (!other.tunnels_.isEmpty()) { if (tunnelsBuilder_.isEmpty()) { tunnelsBuilder_.dispose(); tunnelsBuilder_ = null; tunnels_ = other.tunnels_; bitField0_ = (bitField0_ & ~0x00000001); tunnelsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getTunnelsFieldBuilder() : null; } else { tunnelsBuilder_.addAllMessages(other.tunnels_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getTunnelsCount(); i++) { if (!getTunnels(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder(); input.readMessage(subBuilder, extensionRegistry); addTunnels(subBuilder.buildPartial()); break; } } } } private int bitField0_; // repeated .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnels = 1; private java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo> tunnels_ = java.util.Collections.emptyList(); private void ensureTunnelsIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { tunnels_ = new java.util.ArrayList<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo>(tunnels_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> tunnelsBuilder_; public java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo> getTunnelsList() { if (tunnelsBuilder_ == null) { return java.util.Collections.unmodifiableList(tunnels_); } else { return tunnelsBuilder_.getMessageList(); } } public int getTunnelsCount() { if (tunnelsBuilder_ == null) { return tunnels_.size(); } else { return tunnelsBuilder_.getCount(); } } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnels(int index) { if (tunnelsBuilder_ == null) { return tunnels_.get(index); } else { return tunnelsBuilder_.getMessage(index); } } public Builder setTunnels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { if (tunnelsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTunnelsIsMutable(); tunnels_.set(index, value); onChanged(); } else { tunnelsBuilder_.setMessage(index, value); } return this; } public Builder setTunnels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { if (tunnelsBuilder_ == null) { ensureTunnelsIsMutable(); tunnels_.set(index, builderForValue.build()); onChanged(); } else { tunnelsBuilder_.setMessage(index, builderForValue.build()); } return this; } public Builder addTunnels(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { if (tunnelsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTunnelsIsMutable(); tunnels_.add(value); onChanged(); } else { tunnelsBuilder_.addMessage(value); } return this; } public Builder addTunnels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { if (tunnelsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTunnelsIsMutable(); tunnels_.add(index, value); onChanged(); } else { tunnelsBuilder_.addMessage(index, value); } return this; } public Builder addTunnels( com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { if (tunnelsBuilder_ == null) { ensureTunnelsIsMutable(); tunnels_.add(builderForValue.build()); onChanged(); } else { tunnelsBuilder_.addMessage(builderForValue.build()); } return this; } public Builder addTunnels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { if (tunnelsBuilder_ == null) { ensureTunnelsIsMutable(); tunnels_.add(index, builderForValue.build()); onChanged(); } else { tunnelsBuilder_.addMessage(index, builderForValue.build()); } return this; } public Builder addAllTunnels( java.lang.Iterable<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo> values) { if (tunnelsBuilder_ == null) { ensureTunnelsIsMutable(); super.addAll(values, tunnels_); onChanged(); } else { tunnelsBuilder_.addAllMessages(values); } return this; } public Builder clearTunnels() { if (tunnelsBuilder_ == null) { tunnels_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { tunnelsBuilder_.clear(); } return this; } public Builder removeTunnels(int index) { if (tunnelsBuilder_ == null) { ensureTunnelsIsMutable(); tunnels_.remove(index); onChanged(); } else { tunnelsBuilder_.remove(index); } return this; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder getTunnelsBuilder( int index) { return getTunnelsFieldBuilder().getBuilder(index); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelsOrBuilder( int index) { if (tunnelsBuilder_ == null) { return tunnels_.get(index); } else { return tunnelsBuilder_.getMessageOrBuilder(index); } } public java.util.List<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> getTunnelsOrBuilderList() { if (tunnelsBuilder_ != null) { return tunnelsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(tunnels_); } } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder addTunnelsBuilder() { return getTunnelsFieldBuilder().addBuilder( com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder addTunnelsBuilder( int index) { return getTunnelsFieldBuilder().addBuilder( index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()); } public java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder> getTunnelsBuilderList() { return getTunnelsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> getTunnelsFieldBuilder() { if (tunnelsBuilder_ == null) { tunnelsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder>( tunnels_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); tunnels_ = null; } return tunnelsBuilder_; } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelResponse) } static { defaultInstance = new ListTunnelResponse(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelResponse) } public interface DescribeTunnelRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string table_name = 1; boolean hasTableName(); String getTableName(); // required string tunnel_name = 2; boolean hasTunnelName(); String getTunnelName(); // optional string tunnel_id = 3; boolean hasTunnelId(); String getTunnelId(); } public static final class DescribeTunnelRequest extends com.google.protobuf.GeneratedMessage implements DescribeTunnelRequestOrBuilder { // Use DescribeTunnelRequest.newBuilder() to construct. private DescribeTunnelRequest(Builder builder) { super(builder); } private DescribeTunnelRequest(boolean noInit) {} private static final DescribeTunnelRequest defaultInstance; public static DescribeTunnelRequest getDefaultInstance() { return defaultInstance; } public DescribeTunnelRequest getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_fieldAccessorTable; } private int bitField0_; // required string table_name = 1; public static final int TABLE_NAME_FIELD_NUMBER = 1; private java.lang.Object tableName_; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tableName_ = s; } return s; } } private com.google.protobuf.ByteString getTableNameBytes() { java.lang.Object ref = tableName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tableName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string tunnel_name = 2; public static final int TUNNEL_NAME_FIELD_NUMBER = 2; private java.lang.Object tunnelName_; public boolean hasTunnelName() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelName_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelNameBytes() { java.lang.Object ref = tunnelName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string tunnel_id = 3; public static final int TUNNEL_ID_FIELD_NUMBER = 3; private java.lang.Object tunnelId_; public boolean hasTunnelId() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelId_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelIdBytes() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { tableName_ = ""; tunnelName_ = ""; tunnelId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTableName()) { memoizedIsInitialized = 0; return false; } if (!hasTunnelName()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTableNameBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getTunnelNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getTunnelIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTableNameBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getTunnelNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getTunnelIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); tableName_ = ""; bitField0_ = (bitField0_ & ~0x00000001); tunnelName_ = ""; bitField0_ = (bitField0_ & ~0x00000002); tunnelId_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tableName_ = tableName_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.tunnelName_ = tunnelName_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.tunnelId_ = tunnelId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.getDefaultInstance()) return this; if (other.hasTableName()) { setTableName(other.getTableName()); } if (other.hasTunnelName()) { setTunnelName(other.getTunnelName()); } if (other.hasTunnelId()) { setTunnelId(other.getTunnelId()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTableName()) { return false; } if (!hasTunnelName()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; tableName_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; tunnelName_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; tunnelId_ = input.readBytes(); break; } } } } private int bitField0_; // required string table_name = 1; private java.lang.Object tableName_ = ""; public boolean hasTableName() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTableName() { java.lang.Object ref = tableName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tableName_ = s; return s; } else { return (String) ref; } } public Builder setTableName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; tableName_ = value; onChanged(); return this; } public Builder clearTableName() { bitField0_ = (bitField0_ & ~0x00000001); tableName_ = getDefaultInstance().getTableName(); onChanged(); return this; } void setTableName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; tableName_ = value; onChanged(); } // required string tunnel_name = 2; private java.lang.Object tunnelName_ = ""; public boolean hasTunnelName() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getTunnelName() { java.lang.Object ref = tunnelName_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelName_ = s; return s; } else { return (String) ref; } } public Builder setTunnelName(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; tunnelName_ = value; onChanged(); return this; } public Builder clearTunnelName() { bitField0_ = (bitField0_ & ~0x00000002); tunnelName_ = getDefaultInstance().getTunnelName(); onChanged(); return this; } void setTunnelName(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000002; tunnelName_ = value; onChanged(); } // optional string tunnel_id = 3; private java.lang.Object tunnelId_ = ""; public boolean hasTunnelId() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelId_ = s; return s; } else { return (String) ref; } } public Builder setTunnelId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; tunnelId_ = value; onChanged(); return this; } public Builder clearTunnelId() { bitField0_ = (bitField0_ & ~0x00000004); tunnelId_ = getDefaultInstance().getTunnelId(); onChanged(); return this; } void setTunnelId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000004; tunnelId_ = value; onChanged(); } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelRequest) } static { defaultInstance = new DescribeTunnelRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelRequest) } public interface ChannelInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string channel_id = 1; boolean hasChannelId(); String getChannelId(); // optional string channel_type = 2; boolean hasChannelType(); String getChannelType(); // optional string channel_status = 3; boolean hasChannelStatus(); String getChannelStatus(); // optional string client_id = 4; boolean hasClientId(); String getClientId(); // optional int64 channel_rpo = 5; boolean hasChannelRpo(); long getChannelRpo(); // optional int64 channel_count = 6; boolean hasChannelCount(); long getChannelCount(); } public static final class ChannelInfo extends com.google.protobuf.GeneratedMessage implements ChannelInfoOrBuilder { // Use ChannelInfo.newBuilder() to construct. private ChannelInfo(Builder builder) { super(builder); } private ChannelInfo(boolean noInit) {} private static final ChannelInfo defaultInstance; public static ChannelInfo getDefaultInstance() { return defaultInstance; } public ChannelInfo getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_fieldAccessorTable; } private int bitField0_; // required string channel_id = 1; public static final int CHANNEL_ID_FIELD_NUMBER = 1; private java.lang.Object channelId_; public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getChannelId() { java.lang.Object ref = channelId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { channelId_ = s; } return s; } } private com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string channel_type = 2; public static final int CHANNEL_TYPE_FIELD_NUMBER = 2; private java.lang.Object channelType_; public boolean hasChannelType() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getChannelType() { java.lang.Object ref = channelType_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { channelType_ = s; } return s; } } private com.google.protobuf.ByteString getChannelTypeBytes() { java.lang.Object ref = channelType_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); channelType_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string channel_status = 3; public static final int CHANNEL_STATUS_FIELD_NUMBER = 3; private java.lang.Object channelStatus_; public boolean hasChannelStatus() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getChannelStatus() { java.lang.Object ref = channelStatus_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { channelStatus_ = s; } return s; } } private com.google.protobuf.ByteString getChannelStatusBytes() { java.lang.Object ref = channelStatus_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); channelStatus_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string client_id = 4; public static final int CLIENT_ID_FIELD_NUMBER = 4; private java.lang.Object clientId_; public boolean hasClientId() { return ((bitField0_ & 0x00000008) == 0x00000008); } public String getClientId() { java.lang.Object ref = clientId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { clientId_ = s; } return s; } } private com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int64 channel_rpo = 5; public static final int CHANNEL_RPO_FIELD_NUMBER = 5; private long channelRpo_; public boolean hasChannelRpo() { return ((bitField0_ & 0x00000010) == 0x00000010); } public long getChannelRpo() { return channelRpo_; } // optional int64 channel_count = 6; public static final int CHANNEL_COUNT_FIELD_NUMBER = 6; private long channelCount_; public boolean hasChannelCount() { return ((bitField0_ & 0x00000020) == 0x00000020); } public long getChannelCount() { return channelCount_; } private void initFields() { channelId_ = ""; channelType_ = ""; channelStatus_ = ""; clientId_ = ""; channelRpo_ = 0L; channelCount_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChannelId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getChannelTypeBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getChannelStatusBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getClientIdBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt64(5, channelRpo_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt64(6, channelCount_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getChannelTypeBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getChannelStatusBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getClientIdBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(5, channelRpo_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(6, channelCount_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); channelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); channelType_ = ""; bitField0_ = (bitField0_ & ~0x00000002); channelStatus_ = ""; bitField0_ = (bitField0_ & ~0x00000004); clientId_ = ""; bitField0_ = (bitField0_ & ~0x00000008); channelRpo_ = 0L; bitField0_ = (bitField0_ & ~0x00000010); channelCount_ = 0L; bitField0_ = (bitField0_ & ~0x00000020); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.channelId_ = channelId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.channelType_ = channelType_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.channelStatus_ = channelStatus_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.clientId_ = clientId_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.channelRpo_ = channelRpo_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.channelCount_ = channelCount_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance()) return this; if (other.hasChannelId()) { setChannelId(other.getChannelId()); } if (other.hasChannelType()) { setChannelType(other.getChannelType()); } if (other.hasChannelStatus()) { setChannelStatus(other.getChannelStatus()); } if (other.hasClientId()) { setClientId(other.getClientId()); } if (other.hasChannelRpo()) { setChannelRpo(other.getChannelRpo()); } if (other.hasChannelCount()) { setChannelCount(other.getChannelCount()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChannelId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; channelId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; channelType_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; channelStatus_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; clientId_ = input.readBytes(); break; } case 40: { bitField0_ |= 0x00000010; channelRpo_ = input.readInt64(); break; } case 48: { bitField0_ |= 0x00000020; channelCount_ = input.readInt64(); break; } } } } private int bitField0_; // required string channel_id = 1; private java.lang.Object channelId_ = ""; public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getChannelId() { java.lang.Object ref = channelId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); channelId_ = s; return s; } else { return (String) ref; } } public Builder setChannelId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } public Builder clearChannelId() { bitField0_ = (bitField0_ & ~0x00000001); channelId_ = getDefaultInstance().getChannelId(); onChanged(); return this; } void setChannelId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; channelId_ = value; onChanged(); } // optional string channel_type = 2; private java.lang.Object channelType_ = ""; public boolean hasChannelType() { return ((bitField0_ & 0x00000002) == 0x00000002); } public String getChannelType() { java.lang.Object ref = channelType_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); channelType_ = s; return s; } else { return (String) ref; } } public Builder setChannelType(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; channelType_ = value; onChanged(); return this; } public Builder clearChannelType() { bitField0_ = (bitField0_ & ~0x00000002); channelType_ = getDefaultInstance().getChannelType(); onChanged(); return this; } void setChannelType(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000002; channelType_ = value; onChanged(); } // optional string channel_status = 3; private java.lang.Object channelStatus_ = ""; public boolean hasChannelStatus() { return ((bitField0_ & 0x00000004) == 0x00000004); } public String getChannelStatus() { java.lang.Object ref = channelStatus_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); channelStatus_ = s; return s; } else { return (String) ref; } } public Builder setChannelStatus(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; channelStatus_ = value; onChanged(); return this; } public Builder clearChannelStatus() { bitField0_ = (bitField0_ & ~0x00000004); channelStatus_ = getDefaultInstance().getChannelStatus(); onChanged(); return this; } void setChannelStatus(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000004; channelStatus_ = value; onChanged(); } // optional string client_id = 4; private java.lang.Object clientId_ = ""; public boolean hasClientId() { return ((bitField0_ & 0x00000008) == 0x00000008); } public String getClientId() { java.lang.Object ref = clientId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); clientId_ = s; return s; } else { return (String) ref; } } public Builder setClientId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; clientId_ = value; onChanged(); return this; } public Builder clearClientId() { bitField0_ = (bitField0_ & ~0x00000008); clientId_ = getDefaultInstance().getClientId(); onChanged(); return this; } void setClientId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000008; clientId_ = value; onChanged(); } // optional int64 channel_rpo = 5; private long channelRpo_ ; public boolean hasChannelRpo() { return ((bitField0_ & 0x00000010) == 0x00000010); } public long getChannelRpo() { return channelRpo_; } public Builder setChannelRpo(long value) { bitField0_ |= 0x00000010; channelRpo_ = value; onChanged(); return this; } public Builder clearChannelRpo() { bitField0_ = (bitField0_ & ~0x00000010); channelRpo_ = 0L; onChanged(); return this; } // optional int64 channel_count = 6; private long channelCount_ ; public boolean hasChannelCount() { return ((bitField0_ & 0x00000020) == 0x00000020); } public long getChannelCount() { return channelCount_; } public Builder setChannelCount(long value) { bitField0_ |= 0x00000020; channelCount_ = value; onChanged(); return this; } public Builder clearChannelCount() { bitField0_ = (bitField0_ & ~0x00000020); channelCount_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ChannelInfo) } static { defaultInstance = new ChannelInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ChannelInfo) } public interface DescribeTunnelResponseOrBuilder extends com.google.protobuf.MessageOrBuilder { // required .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnel = 1; boolean hasTunnel(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnel(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelOrBuilder(); // repeated .com.alicloud.openservices.tablestore.core.protocol.ChannelInfo channels = 2; java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo> getChannelsList(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getChannels(int index); int getChannelsCount(); java.util.List<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder> getChannelsOrBuilderList(); com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder getChannelsOrBuilder( int index); // optional int64 tunnel_rpo = 3; boolean hasTunnelRpo(); long getTunnelRpo(); } public static final class DescribeTunnelResponse extends com.google.protobuf.GeneratedMessage implements DescribeTunnelResponseOrBuilder { // Use DescribeTunnelResponse.newBuilder() to construct. private DescribeTunnelResponse(Builder builder) { super(builder); } private DescribeTunnelResponse(boolean noInit) {} private static final DescribeTunnelResponse defaultInstance; public static DescribeTunnelResponse getDefaultInstance() { return defaultInstance; } public DescribeTunnelResponse getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_fieldAccessorTable; } private int bitField0_; // required .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnel = 1; public static final int TUNNEL_FIELD_NUMBER = 1; private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo tunnel_; public boolean hasTunnel() { return ((bitField0_ & 0x00000001) == 0x00000001); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnel() { return tunnel_; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelOrBuilder() { return tunnel_; } // repeated .com.alicloud.openservices.tablestore.core.protocol.ChannelInfo channels = 2; public static final int CHANNELS_FIELD_NUMBER = 2; private java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo> channels_; public java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo> getChannelsList() { return channels_; } public java.util.List<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder> getChannelsOrBuilderList() { return channels_; } public int getChannelsCount() { return channels_.size(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getChannels(int index) { return channels_.get(index); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder getChannelsOrBuilder( int index) { return channels_.get(index); } // optional int64 tunnel_rpo = 3; public static final int TUNNEL_RPO_FIELD_NUMBER = 3; private long tunnelRpo_; public boolean hasTunnelRpo() { return ((bitField0_ & 0x00000002) == 0x00000002); } public long getTunnelRpo() { return tunnelRpo_; } private void initFields() { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); channels_ = java.util.Collections.emptyList(); tunnelRpo_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTunnel()) { memoizedIsInitialized = 0; return false; } if (!getTunnel().isInitialized()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getChannelsCount(); i++) { if (!getChannels(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, tunnel_); } for (int i = 0; i < channels_.size(); i++) { output.writeMessage(2, channels_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(3, tunnelRpo_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, tunnel_); } for (int i = 0; i < channels_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, channels_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, tunnelRpo_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getTunnelFieldBuilder(); getChannelsFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (tunnelBuilder_ == null) { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); } else { tunnelBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); if (channelsBuilder_ == null) { channels_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { channelsBuilder_.clear(); } tunnelRpo_ = 0L; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (tunnelBuilder_ == null) { result.tunnel_ = tunnel_; } else { result.tunnel_ = tunnelBuilder_.build(); } if (channelsBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { channels_ = java.util.Collections.unmodifiableList(channels_); bitField0_ = (bitField0_ & ~0x00000002); } result.channels_ = channels_; } else { result.channels_ = channelsBuilder_.build(); } if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000002; } result.tunnelRpo_ = tunnelRpo_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.getDefaultInstance()) return this; if (other.hasTunnel()) { mergeTunnel(other.getTunnel()); } if (channelsBuilder_ == null) { if (!other.channels_.isEmpty()) { if (channels_.isEmpty()) { channels_ = other.channels_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureChannelsIsMutable(); channels_.addAll(other.channels_); } onChanged(); } } else { if (!other.channels_.isEmpty()) { if (channelsBuilder_.isEmpty()) { channelsBuilder_.dispose(); channelsBuilder_ = null; channels_ = other.channels_; bitField0_ = (bitField0_ & ~0x00000002); channelsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getChannelsFieldBuilder() : null; } else { channelsBuilder_.addAllMessages(other.channels_); } } } if (other.hasTunnelRpo()) { setTunnelRpo(other.getTunnelRpo()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTunnel()) { return false; } if (!getTunnel().isInitialized()) { return false; } for (int i = 0; i < getChannelsCount(); i++) { if (!getChannels(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder(); if (hasTunnel()) { subBuilder.mergeFrom(getTunnel()); } input.readMessage(subBuilder, extensionRegistry); setTunnel(subBuilder.buildPartial()); break; } case 18: { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.newBuilder(); input.readMessage(subBuilder, extensionRegistry); addChannels(subBuilder.buildPartial()); break; } case 24: { bitField0_ |= 0x00000004; tunnelRpo_ = input.readInt64(); break; } } } } private int bitField0_; // required .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnel = 1; private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> tunnelBuilder_; public boolean hasTunnel() { return ((bitField0_ & 0x00000001) == 0x00000001); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnel() { if (tunnelBuilder_ == null) { return tunnel_; } else { return tunnelBuilder_.getMessage(); } } public Builder setTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { if (tunnelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } tunnel_ = value; onChanged(); } else { tunnelBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } public Builder setTunnel( com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { if (tunnelBuilder_ == null) { tunnel_ = builderForValue.build(); onChanged(); } else { tunnelBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } public Builder mergeTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { if (tunnelBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && tunnel_ != com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()) { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder(tunnel_).mergeFrom(value).buildPartial(); } else { tunnel_ = value; } onChanged(); } else { tunnelBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } public Builder clearTunnel() { if (tunnelBuilder_ == null) { tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); onChanged(); } else { tunnelBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder getTunnelBuilder() { bitField0_ |= 0x00000001; onChanged(); return getTunnelFieldBuilder().getBuilder(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelOrBuilder() { if (tunnelBuilder_ != null) { return tunnelBuilder_.getMessageOrBuilder(); } else { return tunnel_; } } private com.google.protobuf.SingleFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> getTunnelFieldBuilder() { if (tunnelBuilder_ == null) { tunnelBuilder_ = new com.google.protobuf.SingleFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder>( tunnel_, getParentForChildren(), isClean()); tunnel_ = null; } return tunnelBuilder_; } // repeated .com.alicloud.openservices.tablestore.core.protocol.ChannelInfo channels = 2; private java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo> channels_ = java.util.Collections.emptyList(); private void ensureChannelsIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { channels_ = new java.util.ArrayList<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo>(channels_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder> channelsBuilder_; public java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo> getChannelsList() { if (channelsBuilder_ == null) { return java.util.Collections.unmodifiableList(channels_); } else { return channelsBuilder_.getMessageList(); } } public int getChannelsCount() { if (channelsBuilder_ == null) { return channels_.size(); } else { return channelsBuilder_.getCount(); } } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getChannels(int index) { if (channelsBuilder_ == null) { return channels_.get(index); } else { return channelsBuilder_.getMessage(index); } } public Builder setChannels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo value) { if (channelsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelsIsMutable(); channels_.set(index, value); onChanged(); } else { channelsBuilder_.setMessage(index, value); } return this; } public Builder setChannels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder builderForValue) { if (channelsBuilder_ == null) { ensureChannelsIsMutable(); channels_.set(index, builderForValue.build()); onChanged(); } else { channelsBuilder_.setMessage(index, builderForValue.build()); } return this; } public Builder addChannels(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo value) { if (channelsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelsIsMutable(); channels_.add(value); onChanged(); } else { channelsBuilder_.addMessage(value); } return this; } public Builder addChannels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo value) { if (channelsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelsIsMutable(); channels_.add(index, value); onChanged(); } else { channelsBuilder_.addMessage(index, value); } return this; } public Builder addChannels( com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder builderForValue) { if (channelsBuilder_ == null) { ensureChannelsIsMutable(); channels_.add(builderForValue.build()); onChanged(); } else { channelsBuilder_.addMessage(builderForValue.build()); } return this; } public Builder addChannels( int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder builderForValue) { if (channelsBuilder_ == null) { ensureChannelsIsMutable(); channels_.add(index, builderForValue.build()); onChanged(); } else { channelsBuilder_.addMessage(index, builderForValue.build()); } return this; } public Builder addAllChannels( java.lang.Iterable<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo> values) { if (channelsBuilder_ == null) { ensureChannelsIsMutable(); super.addAll(values, channels_); onChanged(); } else { channelsBuilder_.addAllMessages(values); } return this; } public Builder clearChannels() { if (channelsBuilder_ == null) { channels_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { channelsBuilder_.clear(); } return this; } public Builder removeChannels(int index) { if (channelsBuilder_ == null) { ensureChannelsIsMutable(); channels_.remove(index); onChanged(); } else { channelsBuilder_.remove(index); } return this; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder getChannelsBuilder( int index) { return getChannelsFieldBuilder().getBuilder(index); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder getChannelsOrBuilder( int index) { if (channelsBuilder_ == null) { return channels_.get(index); } else { return channelsBuilder_.getMessageOrBuilder(index); } } public java.util.List<? extends com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder> getChannelsOrBuilderList() { if (channelsBuilder_ != null) { return channelsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(channels_); } } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder addChannelsBuilder() { return getChannelsFieldBuilder().addBuilder( com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance()); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder addChannelsBuilder( int index) { return getChannelsFieldBuilder().addBuilder( index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance()); } public java.util.List<com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder> getChannelsBuilderList() { return getChannelsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder> getChannelsFieldBuilder() { if (channelsBuilder_ == null) { channelsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder>( channels_, ((bitField0_ & 0x00000002) == 0x00000002), getParentForChildren(), isClean()); channels_ = null; } return channelsBuilder_; } // optional int64 tunnel_rpo = 3; private long tunnelRpo_ ; public boolean hasTunnelRpo() { return ((bitField0_ & 0x00000004) == 0x00000004); } public long getTunnelRpo() { return tunnelRpo_; } public Builder setTunnelRpo(long value) { bitField0_ |= 0x00000004; tunnelRpo_ = value; onChanged(); return this; } public Builder clearTunnelRpo() { bitField0_ = (bitField0_ & ~0x00000004); tunnelRpo_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelResponse) } static { defaultInstance = new DescribeTunnelResponse(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelResponse) } public interface GetRpoRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional string tunnel_id = 1; boolean hasTunnelId(); String getTunnelId(); } public static final class GetRpoRequest extends com.google.protobuf.GeneratedMessage implements GetRpoRequestOrBuilder { // Use GetRpoRequest.newBuilder() to construct. private GetRpoRequest(Builder builder) { super(builder); } private GetRpoRequest(boolean noInit) {} private static final GetRpoRequest defaultInstance; public static GetRpoRequest getDefaultInstance() { return defaultInstance; } public GetRpoRequest getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_fieldAccessorTable; } private int bitField0_; // optional string tunnel_id = 1; public static final int TUNNEL_ID_FIELD_NUMBER = 1; private java.lang.Object tunnelId_; public boolean hasTunnelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { tunnelId_ = s; } return s; } } private com.google.protobuf.ByteString getTunnelIdBytes() { java.lang.Object ref = tunnelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); tunnelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { tunnelId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTunnelIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTunnelIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); tunnelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.tunnelId_ = tunnelId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.getDefaultInstance()) return this; if (other.hasTunnelId()) { setTunnelId(other.getTunnelId()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; tunnelId_ = input.readBytes(); break; } } } } private int bitField0_; // optional string tunnel_id = 1; private java.lang.Object tunnelId_ = ""; public boolean hasTunnelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } public String getTunnelId() { java.lang.Object ref = tunnelId_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); tunnelId_ = s; return s; } else { return (String) ref; } } public Builder setTunnelId(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; tunnelId_ = value; onChanged(); return this; } public Builder clearTunnelId() { bitField0_ = (bitField0_ & ~0x00000001); tunnelId_ = getDefaultInstance().getTunnelId(); onChanged(); return this; } void setTunnelId(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000001; tunnelId_ = value; onChanged(); } // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetRpoRequest) } static { defaultInstance = new GetRpoRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetRpoRequest) } public interface GetRpoResponseOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional bytes rpo_infos = 1; boolean hasRpoInfos(); com.google.protobuf.ByteString getRpoInfos(); // optional bytes tunnel_rpo_infos = 2; boolean hasTunnelRpoInfos(); com.google.protobuf.ByteString getTunnelRpoInfos(); } public static final class GetRpoResponse extends com.google.protobuf.GeneratedMessage implements GetRpoResponseOrBuilder { // Use GetRpoResponse.newBuilder() to construct. private GetRpoResponse(Builder builder) { super(builder); } private GetRpoResponse(boolean noInit) {} private static final GetRpoResponse defaultInstance; public static GetRpoResponse getDefaultInstance() { return defaultInstance; } public GetRpoResponse getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_fieldAccessorTable; } private int bitField0_; // optional bytes rpo_infos = 1; public static final int RPO_INFOS_FIELD_NUMBER = 1; private com.google.protobuf.ByteString rpoInfos_; public boolean hasRpoInfos() { return ((bitField0_ & 0x00000001) == 0x00000001); } public com.google.protobuf.ByteString getRpoInfos() { return rpoInfos_; } // optional bytes tunnel_rpo_infos = 2; public static final int TUNNEL_RPO_INFOS_FIELD_NUMBER = 2; private com.google.protobuf.ByteString tunnelRpoInfos_; public boolean hasTunnelRpoInfos() { return ((bitField0_ & 0x00000002) == 0x00000002); } public com.google.protobuf.ByteString getTunnelRpoInfos() { return tunnelRpoInfos_; } private void initFields() { rpoInfos_ = com.google.protobuf.ByteString.EMPTY; tunnelRpoInfos_ = com.google.protobuf.ByteString.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, rpoInfos_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, tunnelRpoInfos_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, rpoInfos_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, tunnelRpoInfos_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input, extensionRegistry)) { return builder.buildParsed(); } else { return null; } } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_fieldAccessorTable; } // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder(BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); rpoInfos_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); tunnelRpoInfos_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.getDescriptor(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse getDefaultInstanceForType() { return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.getDefaultInstance(); } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse build() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } return result; } public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse buildPartial() { com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.rpoInfos_ = rpoInfos_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.tunnelRpoInfos_ = tunnelRpoInfos_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse) { return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse other) { if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.getDefaultInstance()) return this; if (other.hasRpoInfos()) { setRpoInfos(other.getRpoInfos()); } if (other.hasTunnelRpoInfos()) { setTunnelRpoInfos(other.getTunnelRpoInfos()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: this.setUnknownFields(unknownFields.build()); onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { this.setUnknownFields(unknownFields.build()); onChanged(); return this; } break; } case 10: { bitField0_ |= 0x00000001; rpoInfos_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; tunnelRpoInfos_ = input.readBytes(); break; } } } } private int bitField0_; // optional bytes rpo_infos = 1; private com.google.protobuf.ByteString rpoInfos_ = com.google.protobuf.ByteString.EMPTY; public boolean hasRpoInfos() { return ((bitField0_
8,987
https://github.com/GalRogozinski/hornet/blob/master/pkg/config/graph_config.go
Github Open Source
Open Source
Apache-2.0
null
hornet
GalRogozinski
Go
Code
167
453
package config import ( flag "github.com/spf13/pflag" ) const ( // the path to the visualizer web assets CfgGraphWebRootPath = "graph.webRootPath" // the websocket URI to use (optional) CfgGraphWebSocketURI = "graph.webSocket.uri" // sets the domain name from which the visualizer is served from CfgGraphDomain = "graph.domain" // the bind address from which the visualizer can be accessed from CfgGraphBindAddress = "graph.bindAddress" // the name of the network to be shown on the visualizer site CfgGraphNetworkName = "graph.networkName" // the explorer transaction link CfgGraphExplorerTxLink = "graph.explorerTxLink" // the explorer bundle link CfgGraphExplorerBundleLink = "graph.explorerBundleLink" ) func init() { flag.String(CfgGraphWebRootPath, "IOTAtangle/webroot", "the path to the visualizer web assets") flag.String(CfgGraphWebSocketURI, "", "the websocket URI to use (optional)") flag.String(CfgGraphDomain, "", "sets the domain name from which the visualizer is served from") flag.String(CfgGraphBindAddress, "localhost:8083", "the bind address from which the visualizer can be accessed from") flag.String(CfgGraphNetworkName, "meets HORNET", "the name of the network to be shown on the visualizer site") flag.String(CfgGraphExplorerTxLink, "http://localhost:8081/explorer/tx/", "the explorer transaction link") flag.String(CfgGraphExplorerBundleLink, "http://localhost:8081/explorer/bundle/", "the explorer bundle link") }
31,768
https://github.com/apple4ever/promalertproxy/blob/master/t/alert.t
Github Open Source
Open Source
Artistic-1.0
null
promalertproxy
apple4ever
Perl
Code
146
589
#!/usr/bin/env perl use 5.028; use warnings; use experimental qw(signatures); use Test::Lib; use Test::PromAlertProxy; use Test::More; use Test::Time; use Date::Format qw(time2str); use PromAlertProxy::Alert; subtest "active alerts" => sub { my $now_alert = PromAlertProxy::Alert->new( labels => {}, annotations => {}, startsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()), endsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()+86400), generatorURL => '', ); ok($now_alert->is_active, "alert starting now is active"); my $ancient_past_alert = PromAlertProxy::Alert->new( labels => {}, annotations => {}, startsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()-86400), endsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()-43200), generatorURL => '', ); ok($ancient_past_alert->is_resolved, "alert finished long ago is resolved"); my $just_past_alert = PromAlertProxy::Alert->new( labels => {}, annotations => {}, startsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()-86400), endsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()-30), generatorURL => '', ); ok($just_past_alert->is_resolved, "alert just finished is resolved"); my $recent_past_alert = PromAlertProxy::Alert->new( labels => {}, annotations => {}, startsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()-86400), endsAt => time2str("%Y-%m-%dT%H:%M:%S%z", time()-90), generatorURL => '', ); ok($recent_past_alert->is_resolved, "alert finished a little while go is resolved"); }; done_testing;
31,338
https://github.com/nilax97/leetcode-solutions/blob/master/solutions/Course Schedule III/solution.py
Github Open Source
Open Source
MIT
2,021
leetcode-solutions
nilax97
Python
Code
41
112
class Solution: def scheduleCourse(self, courses: List[List[int]]) -> int: pq = [] start = 0 courses = sorted(courses, key= lambda x : x[1]) for t, end in courses: start += t heapq.heappush(pq, -t) while start > end: start += heapq.heappop(pq) return len(pq)
44,279
https://github.com/savvasth96/fructose/blob/master/src/main/java/fwcd/fructose/structs/WeakArrayList.java
Github Open Source
Open Source
MIT
2,019
fructose
savvasth96
Java
Code
890
2,849
package fwcd.fructose.structs; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; import java.util.stream.Collectors; /** * An {@link ArrayList}-based {@link List} implementation * that maintains weak references to its elements. */ public class WeakArrayList<T> implements List<T> { private final List<WeakReference<T>> entries; public WeakArrayList() { entries = new ArrayList<>(); } public WeakArrayList(Collection<? extends T> c) { entries = new ArrayList<>(c.size()); for (T entry : c) { entries.add(new WeakReference<>(entry)); } } private WeakArrayList(List<WeakReference<T>> delegate, boolean delegateDirectly) { if (delegateDirectly) { entries = delegate; } else { entries = new ArrayList<>(delegate); } } private void removeObsoleteEntries() { Iterator<WeakReference<T>> iterator = entries.iterator(); while (iterator.hasNext()) { WeakReference<T> ref = iterator.next(); if (ref.get() == null) { iterator.remove(); } } } @Override public int size() { removeObsoleteEntries(); return entries.size(); } @Override public boolean isEmpty() { removeObsoleteEntries(); return entries.isEmpty(); } @Override public boolean contains(Object o) { Iterator<WeakReference<T>> iterator = entries.iterator(); boolean containsElement = false; while (iterator.hasNext()) { T value = iterator.next().get(); if (value == null) { iterator.remove(); } else if (value.equals(o)) { containsElement = true; } } return containsElement; } @Override public Iterator<T> iterator() { return new Iterator<T>() { private final Iterator<WeakReference<T>> delegate = entries.iterator(); private T peeked = null; @Override public boolean hasNext() { // Advance the delegate iterator until a valid reference // was found or the iteration ended while (delegate.hasNext()) { peeked = delegate.next().get(); if (peeked != null) { return true; } } return false; } @Override public T next() { if (peeked != null) { T result = peeked; peeked = null; return result; } // Advance the delegate iterator until a valid reference // was found or the iteration ended while (delegate.hasNext()) { T value = delegate.next().get(); if (value != null) { return value; } } throw new NoSuchElementException("WeakArrayList.Iterator could not find a next element"); } }; } @Override public Object[] toArray() { return entries.stream() .filter(it -> it.get() != null) .map(WeakReference::get) .toArray(); } @Override public <A> A[] toArray(A[] a) { return entries.stream() .filter(it -> it.get() != null) .map(WeakReference::get) .collect(Collectors.toList()) .toArray(a); } @Override public boolean add(T e) { removeObsoleteEntries(); return entries.add(new WeakReference<T>(e)); } @Override public boolean remove(Object o) { Iterator<WeakReference<T>> iterator = entries.iterator(); boolean removed = false; while (iterator.hasNext()) { T value = iterator.next().get(); if (value == null) { iterator.remove(); } else if (value.equals(o)) { iterator.remove(); removed = true; } } return removed; } @Override public boolean containsAll(Collection<?> c) { for (Object value : c) { if (!contains(value)) { return false; } } return true; } @Override public boolean addAll(Collection<? extends T> c) { removeObsoleteEntries(); boolean changed = false; for (T value : c) { changed |= entries.add(new WeakReference<>(value)); } return changed; } @Override public boolean addAll(int index, Collection<? extends T> c) { removeObsoleteEntries(); for (T value : c) { entries.add(index, new WeakReference<>(value)); } return true; } @Override public boolean removeAll(Collection<?> c) { Iterator<WeakReference<T>> iterator = entries.iterator(); boolean removed = false; while (iterator.hasNext()) { T value = iterator.next().get(); if (value == null) { iterator.remove(); } else if (c.contains(value)) { iterator.remove(); removed = true; } } return removed; } @Override public boolean retainAll(Collection<?> c) { Iterator<WeakReference<T>> iterator = entries.iterator(); boolean removed = false; while (iterator.hasNext()) { T value = iterator.next().get(); if (value == null) { iterator.remove(); } else if (!c.contains(value)) { iterator.remove(); removed = true; } } return removed; } @Override public void clear() { entries.clear(); } @Override public T get(int index) { removeObsoleteEntries(); return entries.get(index).get(); } @Override public T set(int index, T element) { removeObsoleteEntries(); return entries.set(index, new WeakReference<>(element)).get(); } @Override public void add(int index, T element) { removeObsoleteEntries(); entries.add(index, new WeakReference<>(element)); } @Override public T remove(int index) { removeObsoleteEntries(); return entries.remove(index).get(); } @Override public int indexOf(Object o) { removeObsoleteEntries(); return entries.indexOf(o); } @Override public int lastIndexOf(Object o) { removeObsoleteEntries(); return entries.lastIndexOf(o); } @Override public ListIterator<T> listIterator() { removeObsoleteEntries(); return new ListIteratorImpl(entries.listIterator()); } @Override public ListIterator<T> listIterator(int index) { removeObsoleteEntries(); return new ListIteratorImpl(entries.listIterator(index)); } @Override public List<T> subList(int fromIndex, int toIndex) { removeObsoleteEntries(); return new WeakArrayList<>(entries.subList(fromIndex, toIndex), true); } private class ListIteratorImpl implements ListIterator<T> { private final ListIterator<WeakReference<T>> delegate; public ListIteratorImpl(ListIterator<WeakReference<T>> delegate) { this.delegate = delegate; } @Override public boolean hasNext() { return delegate.hasNext(); } @Override public T next() { return delegate.next().get(); } @Override public boolean hasPrevious() { return delegate.hasPrevious(); } @Override public T previous() { return delegate.previous().get(); } @Override public int nextIndex() { return delegate.nextIndex(); } @Override public int previousIndex() { return delegate.previousIndex(); } @Override public void remove() { delegate.remove(); } @Override public void set(T e) { delegate.set(new WeakReference<>(e)); } @Override public void add(T e) { delegate.add(new WeakReference<>(e)); } } @Override public int hashCode() { return 9 * entries.hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!getClass().equals(obj.getClass())) return false; WeakArrayList<?> other = (WeakArrayList<?>) obj; Iterator<T> thisIterator = iterator(); Iterator<?> otherIterator = other.iterator(); boolean thisHasNext; boolean otherHasNext; while (true) { thisHasNext = thisIterator.hasNext(); otherHasNext = otherIterator.hasNext(); if (thisHasNext && otherHasNext) { if (!thisIterator.next().equals(otherIterator.next())) { return false; } } else { // Only return true when both iterators have no more elements // left, otherwise one of the iterators has to be longer than // the other. return !thisHasNext && !otherHasNext; } } } @Override public String toString() { Iterator<WeakReference<T>> iterator = entries.iterator(); StringBuilder str = new StringBuilder().append('['); while (iterator.hasNext()) { T value = iterator.next().get(); if (value == null) { iterator.remove(); } else { str.append(value).append(", "); } } return str .delete(str.length() - 2, str.length()) .append(']') .toString(); } }
11,949
https://github.com/kfarnung/advent-of-code/blob/master/2018/day04/day04.py
Github Open Source
Open Source
MIT
2,017
advent-of-code
kfarnung
Python
Code
293
1,040
""" Implementation for Advent of Code Day 4. https://adventofcode.com/2018/day/4 """ from __future__ import print_function import re from collections import defaultdict _INSTRUCTION_REGEX = re.compile( r"^\[(\d{4}-\d{2}-\d{2} \d{2}:(\d{2}))] (Guard #(\d+) begins shift|.+)$") class GuardAction: """Represents a single action by a single guard""" def __init__(self, instruction): match = _INSTRUCTION_REGEX.match(instruction) assert match is not None self.time = match.group(1) self.minute = int(match.group(2)) self.event = match.group(3) self.guard_id = int(match.group(4)) if match.group(4) else None def __lt__(self, other): return self.time < other.time class Guard: """Represents the aggregate actions of a single guard""" def __init__(self, guard_id): self.guard_id = guard_id self.sleep_minutes = defaultdict(int) self.total_sleep = 0 def add_sleep_event(self, sleep, wake): """Logs a sleep event for the guard""" self.total_sleep += wake - sleep for minute in range(sleep, wake): self.sleep_minutes[minute] += 1 def get_sleepiest_minute(self): """Finds the sleepiest minute for the guard""" if self.sleep_minutes: return max(self.sleep_minutes, key=self.sleep_minutes.get) return None def get_sleepiest_count(self): """Gets the frequency of the sleepiest minute for the guard""" sleepiest_minute = self.get_sleepiest_minute() if sleepiest_minute is not None: return self.sleep_minutes[sleepiest_minute] return 0 def _parse_input(inputs): guard_map = {} guard = None sleep_minute = None for action in sorted(GuardAction(action) for action in inputs): if action.guard_id is not None: if action.guard_id in guard_map: guard = guard_map[action.guard_id] else: guard = Guard(action.guard_id) guard_map[action.guard_id] = guard elif 'sleep' in action.event: assert sleep_minute is None sleep_minute = action.minute elif 'wake' in action.event: guard.add_sleep_event(sleep_minute, action.minute) sleep_minute = None else: assert False return guard_map def run_part1(inputs): """Implmentation for Part 1.""" sleepiest_guard = max( _parse_input(inputs).values(), key=lambda item: item.total_sleep, ) return sleepiest_guard.guard_id * sleepiest_guard.get_sleepiest_minute() def run_part2(inputs): """Implmentation for Part 2.""" sleepiest_guard = max( _parse_input(inputs).values(), key=lambda item: item.get_sleepiest_count(), ) return sleepiest_guard.guard_id * sleepiest_guard.get_sleepiest_minute() if __name__ == "__main__": import sys def run(input_path): """The main function.""" with open(input_path, 'r') as input_file: file_content = input_file.readlines() print("Part 1: {}".format(run_part1(file_content))) print("Part 2: {}".format(run_part2(file_content))) if len(sys.argv) < 2: print("Usage: python {} <input>".format(sys.argv[0])) sys.exit(1) run(sys.argv[1])
21,016
https://github.com/Roxza/Personal/blob/master/src/components/Warning.vue
Github Open Source
Open Source
MIT
2,021
Personal
Roxza
Vue
Code
55
193
<template> <div class="w-200"> <div class="h-13 text-white px-4 py-3 rounded relative w-full" role="alert" style="background-color: #c02828; text-align: center" > <span style="padding-right: 0.25rem" class="float-left block sm:inline"> <i class="fad fa-exclamation-triangle"></i> {{ title }}</span > </div> </div> </template> <script> import Vue from 'vue' export default Vue.extend({ props: { title: { type: String, required: false, default: '', }, }, }) </script>
39,647
https://github.com/1a2s3d4f1/TIS-3D/blob/master/src/main/java/li/cil/tis3d/util/datafix/fixes/TileEntityLeadingWhitespace.java
Github Open Source
Open Source
CC0-1.0
null
TIS-3D
1a2s3d4f1
Java
Code
118
468
package li.cil.tis3d.util.datafix.fixes; import li.cil.tis3d.api.API; import li.cil.tis3d.common.Constants; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.datafix.IFixableData; import net.minecraftforge.common.util.Constants.NBT; import java.util.Objects; public final class TileEntityLeadingWhitespace implements IFixableData { private static final String TAG_ID = "id"; private static final String LEADING_WHITESPACE_CASING_ID = API.MOD_ID + ": " + Constants.NAME_BLOCK_CASING; private static final String CASING_ID = API.MOD_ID + ':' + Constants.NAME_BLOCK_CASING; private static final String LEADING_WHITESPACE_CONTROLLER_ID = API.MOD_ID + ": " + Constants.NAME_BLOCK_CONTROLLER; private static final String CONTROLLER_ID = API.MOD_ID + ':' + Constants.NAME_BLOCK_CONTROLLER; @Override public int getFixVersion() { return 1; } @Override public NBTTagCompound fixTagCompound(final NBTTagCompound compound) { if (compound.hasKey(TAG_ID, NBT.TAG_STRING)) { final String id = compound.getString(TAG_ID); if (Objects.equals(id, LEADING_WHITESPACE_CASING_ID)) { compound.setString(TAG_ID, CASING_ID); } else if (Objects.equals(id, LEADING_WHITESPACE_CONTROLLER_ID)) { compound.setString(TAG_ID, CONTROLLER_ID); } } return compound; } }
41,674
https://github.com/dozenow/shortcut/blob/master/eglibc-2.15/math/w_sinh.c
Github Open Source
Open Source
LGPL-2.1-only, GPL-2.0-only, LicenseRef-scancode-inner-net-2.0, BSD-3-Clause, LGPL-2.1-or-later, HPND, LicenseRef-scancode-other-copyleft, CMU-Mach, LicenseRef-scancode-other-permissive, BSD-2-Clause
2,019
shortcut
dozenow
C
Code
108
279
/* @(#)w_sinh.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* * wrapper sinh(x) */ #include <math.h> #include <math_private.h> double __sinh (double x) { double z = __ieee754_sinh (x); if (__builtin_expect (!__finite (z), 0) && __finite (x) && _LIB_VERSION != _IEEE_) return __kernel_standard (x, x, 25); /* sinh overflow */ return z; } weak_alias (__sinh, sinh) #ifdef NO_LONG_DOUBLE strong_alias (__sinh, __sinhl) weak_alias (__sinh, sinhl) #endif
38,535
https://github.com/zhouruizhong/crm/blob/master/src/main/java/com/zrz/crm/web/config/advice/WebResponseBody.java
Github Open Source
Open Source
Apache-2.0
null
crm
zhouruizhong
Java
Code
193
844
package com.zrz.crm.web.config.advice; import com.zrz.crm.utils.JsonUtil; import com.zrz.crm.web.config.SwaggerConfig; import com.zrz.crm.web.config.annotation.ResponseAdvice; import com.zrz.crm.web.config.enums.ResponseAdviceEnum; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; import javax.annotation.Nonnull; import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Method; /** * 统一响应、异常配置 * * @author qcdl * @date 2019/6/5 */ @RestControllerAdvice @Slf4j public class WebResponseBody implements ResponseBodyAdvice<Object> { @ExceptionHandler(value = Exception.class) public ResultInfo<String> handle(HttpServletRequest request, Exception e) { ResultInfo<String> resultInfo = new ResultInfo<>(ExceptionEnum.Exception.getCode(), null, ExceptionEnum.Exception.getMsg()); if (e instanceof WebException) { WebException webException = (WebException) e; resultInfo.setCode(webException.getCode()); resultInfo.setMsg(webException.getMsg()); } e.printStackTrace(); return resultInfo; } @Override public boolean supports(@Nonnull MethodParameter returnType, @Nonnull Class<? extends HttpMessageConverter<?>> converterType) { return true; } @Override public Object beforeBodyWrite(Object body, @Nonnull MethodParameter returnType, @Nonnull MediaType selectedContentType, @Nonnull Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, @Nonnull ServerHttpResponse response) { String uri = request.getURI().toString(); if (StringUtils.containsIgnoreCase(uri, SwaggerConfig.SWAGGER_NAME_SYMBOL) || StringUtils.containsIgnoreCase(uri, SwaggerConfig.SWAGGER_API_DOCS_SYMBOL)) { return body; } Method method = returnType.getMethod(); if (method != null && method.getAnnotation(ResponseAdvice.class) != null) { ResponseAdviceEnum responseAdviceEnum = method.getAnnotation(ResponseAdvice.class).value(); if (responseAdviceEnum == ResponseAdviceEnum.NOT_REQUIRED) { return body; } } if (body instanceof ResultInfo) { return body; } ResultInfo result = new ResultInfo<>(ExceptionEnum.Success.getCode(), body, ExceptionEnum.Success.getMsg()); if (body instanceof String) { return JsonUtil.getInstance().toJsonString(result); } return result; } }
13,154
https://github.com/cupy/cupy/blob/master/tests/cupyx_tests/scipy_tests/ndimage_tests/test_distance_transform.py
Github Open Source
Open Source
MIT, LicenseRef-scancode-unknown-license-reference
2,023
cupy
cupy
Python
Code
1,082
4,136
import copy import numpy import pytest import cupy from cupy import testing import cupyx.scipy.ndimage # NOQA try: import scipy.ndimage # NOQA except ImportError: pass @testing.with_requires('scipy') class TestDistanceTransform: def _binary_image(self, shape, xp=cupy, pct_true=50): # cupy and numpy random streams don't match so generate with CuPy only rng = cupy.random.default_rng(123) x = rng.integers(0, 100, size=shape, dtype=xp.uint8) img = x >= pct_true if xp == numpy: img = cupy.asnumpy(img) return img def _assert_percentile_equal(self, arr1, arr2, pct=95): """Assert a target percentage of arr1 and arr2 are equal.""" pct_mismatch = (100 - pct) / 100 arr1 = cupy.asnumpy(arr1) arr2 = cupy.asnumpy(arr2) mismatch = numpy.sum(arr1 != arr2) / arr1.size assert mismatch < pct_mismatch @pytest.mark.parametrize('return_indices', [False, True]) @pytest.mark.parametrize('return_distances', [False, True]) @pytest.mark.parametrize( 'shape, sampling', [ ((256, 128), None), ((384, 256), (1.5, 1.5)), ((384, 256), (3, 2)), # integer-valued anisotropic ((384, 256), (2.25, .85)), ((14, 32, 50), None), ((50, 32, 24), (2., 2., 2.)), ((50, 32, 24), (3, 1, 2)), # integer-valued anisotropic ], ) @pytest.mark.parametrize('density', ['single_point', 5, 50, 95]) @pytest.mark.parametrize('block_params', [None, (1, 1, 1)]) def test_distance_transform_edt_basic( self, shape, sampling, return_distances, return_indices, density, block_params ): # Note: Not using @numpy_cupy_allclose because indices array # comparisons need a custom function to check. if not (return_indices or return_distances): return kwargs_scipy = dict( sampling=sampling, return_distances=return_distances, return_indices=return_indices, ) kwargs_cucim = copy.copy(kwargs_scipy) kwargs_cucim['block_params'] = block_params if density == 'single_point': img = cupy.ones(shape, dtype=bool) img[tuple(s // 2 for s in shape)] = 0 else: img = self._binary_image(shape, pct_true=density) dt_gpu = cupyx.scipy.ndimage.distance_transform_edt dt_cpu = scipy.ndimage.distance_transform_edt out = dt_gpu(img, **kwargs_cucim) expected = dt_cpu(cupy.asnumpy(img), **kwargs_scipy) if sampling is None: target_pct = 95 else: target_pct = 90 if return_indices and return_distances: assert len(out) == 2 cupy.testing.assert_allclose(out[0], expected[0], rtol=1e-6) # May differ at a small % of coordinates where multiple points were # equidistant. self._assert_percentile_equal(out[1], expected[1], pct=target_pct) elif return_distances: cupy.testing.assert_allclose(out, expected, rtol=1e-6) elif return_indices: self._assert_percentile_equal(out, expected, pct=target_pct) @pytest.mark.parametrize( # Fine sampling of shapes to make sure kernels are robust to all shapes 'shape', ( [(s,) * 2 for s in range(512, 512 + 32)] + [(s,) * 2 for s in range(1024, 1024 + 16)] + [(s,) * 2 for s in range(2050, 2050)] + [(s,) * 2 for s in range(4100, 4100)] ), ) @pytest.mark.parametrize('density', [2, 98]) @pytest.mark.parametrize('float64_distances', [False, True]) @testing.numpy_cupy_allclose(scipy_name='scp') def test_distance_transform_edt_additional_shapes( self, xp, scp, shape, density, float64_distances ): kwargs = dict(return_distances=True, return_indices=False) if xp == cupy: # test CuPy-specific behavior allowing float32 distances kwargs['float64_distances'] = float64_distances img = self._binary_image(shape, xp=xp, pct_true=density) distances = scp.ndimage.distance_transform_edt(img, **kwargs) if not float64_distances and xp == cupy: assert distances.dtype == cupy.float32 # cast to same dtype as numpy for numpy_cupy_allclose comparison distances = distances.astype(cupy.float64) return distances @pytest.mark.parametrize( 'shape', [(s,) * 2 for s in range(1024, 1024 + 4)], ) @pytest.mark.parametrize( 'block_params', [(1, 1, 1), (5, 4, 2), (3, 8, 4), (7, 16, 1), (11, 32, 3), (1, 1, 16)] ) @testing.numpy_cupy_allclose(scipy_name='scp') def test_distance_transform_edt_block_params(self, xp, scp, shape, block_params): kwargs = dict(return_distances=True, return_indices=False) if xp == cupy: # testing different block size parameters for the raw kernels kwargs['block_params'] = block_params img = self._binary_image(shape, xp=xp, pct_true=4) return scp.ndimage.distance_transform_edt(img, **kwargs) @pytest.mark.parametrize( 'block_params', [ (0, 1, 1), (1, 0, 1), (1, 1, 0), # no elements can be < 1 (1, 3, 1), (1, 5, 1), (1, 7, 1), # 2nd element must be power of 2 (128, 1, 1), # m1 too large for the array size (1, 128, 1), # m2 too large for the array size (1, 1, 128), # m3 too large for the array size ] ) def test_distance_transform_edt_block_params_invalid(self, block_params): img = self._binary_image((512, 512), xp=cupy, pct_true=4) with pytest.raises(ValueError): cupyx.scipy.ndimage.distance_transform_edt( img, block_params=block_params ) @pytest.mark.parametrize('value', [0, 1, 3]) @pytest.mark.parametrize('ndim', [2, 3]) @testing.numpy_cupy_allclose(scipy_name='scp') def test_distance_transform_edt_uniform_valued(self, xp, scp, value, ndim): """ensure default block_params is robust to anisotropic shape.""" img = xp.full((48, ) * ndim, value, dtype=cupy.uint8) # ensure there is at least 1 pixel at background intensity img[(slice(24, 25),) * ndim] = 0 return scp.ndimage.distance_transform_edt(img) @pytest.mark.parametrize('sx', list(range(16))) @pytest.mark.parametrize('sy', list(range(16))) @testing.numpy_cupy_allclose(scipy_name='scp') def test_distance_transform_edt_2d_aniso(self, xp, scp, sx, sy): """ensure default block_params is robust to anisotropic shape.""" shape = (128 + sy, 128 + sx) img = self._binary_image(shape, xp=xp, pct_true=80) return scp.ndimage.distance_transform_edt(img) @pytest.mark.parametrize('sx', list(range(4))) @pytest.mark.parametrize('sy', list(range(4))) @pytest.mark.parametrize('sz', list(range(4))) @testing.numpy_cupy_allclose(scipy_name='scp') def test_distance_transform_edt_3d_aniso(self, xp, scp, sx, sy, sz): """ensure default block_params is robust to anisotropic shape.""" shape = (16 + sz, 32 + sy, 48 + sx) img = self._binary_image(shape, xp=xp, pct_true=80) return scp.ndimage.distance_transform_edt(img) @pytest.mark.parametrize('ndim', [2, 3]) @pytest.mark.parametrize('sampling', [None, 'iso', 'aniso']) @testing.numpy_cupy_allclose(scipy_name='scp') def test_distance_transform_inplace_distance(self, xp, scp, ndim, sampling): img = self._binary_image((32, ) * ndim, xp=xp, pct_true=80) distances = xp.empty(img.shape, dtype=xp.float64) if sampling == 'iso': sampling = (1.5,) * ndim elif sampling == 'aniso': sampling = tuple(range(1, ndim + 1)) scp.ndimage.distance_transform_edt(img, sampling=sampling, distances=distances) return distances @pytest.mark.parametrize('ndim', [2, 3]) def test_distance_transform_inplace_distance_errors(self, ndim): img = self._binary_image((32, ) * ndim, xp=cupy, pct_true=80) dt_func = cupyx.scipy.ndimage.distance_transform_edt # for binary input, distances output is float32. Other dtypes raise with pytest.raises(RuntimeError): distances = cupy.empty(img.shape, dtype=cupy.float64) dt_func(img, distances=distances, float64_distances=False) with pytest.raises(RuntimeError): distances = cupy.empty(img.shape, dtype=cupy.int32) dt_func(img, distances=distances) # wrong shape with pytest.raises(RuntimeError): distances = cupy.empty(img.shape + (2,), dtype=cupy.float64) dt_func(img, distances=distances) # can't provide indices array when return_indices is False with pytest.raises(RuntimeError): distances = cupy.empty(img.shape, dtype=cupy.float64) dt_func(img, distances=distances, return_distances=False, return_indices=True) @pytest.mark.parametrize('ndim', [2, 3]) @pytest.mark.parametrize('sampling', [None, 'iso', 'aniso']) @pytest.mark.parametrize('dtype', [cupy.int16, cupy.uint16, cupy.uint32, cupy.int32, cupy.uint64, cupy.int64]) @pytest.mark.parametrize('return_distances', [False, True]) def test_distance_transform_inplace_indices( self, ndim, sampling, dtype, return_distances ): img = self._binary_image((32, ) * ndim, xp=cupy, pct_true=80) if ndim == 3 and dtype in [cupy.int16, cupy.uint16]: pytest.skip(reason="3D requires at least 32-bit integer output") if sampling == 'iso': sampling = (1.5,) * ndim elif sampling == 'aniso': sampling = tuple(range(1, ndim + 1)) common_kwargs = dict( sampling=sampling, return_distances=return_distances, return_indices=True ) # verify that in-place and out-of-place results agree indices = cupy.empty((ndim,) + img.shape, dtype=dtype) dt_func = cupyx.scipy.ndimage.distance_transform_edt dt_func(img, indices=indices, **common_kwargs) expected = dt_func(img, **common_kwargs) if return_distances: cupy.testing.assert_array_equal(indices, expected[1]) else: cupy.testing.assert_array_equal(indices, expected) @pytest.mark.parametrize('ndim', [2, 3]) def test_distance_transform_inplace_indices_errors(self, ndim): img = self._binary_image((32, ) * ndim, pct_true=80) common_kwargs = dict(return_distances=False, return_indices=True) dt_func = cupyx.scipy.ndimage.distance_transform_edt # int8 has itemsize too small with pytest.raises(RuntimeError): indices = cupy.empty((ndim,) + img.shape, dtype=cupy.int8) dt_func(img, indices=indices, **common_kwargs) # float not allowed with pytest.raises(RuntimeError): indices = cupy.empty((ndim,) + img.shape, dtype=cupy.float64) dt_func(img, indices=indices, **common_kwargs) # wrong shape with pytest.raises(RuntimeError): indices = cupy.empty((ndim,), dtype=cupy.float32) dt_func(img, indices=indices, **common_kwargs) # can't provide indices array when return_indices is False with pytest.raises(RuntimeError): indices = cupy.empty((ndim,) + img.shape, dtype=cupy.int32) dt_func(img, indices=indices, return_indices=False) @pytest.mark.parametrize('ndim', [1, 4, 5]) def test_distance_transform_edt_unsupported_ndim(self, ndim): with pytest.raises(NotImplementedError): cupyx.scipy.ndimage.distance_transform_edt(cupy.zeros((8,) * ndim)) @pytest.mark.skip(reason="excessive memory requirement (and CPU runtime)") @testing.numpy_cupy_allclose(scipy_name='scp') def test_distance_transform_edt_3d_int64(self, xp, scp): # Test 3D with shape > 2**10 to test the int64 kernels # This takes minutes to run on SciPy, so will need to skip on CI shape = (1040, 1040, 1040) img = self._binary_image(shape, xp=xp, pct_true=80) return scp.ndimage.distance_transform_edt(img)
48,806
https://github.com/xtuzy/SharpConstraintLayout/blob/master/SharpConstraintLayout.Core/androidx/constraintlayout/core/motion/CustomVariable.cs
Github Open Source
Open Source
Apache-2.0
null
SharpConstraintLayout
xtuzy
C#
Code
1,453
4,486
using System; /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace androidx.constraintlayout.core.motion { using TypedValues = androidx.constraintlayout.core.motion.utils.TypedValues; /// <summary> /// Defines non standard Attributes /// </summary> public class CustomVariable { private const string TAG = "TransitionLayout"; internal string mName; private int mType; private int mIntegerValue = int.MinValue; private float mFloatValue = float.NaN; private string mStringValue = null; internal bool mBooleanValue; public virtual CustomVariable copy() { return new CustomVariable(this); } public CustomVariable(CustomVariable c) { mName = c.mName; mType = c.mType; mIntegerValue = c.mIntegerValue; mFloatValue = c.mFloatValue; mStringValue = c.mStringValue; mBooleanValue = c.mBooleanValue; } public CustomVariable(string name, int type, string value) { mName = name; mType = type; mStringValue = value; } public CustomVariable(string name, int type, int value) { mName = name; mType = type; if (type == TypedValues.TypedValues_Custom.TYPE_FLOAT) { // catch int ment for float mFloatValue = value; } else { mIntegerValue = value; } } public CustomVariable(string name, int type, float value) { mName = name; mType = type; mFloatValue = value; } public CustomVariable(string name, int type, bool value) { mName = name; mType = type; mBooleanValue = value; } public static string colorString(int v) { string str = "00000000" + v.ToString("x"); return "#" + str.Substring(str.Length - 8); } public override string ToString() { string str = mName + ':'; switch (mType) { case TypedValues.TypedValues_Custom.TYPE_INT: return str + mIntegerValue; case TypedValues.TypedValues_Custom.TYPE_FLOAT: return str + mFloatValue; case TypedValues.TypedValues_Custom.TYPE_COLOR: return str + colorString(mIntegerValue); case TypedValues.TypedValues_Custom.TYPE_STRING: return str + mStringValue; case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: return str + (bool?) mBooleanValue; case TypedValues.TypedValues_Custom.TYPE_DIMENSION: return str + mFloatValue; } return str + "????"; } public virtual int Type { get { return mType; } } public virtual bool BooleanValue { get { return mBooleanValue; } set { mBooleanValue = value; } } public virtual float FloatValue { get { return mFloatValue; } set { mFloatValue = value; } } public virtual int ColorValue { get { return mIntegerValue; } } public virtual int IntegerValue { get { return mIntegerValue; } } public virtual string StringValue { get { return mStringValue; } set { mStringValue = value; } } /// <summary> /// Continuous types are interpolated they are fired only at /// /// @return /// </summary> public virtual bool Continuous { get { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_REFERENCE: case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: case TypedValues.TypedValues_Custom.TYPE_STRING: return false; default: return true; } } } public virtual int IntValue { set { mIntegerValue = value; } } /// <summary> /// The number of interpolation values that need to be interpolated /// Typically 1 but 3 for colors. /// </summary> /// <returns> Typically 1 but 3 for colors. </returns> public virtual int numberOfInterpolatedValues() { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_COLOR: return 4; default: return 1; } } /// <summary> /// Transforms value to a float for the purpose of interpolation /// </summary> /// <returns> interpolation value </returns> public virtual float ValueToInterpolate { get { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_INT: return mIntegerValue; case TypedValues.TypedValues_Custom.TYPE_FLOAT: return mFloatValue; case TypedValues.TypedValues_Custom.TYPE_COLOR: throw new Exception("Color does not have a single color to interpolate"); case TypedValues.TypedValues_Custom.TYPE_STRING: throw new Exception("Cannot interpolate String"); case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: return mBooleanValue ? 1 : 0; case TypedValues.TypedValues_Custom.TYPE_DIMENSION: return mFloatValue; } return float.NaN; } } public virtual void getValuesToInterpolate(float[] ret) { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_INT: ret[0] = mIntegerValue; break; case TypedValues.TypedValues_Custom.TYPE_FLOAT: ret[0] = mFloatValue; break; case TypedValues.TypedValues_Custom.TYPE_COLOR: int a = 0xFF & (mIntegerValue >> 24); int r = 0xFF & (mIntegerValue >> 16); int g = 0xFF & (mIntegerValue >> 8); int b = 0xFF & (mIntegerValue); float f_r = (float) Math.Pow(r / 255.0f, 2.2); float f_g = (float) Math.Pow(g / 255.0f, 2.2); float f_b = (float) Math.Pow(b / 255.0f, 2.2); ret[0] = f_r; ret[1] = f_g; ret[2] = f_b; ret[3] = a / 255f; break; case TypedValues.TypedValues_Custom.TYPE_STRING: throw new Exception("Color does not have a single color to interpolate"); case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: ret[0] = mBooleanValue ? 1 : 0; break; case TypedValues.TypedValues_Custom.TYPE_DIMENSION: ret[0] = mFloatValue; break; } } public virtual float[] Value { set { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_REFERENCE: case TypedValues.TypedValues_Custom.TYPE_INT: mIntegerValue = (int) value[0]; break; case TypedValues.TypedValues_Custom.TYPE_FLOAT: case TypedValues.TypedValues_Custom.TYPE_DIMENSION: mFloatValue = value[0]; break; case TypedValues.TypedValues_Custom.TYPE_COLOR: mIntegerValue = hsvToRgb(value[0], value[1], value[2]); mIntegerValue = (mIntegerValue & 0xFFFFFF) | (clamp((int)(0xFF * value[3])) << 24); break; case TypedValues.TypedValues_Custom.TYPE_STRING: throw new Exception("Color does not have a single color to interpolate"); case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: mBooleanValue = value[0] > 0.5; break; } } } public static int hsvToRgb(float hue, float saturation, float value) { int h = (int)(hue * 6); float f = hue * 6 - h; int p = (int)(0.5f + 255 * value * (1 - saturation)); int q = (int)(0.5f + 255 * value * (1 - f * saturation)); int t = (int)(0.5f + 255 * value * (1 - (1 - f) * saturation)); int v = (int)(0.5f + 255 * value); switch (h) { case 0: return (int)unchecked((int)0XFF000000) | (v << 16) + (t << 8) + p; case 1: return (int)unchecked((int)0XFF000000) | (q << 16) + (v << 8) + p; case 2: return (int)unchecked((int)0XFF000000) | (p << 16) + (v << 8) + t; case 3: return (int)unchecked((int)0XFF000000) | (p << 16) + (q << 8) + v; case 4: return (int)unchecked((int)0XFF000000) | (t << 16) + (p << 8) + v; case 5: return (int)unchecked((int)0XFF000000) | (v << 16) + (p << 8) + q; } return 0; } /// <summary> /// test if the two attributes are different /// </summary> /// <param name="CustomAttribute"> /// @return </param> public virtual bool diff(CustomVariable CustomAttribute) { if (CustomAttribute == null || mType != CustomAttribute.mType) { return false; } switch (mType) { case TypedValues.TypedValues_Custom.TYPE_INT: case TypedValues.TypedValues_Custom.TYPE_REFERENCE: return mIntegerValue == CustomAttribute.mIntegerValue; case TypedValues.TypedValues_Custom.TYPE_FLOAT: return mFloatValue == CustomAttribute.mFloatValue; case TypedValues.TypedValues_Custom.TYPE_COLOR: return mIntegerValue == CustomAttribute.mIntegerValue; case TypedValues.TypedValues_Custom.TYPE_STRING: return mIntegerValue == CustomAttribute.mIntegerValue; case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: return mBooleanValue == CustomAttribute.mBooleanValue; case TypedValues.TypedValues_Custom.TYPE_DIMENSION: return mFloatValue == CustomAttribute.mFloatValue; } return false; } public CustomVariable(string name, int attributeType) { mName = name; mType = attributeType; } public CustomVariable(string name, int attributeType, object value) { mName = name; mType = attributeType; setValue(value); } public CustomVariable(CustomVariable source, object value) { mName = source.mName; mType = source.mType; setValue(value); } public virtual void setValue(object value) { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_REFERENCE: case TypedValues.TypedValues_Custom.TYPE_INT: mIntegerValue = ((int?) value).Value; break; case TypedValues.TypedValues_Custom.TYPE_FLOAT: mFloatValue = ((float?) value).Value; break; case TypedValues.TypedValues_Custom.TYPE_COLOR: mIntegerValue = ((int?) value).Value; break; case TypedValues.TypedValues_Custom.TYPE_STRING: mStringValue = (string) value; break; case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: mBooleanValue = ((bool?) value).Value; break; case TypedValues.TypedValues_Custom.TYPE_DIMENSION: mFloatValue = ((float?) value).Value; break; } } private static int clamp(int c) { int N = 255; c &= ~(c >> 31); c -= N; c &= (c >> 31); c += N; return c; } public virtual int getInterpolatedColor(float[] value) { int r = clamp((int)((float) Math.Pow(value[0], 1.0 / 2.2) * 255.0f)); int g = clamp((int)((float) Math.Pow(value[1], 1.0 / 2.2) * 255.0f)); int b = clamp((int)((float) Math.Pow(value[2], 1.0 / 2.2) * 255.0f)); int a = clamp((int)(value[3] * 255.0f)); int color = (a << 24) | (r << 16) | (g << 8) | b; return color; } public virtual void setInterpolatedValue(MotionWidget view, float[] value) { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_INT: view.setCustomAttribute(mName, mType, (int) value[0]); break; case TypedValues.TypedValues_Custom.TYPE_COLOR: int r = clamp((int)((float) Math.Pow(value[0], 1.0 / 2.2) * 255.0f)); int g = clamp((int)((float) Math.Pow(value[1], 1.0 / 2.2) * 255.0f)); int b = clamp((int)((float) Math.Pow(value[2], 1.0 / 2.2) * 255.0f)); int a = clamp((int)(value[3] * 255.0f)); int color = (a << 24) | (r << 16) | (g << 8) | b; view.setCustomAttribute(mName, mType, color); break; case TypedValues.TypedValues_Custom.TYPE_REFERENCE: case TypedValues.TypedValues_Custom.TYPE_STRING: throw new Exception("unable to interpolate " + mName); case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: view.setCustomAttribute(mName, mType, value[0] > 0.5f); break; case TypedValues.TypedValues_Custom.TYPE_DIMENSION: case TypedValues.TypedValues_Custom.TYPE_FLOAT: view.setCustomAttribute(mName, mType, value[0]); break; } } public static int rgbaTocColor(float r, float g, float b, float a) { int ir = clamp((int)(r * 255f)); int ig = clamp((int)(g * 255f)); int ib = clamp((int)(b * 255f)); int ia = clamp((int)(a * 255f)); int color = (ia << 24) | (ir << 16) | (ig << 8) | ib; return color; } public virtual void applyToWidget(MotionWidget view) { switch (mType) { case TypedValues.TypedValues_Custom.TYPE_INT: case TypedValues.TypedValues_Custom.TYPE_COLOR: case TypedValues.TypedValues_Custom.TYPE_REFERENCE: view.setCustomAttribute(mName, mType, mIntegerValue); break; case TypedValues.TypedValues_Custom.TYPE_STRING: view.setCustomAttribute(mName, mType, mStringValue); break; case TypedValues.TypedValues_Custom.TYPE_BOOLEAN: view.setCustomAttribute(mName, mType, mBooleanValue); break; case TypedValues.TypedValues_Custom.TYPE_DIMENSION: case TypedValues.TypedValues_Custom.TYPE_FLOAT: view.setCustomAttribute(mName, mType, mFloatValue); break; } } public virtual string Name { get { return mName; } } } }
6,298
https://github.com/openstack4j/openstack4j/blob/master/core/src/main/java/org/openstack4j/model/network/AvailabilityZone.java
Github Open Source
Open Source
Apache-2.0
2,023
openstack4j
openstack4j
Java
Code
58
143
package org.openstack4j.model.network; import org.openstack4j.model.ModelEntity; /** * An availability zone groups network nodes that run services like DHCP, L3, FW, and others. * * @author Taemin */ public interface AvailabilityZone extends ModelEntity { /** * @return State */ String getState(); /** * @return Resource */ String getResource(); /** * @return The Zone Name of Neutron */ String getName(); }
18,989
https://github.com/odooht/odoo-rpc/blob/master/examples/psm/src/odoo/odoojs/addons/product.js
Github Open Source
Open Source
MIT
2,019
odoo-rpc
odooht
JavaScript
Code
190
1,242
import mail from './mail' import uom from './uom' const product_product_extend = (BaseClass)=>{ class cls extends BaseClass { get_history_price( company_id, date=null) { const data = this.call( 'get_history_price', [company_id, date] ) return data; } } return cls } export default { name: 'product', depends: {mail,uom}, models: { 'res.partner': { fields: ['property_product_pricelist'], }, 'product.template': { fields: [ 'name', 'sequence', 'description','description_purchase','description_sale', 'type','rental','categ_id','currency_id', 'price','list_price','lst_price','standard_price', 'volume','weight','weight_uom_id','weight_uom_name', 'sale_ok','purchase_ok','pricelist_id', 'uom_id','uom_name','uom_po_id','company_id', 'packaging_ids','seller_ids','variant_seller_ids', 'active','color','is_product_variant', 'attribute_line_ids','product_variant_ids', 'product_variant_id','product_variant_count', 'barcode','default_code','item_ids', 'image','image_medium','image_small' ], }, 'product.category': { fields: [ 'name','complete_name', 'parent_id','parent_path','child_id','product_count' ], }, 'product.price.history': { fields: [ 'company_id','product_id','datetime','cost' ], }, 'product.product': { fields: [ 'price','price_extra','lst_price', 'default_code','code','partner_ref', 'active','product_tmpl_id','barcode', 'attribute_value_ids','product_template_attribute_value_ids', 'image_variant','image','image_small','image_medium', 'is_product_variant','standard_price', 'volume','weight', 'pricelist_item_ids','packaging_ids' ], extend: product_product_extend }, 'product.packaging': { fields: [ 'name','sequence','product_id','qty', 'barcode','product_uom_id' ], }, 'product.supplierinfo': { fields: [ 'name','product_name','product_code','sequence', 'product_uom','min_qty','price','company_id', 'currency_id','date_start','date_end', 'product_id','product_tmpl_id','product_variant_count','delay' ], }, 'product.pricelist': { fields: [ 'name','active','item_ids','currency_id', 'company_id','sequence', 'country_group_ids' ], }, 'res.country.group': { fields: [ 'pricelist_ids' ], }, 'product.pricelist.item': { fields: [ 'product_tmpl_id','product_id','categ_id', 'min_quantity','applied_on','base', 'base_pricelist_id','pricelist_id','price_surcharge', 'price_discount','price_round', 'price_min_margin','price_max_margin', 'company_id','currency_id','date_start','date_end', 'compute_price','fixed_price','percent_price','name','price' ], }, 'product.attribute': { fields: [ 'name','value_ids','sequence','attribute_line_ids', 'create_variant' ], }, 'product.attribute.value': { fields: [ 'name','sequence','attribute_id' ], }, 'product.template.attribute.line': { fields: [ 'product_tmpl_id','attribute_id','value_ids', 'product_template_value_ids' ], }, 'product.template.attribute.value': { fields: [ 'name','product_attribute_value_id','product_tmpl_id', 'attribute_id','sequence','price_extra','exclude_for' ], }, 'product.template.attribute.exclusion': { fields: [ 'product_template_attribute_value_id', 'product_tmpl_id', 'value_ids' ], }, } }
3,972
https://github.com/toolmagic/Toolmagic.Common/blob/master/Toolmagic.Common/IO/SystemConsole.cs
Github Open Source
Open Source
MIT
null
Toolmagic.Common
toolmagic
C#
Code
66
217
using System; namespace Toolmagic.Common.IO { public sealed class SystemConsole : IConsole { private readonly object _lockObject = new object(); public bool KeyAvailable => System.Console.KeyAvailable; public ConsoleKeyInfo ReadKey(bool intercept) { return System.Console.ReadKey(intercept); } public void WriteLine(string format, params object[] args) { lock (_lockObject) { System.Console.WriteLine(format, args); } } public void Write(string format, params object[] args) { System.Console.Write(format, args); } public void WriteLine() { System.Console.WriteLine(); } } }
29,103
https://github.com/MaloPavol/Algorithmic-cash-flow-prediction-tool/blob/master/02_LocalFileSystem/DataMapStockBarsJSON.cs
Github Open Source
Open Source
BSD-3-Clause
2,020
Algorithmic-cash-flow-prediction-tool
MaloPavol
C#
Code
21
74
using System; using System.Collections.Generic; using System.Text; using FileHelpers; namespace AlgoCashFlow.LocalFileSystem { [DelimitedRecord("|")] public class DataMapStockBarsJSON { public string JSON; } }
30,092
https://github.com/MoeCasts/laravel-user-login-log/blob/master/tests/UserLoginLogMiddlewareTest.php
Github Open Source
Open Source
MIT
2,021
laravel-user-login-log
MoeCasts
PHP
Code
98
494
<?php namespace Moecasts\Laravel\UserLoginLog\Test; use Moecasts\Laravel\UserLoginLog\Middleware\UserLoginLogMiddleware; use Moecasts\Laravel\UserLoginLog\Test\Models\User; use Moecasts\Laravel\UserLoginLog\Test\TestCase; class UserLoginLogMiddlewareTest extends TestCase { public function setUp(): void { parent::setUp(); $this->app['config']->set('loginlog.expire', 1); $this->app['router']->get('hello', [ 'middleware' => UserLoginLogMiddleware::class, 'uses' => function () { return 'hello world'; }, ]); } public function testUnauthenticatedRequest() { $user = User::create(['name' => 'Demo']); $response = $this ->call('GET', 'hello'); $this->assertGuest(); } public function testAuthenticatedRequest() { $user = User::create(['name' => 'Demo']); $this ->withHeaders(['User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2']) ->actingAs($user) ->call('GET', 'hello'); $this->assertAuthenticated(); $this->assertCount(1, $user->loginLogs()->get()); $this->call('GET', 'hello'); $this->assertAuthenticated(); $this->assertCount(1, $user->loginLogs()->get()); sleep(2); $this->call('GET', 'hello'); $this->assertAuthenticated(); $this->assertCount(2, $user->loginLogs()->get()); } }
37,031
https://github.com/Oyiersan/p3c/blob/master/p3c-pmd/src/main/java/com/xenoamess/p3c/pmd/lang/java/rule/dubbo/InterfaceClassShouldEndWithRemoteServiceNamingRule.java
Github Open Source
Open Source
Apache-2.0
null
p3c
Oyiersan
Java
Code
175
557
/* * Copyright 1999-2017 Alibaba Group. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.xenoamess.p3c.pmd.lang.java.rule.dubbo; import com.xenoamess.p3c.pmd.I18nResources; import com.xenoamess.p3c.pmd.lang.AbstractAliXpathRule; import com.xenoamess.p3c.pmd.lang.java.util.ViolationUtils; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; /** * dubbo 接口命名需要以 RemoteService 结尾 * * @author zhangjiawu * @since 2021/09/01 */ public class InterfaceClassShouldEndWithRemoteServiceNamingRule extends AbstractAliXpathRule { private static final String XPATH = "//ClassOrInterfaceDeclaration[@Interface and (matches(@BinaryName,'.*dubbo.interfaces.*'))]" + "[not (matches(@SimpleName,'.*RemoteService$'))]"; public InterfaceClassShouldEndWithRemoteServiceNamingRule() { setXPath(XPATH); } @Override public void addViolation(Object data, Node node, String arg) { if (node instanceof ASTClassOrInterfaceDeclaration) { ViolationUtils.addViolationWithPrecisePosition(this, node, data, I18nResources.getMessage("java.naming.InterfaceClassShouldEndWithRemoteServiceNamingRule.violation.msg", node.getImage())); } else { super.addViolation(data, node, arg); } } }
35,121
https://github.com/mkasa/neco-ghc-lushtags/blob/master/autoload/neocomplete/sources/cabal.vim
Github Open Source
Open Source
BSD-3-Clause
2,018
neco-ghc-lushtags
mkasa
Vim Script
Code
286
1,150
let s:source = { \ 'name' : 'cabal', \ 'filetypes': { 'cabal': 1 } \ } function! s:source.gather_candidates(...) abort "{{{ return map([ \ 'executable', \ 'library', \ 'benchmark', \ 'test-suite', \ 'flag', \ 'author', \ 'bug-reports', \ 'buildable', \ 'build-depends', \ 'build-tools', \ 'build-type', \ 'cabal-version', \ 'category', \ 'cc-options', \ 'copyright', \ 'cpp-options', \ 'c-sources', \ 'data-dir', \ 'data-files', \ 'default', \ 'description', \ 'exposed-modules', \ 'exposed', \ 'extensions', \ 'extra-lib-dirs', \ 'extra-libraries', \ 'extra-source-files', \ 'extra-tmp-files', \ 'frameworks', \ 'ghc-options', \ 'ghc-prof-options', \ 'ghc-shared-options', \ 'homepage', \ 'hs-source-dirs', \ 'hugs-options', \ 'include-dirs', \ 'includes', \ 'install-includes', \ 'jhc-options', \ 'ld-options', \ 'license-file', \ 'license', \ 'location', \ 'main-is', \ 'maintainer', \ 'name', \ 'nhc98-options', \ 'other-modules', \ 'package-url', \ 'pkgconfig-depends', \ 'source-repository', \ 'stability', \ 'synopsis', \ 'tag', \ 'tested-with', \ 'type', \ 'version', \ 'Arrows', \ 'BangPatterns', \ 'ConstrainedClassMethods', \ 'DeriveDataTypeable', \ 'DisambiguateRecordFields', \ 'EmptyDataDecls', \ 'CPP', \ 'ExistentialQuantification', \ 'ExtendedDefaultRules', \ 'ExtensibleRecords', \ 'FlexibleContexts', \ 'FlexibleInstances', \ 'ForeignFunctionInterface', \ 'FunctionalDependencies', \ 'GADTs', \ 'GeneralizedNewtypeDeriving', \ 'Generics', \ 'HereDocuments', \ 'ImplicitParams', \ 'ImpredicativeTypes', \ 'IncoherentInstances', \ 'KindSignatures', \ 'LiberalTypeSynonyms', \ 'MagicHash', \ 'MultiParamTypeClasses', \ 'NamedFieldPuns', \ 'NewQualifiedOperators', \ 'NoImplicitPrelude', \ 'NoMonomorphismRestriction', \ 'NoMonoPatBinds', \ 'OverlappingInstances', \ 'OverloadedStrings', \ 'PackageImports', \ 'ParallelListComp', \ 'PatternGuards', \ 'PatternSignatures', \ 'PolymorphicComponents', \ 'PostfixOperators', \ 'QuasiQuotes', \ 'Rank2Types', \ 'RankNTypes', \ 'RecordPuns', \ 'RecordWildCards', \ 'RecursiveDo', \ 'RelaxedPolyRec', \ 'RestrictedTypeSynonyms', \ 'ScopedTypeVariables', \ 'StandaloneDeriving', \ 'TemplateHaskell', \ 'TransformListComp', \ 'TypeFamilies', \ 'TypeOperators', \ 'TypeSynonymInstances', \ 'UnboxedTuples', \ 'UndecidableInstances', \ 'UnicodeSyntax', \ 'UnliftedFFITypes', \ 'ViewPatterns', \ 'os', \ 'arch', \ 'implflag', \ 'true', \ 'false', \ 'Configure', \ 'Custom', \ 'Make', \ 'Simple' \ ], '{ "word": v:val }') endfunction "}}} function! neocomplete#sources#cabal#define() abort "{{{ return s:source endfunction "}}}
4,798
https://github.com/AndrewKhitrin/antlr_psql/blob/master/src/test/resources/sql/update/9be3a2e5.sql
Github Open Source
Open Source
MIT
2,018
antlr_psql
AndrewKhitrin
SQL
Code
14
32
-- file:update.sql ln:459 expect:true UPDATE range_parted set a = 'a' WHERE a = 'ad'
6,258
https://github.com/jscriptcoder/mangleIt/blob/master/src/ts/services/countdown-provider.ts
Github Open Source
Open Source
MIT
null
mangleIt
jscriptcoder
TypeScript
Code
42
98
import Countdown from '../models/countdown'; /** * Service provider of Countdown */ export default class CountdownProvider implements ng.IServiceProvider { private _timeout: number; public set timeout(timeout: number) { this._timeout = timeout; } public $get = (): Countdown => { return new Countdown(this._timeout); } }
23,798
https://github.com/freezyoff/JIWANALA/blob/master/system/vendor/maatwebsite/excel/src/Concerns/WithValidation.php
Github Open Source
Open Source
MIT, Apache-2.0
2,019
JIWANALA
freezyoff
PHP
Code
24
62
<?php namespace Maatwebsite\Excel\Concerns; interface WithValidation { /** * @param @rows - row columns data value * @return array */ public function rules($rows): array; }
27,133
https://github.com/anastasiarebr/aa_dev/blob/master/backend/assets/dod/dist/js/create.js
Github Open Source
Open Source
BSD-3-Clause
2,021
aa_dev
anastasiarebr
JavaScript
Code
15
68
var faculty = $("div.field-dodcreateform-faculty_id"); $("#dodcreateform-type").on("change", function() { if(this.checked){ faculty.hide() } else { faculty.show() } });
23,331
https://github.com/ldLirn/youxi/blob/master/resources/views/user/goods.blade.php
Github Open Source
Open Source
Apache-2.0
null
youxi
ldLirn
PHP
Code
514
3,063
@extends('layouts.user') @section('content') <link href="{{asset(HOME_CSS.'select-game.css') }}" rel="stylesheet" type="text/css"> <div class="content"> <div class="center_title">我的位置:{!! Breadcrumbs::render('my_buy_goods') !!}</div> <div class="center_box"> @include('layouts.user_left_menu') <div class="center_right"> <div class="qq_up_top"> <div class="fssc"></div> <div class="fw_c"><span>我购买的商品</span><p>在这里你可以查询到已购买的商品的信息</p></div> </div> @include('layouts.user_search') <div class="buyers"> <div class="record"> <span @if(!isset($_GET['order_status'])) class="current" @endif><a href="{{FilterManager::url('order_status', '')}}">所有订单</a></span> <span @if(isset($_GET['order_status']) && $_GET['order_status']==11) class="current" @endif><a href="{{FilterManager::url('order_status', '11')}}">等待支付</a> </span> <span @if(isset($_GET['order_status']) && $_GET['order_status']==12) class="current" @endif><a href="{{FilterManager::url('order_status', '12')}}">支付成功</a> </span> <span @if(isset($_GET['order_status']) && $_GET['order_status']==1) class="current" @endif><a href="{{FilterManager::url('order_status', '1')}}">正在发货</a></span> <span @if(isset($_GET['order_status']) && $_GET['order_status']==3) class="current" @endif><a href="{{FilterManager::url('order_status', '3')}}">交易成功</a></span> <span @if(isset($_GET['order_status']) && $_GET['order_status']==4) class="current" @endif><a href="{{FilterManager::url('order_status', '4')}}">交易取消</a></span> </div> <table> <thead> <tr> <th width="40%">宝贝信息</th> <th width="16%">单价</th> <th width="16%">数量</th> <th width="16%">总价</th> <th>交易状态</th> </tr> </thead> </table> <div class="order_list"> <div id="failinfo" style="width: 100px; height: 50px; position: absolute; z-index: 999; padding: 10px; top: 599px; left: 1277px; border: 1px solid rgb(247, 142, 87); display: none; background-color: rgb(157, 212, 251);"></div> <ul class="order"> @foreach($goodsShow as $v) <li> <p> <span> <input type="checkbox" class="pay " value="{{$v->order_sn}}"> &nbsp;订单编号:<a title="查看订单详情" href="{{url('/user/orderDetail?order_sn='.$v->order_sn)}}" target="_blank">{{$v->order_sn}}</a> </span> <span>创建时间:{{date('Y-m-d H:i:s',$v->created_at)}}</span> <span> </span> </p> <div class="ner"> <div class="w40 bor_l left" style="width: 40%"> <span class="stitle"> <a class="transaction ico_bao" title="担保交易"></a> <a class="alink" title="{{$v->goods_name}}" href="{{url('/goods/'.Hashids::encode($v->id))}}" target="_blank">{{$v->goods_name}}</a> </span> <span class="hui2">{{$v->game_name}}/{{$v->da_qu}}/{{$v->qu_name}}/{{$v->type}}@if($v->flag)(<i style="color: red">{{$v->flag}}</i>)@endif</span> </div> <div class="w16 bor_l left" style="width: 16%">{{$v->goods_price}}</div> <div class="w10 bor_l left" style="width: 16%">{{$v->buy_number}}</div> <div class="w16 bor_l left" style="width: 16%">{{$v->order_amount}}</div> <div class="w16 left" style="width: 11%"> <span class="nomargin" style="line-height:20px; margin-top:10px;"> <a href="{{url('/user/orderDetail?order_sn='.$v->order_sn)}}">查看详情</a><br> @if($v->pay_status=='0' && $v->order_status!='4' && $v->order_status!='5') <a target="_blank" href="{{url('/pay_order?order_sn='.$v->order_sn)}}">立即支付</a><br> @elseif($v->order_status=='0' && $v->pay_status=='1') <a target="_blank" style="color: red">已支付</a><br> @elseif($v->order_status=='1') <a target="_blank" style="color: red">正在发货</a><br> @elseif($v->order_status=='3') <a target="_blank" style="color: red">交易成功</a><br> @elseif($v->order_status=='4') <a target="_blank" style="color: red">交易取消</a><br> <a class="spstate" oid="{{$v->order_id}}" os="4">查看原因</a><br> @elseif($v->order_status=='5') <a target="_blank" style="color: red">订单无效</a><br> <a class="spstate" oid="{{$v->order_id}}" os="5">查看原因</a><br> @endif @if($v->order_status=='0' && $v->pay_status=='0') <a class="nopaycancel" href="javascript:delConfig({{$v->order_id}})">取消交易</a> @elseif($v->order_status=='1') <a class="nopaycancel" href="javascript:sure({{$v->order_id}},{{$v->id}})">确认收货</a> @endif </span> </div> </div> </li> @endforeach <script> var cacheReason = {}; $(function () { $(".spstate").mouseover(function (e) { var orderId = $(this).attr("oid"); var orderSt = $(this).attr("os"); var cache = cacheReason["OrderId" + orderId]; if (cache) { $("#failinfo").html(cache).show().css({ top: e.pageY + 15 + "px", left: e.pageX - 50 + "px" }); } else { $.ajax({ type: 'get', url: '{{web_url}}/center/GetOrderReason', data: { OrderId: orderId, orderSt: orderSt }, dataType: 'jsonp', jsonp: "callback", success: function (res) { cacheReason["OrderId" + orderId] = res.action_note; $("#failinfo").html(res.action_note).show().css({ top: e.pageY + 15 + "px", left: e.pageX - 50 + "px" }); } }); } }); $(".spstate").mouseleave(function (e) { $("#failinfo").hide(); }); }); </script> <li style="height:30px;line-height:28px;"> {{--<span style="color:Red; font-weight:bold; margin-left:50px;">--}} {{--订单总额:<span style="color:Blue;">200.00</span> 元--}} {{--</span>--}} <span style="color:Red;margin-right:25px;font-size:12px; float:right;"> {{trans('home.order_remarks')}} </span> </li> </ul> </div> <div class="page"> @if(isset($page_path)) {{$goodsShow->appends($page_path)->links()}} @else {{$goodsShow->links()}} @endif </div> </div> </div> </div> </div> <script type="text/javascript" src="{{asset(PUBLIC_JS.'jedate.min.js')}}"></script> <script type="text/javascript" src="{{asset(HOME_JS.'center_game.js')}}"></script> <script type="text/javascript"> jeDate({ dateCell: '#date02', isinitVal:true, format: 'YYYY-MM-DD', minDate: jeDate.now(-150) }); jeDate({ dateCell: '#date03', isinitVal:true, format: 'YYYY-MM-DD', maxDate: jeDate.now(0) }); function delConfig(id) { layer.confirm('{{trans('home.goods_cancel')}}', { btn: ["{{trans('com.sure')}}","{{trans('com.cancel')}}"] //按钮 }, function(){ $.ajax({ url: "{{url('/user/goods/cancel')}}/"+id, data:{'_method':'delete','_token':"{{csrf_token()}}"}, type: "POST", dataType:'json', success:function (data) { if (data.status == 1) { layer.msg(data.info, {icon: 6}); location.reload(); } else if (data.status == -1) { layer.msg(data.info, {icon: 5}); } else { layer.msg('{{trans('com.not_find_status')}}', {icon: 5}); } } }); }); } function sure(id,gid) { layer.confirm("{{trans('home.goods_sure')}}", { btn: ["{{trans('com.sure')}}","{{trans('com.cancel')}}"] //按钮 }, function(){ $.ajax({ url: "{{url('/user/goods/sure')}}/"+id, data:{'_method':'delete','_token':"{{csrf_token()}}",'gid':gid}, type: "POST", dataType:'json', success:function (data) { if (data.status == 1) { layer.msg(data.info, {icon: 6}); location.reload(); } else if (data.status == -1) { layer.msg(data.info, {icon: 5}); } else { layer.msg("{{trans('com.not_find_status')}}", {icon: 5}); } } }); }); } </script> @endsection
7,893
https://github.com/0xcafed00d/adventofcode_2019/blob/master/day_16/day16_test.go
Github Open Source
Open Source
MIT
null
adventofcode_2019
0xcafed00d
Go
Code
227
851
package main import ( "fmt" "testing" "github.com/0xcafed00d/assert" ) func Test1(t *testing.T) { assert := assert.Make(t) pgen := pattern(0) assert(pgen()).Equal(1) assert(pgen()).Equal(0) assert(pgen()).Equal(-1) assert(pgen()).Equal(0) pgen = pattern(1) assert(pgen()).Equal(0) assert(pgen()).Equal(1) assert(pgen()).Equal(1) assert(pgen()).Equal(0) assert(pgen()).Equal(0) assert(pgen()).Equal(-1) assert(pgen()).Equal(-1) assert(pgen()).Equal(0) assert(pgen()).Equal(0) pgen = pattern(2) assert(pgen()).Equal(0) assert(pgen()).Equal(0) assert(pgen()).Equal(1) assert(pgen()).Equal(1) assert(pgen()).Equal(1) assert(pgen()).Equal(0) assert(pgen()).Equal(0) assert(pgen()).Equal(0) assert(pgen()).Equal(-1) assert(pgen()).Equal(-1) assert(pgen()).Equal(-1) assert(pgen()).Equal(0) assert(pgen()).Equal(0) assert(pgen()).Equal(0) } func Test2(t *testing.T) { assert := assert.Make(t) input := []int{1, 2, 3, 4, 5, 6, 7, 8} assert(doPhase(input)).Equal([]int{4, 8, 2, 2, 6, 1, 5, 8}) input = []int{3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} for i := 0; i < 100; i++ { //fmt.Println(input) input = doPhase(input) } fmt.Println(input) input = []int{3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} for i := 0; i < 100; i++ { //fmt.Println(input) input = doPhase(input) } fmt.Println(input) input = []int{3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} for i := 0; i < 100; i++ { //fmt.Println(input) input = doPhase(input) } fmt.Println(input) input = []int{3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} for i := 0; i < 100; i++ { //fmt.Println(input) input = doPhase2(input, 11) } fmt.Println(input) }
28,236
https://github.com/lukaszwawrzyk/quasar/blob/master/precog/src/main/scala/quasar/precog/JPath.scala
Github Open Source
Open Source
Apache-2.0
null
quasar
lukaszwawrzyk
Scala
Code
161
282
/* * Copyright 2014–2018 SlamData Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package quasar.precog final case class JPath(nodes: List[JPathNode]) { override def toString: String = nodes match { case Nil => "." case _ => nodes mkString "" } } sealed abstract class JPathNode final case class JPathField(name: String) extends JPathNode { override def toString: String = "." + name } final case class JPathIndex(index: Int) extends JPathNode { override def toString: String = s"[$index]" }
9,177
https://github.com/berand/trinity/blob/master/tests/eth2/beacon/test_beacon_validation.py
Github Open Source
Open Source
MIT
2,019
trinity
berand
Python
Code
217
925
import pytest from hypothesis import ( given, strategies as st, ) from eth_utils import ( ValidationError, ) from eth2._utils.bitfield import ( get_bitfield_length, get_empty_bitfield, set_voted, ) from eth2.beacon.validation import ( validate_bitfield, validate_slot, validate_epoch_for_current_epoch, ) @pytest.mark.parametrize( "slot,is_valid", ( (tuple(), False), ([], False), ({}, False), (set(), False), ('abc', False), (1234, True), (-1, False), (0, True), (100, True), (2 ** 64, False), ), ) def test_validate_slot(slot, is_valid): if is_valid: validate_slot(slot) else: with pytest.raises(ValidationError): validate_slot(slot) @pytest.mark.parametrize( ( 'current_epoch, epoch, success' ), [ ( 0, 0, True, ), ( 1, 0, True, ), ( 2, 0, False, # epoch < previous_epoch ), ( 2, 2, True, ), ( 2, 3, True, # next_epoch == epoch ), ( 2, 4, False, # next_epoch < epoch ), ] ) def test_validate_epoch_for_current_epoch( current_epoch, epoch, success, epoch_length, genesis_epoch): if success: validate_epoch_for_current_epoch( current_epoch=current_epoch, given_epoch=epoch, genesis_epoch=genesis_epoch, ) else: with pytest.raises(ValidationError): validate_epoch_for_current_epoch( current_epoch=current_epoch, given_epoch=epoch, genesis_epoch=genesis_epoch, ) @pytest.mark.parametrize( ( 'is_valid' ), [ (True), (False), ] ) @given(committee_size=st.integers(0, 1000)) def test_validate_bitfield_bitfield_length(committee_size, is_valid): if is_valid: testing_committee_size = committee_size else: testing_committee_size = committee_size + 1 bitfield = get_empty_bitfield(testing_committee_size) if not is_valid and len(bitfield) != get_bitfield_length(committee_size): with pytest.raises(ValidationError): validate_bitfield(bitfield, committee_size) else: validate_bitfield(bitfield, committee_size) @given(committee_size=st.integers(0, 1000)) def test_validate_bitfield_padding_zero(committee_size): bitfield = get_empty_bitfield(committee_size) for index in range(committee_size): bitfield = set_voted(bitfield, index) if committee_size % 8 != 0: bitfield = set_voted(bitfield, committee_size) with pytest.raises(ValidationError): validate_bitfield(bitfield, committee_size) else: validate_bitfield(bitfield, committee_size)
46,704
https://github.com/bsed/rust_example/blob/master/adder/target/debug/deps/adder-b56f5c64cac59b33.d
Github Open Source
Open Source
MIT
2,020
rust_example
bsed
Makefile
Code
5
96
c:\workspace\rust\rust_example\adder\target\debug\deps\libadder-b56f5c64cac59b33.rlib: src\lib.rs c:\workspace\rust\rust_example\adder\target\debug\deps\adder-b56f5c64cac59b33.d: src\lib.rs src\lib.rs:
41,961
https://github.com/Aarthif-Nawaz/ARC-R3ACT/blob/master/Server_side/routes/datascience.route.js
Github Open Source
Open Source
MIT
null
ARC-R3ACT
Aarthif-Nawaz
JavaScript
Code
54
118
/* This file retrieves invokes the python file to start the data science section of this project. Author: Shiromi Thevarajan IIT ID: 2018117 Dependencies: express */ // importing express JS module and assign it to a variable var express = require("express"); var router = express.Router(); var searchController = require('../controllers/datascience.controller') router.get('/', searchController.connectDatascience); module.exports = router;
19,663
https://github.com/zcf7822/joyqueue/blob/master/joyqueue-console/joyqueue-portal/src/components/tab-pane/tab-pane.vue
Github Open Source
Open Source
Apache-2.0
2,022
joyqueue
zcf7822
Vue
Code
139
425
<template> <div :class="[prefixCls + '__pane']" v-show="show"> <slot></slot> </div> </template> <script> import Config from '../../config' const prefixCls = `${Config.clsPrefix}tabs` export default { name: `${Config.namePrefix}TabPane`, props: { name: { type: String }, label: { type: String }, icon: { type: String }, disabled: { type: Boolean, default: false }, closable: { type: Boolean, default: true }, visible: { type: Boolean, default: true } }, data () { return { prefixCls: prefixCls, currentName: this.name, show: true } }, computed: { isClosable () { return this.closable ? true : this.$parent.closable } }, watch: { name (val) { this.currentName = val this.updateNav() }, label () { this.updateNav() }, icon () { this.updateNav() }, disabled () { this.updateNav() }, visible () { this.updateNav() } }, methods: { updateNav () { this.$parent.updateNav() } }, mounted () { this.updateNav() }, destroyed () { this.updateNav() } } </script>
8,399
https://github.com/SCardonaSuarez/NestJs-BSL/blob/master/src/interface/index.ts
Github Open Source
Open Source
MIT
2,021
NestJs-BSL
SCardonaSuarez
TypeScript
Code
8
15
export * from './pet'; export * from './category';
11,626
https://github.com/amboar/tceetree/blob/master/ccan/tcon/test/compile_ok-container.c
Github Open Source
Open Source
MIT
2,021
tceetree
amboar
C
Code
70
221
#include <stdlib.h> #include <ccan/tcon/tcon.h> #include <ccan/build_assert/build_assert.h> #include <ccan/tap/tap.h> struct inner { int inner_val; }; struct outer { int outer_val; struct inner inner; }; struct info_base { char *infop; }; struct info_tcon { struct info_base base; TCON(TCON_CONTAINER(fi, struct outer, inner)); }; int main(void) { /* Const should work! */ const struct outer *ovar = NULL; struct outer *o; struct info_tcon info; o = tcon_container_of(&info, fi, &ovar->inner); return (o == ovar); }
21,903
https://github.com/mysutka/Atk14/blob/master/src/forms/fields/choice_field.php
Github Open Source
Open Source
MIT
2,016
Atk14
mysutka
PHP
Code
198
618
<?php /** * Field for choices. * * @package Atk14 * @subpackage Forms */ class ChoiceField extends Field { var $choices = array(); function __construct($options=array()) { if (!isset($options["widget"])) { $options["widget"] = new Select(); } parent::__construct($options); $this->update_messages(array( 'invalid_choice' => _('Select a valid choice. That choice is not one of the available choices.'), 'required' => _('Please, choose the right option.'), )); if (isset($options['choices'])) { $this->set_choices($options['choices']); } } /** * Vrati seznam voleb. * * NOTE: V djangu zrealizovano pomoci property. */ function get_choices() { return $this->choices; } /** * Nastavi seznam voleb. * * NOTE: V djangu zrealizovano pomoci property (v pripade nastaveni * saha i na widget) */ function set_choices($value) { $this->choices = $value; $this->widget->choices = $value; } function clean($value) { list($error, $value) = parent::clean($value); if (!is_null($error)) { return array($error, null); } if ($this->check_empty_value($value)) { $value = ''; } if ($value === '') { return array(null, null); //return array(null, $value); } $value = (string)$value; // zkontrolujeme, jestli je zadana hodnota v poli ocekavanych hodnot $found = false; foreach ($this->get_choices() as $k => $v) { if ((string)$k === $value) { $found = true; break; } } if (!$found) { // neni! return array($this->messages['invalid_choice'], null); } return array(null, (string)$value); } }
40,917
https://github.com/peterivatt/GC_AROMATICS/blob/master/run/GCHPctm/build.sh
Github Open Source
Open Source
MIT
null
GC_AROMATICS
peterivatt
Shell
Code
655
1,582
#!/bin/bash #------------------------------------------------------------------------------ # GEOS-Chem Global Chemical Transport Model ! #------------------------------------------------------------------------------ #BOP # # !MODULE: build.sh # # !DESCRIPTION: Cleans or compiles GEOS-Chem High Performance (GCHP) # source code. Accepts keyword argument indicating clean or compile option. # Optionally accepts '--debug' argument to build with debug flags on. #\\ #\\ # !REMARKS: # (1) This script is used within the GCHP run directory Makefile but can # also be used as a standalone option to clean and compile source code. # (2) Type './build.sh' or './build.sh help' within the run directory for # options. # # !REVISION HISTORY: # 19 Oct 2016 - E. Lundgren - Initial version # See git history for version changes. #EOP #------------------------------------------------------------------------------ #BOC # Check usage if [ $# == 0 ] || [ $1 == "help" ]; then echo "Script name: build.sh" echo "Arguments: " echo " none: prints options to screen" echo " 1st: clean and/or compile option" echo " 2nd: Optional '--debug' to turn on debug flags" echo "Clean options:" echo " clean_all - clean GEOS-Chem, ESMF, MAPL, and FVdycore" echo " clean_mapl - clean GC, MAPL, and FVdycore (skip ESMF)" echo " clean_core - clean GC only (skip ESMF, MAPL, and FVdycore)" echo "Compile options:" echo " build - general build command" echo "Example usage:" echo " ./build.sh build # Build without debug flags" echo " ./build.sh build --debug # Build with debug flags" exit 0 fi # Set run directory path rundir=$PWD gcdir=$(readlink -f CodeDir) gchpdir=${gcdir}/GCHP # Check source your environment file. This requires first setting the gchp.env # symbolic link using script setEnvironment in the run directory. # Be sure gchp.env points to the same file for both compilation and # running. You can copy or adapt sample environment files located in # ./environmentFileSamples subdirectory. gchp_env=$(readlink -f gchp.env) if [ ! -f ${gchp_env} ] then echo "ERROR: gchp.env symbolic link is not set!" echo "Copy or adapt an environment file from the ./environmentFileSamples " echo "subdirectory prior to running. Then set the gchp.env " echo "symbolic link to point to it using ./setEnvironment." echo "Exiting." exit 1 fi echo "WARNING: You are using environment settings in ${gchp_env}" source ${gchp_env} # Check environment vars if [[ "x${MPI_ROOT}" == x ]]; then echo "ERROR: MPI_ROOT is not set! See environmentFileSamples subdir for examples." elif [[ "x${ESMF_COMM}" == x ]]; then echo "ERROR: ESMF_COMM is not set! See environmentFileSamples subdir for examples." exit 1 elif [[ "x${ESMF_COMPILER}" == x ]]; then echo "ERROR: ESMF_COMPILER is not set! See environmentFileSamples subdir for examples." exit 1 elif [[ ! -e CodeDir ]]; then echo "ERROR: CodeDir symbolic link to source code directory does not exist!" echo "You may use the setCodeDir function for this, e.g." echo " ./setCodeDir /path/to/your/code" exit 1 fi # Go to the source code directory # Flag for when to exit done=0 ############################### ### Clean Options ### ############################### #----------------------------------------------------------------------- # clean_all #----------------------------------------------------------------------- if [[ $1 == "clean_all" ]]; then cd ${gcdir} make HPC=yes realclean cd ${gchpdir} make the_nuclear_option cd ${rundir} done=1 #----------------------------------------------------------------------- # clean_mapl #----------------------------------------------------------------------- elif [[ $1 == "clean_mapl" ]]; then cd ${gcdir} make HPC=yes realclean cd ${gchpdir} make wipeout_fvdycore make wipeout_mapl cd ${rundir} done=1 #----------------------------------------------------------------------- # clean_core #----------------------------------------------------------------------- elif [[ $1 == "clean_core" ]]; then cd ${gcdir} make HPC=yes realclean cd ${rundir} done=1 fi if [[ ${done} == "1" ]]; then unset rundir exit 0 fi ############################### ### Compile Options ### ############################### #----------------------------------------------------------------------- # build (compile) - with or without debug flags #----------------------------------------------------------------------- if [[ $1 == "build" ]]; then cd ${gcdir} if [[ $2 == "--debug" ]]; then make -j${NUM_JOB_SLOTS} CHEM=standard EXTERNAL_GRID=y TRACEBACK=y \ DEBUG=y BOUNDS=y FPEX=y \ BPCH_DIAG=n MODEL_GCHP=y hpc else make -j${NUM_JOB_SLOTS} CHEM=standard EXTERNAL_GRID=y TRACEBACK=y \ BPCH_DIAG=n MODEL_GCHP=y hpc fi fi cd ${rundir} if [[ -e ${gcdir}/bin/geos ]]; then echo '###################################' echo '### GCHP executable exists! ###' echo '###################################' cp CodeDir/bin/geos . else echo '###################################################' echo '### WARNING: GCHP executable does not exist ###' echo '###################################################' fi unset rundir exit 0
372
https://github.com/flanggut/advent-of-code/blob/master/aoc-2020/day16.playground/Contents.swift
Github Open Source
Open Source
MIT
null
advent-of-code
flanggut
Swift
Code
393
1,047
import Foundation let file = "/Users/flanggut/Downloads/day16.txt" //let file = "/Users/flanggut/Desktop/aoc2020/test.strings" let input = try! String(contentsOfFile: file).components(separatedBy: .newlines).dropLast() /// Parse input var ranges : [String: [(Int, Int)]] = [:] var line = 0 while input[line].count > 1 { let split = input[line].components(separatedBy: ": ") let split2 = split[1].components(separatedBy: " or ") let name = String(split[0]) for range in split2 { let value1 = Int(range.split(separator: "-")[0])! let value2 = Int(range.split(separator: "-")[1])! ranges[name, default: []].append((value1, value2)) } line += 1 } line += 2 let myticket = input[line].split(separator: ",").map({Int($0)!}) print("MyTicket: \(myticket)") line += 3 let numberCount = myticket.count /// Part 1 var validTickets : [[Int]] = [] var result : Int = 0 /// Return true if number is in any range func isNumInRanges(all : [String: [(Int, Int)]], num: Int) -> Bool { for (_, ranges) in all { for r in ranges { if r.0...r.1 ~= num { return true } } } return false; } for i in line..<input.count { let numbersOnTicket = input[i].split(separator: ",").map({Int($0)!}) var valid = true for number in numbersOnTicket { if !isNumInRanges(all: ranges, num: number) { result += number valid = false } } if valid { validTickets.append(numbersOnTicket) } } print("Part1: \(result)") /// Part 2 let validNames = Set(ranges.map({$0.0})) var validNamesForId = Array(repeating: validNames, count: numberCount) /// Return all ranges where the number does not appear func missingInRanges(all : [String: [(Int, Int)]], num: Int) -> Set<String> { var res : Set<String> = [] for (name, ranges) in all { var isIn = false for r in ranges { isIn = isIn || r.0...r.1 ~= num } if !isIn { res.insert(name) } } return res; } for ticket in validTickets { for (i, number) in ticket.enumerated() { validNamesForId[i].subtract(missingInRanges(all: ranges, num: number)) } } var counter : [String : [Int]] = [:] for (i, val) in validNamesForId.enumerated() { for name in val { counter[name, default: []].append(i) } } var filtered : Set<String> = [] var needFilter = true while needFilter { needFilter = false var fname : String = "" var fnum : Int = -1 for (name, list) in counter { if list.count == 1 && !filtered.contains(name) { needFilter = true filtered.insert(name) fname = name fnum = list[0] break } } if needFilter { print(fname) for (name, list) in counter { if name != fname { counter[name] = list.filter({$0 != fnum}) } } } } print(counter.filter({$0.key.hasPrefix("departure")})) print("Part2: \(counter.filter({$0.key.hasPrefix("departure")}).reduce(1, {$0 * myticket[$1.value[0]]}))")
9,769
https://github.com/aberba/gtkDcoding/blob/master/012_menus/menu_012_12_observed_radiomenuitems.d
Github Open Source
Open Source
LicenseRef-scancode-public-domain
2,020
gtkDcoding
aberba
D
Code
489
1,772
// This source code is in the public domain. /* Diagram: MyMenuBar FileMenuHeader FileMenu SmallRadioMenuItem MediumRadioMenuItem LargeRadioMenuItem ExtraLargeRadioMenuItem Exit */ import std.stdio; import std.string; // for access to .length import gtk.MainWindow; import gtk.Box; import gtk.Main; import gtk.Menu; import gtk.MenuBar; import gtk.MenuItem; import gtk.CheckMenuItem; // onToggle() defined here import gtk.RadioMenuItem; import gtk.Widget; import gdk.Event; import glib.ListSG; void main(string[] args) { TestRigWindow testRigWindow; Main.init(args); testRigWindow = new TestRigWindow(); Main.run(); } // main() class TestRigWindow : MainWindow { string title = "RadioMenuItems - Observed"; ObservedFeaturesList observedList; this() { super(title); setDefaultSize(640, 480); addOnDestroy(&quitApp); observedList = new ObservedFeaturesList(); AppBox appBox = new AppBox(observedList); add(appBox); showAll(); } // this() void quitApp(Widget w) { observedList.listFeatures(); Main.quit(); } // quitApp() } // testRigWindow class AppBox : Box { int padding = 10; MyMenuBar menuBar; this(ObservedFeaturesList extObservedList) { super(Orientation.VERTICAL, padding); menuBar = new MyMenuBar(extObservedList); packStart(menuBar, false, false, 0); } // this() } // class AppBox class MyMenuBar : MenuBar { FileMenuHeader fileMenuHeader; this(ObservedFeaturesList extObservedList) { super(); fileMenuHeader = new FileMenuHeader(extObservedList); append(fileMenuHeader); } // this() } // class MyMenuBar class FileMenuHeader : MenuItem { string headerTitle = "File"; FileMenu fileMenu; this(ObservedFeaturesList extObservedList) { super(headerTitle); fileMenu = new FileMenu(extObservedList); setSubmenu(fileMenu); } // this() } // class FileMenu class FileMenu : Menu { FeatureRadioMenuItem[] featureItemArray; FeatureRadioMenuItem featureItem; ExitItem exitItem; ListSG group; this(ObservedFeaturesList extObservedList) { super(); foreach(itemName; extObservedList.featureNames) { if(itemName == extObservedList.featureNames[0]) { featureItem = new FeatureRadioMenuItem(group, extObservedList, itemName); group = featureItem.getGroup(); } else { featureItem = new FeatureRadioMenuItem(group, extObservedList, itemName); } featureItemArray ~= featureItem; append(featureItem); } // this next line plus the foreach statement set the default extObservedList.setFeatureDefault(); foreach(item; featureItemArray) { if(item.getLabel() == extObservedList.getDefaultFeature()) { item.setActive(true); } else { item.setActive(false); } } exitItem = new ExitItem(extObservedList); append(exitItem); } // this() } // class FileMenu class FeatureRadioMenuItem : RadioMenuItem { string labelText; ObservedFeaturesList observedList; this(ListSG group, ObservedFeaturesList extObservedList, string extLabelText) { labelText = extLabelText; super(group, labelText); observedList = extObservedList; addOnToggled(&toggleFeature); } // this() void toggleFeature(CheckMenuItem mi) // defined in superclass { if(getActive() == true) { observedList.setFeature(labelText); } } // toggleFeature() } // class FeatureRadioMenuItem class ExitItem : MenuItem { string exitLabel = "Exit"; ObservedFeaturesList observedList; this(ObservedFeaturesList extObservedList) { super(exitLabel); addOnActivate(&exit); observedList = extObservedList; } // this() void exit(MenuItem mi) { observedList.listFeatures(); Main.quit(); } // exit() } // class FileMenuItem class ObservedFeaturesList { bool[string] features; string[] featureNames; string defaultFeatureName; this() { defaultFeatureName = "Large"; featureNames = ["Small", "Medium", "Large", "Extra Large"]; } // this() void setFeatureDefault() { foreach(ulong i; 0..featureNames.length) { string featureName = featureNames[i]; if(featureName == defaultFeatureName) { features[featureName] = true; } else { features[featureName] = false; } } } // setFeatureDefault() void setFeature(string featureName) { foreach(feature, state; features) { if(feature == featureName) { features[feature] = true; } else { features[feature] = false; } } // test getFeatureState() writeln("The state of ", featureName, ": ", getFeatureState(featureName)); } // setFeature() string getDefaultFeature() { return(defaultFeatureName); } bool getFeatureState(string featureName) { return(features[featureName]); } // getFeatureState() void listFeatures() { foreach(name, feature; features) { writeln(name, " = ", feature); } } // listFeatures() } // class ObservedFeaturesList
44,877
https://github.com/Comcast/prometheus-rpms-centos6/blob/master/build_rpm.sh
Github Open Source
Open Source
Apache-2.0
2,019
prometheus-rpms-centos6
Comcast
Shell
Code
252
800
#!/bin/bash # Defaults RPM_BUILD_ROOT=/root NOSIGN= NAME= RELEASE= usage() { echo "usage: build_rpm.sh --name name [--rpm-build-root path] [--no-sign]" echo " --name - the name of the rpm to build" echo " --release - the version of the rpm to build" echo " --rpm-build-root - the path where /rpmbuild exists for your user" echo " --no-sign - don't try to sign the build" } while [ "$1" != "" ]; do case $1 in --name ) shift NAME=$1 ;; --release ) shift RELEASE=$1 ;; --rpm-build-root ) shift RPM_BUILD_ROOT=$1 ;; --no-sign ) NOSIGN='nosign' ;; --build-number ) shift BUILD_NUMBER=$1 ;; -h | --help ) usage exit ;; * ) usage exit 1 esac shift done if [ -z ${NAME} ]; then echo "--name option must be set." else echo "Building rpm for ${NAME}" fi if [ -z ${RELEASE} ]; then echo "--name option must be set." else echo "Building rpm for ${RELEASE}" fi echo "spectool -g -R ${NAME}.spec" spectool -g -R ${NAME}.spec echo "cp ${NAME}.initd ${RPM_BUILD_ROOT}/rpmbuild/SOURCES/." cp ${NAME}.initd ${RPM_BUILD_ROOT}/rpmbuild/SOURCES/. echo "cp ${NAME}.supervisord ${RPM_BUILD_ROOT}/rpmbuild/SOURCES/." cp ${NAME}.supervisord ${RPM_BUILD_ROOT}/rpmbuild/SOURCES/. if [ -z ${NOSIGN} ]; then echo "rpmbuild -ba --define \"_ver ${RELEASE}\" --define \"_releaseno ${BUILD_NUMBER}\" ${NAME}.spec" yes "" | rpmbuild -ba \ --define "_ver ${RELEASE}" \ --define "_releaseno ${BUILD_NUMBER}" \ ${NAME}.spec else echo "rpmbuild -ba --sign --define \"_signature gpg\" --define \"_gpg_name Comcast Xmidt Team <CHQSV-Xmidt-Gpg@comcast.com>\" --define \"_ver ${RELEASE}\" --define \"_releaseno ${BUILD_NUMBER}\" ${NAME}.spec" yes "" | rpmbuild -ba --sign \ --define "_signature gpg" \ --define "_gpg_name Comcast Xmidt Team <CHQSV-Xmidt-Gpg@comcast.com>" \ --define "_ver ${RELEASE}" \ --define "_releaseno ${BUILD_NUMBER}" \ ${NAME}.spec fi
2,631
https://github.com/a-x-/decaffeinate/blob/master/dist/stages/main/patchers/ProgramPatcher.js
Github Open Source
Open Source
MIT
null
decaffeinate
a-x-
JavaScript
Code
444
1,382
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var coffee_lex_1 = require("coffee-lex"); var SharedProgramPatcher_1 = require("../../../patchers/SharedProgramPatcher"); var getIndent_1 = require("../../../utils/getIndent"); var notNull_1 = require("../../../utils/notNull"); var BLOCK_COMMENT_DELIMITER = '###'; var ProgramPatcher = /** @class */ (function (_super) { tslib_1.__extends(ProgramPatcher, _super); function ProgramPatcher() { return _super !== null && _super.apply(this, arguments) || this; } ProgramPatcher.prototype.canPatchAsExpression = function () { return false; }; ProgramPatcher.prototype.patchAsStatement = function () { this.patchComments(); this.patchContinuations(); if (this.body) { this.body.patch({ leftBrace: false, rightBrace: false }); } this.patchHelpers(); }; /** * Removes continuation tokens (i.e. '\' at the end of a line). * * @private */ ProgramPatcher.prototype.patchContinuations = function () { var _this = this; this.getProgramSourceTokens().forEach(function (token) { if (token.type === coffee_lex_1.SourceType.CONTINUATION) { _this.remove(token.start, token.end); } }); }; /** * Replaces CoffeeScript style comments with JavaScript style comments. * * @private */ ProgramPatcher.prototype.patchComments = function () { var _this = this; var source = this.context.source; this.getProgramSourceTokens().forEach(function (token) { if (token.type === coffee_lex_1.SourceType.COMMENT) { if (token.start === 0 && source[1] === '!') { _this.patchShebangComment(token); } else { _this.patchLineComment(token); } } else if (token.type === coffee_lex_1.SourceType.HERECOMMENT) { _this.patchBlockComment(token); } }); }; /** * Patches a block comment. * * @private */ ProgramPatcher.prototype.patchBlockComment = function (comment) { var _this = this; var start = comment.start, end = comment.end; this.overwrite(start, start + BLOCK_COMMENT_DELIMITER.length, '/*'); var atStartOfLine = false; var lastStartOfLine = null; var lineUpAsterisks = true; var isMultiline = false; var source = this.context.source; var expectedIndent = getIndent_1.default(source, start); var leadingHashIndexes = []; for (var index = start + BLOCK_COMMENT_DELIMITER.length; index < end - BLOCK_COMMENT_DELIMITER.length; index++) { switch (source[index]) { case '\n': isMultiline = true; atStartOfLine = true; lastStartOfLine = index + '\n'.length; break; case ' ': case '\t': break; case '#': if (atStartOfLine) { leadingHashIndexes.push(index); atStartOfLine = false; if (source.slice(notNull_1.default(lastStartOfLine), index) !== expectedIndent) { lineUpAsterisks = false; } } break; default: if (atStartOfLine) { atStartOfLine = false; lineUpAsterisks = false; } break; } } leadingHashIndexes.forEach(function (index) { _this.overwrite(index, index + '#'.length, lineUpAsterisks ? ' *' : '*'); }); this.overwrite(end - BLOCK_COMMENT_DELIMITER.length, end, isMultiline && lineUpAsterisks ? ' */' : '*/'); }; /** * Patches a single-line comment. * * @private */ ProgramPatcher.prototype.patchLineComment = function (comment) { var start = comment.start; this.overwrite(start, start + '#'.length, '//'); }; /** * Patches a shebang comment. * * @private */ ProgramPatcher.prototype.patchShebangComment = function (comment) { var start = comment.start, end = comment.end; var commentBody = this.slice(start, end); var coffeeIndex = commentBody.indexOf('coffee'); if (coffeeIndex >= 0) { this.overwrite(start + coffeeIndex, start + coffeeIndex + 'coffee'.length, 'node'); } }; /** * Serve as the implicit return patcher for anyone not included in a function. */ ProgramPatcher.prototype.canHandleImplicitReturn = function () { return true; }; return ProgramPatcher; }(SharedProgramPatcher_1.default)); exports.default = ProgramPatcher;
15,547
https://github.com/gentics/mesh/blob/master/common/src/main/java/com/gentics/mesh/auth/provider/MeshJWTAuthProvider.java
Github Open Source
Open Source
Apache-2.0
2,023
mesh
gentics
Java
Code
1,096
3,504
package com.gentics.mesh.auth.provider; import static com.gentics.mesh.core.rest.error.Errors.error; import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; import static io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR; import static io.netty.handler.codec.http.HttpResponseStatus.UNAUTHORIZED; import javax.inject.Inject; import javax.inject.Singleton; import com.gentics.mesh.auth.handler.MeshJWTAuthHandler; import io.vertx.core.http.Cookie; import io.vertx.ext.auth.authentication.AuthenticationProvider; import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang3.StringUtils; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import com.gentics.mesh.auth.AuthenticationResult; import com.gentics.mesh.cli.BootstrapInitializer; import com.gentics.mesh.context.InternalActionContext; import com.gentics.mesh.core.data.user.HibUser; import com.gentics.mesh.core.data.user.MeshAuthUser; import com.gentics.mesh.core.db.Database; import com.gentics.mesh.core.rest.auth.TokenResponse; import com.gentics.mesh.etc.config.AuthenticationOptions; import com.gentics.mesh.etc.config.MeshOptions; import com.gentics.mesh.shared.SharedKeys; import io.vertx.core.AsyncResult; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; import io.vertx.core.logging.Logger; import io.vertx.core.logging.LoggerFactory; import io.vertx.ext.auth.AuthProvider; import io.vertx.ext.auth.JWTOptions; import io.vertx.ext.auth.KeyStoreOptions; import io.vertx.ext.auth.User; import io.vertx.ext.auth.jwt.JWTAuth; import io.vertx.ext.auth.jwt.JWTAuthOptions; /** * Central mesh authentication provider which will handle JWT. * * Note that the auth proces starts at {@link MeshJWTAuthHandler#handle(io.vertx.ext.web.RoutingContext). The handler will extract the JWT values and this * provider will authenticate the data and load the user. * */ @Singleton public class MeshJWTAuthProvider implements AuthenticationProvider, JWTAuth { private static final Logger log = LoggerFactory.getLogger(MeshJWTAuthProvider.class); private JWTAuth jwtProvider; private static final String USERID_FIELD_NAME = "userUuid"; private static final String API_KEY_TOKEN_CODE_FIELD_NAME = "jti"; protected final Database db; private BCryptPasswordEncoder passwordEncoder; private final MeshOptions meshOptions; @Inject public MeshJWTAuthProvider(Vertx vertx, MeshOptions meshOptions, BCryptPasswordEncoder passwordEncoder, Database database, BootstrapInitializer boot) { this.meshOptions = meshOptions; this.passwordEncoder = passwordEncoder; this.db = database; // Use the mesh JWT options in order to setup the JWTAuth provider AuthenticationOptions options = meshOptions.getAuthenticationOptions(); String keystorePassword = options.getKeystorePassword(); if (keystorePassword == null) { throw new RuntimeException("The keystore password could not be found within the authentication options."); } String keyStorePath = options.getKeystorePath(); String type = "jceks"; JWTAuthOptions config = new JWTAuthOptions(); config.setKeyStore(new KeyStoreOptions().setPath(keyStorePath).setPassword(keystorePassword).setType(type)); jwtProvider = JWTAuth.create(vertx, new JWTAuthOptions(config)); } /** * Authenticate the JWT information and invoke the handler with the result of the authentication process. * * This method will also load the actual user from the JWT user reference. * * @param authInfo * @param resultHandler */ public void authenticateJWT(JsonObject authInfo, Handler<AsyncResult<AuthenticationResult>> resultHandler) { // Decode and validate the JWT. A JWTUser will be returned which contains the decoded token. // We will use this information to load the Mesh User from the graph. jwtProvider.authenticate(authInfo, rh -> { if (rh.failed()) { if (log.isDebugEnabled()) { log.debug("Could not authenticate token.", rh.cause()); } else { log.warn("Could not authenticate token."); } resultHandler.handle(Future.failedFuture("Invalid Token")); } else { JsonObject decodedJwt = rh.result().principal(); try { User user = loadUserByJWT(decodedJwt); AuthenticationResult result = new AuthenticationResult(user); // Check whether an api key was used to authenticate the user. if (decodedJwt.containsKey(API_KEY_TOKEN_CODE_FIELD_NAME)) { result.setUsingAPIKey(true); } resultHandler.handle(Future.succeededFuture(result)); } catch (Exception e) { resultHandler.handle(Future.failedFuture(e)); } } }); } @Override public void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler) { // The mesh auth provider is not using this method to authenticate a user. throw new NotImplementedException(); } @Override public String generateToken(JsonObject claims, JWTOptions options) { throw new NotImplementedException(); } @Override public String generateToken(JsonObject jsonObject) { throw new NotImplementedException(); } /** * Authenticates the user and returns a JWToken if successful. * * @param username * Username * @param password * Password */ public String generateToken(String username, String password, String newPassword) { HibUser user = authenticate(username, password, newPassword); String uuid = db.tx(user::getUuid); JsonObject tokenData = new JsonObject().put(USERID_FIELD_NAME, uuid); return jwtProvider.generateToken(tokenData, new JWTOptions() .setExpiresInSeconds(meshOptions.getAuthenticationOptions().getTokenExpirationTime())); } /** * Load the user with the given username and use the bcrypt encoder to compare the user password with the provided password. * * @param username * Username * @param password * Password */ private HibUser authenticate(String username, String password, String newPassword) { HibUser user = db.tx(tx -> { return tx.userDao().findByUsername(username); }); if (user != null) { String accountPasswordHash = db.tx(user::getPasswordHash); // TODO check if user is enabled boolean hashMatches = false; if (StringUtils.isEmpty(accountPasswordHash) && password != null) { if (log.isDebugEnabled()) { log.debug("The account password hash or token password string are invalid."); } throw error(UNAUTHORIZED, "auth_login_failed"); } else { if (log.isDebugEnabled()) { log.debug("Validating password using the bcrypt password encoder"); } hashMatches = passwordEncoder.matches(password, accountPasswordHash); } if (hashMatches) { boolean forcedPasswordChange = db.tx(user::isForcedPasswordChange); if (forcedPasswordChange && newPassword == null) { throw error(BAD_REQUEST, "auth_login_password_change_required"); } else if (!forcedPasswordChange && newPassword != null) { throw error(BAD_REQUEST, "auth_login_newpassword_failed"); } else { if (forcedPasswordChange) { db.tx(tx -> { return tx.userDao().setPassword(user, newPassword); }); } return user; } } else { throw error(UNAUTHORIZED, "auth_login_failed"); } } else { if (log.isDebugEnabled()) { log.debug("Could not load user with username {" + username + "}."); } // TODO Don't let the user know that we know that he did not exist? throw error(UNAUTHORIZED, "auth_login_failed"); } } /** * Generates a new JWToken with the user. * * @param user * User * @return The new token */ public String generateToken(User user) { if (user instanceof MeshAuthUser) { AuthenticationOptions options = meshOptions.getAuthenticationOptions(); JsonObject tokenData = new JsonObject(); String uuid = db.tx(((MeshAuthUser) user).getDelegate()::getUuid); tokenData.put(USERID_FIELD_NAME, uuid); JWTOptions jwtOptions = new JWTOptions().setAlgorithm(options.getAlgorithm()) .setExpiresInSeconds(options.getTokenExpirationTime()); return jwtProvider.generateToken(tokenData, jwtOptions); } else { log.error("Can't generate token for user of type {" + user.getClass().getName() + "}"); throw error(INTERNAL_SERVER_ERROR, "error_internal"); } } /** * Generate a new JWT which can be used as an API key. * * @param user * @param tokenCode * Code which will be part of the JWT. This code is used to verify that the JWT is still valid * @param expireDuration * @return Generated API key */ public String generateAPIToken(HibUser user, String tokenCode, Integer expireDuration) { AuthenticationOptions options = meshOptions.getAuthenticationOptions(); JsonObject tokenData = new JsonObject() .put(USERID_FIELD_NAME, user.getUuid()) .put(API_KEY_TOKEN_CODE_FIELD_NAME, tokenCode); JWTOptions jwtOptions = new JWTOptions().setAlgorithm(options.getAlgorithm()); if (expireDuration != null) { jwtOptions.setExpiresInMinutes(expireDuration); } return jwtProvider.generateToken(tokenData, jwtOptions); } /** * Gets the corresponding {@link MeshAuthUser} by the Vert.x User. * * @param jwt * Decoded JWT * @return Mesh user * @throws Exception */ private User loadUserByJWT(JsonObject jwt) throws Exception { return db.tx(tx -> { String userUuid = jwt.getString(USERID_FIELD_NAME); MeshAuthUser user = tx.userDao().findMeshAuthUserByUuid(userUuid); if (user == null) { if (log.isDebugEnabled()) { log.debug("Could not load user with UUID {" + userUuid + "}."); } // TODO use NoStackTraceThrowable? throw new Exception("Invalid credentials!"); } // TODO Re-enable isEnabled cache and check if User#delete behaviour changes // if (!user.isEnabled()) { // throw new Exception("User is disabled"); // } // Check whether the token might be an API key token if (!jwt.containsKey("exp")) { String apiKeyToken = jwt.getString(API_KEY_TOKEN_CODE_FIELD_NAME); // TODO: All tokens without exp must have a token code - See https://github.com/gentics/mesh/issues/412 if (apiKeyToken != null) { String storedApiKey = user.getDelegate().getAPIKeyTokenCode(); // Verify that the API token is invalid. if (apiKeyToken != null && !apiKeyToken.equals(storedApiKey)) { throw new Exception("API key token is invalid."); } } } return user; }); } /** * Handle the login action and set a token cookie if the credentials are valid. * * @param ac * Action context used to add token cookie * @param username * Username * @param password * Password */ public void login(InternalActionContext ac, String username, String password, String newPassword) { String token = generateToken(username, password, newPassword); ac.addCookie(Cookie.cookie(SharedKeys.TOKEN_COOKIE_KEY, token) .setMaxAge(meshOptions.getAuthenticationOptions().getTokenExpirationTime()).setPath("/")); ac.send(new TokenResponse(token).toJson()); } }
47,997
https://github.com/alexUXUI/ng2-for-fun/blob/master/app/games/games.service.ts
Github Open Source
Open Source
MIT
null
ng2-for-fun
alexUXUI
TypeScript
Code
48
122
export class GamesService { games = [ { name: 'Fifa', id: 1, rating: 5 }, { name: 'Halo', id: 2, rating: 5 }, { name: 'Palgue', id: 3, rating: 5 } ]; getGames() { return this.games; } getGame(id: any) { return this.games.find(games => games.id === id); } }
30,249
https://github.com/pnp/pnpscanning/blob/master/src/PnP.Scanning/PnP.Scanning.Core/Storage/Model/SyntexList.cs
Github Open Source
Open Source
MIT
2,022
pnpscanning
pnp
C#
Code
214
466
using Microsoft.EntityFrameworkCore; #nullable disable namespace PnP.Scanning.Core.Storage { [Index(new string[] { nameof(ScanId), nameof(SiteUrl), nameof(WebUrl), nameof(ListId) }, IsUnique = true)] internal sealed class SyntexList : BaseScanResult { #region List identification information public string ListServerRelativeUrl { get; set; } public string Title { get; set; } public Guid ListId { get; set; } public int ListTemplate { get; set; } public string ListTemplateString { get; set; } #endregion #region Information to determine Syntex need public bool AllowContentTypes { get; set; } public int ContentTypeCount { get; set; } public int FieldCount { get; set; } public string ListExperienceOptions { get; set; } public int WorkflowInstanceCount { get; set; } public int FlowInstanceCount { get; set; } public int RetentionLabelCount { get; set; } #endregion #region Information to collect list "activeness" public int ItemCount { get; set; } public int FolderCount { get; set; } public int DocumentCount { get; set; } public int AverageDocumentsPerFolder { get; set; } public string LibrarySize { get; set; } public bool UsesCustomColumns { get; set; } public DateTime Created { get; set; } public DateTime LastChanged { get; set; } public int LastChangedYear { get; set; } public int LastChangedMonth { get; set; } public string LastChangedMonthString { get; set; } public string LastChangedQuarter { get; set; } #endregion } }
32,846
https://github.com/stStoyanov93/SoftUni-CSharp-Fundamentals-2018/blob/master/C# OOP Advanced/04 Reflection and Attributes/EXE_ReflectionAndAttributes/P07_InfernoInfinity/Core/Engine.cs
Github Open Source
Open Source
MIT
null
SoftUni-CSharp-Fundamentals-2018
stStoyanov93
C#
Code
64
205
using System; using System.Linq; public class Engine : IEngine { private ICommandInterpreter commandInterpreter; public Engine(ICommandInterpreter commandInterpreter) { this.commandInterpreter = commandInterpreter; } public void Run() { var input = Console.ReadLine(); while (input != "END") { var data = input.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); string command = data[0]; var instance = this.commandInterpreter.InterpretCommand(data, command); var method = typeof(ICommand).GetMethods().First(); method.Invoke(instance, null); input = Console.ReadLine(); } } }
36,813
https://github.com/squad-b/work-assistant-web/blob/master/src/pages/main/BookAddPage.tsx
Github Open Source
Open Source
MIT
2,021
work-assistant-web
squad-b
TypeScript
Code
249
858
import * as React from "react"; import BookAddPopup from "../../components/book/add/BookAddPopup"; import BookSearchInput from "../../components/book/add/BookSearchInput"; import BookSearchResultList from "../../components/book/add/BookSearchResultList"; import Layout from "../../components/common/Layout"; import api from "../../api"; class BookAddPage extends React.Component<any, any> { fetching: boolean; isEnd: boolean; query: string; page: number; size: number; constructor(props: any) { super(props); this.state = { searchBooks: [], popupOpen: false, selectedBook: {} } this.fetching = false; this.isEnd = false; this.query = ''; this.page = 1; this.size = 10; } public componentDidMount() { window.addEventListener('scroll', this.handleScroll); } public componentWillUnmount() { window.removeEventListener('scroll', this.handleScroll); } public render() { return ( <div> <Layout> <BookSearchInput onSearchButtonClick={this.onSearchButtonClick}/> <BookSearchResultList searchBooks={this.state.searchBooks} onClickCard={this.onClickBookCard}/> <BookAddPopup open={this.state.popupOpen} book={this.state.selectedBook} onClose={this.onClosePopup}/> </Layout> </div> ) } private onClickBookCard = (book: any) => { this.setState({ popupOpen: true, selectedBook: book }) } private onClosePopup = () => { this.setState({ popupOpen: false }) } private onSearchButtonClick = async (query: any) => { if (!query) { return; } this.fetching = true if (this.query !== query) { this.page = 1 this.isEnd = false } const booksResponse = await api.get(`/search/books/?query=${query}&page=${this.page}&size=${this.size}`); const bookList = booksResponse.data.documents; const addBookList = this.query === query ? this.state.searchBooks.concat(...bookList) : bookList if (bookList) { this.setState({searchBooks: addBookList}) if (bookList.length >= this.size) { this.page = this.page + 1 } else { this.isEnd = true } } this.fetching = false this.query = query; } private handleScroll = () => { const scrollHeight = document.documentElement.scrollHeight; const scrollTop = document.documentElement.scrollTop; const clientHeight = document.documentElement.clientHeight; if (scrollTop + clientHeight >= scrollHeight && !this.fetching && !this.isEnd) { // 페이지 끝에 도달하면 추가 데이터를 받아온다 this.onSearchButtonClick(this.query); } }; } export default BookAddPage
5,029
https://github.com/dakota/croogo/blob/master/Plugin/Contacts/Controller/ContactsController.php
Github Open Source
Open Source
MIT
null
croogo
dakota
PHP
Code
716
2,599
<?php App::uses('CakeEmail', 'Network/Email'); App::uses('ContactsAppController', 'Contacts.Controller'); /** * Contacts Controller * * PHP version 5 * * @category Controller * @package Croogo.Contacts.Controller * @version 1.0 * @author Fahad Ibnay Heylaal <contact@fahad19.com> * @license http://www.opensource.org/licenses/mit-license.php The MIT License * @link http://www.croogo.org */ class ContactsController extends ContactsAppController { /** * Controller name * * @var string * @access public */ public $name = 'Contacts'; /** * Components * * @var array * @access public */ public $components = array( 'Croogo.Akismet', 'Croogo.Recaptcha', ); /** * Models used by the Controller * * @var array * @access public */ public $uses = array('Contacts.Contact', 'Contacts.Message'); /** * Admin index * * @return void * @access public */ public function admin_index() { $this->set('title_for_layout', __d('croogo', 'Contacts')); $this->Contact->recursive = 0; $this->paginate['Contact']['order'] = 'Contact.title ASC'; $this->set('contacts', $this->paginate()); $this->set('displayFields', $this->Contact->displayFields()); } /** * Admin add * * @return void * @access public */ public function admin_add() { $this->set('title_for_layout', __d('croogo', 'Add Contact')); if (!empty($this->request->data)) { $this->Contact->create(); if ($this->Contact->save($this->request->data)) { $this->Session->setFlash(__d('croogo', 'The Contact has been saved'), 'default', array('class' => 'success')); $this->Croogo->redirect(array('action' => 'edit', $this->Contact->id)); } else { $this->Session->setFlash(__d('croogo', 'The Contact could not be saved. Please, try again.'), 'default', array('class' => 'error')); } } } /** * Admin edit * * @param integer $id * @return void * @access public */ public function admin_edit($id = null) { $this->set('title_for_layout', __d('croogo', 'Edit Contact')); if (!$id && empty($this->request->data)) { $this->Session->setFlash(__d('croogo', 'Invalid Contact'), 'default', array('class' => 'error')); $this->redirect(array('action' => 'index')); } if (!empty($this->request->data)) { if ($this->Contact->save($this->request->data)) { $this->Session->setFlash(__d('croogo', 'The Contact has been saved'), 'default', array('class' => 'success')); $this->Croogo->redirect(array('action' => 'edit', $this->Contact->id)); } else { $this->Session->setFlash(__d('croogo', 'The Contact could not be saved. Please, try again.'), 'default', array('class' => 'error')); } } if (empty($this->request->data)) { $this->request->data = $this->Contact->read(null, $id); } } /** * Admin delete * * @param integer $id * @return void * @access public */ public function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(__d('croogo', 'Invalid id for Contact'), 'default', array('class' => 'error')); $this->redirect(array('action' => 'index')); } if ($this->Contact->delete($id)) { $this->Session->setFlash(__d('croogo', 'Contact deleted'), 'default', array('class' => 'success')); $this->redirect(array('action' => 'index')); } } /** * View * * @param string $alias * @return void * @access public */ public function view($alias = null) { if (!$alias) { $this->redirect('/'); } $contact = $this->Contact->find('first', array( 'conditions' => array( 'Contact.alias' => $alias, 'Contact.status' => 1, ), 'cache' => array( 'name' => $alias, 'config' => 'contacts_view', ), )); if (!isset($contact['Contact']['id'])) { $this->redirect('/'); } $this->set('contact', $contact); $continue = true; if (!$contact['Contact']['message_status']) { $continue = false; } if (!empty($this->request->data) && $continue === true) { $this->request->data['Message']['contact_id'] = $contact['Contact']['id']; $this->request->data['Message']['title'] = htmlspecialchars($this->request->data['Message']['title']); $this->request->data['Message']['name'] = htmlspecialchars($this->request->data['Message']['name']); $this->request->data['Message']['body'] = htmlspecialchars($this->request->data['Message']['body']); $continue = $this->_validation($continue, $contact); $continue = $this->_spam_protection($continue, $contact); $continue = $this->_captcha($continue, $contact); $continue = $this->_send_email($continue, $contact); if ($continue === true) { //$this->Session->setFlash(__d('croogo', 'Your message has been received.')); //unset($this->request->data['Message']); echo $this->flash(__d('croogo', 'Your message has been received...'), '/'); } } $this->set('title_for_layout', $contact['Contact']['title']); $this->set(compact('continue')); } /** * Validation * * @param boolean $continue * @param array $contact * @return boolean * @access protected */ protected function _validation($continue, $contact) { if ($this->Contact->Message->set($this->request->data) && $this->Contact->Message->validates() && $continue === true) { if ($contact['Contact']['message_archive'] && !$this->Contact->Message->save($this->request->data['Message'])) { $continue = false; } } else { $continue = false; } return $continue; } /** * Spam protection * * @param boolean $continue * @param array $contact * @return boolean * @access protected */ protected function _spam_protection($continue, $contact) { if (!empty($this->request->data) && $contact['Contact']['message_spam_protection'] && $continue === true) { $this->Akismet->setCommentAuthor($this->request->data['Message']['name']); $this->Akismet->setCommentAuthorEmail($this->request->data['Message']['email']); $this->Akismet->setCommentContent($this->request->data['Message']['body']); if ($this->Akismet->isCommentSpam()) { $continue = false; $this->Session->setFlash(__d('croogo', 'Sorry, the message appears to be spam.'), 'default', array('class' => 'error')); } } return $continue; } /** * Captcha * * @param boolean $continue * @param array $contact * @return boolean * @access protected */ protected function _captcha($continue, $contact) { if (!empty($this->request->data) && $contact['Contact']['message_captcha'] && $continue === true && !$this->Recaptcha->valid($this->request)) { $continue = false; $this->Session->setFlash(__d('croogo', 'Invalid captcha entry'), 'default', array('class' => 'error')); } return $continue; } /** * Send Email * * @param boolean $continue * @param array $contact * @return boolean * @access protected */ protected function _send_email($continue, $contact) { $email = new CakeEmail(); if (!$contact['Contact']['message_notify'] || $continue !== true) { return $continue; } $siteTitle = Configure::read('Site.title'); try { $email->from($this->request->data['Message']['email']) ->to($contact['Contact']['email']) ->subject(__d('croogo', '[%s] %s', $siteTitle, $contact['Contact']['title'])) ->template('Contacts.contact') ->viewVars(array( 'contact' => $contact, 'message' => $this->request->data, )); if ($this->theme) { $email->theme($this->theme); } if (!$email->send()) { $continue = false; } } catch (SocketException $e) { $this->log(sprintf('Error sending contact notification: %s', $e->getMessage())); $continue = false; } return $continue; } }
43,873
https://github.com/leofideliss/qualityct_laravel/blob/master/app/Http/Controllers/SpecificationsController.php
Github Open Source
Open Source
MIT
null
qualityct_laravel
leofideliss
PHP
Code
646
2,310
<?php namespace App\Http\Controllers; use App\Helpers\CollectionHelper; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use App\Models\Clients; use App\Models\Experiment; use App\Models\Measure; use App\Models\Products; use App\Models\Specification; use App\Models\Sample; use App\Models\Test; class SpecificationsController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $products = Products::all(); $result = [$i = 0]; foreach ($products as $value) { if (DB::table('specifications')->where('id_product', $value->id)->exists()) $result[$i++] = $value; } $data = CollectionHelper::paginate($result, 5); return view('specifications.index', compact('data')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $clients = Clients::all(); $products = Products::all(); return view('specifications.create', compact('clients', 'products')); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $request->validate([ 'id_client' => 'required', 'id_product' => 'required', ]); $product = Products::find($request->id_product); $experiments = Experiment::where('id_leather_type', '=', $product->id_leather_type)->get(); for ($i = 0; $i < count(($experiments)); $i++) { if ($request->min_value[$i] != null && $request->uni[$i] != '') { switch ($request->uni[$i]) { case '1': $min_value = $request->min_value[$i] . " (Kgf)"; break; case '2': $min_value = $request->min_value[$i] . " (N)"; break; case '3': $min_value = $request->min_value[$i] . " (%)"; break; case '4': $min_value = $request->min_value[$i] . " (E/C)"; break; case '5': $min_value = $request->min_value[$i] . " (mm)"; break; default: break; } } else return redirect()->back()->with('msg',"Existe experimentos não preenchidos !"); $specifications[$i] = [ 'id_client' => $request->id_client, 'name' => 'Esp. Cliente', 'min_value' => $min_value, 'id_product' => $product->id, 'id_experiment' => $experiments[$i]->id, 'id_uni' => $request->uni[$i], 'created_at' => date('Y/m/d H:i:s'), 'updated_at' => date('Y/m/d H:i:s'), ]; Specification::create($specifications[$i]); } return redirect()->route('specifications.index'); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $specification = Specification::where('id_product', '=', $id)->first(); $clients = Clients::where('id', '=', $specification->id_client)->get(); $products = Products::where('id', '=', $specification->id_product)->get(); $measures = Measure::all(); return view('specifications.edit', compact('specification', 'clients', 'products', 'measures')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $experiments = Experiment::where('id_leather_type', '=', $id)->get(); for ($i = 0; $i < count(($experiments)); $i++) { $str = explode(' ', $request->min_value[$i]); switch ($request->uni[$i]) { case '1': if (count($str) == 2) $min_value = $request->min_value[$i] . " (Kgf)"; else $min_value = $request->min_value[$i]; break; case '2': if (count($str) == 2) $min_value = $request->min_value[$i] . " (N)"; else $min_value = $request->min_value[$i]; break; case '3': if (count($str) == 2) $min_value = $request->min_value[$i] . " (%)"; else $min_value = $request->min_value[$i]; break; case '4': if (count($str) == 2) $min_value = $request->min_value[$i] . " (E/C)"; else $min_value = $request->min_value[$i]; break; case '5': if (count($str) == 2) $min_value = $request->min_value[$i] . " (mm)"; else $min_value = $request->min_value[$i]; break; default: break; } Specification::where('id_product', $id)->where('id_experiment', '=', $experiments[$i]->id)->update([ 'min_value' => $min_value, 'id_uni' => $request->uni[$i], 'updated_at' => date('Y/m/d H:i:s'), ]); } return redirect()->route('specifications.index'); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Specification::where('id_product', '=', $id)->delete(); return redirect()->route('specifications.index'); } public function loadSpecifications($id) { $specifications = Specification::where('id_product', '=', $id)->get(); return json_encode($specifications); } public function searchSpecifications($id) { $spec = Specification::where('id_product', '=', $id)->get(); return $spec; } public function search(Request $request) // Busca para exibir no index { $result = [$i = 0]; if ($request->name === "" || $request->name === null) return redirect()->route('specifications.index'); else { $client = Clients::where('company_name', 'like', '%' . $request->name . '%')->get(); foreach ($client as $cli) { $product = Products::where('id_client', '=', $cli->id)->get(); foreach ($product as $prod) { if (DB::table('specifications')->where('id_product', $prod->id)->exists()) $result[$i++] = $prod; } } } $data = CollectionHelper::paginate($result, 5); return view('specifications.index', compact('data')); } public function searchSpec($op_number) //Busca para a requisição AJAX { $sample = Sample::where('op_number', '=', $op_number)->first(); $product = Products::where('id', '=', $sample->id_product)->first(); $tests = Test::where('op_number', '=', $op_number)->get(); for ($i = 0; $i < count($tests); $i++) { $specifications[$i] = Specification::where('id_experiment', '=', $tests[$i]->id_experiment)->where('id_product', '=', $product->id)->first(); } return json_encode($specifications); } }
2,814
https://github.com/hw233/home3/blob/master/core/server/project/commonBase/src/main/java/com/home/commonBase/constlist/generate/UnitAgainstType.java
Github Open Source
Open Source
Apache-2.0
2,021
home3
hw233
Java
Code
43
120
package com.home.commonBase.constlist.generate; /** 单位敌对类型(generated by shine) */ public class UnitAgainstType { /** 中立 */ public static final int Neutral=0; /** 敌对 */ public static final int Enemy=1; /** 友好 */ public static final int Friend=2; /** 长度 */ public static int size=3; }
44,721
https://github.com/feiyungu/Haze_Removal_Using_Dark_Channel_Prior/blob/master/WhiteBalance.m
Github Open Source
Open Source
MIT
2,018
Haze_Removal_Using_Dark_Channel_Prior
feiyungu
MATLAB
Code
129
355
function WB = WhiteBalance(img) img = double(img); [m, n, ~] = size(img); % fetch each color channel r = img(:,:,1); g = img(:,:,2); b = img(:,:,3); % calculate mean value for each color channel meanR = mean(r(:)); meanG = mean(g(:)); meanB = mean(b(:)); meanRGB = [meanR meanG meanB]; % calculate grayvalue and scale value grayValue = (meanR + meanG + meanB) / 3 ; scaleValue = grayValue ./ (meanRGB + 0.001); R = scaleValue(1) * r; G = scaleValue(2) * g; B = scaleValue(3) * b; for i = 1:m for j = 1:n if (R(i,j) > 255) R(i,j) = 255; end if (G(i,j) > 255) G(i,j) = 255; end if (B(i,j) > 255) B(i,j) = 255; end end end new(:,:,1)=R; new(:,:,2)=G; new(:,:,3)=B; WB = new; imwrite(WB, 'WB.png'); end
38,616
https://github.com/hugwolf41/prettygood_dsp/blob/master/scripts/parse_autoeq_results.py
Github Open Source
Open Source
MIT
2,021
prettygood_dsp
hugwolf41
Python
Code
145
578
import json import os import re # Run in AutoEQ results folder root_dir = "." out_file_name = "autoeq_profiles.json" staging_dict = {} def get_numbers(s): rr = re.findall("[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?", s) return [float(d) for d in rr] for dir_name, subdir_list, file_list in os.walk(root_dir): print(f"Found directory: {dir_name}") for file_name in file_list: if "ParametricEQ" in file_name: source = dir_name.split("/")[-2] name = file_name.split(" ParametricEQ")[0] path = os.path.join(dir_name, file_name) with open(path, "r") as f: content = f.readlines() preamp_gain = get_numbers(content[0])[0] filter_fc = [] filter_db = [] filter_q = [] for line in content[1:]: filt_numbers = get_numbers(line) filter_fc.append(filt_numbers[1]) filter_db.append(filt_numbers[2]) filter_q.append(filt_numbers[3]) if source not in staging_dict.keys(): print(f"Adding {source} group") staging_dict[source] = [] staging_dict[source].append( { "label": name, "value": json.dumps( { "filter_fc": filter_fc, "filter_db": filter_db, "filter_q": filter_q } ) } ) out_array = [] # print(staging_dict) for k, v in staging_dict.items(): group = { "label": k, "choices": v } out_array.append(group) with open(out_file_name, "w") as f: json.dump(out_array, f)
25,074
https://github.com/alanyee/python-terrascript/blob/master/terrascript/clc/d.py
Github Open Source
Open Source
BSD-2-Clause, Python-2.0
2,020
python-terrascript
alanyee
Python
Code
2
13
# terrascript/clc/d.py
35,293
https://github.com/AbeerMM/scriptmanager/blob/master/src/scripts/Coordinate_Analysis/FilterBEDbyProximity.java
Github Open Source
Open Source
MIT
null
scriptmanager
AbeerMM
Java
Code
454
1,825
package scripts.Coordinate_Analysis; import java.awt.BorderLayout; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import objects.BEDCoord; @SuppressWarnings({"serial"}) public class FilterBEDbyProximity extends JFrame{ private int CUTOFF; private InputStream inputStream; private File OUTPUTPATH = null; private String INPUTFILE = null; private PrintStream OUT_Filter = null; private PrintStream OUT_Cluster = null; private JTextArea textArea; public FilterBEDbyProximity(File input, int cutoff, File output) throws IOException { setTitle("BED File Filter Progress"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(150, 150, 600, 800); JScrollPane scrollPane = new JScrollPane(); getContentPane().add(scrollPane, BorderLayout.CENTER); textArea = new JTextArea(); textArea.setEditable(false); scrollPane.setViewportView(textArea); CUTOFF = cutoff; inputStream = new FileInputStream(input); INPUTFILE = input.getName(); OUTPUTPATH = output; String fname_f = INPUTFILE.substring(0, input.getName().lastIndexOf('.')) + "_" + Integer.toString(CUTOFF) + "bp-FILTER" + ".bed"; String fname_c = INPUTFILE.substring(0, input.getName().lastIndexOf('.')) + "_" + Integer.toString(CUTOFF) + "bp-CLUSTER" + ".bed"; if(OUTPUTPATH != null) { try { OUT_Filter = new PrintStream(new File(OUTPUTPATH.getCanonicalPath() + File.separator + fname_f)); OUT_Cluster = new PrintStream(new File(OUTPUTPATH.getCanonicalPath() + File.separator + fname_c)); } catch (FileNotFoundException e) { e.printStackTrace(); }} else { try { OUT_Filter = new PrintStream(new File(fname_f)); OUT_Cluster = new PrintStream(new File(fname_c)); } catch (FileNotFoundException e) { e.printStackTrace(); } } } public void run() throws IOException, InterruptedException { System.out.println("Filtering BED file with a cutoff: " + CUTOFF + " in " + INPUTFILE); System.out.println("Starting: " + getTimeStamp()); textArea.append("Filtering BED file with a cutoff: " + CUTOFF + " in " + INPUTFILE + "\n"); textArea.append("Starting: " + getTimeStamp() + "\n"); BufferedReader lines = new BufferedReader(new InputStreamReader(inputStream), 100); List<BEDCoord> bedArray = new ArrayList<BEDCoord>(); List<Integer> failArray = new ArrayList<Integer>(); String line; while((line = lines.readLine()) != null) { bedArray.add(new BEDCoord(line)); bedArray.get(bedArray.size() - 1).calcMid(); failArray.add(new Integer(0)); } Collections.sort(bedArray, BEDCoord.PeakMidpointComparator); Collections.sort(bedArray, BEDCoord.PeakChromComparator); for(int i = 0; i < bedArray.size(); i++) { int INDEX = i - 1; if(INDEX >= 0) { while((bedArray.get(i).getChrom().equals(bedArray.get(INDEX).getChrom())) && (Math.abs(bedArray.get(i).getMid() - bedArray.get(INDEX).getMid()) <= CUTOFF)) { if(bedArray.get(i).getScore() > bedArray.get(INDEX).getScore()) { failArray.set(INDEX, new Integer(1)); } else if((bedArray.get(i).getScore() == bedArray.get(INDEX).getScore()) && (bedArray.get(INDEX).getMid() > bedArray.get(i).getMid())) { failArray.set(INDEX, new Integer(1)); } else { failArray.set(i, new Integer(1)); } INDEX--; if(INDEX < 0) { break; } } } INDEX = i + 1; if(INDEX < bedArray.size()) { while((bedArray.get(i).getChrom().equals(bedArray.get(INDEX).getChrom())) && (Math.abs(bedArray.get(i).getMid() - bedArray.get(INDEX).getMid()) <= CUTOFF)) { if(bedArray.get(i).getScore() > bedArray.get(INDEX).getScore()) { failArray.set(INDEX, new Integer(1)); } else if((bedArray.get(i).getScore() == bedArray.get(INDEX).getScore()) && (bedArray.get(INDEX).getMid() > bedArray.get(i).getMid())) { failArray.set(INDEX, new Integer(1)); } else { failArray.set(i, new Integer(1)); } INDEX++; if(INDEX == bedArray.size()) {break; } } } } for(int x = 0; x < bedArray.size(); x++) { if(failArray.get(x).intValue() == 0) { OUT_Filter.println(bedArray.get(x).toString()); } else { OUT_Cluster.println(bedArray.get(x).toString()); } } OUT_Filter.close(); OUT_Cluster.close(); inputStream.close(); System.out.println("Completing: " + getTimeStamp()); textArea.append("Completing: " + getTimeStamp() + "\n"); Thread.sleep(1000); dispose(); } private static String getTimeStamp() { Date date= new Date(); String time = new Timestamp(date.getTime()).toString(); return time; } }
48,521
https://github.com/uWebshop/-INACTIVE-uWebshop-Core/blob/master/Umbraco/uWebshop.Umbraco7/DataTypes/MultiNodePickers/MultipleCategoryPicker.cs
Github Open Source
Open Source
MIT
2,016
-INACTIVE-uWebshop-Core
uWebshop
C#
Code
65
274
using System.Collections.Generic; using Umbraco.Core.Models; using Umbraco.Core.PropertyEditors; using Umbraco.Web.PropertyEditors; namespace uWebshop.Umbraco7.DataTypes.MultiNodePickers { [PropertyEditor("uWebshop.MultiContentPickerCategories", "uWebshop Multiple Category Picker", "contentpicker")] public sealed class MultipleCategoryPicker : MultiNodeTreePickerPropertyEditor { public MultipleCategoryPicker() { DefaultPreValues = new Dictionary<string, object> { //{"multiPicker", "1"}, { "startNode", new MultiNodePickerPreValues { type = "content", query = "//uwbsCategoryRepository" } }, { "filter", "uwbsCategory" } }; } protected override global::Umbraco.Core.PropertyEditors.PreValueEditor CreatePreValueEditor() { return new MultiNodePickerPreValueEditor(); } } }
25,985
https://github.com/ksrilal/glfa/blob/master/Version 2.0/src/app/pages/author-management/add-author/add-author.component.ts
Github Open Source
Open Source
MIT
2,020
glfa
ksrilal
TypeScript
Code
255
1,017
import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl, Validators } from '@angular/forms'; import { PasswordValidators } from '../../validators/password-validator'; import { AuthorManagementService } from '../author-management.service'; import { AngularFireStorage } from '@angular/fire/storage'; import * as firebase from 'firebase/app'; import { from } from 'rxjs'; @Component({ selector: 'ngx-add-author', templateUrl: './add-author.component.html', styleUrls: ['./add-author.component.scss'] }) export class AddAuthorComponent implements OnInit { constructor(private afStorage: AngularFireStorage, private authorManagement: AuthorManagementService) { } ngOnInit() { } downloadURL; randomId; latitude: number=0; longitude: number=0; upload(event) { this.randomId = Math.random() .toString(36) .substring(2); this.afStorage.upload("/authors/" + this.randomId, event.target.files[0]); } form = new FormGroup({ //userName: new FormControl("", Validators.required), name: new FormControl("", Validators.required), lname: new FormControl("", Validators.required), des: new FormControl("", Validators.required), pic: new FormControl("", Validators.required), email: new FormControl("", [Validators.required, Validators.email]), password: new FormControl("", [ Validators.required, Validators.minLength(8), ]), mobile: new FormControl("", [ Validators.required, Validators.minLength(10), Validators.maxLength(10) ]), confirmPassword: new FormControl("", [ Validators.required, Validators.minLength(8), PasswordValidators.checkPasswrod ]), gender: new FormControl("", Validators.required), // latitude: new FormControl(""), // longitude: new FormControl(""), }); onSubmit() { this.downloadURL = this.afStorage .ref("/authors/" + this.randomId) .getDownloadURL() .subscribe(a => { this.downloadURL = a; //console.log(this.downloadURL); //console.log(this.form.value); this.form.value.pic = this.downloadURL; // this.form.value.latitude = this.latitude; // this.form.value.longitude = this.longitude; const location = new firebase.firestore.GeoPoint( this.latitude,this.longitude ) this.form.value['latitude']=this.latitude; this.form.value['longitude']=this.longitude; this.form.value['role']='author'; this.form.value['orderId']='0'; this.form.value.pic = this.downloadURL; //console.log(this.form.value); this.authorManagement.create(this.form.value); this.form.reset(); }); } get email() { return this.form.get("email"); } get name() { return this.form.get("name"); } get lname() { return this.form.get("lname"); } get password() { return this.form.get("password"); } get mobile() { return this.form.get("mobile"); } get des() { return this.form.get("des"); } get pic() { return this.form.get("pic"); } get confirmPassword() { return this.form.get("confirmPassword"); } get gender() { return this.form.get("gender"); } }
3,171
https://github.com/pavana184/lmscourseplayer/blob/master/src/features/apis/api-info.js
Github Open Source
Open Source
MIT
null
lmscourseplayer
pavana184
JavaScript
Code
30
233
module.exports = { url: 'https://learner.contentenablers.com/storefront/', dummy_url: 'https://jsonplaceholder.typicode.com/', clientId: 139, ENCRYPT_IV: '0123456789123456', ENCRYPT_KEY: "HG58YZ3CR9HG58YZ3CR93CR9", destination: { authUrl : 'microservicelogin/', playerAuth: 'api/playerv2/auth/', userInfo:'api/lmsv2/info/', permawidgettext: 'api/playerv2/permawidgettext/', updatesNotesPoster: 'api/playerv2/updateNotesPosterById/', courseConfigUrl: 'api/playerv2/courseConfig/', dummy_post:'posts/' } };
30,653
https://github.com/chrreisinger/antlr4/blob/master/tool/test/org/antlr/v4/test/TestLexerExec.java
Github Open Source
Open Source
BSD-3-Clause
2,011
antlr4
chrreisinger
Java
Code
338
1,666
package org.antlr.v4.test; import org.junit.Test; public class TestLexerExec extends BaseTest { @Test public void testRefToRuleDoesNotSetTokenNorEmitAnother() throws Exception { String grammar = "lexer grammar L;\n"+ "A : '-' I ;\n" + "I : '0'..'9'+ ;\n"+ "WS : (' '|'\\n') {skip();} ;"; String found = execLexer("L.g", grammar, "L", "34 -21 3"); String expecting = "[@0,0:1='34',<4>,1:0]\n" + "[@1,3:5='-21',<3>,1:3]\n" + "[@2,7:7='3',<4>,1:7]\n" + "[@3,8:8='<EOF>',<-1>,1:8]\n"; assertEquals(expecting, found); } @Test public void testActionExecutedInDFA() throws Exception { String grammar = "lexer grammar L;\n"+ "I : '0'..'9'+ {System.out.println(\"I\");} ;\n"+ "WS : (' '|'\\n') {skip();} ;"; String found = execLexer("L.g", grammar, "L", "34 34"); String expecting = "I\n" + "I\n" + "[@0,0:1='34',<3>,1:0]\n" + "[@1,3:4='34',<3>,1:3]\n" + "[@2,5:5='<EOF>',<-1>,1:5]\n"; assertEquals(expecting, found); } @Test public void testLexerMode() throws Exception { String grammar = "lexer grammar L;\n" + "STRING_START : '\"' {pushMode(STRING_MODE); more();} ;\n" + "WS : ' '|'\n' {skip();} ;\n"+ "mode STRING_MODE;\n"+ "STRING : '\"' {popMode();} ;\n"+ "ANY : . {more();} ;\n"; String found = execLexer("L.g", grammar, "L", "\"abc\" \"ab\""); String expecting = "[@0,0:4='\"abc\"',<5>,1:0]\n" + "[@1,6:9='\"ab\"',<5>,1:6]\n" + "[@2,10:10='<EOF>',<-1>,1:10]\n"; assertEquals(expecting, found); } @Test public void testKeywordID() throws Exception { String grammar = "lexer grammar L;\n"+ "KEND : 'end' ;\n" + // has priority "ID : 'a'..'z'+ ;\n" + "WS : (' '|'\n')+ ;"; String found = execLexer("L.g", grammar, "L", "end eend ending a"); String expecting = "[@0,0:2='end',<3>,1:0]\n" + "[@1,3:3=' ',<5>,1:3]\n" + "[@2,4:7='eend',<4>,1:4]\n" + "[@3,8:8=' ',<5>,1:8]\n" + "[@4,9:14='ending',<4>,1:9]\n" + "[@5,15:15=' ',<5>,1:15]\n" + "[@6,16:16='a',<4>,1:16]\n" + "[@7,17:17='<EOF>',<-1>,1:17]\n"; assertEquals(expecting, found); } @Test public void testHexVsID() throws Exception { String grammar = "lexer grammar L;\n"+ "HexLiteral : '0' ('x'|'X') HexDigit+ ;\n"+ "DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) ;\n" + "FloatingPointLiteral : ('0x' | '0X') HexDigit* ('.' HexDigit*)? ;\n" + "DOT : '.' ;\n" + "ID : 'a'..'z'+ ;\n" + "fragment HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;\n" + "WS : (' '|'\n')+ ;"; String found = execLexer("L.g", grammar, "L", "x 0 1 a.b a.l"); String expecting = "[@0,0:0='x',<7>,1:0]\n" + "[@1,1:1=' ',<8>,1:1]\n" + "[@2,2:2='0',<4>,1:2]\n" + "[@3,3:3=' ',<8>,1:3]\n" + "[@4,4:4='1',<4>,1:4]\n" + "[@5,5:5=' ',<8>,1:5]\n" + "[@6,6:6='a',<7>,1:6]\n" + "[@7,7:7='.',<6>,1:7]\n" + "[@8,8:8='b',<7>,1:8]\n" + "[@9,9:9=' ',<8>,1:9]\n" + "[@10,10:10='a',<7>,1:10]\n" + "[@11,11:11='.',<6>,1:11]\n" + "[@12,12:12='l',<7>,1:12]\n" + "[@13,13:13='<EOF>',<-1>,1:13]\n"; assertEquals(expecting, found); } }
38,949
https://github.com/asp2insp/Nuclear-Swift/blob/master/NuclearTests/ImmutableTests.swift
Github Open Source
Open Source
MIT
null
Nuclear-Swift
asp2insp
Swift
Code
815
2,527
// // ImmutableTests.swift // Nuclear // // Created by Josiah Gaskin on 5/5/15. // Copyright (c) 2015 Josiah Gaskin. All rights reserved. // import UIKit import XCTest class ImmutableTests: XCTestCase { override func setUp() { super.setUp() } // Test contains func testContainsValueArray() { let state = Immutable.toState([0, 1, 2, 3, "true", false, 5]) XCTAssertTrue(state.containsValue(3), "") XCTAssertTrue(state.containsValue("true"), "") XCTAssertTrue(state.containsValue(false), "") XCTAssertFalse(state.containsValue(-1), "") } func testContainsValueMap() { let state = Immutable.toState(["items": ["eggs", "milk"], "total": 5]) XCTAssertTrue(state.containsValue(5), "") XCTAssertFalse(state.containsValue("items"), "") } func testContainsKeyMap() { let state = Immutable.toState(["items": ["eggs", "milk"], "total": 5]) XCTAssertTrue(state.containsKey("items"), "") XCTAssertTrue(state.containsKey("total"), "") XCTAssertFalse(state.containsKey("hello"), "") } // Test dirty marks func testSetInMarksAsDirty() { var state = Immutable.toState([:]) state = state.setIn(["a", 5], withValue: Immutable.toState(75)) XCTAssertTrue(state.getIn(["a", 5]) === state.getIn(["a", 5]), "Identity failed on same value") XCTAssertTrue(state.getIn(["a", 2]) === state.getIn(["a", 2]), "Identity failed on None") // Test replace state = state.setIn(["b", 10], withValue: Immutable.toState(30)) let oldValue = state.getIn(["a", 5]) let oldRoot = state let oldArray = state.getIn(["a"]) let oldUntouched = state.getIn(["b", 10]) state = state.setIn(["a", 5], withValue: Immutable.toState(88)) XCTAssertFalse(oldValue === state.getIn(["a", 5]), "Updated value should have different tag") XCTAssertFalse(oldArray === state.getIn(["a"]), "Array with updated child should have different tag") XCTAssertFalse(oldRoot === state, "Map with updated child should have different tag") XCTAssertTrue(oldUntouched === state.getIn(["b", 10]), "") } // Test mutators func testSetIn() { var state = Immutable.toState([:]) state = state.setIn(["a", 0, "b"], withValue: Immutable.toState("Hello!")) XCTAssertEqual("(Map {a : (Array [(Map {b : (Value)})])})", state.description(), "") XCTAssertEqual("Hello!", Immutable.fromState(state.getIn(["a", 0, "b"])) as! String, "") // Test auto fill arrays increment state = state.setIn(["a", 5], withValue: Immutable.toState(75)) XCTAssertEqual("(Map {a : (Array [(Map {b : (Value)}), (None), (None), (None), (None), (Value)])})", state.description(), "") XCTAssertEqual(75, Immutable.fromState(state.getIn(["a", 5])) as! Int, "") // Test replace state = state.setIn(["a", 5], withValue: Immutable.toState(88)) XCTAssertEqual(88, Immutable.fromState(state.getIn(["a", 5])) as! Int, "") } // Test mapping transformation func testMap() { let state = Immutable.toState([0, 1, 2, 3, 4, 5]) let plusThree = state.map({(int, index) in return Immutable.toState(int.toSwift() as! Int + 3) }) let native = plusThree.toSwift() as! [Any?] for var i = 0; i < 5; i++ { XCTAssertEqual(i+3, native[i] as! Int, "") } } // Test reducing transformation func testReduce() { let state = Immutable.toState([0, 1, 2, 3, 4, 5]) let summed = state.reduce(Immutable.toState(0), f: {(sum, one) in let a = sum.toSwift() as! Int let b = one.toSwift() as! Int return Immutable.toState(a + b) }) XCTAssertEqual(15, summed.toSwift() as! Int, "") } // Test helper functions that convert back from state func testFromStateNested() { let state = Immutable.toState(["shopping_cart": ["items": ["eggs", "milk"], "total": 5]]) let native = Immutable.fromState(state) as! [String:Any?] let cart = native["shopping_cart"] as! [String:Any?] let items = cart["items"] as! [Any?] XCTAssertEqual(5, cart["total"] as! Int, "") XCTAssertEqual("eggs", items[0] as! String, "") XCTAssertEqual("milk", items[1] as! String, "") } func testConvertBackFromArray() { let state = Immutable.convertArray([0, 1, 2, 3]) let native = Immutable.convertArrayBack(state) XCTAssertEqual(4, native.count, "There should be 4 items in the round-tripped array") for var i = 0; i < 3; i++ { XCTAssertEqual(i, native[i] as! Int, "") } } func testConvertBackFromMap() { let state = Immutable.convertMap(["hello":"world", "eggs":12]) let native = Immutable.convertMapBack(state) XCTAssertEqual(2, native.count, "There should be 2 items in the round-tripped array") XCTAssertEqual("world", native["hello"] as! String, "") XCTAssertEqual(12, native["eggs"] as! Int, "") } // Test comparison by tag, and marking as dirty func testTagging() { let a = Immutable.State.Value(5, 2) let b = Immutable.State.Value(5, 3) XCTAssertFalse(a === b, "States should be compared by tag not by value") XCTAssertTrue(a === a, "States should be self-identical") } // Test deep conversion to state func testDeepNestedToState() { let a = ["shopping_cart": ["items": ["eggs", "milk"], "total": 5]] let stateRep = Immutable.toState(a) let expected = "(Map {shopping_cart : (Map {items : (Array [(Value), (Value)]), total : (Value)})})" XCTAssertEqual(expected, stateRep.description(), "") } // Test simple conversion to state func testValueToState() { let a = 5 let stateRep = Immutable.toState(a) XCTAssertEqual( "(Value)", stateRep.description(), "") let b = "hello" let stateRep2 = Immutable.toState(b) XCTAssertEqual("(Value)", stateRep2.description(), "") } // Test deep conversion to state func testMapToState() { let a = ["total": 5] let stateRep = Immutable.toState(a) let expected = "(Map {total : (Value)})" XCTAssertEqual(expected, stateRep.description(), "") } // Test deep conversion to state func testArrayToState() { let a = ["eggs", "milk"] let stateRep = Immutable.toState(a) let expected = "(Array [(Value), (Value)])" XCTAssertEqual(expected, stateRep.description(), "") let b = [1, 2, 3] let stateRep2 = Immutable.toState(b) let expected2 = "(Array [(Value), (Value), (Value)])" XCTAssertEqual(expected2, stateRep2.description(), "") } // Test helper functions that convert to state func testConvertArray() { let a = ["eggs", "milk", 45] let stateRep = Immutable.State.Array(Immutable.convertArray(a), 4) let expected = "(Array [(Value), (Value), (Value)])" XCTAssertEqual(expected, stateRep.description(), "") } // Test helper functions that convert to state func testConvertMap() { let a = ["eggs":10, "milk":"one"] let stateRep = Immutable.State.Map(Immutable.convertMap(a), 3) let expected = "(Map {eggs : (Value), milk : (Value)})" XCTAssertEqual(expected, stateRep.description(), "") } // Ensure that our to string works since we'll be basing everything else on it func testDescription() { XCTAssertEqual("(Value)", Immutable.State.Value(3, 1).description(), "") XCTAssertEqual("(Array [(Value)])", Immutable.State.Array([Immutable.State.Value(3, 1)], 2).description(), "") XCTAssertEqual("(Map {hello : (Value)})", Immutable.State.Map(["hello":Immutable.State.Value(3, 1)], 2).description(), "") } }
25,421
https://github.com/vendelal/wave/blob/master/Wave/MelodySmart.h
Github Open Source
Open Source
MIT
2,015
wave
vendelal
Objective-C
Code
1,251
2,829
// // MelodySmart.h // MelodySmart // // Copyright (c) 2013 BlueCreation. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreBluetooth/CoreBluetooth.h> #define BC_LIB_MELODY_SMART_IOS_VER 0x0009 @class MelodySmart; /*! * @enum PioLocation * * @discussion Represents the set of PIOs the value is representing * * @constant pio_24_31 value is representing PIO 24 to PIO 31. * @constant pio_16_23 value is representing PIO 16 to PIO 23. * @constant pio_8_15 value is representing PIO 8 to PIO 15. * @constant pio_0_7 value is representing PIO 0 to PIO 7. * */ typedef enum { pio_24_31 = 0, pio_16_23, pio_8_15, pio_0_7 } BcSmartPioLocation; typedef enum { bc_smart_no_alert = 0, bc_smart_mild_alert, bc_smart_high_alert } BcSmartAlertLevel; /*! * @protocol MelodySmartDelegate * * @discussion The delegate of a MelodySmart object must adopt the <code>MelodySmartDelegate</code> protocol. The requirement of methods are * dependent on the implementation. * */ @protocol MelodySmartDelegate <NSObject> /*! * @method didConnectToMelody: * * @param melody The MelodySmart instance which corresponds to the connected device. * * @param result The result of the connection. YES if connection is successful and NO * otherwise. * * @discussion Invoked when a connection to a melody peripheral has finished. * */ - (void) melodySmart:(MelodySmart*)melody didConnectToMelody:(BOOL)result; - (void) melodySmartDidDisconnectFromMelody:(MelodySmart*)melody; /*! * @method didPopulateMelodyService: * * @param melody The MelodySmart instance which corresponds to the connected device. * * @discussion Invoked when the melody service has been populated after a connection * */ -(void) melodySmartDidPopulateMelodyService:(MelodySmart*)melody; /*! * @method didReceiveData: * * @param data The data received from Melody peripheral device. * * @discussion Invoked when data has arrived from the Data service from * the peripheral * */ - (void) melodySmart:(MelodySmart*)melody didSendData:(NSError*)error; /*! * @method didReceiveData: * * @param data The data received from Melody peripheral device. * * @discussion Invoked when data has arrived from the Data service from * the peripheral * */ - (void) melodySmart:(MelodySmart*)melody didReceiveData:(NSData*)data; /*! * @method didReceivePioChange: * * @param data 8 bits representing the new state of 1 or more pios. * * @param location the set of PIOs the state is representing PioLocation * * @discussion Invoked when a new pio state has arrived from the Pio state service from the peripheral. This is not yet supported. * */ @optional - (void) melodySmart:(MelodySmart*)melody didReceivePioChange:(unsigned char)state WithLocation:(BcSmartPioLocation)location; /*! * @method didReceivePioSettingChange: * * @param data 8 bits representing the new state of 1 or more pios. * * @param location the set of PIOs the state is representing PioLocation * * @discussion Invoked when a pio setting state has arrived from the Pio state service from the peripheral. This is not yet supported * */ @optional - (void) melodySmart:(MelodySmart*)melody didReceivePioSettingChange:(unsigned char)state WithLocation:(BcSmartPioLocation)location; /*! * @method didReceiveLinkLossLevel: * * @param level BC Smart Alert Level. * * @discussion Invoked when a the remote device replies reading the link loss alert level set on the remote device. * */ - (void) meldodySmart:(MelodySmart*)melody didReceiveLinkLossLevel:(BcSmartAlertLevel)level; /*! * @method didReceiveTxPower: * * @param level BC Smart Alert Level. * * @discussion Invoked when a the remote device replies reading the TX Power level set on the remote device. * */ - (void) meldodySmart:(MelodySmart*)melody didReceiveTxPower:(NSInteger)power; @end /*! * @class MelodySmart * * @discussion MelodySmart. This object can searh and commnicate with a Melody Smart peripheral. * */ @interface MelodySmart : NSObject /*! * @property delegate * * @discussion The delegate object that will receive Melody Smart events. * */ @property (nonatomic, assign) NSObject<MelodySmartDelegate> *delegate; /*! * @method name * * @return The name of the peripheral. * * @discussion Returns the name of the peripheral in MelodySmart instance. * */ - (NSString*) name; /*! * @method RSSI * * @return The RSSI of the peripheral. * * @discussion Resturns the RSSI of the peripheral in MelodySmart instance * */ - (NSNumber*) RSSI; /*! * @method isConnected * * @return YES if the peripheral is connected, NO otherwise * * @discussion Returns the connection status. * */ - (BOOL) isConnected; /*! * @method connect * * @discussion Start a connection with this instance of MelodySmart. This instance contains one set of UUIDs * */ - (void) connect; /*! * @method disconnect * * @discussion Release the connection with the current Melody peripheral referenced in this object. * */ - (void) disconnect; /*! * @method sendData * * @param data The data to send to the peripheral. Due to BLE protocol limitations, the maximum size of a single data chunk is 20 bytes. No data is transmitted if the chunk exceeds that size. * * @discussion Sends data using the Data service to the connected Melody peripheral. * */ - (bool) sendData:(NSData*) data; /*! * @method sendPioState * * @param data 8 bits representing the new state of 1 or more pios. * * @param location the set of PIOs the state is representing PioLocation * * @discussion Sends the new state of the pios. Only output PIOs are affected in this method. * */ - (void) sendPioState:(unsigned char)state WithLocation:(BcSmartPioLocation)location; /*! * @method sendPioSetting * * @param data 8 bits representing the new state of 1 or more pios. * * @param location the set of PIOs the state is representing PioLocation * * @discussion Configured the PIOs to input and output, bit with 1 represents output, 0 represents input * */ - (void) sendPioSetting:(unsigned char)state WithLocation:(BcSmartPioLocation)location; /*! * @method readData * * @discussion Request a read over the Data service. Note that this might not be supported by the peripheral. * */ - (void) readData; /*! * @method readPioState * * @param location The location that is required. * * @discussion Request a read of the pio state from the peripheral. didRecveivePioChange will be invoked for location even if no changes occured. * */ - (void) readPioState:(BcSmartPioLocation)location; /*! * @method readPioSetting * * @param location The location that is required. * * @discussion Request a read of the pio setting state from the peripheral. didRecveivePioSettingChange will be invoked for location even if no changes occured. * */ - (void) readPioSetting:(BcSmartPioLocation)location; /*! * @method setDataNotification * * @param enable YES to enable notification, NO to disable them * * @discussion Enable Notification of the Data service or not. * */ - (void) setDataNotification:(BOOL) enable; /*! * @method init * * @param enable YES to enable notification, NO to disable them * * @discussion Enable Notification of the Pio Report service or not. * */ - (void) setPioNotification:(BOOL) enable; /*! * @method identifier * * @discussion The unique identifier associated with the peripheral. */ - (const NSUUID*) identifier; /*! * @method readLinkLossLevel * * @discussion Read the remote device link loss alert level. */ - (void) readLinkLossLevel; /*! * @method setLinkLossLevel * * @param level The new level of the link loss alert level of the remove device. * * @discussion Set the remote device link loss alert level. */ - (void) setLinkLossLevel:(BcSmartAlertLevel) level; /*! * @method setImmediateAlertLevel * * @param level Set the alert level of the remote device. * * @discussion Set the the alert level of the remote device immediatly. */ - (void) setImmediateAlertLevel:(BcSmartAlertLevel) level; /*! * @method readCurrentTxPower * * @discussion Retrieve the current TX power of the remote device.s */ - (void) readCurrentTxPower; /*! * This is the set of the remote device Information. * This is read after connecting to the remote device. */ @property(readonly, nonatomic) NSString *deviceInfoSystemId; @property(readonly, nonatomic) NSString *deviceInfoModelNumber; @property(readonly, nonatomic) NSString *deviceInfoSerialNumber; @property(readonly, nonatomic) NSString *deviceInfoHardwareRevision; @property(readonly, nonatomic) NSString *deviceInfoFirmwareRevision; @property(readonly, nonatomic) NSString *deviceInfoSoftwareRevisin; @property(readonly, nonatomic) NSString *deviceInfoManufacturerName; @property(readonly, nonatomic) NSInteger pnpSourceID; @property(readonly, nonatomic) NSInteger pnpVid; @property(readonly, nonatomic) NSInteger pnpPid; @property(readonly, nonatomic) NSInteger pnpProductVersion; @end
10,671
https://github.com/mhxw/solidity-by-example-cn/blob/master/src/pages/app/time-lock/TimeLock.sol
Github Open Source
Open Source
MIT
null
solidity-by-example-cn
mhxw
Solidity
Code
428
1,190
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; contract TimeLock { error NotOwnerError(); error AlreadyQueuedError(bytes32 txId); error TimestampNotInRangeError(uint blockTimestamp, uint timestamp); error NotQueuedError(bytes32 txId); error TimestampNotPassedError(uint blockTimestmap, uint timestamp); error TimestampExpiredError(uint blockTimestamp, uint expiresAt); error TxFailedError(); event Queue( bytes32 indexed txId, address indexed target, uint value, string func, bytes data, uint timestamp ); event Execute( bytes32 indexed txId, address indexed target, uint value, string func, bytes data, uint timestamp ); event Cancel(bytes32 indexed txId); uint public constant MIN_DELAY = 10; // seconds uint public constant MAX_DELAY = 1000; // seconds uint public constant GRACE_PERIOD = 1000; // seconds address public owner; // tx id => queued mapping(bytes32 => bool) public queued; constructor() { owner = msg.sender; } modifier onlyOwner() { if (msg.sender != owner) { revert NotOwnerError(); } _; } receive() external payable {} function getTxId( address _target, uint _value, string calldata _func, bytes calldata _data, uint _timestamp ) public pure returns (bytes32) { return keccak256(abi.encode(_target, _value, _func, _data, _timestamp)); } /** * @param _target Address of contract or account to call * @param _value Amount of ETH to send * @param _func Function signature, for example "foo(address,uint256)" * @param _data ABI encoded data send. * @param _timestamp Timestamp after which the transaction can be executed. */ function queue( address _target, uint _value, string calldata _func, bytes calldata _data, uint _timestamp ) external onlyOwner returns (bytes32 txId) { txId = getTxId(_target, _value, _func, _data, _timestamp); if (queued[txId]) { revert AlreadyQueuedError(txId); } // ---|------------|---------------|------- // block block + min block + max if ( _timestamp < block.timestamp + MIN_DELAY || _timestamp > block.timestamp + MAX_DELAY ) { revert TimestampNotInRangeError(block.timestamp, _timestamp); } queued[txId] = true; emit Queue(txId, _target, _value, _func, _data, _timestamp); } function execute( address _target, uint _value, string calldata _func, bytes calldata _data, uint _timestamp ) external payable onlyOwner returns (bytes memory) { bytes32 txId = getTxId(_target, _value, _func, _data, _timestamp); if (!queued[txId]) { revert NotQueuedError(txId); } // ----|-------------------|------- // timestamp timestamp + grace period if (block.timestamp < _timestamp) { revert TimestampNotPassedError(block.timestamp, _timestamp); } if (block.timestamp > _timestamp + GRACE_PERIOD) { revert TimestampExpiredError(block.timestamp, _timestamp + GRACE_PERIOD); } queued[txId] = false; // prepare data bytes memory data; if (bytes(_func).length > 0) { // data = func selector + _data data = abi.encodePacked(bytes4(keccak256(bytes(_func))), _data); } else { // call fallback with data data = _data; } // call target (bool ok, bytes memory res) = _target.call{value: _value}(data); if (!ok) { revert TxFailedError(); } emit Execute(txId, _target, _value, _func, _data, _timestamp); return res; } function cancel(bytes32 _txId) external onlyOwner { if (!queued[_txId]) { revert NotQueuedError(_txId); } queued[_txId] = false; emit Cancel(_txId); } }
23,868
https://github.com/miaobin/webnn-native/blob/master/src/tests/end2end/MulTests.cpp
Github Open Source
Open Source
Apache-2.0
null
webnn-native
miaobin
C++
Code
806
5,300
// Copyright 2021 The WebNN-native Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "src/tests/WebnnTest.h" class MulTests : public WebnnTest {}; TEST_F(MulTests, MulInputAndConstant) { ml::GraphBuilder builder = ml::CreateGraphBuilder(GetContext()); ml::Operand a = utils::BuildInput(builder, "a", {3, 4, 5}); std::vector<float> dataB = { 2.0435283, 0.07213961, -1.1644137, -1.2209045, 0.8982674, 0.21796915, 0.27658972, 0.7744382, -0.52159035, -0.969913, 0.6081186, -0.04225572, 0.3275312, -0.06443629, -2.257355, 1.7802691, -1.279233, -3.1389477, -1.1663845, -0.79485595, 0.679013, 1.0919031, 0.51905185, 1.3186365, 0.6612518, 0.40741763, 0.05208012, 0.16548257, -0.4570541, 0.10149371, 0.08249464, 0.3992067, -0.3945879, -0.37389037, 1.4760005, -0.781274, -0.49022308, 0.27020553, -0.2356837, 0.13846985, 0.9767852, -1.3560135, 0.78826934, -0.18788454, 0.38178417, 0.9748209, 1.0242884, 0.7939937, 0.24449475, -1.3840157, 1.9665064, 0.35833818, -0.87076694, -0.76727265, 0.6157508, -0.5558823, 0.18417479, -0.93904793, -0.00859687, 0.5034271}; ml::Operand b = utils::BuildConstant(builder, {3, 4, 5}, dataB.data(), dataB.size() * sizeof(float)); ml::Operand c = builder.Mul(a, b); ml::Graph graph = utils::AwaitBuild(builder, {{"c", c}}); ASSERT_TRUE(graph); std::vector<float> dataA = { 5.6232101e-01, 1.3117781e-01, -1.4161869e+00, 2.0386910e-02, 9.1077393e-01, 7.4952751e-01, -2.8509337e-01, -1.6272701e+00, 1.0271618e+00, 4.2815253e-01, -7.7895027e-01, 9.7542489e-01, 3.9352554e-01, 9.7878903e-01, -6.0965502e-01, 6.6299748e-01, -1.1980454e+00, -7.7857232e-01, -9.8175555e-01, -2.8763762e-01, -3.2260692e-01, -7.4259090e-01, -1.0055183e+00, -1.4305019e+00, 6.0624069e-01, -1.5911928e-01, 4.5598033e-01, 1.0880016e-01, 1.4949993e+00, 6.6210419e-01, -5.6889033e-01, -2.0945708e-01, -7.1049523e-01, -2.8507587e-01, 1.1723405e+00, -6.3937567e-02, -5.4250038e-01, -1.2398884e+00, -1.0347517e+00, 1.2763804e+00, -1.5979607e+00, -5.8152825e-01, -5.0100851e-01, -1.0742084e+00, -1.1273566e+00, 3.4815140e-04, -5.6024802e-01, 1.0848801e+00, -5.1780093e-01, -3.8996863e-01, 5.3133094e-01, 2.3897937e-01, -1.3832775e+00, 6.3414145e-01, 1.0691971e+00, 5.7040757e-01, 3.0711100e-01, 8.8405716e-01, -2.1583509e+00, 4.3243581e-01}; ml::Input input = {dataA.data(), dataA.size() * sizeof(float)}; ml::Result result = utils::AwaitCompute(graph, {{"a", input}}).Get("c"); EXPECT_TRUE(utils::CheckShape(result, {3, 4, 5})); std::vector<float> expectedData = { 1.1491189e+00, 9.4631165e-03, 1.6490275e+00, -2.4890469e-02, 8.1811851e-01, 1.6337387e-01, -7.8853898e-02, -1.2602202e+00, -5.3575772e-01, -4.1527072e-01, -4.7369415e-01, -4.1217282e-02, 1.2889189e-01, -6.3069537e-02, 1.3762078e+00, 1.1803139e+00, 1.5325792e+00, 2.4438977e+00, 1.1451044e+00, 2.2863047e-01, -2.1905430e-01, -8.1083733e-01, -5.2191615e-01, -1.8863121e+00, 4.0087774e-01, -6.4828001e-02, 2.3747511e-02, 1.8004529e-02, -6.8329555e-01, 6.7199409e-02, -4.6930403e-02, -8.3616674e-02, 2.8035283e-01, 1.0658713e-01, 1.7303753e+00, 4.9952760e-02, 2.6594621e-01, -3.3502471e-01, 2.4387409e-01, 1.7674020e-01, -1.5608643e+00, 7.8856015e-01, -3.9492965e-01, 2.0182715e-01, -4.3040693e-01, 3.3938527e-04, -5.7385558e-01, 8.6138797e-01, -1.2659961e-01, 5.3972268e-01, 1.0448657e+00, 8.5635431e-02, 1.2045124e+00, -4.8655939e-01, 6.5835893e-01, -3.1707945e-01, 5.6562103e-02, -8.3017206e-01, 1.8555066e-02, 2.1769990e-01}; EXPECT_TRUE(utils::CheckValue(result, expectedData)); } TEST_F(MulTests, MulTwoInputs) { ml::GraphBuilder builder = ml::CreateGraphBuilder(GetContext()); ml::Operand a = utils::BuildInput(builder, "a", {3, 4, 5}); ml::Operand b = utils::BuildInput(builder, "b", {3, 4, 5}); ml::Operand c = builder.Mul(a, b); ml::Graph graph = utils::AwaitBuild(builder, {{"c", c}}); ASSERT_TRUE(graph); std::vector<float> dataA = { 5.6232101e-01, 1.3117781e-01, -1.4161869e+00, 2.0386910e-02, 9.1077393e-01, 7.4952751e-01, -2.8509337e-01, -1.6272701e+00, 1.0271618e+00, 4.2815253e-01, -7.7895027e-01, 9.7542489e-01, 3.9352554e-01, 9.7878903e-01, -6.0965502e-01, 6.6299748e-01, -1.1980454e+00, -7.7857232e-01, -9.8175555e-01, -2.8763762e-01, -3.2260692e-01, -7.4259090e-01, -1.0055183e+00, -1.4305019e+00, 6.0624069e-01, -1.5911928e-01, 4.5598033e-01, 1.0880016e-01, 1.4949993e+00, 6.6210419e-01, -5.6889033e-01, -2.0945708e-01, -7.1049523e-01, -2.8507587e-01, 1.1723405e+00, -6.3937567e-02, -5.4250038e-01, -1.2398884e+00, -1.0347517e+00, 1.2763804e+00, -1.5979607e+00, -5.8152825e-01, -5.0100851e-01, -1.0742084e+00, -1.1273566e+00, 3.4815140e-04, -5.6024802e-01, 1.0848801e+00, -5.1780093e-01, -3.8996863e-01, 5.3133094e-01, 2.3897937e-01, -1.3832775e+00, 6.3414145e-01, 1.0691971e+00, 5.7040757e-01, 3.0711100e-01, 8.8405716e-01, -2.1583509e+00, 4.3243581e-01}; std::vector<float> dataB = { 2.0435283, 0.07213961, -1.1644137, -1.2209045, 0.8982674, 0.21796915, 0.27658972, 0.7744382, -0.52159035, -0.969913, 0.6081186, -0.04225572, 0.3275312, -0.06443629, -2.257355, 1.7802691, -1.279233, -3.1389477, -1.1663845, -0.79485595, 0.679013, 1.0919031, 0.51905185, 1.3186365, 0.6612518, 0.40741763, 0.05208012, 0.16548257, -0.4570541, 0.10149371, 0.08249464, 0.3992067, -0.3945879, -0.37389037, 1.4760005, -0.781274, -0.49022308, 0.27020553, -0.2356837, 0.13846985, 0.9767852, -1.3560135, 0.78826934, -0.18788454, 0.38178417, 0.9748209, 1.0242884, 0.7939937, 0.24449475, -1.3840157, 1.9665064, 0.35833818, -0.87076694, -0.76727265, 0.6157508, -0.5558823, 0.18417479, -0.93904793, -0.00859687, 0.5034271}; ml::Input inputA = {dataA.data(), dataA.size() * sizeof(float)}; ml::Input inputB = {dataB.data(), dataB.size() * sizeof(float)}; ml::Result result = utils::AwaitCompute(graph, {{"a", inputA}, {"b", inputB}}).Get("c"); EXPECT_TRUE(utils::CheckShape(result, {3, 4, 5})); std::vector<float> expectedData = { 1.1491189e+00, 9.4631165e-03, 1.6490275e+00, -2.4890469e-02, 8.1811851e-01, 1.6337387e-01, -7.8853898e-02, -1.2602202e+00, -5.3575772e-01, -4.1527072e-01, -4.7369415e-01, -4.1217282e-02, 1.2889189e-01, -6.3069537e-02, 1.3762078e+00, 1.1803139e+00, 1.5325792e+00, 2.4438977e+00, 1.1451044e+00, 2.2863047e-01, -2.1905430e-01, -8.1083733e-01, -5.2191615e-01, -1.8863121e+00, 4.0087774e-01, -6.4828001e-02, 2.3747511e-02, 1.8004529e-02, -6.8329555e-01, 6.7199409e-02, -4.6930403e-02, -8.3616674e-02, 2.8035283e-01, 1.0658713e-01, 1.7303753e+00, 4.9952760e-02, 2.6594621e-01, -3.3502471e-01, 2.4387409e-01, 1.7674020e-01, -1.5608643e+00, 7.8856015e-01, -3.9492965e-01, 2.0182715e-01, -4.3040693e-01, 3.3938527e-04, -5.7385558e-01, 8.6138797e-01, -1.2659961e-01, 5.3972268e-01, 1.0448657e+00, 8.5635431e-02, 1.2045124e+00, -4.8655939e-01, 6.5835893e-01, -3.1707945e-01, 5.6562103e-02, -8.3017206e-01, 1.8555066e-02, 2.1769990e-01}; EXPECT_TRUE(utils::CheckValue(result, expectedData)); } TEST_F(MulTests, MulBroadcast) { ml::GraphBuilder builder = ml::CreateGraphBuilder(GetContext()); ml::Operand a = utils::BuildInput(builder, "a", {3, 4, 5}); std::vector<float> dataB = { 0.6338172, 1.630534, -1.3819867, -1.0427561, 1.058136, }; ml::Operand b = utils::BuildConstant(builder, {5}, dataB.data(), dataB.size() * sizeof(float)); ml::Operand c = builder.Mul(a, b); ml::Graph graph = utils::AwaitBuild(builder, {{"c", c}}); ASSERT_TRUE(graph); std::vector<float> dataA = { -0.08539673, 0.11800674, -1.2358714, 0.30089188, -0.73443925, 1.4894297, 0.16823359, -2.2034893, 1.0740992, -0.35457978, 0.61524934, 0.462153, 0.5992003, -0.81047946, -2.2757835, -0.21841764, 1.1650828, -0.56927145, 1.9960726, 0.62048405, 0.10586528, -1.0386543, -1.9402571, -2.0906122, -0.4305259, -1.2730165, 1.5639576, 0.53357494, -0.8079486, -0.06450062, -0.7841324, -0.24135855, 1.9275267, 0.4476717, 0.15467685, -1.2363592, -0.50745815, 0.03250425, 0.86344534, -0.7938714, 1.1835734, 1.515135, 0.3092435, -1.311751, -0.6659017, 0.8815683, -0.31157655, 0.57511795, -1.1924151, -1.8408557, -0.85080767, -1.3341717, 0.54687303, -0.14426671, -0.15728855, 0.323939, 1.167636, 0.03020451, 0.91373825, 1.0675793, }; ml::Input input = {dataA.data(), dataA.size() * sizeof(float)}; ml::Result result = utils::AwaitCompute(graph, {{"a", input}}).Get("c"); EXPECT_TRUE(utils::CheckShape(result, {3, 4, 5})); std::vector<float> expectedData = { -0.05412592, 0.192414, 1.707958, -0.31375682, -0.7771366, 0.9440262, 0.2743106, 3.045193, -1.1200235, -0.37519363, 0.3899556, 0.7535562, -0.82808685, 0.8451324, -2.4080884, -0.13843685, 1.8997072, 0.7867256, -2.0814168, 0.6565565, 0.06709924, -1.6935612, 2.6814096, 2.1799986, -0.45555493, -0.80685973, 2.550086, -0.7373935, 0.8424933, -0.06825043, -0.4969966, -0.39354333, -2.6638165, -0.4668124, 0.16366914, -0.7836257, -0.8274278, -0.04492044, -0.9003629, -0.8400239, 0.75016916, 2.4704792, -0.42737043, 1.3678364, -0.7046146, 0.55875313, -0.5080362, -0.79480535, 1.2433981, -1.9478757, -0.5392565, -2.1754124, -0.7557713, 0.15043499, -0.16643268, 0.20531811, 1.9038703, -0.04174223, -0.9528061, 1.129644, }; EXPECT_TRUE(utils::CheckValue(result, expectedData)); }
8,911
https://github.com/PrinceKael/U-232-V5/blob/master/scripts/jquery.status.js
Github Open Source
Open Source
WTFPL
2,022
U-232-V5
PrinceKael
JavaScript
Code
220
1,109
$(document).ready( function () { $('#status_button').click(function () { alert('should edit'); }); $('#status_button_cancel').click(function () { alert('Should cancel'); }); }); function status_count() { var text_limit = 140; var text = $('#status').val(); if(typeof text == 'undefined') var text = $('#box_status').val(); var text_length = text.length; if(text_length > text_limit) $('#status').val(text.substr(0,text_limit)); else $('#status_count').html(text_limit-text_length); } function status_slide(){ if($('#status_archive').is(':hidden')){ $('#status_archive').slideDown('slow'); $('#status_archive_click').html('-'); } else { $('#status_archive').slideUp('slow'); $('#status_archive_click').html('+'); } } function status_pedit() { var current = $('#current_status').html(); $('#current_holder').hide(); $('#status').val('').val(current).focus(); $('#status').after("<div id='status_buttons'><input type='button' onclick='status_edit()' value='Edit' /><input type='button' onclick='status_cancel()' value='Cancel' /></div>"); status_count(); } function status_edit() { var status = $('#status').val(); $.post('ajax.status.php',{action:'edit',ss:status},function (data) { if(data.status) { $('#status_buttons').fadeOut().remove(); $('#status').val(''); $('#current_status').empty().html(data.msg); $('#current_holder').fadeIn(); status_count(); }else alert(data.msg); },'json'); } function status_showbox(text) { if(typeof text == 'undefined') var text = ''; var status_box = "<div id='status_box' style='display:none;'><div id='status_title' >Status update</div><div id='status_content'><textarea name='status' id='box_status' onkeyup='status_count()' cols='50' style='width:50%;'rows='4'>"+text+"</textarea><br/><div style='text-align:right;'><input type='button' value='Update' onclick='status_update()' /><input type='button' value='Cancel' onclick='status_distroy_box()'/></div></div><div id='status_tool'><div style='float:left;'>NO bbcode or html allowed</div><div style='float:right;' id='status_count'>140</div><div style='clear:both;'></div></div>"; $('body').after(status_box); $("#status_box").css("top",(($(window).height()/2)-($("#status_box").height()/2))); $("#status_box").css("left",(($(window).width()/2)-($("#status_box").width()/2))); $("#status_box").fadeIn('slow'); //status_count(); } function status_distroy_box() { $('#status_box').fadeOut('slow').remove(); } function status_update(u) { var status = $('#box_status').val(); if(status.length > 0) { $.post('ajax.status.php',{action:'new',ss:status}, function (data) { if(data.status) { $('#status_content').empty(); $('#status_tool').remove(); $('#status_content').html(data.msg); window.setTimeout(function () { status_distroy_box() },1000); } else alert(data.msg); },'json'); } } function status_cancel() { $('#status').val(''); $('#status_buttons').fadeOut().remove(); $('#current_holder').fadeIn(); status_count(); } function status_delete(id) { if(confirm('Are you sure you want to do this ?')) { $.post('ajax.status.php',{action:'delete',id:id}, function (data) { if(data.status) { $('#status_'+id).fadeOut(); } else alert(data.msg); },'json'); } }
48,390
https://github.com/ycs77/phptheday-inertiajs-demo-resource/blob/master/03 todolist/Todolist.vue
Github Open Source
Open Source
MIT
2,020
phptheday-inertiajs-demo-resource
ycs77
Vue
Code
193
833
<template> <div class="max-w-md mx-auto"> <h1 class="text-purple-700 text-3xl text-center">待辦事項</h1> <div class="bg-white mt-4 border border-purple-200 divide-y divide-purple-200 rounded-md shadow-md"> <form class="flex px-6 py-4" @submit.prevent="createTodo"> <div class="flex-1 mr-4"> <input type="text" class="form-input w-full" placeholder="請輸入待辦事項..." v-model="form.content"> <!-- <div class="mt-2 text-red-600 text-sm"> 錯誤訊息... </div> --> </div> <div> <button class="px-4 py-2 text-white bg-purple-500 rounded hover:bg-purple-400 focus:outline-none">新增</button> </div> </form> <div v-for="todo in todos" :key="todo.id" class="flex select-none"> <label class="flex flex-1 px-6 py-4 cursor-pointer"> <div class="mr-4"> <input type="checkbox" class="form-checkbox cursor-pointer" v-model="todo.checked" @change="checkTodo(todo.id, todo.checked)"> </div> <div class="flex-1" :class="todo.checked ? 'text-gray-500 line-through' : ''">{{ todo.content }}</div> </label> <button class="px-6 text-red-600 hover:text-red-400 focus:outline-none" @click="removeTodo(todo.id)"> <svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path> </svg> </button> </div> </div> </div> </template> <script> export default { metaInfo: { title: '待辦事項' }, data() { return { todos: [ { id: 1, content: '修復 A bug', checked: true }, { id: 2, content: '開發 B 功能', checked: false } ], form: { content: '' } } }, methods: { createTodo() { console.log(`新增 ${this.form.content} 待辦事項...`) }, checkTodo(id, checked) { console.log(`核選 ${id} 號待辦事項...`, checked) }, removeTodo(id) { console.log(`刪除 ${id} 號待辦事項...`) } } } </script>
26,093
https://github.com/GuillermoElectrico/energy-meter-logger/blob/master/write_register.py
Github Open Source
Open Source
GPL-3.0-only
2,023
energy-meter-logger
GuillermoElectrico
Python
Code
136
303
#!/usr/bin/env python import minimalmodbus #sudo pip install pyserial #sudo pip install minimalmodbus instrument = minimalmodbus.Instrument('/dev/ttyAMA0', 1) # port name, slave address (in decimal) #instrument = minimalmodbus.Instrument('/dev/serial0', 1) # port name, slave address (in decimal) instrument.debug = True #instrument.serial.port # this is the serial port name instrument.serial.baudrate = 2400 # Baud instrument.serial.bytesize = 8 instrument.serial.parity = minimalmodbus.serial.PARITY_EVEN instrument.serial.stopbits = 1 instrument.serial.timeout = 0.5 # seconds #instrument.address # this is the slave address number instrument.mode = minimalmodbus.MODE_RTU # rtu or ascii mode # It needs to long press the button on meter last for 3 seconds to enter the set-up interface firstly, # then the set-up can be realized via RS485 communication. After the set-up is finished, # long press last for 3 seconds to exit the set-up interface instrument.write_float(28, 2, 2) #Write Address=28, baudrate 2=9600, 2 registers)
17,106
https://github.com/Maksimka101/isolate-bloc/blob/master/packages/isolate_bloc/test/src/common/isolate/isolate_bloc_events/isolate_bloc_events_test.dart
Github Open Source
Open Source
MIT
2,022
isolate-bloc
Maksimka101
Dart
Code
65
321
// ignore_for_file: no-equal-arguments import 'package:flutter_test/flutter_test.dart'; import 'package:isolate_bloc/src/common/isolate/isolate_bloc_events/isolate_bloc_events.dart'; void main() { test('Events creating', () { const CloseIsolateBlocEvent(''); const IsolateBlocsInitialized({}); const IsolateBlocCreatedEvent(''); const CreateIsolateBlocEvent(Object, ''); const IsolateBlocTransitionEvent('', ''); }); test('test equality', () { expect(const CloseIsolateBlocEvent(''), const CloseIsolateBlocEvent('')); expect( const IsolateBlocsInitialized({}), const IsolateBlocsInitialized({}), ); expect( const IsolateBlocCreatedEvent(''), const IsolateBlocCreatedEvent(''), ); expect( const CreateIsolateBlocEvent(Object, ''), const CreateIsolateBlocEvent(Object, ''), ); expect( const IsolateBlocTransitionEvent('', ''), const IsolateBlocTransitionEvent('', ''), ); }); }
8,301
https://github.com/LMiceOrg/Modelingtools/blob/master/autotools/modelparser/excelmodelpropertyparser.py
Github Open Source
Open Source
MIT
2,016
Modelingtools
LMiceOrg
Python
Code
38
173
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Excel ModelProperty表单解析器基类, ExcelModelPropertyParser Sheet struct: """ import excelsheetparser class ExcelModelPropertyParser(excelsheetparser.ExcelSheetParser): def ParseExcelSheet(self, model, xl_name, sh_ctx, sh_idx, sh_name): #get namespace self.GetNamespace(xl_name, sh_idx, sh_name) #model.AppendItem(xl_name, sh_idx, sh_name, self.ns, "ModelProperty", (last_ed_type, last_ed_desc, last_ed_items))
23,100
https://github.com/BingzhangChen/Citrate/blob/master/DRAM/EFTsimple_sRun/S1_aI1.2/Compile/npzd_cont__genmod.f90
Github Open Source
Open Source
MIT
2,019
Citrate
BingzhangChen
Fortran Free Form
Code
21
79
!COMPILER-GENERATED INTERFACE MODULE: Tue May 2 15:02:02 2017 MODULE NPZD_CONT__genmod INTERFACE SUBROUTINE NPZD_CONT END SUBROUTINE NPZD_CONT END INTERFACE END MODULE NPZD_CONT__genmod
27,799
https://github.com/rust404/icons-vue3/blob/master/src/icons/Mdb.vue
Github Open Source
Open Source
MIT
2,020
icons-vue3
rust404
Vue
Code
69
450
<template> <w-icon v-bind="$attrs"> <svg viewBox="0 0 576 512"><path d="M17.37 160.41L7 352h43.91l5.59-79.83L84.43 352h44.71l25.54-77.43 4.79 77.43H205l-12.79-191.59H146.7L106 277.74 63.67 160.41zm281 0h-47.9V352h47.9s95 .8 94.2-95.79c-.78-94.21-94.18-95.78-94.18-95.78zm-1.2 146.46V204.78s46 4.27 46.8 50.57-46.78 51.54-46.78 51.54zm238.29-74.24a56.16 56.16 0 008-38.31c-5.34-35.76-55.08-34.32-55.08-34.32h-51.9v191.58H482s87 4.79 87-63.85c0-43.14-33.52-55.08-33.52-55.08zm-51.9-31.94s13.57-1.59 16 9.59c1.43 6.66-4 12-4 12h-12v-21.57zm-.1 109.46l.1-24.92V267h.08s41.58-4.73 41.19 22.43c-.33 25.65-41.35 20.74-41.35 20.74z"/></svg> </w-icon> </template> <script> /* This file is auto generated by generateIcon.js */ import WIcon from '../index.js' export default { name: 'Mdb', components: { WIcon }, } </script>
5,996
https://github.com/02GEEK/course-react-ui/blob/master/004-sass/source/bootstrap/utils.js
Github Open Source
Open Source
MIT
null
course-react-ui
02GEEK
JavaScript
Code
17
59
export function classify(key, value){ if(value[0]==='-') value = key+value; value = value.split(' -').join(` ${key}-`); return `${key} ${value}`; }
4,449
https://github.com/mmm-soares/concurrency-java-9/blob/master/Chapter08/IRSystem/src/com/javferna/packtpub/mastering/irsystem/concurrent/ConcurrentData.java
Github Open Source
Open Source
MIT
null
concurrency-java-9
mmm-soares
Java
Code
171
738
package com.javferna.packtpub.mastering.irsystem.concurrent; import com.javferna.packtpub.mastering.irsystem.common.Token; public class ConcurrentData { public static void getWordsInFile1(String fileName, ConcurrentInvertedIndex index) { long value = index .getIndex() .parallelStream() .filter(token -> fileName.equals(token.getFile())) .count(); System.out.println("Words in File "+fileName+": "+value); } public static void getWordsInFile2(String fileName, ConcurrentInvertedIndex index) { long value = index .getIndex() .parallelStream() .filter(token -> fileName.equals(token.getFile())) .mapToLong(token -> 1) .reduce(0, Long::sum); System.out.println("Words in File "+fileName+": "+value); } public static void getAverageTfxidf(String fileName, ConcurrentInvertedIndex index) { long wordCounter = index .getIndex() .parallelStream() .filter(token -> fileName.equals(token.getFile())) .mapToLong(token -> 1) .reduce(0, Long::sum); double tfxidf = index .getIndex() .parallelStream() .filter(token -> fileName.equals(token.getFile())) .reduce(0d, (n,t) -> n+t.getTfxidf(), (n1,n2) -> n1+n2); System.out.println("Words in File "+fileName+": "+(tfxidf/wordCounter)); } public static void maxTfxidf(ConcurrentInvertedIndex index) { Token token = index .getIndex() .parallelStream() .reduce(new Token("", "xxx:0"), (t1, t2) -> { if (t1.getTfxidf()>t2.getTfxidf()) { return t1; } else { return t2; } }); System.out.println(token.toString()); } public static void minTfxidf(ConcurrentInvertedIndex index) { Token token = index .getIndex() .parallelStream() .reduce(new Token("", "xxx:1000000"), (t1, t2) -> { if (t1.getTfxidf()<t2.getTfxidf()) { return t1; } else { return t2; } }); System.out.println(token.toString()); } }
39,096