code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
--- external help file: Microsoft.Azure.Commands.Compute.dll-Help.xml Module Name: AzureRM.Compute ms.assetid: 7311F66C-3370-4436-8030-6D98D42C3112 online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.compute/get-azurermvmimagepublisher schema: 2.0.0 --- # Get-AzureRmVMImagePublisher ## SYNOPSIS Gets the VMImage publishers. ## SYNTAX ``` Get-AzureRmVMImagePublisher -Location <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>] ``` ## DESCRIPTION The **Get-AzureRmVMImagePublisher** cmdlet gets the VMImage publishers. ## EXAMPLES ### Example 1: Get VMImage publishers for a region ``` PS C:\> Get-AzureRmVMImagePublisher -Location "Central US" ``` This command gets the publishers of VMImage instances for the Central US region within your Azure profile. ## PARAMETERS ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with azure. ```yaml Type: IAzureContextContainer Parameter Sets: (All) Aliases: AzureRmContext, AzureCredential Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Location Specifies the location of the VMImage. ```yaml Type: String Parameter Sets: (All) Aliases: Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ## OUTPUTS ### Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineImagePublisher ## NOTES ## RELATED LINKS [Get-AzureRmVMImage](./Get-AzureRmVMImage.md) [Get-AzureRmVMImageOffer](./Get-AzureRmVMImageOffer.md) [Get-AzureRmVMImageSku](./Get-AzureRmVMImageSku.md) [Save-AzureRmVMImage](./Save-AzureRmVMImage.md)
devigned/azure-powershell
src/ResourceManager/Compute/Commands.Compute/help/Get-AzureRmVMImagePublisher.md
Markdown
apache-2.0
2,067
package Google::Ads::AdWords::v201406::IdeaType; use strict; use warnings; sub get_xmlns { 'https://adwords.google.com/api/adwords/o/v201406'}; # derivation by restriction use base qw( SOAP::WSDL::XSD::Typelib::Builtin::string); 1; __END__ =pod =head1 NAME =head1 DESCRIPTION Perl data type class for the XML Schema defined simpleType IdeaType from the namespace https://adwords.google.com/api/adwords/o/v201406. Represents the type of idea. <span class="constraint AdxEnabled">This is disabled for AdX.</span> This clase is derived from SOAP::WSDL::XSD::Typelib::Builtin::string . SOAP::WSDL's schema implementation does not validate data, so you can use it exactly like it's base type. # Description of restrictions not implemented yet. =head1 METHODS =head2 new Constructor. =head2 get_value / set_value Getter and setter for the simpleType's value. =head1 OVERLOADING Depending on the simple type's base type, the following operations are overloaded Stringification Numerification Boolification Check L<SOAP::WSDL::XSD::Typelib::Builtin> for more information. =head1 AUTHOR Generated by SOAP::WSDL =cut
gitpan/GOOGLE-ADWORDS-PERL-CLIENT
lib/Google/Ads/AdWords/v201406/IdeaType.pm
Perl
apache-2.0
1,150
/* @internal */ namespace ts.textChanges { /** * Currently for simplicity we store recovered positions on the node itself. * It can be changed to side-table later if we decide that current design is too invasive. */ function getPos(n: TextRange): number { const result = (<any>n).__pos; Debug.assert(typeof result === "number"); return result; } function setPos(n: TextRange, pos: number): void { Debug.assert(typeof pos === "number"); (<any>n).__pos = pos; } function getEnd(n: TextRange): number { const result = (<any>n).__end; Debug.assert(typeof result === "number"); return result; } function setEnd(n: TextRange, end: number): void { Debug.assert(typeof end === "number"); (<any>n).__end = end; } export interface ConfigurableStart { /** True to use getStart() (NB, not getFullStart()) without adjustment. */ useNonAdjustedStartPosition?: boolean; } export interface ConfigurableEnd { /** True to use getEnd() without adjustment. */ useNonAdjustedEndPosition?: boolean; } export enum Position { FullStart, Start } function skipWhitespacesAndLineBreaks(text: string, start: number) { return skipTrivia(text, start, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } function hasCommentsBeforeLineBreak(text: string, start: number) { let i = start; while (i < text.length) { const ch = text.charCodeAt(i); if (isWhiteSpaceSingleLine(ch)) { i++; continue; } return ch === CharacterCodes.slash; } return false; } /** * Usually node.pos points to a position immediately after the previous token. * If this position is used as a beginning of the span to remove - it might lead to removing the trailing trivia of the previous node, i.e: * const x; // this is x * ^ - pos for the next variable declaration will point here * const y; // this is y * ^ - end for previous variable declaration * Usually leading trivia of the variable declaration 'y' should not include trailing trivia (whitespace, comment 'this is x' and newline) from the preceding * variable declaration and trailing trivia for 'y' should include (whitespace, comment 'this is y', newline). * By default when removing nodes we adjust start and end positions to respect specification of the trivia above. * If pos\end should be interpreted literally 'useNonAdjustedStartPosition' or 'useNonAdjustedEndPosition' should be set to true */ export interface ConfigurableStartEnd extends ConfigurableStart, ConfigurableEnd {} export const useNonAdjustedPositions: ConfigurableStartEnd = { useNonAdjustedStartPosition: true, useNonAdjustedEndPosition: true, }; export interface InsertNodeOptions { /** * Text to be inserted before the new node */ prefix?: string; /** * Text to be inserted after the new node */ suffix?: string; /** * Text of inserted node will be formatted with this indentation, otherwise indentation will be inferred from the old node */ indentation?: number; /** * Text of inserted node will be formatted with this delta, otherwise delta will be inferred from the new node kind */ delta?: number; /** * Do not trim leading white spaces in the edit range */ preserveLeadingWhitespace?: boolean; } export interface ReplaceWithMultipleNodesOptions extends InsertNodeOptions { readonly joiner?: string; } enum ChangeKind { Remove, ReplaceWithSingleNode, ReplaceWithMultipleNodes, Text, } type Change = ReplaceWithSingleNode | ReplaceWithMultipleNodes | RemoveNode | ChangeText; interface BaseChange { readonly sourceFile: SourceFile; readonly range: TextRange; } export interface ChangeNodeOptions extends ConfigurableStartEnd, InsertNodeOptions {} interface ReplaceWithSingleNode extends BaseChange { readonly kind: ChangeKind.ReplaceWithSingleNode; readonly node: Node; readonly options?: InsertNodeOptions; } interface RemoveNode extends BaseChange { readonly kind: ChangeKind.Remove; readonly node?: never; readonly options?: never; } interface ReplaceWithMultipleNodes extends BaseChange { readonly kind: ChangeKind.ReplaceWithMultipleNodes; readonly nodes: ReadonlyArray<Node>; readonly options?: ReplaceWithMultipleNodesOptions; } interface ChangeText extends BaseChange { readonly kind: ChangeKind.Text; readonly text: string; } function getAdjustedRange(sourceFile: SourceFile, startNode: Node, endNode: Node, options: ConfigurableStartEnd): TextRange { return { pos: getAdjustedStartPosition(sourceFile, startNode, options, Position.Start), end: getAdjustedEndPosition(sourceFile, endNode, options) }; } function getAdjustedStartPosition(sourceFile: SourceFile, node: Node, options: ConfigurableStart, position: Position) { if (options.useNonAdjustedStartPosition) { return node.getStart(sourceFile); } const fullStart = node.getFullStart(); const start = node.getStart(sourceFile); if (fullStart === start) { return start; } const fullStartLine = getLineStartPositionForPosition(fullStart, sourceFile); const startLine = getLineStartPositionForPosition(start, sourceFile); if (startLine === fullStartLine) { // full start and start of the node are on the same line // a, b; // ^ ^ // | start // fullstart // when b is replaced - we usually want to keep the leading trvia // when b is deleted - we delete it return position === Position.Start ? start : fullStart; } // get start position of the line following the line that contains fullstart position // (but only if the fullstart isn't the very beginning of the file) const nextLineStart = fullStart > 0 ? 1 : 0; let adjustedStartPosition = getStartPositionOfLine(getLineOfLocalPosition(sourceFile, fullStartLine) + nextLineStart, sourceFile); // skip whitespaces/newlines adjustedStartPosition = skipWhitespacesAndLineBreaks(sourceFile.text, adjustedStartPosition); return getStartPositionOfLine(getLineOfLocalPosition(sourceFile, adjustedStartPosition), sourceFile); } function getAdjustedEndPosition(sourceFile: SourceFile, node: Node, options: ConfigurableEnd) { const { end } = node; if (options.useNonAdjustedEndPosition || isExpression(node)) { return end; } const newEnd = skipTrivia(sourceFile.text, end, /*stopAfterLineBreak*/ true); return newEnd !== end && isLineBreak(sourceFile.text.charCodeAt(newEnd - 1)) ? newEnd : end; } /** * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node: Node, candidate: Node | undefined): candidate is Token<SyntaxKind.CommaToken | SyntaxKind.SemicolonToken> { return !!candidate && !!node.parent && (candidate.kind === SyntaxKind.CommaToken || (candidate.kind === SyntaxKind.SemicolonToken && node.parent.kind === SyntaxKind.ObjectLiteralExpression)); } function spaces(count: number) { let s = ""; for (let i = 0; i < count; i++) { s += " "; } return s; } export interface TextChangesContext { host: LanguageServiceHost; formatContext: formatting.FormatContext; } export type TypeAnnotatable = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertyDeclaration | PropertySignature; export class ChangeTracker { private readonly changes: Change[] = []; private readonly newFiles: { readonly oldFile: SourceFile | undefined, readonly fileName: string, readonly statements: ReadonlyArray<Statement> }[] = []; private readonly classesWithNodesInsertedAtStart = createMap<{ readonly node: ClassDeclaration | InterfaceDeclaration | ObjectLiteralExpression, readonly sourceFile: SourceFile }>(); // Set<ClassDeclaration> implemented as Map<node id, ClassDeclaration> private readonly deletedNodes: { readonly sourceFile: SourceFile, readonly node: Node | NodeArray<TypeParameterDeclaration> }[] = []; public static fromContext(context: TextChangesContext): ChangeTracker { return new ChangeTracker(getNewLineOrDefaultFromHost(context.host, context.formatContext.options), context.formatContext); } public static with(context: TextChangesContext, cb: (tracker: ChangeTracker) => void): FileTextChanges[] { const tracker = ChangeTracker.fromContext(context); cb(tracker); return tracker.getChanges(); } /** Public for tests only. Other callers should use `ChangeTracker.with`. */ constructor(private readonly newLineCharacter: string, private readonly formatContext: formatting.FormatContext) {} public deleteRange(sourceFile: SourceFile, range: TextRange): void { this.changes.push({ kind: ChangeKind.Remove, sourceFile, range }); } delete(sourceFile: SourceFile, node: Node | NodeArray<TypeParameterDeclaration>): void { this.deletedNodes.push({ sourceFile, node }); } public deleteModifier(sourceFile: SourceFile, modifier: Modifier): void { this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) }); } public deleteNodeRange(sourceFile: SourceFile, startNode: Node, endNode: Node, options: ConfigurableStartEnd = {}): void { const startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart); const endPosition = getAdjustedEndPosition(sourceFile, endNode, options); this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); } public deleteNodeRangeExcludingEnd(sourceFile: SourceFile, startNode: Node, afterEndNode: Node | undefined, options: ConfigurableStartEnd = {}): void { const startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart); const endPosition = afterEndNode === undefined ? sourceFile.text.length : getAdjustedStartPosition(sourceFile, afterEndNode, options, Position.FullStart); this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); } public replaceRange(sourceFile: SourceFile, range: TextRange, newNode: Node, options: InsertNodeOptions = {}): void { this.changes.push({ kind: ChangeKind.ReplaceWithSingleNode, sourceFile, range, options, node: newNode }); } public replaceNode(sourceFile: SourceFile, oldNode: Node, newNode: Node, options: ChangeNodeOptions = useNonAdjustedPositions): void { this.replaceRange(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNode, options); } public replaceNodeRange(sourceFile: SourceFile, startNode: Node, endNode: Node, newNode: Node, options: ChangeNodeOptions = useNonAdjustedPositions): void { this.replaceRange(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNode, options); } private replaceRangeWithNodes(sourceFile: SourceFile, range: TextRange, newNodes: ReadonlyArray<Node>, options: ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = {}): void { this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile, range, options, nodes: newNodes }); } public replaceNodeWithNodes(sourceFile: SourceFile, oldNode: Node, newNodes: ReadonlyArray<Node>, options: ChangeNodeOptions = useNonAdjustedPositions): void { this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNodes, options); } public replaceNodeWithText(sourceFile: SourceFile, oldNode: Node, text: string): void { this.replaceRangeWithText(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, useNonAdjustedPositions), text); } public replaceNodeRangeWithNodes(sourceFile: SourceFile, startNode: Node, endNode: Node, newNodes: ReadonlyArray<Node>, options: ReplaceWithMultipleNodesOptions & ConfigurableStartEnd = useNonAdjustedPositions): void { this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options); } private nextCommaToken(sourceFile: SourceFile, node: Node): Node | undefined { const next = findNextToken(node, node.parent, sourceFile); return next && next.kind === SyntaxKind.CommaToken ? next : undefined; } public replacePropertyAssignment(sourceFile: SourceFile, oldNode: PropertyAssignment, newNode: PropertyAssignment): void { const suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : ("," + this.newLineCharacter); this.replaceNode(sourceFile, oldNode, newNode, { suffix }); } public insertNodeAt(sourceFile: SourceFile, pos: number, newNode: Node, options: InsertNodeOptions = {}): void { this.replaceRange(sourceFile, createRange(pos), newNode, options); } private insertNodesAt(sourceFile: SourceFile, pos: number, newNodes: ReadonlyArray<Node>, options: ReplaceWithMultipleNodesOptions = {}): void { this.replaceRangeWithNodes(sourceFile, createRange(pos), newNodes, options); } public insertNodeAtTopOfFile(sourceFile: SourceFile, newNode: Statement, blankLineBetween: boolean): void { const pos = getInsertionPositionAtSourceFileTop(sourceFile); this.insertNodeAt(sourceFile, pos, newNode, { prefix: pos === 0 ? undefined : this.newLineCharacter, suffix: (isLineBreak(sourceFile.text.charCodeAt(pos)) ? "" : this.newLineCharacter) + (blankLineBetween ? this.newLineCharacter : ""), }); } public insertNodeBefore(sourceFile: SourceFile, before: Node, newNode: Node, blankLineBetween = false): void { this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, {}, Position.Start), newNode, this.getOptionsForInsertNodeBefore(before, blankLineBetween)); } public insertModifierBefore(sourceFile: SourceFile, modifier: SyntaxKind, before: Node): void { const pos = before.getStart(sourceFile); this.insertNodeAt(sourceFile, pos, createToken(modifier), { suffix: " " }); } public insertLastModifierBefore(sourceFile: SourceFile, modifier: SyntaxKind, before: Node): void { if (!before.modifiers) { this.insertModifierBefore(sourceFile, modifier, before); return; } const pos = before.modifiers.end; this.insertNodeAt(sourceFile, pos, createToken(modifier), { prefix: " " }); } public insertCommentBeforeLine(sourceFile: SourceFile, lineNumber: number, position: number, commentText: string): void { const lineStartPosition = getStartPositionOfLine(lineNumber, sourceFile); const startPosition = getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition); // First try to see if we can put the comment on the previous line. // We need to make sure that we are not in the middle of a string literal or a comment. // If so, we do not want to separate the node from its comment if we can. // Otherwise, add an extra new line immediately before the error span. const insertAtLineStart = isValidLocationToAddComment(sourceFile, startPosition); const token = getTouchingToken(sourceFile, insertAtLineStart ? startPosition : position); const indent = sourceFile.text.slice(lineStartPosition, startPosition); const text = `${insertAtLineStart ? "" : this.newLineCharacter}//${commentText}${this.newLineCharacter}${indent}`; this.insertText(sourceFile, token.getStart(sourceFile), text); } public insertJsdocCommentBefore(sourceFile: SourceFile, node: HasJSDoc, tag: JSDoc): void { const fnStart = node.getStart(sourceFile); if (node.jsDoc) { for (const jsdoc of node.jsDoc) { this.deleteRange(sourceFile, { pos: getLineStartPositionForPosition(jsdoc.getStart(sourceFile), sourceFile), end: getAdjustedEndPosition(sourceFile, jsdoc, /*options*/ {}) }); } } const startPosition = getPrecedingNonSpaceCharacterPosition(sourceFile.text, fnStart - 1); const indent = sourceFile.text.slice(startPosition, fnStart); this.insertNodeAt(sourceFile, fnStart, tag, { preserveLeadingWhitespace: false, suffix: this.newLineCharacter + indent }); } public replaceRangeWithText(sourceFile: SourceFile, range: TextRange, text: string): void { this.changes.push({ kind: ChangeKind.Text, sourceFile, range, text }); } public insertText(sourceFile: SourceFile, pos: number, text: string): void { this.replaceRangeWithText(sourceFile, createRange(pos), text); } /** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */ public tryInsertTypeAnnotation(sourceFile: SourceFile, node: TypeAnnotatable, type: TypeNode): void { let endNode: Node | undefined; if (isFunctionLike(node)) { endNode = findChildOfKind(node, SyntaxKind.CloseParenToken, sourceFile); if (!endNode) { if (!isArrowFunction(node)) return; // Function missing parentheses, give up // If no `)`, is an arrow function `x => x`, so use the end of the first parameter endNode = first(node.parameters); } } else { endNode = node.kind !== SyntaxKind.VariableDeclaration && node.questionToken ? node.questionToken : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); } public insertTypeParameters(sourceFile: SourceFile, node: SignatureDeclaration, typeParameters: ReadonlyArray<TypeParameterDeclaration>): void { // If no `(`, is an arrow function `x => x`, so use the pos of the first parameter const start = (findChildOfKind(node, SyntaxKind.OpenParenToken, sourceFile) || first(node.parameters)).getStart(sourceFile); this.insertNodesAt(sourceFile, start, typeParameters, { prefix: "<", suffix: ">" }); } private getOptionsForInsertNodeBefore(before: Node, doubleNewlines: boolean): InsertNodeOptions { if (isStatement(before) || isClassElement(before)) { return { suffix: doubleNewlines ? this.newLineCharacter + this.newLineCharacter : this.newLineCharacter }; } else if (isVariableDeclaration(before)) { // insert `x = 1, ` into `const x = 1, y = 2; return { suffix: ", " }; } else if (isParameter(before)) { return {}; } else if (isStringLiteral(before) && isImportDeclaration(before.parent) || isNamedImports(before)) { return { suffix: ", " }; } return Debug.failBadSyntaxKind(before); // We haven't handled this kind of node yet -- add it } public insertNodeAtConstructorStart(sourceFile: SourceFile, ctr: ConstructorDeclaration, newStatement: Statement): void { const firstStatement = firstOrUndefined(ctr.body!.statements); if (!firstStatement || !ctr.body!.multiLine) { this.replaceConstructorBody(sourceFile, ctr, [newStatement, ...ctr.body!.statements]); } else { this.insertNodeBefore(sourceFile, firstStatement, newStatement); } } public insertNodeAtConstructorEnd(sourceFile: SourceFile, ctr: ConstructorDeclaration, newStatement: Statement): void { const lastStatement = lastOrUndefined(ctr.body!.statements); if (!lastStatement || !ctr.body!.multiLine) { this.replaceConstructorBody(sourceFile, ctr, [...ctr.body!.statements, newStatement]); } else { this.insertNodeAfter(sourceFile, lastStatement, newStatement); } } private replaceConstructorBody(sourceFile: SourceFile, ctr: ConstructorDeclaration, statements: ReadonlyArray<Statement>): void { this.replaceNode(sourceFile, ctr.body!, createBlock(statements, /*multiLine*/ true)); } public insertNodeAtEndOfScope(sourceFile: SourceFile, scope: Node, newNode: Node): void { const pos = getAdjustedStartPosition(sourceFile, scope.getLastToken()!, {}, Position.Start); this.insertNodeAt(sourceFile, pos, newNode, { prefix: isLineBreak(sourceFile.text.charCodeAt(scope.getLastToken()!.pos)) ? this.newLineCharacter : this.newLineCharacter + this.newLineCharacter, suffix: this.newLineCharacter }); } public insertNodeAtClassStart(sourceFile: SourceFile, cls: ClassLikeDeclaration | InterfaceDeclaration, newElement: ClassElement): void { this.insertNodeAtStartWorker(sourceFile, cls, newElement); } public insertNodeAtObjectStart(sourceFile: SourceFile, obj: ObjectLiteralExpression, newElement: ObjectLiteralElementLike): void { this.insertNodeAtStartWorker(sourceFile, obj, newElement); } private insertNodeAtStartWorker(sourceFile: SourceFile, cls: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression, newElement: ClassElement | ObjectLiteralElementLike): void { const clsStart = cls.getStart(sourceFile); const indentation = formatting.SmartIndenter.findFirstNonWhitespaceColumn(getLineStartPositionForPosition(clsStart, sourceFile), clsStart, sourceFile, this.formatContext.options) + this.formatContext.options.indentSize!; this.insertNodeAt(sourceFile, getMembersOrProperties(cls).pos, newElement, { indentation, ...this.getInsertNodeAtStartPrefixSuffix(sourceFile, cls) }); } private getInsertNodeAtStartPrefixSuffix(sourceFile: SourceFile, cls: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression): { prefix: string, suffix: string } { const comma = isObjectLiteralExpression(cls) ? "," : ""; if (getMembersOrProperties(cls).length === 0) { if (addToSeen(this.classesWithNodesInsertedAtStart, getNodeId(cls), { node: cls, sourceFile })) { // For `class C {\n}`, don't add the trailing "\n" const shouldSuffix = (positionsAreOnSameLine as any)(...getClassOrObjectBraceEnds(cls, sourceFile), sourceFile); // TODO: GH#4130 remove 'as any' return { prefix: this.newLineCharacter, suffix: comma + (shouldSuffix ? this.newLineCharacter : "") }; } else { return { prefix: "", suffix: comma + this.newLineCharacter }; } } else { return { prefix: this.newLineCharacter, suffix: comma }; } } public insertNodeAfterComma(sourceFile: SourceFile, after: Node, newNode: Node): void { const endPosition = this.insertNodeAfterWorker(sourceFile, this.nextCommaToken(sourceFile, after) || after, newNode); this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after)); } public insertNodeAfter(sourceFile: SourceFile, after: Node, newNode: Node): void { const endPosition = this.insertNodeAfterWorker(sourceFile, after, newNode); this.insertNodeAt(sourceFile, endPosition, newNode, this.getInsertNodeAfterOptions(sourceFile, after)); } public insertNodeAtEndOfList(sourceFile: SourceFile, list: NodeArray<Node>, newNode: Node): void { this.insertNodeAt(sourceFile, list.end, newNode, { prefix: ", " }); } public insertNodesAfter(sourceFile: SourceFile, after: Node, newNodes: ReadonlyArray<Node>): void { const endPosition = this.insertNodeAfterWorker(sourceFile, after, first(newNodes)); this.insertNodesAt(sourceFile, endPosition, newNodes, this.getInsertNodeAfterOptions(sourceFile, after)); } private insertNodeAfterWorker(sourceFile: SourceFile, after: Node, newNode: Node): number { if (needSemicolonBetween(after, newNode)) { // check if previous statement ends with semicolon // if not - insert semicolon to preserve the code from changing the meaning due to ASI if (sourceFile.text.charCodeAt(after.end - 1) !== CharacterCodes.semicolon) { this.replaceRange(sourceFile, createRange(after.end), createToken(SyntaxKind.SemicolonToken)); } } const endPosition = getAdjustedEndPosition(sourceFile, after, {}); return endPosition; } private getInsertNodeAfterOptions(sourceFile: SourceFile, after: Node): InsertNodeOptions { const options = this.getInsertNodeAfterOptionsWorker(after); return { ...options, prefix: after.end === sourceFile.end && isStatement(after) ? (options.prefix ? `\n${options.prefix}` : "\n") : options.prefix, }; } private getInsertNodeAfterOptionsWorker(node: Node): InsertNodeOptions { switch (node.kind) { case SyntaxKind.ClassDeclaration: case SyntaxKind.ModuleDeclaration: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; case SyntaxKind.VariableDeclaration: case SyntaxKind.StringLiteral: case SyntaxKind.Identifier: return { prefix: ", " }; case SyntaxKind.PropertyAssignment: return { suffix: "," + this.newLineCharacter }; case SyntaxKind.ExportKeyword: return { prefix: " " }; case SyntaxKind.Parameter: return {}; default: Debug.assert(isStatement(node) || isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it return { suffix: this.newLineCharacter }; } } public insertName(sourceFile: SourceFile, node: FunctionExpression | ClassExpression | ArrowFunction, name: string): void { Debug.assert(!node.name); if (node.kind === SyntaxKind.ArrowFunction) { const arrow = findChildOfKind(node, SyntaxKind.EqualsGreaterThanToken, sourceFile)!; const lparen = findChildOfKind(node, SyntaxKind.OpenParenToken, sourceFile); if (lparen) { // `() => {}` --> `function f() {}` this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [createToken(SyntaxKind.FunctionKeyword), createIdentifier(name)], { joiner: " " }); deleteNode(this, sourceFile, arrow); } else { // `x => {}` -> `function f(x) {}` this.insertText(sourceFile, first(node.parameters).getStart(sourceFile), `function ${name}(`); // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, createToken(SyntaxKind.CloseParenToken)); } if (node.body.kind !== SyntaxKind.Block) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [createToken(SyntaxKind.OpenBraceToken), createToken(SyntaxKind.ReturnKeyword)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [createToken(SyntaxKind.SemicolonToken), createToken(SyntaxKind.CloseBraceToken)], { joiner: " " }); } } else { const pos = findChildOfKind(node, node.kind === SyntaxKind.FunctionExpression ? SyntaxKind.FunctionKeyword : SyntaxKind.ClassKeyword, sourceFile)!.end; this.insertNodeAt(sourceFile, pos, createIdentifier(name), { prefix: " " }); } } public insertExportModifier(sourceFile: SourceFile, node: DeclarationStatement | VariableStatement): void { this.insertText(sourceFile, node.getStart(sourceFile), "export "); } /** * This function should be used to insert nodes in lists when nodes don't carry separators as the part of the node range, * i.e. arguments in arguments lists, parameters in parameter lists etc. * Note that separators are part of the node in statements and class elements. */ public insertNodeInListAfter(sourceFile: SourceFile, after: Node, newNode: Node, containingList = formatting.SmartIndenter.getContainingList(after, sourceFile)): void { if (!containingList) { Debug.fail("node is not a list element"); return; } const index = indexOfNode(containingList, after); if (index < 0) { return; } const end = after.getEnd(); if (index !== containingList.length - 1) { // any element except the last one // use next sibling as an anchor const nextToken = getTokenAtPosition(sourceFile, after.end); if (nextToken && isSeparator(after, nextToken)) { // for list // a, b, c // create change for adding 'e' after 'a' as // - find start of next element after a (it is b) // - use this start as start and end position in final change // - build text of change by formatting the text of node + separator + whitespace trivia of b // in multiline case it will work as // a, // b, // c, // result - '*' denotes leading trivia that will be inserted after new text (displayed as '#') // a,* // ***insertedtext<separator># // ###b, // c, // find line and character of the next element const lineAndCharOfNextElement = getLineAndCharacterOfPosition(sourceFile, skipWhitespacesAndLineBreaks(sourceFile.text, containingList[index + 1].getFullStart())); // find line and character of the token that precedes next element (usually it is separator) const lineAndCharOfNextToken = getLineAndCharacterOfPosition(sourceFile, nextToken.end); let prefix: string | undefined; let startPos: number; if (lineAndCharOfNextToken.line === lineAndCharOfNextElement.line) { // next element is located on the same line with separator: // a,$$$$b // ^ ^ // | |-next element // |-separator // where $$$ is some leading trivia // for a newly inserted node we'll maintain the same relative position comparing to separator and replace leading trivia with spaces // a, x,$$$$b // ^ ^ ^ // | | |-next element // | |-new inserted node padded with spaces // |-separator startPos = nextToken.end; prefix = spaces(lineAndCharOfNextElement.character - lineAndCharOfNextToken.character); } else { // next element is located on different line that separator // let insert position be the beginning of the line that contains next element startPos = getStartPositionOfLine(lineAndCharOfNextElement.line, sourceFile); } // write separator and leading trivia of the next element as suffix const suffix = `${tokenToString(nextToken.kind)}${sourceFile.text.substring(nextToken.end, containingList[index + 1].getStart(sourceFile))}`; this.replaceRange(sourceFile, createRange(startPos, containingList[index + 1].getStart(sourceFile)), newNode, { prefix, suffix }); } } else { const afterStart = after.getStart(sourceFile); const afterStartLinePosition = getLineStartPositionForPosition(afterStart, sourceFile); let separator: SyntaxKind.CommaToken | SyntaxKind.SemicolonToken | undefined; let multilineList = false; // insert element after the last element in the list that has more than one item // pick the element preceding the after element to: // - pick the separator // - determine if list is a multiline if (containingList.length === 1) { // if list has only one element then we'll format is as multiline if node has comment in trailing trivia, or as singleline otherwise // i.e. var x = 1 // this is x // | new element will be inserted at this position separator = SyntaxKind.CommaToken; } else { // element has more than one element, pick separator from the list const tokenBeforeInsertPosition = findPrecedingToken(after.pos, sourceFile); separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : SyntaxKind.CommaToken; // determine if list is multiline by checking lines of after element and element that precedes it. const afterMinusOneStartLinePosition = getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; } if (hasCommentsBeforeLineBreak(sourceFile.text, after.end)) { // in this case we'll always treat containing list as multiline multilineList = true; } if (multilineList) { // insert separator immediately following the 'after' node to preserve comments in trailing trivia this.replaceRange(sourceFile, createRange(end), createToken(separator)); // use the same indentation as 'after' item const indentation = formatting.SmartIndenter.findFirstNonWhitespaceColumn(afterStartLinePosition, afterStart, sourceFile, this.formatContext.options); // insert element before the line break on the line that contains 'after' element let insertPos = skipTrivia(sourceFile.text, end, /*stopAfterLineBreak*/ true, /*stopAtComments*/ false); if (insertPos !== end && isLineBreak(sourceFile.text.charCodeAt(insertPos - 1))) { insertPos--; } this.replaceRange(sourceFile, createRange(insertPos), newNode, { indentation, prefix: this.newLineCharacter }); } else { this.replaceRange(sourceFile, createRange(end), newNode, { prefix: `${tokenToString(separator)} ` }); } } } private finishClassesWithNodesInsertedAtStart(): void { this.classesWithNodesInsertedAtStart.forEach(({ node, sourceFile }) => { const [openBraceEnd, closeBraceEnd] = getClassOrObjectBraceEnds(node, sourceFile); // For `class C { }` remove the whitespace inside the braces. if (positionsAreOnSameLine(openBraceEnd, closeBraceEnd, sourceFile) && openBraceEnd !== closeBraceEnd - 1) { this.deleteRange(sourceFile, createRange(openBraceEnd, closeBraceEnd - 1)); } }); } private finishDeleteDeclarations(): void { const deletedNodesInLists = new NodeSet(); // Stores nodes in lists that we already deleted. Used to avoid deleting `, ` twice in `a, b`. for (const { sourceFile, node } of this.deletedNodes) { if (!this.deletedNodes.some(d => d.sourceFile === sourceFile && rangeContainsRangeExclusive(d.node, node))) { if (isArray(node)) { this.deleteRange(sourceFile, rangeOfTypeParameters(node)); } else { deleteDeclaration.deleteDeclaration(this, deletedNodesInLists, sourceFile, node); } } } deletedNodesInLists.forEach(node => { const sourceFile = node.getSourceFile(); const list = formatting.SmartIndenter.getContainingList(node, sourceFile)!; if (node !== last(list)) return; const lastNonDeletedIndex = findLastIndex(list, n => !deletedNodesInLists.has(n), list.length - 2); if (lastNonDeletedIndex !== -1) { this.deleteRange(sourceFile, { pos: list[lastNonDeletedIndex].end, end: startPositionToDeleteNodeInList(sourceFile, list[lastNonDeletedIndex + 1]) }); } }); } /** * Note: after calling this, the TextChanges object must be discarded! * @param validate only for tests * The reason we must validate as part of this method is that `getNonFormattedText` changes the node's positions, * so we can only call this once and can't get the non-formatted text separately. */ public getChanges(validate?: ValidateNonFormattedText): FileTextChanges[] { this.finishDeleteDeclarations(); this.finishClassesWithNodesInsertedAtStart(); const changes = changesToText.getTextChangesFromChanges(this.changes, this.newLineCharacter, this.formatContext, validate); for (const { oldFile, fileName, statements } of this.newFiles) { changes.push(changesToText.newFileChanges(oldFile, fileName, statements, this.newLineCharacter, this.formatContext)); } return changes; } public createNewFile(oldFile: SourceFile | undefined, fileName: string, statements: ReadonlyArray<Statement>): void { this.newFiles.push({ oldFile, fileName, statements }); } } // find first non-whitespace position in the leading trivia of the node function startPositionToDeleteNodeInList(sourceFile: SourceFile, node: Node): number { return skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, {}, Position.FullStart), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } function getClassOrObjectBraceEnds(cls: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression, sourceFile: SourceFile): [number, number] { return [findChildOfKind(cls, SyntaxKind.OpenBraceToken, sourceFile)!.end, findChildOfKind(cls, SyntaxKind.CloseBraceToken, sourceFile)!.end]; } function getMembersOrProperties(cls: ClassLikeDeclaration | InterfaceDeclaration | ObjectLiteralExpression): NodeArray<Node> { return isObjectLiteralExpression(cls) ? cls.properties : cls.members; } export type ValidateNonFormattedText = (node: Node, text: string) => void; export function getNewFileText(statements: ReadonlyArray<Statement>, scriptKind: ScriptKind, newLineCharacter: string, formatContext: formatting.FormatContext): string { return changesToText.newFileChangesWorker(/*oldFile*/ undefined, scriptKind, statements, newLineCharacter, formatContext); } namespace changesToText { export function getTextChangesFromChanges(changes: ReadonlyArray<Change>, newLineCharacter: string, formatContext: formatting.FormatContext, validate: ValidateNonFormattedText | undefined): FileTextChanges[] { return group(changes, c => c.sourceFile.path).map(changesInFile => { const sourceFile = changesInFile[0].sourceFile; // order changes by start position // If the start position is the same, put the shorter range first, since an empty range (x, x) may precede (x, y) but not vice-versa. const normalized = stableSort(changesInFile, (a, b) => (a.range.pos - b.range.pos) || (a.range.end - b.range.end)); // verify that change intervals do not overlap, except possibly at end points. for (let i = 0; i < normalized.length - 1; i++) { Debug.assert(normalized[i].range.end <= normalized[i + 1].range.pos, "Changes overlap", () => `${JSON.stringify(normalized[i].range)} and ${JSON.stringify(normalized[i + 1].range)}`); } const textChanges = normalized.map(c => createTextChange(createTextSpanFromRange(c.range), computeNewText(c, sourceFile, newLineCharacter, formatContext, validate))); return { fileName: sourceFile.fileName, textChanges }; }); } export function newFileChanges(oldFile: SourceFile | undefined, fileName: string, statements: ReadonlyArray<Statement>, newLineCharacter: string, formatContext: formatting.FormatContext): FileTextChanges { const text = newFileChangesWorker(oldFile, getScriptKindFromFileName(fileName), statements, newLineCharacter, formatContext); return { fileName, textChanges: [createTextChange(createTextSpan(0, 0), text)], isNewFile: true }; } export function newFileChangesWorker(oldFile: SourceFile | undefined, scriptKind: ScriptKind, statements: ReadonlyArray<Statement>, newLineCharacter: string, formatContext: formatting.FormatContext): string { // TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this const nonFormattedText = statements.map(s => getNonformattedText(s, oldFile, newLineCharacter).text).join(newLineCharacter); const sourceFile = createSourceFile("any file name", nonFormattedText, ScriptTarget.ESNext, /*setParentNodes*/ true, scriptKind); const changes = formatting.formatDocument(sourceFile, formatContext); return applyChanges(nonFormattedText, changes) + newLineCharacter; } function computeNewText(change: Change, sourceFile: SourceFile, newLineCharacter: string, formatContext: formatting.FormatContext, validate: ValidateNonFormattedText | undefined): string { if (change.kind === ChangeKind.Remove) { return ""; } if (change.kind === ChangeKind.Text) { return change.text; } const { options = {}, range: { pos } } = change; const format = (n: Node) => getFormattedTextOfNode(n, sourceFile, pos, options, newLineCharacter, formatContext, validate); const text = change.kind === ChangeKind.ReplaceWithMultipleNodes ? change.nodes.map(n => removeSuffix(format(n), newLineCharacter)).join(change.options!.joiner || newLineCharacter) // TODO: GH#18217 : format(change.node); // strip initial indentation (spaces or tabs) if text will be inserted in the middle of the line const noIndent = (options.preserveLeadingWhitespace || options.indentation !== undefined || getLineStartPositionForPosition(pos, sourceFile) === pos) ? text : text.replace(/^\s+/, ""); return (options.prefix || "") + noIndent + (options.suffix || ""); } /** Note: this may mutate `nodeIn`. */ function getFormattedTextOfNode(nodeIn: Node, sourceFile: SourceFile, pos: number, { indentation, prefix, delta }: InsertNodeOptions, newLineCharacter: string, formatContext: formatting.FormatContext, validate: ValidateNonFormattedText | undefined): string { const { node, text } = getNonformattedText(nodeIn, sourceFile, newLineCharacter); if (validate) validate(node, text); const { options: formatOptions } = formatContext; const initialIndentation = indentation !== undefined ? indentation : formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || getLineStartPositionForPosition(pos, sourceFile) === pos); if (delta === undefined) { delta = formatting.SmartIndenter.shouldIndentChildNode(formatContext.options, nodeIn) ? (formatOptions.indentSize || 0) : 0; } const file: SourceFileLike = { text, getLineAndCharacterOfPosition(pos) { return getLineAndCharacterOfPosition(this, pos); } }; const changes = formatting.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, formatContext); return applyChanges(text, changes); } /** Note: output node may be mutated input node. */ export function getNonformattedText(node: Node, sourceFile: SourceFile | undefined, newLineCharacter: string): { text: string, node: Node } { const writer = new Writer(newLineCharacter); const newLine = newLineCharacter === "\n" ? NewLineKind.LineFeed : NewLineKind.CarriageReturnLineFeed; createPrinter({ newLine, neverAsciiEscape: true }, writer).writeNode(EmitHint.Unspecified, node, sourceFile, writer); return { text: writer.getText(), node: assignPositionsToNode(node) }; } } export function applyChanges(text: string, changes: ReadonlyArray<TextChange>): string { for (let i = changes.length - 1; i >= 0; i--) { const { span, newText } = changes[i]; text = `${text.substring(0, span.start)}${newText}${text.substring(textSpanEnd(span))}`; } return text; } function isTrivia(s: string) { return skipTrivia(s, 0) === s.length; } function assignPositionsToNode(node: Node): Node { const visited = visitEachChild(node, assignPositionsToNode, nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode)!; // TODO: GH#18217 // create proxy node for non synthesized nodes const newNode = nodeIsSynthesized(visited) ? visited : Object.create(visited) as Node; newNode.pos = getPos(node); newNode.end = getEnd(node); return newNode; } function assignPositionsToNodeArray(nodes: NodeArray<any>, visitor: Visitor, test?: (node: Node) => boolean, start?: number, count?: number) { const visited = visitNodes(nodes, visitor, test, start, count); if (!visited) { return visited; } // clone nodearray if necessary const nodeArray = visited === nodes ? createNodeArray(visited.slice(0)) : visited; nodeArray.pos = getPos(nodes); nodeArray.end = getEnd(nodes); return nodeArray; } class Writer implements EmitTextWriter, PrintHandlers { private lastNonTriviaPosition = 0; private readonly writer: EmitTextWriter; public readonly onEmitNode: PrintHandlers["onEmitNode"]; public readonly onBeforeEmitNodeArray: PrintHandlers["onBeforeEmitNodeArray"]; public readonly onAfterEmitNodeArray: PrintHandlers["onAfterEmitNodeArray"]; public readonly onBeforeEmitToken: PrintHandlers["onBeforeEmitToken"]; public readonly onAfterEmitToken: PrintHandlers["onAfterEmitToken"]; constructor(newLine: string) { this.writer = createTextWriter(newLine); this.onEmitNode = (hint, node, printCallback) => { if (node) { setPos(node, this.lastNonTriviaPosition); } printCallback(hint, node); if (node) { setEnd(node, this.lastNonTriviaPosition); } }; this.onBeforeEmitNodeArray = nodes => { if (nodes) { setPos(nodes, this.lastNonTriviaPosition); } }; this.onAfterEmitNodeArray = nodes => { if (nodes) { setEnd(nodes, this.lastNonTriviaPosition); } }; this.onBeforeEmitToken = node => { if (node) { setPos(node, this.lastNonTriviaPosition); } }; this.onAfterEmitToken = node => { if (node) { setEnd(node, this.lastNonTriviaPosition); } }; } private setLastNonTriviaPosition(s: string, force: boolean) { if (force || !isTrivia(s)) { this.lastNonTriviaPosition = this.writer.getTextPos(); let i = 0; while (isWhiteSpaceLike(s.charCodeAt(s.length - i - 1))) { i++; } // trim trailing whitespaces this.lastNonTriviaPosition -= i; } } write(s: string): void { this.writer.write(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeComment(s: string): void { this.writer.writeComment(s); } writeKeyword(s: string): void { this.writer.writeKeyword(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeOperator(s: string): void { this.writer.writeOperator(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writePunctuation(s: string): void { this.writer.writePunctuation(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeTrailingSemicolon(s: string): void { this.writer.writeTrailingSemicolon(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeParameter(s: string): void { this.writer.writeParameter(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeProperty(s: string): void { this.writer.writeProperty(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeSpace(s: string): void { this.writer.writeSpace(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeStringLiteral(s: string): void { this.writer.writeStringLiteral(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeSymbol(s: string, sym: Symbol): void { this.writer.writeSymbol(s, sym); this.setLastNonTriviaPosition(s, /*force*/ false); } writeLine(): void { this.writer.writeLine(); } increaseIndent(): void { this.writer.increaseIndent(); } decreaseIndent(): void { this.writer.decreaseIndent(); } getText(): string { return this.writer.getText(); } rawWrite(s: string): void { this.writer.rawWrite(s); this.setLastNonTriviaPosition(s, /*force*/ false); } writeLiteral(s: string): void { this.writer.writeLiteral(s); this.setLastNonTriviaPosition(s, /*force*/ true); } getTextPos(): number { return this.writer.getTextPos(); } getLine(): number { return this.writer.getLine(); } getColumn(): number { return this.writer.getColumn(); } getIndent(): number { return this.writer.getIndent(); } isAtStartOfLine(): boolean { return this.writer.isAtStartOfLine(); } clear(): void { this.writer.clear(); this.lastNonTriviaPosition = 0; } } function getInsertionPositionAtSourceFileTop(sourceFile: SourceFile): number { let lastPrologue: PrologueDirective | undefined; for (const node of sourceFile.statements) { if (isPrologueDirective(node)) { lastPrologue = node; } else { break; } } let position = 0; const text = sourceFile.text; if (lastPrologue) { position = lastPrologue.end; advancePastLineBreak(); return position; } const shebang = getShebang(text); if (shebang !== undefined) { position = shebang.length; advancePastLineBreak(); } // For a source file, it is possible there are detached comments we should not skip let ranges = getLeadingCommentRanges(text, position); if (!ranges) return position; // However we should still skip a pinned comment at the top if (ranges.length && ranges[0].kind === SyntaxKind.MultiLineCommentTrivia && isPinnedComment(text, ranges[0].pos)) { position = ranges[0].end; advancePastLineBreak(); ranges = ranges.slice(1); } // As well as any triple slash references for (const range of ranges) { if (range.kind === SyntaxKind.SingleLineCommentTrivia && isRecognizedTripleSlashComment(text, range.pos, range.end)) { position = range.end; advancePastLineBreak(); continue; } break; } return position; function advancePastLineBreak() { if (position < text.length) { const charCode = text.charCodeAt(position); if (isLineBreak(charCode)) { position++; if (position < text.length && charCode === CharacterCodes.carriageReturn && text.charCodeAt(position) === CharacterCodes.lineFeed) { position++; } } } } } export function isValidLocationToAddComment(sourceFile: SourceFile, position: number) { return !isInComment(sourceFile, position) && !isInString(sourceFile, position) && !isInTemplateString(sourceFile, position) && !isInJSXText(sourceFile, position); } function needSemicolonBetween(a: Node, b: Node): boolean { return (isPropertySignature(a) || isPropertyDeclaration(a)) && isClassOrTypeElement(b) && b.name!.kind === SyntaxKind.ComputedPropertyName || isStatementButNotDeclaration(a) && isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } namespace deleteDeclaration { export function deleteDeclaration(changes: ChangeTracker, deletedNodesInLists: NodeSet<Node>, sourceFile: SourceFile, node: Node): void { switch (node.kind) { case SyntaxKind.Parameter: { const oldFunction = node.parent; if (isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && !findChildOfKind(oldFunction, SyntaxKind.OpenParenToken, sourceFile)) { // Lambdas with exactly one parameter are special because, after removal, there // must be an empty parameter list (i.e. `()`) and this won't necessarily be the // case if the parameter is simply removed (e.g. in `x => 1`). changes.replaceNodeWithText(sourceFile, node, "()"); } else { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; } case SyntaxKind.ImportDeclaration: deleteNode(changes, sourceFile, node, // For first import, leave header comment in place node === sourceFile.imports[0].parent ? { useNonAdjustedStartPosition: true, useNonAdjustedEndPosition: false } : undefined); break; case SyntaxKind.BindingElement: const pattern = (node as BindingElement).parent; const preserveComma = pattern.kind === SyntaxKind.ArrayBindingPattern && node !== last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } else { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; case SyntaxKind.VariableDeclaration: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node as VariableDeclaration); break; case SyntaxKind.TypeParameter: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; case SyntaxKind.ImportSpecifier: const namedImports = (node as ImportSpecifier).parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); } else { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; case SyntaxKind.NamespaceImport: deleteImportBinding(changes, sourceFile, node as NamespaceImport); break; default: if (isImportClause(node.parent) && node.parent.name === node) { deleteDefaultImport(changes, sourceFile, node.parent); } else if (isCallLikeExpression(node.parent)) { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } else { deleteNode(changes, sourceFile, node, node.kind === SyntaxKind.SemicolonToken ? { useNonAdjustedEndPosition: true } : undefined); } } } function deleteDefaultImport(changes: ChangeTracker, sourceFile: SourceFile, importClause: ImportClause): void { if (!importClause.namedBindings) { // Delete the whole import deleteNode(changes, sourceFile, importClause.parent); } else { // import |d,| * as ns from './file' const start = importClause.name!.getStart(sourceFile); const nextToken = getTokenAtPosition(sourceFile, importClause.name!.end); if (nextToken && nextToken.kind === SyntaxKind.CommaToken) { // shift first non-whitespace position after comma to the start position of the node const end = skipTrivia(sourceFile.text, nextToken.end, /*stopAfterLineBreaks*/ false, /*stopAtComments*/ true); changes.deleteRange(sourceFile, { pos: start, end }); } else { deleteNode(changes, sourceFile, importClause.name!); } } } function deleteImportBinding(changes: ChangeTracker, sourceFile: SourceFile, node: NamedImportBindings): void { if (node.parent.name) { // Delete named imports while preserving the default import // import d|, * as ns| from './file' // import d|, { a }| from './file' const previousToken = Debug.assertDefined(getTokenAtPosition(sourceFile, node.pos - 1)); changes.deleteRange(sourceFile, { pos: previousToken.getStart(sourceFile), end: node.end }); } else { // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| const importDecl = getAncestor(node, SyntaxKind.ImportDeclaration)!; deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes: ChangeTracker, deletedNodesInLists: NodeSet<Node>, sourceFile: SourceFile, node: VariableDeclaration): void { const { parent } = node; if (parent.kind === SyntaxKind.CatchClause) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, findChildOfKind(parent, SyntaxKind.OpenParenToken, sourceFile)!, findChildOfKind(parent, SyntaxKind.CloseParenToken, sourceFile)!); return; } if (parent.declarations.length !== 1) { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); return; } const gp = parent.parent; switch (gp.kind) { case SyntaxKind.ForOfStatement: case SyntaxKind.ForInStatement: changes.replaceNode(sourceFile, node, createObjectLiteral()); break; case SyntaxKind.ForStatement: deleteNode(changes, sourceFile, parent); break; case SyntaxKind.VariableStatement: deleteNode(changes, sourceFile, gp); break; default: Debug.assertNever(gp); } } } /** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */ // Exported for tests only! (TODO: improve tests to not need this) export function deleteNode(changes: ChangeTracker, sourceFile: SourceFile, node: Node, options: ConfigurableStartEnd = {}): void { const startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart); const endPosition = getAdjustedEndPosition(sourceFile, node, options); changes.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); } function deleteNodeInList(changes: ChangeTracker, deletedNodesInLists: NodeSet<Node>, sourceFile: SourceFile, node: Node): void { const containingList = Debug.assertDefined(formatting.SmartIndenter.getContainingList(node, sourceFile)); const index = indexOfNode(containingList, node); Debug.assert(index !== -1); if (containingList.length === 1) { deleteNode(changes, sourceFile, node); return; } // Note: We will only delete a comma *after* a node. This will leave a trailing comma if we delete the last node. // That's handled in the end by `finishTrailingCommaAfterDeletingNodesInList`. Debug.assert(!deletedNodesInLists.has(node), "Deleting a node twice"); deletedNodesInLists.add(node); changes.deleteRange(sourceFile, { pos: startPositionToDeleteNodeInList(sourceFile, node), end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]), }); } }
SaschaNaz/TypeScript
src/services/textChanges.ts
TypeScript
apache-2.0
66,473
#region using System; using System.Collections.Generic; using Newtonsoft.Json; using Tabster.Core.Types; using Tabster.Update; #endregion namespace Tabster.Plugins { internal class FeaturedPlugin { [JsonProperty("name")] public string Name { get; private set; } [JsonProperty("author")] public string Author { get; private set; } [JsonProperty("description")] public string Description { get; private set; } [JsonProperty("version")] [JsonConverter(typeof (TabsterVersionConverter))] public TabsterVersion Version { get; private set; } [JsonProperty("website")] public Uri Website { get; private set; } [JsonProperty("categories")] public List<string> Categories { get; private set; } } internal class FeaturedPluginsResponse { [JsonProperty("featured_plugins")] public List<FeaturedPlugin> Plugins { get; internal set; } } }
GetTabster/Tabster
Tabster/Plugins/FeaturedPluginsResponse.cs
C#
apache-2.0
981
/* update - do sync periodically Author: Andy Tanenbaum */ #include <sys/types.h> #include <signal.h> #include <unistd.h> int main(void); int main() { /* Release all (?) open file descriptors. */ close(0); close(1); close(2); /* Release current directory to avoid locking current device. */ chdir("/"); /* Flush the cache every 30 seconds. */ while (1) { sync(); sleep(30); } }
veritas-shine/minix3-rpi
minix/commands/update/update.c
C
apache-2.0
404
package com.ctrip.zeus.executor.impl; import com.ctrip.zeus.executor.TaskExecutor; import com.ctrip.zeus.executor.TaskWorker; import com.ctrip.zeus.server.LocalInfoPack; import com.ctrip.zeus.service.build.ConfigHandler; import com.ctrip.zeus.service.tools.local.LocalInfoService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.annotation.Resource; /** * Created by fanqq on 2015/7/31. */ @Component("taskWorker") public class TaskWorkerImpl implements TaskWorker { @Resource private TaskExecutor taskExecutor; @Resource private LocalInfoService localInfoService; @Resource private ConfigHandler configHandler; private Logger logger = LoggerFactory.getLogger(this.getClass()); @Override public void execute() { Long workerSlbId = null; try { //1. getWorkerSlbId workerSlbId = localInfoService.getLocalSlbId(); if (!configHandler.getEnable("agent.task.worker", workerSlbId, null, null, true)) { return; } //2. check slbId if (workerSlbId == null) { logger.warn("Can Not Found Slb by Local Ip. NginxStatusFetcher ignore task! Local Ip : " + LocalInfoPack.INSTANCE.getIp()); return; } //3. Do work taskExecutor.execute(workerSlbId); } catch (Exception e) { logger.error("Task Worker Execute Fail." + e.getMessage(), e); } } }
sdgdsffdsfff/zeus
slb/src/main/java/com/ctrip/zeus/executor/impl/TaskWorkerImpl.java
Java
apache-2.0
1,596
@(branch: String, repository: gitbucket.core.service.RepositoryService.RepositoryInfo, pathList: List[String], groupNames: List[String], latestCommit: gitbucket.core.util.JGitUtil.CommitInfo, files: List[gitbucket.core.util.JGitUtil.FileInfo], readme: Option[(List[String], String)], hasWritePermission: Boolean, branchPullRequest: Option[(gitbucket.core.model.PullRequest, gitbucket.core.model.Issue)], info: Option[Any] = None, error: Option[Any] = None)(implicit context: gitbucket.core.controller.Context) @import context._ @import gitbucket.core.view.helpers._ @html.main(s"${repository.owner}/${repository.name}", Some(repository)) { @html.menu("code", repository, Some(branch), pathList.isEmpty, groupNames.isEmpty, info, error){ <div class="head"> <div class="pull-right"><div class="btn-group"> <a href="@url(repository)/find/@encodeRefName(branch)" class="btn btn-mini" data-toggle="tooltip" data-placement="bottom" data-hotkey="t" title="Quickly jump between files"><i class="icon icon-th-list"></i></a> @if(pathList.nonEmpty){ <a href="@url(repository)/commits/@encodeRefName(branch)/@pathList.mkString("/")" class="btn btn-mini" data-toggle="tooltip" data-placement="bottom" title="Browse commits for this branch"><i class="icon icon-time"></i></a> } </div></div> @branchPullRequest.map{ case (pullRequest, issue) => <a href="@url(repository)/pull/@pullRequest.issueId" class="btn btn-pullrequest-branch btn-mini" title="@issue.title" data-toggle="tooltip">#@pullRequest.issueId</a> }.getOrElse{ <a href="@url(repository)/compare?head=@urlEncode(encodeRefName(branch))" class="btn btn-success btn-mini"><i class="icon-white icon-retweet" data-toggle="tooltip" title="Compare, review, create a pull request"></i></a> } @helper.html.branchcontrol( branch, repository, hasWritePermission ){ @repository.branchList.map { x => <li><a href="@url(repository)/tree/@encodeRefName(x)">@helper.html.checkicon(x == branch) @x</a></li> } } <a href="@url(repository)/tree/@encodeRefName(branch)">@repository.name</a> / @pathList.zipWithIndex.map { case (section, i) => <a href="@url(repository)/tree/@encodeRefName(branch)/@pathList.take(i + 1).mkString("/")">@section</a> / } @if(hasWritePermission){ <a href="@url(repository)/new/@encodeRefName(branch)/@pathList.mkString("/")" title="Create a new file here" style="text-decoration: none;">+</i></a> } </div> <table class="table table-file-list"> <tr> <th colspan="4" style="font-weight: normal; border: none;"> <a href="@url(repository)/commit/@latestCommit.id" class="commit-message">@link(latestCommit.summary, repository)</a> @if(latestCommit.description.isDefined){ <a href="javascript:void(0)" onclick="$('#description-@latestCommit.id').toggle();" class="omit">...</a> <pre id="description-@latestCommit.id" class="commit-description" style="display: none;">@link(latestCommit.description.get, repository)</pre> } </th> </tr> <tr> <td colspan="4" class="latest-commit"> <div> <div class="pull-right align-right monospace" style="line-height: 18px;"> <a href="@url(repository)/commit/@latestCommit.id" class="commit-id"><span class="muted">latest commit</span> @latestCommit.id.substring(0, 10)</a> </div> <div class="author-info"> <div class="author"> @avatar(latestCommit, 20) <span>@user(latestCommit.authorName, latestCommit.authorEmailAddress, "username strong")</span> <span class="muted"> authored @helper.html.datetimeago(latestCommit.authorTime)</span> </div> @if(latestCommit.isDifferentFromAuthor) { <div class="committer"> <span class="icon-arrow-right"></span> <span>@user(latestCommit.committerName, latestCommit.committerEmailAddress, "username strong")</span> <span class="muted"> committed @helper.html.datetimeago(latestCommit.commitTime)</span> </div> } </div> </div> </td> </tr> @if(pathList.size > 0){ <tr> <td width="16"></td> <td><a href="@url(repository)@if(pathList.size > 1){/tree/@encodeRefName(branch)/@pathList.init.mkString("/")}">..</a></td> <td></td> <td></td> </tr> } @files.map { file => <tr> <td width="16"> @if(file.isDirectory){ @if(file.linkUrl.isDefined){ <i class="octicon octicon-file-symlink-directory"></i> } else { <i class="octicon octicon-file-directory"></i> } } else { <i class="octicon octicon-file-text"></i> } </td> <td> @if(file.isDirectory){ @if(file.linkUrl.isDefined){ <a href="@file.linkUrl"> <span class="simplified-path">@file.name.split("/").toList.init match { case Nil => {} case list => {@list.mkString("", "/", "/")} }</span>@file.name.split("/").toList.last </a> } else { <a href="@url(repository)/tree@{(encodeRefName(branch) :: pathList).mkString("/", "/", "/")}@file.name"> <span class="simplified-path">@file.name.split("/").toList.init match { case Nil => {} case list => {@list.mkString("", "/", "/")} }</span>@file.name.split("/").toList.last </a> } } else { <a href="@url(repository)/blob@{(encodeRefName(branch) :: pathList).mkString("/", "/", "/")}@file.name">@file.name</a> } </td> <td class="mute"> <a href="@url(repository)/commit/@file.commitId" class="commit-message">@link(file.message, repository)</a> [@user(file.author, file.mailAddress)] </td> <td style="text-align: right;">@helper.html.datetimeago(file.time, false)</td> </tr> } </table> @readme.map { case(filePath, content) => <div id="readme"> <div class="box-header">@filePath.reverse.head</div> <div class="box-content-bottom markdown-body" style="padding-left: 16px; padding-right: 16px;">@renderMarkup(filePath, content, branch, repository, false, false, true)</div> </div> } } }
hilerchyn/gitbucket
src/main/twirl/gitbucket/core/repo/files.scala.html
HTML
apache-2.0
6,599
/* * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * */ package org.opensaml.saml2.core.impl; import java.util.List; import org.opensaml.common.impl.AbstractSAMLObject; import org.opensaml.saml2.core.Artifact; import org.opensaml.xml.XMLObject; /** * Concrete implementation of {@link org.opensaml.saml2.core.Artifact}. */ public class ArtifactImpl extends AbstractSAMLObject implements Artifact { /** Artifact data. */ private String artifact; /** * Constructor. * * @param namespaceURI the namespace the element is in * @param elementLocalName the local name of the XML element this Object represents * @param namespacePrefix the prefix for the given namespace */ protected ArtifactImpl(String namespaceURI, String elementLocalName, String namespacePrefix) { super(namespaceURI, elementLocalName, namespacePrefix); } /** {@inheritDoc} */ public String getArtifact() { return this.artifact; } /** {@inheritDoc} */ public void setArtifact(String newArtifact) { this.artifact = prepareForAssignment(this.artifact, newArtifact); } /** {@inheritDoc} */ public List<XMLObject> getOrderedChildren() { // no children return null; } }
danpal/OpenSAML
src/main/java/org/opensaml/saml2/core/impl/ArtifactImpl.java
Java
apache-2.0
1,930
package com.plugin.internet.core.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE }) public @interface HttpMethod { String value() default ""; }
xstd/quick_setting
src_lib/mcuslib/src/com/plugin/internet/core/annotations/HttpMethod.java
Java
apache-2.0
339
#include "fast_float/fast_float.h" #include <iostream> #include <vector> #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun) // Anything at all that is related to cygwin, msys and so forth will // always use this fallback because we cannot rely on it behaving as normal // gcc. #include <locale> #include <sstream> // workaround for CYGWIN double cygwin_strtod_l(const char* start, char** end) { double d; std::stringstream ss; ss.imbue(std::locale::classic()); ss << start; ss >> d; if(ss.fail()) { *end = nullptr; } if(ss.eof()) { ss.clear(); } auto nread = ss.tellg(); *end = const_cast<char*>(start) + nread; return d; } float cygwin_strtof_l(const char* start, char** end) { float d; std::stringstream ss; ss.imbue(std::locale::classic()); ss << start; ss >> d; if(ss.fail()) { *end = nullptr; } if(ss.eof()) { ss.clear(); } auto nread = ss.tellg(); *end = const_cast<char*>(start) + nread; return d; } #endif inline void Assert(bool Assertion) { #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun) if (!Assertion) { std::cerr << "Omitting hard falure on msys/cygwin/sun systems."; } #else if (!Assertion) { throw std::runtime_error("bug"); } #endif } template <typename T> std::string to_string(T d) { std::string s(64, '\0'); auto written = std::snprintf(&s[0], s.size(), "%.*e", std::numeric_limits<T>::max_digits10 - 1, d); s.resize(size_t(written)); return s; } template <typename T> bool test() { std::string input = "0.1 1e1000 100000 3.14159265359 -1e-500 001 1e01 1e0000001 -inf"; std::vector<T> answers = {T(0.1), std::numeric_limits<T>::infinity(), 100000, T(3.14159265359), -0.0, 1, 10, 10, -std::numeric_limits<T>::infinity()}; const char * begin = input.data(); const char * end = input.data() + input.size(); for(size_t i = 0; i < answers.size(); i++) { T result_value; auto result = fast_float::from_chars(begin, end, result_value); if (result.ec != std::errc()) { printf("parsing %.*s\n", int(end - begin), begin); std::cerr << " I could not parse " << std::endl; return false; } if(result_value != answers[i]) { printf("parsing %.*s\n", int(end - begin), begin); std::cerr << " Mismatch " << std::endl; return false; } begin = result.ptr; } if(begin != end) { std::cerr << " bad ending " << std::endl; return false; } return true; } template <typename T> void strtod_from_string(const std::string &st, T& d); template <> void strtod_from_string(const std::string &st, double& d) { char *pr = (char *)st.c_str(); #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun) d = cygwin_strtod_l(pr, &pr); #elif defined(_WIN32) static _locale_t c_locale = _create_locale(LC_ALL, "C"); d = _strtod_l(st.c_str(), &pr, c_locale); #else static locale_t c_locale = newlocale(LC_ALL_MASK, "C", NULL); d = strtod_l(st.c_str(), &pr, c_locale); #endif if (pr == st.c_str()) { throw std::runtime_error("bug in strtod_from_string"); } } template <> void strtod_from_string(const std::string &st, float& d) { char *pr = (char *)st.c_str(); #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun) d = cygwin_strtof_l(st.c_str(), &pr); #elif defined(_WIN32) static _locale_t c_locale = _create_locale(LC_ALL, "C"); d = _strtof_l(st.c_str(), &pr, c_locale); #else static locale_t c_locale = newlocale(LC_ALL_MASK, "C", NULL); d = strtof_l(st.c_str(), &pr, c_locale); #endif if (pr == st.c_str()) { throw std::runtime_error("bug in strtod_from_string"); } } template <typename T> bool partow_test() { // credit: https://github.com/ArashPartow/strtk/blob/master/strtk_tokenizer_cmp.cpp#L568 // MIT license const std::string strint_list[] = { "9007199254740993", "9007199254740994", "9007199254740995" , "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "917049", "4931205", "6768064", "6884243", "5647132", "7371203", "-8629878", "4941840", "4543268", "1075600", "+290", "823", "+111", "715", "-866", "+367", "666", "-706", "850", "-161", "9922547", "6960207", "1883152", "2300759", "-279294", "4187292", "3699841", "+8386395", "-1441129", "-887892", "-635422", "9742573", "2326186", "-5903851", "5648486", "3057647", "2980079", "2957468", "7929158", "1925615", "879", "+130", "292", "+705", "817", "446", "576", "750", "523", "-527", "4365041", "5624958", "8990205", "2652177", "3993588", "-298316", "+2901599", "3887387", "-5202979", "1196268", "5968501", "7619928", "3565643", "1885272", "-749485", "2961381", "2982579", "2387454", "4250081", "5958205", "00000", "00001", "00002", "+00003", "00004", "00005", "00006", "00007", "00008", "+00009", "4907034", "2592882", "3269234", "549815", "6256292", "9721039", "-595225", "+5587491", "4596297", "-3885009", "673", "-899", "174", "354", "870", "147", "898", "-510", "369", "+859", "6518423", "5149762", "8834164", "-8085586", "3233120", "8166948", "4172345", "6735549", "-934295", "9481935", "-430406", "6932717", "4087292", "4047263", "3236400", "-3863050", "4312079", "6956261", "5689446", "3871332", "+535", "691", "+326", "-409", "704", "-568", "+301", "951", "121", "384", "4969414", "9378599", "7971781", "5380630", "5001363", "1715827", "6044615", "9118925", "9956168", "-8865496", "5962464", "7408980", "6646513", "-634564", "4188330", "9805948", "5625691", "+7641113", "-4212929", "7802447", "+0", "+1", "+2", "+3", "+4", "+5", "+6", "+7", "+8", "+9", "2174248", "7449361", "9896659", "-25961", "1706598", "2412368", "-4617035", "6314554", "2225957", "7521434", "-9530566", "3914164", "2394759", "7157744", "9919392", "6406949", "-744004", "9899789", "8380325", "-1416284", "3402833", "2150043", "5191009", "8979538", "9565778", "3750211", "7304823", "2829359", "6544236", "-615740", "363", "-627", "129", "+656", "135", "113", "381", "+646", "198", "38", "8060564", "-176752", "1184717", "-666343", "-1273292", "-485827", "6241066", "6579411", "8093119", "7481306", "-4924485", "7467889", "9813178", "7927100", "+3614859", "7293354", "9232973", "4323115", "1133911", "+9511638", "4443188", "2289448", "5639726", "9073898", "8540394", "5389992", "1397726", "-589230", "1017086", "1852330", "-840", "267", "201", "533", "-675", "494", "315", "706", "-920", "784", "9097353", "6002251", "-308780", "-3830169", "4340467", "2235284", "3314444", "1085967", "4152107", "+5431117", "-0000", "-0001", "-0002", "-0003", "-0004", "-0005", "-0006", "-0007", "-0008", "-0009", "-444999", "2136400", "6925907", "6990614", "3588271", "8422028", "-4034772", "5804039", "-6740545", "9381873", "-924923", "1652367", "2302616", "6776663", "2567821", "-248935", "2587688", "7076742", "-6461467", "1562896", "-768116", "2338768", "9887307", "9992184", "2045182", "2797589", "9784597", "9696554", "5113329", "1067216", "-76247763", "58169007", "29408062", "85342511", "42092201", "-95817703", "-1912517", "-26275135", "54656606", "-58188878", "+473", "74", "374", "-64", "266", "+715", "937", "-249", "249", "780", "3907360", "-23063423", "59062754", "83711047", "-95221044", "34894840", "-38562139", "-82018330", "14226223", "-10799717", "8529722", "88961903", "25608618", "-39988247", "33228241", "+38598533", "21161480", "-33723784", "8873948", "96505557", "-47385048", "-79413272", "-85904404", "87791158", "49194195", "13051222", "57773302", "31904423", "3142966", "27846156", "7420011", "-72376922", "-68873971", "23765361", "4040725", "-22359806", "85777219", "10099223", "-90364256", "-40158172", "-7948696", "-64344821", "34404238", "84037448", "-85084788", "-42078409", "-56550310", "96898389", "-595829", "-73166703", "-0", "-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9", "2147483647", "31", "2147483610", "33", "2147483573", "37", "2147483536", "-82838342", "64441808", "43641062", "-64419642", "-44421934", "75232413", "-75773725", "-89139509", "12812089", "-97633526", "36090916", "-57706234", "17804655", "4189936", "-4100124", "38803710", "-39735126", "-62397437", "75801648", "51302332", "73433906", "13015224", "-12624818", "91360377", "11576319", "-54467535", "8892431", "36319780", "38832042", "50172572", "-317", "109", "-888", "302", "-463", "716", "+916", "665", "826", "513", "42423473", "41078812", "40445652", "-76722281", "95092224", "12075234", "-4045888", "-74396490", "-57304222", "-21726885", "92038121", "-31899682", "21589254", "-30260046", "56000244", "69686659", "+93327838", "96882881", "-91419389", "77529147", "+43288506", "1192435", "-74095920", "76756590", "-31184683", "-35716724", "9451980", "-63168350", "62864002", "26283194", "37188395", "29151634", "99343471", "-69450330", "-55680090", "-64957599", "47577948", "47107924", "2490477", "+48633003", "-82740809", "-24122215", "67301713", "-63649610", "75499016", "82746620", "17052193", "4602244", "-32721165", "20837836", "674", "+467", "+706", "889", "172", "+282", "-795", "188", "+87", "153", "64501793", "53146328", "5152287", "-9674493", "68105580", "57245637", "39740229", "-74071854", "86777268", "86484437", "-86962508", "12644427", "-62944073", "59539680", "43340539", "30661534", "20143968", "-68183731", "-48250926", "42669063", "+000", "+001", "+002", "+003", "+004", "+005", "+006", "+007", "+008", "+009", "2147483499", "71", "2147483462", "73", "2147483425", "77", "2147483388", "87736852", "-4444906", "-48094147", "54774735", "54571890", "-22473078", "95053418", "393654", "-33229960", "32276798", "-48361110", "44295939", "-79813406", "11630865", "38544571", "70972830", "-9821748", "-60965384", "-13096675", "-24569041", "708", "-467", "-794", "610", "+929", "766", "152", "482", "397", "-191", "97233152", "51028396", "-13796948", "95437272", "71352512", "-83233730", "-68517318", "61832742", "-42667174", "-18002395", "-92239407", "12701336", "-63830875", "41514172", "-5726049", "18668677", "69555144", "-13737009", "-22626233", "-55078143", "00", "11", "22", "33", "44", "-00", "-11", "-22", "-33", "-44", "000", "111", "222", "333", "444", "-000", "-111", "-222", "-333", "-444", "0000", "1111", "2222", "3333", "4444", "-0000", "-1111", "-2222", "-3333", "-4444", "00000", "11111", "22222", "33333", "44444", "-00000", "-11111", "-22222", "-33333", "-44444", "000000", "111111", "222222", "333333", "444444", "-000000", "-111111", "-222222", "-333333", "-444444", "0000000", "1111111", "2222222", "3333333", "4444444", "-0000000", "-1111111", "-2222222", "-3333333", "-4444444", "00000000", "11111111", "22222222", "33333333", "44444444", "-00000000", "-11111111", "-22222222", "-33333333", "-44444444", "000000000", "111111111", "222222222", "333333333", "444444444","-000000000","-111111111","-222222222","-333333333","-444444444", "2147483351", "51", "2147483314", "53", "-2147483648", "57", "-2147483611", "55", "66", "77", "88", "99", "-55", "-66", "-77", "-88", "-99", "555", "666", "777", "888", "999", "-555", "-666", "-777", "-888", "-999", "5555", "6666", "7777", "8888", "9999", "-5555", "-6666", "-7777", "-8888", "-9999", "55555", "66666", "77777", "88888", "99999", "-55555", "-66666", "-77777", "-88888", "-99999", "555555", "666666", "777777", "888888", "999999", "-555555", "-666666", "-777777", "-888888", "-999999", "5555555", "6666666", "7777777", "8888888", "9999999", "-5555555", "-6666666", "-7777777", "-8888888", "-9999999", "55555555", "66666666", "77777777", "88888888", "99999999", "-55555555", "-66666666", "-77777777", "-88888888", "-99999999", "555555555", "666666666", "777777777", "888888888", "999999999","-555555555","-666666666","-777777777","-888888888","-999999999", "-2147483574", "91", "-2147483537", "93", "-2147483500", "97", "-2147483463", "0000000011", "0000000022", "0000000033", "0000000044", "-000000011", "-000000022", "-000000033", "-000000044", "-000000088", "0000000111", "0000000222", "0000000333", "0000000444", "-000000111", "-000000222", "-000000333", "-000000444", "-000000888", "0000001111", "0000002222", "0000003333", "0000004444", "-000001111", "-000002222", "-000003333", "-000004444", "-000008888", "0000011111", "0000022222", "0000033333", "0000044444", "-000011111", "-000022222", "-000033333", "-000044444", "-000088888", "0000111111", "0000222222", "0000333333", "0000444444", "-000111111", "-000222222", "-000333333", "-000444444", "-000888888", "0001111111", "0002222222", "0003333333", "0004444444", "-001111111", "-002222222", "-003333333", "-004444444", "-008888888", "0011111111", "0022222222", "0033333333", "0044444444", "-011111111", "-022222222", "-033333333", "-044444444", "-088888888", "0111111111", "0222222222", "0333333333", "0444444444", "-111111111", "-222222222", "-333333333", "-444444444", "-888888888", "0000000055", "0000000066", "0000000077", "0000000088", "0000000099", "-000000055", "-000000066", "-000000077", "-000000099", "0000000555", "0000000666", "0000000777", "0000000888", "0000000999", "-000000555", "-000000666", "-000000777", "-000000999", "0000005555", "0000006666", "0000007777", "0000008888", "0000009999", "-000005555", "-000006666", "-000007777", "-000009999", "0000055555", "0000066666", "0000077777", "0000088888", "0000099999", "-000055555", "-000066666", "-000077777", "-000099999", "0000555555", "0000666666", "0000777777", "0000888888", "0000999999", "-000555555", "-000666666", "-000777777", "-000999999", "0005555555", "0006666666", "0007777777", "0008888888", "0009999999", "-005555555", "-006666666", "-007777777", "-009999999", "0055555555", "0066666666", "0077777777", "0088888888", "0099999999", "-055555555", "-066666666", "-077777777", "-099999999", "0555555555", "0666666666", "0777777777", "0888888888", "0999999999", "-555555555", "-666666666", "-777777777", "-999999999", "-2147483426", "101", "-2147483389", "103", "-2147483352", "105", "-2147483315", "0000001234567890", "+0000001234567890", "-0000001234567890", "000001234567890", "+000001234567890", "-000001234567890", "00001234567890", "+00001234567890", "-00001234567890", "0001234567890", "+0001234567890", "-0001234567890", "001234567890", "+001234567890", "-001234567890", "01234567890", "+01234567890", "-01234567890", "1234567890", "+1234567890", "-1234567890", }; for(const std::string& st : strint_list) { T expected_value; strtod_from_string(st, expected_value); T result_value; auto result = fast_float::from_chars(st.data(), st.data() + st.size(), result_value); if (result.ec != std::errc()) { printf("parsing %.*s\n", int(st.size()), st.data()); std::cerr << " I could not parse " << std::endl; return false; } if(result.ptr != st.data() + st.size()) { printf("parsing %.*s\n", int(st.size()), st.data()); std::cerr << " Did not get to the end " << std::endl; return false; } if(result_value != expected_value) { printf("parsing %.*s\n", int(st.size()), st.data()); std::cerr << "expected value : " << to_string(expected_value) << std::endl; std::cerr << "result value : " << to_string(result_value) << std::endl; std::cerr << " Mismatch " << std::endl; return false; } } return true; } int main() { #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(sun) || defined(__sun) std::cout << "Warning: msys/cygwin or solaris detected." << std::endl; #endif std::cout << "32 bits checks" << std::endl; Assert(partow_test<float>()); Assert(test<float>()); std::cout << "64 bits checks" << std::endl; Assert(partow_test<double>()); Assert(test<double>()); std::cout << "All ok" << std::endl; return EXIT_SUCCESS; }
sparkprime/jsonnet
third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/ext/fast_float/tests/string_test.cpp
C++
apache-2.0
19,354
/*- * BSD LICENSE * * Copyright 2015 6WIND S.A. * Copyright 2015 Mellanox. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of 6WIND S.A. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <unistd.h> #include <rte_ether.h> #include <rte_ethdev.h> #include <rte_interrupts.h> #include <rte_alarm.h> #include "mlx5.h" #include "mlx5_rxtx.h" #include "mlx5_utils.h" static void priv_txq_stop(struct priv *priv) { unsigned int i; for (i = 0; i != priv->txqs_n; ++i) mlx5_priv_txq_release(priv, i); } static int priv_txq_start(struct priv *priv) { unsigned int i; int ret = 0; /* Add memory regions to Tx queues. */ for (i = 0; i != priv->txqs_n; ++i) { unsigned int idx = 0; struct mlx5_mr *mr; struct mlx5_txq_ctrl *txq_ctrl = mlx5_priv_txq_get(priv, i); if (!txq_ctrl) continue; LIST_FOREACH(mr, &priv->mr, next) priv_txq_mp2mr_reg(priv, &txq_ctrl->txq, mr->mp, idx++); txq_alloc_elts(txq_ctrl); txq_ctrl->ibv = mlx5_priv_txq_ibv_new(priv, i); if (!txq_ctrl->ibv) { ret = ENOMEM; goto error; } } return -ret; error: priv_txq_stop(priv); return -ret; } static void priv_rxq_stop(struct priv *priv) { unsigned int i; for (i = 0; i != priv->rxqs_n; ++i) mlx5_priv_rxq_release(priv, i); } static int priv_rxq_start(struct priv *priv) { unsigned int i; int ret = 0; for (i = 0; i != priv->rxqs_n; ++i) { struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_priv_rxq_get(priv, i); if (!rxq_ctrl) continue; ret = rxq_alloc_elts(rxq_ctrl); if (ret) goto error; rxq_ctrl->ibv = mlx5_priv_rxq_ibv_new(priv, i); if (!rxq_ctrl->ibv) { ret = ENOMEM; goto error; } } return -ret; error: priv_rxq_stop(priv); return -ret; } /** * DPDK callback to start the device. * * Simulate device start by attaching all configured flows. * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success, negative errno value on failure. */ int mlx5_dev_start(struct rte_eth_dev *dev) { struct priv *priv = dev->data->dev_private; struct mlx5_mr *mr = NULL; int err; if (mlx5_is_secondary()) return -E_RTE_SECONDARY; dev->data->dev_started = 1; priv_lock(priv); err = priv_flow_create_drop_queue(priv); if (err) { ERROR("%p: Drop queue allocation failed: %s", (void *)dev, strerror(err)); goto error; } DEBUG("%p: allocating and configuring hash RX queues", (void *)dev); rte_mempool_walk(mlx5_mp2mr_iter, priv); err = priv_txq_start(priv); if (err) { ERROR("%p: TXQ allocation failed: %s", (void *)dev, strerror(err)); goto error; } /* Update send callback. */ priv_dev_select_tx_function(priv, dev); err = priv_rxq_start(priv); if (err) { ERROR("%p: RXQ allocation failed: %s", (void *)dev, strerror(err)); goto error; } /* Update receive callback. */ priv_dev_select_rx_function(priv, dev); err = priv_dev_traffic_enable(priv, dev); if (err) { ERROR("%p: an error occurred while configuring control flows:" " %s", (void *)priv, strerror(err)); goto error; } err = priv_flow_start(priv, &priv->flows); if (err) { ERROR("%p: an error occurred while configuring flows:" " %s", (void *)priv, strerror(err)); goto error; } err = priv_rx_intr_vec_enable(priv); if (err) { ERROR("%p: RX interrupt vector creation failed", (void *)priv); goto error; } priv_dev_interrupt_handler_install(priv, dev); priv_xstats_init(priv); priv_unlock(priv); return 0; error: /* Rollback. */ dev->data->dev_started = 0; for (mr = LIST_FIRST(&priv->mr); mr; mr = LIST_FIRST(&priv->mr)) priv_mr_release(priv, mr); priv_flow_stop(priv, &priv->flows); priv_dev_traffic_disable(priv, dev); priv_txq_stop(priv); priv_rxq_stop(priv); priv_flow_delete_drop_queue(priv); priv_unlock(priv); return -err; } /** * DPDK callback to stop the device. * * Simulate device stop by detaching all configured flows. * * @param dev * Pointer to Ethernet device structure. */ void mlx5_dev_stop(struct rte_eth_dev *dev) { struct priv *priv = dev->data->dev_private; struct mlx5_mr *mr; if (mlx5_is_secondary()) return; priv_lock(priv); dev->data->dev_started = 0; /* Prevent crashes when queues are still in use. */ dev->rx_pkt_burst = removed_rx_burst; dev->tx_pkt_burst = removed_tx_burst; rte_wmb(); usleep(1000 * priv->rxqs_n); DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev); priv_flow_stop(priv, &priv->flows); priv_dev_traffic_disable(priv, dev); priv_rx_intr_vec_disable(priv); priv_dev_interrupt_handler_uninstall(priv, dev); priv_txq_stop(priv); priv_rxq_stop(priv); for (mr = LIST_FIRST(&priv->mr); mr; mr = LIST_FIRST(&priv->mr)) priv_mr_release(priv, mr); priv_flow_delete_drop_queue(priv); priv_unlock(priv); } /** * Enable traffic flows configured by control plane * * @param priv * Pointer to Ethernet device private data. * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success. */ int priv_dev_traffic_enable(struct priv *priv, struct rte_eth_dev *dev) { struct rte_flow_item_eth bcast = { .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", }; struct rte_flow_item_eth ipv6_multi_spec = { .dst.addr_bytes = "\x33\x33\x00\x00\x00\x00", }; struct rte_flow_item_eth ipv6_multi_mask = { .dst.addr_bytes = "\xff\xff\x00\x00\x00\x00", }; struct rte_flow_item_eth unicast = { .src.addr_bytes = "\x00\x00\x00\x00\x00\x00", }; struct rte_flow_item_eth unicast_mask = { .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", }; const unsigned int vlan_filter_n = priv->vlan_filter_n; const struct ether_addr cmp = { .addr_bytes = "\x00\x00\x00\x00\x00\x00", }; unsigned int i; unsigned int j; int ret; if (priv->isolated) return 0; if (dev->data->promiscuous) { struct rte_flow_item_eth promisc = { .dst.addr_bytes = "\x00\x00\x00\x00\x00\x00", .src.addr_bytes = "\x00\x00\x00\x00\x00\x00", .type = 0, }; claim_zero(mlx5_ctrl_flow(dev, &promisc, &promisc)); return 0; } if (dev->data->all_multicast) { struct rte_flow_item_eth multicast = { .dst.addr_bytes = "\x01\x00\x00\x00\x00\x00", .src.addr_bytes = "\x00\x00\x00\x00\x00\x00", .type = 0, }; claim_zero(mlx5_ctrl_flow(dev, &multicast, &multicast)); } else { /* Add broadcast/multicast flows. */ for (i = 0; i != vlan_filter_n; ++i) { uint16_t vlan = priv->vlan_filter[i]; struct rte_flow_item_vlan vlan_spec = { .tci = rte_cpu_to_be_16(vlan), }; struct rte_flow_item_vlan vlan_mask = { .tci = 0xffff, }; ret = mlx5_ctrl_flow_vlan(dev, &bcast, &bcast, &vlan_spec, &vlan_mask); if (ret) goto error; ret = mlx5_ctrl_flow_vlan(dev, &ipv6_multi_spec, &ipv6_multi_mask, &vlan_spec, &vlan_mask); if (ret) goto error; } if (!vlan_filter_n) { ret = mlx5_ctrl_flow(dev, &bcast, &bcast); if (ret) goto error; ret = mlx5_ctrl_flow(dev, &ipv6_multi_spec, &ipv6_multi_mask); if (ret) goto error; } } /* Add MAC address flows. */ for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) { struct ether_addr *mac = &dev->data->mac_addrs[i]; if (!memcmp(mac, &cmp, sizeof(*mac))) continue; memcpy(&unicast.dst.addr_bytes, mac->addr_bytes, ETHER_ADDR_LEN); for (j = 0; j != vlan_filter_n; ++j) { uint16_t vlan = priv->vlan_filter[j]; struct rte_flow_item_vlan vlan_spec = { .tci = rte_cpu_to_be_16(vlan), }; struct rte_flow_item_vlan vlan_mask = { .tci = 0xffff, }; ret = mlx5_ctrl_flow_vlan(dev, &unicast, &unicast_mask, &vlan_spec, &vlan_mask); if (ret) goto error; } if (!vlan_filter_n) { ret = mlx5_ctrl_flow(dev, &unicast, &unicast_mask); if (ret) goto error; } } return 0; error: return rte_errno; } /** * Disable traffic flows configured by control plane * * @param priv * Pointer to Ethernet device private data. * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success. */ int priv_dev_traffic_disable(struct priv *priv, struct rte_eth_dev *dev) { (void)dev; priv_flow_flush(priv, &priv->ctrl_flows); return 0; } /** * Restart traffic flows configured by control plane * * @param priv * Pointer to Ethernet device private data. * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success. */ int priv_dev_traffic_restart(struct priv *priv, struct rte_eth_dev *dev) { if (dev->data->dev_started) { priv_dev_traffic_disable(priv, dev); priv_dev_traffic_enable(priv, dev); } return 0; } /** * Restart traffic flows configured by control plane * * @param dev * Pointer to Ethernet device structure. * * @return * 0 on success. */ int mlx5_traffic_restart(struct rte_eth_dev *dev) { struct priv *priv = dev->data->dev_private; priv_lock(priv); priv_dev_traffic_restart(priv, dev); priv_unlock(priv); return 0; }
dimagol/trex-core
src/dpdk/drivers/net/mlx5/mlx5_trigger.c
C
apache-2.0
10,385
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.codehaus.groovy.antlr.treewalker; import groovy.lang.GroovyShell; import groovy.lang.Script; import groovy.util.GroovyTestCase; /** * This tests code that is valid in parser, but has issues further down the line. * * @author <a href="mailto:groovy@ross-rayner.com">Jeremy Rayner</a> */ public class UnimplementedSyntaxTest extends GroovyTestCase { // ------------------------------ // feature: Annotation Definition // ------------------------------ public void test_AnnotationDef1_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: ANNOTATION_DEF assertNotNull(compile("public @interface Foo{}")); } public void test_AnnotationDef2_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: ANNOTATION_DEF assertNotNull(compile("public @interface Foo{int bar() default 123}")); } // ------------------------------ // bug: Qualified Exception Types // ------------------------------ public void test_QualifiedExceptionTypes_FAILS() throws Exception { if (notYetImplemented()) return; // Unexpected node type: '.' found when expecting type: an identifier assertNotNull(compile("def foo() throws bar.MookyException{}")); // fails after parser } // ------------------------------ // feature: classic Java for loop // ------------------------------ public void test_ClassicJavaForLoop1_FAILS() throws Exception { if (notYetImplemented()) return; // For statement contains unexpected tokens. Possible attempt to use unsupported Java-style for loop. // This syntax now replaced with closure list i.e. for (i=0;j=2;i<10;i++;j--) {... assertNotNull(compile("for (i = 0,j = 2;i < 10; i++, j--) {print i}")); // fails after parser } public void test_ClassicJavaForLoop2() throws Exception { // For statement contains unexpected tokens. Possible attempt to use unsupported Java-style for loop. assertNotNull(compile("for (i=0;i<10;i++) {println i}")); // fails after parser } // ------------------------------ // feature: Enum Definitions // ------------------------------ public void test_EnumDef1_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: ENUM_DEF assertNotNull(compile("enum Coin {PENNY(1), DIME(10), QUARTER(25)}")); // fails after parser } public void test_EnumDef2_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: ENUM_DEF assertNotNull(compile("enum Season{WINTER,SPRING,SUMMER,AUTUMN}")); // fails after parser } public void test_EnumDef3_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: ENUM_DEF assertNotNull(compile("enum Operation {ADDITION {double eval(x,y) {return x + y}}}")); // fails after parser } public void test_EnumDef4_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: ENUM_DEF assertNotNull(compile("enum EarthSeason implements Season{SPRING}")); // fails after parser } // ------------------------------------------------ // deprecate in parser?: 'break' allowed in methods // ------------------------------------------------ public void test_BreakAllowedInMethods_FAILS() throws Exception { if (notYetImplemented()) return; // the break statement is only allowed inside loops or switches assertNotNull(compile("def myMethod(){break}")); // fails after parser } // ---------------------------------------------------- // deprecate in parser?: 'continue' allowed in closures // ---------------------------------------------------- public void test_ContinueAllowedInClosures_FAILS() throws Exception { if (notYetImplemented()) return; // the continue statement is only allowed inside loops assertNotNull(compile("[1,2,3].each{continue}")); // fails after parser } // ---------------------------------------------------- // feature?: allow break/continue with value from loops? // ---------------------------------------------------- public void test_BreakWithValueAllowedInLoops_FAILS() throws Exception { if (notYetImplemented()) return; // Unexpected node type: a numeric literal found when expecting type: an identifier assertNotNull(compile("for (i in 1..100) {break 2}")); // fails after parser } public void test_ContinueWithValueAllowedInLoops_FAILS() throws Exception { if (notYetImplemented()) return; // Unexpected node type: a numeric literal found when expecting type: an identifier assertNotNull(compile("for (i in 1..100) {continue 2}")); // fails after parser } // --------------------------------------------------------------- // feature?: allow break/continue to labeled statement from loops? (is this even right syntax, or parser bug???) // --------------------------------------------------------------- public void test_BreakToLabeledStatementAllowedInLoops_FAILS() throws Exception { if (notYetImplemented()) return; // Unexpected node type: LABELED_STAT found when expecting type: an identifier assertNotNull(compile("for (i in 1..100) {break label1:}")); // fails after parser } public void test_ContinueToLabeledStatementAllowedInLoops_FAILS() throws Exception { if (notYetImplemented()) return; // Unexpected node type: LABELED_STAT found when expecting type: an identifier assertNotNull(compile("for (i in 1..100) {continue label1:}")); // fails after parser } // ----------------------- // feature: Native Methods // ----------------------- public void test_NativeMethods1_FAILS() throws Exception { if (notYetImplemented()) return; // You defined a method without body. Try adding a body, or declare it abstract assertNotNull(compile("public class R{public native void seek(long pos)}")); // fails after parser } public void test_NativeMethods2_FAILS() throws Exception { if (notYetImplemented()) return; // You defined a method without body. Try adding a body, or declare it abstract assertNotNull(compile("native foo()")); // fails after parser } // --------------------- // feature: 'threadsafe' // --------------------- public void test_Threadsafe1_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: "threadsafe" assertNotNull(compile("threadsafe foo() {}")); // fails after parser } public void test_Threadsafe2_FAILS() throws Exception { if (notYetImplemented()) return; // Unknown type: "threadsafe" assertNotNull(compile("public static transient final native threadsafe synchronized volatile strictfp foo() {}")); // fails after parser } // -------------------------------------------------- // bugs?: spread expressions in closures and GStrings // -------------------------------------------------- public void test_SpreadExpressionInClosure_FAILS() throws Exception { if (notYetImplemented()) return; // BUG! exception in phase 'class generation' in source unit 'Script1.groovy' // SpreadExpression should not be visited here assertNotNull(compile("myList{*name}")); // fails after parser } public void test_SpreadExpressionInGString1_FAILS() throws Exception { if (notYetImplemented()) return; // BUG! exception in phase 'conversion' in source unit 'Script1.groovy' null assertNotNull(compile("\"foo$*bar\"")); // fails after parser } public void test_SpreadExpressionInGString2_FAILS() throws Exception { if (notYetImplemented()) return; // BUG! exception in phase 'class generation' in source unit 'Script1.groovy' // SpreadExpression should not be visited here assertNotNull(compile("\"foo${*bar}\"")); // fails after parser } // ----------------------- // feature: static imports // ----------------------- // TODO: move somewhere else public void test_StaticImport1() throws Exception { //GROOVY-3711: The following call now results in a valid script class node, so foo.Bar needs to get resolved. GroovyShell groovyShell = new GroovyShell(); compile("package foo; class Bar{}", groovyShell); assertNotNull(compile("import static foo.Bar.mooky", groovyShell)); } public void test_StaticImport2() throws Exception { //GROOVY-3711: The following call now results in a valid script class node, so foo.Bar needs to get resolved. GroovyShell groovyShell = new GroovyShell(); compile("package foo; class Bar{}", groovyShell); assertNotNull(compile("import static foo.Bar.*", groovyShell)); } // TODO: move somewhere else GROOVY-1874 public void test_staticBlockWithNewLines() throws Exception { assertNotNull(compile("class MyClass \n{\n\tstatic\n{\nprintln 2\n}\n}")); } public void test_staticBlockWithNoStartNewLines() throws Exception { assertNotNull(compile("class MyClass \n{\n\tstatic {\nprintln 2\n}\n}")); } public void test_staticBlockWithNoNewLines() throws Exception { assertNotNull(compile("class MyClass \n{\n\tstatic { println 2 }}")); } // ------------------------ // feature: type parameters // ------------------------ public void test_TypeParameters_FAILS() throws Exception { if (notYetImplemented()) return; // Unexpected node type: TYPE_PARAMETERS found when expecting type: OBJBLOCK assertNotNull(compile("class Foo<T extends C & I> {T t}")); // fails after parser } private Script compile(String input) throws Exception { return compile(input, new GroovyShell()); } private Script compile(String input, GroovyShell groovyShell) throws Exception { TraversalTestHelper traverser = new TraversalTestHelper(); traverser.traverse(input, SourcePrinter.class, Boolean.FALSE); return groovyShell.parse(input); } }
OpenBEL/kam-nav
tools/groovy/src/src/test/org/codehaus/groovy/antlr/treewalker/UnimplementedSyntaxTest.java
Java
apache-2.0
11,146
/* * Copyright (c) 2008-2018 Haulmont. * * 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.haulmont.cuba.gui.components; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Collection; /** * A component containing {@link Action}s. */ public interface ActionsHolder extends Component, HasSubParts { /** * Add an action to the component */ void addAction(Action action); /** * Add an action to the component with index. */ void addAction(Action action, int index); /** * Remove the action from the component */ void removeAction(@Nullable Action action); /** * Remove the action by its ID. If there is no action with that ID, nothing happens. */ void removeAction(@Nullable String id); /** * Remove all actions from the component */ void removeAllActions(); /** * @return unmodifiable collection of actions */ Collection<Action> getActions(); /** * @return an action by its ID, or null if not found */ @Nullable Action getAction(String id); /** * @return an action by its ID * @throws java.lang.IllegalArgumentException if not found */ @Nonnull default Action getActionNN(String id) { Action action = getAction(id); if (action == null) { throw new IllegalStateException("Unable to find action with id " + id); } return action; } @Nullable @Override default Object getSubPart(String name) { return getAction(name); } }
cuba-platform/cuba
modules/gui/src/com/haulmont/cuba/gui/components/ActionsHolder.java
Java
apache-2.0
2,112
// https://jestjs.io/docs/en/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom Object.defineProperty(window, 'matchMedia', { writable: true, value: jest.fn().mockImplementation(query => ({ matches: false, media: query, onchange: null, addListener: jest.fn(), // deprecated removeListener: jest.fn(), // deprecated addEventListener: jest.fn(), removeEventListener: jest.fn(), dispatchEvent: jest.fn(), })), });
vector-im/vector-web
test/jest-mocks.js
JavaScript
apache-2.0
500
#!/usr/bin/env python """HTTP API logic that ties API call renderers with HTTP routes.""" import json from django import http from werkzeug import exceptions as werkzeug_exceptions from werkzeug import routing import logging from grr.gui import api_call_renderers from grr.lib import access_control from grr.lib import rdfvalue from grr.lib import registry def BuildToken(request, execution_time): """Build an ACLToken from the request.""" if request.method == "GET": reason = request.GET.get("reason", "") elif request.method == "POST": reason = request.POST.get("reason", "") token = access_control.ACLToken( username=request.user, reason=reason, process="GRRAdminUI", expiry=rdfvalue.RDFDatetime().Now() + execution_time) for field in ["REMOTE_ADDR", "HTTP_X_FORWARDED_FOR"]: remote_addr = request.META.get(field, "") if remote_addr: token.source_ips.append(remote_addr) return token HTTP_ROUTING_MAP = routing.Map() def RegisterHttpRouteHandler(method, route, renderer_cls): """Registers given ApiCallRenderer for given method and route.""" HTTP_ROUTING_MAP.add(routing.Rule( route, methods=[method], endpoint=renderer_cls)) def GetRendererForHttpRequest(request): """Returns a renderer to handle given HTTP request.""" matcher = HTTP_ROUTING_MAP.bind("%s:%s" % (request.environ["SERVER_NAME"], request.environ["SERVER_PORT"])) try: match = matcher.match(request.path, request.method) except werkzeug_exceptions.NotFound: raise api_call_renderers.ApiCallRendererNotFoundError( "No API renderer was found for (%s) %s" % (request.path, request.method)) renderer_cls, route_args = match return (renderer_cls(), route_args) def FillAdditionalArgsFromRequest(request, supported_types): """Creates arguments objects from a given request dictionary.""" results = {} for key, value in request.items(): try: request_arg_type, request_attr = key.split(".", 1) except ValueError: continue arg_class = None for key, supported_type in supported_types.items(): if key == request_arg_type: arg_class = supported_type if arg_class: if request_arg_type not in results: results[request_arg_type] = arg_class() results[request_arg_type].Set(request_attr, value) results_list = [] for name, arg_obj in results.items(): additional_args = rdfvalue.ApiCallAdditionalArgs( name=name, type=supported_types[name].__name__) additional_args.args = arg_obj results_list.append(additional_args) return results_list class JSONEncoderWithRDFPrimitivesSupport(json.JSONEncoder): """Custom JSON encoder that encodes renderers output. Custom encoder is required to facilitate usage of primitive values - booleans, integers and strings - in renderers responses. If renderer references an RDFString, RDFInteger or and RDFBOol when building a response, it will lead to JSON encoding failure when response encoded, unless this custom encoder is used. Another way to solve this issue would be to explicitly call api_value_renderers.RenderValue on every value returned from the renderer, but it will make the code look overly verbose and dirty. """ def default(self, obj): if isinstance(obj, (rdfvalue.RDFInteger, rdfvalue.RDFBool, rdfvalue.RDFString)): return obj.SerializeToDataStore() return json.JSONEncoder.default(self, obj) def BuildResponse(status, rendered_data): """Builds HTTPResponse object from rendered data and HTTP status.""" response = http.HttpResponse(status=status, content_type="application/json") response.write(")]}'\n") # XSSI protection response.write(json.dumps(rendered_data, cls=JSONEncoderWithRDFPrimitivesSupport)) return response def RenderHttpResponse(request): """Handles given HTTP request with one of the available API renderers.""" renderer, route_args = GetRendererForHttpRequest(request) if request.method == "GET": if renderer.args_type: unprocessed_request = request.GET if hasattr(unprocessed_request, "dict"): unprocessed_request = unprocessed_request.dict() args = renderer.args_type() for type_info in args.type_infos: if type_info.name in route_args: args.Set(type_info.name, route_args[type_info.name]) elif type_info.name in unprocessed_request: args.Set(type_info.name, unprocessed_request[type_info.name]) if renderer.additional_args_types: if not hasattr(args, "additional_args"): raise RuntimeError("Renderer %s defines additional arguments types " "but its arguments object does not have " "'additional_args' field." % renderer) if hasattr(renderer.additional_args_types, "__call__"): additional_args_types = renderer.additional_args_types() else: additional_args_types = renderer.additional_args_types args.additional_args = FillAdditionalArgsFromRequest( unprocessed_request, additional_args_types) else: args = None elif request.method == "POST": try: payload = json.loads(request.body) args = renderer.args_type(**payload) except Exception as e: # pylint: disable=broad-except response = http.HttpResponse(status=500) response.write(")]}'\n") # XSSI protection response.write(json.dumps(dict(message=str(e)))) logging.exception( "Error while parsing POST request %s (%s): %s", request.path, request.method, e) return response else: raise RuntimeError("Unsupported method: %s." % request.method) token = BuildToken(request, renderer.max_execution_time) try: rendered_data = api_call_renderers.HandleApiCall(renderer, args, token=token) return BuildResponse(200, rendered_data) except Exception as e: # pylint: disable=broad-except logging.exception( "Error while processing %s (%s) with %s: %s", request.path, request.method, renderer.__class__.__name__, e) return BuildResponse(500, dict(message=str(e))) class HttpApiInitHook(registry.InitHook): """Register HTTP API renderers.""" def RunOnce(self): # Doing late import to avoid circular dependency (http_api.py is referenced # by api_plugins/docs.py). # # pylint: disable=g-import-not-at-top from grr.gui import api_plugins # pylint: enable=g-import-not-at-top # The list is alphabetized by route. RegisterHttpRouteHandler("GET", "/api/aff4/<path:aff4_path>", api_plugins.aff4.ApiAff4Renderer) RegisterHttpRouteHandler("GET", "/api/aff4-index/<path:aff4_path>", api_plugins.aff4.ApiAff4IndexRenderer) RegisterHttpRouteHandler("GET", "/api/artifacts", api_plugins.artifact.ApiArtifactRenderer) RegisterHttpRouteHandler("GET", "/api/clients", api_plugins.client.ApiClientSearchRenderer) RegisterHttpRouteHandler("GET", "/api/clients/<client_id>", api_plugins.client.ApiClientSummaryRenderer) RegisterHttpRouteHandler("GET", "/api/clients/labels", api_plugins.client.ApiClientsLabelsListRenderer) RegisterHttpRouteHandler("POST", "/api/clients/labels/add", api_plugins.client.ApiClientsAddLabelsRenderer) RegisterHttpRouteHandler("POST", "/api/clients/labels/remove", api_plugins.client.ApiClientsRemoveLabelsRenderer) RegisterHttpRouteHandler("GET", "/api/config", api_plugins.config.ApiConfigRenderer) RegisterHttpRouteHandler("GET", "/api/docs", api_plugins.docs.ApiDocsRenderer) RegisterHttpRouteHandler("GET", "/api/flows/<client_id>/<flow_id>/status", api_plugins.client.ApiFlowStatusRenderer) RegisterHttpRouteHandler("GET", "/api/hunts", api_plugins.hunt.ApiHuntsListRenderer) RegisterHttpRouteHandler("GET", "/api/hunts/<hunt_id>", api_plugins.hunt.ApiHuntSummaryRenderer) RegisterHttpRouteHandler("GET", "/api/hunts/<hunt_id>/errors", api_plugins.hunt.ApiHuntErrorsRenderer) RegisterHttpRouteHandler("GET", "/api/hunts/<hunt_id>/log", api_plugins.hunt.ApiHuntLogRenderer) RegisterHttpRouteHandler( "GET", "/api/reflection/rdfvalue/<type>", api_plugins.reflection.ApiRDFValueReflectionRenderer) RegisterHttpRouteHandler( "GET", "/api/reflection/rdfvalue/all", api_plugins.reflection.ApiAllRDFValuesReflectionRenderer) RegisterHttpRouteHandler( "GET", "/api/stats/store/<component>/metadata", api_plugins.stats.ApiStatsStoreMetricsMetadataRenderer) RegisterHttpRouteHandler( "GET", "/api/stats/store/<component>/metrics/<metric_name>", api_plugins.stats.ApiStatsStoreMetricRenderer) RegisterHttpRouteHandler("GET", "/api/users/me/settings", api_plugins.user.ApiUserSettingsRenderer) RegisterHttpRouteHandler("POST", "/api/users/me/settings", api_plugins.user.ApiSetUserSettingsRenderer)
ksmaheshkumar/grr
gui/http_api.py
Python
apache-2.0
9,614
package hex; import water.fvec.Frame; import water.util.TwoDimTable; public class ModelMetricsBinomialGeneric extends ModelMetricsBinomial { public final TwoDimTable _gainsLiftTable; public final TwoDimTable _thresholds_and_metric_scores; public final TwoDimTable _max_criteria_and_metric_scores; public final TwoDimTable _confusion_matrix; public final double _r2; public ModelMetricsBinomialGeneric(Model model, Frame frame, long nobs, double mse, String[] domain, double sigma, AUC2 auc, double logloss, TwoDimTable gainsLiftTable, CustomMetric customMetric, double mean_per_class_error, TwoDimTable thresholds_and_metric_scores, TwoDimTable max_criteria_and_metric_scores, TwoDimTable confusion_matrix, double r2, final String description) { super(model, frame, nobs, mse, domain, sigma, auc, logloss, null, customMetric); _gainsLiftTable = gainsLiftTable; _thresholds_and_metric_scores = thresholds_and_metric_scores; _max_criteria_and_metric_scores = max_criteria_and_metric_scores; _confusion_matrix = confusion_matrix; _mean_per_class_error = mean_per_class_error; _r2 = r2; _description = description; } @Override public double r2() { return _r2; } }
h2oai/h2o-3
h2o-core/src/main/java/hex/ModelMetricsBinomialGeneric.java
Java
apache-2.0
1,373
/**************************************************************************** Copyright 2004, Colorado School of Mines and others. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ****************************************************************************/ package edu.mines.jtk.dsp; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import static edu.mines.jtk.util.ArrayMath.FLT_EPSILON; /** * Tests {@link edu.mines.jtk.dsp.Real1}. * @author Dave Hale, Colorado School of Mines * @version 2005.03.10 */ public class Real1Test { static final int N = 100; static final double TINY = N*10*FLT_EPSILON; static final Real1 FILL1 = Real1.fill(1.0,N); static final Real1 FILL2 = Real1.fill(2.0,N); static final Real1 RAMP1 = Real1.ramp(0.0,1.0,N); static final Real1 RAMP2 = Real1.ramp(0.0,2.0,N); @Test public void testMath() { Real1 ra = RAMP1; Real1 rb = RAMP1; Real1 rc = ra.plus(rb); Real1 re = RAMP2; assertRealEquals(re,rc); } @Test public void testResample() { Real1 ra = FILL1; Sampling sa = ra.getSampling(); int n1 = sa.getCount(); double d1 = sa.getDelta(); int m1 = n1/3; Sampling sb = sa.shift(-m1*d1); Real1 rb = ra.resample(sb); float[] vb = rb.getValues(); for (int i1=0; i1<m1; ++i1) assertEquals(0.0,vb[i1],0.0); for (int i1=m1; i1<n1; ++i1) assertEquals(1.0,vb[i1],0.0); Sampling sc = sa.shift(m1*d1); Real1 rc = ra.resample(sc); float[] vc = rc.getValues(); for (int i1=0; i1<n1-m1; ++i1) assertEquals(1.0,vc[i1],0.0); for (int i1=n1-m1; i1<n1; ++i1) assertEquals(0.0,vc[i1],0.0); } void assertRealEquals(Real1 e, Real1 a) { Sampling se = e.getSampling(); Sampling sa = a.getSampling(); assertTrue(sa.isEquivalentTo(se)); float[] ve = e.getValues(); float[] va = a.getValues(); int n = ve.length; for (int i=0; i<n; ++i) assertEquals(ve[i],va[i],TINY); } }
chrisengelsma/jtk
core/src/test/java/edu/mines/jtk/dsp/Real1Test.java
Java
apache-2.0
2,505
// filter: unchecked package p; public class A { public static interface I { public I w(); } public static interface J<R extends J<R>> extends I { @Override public R w(); } public static interface K extends I { @Override public K w(); public default String mK() { return "K"; } } /* package-private */ static class B<R extends J<R>> implements J<R> { @Override public R w() { return (R) this; } } public static class C<R extends J<R>> extends B<R> implements J<R> { } // OK in Java, also OK in Scala public static class Test extends C<Test> implements K { } }
scala/scala
test/files/run/t12380/A.java
Java
apache-2.0
610
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.webbeans.sample.bean; public class AppObject { public boolean config; public AppObject() { config = true; } }
apache/openwebbeans
samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
Java
apache-2.0
956
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Nop.Plugin.Misc.PointOfSale")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Nop.Plugin.Misc.PointOfSale")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a08d5d30-e355-4ea9-af29-08dd2413032f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
shanalikhan/NopCommerce_POS
Plugins/Nop.Plugin.Misc.PointOfSale/Properties/AssemblyInfo.cs
C#
apache-2.0
1,430
# Makefile - dtls server that is used in testing # # Copyright (c) 2015 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NET_IFACE ?= slip MDEF_FILE = prj.mdef KERNEL_TYPE ?= nano BOARD ?= qemu_x86 CONF_FILE ?= prj_$(NET_IFACE).conf include $(ZEPHYR_BASE)/Makefile.inc ifeq ($(CONFIG_NETWORKING_WITH_BT), y) QEMU_EXTRA_FLAGS = -serial unix:/tmp/bt-server-bredr else include $(ZEPHYR_BASE)/samples/net/common/Makefile.ipstack endif
mirzak/zephyr-os
samples/net/dtls_server/Makefile
Makefile
apache-2.0
954
<?php /******************************************************************************* * Copyright 2009-2016 Amazon Services. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. ******************************************************************************* * PHP Version 5 * @category Amazon * @package FBA Outbound Service MWS * @version 2010-10-01 * Library Version: 2016-10-19 * Generated: Wed Oct 19 08:37:58 PDT 2016 */ /** * @see FBAOutboundServiceMWS_Model */ require_once (dirname(__FILE__) . '/../Model.php'); /** * FBAOutboundServiceMWS_Model_ListAllFulfillmentOrdersResult * * Properties: * <ul> * * <li>NextToken: string</li> * <li>FulfillmentOrders: FBAOutboundServiceMWS_Model_FulfillmentOrderList</li> * * </ul> */ class FBAOutboundServiceMWS_Model_ListAllFulfillmentOrdersResult extends FBAOutboundServiceMWS_Model { public function __construct($data = null) { $this->_fields = array ( 'NextToken' => array('FieldValue' => null, 'FieldType' => 'string'), 'FulfillmentOrders' => array('FieldValue' => null, 'FieldType' => 'FBAOutboundServiceMWS_Model_FulfillmentOrderList'), ); parent::__construct($data); } /** * Get the value of the NextToken property. * * @return String NextToken. */ public function getNextToken() { return $this->_fields['NextToken']['FieldValue']; } /** * Set the value of the NextToken property. * * @param string nextToken * @return this instance */ public function setNextToken($value) { $this->_fields['NextToken']['FieldValue'] = $value; return $this; } /** * Check to see if NextToken is set. * * @return true if NextToken is set. */ public function isSetNextToken() { return !is_null($this->_fields['NextToken']['FieldValue']); } /** * Set the value of NextToken, return this. * * @param nextToken * The new value to set. * * @return This instance. */ public function withNextToken($value) { $this->setNextToken($value); return $this; } /** * Get the value of the FulfillmentOrders property. * * @return FulfillmentOrderList FulfillmentOrders. */ public function getFulfillmentOrders() { return $this->_fields['FulfillmentOrders']['FieldValue']; } /** * Set the value of the FulfillmentOrders property. * * @param FBAOutboundServiceMWS_Model_FulfillmentOrderList fulfillmentOrders * @return this instance */ public function setFulfillmentOrders($value) { $this->_fields['FulfillmentOrders']['FieldValue'] = $value; return $this; } /** * Check to see if FulfillmentOrders is set. * * @return true if FulfillmentOrders is set. */ public function isSetFulfillmentOrders() { return !is_null($this->_fields['FulfillmentOrders']['FieldValue']); } /** * Set the value of FulfillmentOrders, return this. * * @param fulfillmentOrders * The new value to set. * * @return This instance. */ public function withFulfillmentOrders($value) { $this->setFulfillmentOrders($value); return $this; } }
enkay83/mws
src/FBAOutboundServiceMWS/Model/ListAllFulfillmentOrdersResult.php
PHP
apache-2.0
3,796
/* * Copyright 2015-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ using System.Collections; using System.Collections.Generic; using Amazon.MobileAnalytics.MobileAnalyticsManager.Internal; using System; namespace Amazon.MobileAnalytics.MobileAnalyticsManager { /// <summary> /// Interface for Mobile Analytics Event. /// </summary> public interface IEvent { #region attribute /// <summary> /// Adds the attribute. /// </summary> /// <param name="attributeName">Attribute name. Max name length is 50.</param> /// <param name="attributeValue">Attribute value. Max value length is 255.</param> void AddAttribute(string attributeName, string attributeValue); /// <summary> /// Determines whether this instance has attribute the specified attributeName. /// </summary> /// <returns><c>true</c> if this instance has attribute the specified attributeName; otherwise, <c>false</c>.</returns> /// <param name="attributeName">Attribute name.</param> bool HasAttribute(string attributeName); /// <summary> /// Gets the attribute. /// </summary> /// <returns>The attribute. Return null if the attribute doesn't exist.</returns> /// <param name="attributeName">Attribute name.</param> string GetAttribute(string attributeName); /// <summary> /// Gets all attributes. /// </summary> /// <returns>All the attributes.</returns> IDictionary<string, string> AllAttributes { get; } #endregion #region metric /// <summary> /// Adds the metric. /// </summary> /// <param name="metricName">Metric name. Max length is 50.</param> /// <param name="metricValue">Metric value.</param> void AddMetric(string metricName, double metricValue); /// <summary> /// Determines whether this instance has metric the specified metricName. /// </summary> /// <returns><c>true</c> if this instance has metric the specified metricName; otherwise, <c>false</c>.</returns> /// <param name="metricName">Metric name.</param> bool HasMetric(string metricName); /// <summary> /// Gets the metric. /// </summary> /// <returns>The metric. Return null if metric doesn't exist.</returns> /// <param name="metricName">Metric name.</param> double? GetMetric(string metricName); /// <summary> /// Gets all metrics. /// </summary> /// <returns>All the metrics.</returns> IDictionary<string, double> AllMetrics { get; } #endregion #region gloablattribute /// <summary> /// Adds the global attribute, which is valid for all events. /// </summary> /// <param name="attributeName">Attribute name. Max length is 50.</param> /// <param name="attributeValue">Attribute value. Max length is 255.</param> void AddGlobalAttribute(string attributeName, string attributeValue); /// <summary> /// Adds the global attribute, which is valid to some specific event type. /// </summary> /// <param name="eventType">Event type.</param> /// <param name="attributeName">Attribute name. Max length is 50.</param> /// <param name="attributeValue">Attribute value. Max length is 255.</param> void AddGlobalAttribute(string eventType, string attributeName, string attributeValue); /// <summary> /// Removes the global attribute, which is valid for all events. /// </summary> /// <param name="attributeName">Attribute name.</param> void RemoveGlobalAttribute(string attributeName); /// <summary> /// Removes the global attribute, which is valid to some specific event type. /// </summary> /// <param name="eventType">Event type.</param> /// <param name="attributeName">Attribute name.</param> void RemoveGlobalAttribute(string eventType, string attributeName); /// <summary> /// Gets the global attribute, which is valid for all events. /// </summary> /// <returns>The global attribute. Return null if attribute doesn't exist.</returns> /// <param name="attributeName">Attribute name.</param> string GetGlobalAttribute(string attributeName); /// <summary> /// Gets the global attribute, which is valid for some specific event type. /// </summary> /// <returns>The global attribute. Return null if attribute doesn't exist. </returns> /// <param name="eventType">Event type.</param> /// <param name="attributeName">Attribute name.</param> string GetGlobalAttribute(string eventType, string attributeName); #endregion #region globalmetric /// <summary> /// Adds the global metric, which is valid for all events. /// </summary> /// <param name="metricName">Metric name. Max length is 50.</param> /// <param name="metricValue">Metric value.</param> void AddGlobalMetric(string metricName, double metricValue); /// <summary> /// Adds the global metric, which is valid for some specific event type. /// </summary> /// <param name="eventType">Event type.</param> /// <param name="metricName">Metric name. Max length is 50.</param> /// <param name="metricValue">Metric value.</param> void AddGlobalMetric(string eventType, string metricName, double metricValue); /// <summary> /// Removes the global metric, which is valid for all events. /// </summary> /// <param name="metricName">Metric name.</param> void RemoveGlobalMetric(string metricName); /// <summary> /// Removes the global metric, which is valid for some specific event type. /// </summary> /// <param name="eventType">Event type.</param> /// <param name="metricName">Metric name.</param> void RemoveGlobalMetric(string eventType,string metricName); /// <summary> /// Gets the global metric, which is valid for all events. /// </summary> /// <returns>The global metric.Return null if metric doesn't exist.</returns> /// <param name="metricName">Metric name.</param> double? GetGlobalMetric(string metricName); /// <summary> /// Gets the global metric, which is valid for some specific event type. /// </summary> /// <returns>The global metric.Return null if metric doesn't exist.</returns> /// <param name="eventType">Event type.</param> /// <param name="metricName">Metric name.</param> double? GetGlobalMetric(string eventType, string metricName); #endregion } }
rafd123/aws-sdk-net
sdk/src/Services/MobileAnalytics/Custom/Event/IEvent.cs
C#
apache-2.0
7,605
# Author:: Christian Vozar (<christian@rogueethic.com>) # License:: Apache License, Version 2.0 # # 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. Ohai.plugin(:Go) do provides "languages/go" depends "languages" collect_data do so = shell_out("go version") # Sample output: # go version go1.6.1 darwin/amd64 if so.exitstatus == 0 && so.stdout =~ /go(\S+)/ go = Mash.new go[:version] = $1 languages[:go] = go end rescue Ohai::Exceptions::Exec logger.trace('Plugin Go: Could not shell_out "go version". Skipping plugin') end end
mattray/ohai
lib/ohai/plugins/go.rb
Ruby
apache-2.0
1,073
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.impl.cluster; import org.apache.camel.CamelContext; import org.apache.camel.model.RouteDefinition; @FunctionalInterface public interface ClusteredRouteFilter { /** * Test if the route should be clustered or not. * * @param camelContext the camel context * @param routeId the route id * @param route the route definition * @return true if the route should be included */ boolean test(CamelContext camelContext, String routeId, RouteDefinition route); }
objectiser/camel
core/camel-core-engine/src/main/java/org/apache/camel/impl/cluster/ClusteredRouteFilter.java
Java
apache-2.0
1,325
<!doctype html> <html class="theme-next pisces use-motion" lang="zh-Hans"> <head> <script type="text/javascript"> var _speedMark = new Date(); </script> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" /> <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css"> <link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" /> <link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" /> <meta name="keywords" content="Hexo, NexT" /> <link rel="alternate" href="/atom.xml" title="Rockjins Blog" type="application/atom+xml" /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" /> <meta name="description" content="Teenager Dream Of Freedom"> <meta property="og:type" content="website"> <meta property="og:title" content="Rockjins Blog"> <meta property="og:url" content="http://yoursite.com/categories/Translation/page/2/index.html"> <meta property="og:site_name" content="Rockjins Blog"> <meta property="og:description" content="Teenager Dream Of Freedom"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="Rockjins Blog"> <meta name="twitter:description" content="Teenager Dream Of Freedom"> <script type="text/javascript" id="hexo.configurations"> var NexT = window.NexT || {}; var CONFIG = { root: '/', scheme: 'Pisces', sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false}, fancybox: true, motion: true, duoshuo: { userId: '0', author: '博主' }, algolia: { applicationID: '', apiKey: '', indexName: '', hits: {"per_page":10}, labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"} } }; </script> <link rel="canonical" href="http://yoursite.com/categories/Translation/page/2/"/> <title>分类: Translation | Rockjins Blog</title> </head> <body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans"> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-96870452-1', 'auto'); ga('send', 'pageview'); </script> <div class="container sidebar-position-left "> <div class="headband"></div> <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> <div class="header-inner"><div class="site-brand-wrapper"> <div class="site-meta "> <div class="custom-logo-site-title"> <a href="/" class="brand" rel="start"> <span class="logo-line-before"><i></i></span> <span class="site-title">Rockjins Blog</span> <span class="logo-line-after"><i></i></span> </a> </div> <p class="site-subtitle">Mad World</p> </div> <div class="site-nav-toggle"> <button> <span class="btn-bar"></span> <span class="btn-bar"></span> <span class="btn-bar"></span> </button> </div> </div> <nav class="site-nav"> <ul id="menu" class="menu"> <li class="menu-item menu-item-home"> <a href="/" rel="section"> <i class="menu-item-icon fa fa-fw fa-home"></i> <br /> 首页 </a> </li> <li class="menu-item menu-item-categories"> <a href="/categories" rel="section"> <i class="menu-item-icon fa fa-fw fa-th"></i> <br /> 分类 </a> </li> <li class="menu-item menu-item-archives"> <a href="/archives" rel="section"> <i class="menu-item-icon fa fa-fw fa-archive"></i> <br /> 归档 </a> </li> <li class="menu-item menu-item-tags"> <a href="/tags" rel="section"> <i class="menu-item-icon fa fa-fw fa-tags"></i> <br /> 标签 </a> </li> <li class="menu-item menu-item-search"> <a href="javascript:;" class="popup-trigger"> <i class="menu-item-icon fa fa-search fa-fw"></i> <br /> 搜索 </a> </li> </ul> <div class="site-search"> <div class="popup search-popup local-search-popup"> <div class="local-search-header clearfix"> <span class="search-icon"> <i class="fa fa-search"></i> </span> <span class="popup-btn-close"> <i class="fa fa-times-circle"></i> </span> <div class="local-search-input-wrapper"> <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input"> </div> </div> <div id="local-search-result"></div> </div> </div> </nav> </div> </header> <main id="main" class="main"> <div class="main-inner"> <div class="content-wrap"> <div id="content" class="content"> <section id="posts" class="posts-collapse"> <div class="collection-title"> <h1>Translation<small>分类</small> </h1> </div> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/02/13/2017-02-13-tiny-javascript-optimizations/" itemprop="url"> <span itemprop="name">『翻译』一些 JavaScript 优化的细节 </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-02-13T00:00:00+08:00" content="2017-02-13" > 02-13 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/02/11/2017-02-11-functional-programming/" itemprop="url"> <span itemprop="name">『翻译』JavaScript 函数式编程 </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-02-11T00:00:00+08:00" content="2017-02-11" > 02-11 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/02/09/2017-02-09-spread-operator/" itemprop="url"> <span itemprop="name">『翻译』扩展运算符的6个重要用途 </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-02-09T00:00:00+08:00" content="2017-02-09" > 02-09 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/02/08/2017-02-08-fun-with-console-object/" itemprop="url"> <span itemprop="name">『翻译』有趣的Console对象 </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-02-08T00:00:00+08:00" content="2017-02-08" > 02-08 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/01/26/2017-01-26-interviews-javascript/" itemprop="url"> <span itemprop="name"> 『翻译』JavaScript技术面试时要小心的三个问题 </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-01-26T00:00:00+08:00" content="2017-01-26" > 01-26 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/01/22/2017-01-22-javascript-fatigue/" itemprop="url"> <span itemprop="name"> 『翻译』JavaScript疲劳症 </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-01-22T00:00:00+08:00" content="2017-01-22" > 01-22 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/01/05/2017-01-05-Hemingway-javascript/" itemprop="url"> <span itemprop="name"> 『翻译』如果让海明威写JavaScript </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-01-05T00:00:00+08:00" content="2017-01-05" > 01-05 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2016/12/26/2016-12-26-socket-io/" itemprop="url"> <span itemprop="name">『翻译』Socket.IO聊天室程序(官方示例) </span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2016-12-26T00:00:00+08:00" content="2016-12-26" > 12-26 </time> </div> </header> </article> </section> <nav class="pagination"> <a class="extend prev" rel="prev" href="/categories/Translation/"><i class="fa fa-angle-left"></i></a><a class="page-number" href="/categories/Translation/">1</a><span class="page-number current">2</span> </nav> </div> </div> <div class="sidebar-toggle"> <div class="sidebar-toggle-line-wrap"> <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> </div> </div> <aside id="sidebar" class="sidebar"> <div class="sidebar-inner"> <section class="site-overview sidebar-panel sidebar-panel-active"> <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="余震" /> <p class="site-author-name" itemprop="name">余震</p> <p class="site-description motion-element" itemprop="description">Teenager Dream Of Freedom</p> </div> <nav class="site-state motion-element"> <div class="site-state-item site-state-posts"> <a href="/archives"> <span class="site-state-item-count">57</span> <span class="site-state-item-name">日志</span> </a> </div> <div class="site-state-item site-state-categories"> <a href="/categories/index.html"> <span class="site-state-item-count">7</span> <span class="site-state-item-name">分类</span> </a> </div> <div class="site-state-item site-state-tags"> <a href="/tags/index.html"> <span class="site-state-item-count">45</span> <span class="site-state-item-name">标签</span> </a> </div> </nav> <div class="feed-link motion-element"> <a href="/atom.xml" rel="alternate"> <i class="fa fa-rss"></i> RSS </a> </div> <div class="links-of-author motion-element"> <span class="links-of-author-item"> <a href="https://github.com/rockjins" target="_blank" title="GitHub"> <i class="fa fa-fw fa-github"></i> GitHub </a> </span> <span class="links-of-author-item"> <a href="http://weibo.com/rockjins" target="_blank" title="Weibo"> <i class="fa fa-fw fa-weibo"></i> Weibo </a> </span> </div> </section> </div> </aside> </div> </main> <footer id="footer" class="footer"> <div class="footer-inner"> <div class="copyright" > &copy; 2016 - <span itemprop="copyrightYear">2017</span> <span class="with-love"> <i class="fa fa-heart"></i> </span> <span class="author" itemprop="copyrightHolder">余震</span> </div> <div class="powered-by"> 由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动 </div> <div class="theme-info"> 主题 - <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next"> NexT.Pisces </a> </div> </div> </footer> <div class="back-to-top"> <i class="fa fa-arrow-up"></i> </div> </div> <script type="text/javascript"> if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { window.Promise = null; } </script> <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script> <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script> <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script> <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script> <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script> <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script> <script type="text/javascript" src="/js/src/affix.js?v=5.1.1"></script> <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.1"></script> <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script> <script type="text/javascript"> // Popup Window; var isfetched = false; var isXml = true; // Search DB path; var search_path = "search.xml"; if (search_path.length === 0) { search_path = "search.xml"; } else if (search_path.endsWith("json")) { isXml = false; } var path = "/" + search_path; // monitor main search box; var onPopupClose = function (e) { $('.popup').hide(); $('#local-search-input').val(''); $('.search-result-list').remove(); $('#no-result').remove(); $(".local-search-pop-overlay").remove(); $('body').css('overflow', ''); } function proceedsearch() { $("body") .append('<div class="search-popup-overlay local-search-pop-overlay"></div>') .css('overflow', 'hidden'); $('.search-popup-overlay').click(onPopupClose); $('.popup').toggle(); var $localSearchInput = $('#local-search-input'); $localSearchInput.attr("autocapitalize", "none"); $localSearchInput.attr("autocorrect", "off"); $localSearchInput.focus(); } // search function; var searchFunc = function(path, search_id, content_id) { 'use strict'; // start loading animation $("body") .append('<div class="search-popup-overlay local-search-pop-overlay">' + '<div id="search-loading-icon">' + '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' + '</div>' + '</div>') .css('overflow', 'hidden'); $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center'); $.ajax({ url: path, dataType: isXml ? "xml" : "json", async: true, success: function(res) { // get the contents from search data isfetched = true; $('.popup').detach().appendTo('.header-inner'); var datas = isXml ? $("entry", res).map(function() { return { title: $("title", this).text(), content: $("content",this).text(), url: $("url" , this).text() }; }).get() : res; var input = document.getElementById(search_id); var resultContent = document.getElementById(content_id); var inputEventFunction = function() { var searchText = input.value.trim().toLowerCase(); var keywords = searchText.split(/[\s\-]+/); if (keywords.length > 1) { keywords.push(searchText); } var resultItems = []; if (searchText.length > 0) { // perform local searching datas.forEach(function(data) { var isMatch = false; var hitCount = 0; var searchTextCount = 0; var title = data.title.trim(); var titleInLowerCase = title.toLowerCase(); var content = data.content.trim().replace(/<[^>]+>/g,""); var contentInLowerCase = content.toLowerCase(); var articleUrl = decodeURIComponent(data.url); var indexOfTitle = []; var indexOfContent = []; // only match articles with not empty titles if(title != '') { keywords.forEach(function(keyword) { function getIndexByWord(word, text, caseSensitive) { var wordLen = word.length; if (wordLen === 0) { return []; } var startPosition = 0, position = [], index = []; if (!caseSensitive) { text = text.toLowerCase(); word = word.toLowerCase(); } while ((position = text.indexOf(word, startPosition)) > -1) { index.push({position: position, word: word}); startPosition = position + wordLen; } return index; } indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false)); indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false)); }); if (indexOfTitle.length > 0 || indexOfContent.length > 0) { isMatch = true; hitCount = indexOfTitle.length + indexOfContent.length; } } // show search results if (isMatch) { // sort index by position of keyword [indexOfTitle, indexOfContent].forEach(function (index) { index.sort(function (itemLeft, itemRight) { if (itemRight.position !== itemLeft.position) { return itemRight.position - itemLeft.position; } else { return itemLeft.word.length - itemRight.word.length; } }); }); // merge hits into slices function mergeIntoSlice(text, start, end, index) { var item = index[index.length - 1]; var position = item.position; var word = item.word; var hits = []; var searchTextCountInSlice = 0; while (position + word.length <= end && index.length != 0) { if (word === searchText) { searchTextCountInSlice++; } hits.push({position: position, length: word.length}); var wordEnd = position + word.length; // move to next position of hit index.pop(); while (index.length != 0) { item = index[index.length - 1]; position = item.position; word = item.word; if (wordEnd > position) { index.pop(); } else { break; } } } searchTextCount += searchTextCountInSlice; return { hits: hits, start: start, end: end, searchTextCount: searchTextCountInSlice }; } var slicesOfTitle = []; if (indexOfTitle.length != 0) { slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle)); } var slicesOfContent = []; while (indexOfContent.length != 0) { var item = indexOfContent[indexOfContent.length - 1]; var position = item.position; var word = item.word; // cut out 100 characters var start = position - 20; var end = position + 80; if(start < 0){ start = 0; } if (end < position + word.length) { end = position + word.length; } if(end > content.length){ end = content.length; } slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent)); } // sort slices in content by search text's count and hits' count slicesOfContent.sort(function (sliceLeft, sliceRight) { if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) { return sliceRight.searchTextCount - sliceLeft.searchTextCount; } else if (sliceLeft.hits.length !== sliceRight.hits.length) { return sliceRight.hits.length - sliceLeft.hits.length; } else { return sliceLeft.start - sliceRight.start; } }); // select top N slices in content var upperBound = parseInt('1'); if (upperBound >= 0) { slicesOfContent = slicesOfContent.slice(0, upperBound); } // highlight title and content function highlightKeyword(text, slice) { var result = ''; var prevEnd = slice.start; slice.hits.forEach(function (hit) { result += text.substring(prevEnd, hit.position); var end = hit.position + hit.length; result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>'; prevEnd = end; }); result += text.substring(prevEnd, slice.end); return result; } var resultItem = ''; if (slicesOfTitle.length != 0) { resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>"; } else { resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>"; } slicesOfContent.forEach(function (slice) { resultItem += "<a href='" + articleUrl + "'>" + "<p class=\"search-result\">" + highlightKeyword(content, slice) + "...</p>" + "</a>"; }); resultItem += "</li>"; resultItems.push({ item: resultItem, searchTextCount: searchTextCount, hitCount: hitCount, id: resultItems.length }); } }) }; if (keywords.length === 1 && keywords[0] === "") { resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' } else if (resultItems.length === 0) { resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' } else { resultItems.sort(function (resultLeft, resultRight) { if (resultLeft.searchTextCount !== resultRight.searchTextCount) { return resultRight.searchTextCount - resultLeft.searchTextCount; } else if (resultLeft.hitCount !== resultRight.hitCount) { return resultRight.hitCount - resultLeft.hitCount; } else { return resultRight.id - resultLeft.id; } }); var searchResultList = '<ul class=\"search-result-list\">'; resultItems.forEach(function (result) { searchResultList += result.item; }) searchResultList += "</ul>"; resultContent.innerHTML = searchResultList; } } if ('auto' === 'auto') { input.addEventListener('input', inputEventFunction); } else { $('.search-icon').click(inputEventFunction); input.addEventListener('keypress', function (event) { if (event.keyCode === 13) { inputEventFunction(); } }); } // remove loading animation $(".local-search-pop-overlay").remove(); $('body').css('overflow', ''); proceedsearch(); } }); } // handle and trigger popup window; $('.popup-trigger').click(function(e) { e.stopPropagation(); if (isfetched === false) { searchFunc(path, 'local-search-input', 'local-search-result'); } else { proceedsearch(); }; }); $('.popup-btn-close').click(onPopupClose); $('.popup').click(function(e){ e.stopPropagation(); }); $(document).on('keyup', function (event) { var shouldDismissSearchPopup = event.which === 27 && $('.search-popup').is(':visible'); if (shouldDismissSearchPopup) { onPopupClose(); } }); </script> <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script> <script>AV.initialize("mUzlxxbLTRPVV67VbOYpi6bH-gzGzoHsz", "lRsL1tJMw9QpKCvBwIWy0TJn");</script> <script> function showTime(Counter) { var query = new AV.Query(Counter); var entries = []; var $visitors = $(".leancloud_visitors"); $visitors.each(function () { entries.push( $(this).attr("id").trim() ); }); query.containedIn('url', entries); query.find() .done(function (results) { var COUNT_CONTAINER_REF = '.leancloud-visitors-count'; if (results.length === 0) { $visitors.find(COUNT_CONTAINER_REF).text(0); return; } for (var i = 0; i < results.length; i++) { var item = results[i]; var url = item.get('url'); var time = item.get('time'); var element = document.getElementById(url); $(element).find(COUNT_CONTAINER_REF).text(time); } for(var i = 0; i < entries.length; i++) { var url = entries[i]; var element = document.getElementById(url); var countSpan = $(element).find(COUNT_CONTAINER_REF); if( countSpan.text() == '') { countSpan.text(0); } } }) .fail(function (object, error) { console.log("Error: " + error.code + " " + error.message); }); } function addCount(Counter) { var $visitors = $(".leancloud_visitors"); var url = $visitors.attr('id').trim(); var title = $visitors.attr('data-flag-title').trim(); var query = new AV.Query(Counter); query.equalTo("url", url); query.find({ success: function(results) { if (results.length > 0) { var counter = results[0]; counter.fetchWhenSave(true); counter.increment("time"); counter.save(null, { success: function(counter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(counter.get('time')); }, error: function(counter, error) { console.log('Failed to save Visitor num, with error message: ' + error.message); } }); } else { var newcounter = new Counter(); /* Set ACL */ var acl = new AV.ACL(); acl.setPublicReadAccess(true); acl.setPublicWriteAccess(true); newcounter.setACL(acl); /* End Set ACL */ newcounter.set("title", title); newcounter.set("url", url); newcounter.set("time", 1); newcounter.save(null, { success: function(newcounter) { var $element = $(document.getElementById(url)); $element.find('.leancloud-visitors-count').text(newcounter.get('time')); }, error: function(newcounter, error) { console.log('Failed to create'); } }); } }, error: function(error) { console.log('Error:' + error.code + " " + error.message); } }); } $(function() { var Counter = AV.Object.extend("Counter"); if ($('.leancloud_visitors').length == 1) { addCount(Counter); } else if ($('.post-title-link').length > 1) { showTime(Counter); } }); </script> <script type="text/javascript" src="https://tajs.qq.com/stats?sId=62288553" charset="UTF-8"></script> </body> </html>
rockjins/rockjins.github.io
categories/Translation/page/2/index.html
HTML
apache-2.0
33,300
# Copyright (C) 2014-2016 MongoDB, 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. require 'mongo/server/description/features' require 'mongo/server/description/inspector' module Mongo class Server # Represents a description of the server, populated by the result of the # ismaster command. # # @since 2.0.0 class Description # Constant for reading arbiter info from config. # # @since 2.0.0 ARBITER = 'arbiterOnly'.freeze # Constant for reading arbiters info from config. # # @since 2.0.0 ARBITERS = 'arbiters'.freeze # Constant for reading hidden info from config. # # @since 2.0.0 HIDDEN = 'hidden'.freeze # Constant for reading hosts info from config. # # @since 2.0.0 HOSTS = 'hosts'.freeze # Constant for the key for the message value. # # @since 2.0.0 MESSAGE = 'msg'.freeze # Constant for the message that indicates a sharded cluster. # # @since 2.0.0 MONGOS_MESSAGE = 'isdbgrid'.freeze # Constant for determining ghost servers. # # @since 2.0.0 REPLICA_SET = 'isreplicaset'.freeze # Constant for reading max bson size info from config. # # @since 2.0.0 MAX_BSON_OBJECT_SIZE = 'maxBsonObjectSize'.freeze # Constant for reading max message size info from config. # # @since 2.0.0 MAX_MESSAGE_BYTES = 'maxMessageSizeBytes'.freeze # Constant for the max wire version. # # @since 2.0.0 MAX_WIRE_VERSION = 'maxWireVersion'.freeze # Constant for min wire version. # # @since 2.0.0 MIN_WIRE_VERSION = 'minWireVersion'.freeze # Constant for reading max write batch size. # # @since 2.0.0 MAX_WRITE_BATCH_SIZE = 'maxWriteBatchSize'.freeze # Constant for reading the me field. # # @since 2.1.0 ME = 'me'.freeze # Default max write batch size. # # @since 2.0.0 DEFAULT_MAX_WRITE_BATCH_SIZE = 1000.freeze # The legacy wire protocol version. # # @since 2.0.0 LEGACY_WIRE_VERSION = 0.freeze # Constant for reading passive info from config. # # @since 2.0.0 PASSIVE = 'passive'.freeze # Constant for reading the passive server list. # # @since 2.0.0 PASSIVES = 'passives'.freeze # Constant for reading primary info from config. # # @since 2.0.0 PRIMARY = 'ismaster'.freeze # Constant for reading secondary info from config. # # @since 2.0.0 SECONDARY = 'secondary'.freeze # Constant for reading replica set name info from config. # # @since 2.0.0 SET_NAME = 'setName'.freeze # Constant for reading tags info from config. # # @since 2.0.0 TAGS = 'tags'.freeze # Constant for reading electionId info from config. # # @since 2.1.0 ELECTION_ID = 'electionId'.freeze # Constant for reading setVersion info from config. # # @since 2.2.2 SET_VERSION = 'setVersion'.freeze # Constant for reading localTime info from config. # # @since 2.1.0 LOCAL_TIME = 'localTime'.freeze # Fields to exclude when comparing two descriptions. # # @since 2.0.6 EXCLUDE_FOR_COMPARISON = [ LOCAL_TIME ].freeze # @return [ Address ] address The server's address. attr_reader :address # @return [ Hash ] The actual result from the ismaster command. attr_reader :config # @return [ Features ] features The features for the server. attr_reader :features # @return [ Float ] The moving average time the ismaster call took to complete. attr_reader :average_round_trip_time # Will return true if the server is an arbiter. # # @example Is the server an arbiter? # description.arbiter? # # @return [ true, false ] If the server is an arbiter. # # @since 2.0.0 def arbiter? !!config[ARBITER] && !replica_set_name.nil? end # Get a list of all arbiters in the replica set. # # @example Get the arbiters in the replica set. # description.arbiters # # @return [ Array<String> ] The arbiters in the set. # # @since 2.0.0 def arbiters @arbiters ||= (config[ARBITERS] || []).map { |s| s.downcase } end # Is the server a ghost in a replica set? # # @example Is the server a ghost? # description.ghost? # # @return [ true, false ] If the server is a ghost. # # @since 2.0.0 def ghost? !!config[REPLICA_SET] end # Will return true if the server is hidden. # # @example Is the server hidden? # description.hidden? # # @return [ true, false ] If the server is hidden. # # @since 2.0.0 def hidden? !!config[HIDDEN] end # Get a list of all servers in the replica set. # # @example Get the servers in the replica set. # description.hosts # # @return [ Array<String> ] The servers in the set. # # @since 2.0.0 def hosts @hosts ||= (config[HOSTS] || []).map { |s| s.downcase } end # Instantiate the new server description from the result of the ismaster # command. # # @example Instantiate the new description. # Description.new(address, { 'ismaster' => true }, 0.5) # # @param [ Address ] address The server address. # @param [ Hash ] config The result of the ismaster command. # @param [ Float ] average_round_trip_time The moving average time (ms) the ismaster # call took to complete. # # @since 2.0.0 def initialize(address, config = {}, average_round_trip_time = 0) @address = address @config = config @features = Features.new(wire_versions) @average_round_trip_time = average_round_trip_time end # Inspect the server description. # # @example Inspect the server description # description.inspect # # @return [ String ] The inspection. # # @since 2.0.0 def inspect "#<Mongo::Server:Description:0x#{object_id} config=#{config} average_round_trip_time=#{average_round_trip_time}>" end # Get the max BSON object size for this server version. # # @example Get the max BSON object size. # description.max_bson_object_size # # @return [ Integer ] The maximum object size in bytes. # # @since 2.0.0 def max_bson_object_size config[MAX_BSON_OBJECT_SIZE] end # Get the max message size for this server version. # # @example Get the max message size. # description.max_message_size # # @return [ Integer ] The maximum message size in bytes. # # @since 2.0.0 def max_message_size config[MAX_MESSAGE_BYTES] end # Get the maximum batch size for writes. # # @example Get the max batch size. # description.max_write_batch_size # # @return [ Integer ] The max batch size. # # @since 2.0.0 def max_write_batch_size config[MAX_WRITE_BATCH_SIZE] || DEFAULT_MAX_WRITE_BATCH_SIZE end # Get the maximum wire version. # # @example Get the max wire version. # description.max_wire_version # # @return [ Integer ] The max wire version supported. # # @since 2.0.0 def max_wire_version config[MAX_WIRE_VERSION] || LEGACY_WIRE_VERSION end # Get the minimum wire version. # # @example Get the min wire version. # description.min_wire_version # # @return [ Integer ] The min wire version supported. # # @since 2.0.0 def min_wire_version config[MIN_WIRE_VERSION] || LEGACY_WIRE_VERSION end # Get the me field value. # # @example Get the me field value. # description.me # # @return [ String ] The me field. # # @since 2.1.0 def me config[ME] end # Get the tags configured for the server. # # @example Get the tags. # description.tags # # @return [ Hash ] The tags of the server. # # @since 2.0.0 def tags config[TAGS] || {} end # Get the electionId from the config. # # @example Get the electionId. # description.election_id # # @return [ BSON::ObjectId ] The election id. # # @since 2.1.0 def election_id config[ELECTION_ID] end # Get the setVersion from the config. # # @example Get the setVersion. # description.set_version # # @return [ Integer ] The set version. # # @since 2.2.2 def set_version config[SET_VERSION] end # Is the server a mongos? # # @example Is the server a mongos? # description.mongos? # # @return [ true, false ] If the server is a mongos. # # @since 2.0.0 def mongos? config[MESSAGE] == MONGOS_MESSAGE end # Is the description of type other. # # @example Is the description of type other. # description.other? # # @return [ true, false ] If the description is other. # # @since 2.0.0 def other? (!primary? && !secondary? && !passive? && !arbiter?) || (hidden? && !replica_set_name.nil?) end # Will return true if the server is passive. # # @example Is the server passive? # description.passive? # # @return [ true, false ] If the server is passive. # # @since 2.0.0 def passive? !!config[PASSIVE] end # Get a list of the passive servers in the cluster. # # @example Get the passives. # description.passives # # @return [ Array<String> ] The list of passives. # # @since 2.0.0 def passives @passives ||= (config[PASSIVES] || []).map { |s| s.downcase } end # Will return true if the server is a primary. # # @example Is the server a primary? # description.primary? # # @return [ true, false ] If the server is a primary. # # @since 2.0.0 def primary? !!config[PRIMARY] && !replica_set_name.nil? end # Get the name of the replica set the server belongs to, returns nil if # none. # # @example Get the replica set name. # description.replica_set_name # # @return [ String, nil ] The name of the replica set. # # @since 2.0.0 def replica_set_name config[SET_NAME] end # Get a list of all servers known to the cluster. # # @example Get all servers. # description.servers # # @return [ Array<String> ] The list of all servers. # # @since 2.0.0 def servers hosts + arbiters + passives end # Will return true if the server is a secondary. # # @example Is the server a secondary? # description.secondary? # # @return [ true, false ] If the server is a secondary. # # @since 2.0.0 def secondary? !!config[SECONDARY] && !replica_set_name.nil? end # Is this server a standalone server? # # @example Is the server standalone? # description.standalone? # # @return [ true, false ] If the server is standalone. # # @since 2.0.0 def standalone? replica_set_name.nil? && !mongos? && !ghost? && !unknown? end # Is the server description currently unknown? # # @example Is the server description unknown? # description.unknown? # # @return [ true, false ] If the server description is unknown. # # @since 2.0.0 def unknown? config.empty? || config[Operation::Result::OK] != 1 end # A result from another server's ismaster command before this server has # refreshed causes the need for this description to become unknown before # the next refresh. # # @example Force an unknown state. # description.unknown! # # @return [ true ] Always true. # # @since 2.0.0 def unknown! @config = {} and true end # Get the range of supported wire versions for the server. # # @example Get the wire version range. # description.wire_versions # # @return [ Range ] The wire version range. # # @since 2.0.0 def wire_versions min_wire_version..max_wire_version end # Is this description from the given server. # # @example Check if the description is from a given server. # description.is_server?(server) # # @return [ true, false ] If the description is from the server. # # @since 2.0.6 def is_server?(server) address == server.address end # Is a server included in this description's list of servers. # # @example Check if a server is in the description list of servers. # description.lists_server?(server) # # @return [ true, false ] If a server is in the description's list # of servers. # # @since 2.0.6 def lists_server?(server) servers.include?(server.address.to_s) end # Does this description correspond to a replica set member. # # @example Check if the description is from a replica set member. # description.replica_set_member? # # @return [ true, false ] If the description is from a replica set # member. # # @since 2.0.6 def replica_set_member? !(standalone? || mongos?) end # Check if there is a mismatch between the address host and the me field. # # @example Check if there is a mismatch. # description.me_mismatch? # # @return [ true, false ] If there is a mismatch between the me field and the address host. # # @since 2.0.6 def me_mismatch? !!(address.to_s != me if me) end # Check equality of two descriptions. # # @example Check description equality. # description == other # # @param [ Object ] other The other description. # # @return [ true, false ] Whether the objects are equal. # # @since 2.0.6 def ==(other) return false if self.class != other.class compare_config(other) end alias_method :eql?, :== private def compare_config(other) !config.keys.empty? && config.keys.all? do |k| config[k] == other.config[k] || EXCLUDE_FOR_COMPARISON.include?(k) end end end end end
brandonblack/mongo-ruby-driver
lib/mongo/server/description.rb
Ruby
apache-2.0
15,715
/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights * Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.lambda.model.transform; import java.util.Map; import java.util.Map.Entry; import java.math.*; import java.nio.ByteBuffer; import com.amazonaws.services.lambda.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * FunctionCodeLocation JSON Unmarshaller */ public class FunctionCodeLocationJsonUnmarshaller implements Unmarshaller<FunctionCodeLocation, JsonUnmarshallerContext> { public FunctionCodeLocation unmarshall(JsonUnmarshallerContext context) throws Exception { FunctionCodeLocation functionCodeLocation = new FunctionCodeLocation(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) return null; while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("RepositoryType", targetDepth)) { context.nextToken(); functionCodeLocation.setRepositoryType(context .getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("Location", targetDepth)) { context.nextToken(); functionCodeLocation.setLocation(context.getUnmarshaller( String.class).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals( currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return functionCodeLocation; } private static FunctionCodeLocationJsonUnmarshaller instance; public static FunctionCodeLocationJsonUnmarshaller getInstance() { if (instance == null) instance = new FunctionCodeLocationJsonUnmarshaller(); return instance; } }
nterry/aws-sdk-java
aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/transform/FunctionCodeLocationJsonUnmarshaller.java
Java
apache-2.0
3,166
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef __SLAVE_FLAGS_HPP__ #define __SLAVE_FLAGS_HPP__ #include <cstdint> #include <string> #include <stout/bytes.hpp> #include <stout/duration.hpp> #include <stout/json.hpp> #include <stout/option.hpp> #include <stout/path.hpp> #include <mesos/module/module.hpp> #include "logging/flags.hpp" #include "messages/flags.hpp" namespace mesos { namespace internal { namespace slave { class Flags : public virtual logging::Flags { public: Flags(); bool version; Option<std::string> hostname; bool hostname_lookup; Option<std::string> resources; Option<std::string> resource_provider_config_dir; std::string isolation; std::string launcher; Option<std::string> image_providers; Option<std::string> image_provisioner_backend; std::string appc_simple_discovery_uri_prefix; std::string appc_store_dir; std::string docker_registry; std::string docker_store_dir; std::string docker_volume_checkpoint_dir; std::string default_role; Option<std::string> attributes; Bytes fetcher_cache_size; std::string fetcher_cache_dir; std::string work_dir; std::string runtime_dir; std::string launcher_dir; std::string hadoop_home; // TODO(benh): Make an Option. size_t max_completed_executors_per_framework; #ifndef __WINDOWS__ bool switch_user; #endif // __WINDOWS__ Duration http_heartbeat_interval; std::string frameworks_home; // TODO(benh): Make an Option. Duration registration_backoff_factor; Duration authentication_backoff_factor; Option<JSON::Object> executor_environment_variables; Duration executor_registration_timeout; Duration executor_reregistration_timeout; Option<Duration> executor_reregistration_retry_interval; Duration executor_shutdown_grace_period; #ifdef USE_SSL_SOCKET Option<Path> executor_secret_key; #endif // USE_SSL_SOCKET Duration gc_delay; double gc_disk_headroom; Duration disk_watch_interval; Option<std::string> container_logger; std::string recover; Duration recovery_timeout; bool strict; Duration register_retry_interval_min; #ifdef __linux__ std::string cgroups_hierarchy; std::string cgroups_root; bool cgroups_enable_cfs; bool cgroups_limit_swap; bool cgroups_cpu_enable_pids_and_tids_count; Option<std::string> cgroups_net_cls_primary_handle; Option<std::string> cgroups_net_cls_secondary_handles; Option<DeviceWhitelist> allowed_devices; Option<std::string> agent_subsystems; Option<std::vector<unsigned int>> nvidia_gpu_devices; Option<std::string> perf_events; Duration perf_interval; Duration perf_duration; bool revocable_cpu_low_priority; bool systemd_enable_support; std::string systemd_runtime_directory; Option<CapabilityInfo> effective_capabilities; Option<CapabilityInfo> bounding_capabilities; bool disallow_sharing_agent_pid_namespace; #endif Option<Firewall> firewall_rules; Option<Path> credential; Option<ACLs> acls; std::string containerizers; std::string docker; Option<std::string> docker_mesos_image; Duration docker_remove_delay; std::string sandbox_directory; Option<ContainerDNSInfo> default_container_dns; Option<ContainerInfo> default_container_info; // TODO(alexr): Remove this after the deprecation cycle (started in 1.0). Duration docker_stop_timeout; bool docker_kill_orphans; std::string docker_socket; Option<JSON::Object> docker_config; #ifdef ENABLE_PORT_MAPPING_ISOLATOR uint16_t ephemeral_ports_per_container; Option<std::string> eth0_name; Option<std::string> lo_name; Option<Bytes> egress_rate_limit_per_container; bool egress_unique_flow_per_container; std::string egress_flow_classifier_parent; bool network_enable_socket_statistics_summary; bool network_enable_socket_statistics_details; bool network_enable_snmp_statistics; #endif Option<std::string> network_cni_plugins_dir; Option<std::string> network_cni_config_dir; Duration container_disk_watch_interval; bool enforce_container_disk_quota; Option<Modules> modules; Option<std::string> modulesDir; std::string authenticatee; std::string authorizer; Option<std::string> http_authenticators; bool authenticate_http_readonly; bool authenticate_http_readwrite; #ifdef USE_SSL_SOCKET bool authenticate_http_executors; #endif // USE_SSL_SOCKET Option<Path> http_credentials; Option<std::string> hooks; Option<std::string> secret_resolver; Option<std::string> resource_estimator; Option<std::string> qos_controller; Duration qos_correction_interval_min; Duration oversubscribed_resources_interval; Option<std::string> master_detector; #if ENABLE_XFS_DISK_ISOLATOR std::string xfs_project_range; #endif bool http_command_executor; Option<DomainInfo> domain; // The following flags are executable specific (e.g., since we only // have one instance of libprocess per execution, we only want to // advertise the IP and port option once, here). Option<std::string> ip; uint16_t port; Option<std::string> advertise_ip; Option<std::string> advertise_port; Option<std::string> master; Duration zk_session_timeout; // Optional IP discover script that will set the slave's IP. // If set, its output is expected to be a valid parseable IP string. Option<std::string> ip_discovery_command; // IPv6 flags. // // NOTE: These IPv6 flags are currently input mechanisms // for the operator to specify v6 addresses on which containers // running on host network can listen. Mesos itself doesn't listen // or communicate over v6 addresses at this point. Option<std::string> ip6; // Similar to the `ip_discovery_command` this optional discover // script is expected to output a valid IPv6 string. Only one of the // two options `ip6` or `ip6_discovery_command` can be set at any // given point of time. Option<std::string> ip6_discovery_command; }; } // namespace slave { } // namespace internal { } // namespace mesos { #endif // __SLAVE_FLAGS_HPP__
shakamunyi/mesos
src/slave/flags.hpp
C++
apache-2.0
6,732
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #pragma once #include <aws/waf-regional/WAFRegional_EXPORTS.h> #include <aws/waf-regional/model/RuleGroup.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace WAFRegional { namespace Model { class AWS_WAFREGIONAL_API CreateRuleGroupResult { public: CreateRuleGroupResult(); CreateRuleGroupResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); CreateRuleGroupResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>An empty <a>RuleGroup</a>.</p> */ inline const RuleGroup& GetRuleGroup() const{ return m_ruleGroup; } /** * <p>An empty <a>RuleGroup</a>.</p> */ inline void SetRuleGroup(const RuleGroup& value) { m_ruleGroup = value; } /** * <p>An empty <a>RuleGroup</a>.</p> */ inline void SetRuleGroup(RuleGroup&& value) { m_ruleGroup = std::move(value); } /** * <p>An empty <a>RuleGroup</a>.</p> */ inline CreateRuleGroupResult& WithRuleGroup(const RuleGroup& value) { SetRuleGroup(value); return *this;} /** * <p>An empty <a>RuleGroup</a>.</p> */ inline CreateRuleGroupResult& WithRuleGroup(RuleGroup&& value) { SetRuleGroup(std::move(value)); return *this;} /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline const Aws::String& GetChangeToken() const{ return m_changeToken; } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline void SetChangeToken(const Aws::String& value) { m_changeToken = value; } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline void SetChangeToken(Aws::String&& value) { m_changeToken = std::move(value); } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline void SetChangeToken(const char* value) { m_changeToken.assign(value); } /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline CreateRuleGroupResult& WithChangeToken(const Aws::String& value) { SetChangeToken(value); return *this;} /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline CreateRuleGroupResult& WithChangeToken(Aws::String&& value) { SetChangeToken(std::move(value)); return *this;} /** * <p>The <code>ChangeToken</code> that you used to submit the * <code>CreateRuleGroup</code> request. You can also use this value to query the * status of the request. For more information, see * <a>GetChangeTokenStatus</a>.</p> */ inline CreateRuleGroupResult& WithChangeToken(const char* value) { SetChangeToken(value); return *this;} private: RuleGroup m_ruleGroup; Aws::String m_changeToken; }; } // namespace Model } // namespace WAFRegional } // namespace Aws
cedral/aws-sdk-cpp
aws-cpp-sdk-waf-regional/include/aws/waf-regional/model/CreateRuleGroupResult.h
C
apache-2.0
4,712
/*************************************************************************** * * This is an internal header file used to implement the C++ Standard * Library. It should never be #included directly by a program. * * $Id$ * *************************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. * * Copyright 2008 Rogue Wave Software, Inc. * **************************************************************************/ #ifndef _RWSTD_RW_META_HELP_H_INCLUDED #define _RWSTD_RW_META_HELP_H_INCLUDED #include <rw/_defs.h> _RWSTD_NAMESPACE (__rw) { // // A compile-time integral constant wrapper. This class template // encapsulates an integer constant value for metaprogramming. // template <class _TypeT, _TypeT _Value> struct __rw_integral_constant { typedef __rw_integral_constant<_TypeT,_Value> type; typedef _TypeT value_type; static const _TypeT value = _Value; }; #ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION template<class _TypeT, _TypeT _Value> const _TypeT __rw_integral_constant<_TypeT, _Value>::value; #endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION // // Synonym for __rw_integral_constant<bool, true> type. // typedef __rw_integral_constant<bool, true> __rw_true_type; // // Synonym for __rw_integral_constant<bool, false> type. // typedef __rw_integral_constant<bool, false> __rw_false_type; // convenience macros #define _RWSTD_BOOL_CONST(B) _RW::__rw_integral_constant<bool, B> } // namespace __rw #endif // _RWSTD_RW_META_HELP_H_INCLUDED
pathscale/stdcxx
include/rw/_meta_help.h
C
apache-2.0
2,340
/******************************************************************************* * Copyright (c) 2013 IBM Corp. * * 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.acmeair.jmeter.functions; import java.util.Arrays; import java.util.List; import org.apache.jmeter.processor.PostProcessor; import org.apache.jmeter.samplers.SampleResult; import org.apache.jmeter.testelement.AbstractTestElement; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.threads.JMeterContextService; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; /** * FlightsPostProcessor will parse the JSON return string and set the variables that are * used by the ExtractFlightsInfoFunction. It will also set some custom variable used to * collect statistics about the run. * * Reference to collecting custom variables: * http://stackoverflow.com/questions/12809877/graph-a-custom-variable-in-jmeter * * To enable this PostProcessor you'll need to add the following in the jmx script * right after the flights query: * <com.acmeair.jmeter.functions.FlightsPostProcessor guiclass="com.acmeair.jmeter.functions.FlightsPostProcessorGui" testclass="com.acmeair.jmeter.functions.FlightsPostProcessor" testname="Flights PostProcessor" enabled="true"> * </com.acmeair.jmeter.functions.FlightsPostProcessor> * * To see the custom metrics in the jtl log need to add the following in the user.properties file: * sample_variables=FLIGHTTOCOUNT,FLIGHTRETCOUNT,ONEWAY * * @see ExtractFlightsInfoFunction * */ public class FlightsPostProcessor extends AbstractTestElement implements PostProcessor, TestElement { private static final long serialVersionUID = 1L; private static final List<String> DESC = Arrays.asList("extract_info"); private static final String FLIGHT_TO_COUNT = "FLIGHTTOCOUNT"; private static final String FLIGHT_RET_COUNT = "FLIGHTRETCOUNT"; private static final String ONE_WAY = "ONEWAY"; FlightsContext context; @Override public void process() { SampleResult prev = JMeterContextService.getContext().getPreviousResult(); if(prev.getErrorCount()>0){ System.out.println("FlightsPostProcessor - Last sample received an error. Response Code = " + prev.getResponseCode() +"."); return; } context = FlightsThreadLocal.get(); if (context == null) { context = new FlightsContext(); } processJSonString(prev.getResponseDataAsString()); } public String processJSonString(String responseDataAsString) { try { JSONObject json = (JSONObject) new JSONParser().parse(responseDataAsString); JSONArray tripFlights = (JSONArray) json.get("tripFlights"); if (tripFlights == null || tripFlights.size() == 0) { context.setIsFlightAvailable("false"); FlightsThreadLocal.set(context); return null; } for (int counter = 1; counter <= tripFlights.size(); counter++) { if (counter == 1) { JSONObject jsonTripFlight = (JSONObject) tripFlights.get(0); JSONArray jsonFlightOptions = (JSONArray) jsonTripFlight.get("flightsOptions"); String numFlightsAsString = jsonFlightOptions.size() + ""; context.setNumOfToFlights(numFlightsAsString); JMeterContextService.getContext().getVariables().put(FLIGHT_TO_COUNT, numFlightsAsString); if (jsonFlightOptions.size() > 0) { context.setIsFlightAvailable("true"); } else { context.setIsFlightAvailable("false"); } } else if (counter == 2) { JSONObject jsonTripFlight = (JSONObject) tripFlights.get(1); JSONArray jsonFlightOptions = (JSONArray) jsonTripFlight.get("flightsOptions"); String numFlightAsString = jsonFlightOptions.size() + ""; context.setNumOfRetFlights(numFlightAsString); JMeterContextService.getContext().getVariables().put(FLIGHT_RET_COUNT, numFlightAsString); if (jsonFlightOptions.size() > 0) { context.setONEWAY("false"); JMeterContextService.getContext().getVariables().put(ONE_WAY, "false"); } else { context.setONEWAY("true"); JMeterContextService.getContext().getVariables().put(ONE_WAY, "true"); } } JSONObject jsonTripFlight = (JSONObject) tripFlights.get(counter - 1); JSONArray jsonFlightOptions = (JSONArray) jsonTripFlight.get("flightsOptions"); for (int tripCounter = 1; tripCounter <= jsonFlightOptions.size(); tripCounter++) { if (counter == 1) { JSONObject flightOption0 = (JSONObject) jsonFlightOptions.get(tripCounter - 1); if (ExtractFlightsInfoFunction.pureIDs) { String id = (String)flightOption0.get("_id"); String fsId = (String)flightOption0.get("flightSegmentId"); context.setTOFLIGHT(id); context.setTOSEGMENTID(fsId); } else { String id = (String)flightOption0.get("id"); context.setTOFLIGHT(id); } } else if (counter == 2) { JSONObject flightOption0 = (JSONObject) jsonFlightOptions.get(tripCounter - 1); if (ExtractFlightsInfoFunction.pureIDs) { String id = (String)flightOption0.get("_id"); String fsId = (String)flightOption0.get("flightSegmentId"); context.setRETFLIGHT(id); context.setRESEGMENTID(fsId); } else { String id = (String)flightOption0.get("id"); context.setRETFLIGHT(id); } } } } FlightsThreadLocal.set(context); return json.toJSONString(); } catch (ParseException e) { System.out.println("responseDataAsString = " + responseDataAsString); e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); System.out.println("NullPointerException in FlightsPostProcessor - ResponseData =" + responseDataAsString); } catch (Exception e) { e.printStackTrace(); } return null; } public List<String> getArgumentDesc() { return DESC; } }
jbajwa/acmeair-driver
acmeair-jmeter/src/main/java/com/acmeair/jmeter/functions/FlightsPostProcessor.java
Java
apache-2.0
6,691
from cloudify.workflows import ctx, parameters ctx.logger.info(parameters.node_id) instance = [n for n in ctx.node_instances if n.node_id == parameters.node_id][0] for relationship in instance.relationships: relationship.execute_source_operation('custom_lifecycle.custom_operation')
cloudify-cosmo/cloudify-manager
tests/integration_tests/resources/dsl/deployment_update/modify_relationship_operation/modification/custom_workflow.py
Python
apache-2.0
304
using System; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Net; namespace NuGet { public interface IHttpClient : IHttpClientEvents { string UserAgent { get; set; } Uri Uri { get; } Uri OriginalUri { get; } bool AcceptCompression { get; set; } [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "This is expensive")] WebResponse GetResponse(); void InitializeRequest(WebRequest request); void DownloadData(Stream targetStream); } }
aaasoft/NuGet.Server
src/Core/Http/IHttpClient.cs
C#
apache-2.0
716
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddFieldsPacienteTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('paciente', function(Blueprint $table) { $table->string('sexo', 1)->nullable(); $table->date('data_nascimento')->nullable(); $table->bigInteger('cpf')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('paciente', function(Blueprint $table) { $table->dropColumn('sexo'); $table->dropColumn('data_nascimento'); $table->dropColumn('cpf'); }); } }
andersonfraga/pucrs_prescricoes
database/migrations/2015_05_12_163527_add_fields_paciente_table.php
PHP
apache-2.0
683
package lia.advsearching; /** * Copyright Manning Publications Co. * * 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 lan */ import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; import org.apache.lucene.index.TermFreqVector; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; import lia.common.TestUtil; import java.io.IOException; import java.io.File; // From chapter 5 public class BooksLikeThis { public static void main(String[] args) throws IOException { Directory dir = TestUtil.getBookIndexDirectory(); IndexReader reader = IndexReader.open(dir); int numDocs = reader.maxDoc(); BooksLikeThis blt = new BooksLikeThis(reader); for (int i = 0; i < numDocs; i++) { // #1 System.out.println(); Document doc = reader.document(i); System.out.println(doc.get("title")); Document[] docs = blt.docsLike(i, 10); // #2 if (docs.length == 0) { System.out.println(" None like this"); } for (Document likeThisDoc : docs) { System.out.println(" -> " + likeThisDoc.get("title")); } } reader.close(); dir.close(); } private IndexReader reader; private IndexSearcher searcher; public BooksLikeThis(IndexReader reader) { this.reader = reader; searcher = new IndexSearcher(reader); } public Document[] docsLike(int id, int max) throws IOException { Document doc = reader.document(id); String[] authors = doc.getValues("author"); BooleanQuery authorQuery = new BooleanQuery(); // #3 for (String author : authors) { // #3 authorQuery.add(new TermQuery(new Term("author", author)), // #3 BooleanClause.Occur.SHOULD); // #3 } authorQuery.setBoost(2.0f); TermFreqVector vector = // #4 reader.getTermFreqVector(id, "subject"); // #4 BooleanQuery subjectQuery = new BooleanQuery(); // #4 for (String vecTerm : vector.getTerms()) { // #4 TermQuery tq = new TermQuery( // #4 new Term("subject", vecTerm)); // #4 subjectQuery.add(tq, BooleanClause.Occur.SHOULD); // #4 } BooleanQuery likeThisQuery = new BooleanQuery(); // #5 likeThisQuery.add(authorQuery, BooleanClause.Occur.SHOULD); // #5 likeThisQuery.add(subjectQuery, BooleanClause.Occur.SHOULD); // #5 likeThisQuery.add(new TermQuery( // #6 new Term("isbn", doc.get("isbn"))), BooleanClause.Occur.MUST_NOT); // #6 // System.out.println(" Query: " + // likeThisQuery.toString("contents")); TopDocs hits = searcher.search(likeThisQuery, 10); int size = max; if (max > hits.scoreDocs.length) size = hits.scoreDocs.length; Document[] docs = new Document[size]; for (int i = 0; i < size; i++) { docs[i] = reader.document(hits.scoreDocs[i].doc); } return docs; } } /* #1 Iterate over every book #2 Look up books like this #3 Boosts books by same author #4 Use terms from "subject" term vectors #5 Create final query #6 Exclude current book */
sluk3r/lia2e_study
src/lia/advsearching/BooksLikeThis.java
Java
apache-2.0
4,047
=begin Copyright 2010-2012 Tasos Laskos <tasos.laskos@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =end require Arachni::Options.instance.dir['lib'] + 'rpc/client/dispatcher' require Arachni::Options.instance.dir['lib'] + 'ui/web/utilities' module Arachni module UI module Web # # Schedules and executes scan jobs. # # # @author Tasos "Zapotek" Laskos # <tasos.laskos@gmail.com> # # @version 0.1.2 # class Scheduler include Utilities class Job include DataMapper::Resource property :id, Serial property :dispatcher, String property :url, String property :opts, Text property :datetime, DateTime property :owner_addr, String property :owner_host, String property :created_at, DateTime end # # Initializes the Scheduler and starts the clock. # # def initialize( opts, settings ) @opts = opts @settings = settings DataMapper::setup( :default, "sqlite3://#{@settings.db}/default.db" ) DataMapper.finalize Job.auto_upgrade! ticktock! end # # Runs a job. # # @param [Job] job # @param [Hash] env Sinatra environment # @param [Hash] session Rack session # # @return [String] URL of the laucnhed scanner instance # def run( job, env = nil, session = nil, &block ) raise( "This method requires a block!" ) if !block_given? @settings.dispatchers.connect( job.dispatcher ).dispatch( job.url ){ |instance| if instance.rpc_exception? @settings.log.scheduler_instance_dispatch_failed( env ) next end env = { 'REMOTE_ADDR' => job.owner_addr, 'REMOTE_HOST' => job.owner_host } if env.nil? @settings.log.scheduler_instance_dispatched( env, instance['url'] ) @settings.log.scheduler_instance_owner_assigned( env, job.url ) arachni = @settings.instances.connect( instance['url'], session, instance['token'] ) opts = YAML::load( job.opts ) arachni.opts.set( opts['settings'] ){ arachni.plugins.load( opts['plugins'] ) { arachni.modules.load( opts['modules'] ) { arachni.framework.run{ @settings.log.scheduler_scan_started( env, job.url ) block.call( instance['url'] ) } } } } } end # # Runs a job and removed it from the DB. # # @param [Job] job # def run_and_destroy( job, &block ) run( job ){ |url| job.destroy block.call( url ) if block_given? } end # # Returns all scheduled jobs. # # @return [Array] # def jobs( *args ) Job.all( *args ) end # # Removes all jobs. # def delete_all jobs.destroy end # # Removed a job. # # @param [Integer] id # def delete( id ) Job.get( id ).destroy end private def ticktock! ::EM.add_periodic_timer( 1 ){ jobs.each { |job| run_and_destroy( job ) if job.datetime <= DateTime.now } } end end end end end
winny19/entersoft-scanner
lib/arachni/ui/web/scheduler.rb
Ruby
apache-2.0
4,089
# Copyright 2014 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import unittest2 class TestQuery(unittest2.TestCase): def _getTargetClass(self): from gcloud.datastore.query import Query return Query def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) def test_ctor_defaults_wo_implicit_dataset_id(self): self.assertRaises(ValueError, self._makeOne) def test_ctor_defaults_w_implicit_dataset_id(self): from gcloud._testing import _Monkey from gcloud.datastore import _implicit_environ _DATASET = 'DATASET' with _Monkey(_implicit_environ, DATASET_ID=_DATASET): query = self._makeOne() self.assertEqual(query.dataset_id, _DATASET) self.assertEqual(query.kind, None) self.assertEqual(query.namespace, None) self.assertEqual(query.ancestor, None) self.assertEqual(query.filters, []) self.assertEqual(query.projection, []) self.assertEqual(query.order, []) self.assertEqual(query.group_by, []) def test_ctor_explicit(self): from gcloud.datastore.key import Key _DATASET = 'DATASET' _KIND = 'KIND' _NAMESPACE = 'NAMESPACE' ancestor = Key('ANCESTOR', 123, dataset_id=_DATASET) FILTERS = [('foo', '=', 'Qux'), ('bar', '<', 17)] PROJECTION = ['foo', 'bar', 'baz'] ORDER = ['foo', 'bar'] GROUP_BY = ['foo'] query = self._makeOne( dataset_id=_DATASET, kind=_KIND, namespace=_NAMESPACE, ancestor=ancestor, filters=FILTERS, projection=PROJECTION, order=ORDER, group_by=GROUP_BY, ) self.assertEqual(query.dataset_id, _DATASET) self.assertEqual(query.kind, _KIND) self.assertEqual(query.namespace, _NAMESPACE) self.assertEqual(query.ancestor.path, ancestor.path) self.assertEqual(query.filters, FILTERS) self.assertEqual(query.projection, PROJECTION) self.assertEqual(query.order, ORDER) self.assertEqual(query.group_by, GROUP_BY) def test_namespace_setter_w_non_string(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) def _assign(val): query.namespace = val self.assertRaises(ValueError, _assign, object()) def test_namespace_setter(self): _DATASET = 'DATASET' _NAMESPACE = 'NAMESPACE' query = self._makeOne(_DATASET) query.namespace = _NAMESPACE self.assertEqual(query.dataset_id, _DATASET) self.assertEqual(query.namespace, _NAMESPACE) def test_kind_setter_w_non_string(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) def _assign(val): query.kind = val self.assertRaises(TypeError, _assign, object()) def test_kind_setter_wo_existing(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET) query.kind = _KIND self.assertEqual(query.dataset_id, _DATASET) self.assertEqual(query.kind, _KIND) def test_kind_setter_w_existing(self): _DATASET = 'DATASET' _KIND_BEFORE = 'KIND_BEFORE' _KIND_AFTER = 'KIND_AFTER' query = self._makeOne(_DATASET, _KIND_BEFORE) self.assertEqual(query.kind, _KIND_BEFORE) query.kind = _KIND_AFTER self.assertEqual(query.dataset_id, _DATASET) self.assertEqual(query.kind, _KIND_AFTER) def test_ancestor_setter_w_non_key(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) def _assign(val): query.ancestor = val self.assertRaises(TypeError, _assign, object()) self.assertRaises(TypeError, _assign, ['KIND', 'NAME']) def test_ancestor_setter_w_key(self): from gcloud.datastore.key import Key _DATASET = 'DATASET' _NAME = u'NAME' key = Key('KIND', 123, dataset_id='DATASET') query = self._makeOne(_DATASET) query.add_filter('name', '=', _NAME) query.ancestor = key self.assertEqual(query.ancestor.path, key.path) def test_ancestor_deleter_w_key(self): from gcloud.datastore.key import Key _DATASET = 'DATASET' key = Key('KIND', 123, dataset_id='DATASET') query = self._makeOne(_DATASET, ancestor=key) del query.ancestor self.assertTrue(query.ancestor is None) def test_add_filter_setter_w_unknown_operator(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) self.assertRaises(ValueError, query.add_filter, 'firstname', '~~', 'John') def test_add_filter_w_known_operator(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) query.add_filter('firstname', '=', u'John') self.assertEqual(query.filters, [('firstname', '=', u'John')]) def test_add_filter_w_all_operators(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) query.add_filter('leq_prop', '<=', u'val1') query.add_filter('geq_prop', '>=', u'val2') query.add_filter('lt_prop', '<', u'val3') query.add_filter('gt_prop', '>', u'val4') query.add_filter('eq_prop', '=', u'val5') self.assertEqual(len(query.filters), 5) self.assertEqual(query.filters[0], ('leq_prop', '<=', u'val1')) self.assertEqual(query.filters[1], ('geq_prop', '>=', u'val2')) self.assertEqual(query.filters[2], ('lt_prop', '<', u'val3')) self.assertEqual(query.filters[3], ('gt_prop', '>', u'val4')) self.assertEqual(query.filters[4], ('eq_prop', '=', u'val5')) def test_add_filter_w_known_operator_and_entity(self): from gcloud.datastore.entity import Entity _DATASET = 'DATASET' query = self._makeOne(_DATASET) other = Entity() other['firstname'] = u'John' other['lastname'] = u'Smith' query.add_filter('other', '=', other) self.assertEqual(query.filters, [('other', '=', other)]) def test_add_filter_w_whitespace_property_name(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) PROPERTY_NAME = ' property with lots of space ' query.add_filter(PROPERTY_NAME, '=', u'John') self.assertEqual(query.filters, [(PROPERTY_NAME, '=', u'John')]) def test_add_filter___key__valid_key(self): from gcloud.datastore.key import Key _DATASET = 'DATASET' query = self._makeOne(_DATASET) key = Key('Foo', dataset_id='DATASET') query.add_filter('__key__', '=', key) self.assertEqual(query.filters, [('__key__', '=', key)]) def test_filter___key__invalid_operator(self): from gcloud.datastore.key import Key _DATASET = 'DATASET' key = Key('Foo', dataset_id='DATASET') query = self._makeOne(_DATASET) self.assertRaises(ValueError, query.add_filter, '__key__', '<', key) def test_filter___key__invalid_value(self): _DATASET = 'DATASET' query = self._makeOne(_DATASET) self.assertRaises(ValueError, query.add_filter, '__key__', '=', None) def test_projection_setter_empty(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.projection = [] self.assertEqual(query.projection, []) def test_projection_setter_string(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.projection = 'field1' self.assertEqual(query.projection, ['field1']) def test_projection_setter_non_empty(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.projection = ['field1', 'field2'] self.assertEqual(query.projection, ['field1', 'field2']) def test_projection_setter_multiple_calls(self): _DATASET = 'DATASET' _KIND = 'KIND' _PROJECTION1 = ['field1', 'field2'] _PROJECTION2 = ['field3'] query = self._makeOne(_DATASET, _KIND) query.projection = _PROJECTION1 self.assertEqual(query.projection, _PROJECTION1) query.projection = _PROJECTION2 self.assertEqual(query.projection, _PROJECTION2) def test_keys_only(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.keys_only() self.assertEqual(query.projection, ['__key__']) def test_order_setter_empty(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND, order=['foo', '-bar']) query.order = [] self.assertEqual(query.order, []) def test_order_setter_string(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.order = 'field' self.assertEqual(query.order, ['field']) def test_order_setter_single_item_list_desc(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.order = ['-field'] self.assertEqual(query.order, ['-field']) def test_order_setter_multiple(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.order = ['foo', '-bar'] self.assertEqual(query.order, ['foo', '-bar']) def test_group_by_setter_empty(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND, group_by=['foo', 'bar']) query.group_by = [] self.assertEqual(query.group_by, []) def test_group_by_setter_string(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.group_by = 'field1' self.assertEqual(query.group_by, ['field1']) def test_group_by_setter_non_empty(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) query.group_by = ['field1', 'field2'] self.assertEqual(query.group_by, ['field1', 'field2']) def test_group_by_multiple_calls(self): _DATASET = 'DATASET' _KIND = 'KIND' _GROUP_BY1 = ['field1', 'field2'] _GROUP_BY2 = ['field3'] query = self._makeOne(_DATASET, _KIND) query.group_by = _GROUP_BY1 self.assertEqual(query.group_by, _GROUP_BY1) query.group_by = _GROUP_BY2 self.assertEqual(query.group_by, _GROUP_BY2) def test_fetch_defaults_wo_implicit_connection(self): _DATASET = 'DATASET' _KIND = 'KIND' query = self._makeOne(_DATASET, _KIND) self.assertRaises(ValueError, query.fetch) def test_fetch_defaults_w_implicit_connection(self): from gcloud._testing import _Monkey from gcloud.datastore import _implicit_environ _DATASET = 'DATASET' _KIND = 'KIND' connection = _Connection() query = self._makeOne(_DATASET, _KIND) with _Monkey(_implicit_environ, CONNECTION=connection): iterator = query.fetch() self.assertTrue(iterator._query is query) self.assertEqual(iterator._limit, None) self.assertEqual(iterator._offset, 0) def test_fetch_explicit(self): _DATASET = 'DATASET' _KIND = 'KIND' connection = _Connection() query = self._makeOne(_DATASET, _KIND) iterator = query.fetch(limit=7, offset=8, connection=connection) self.assertTrue(iterator._query is query) self.assertEqual(iterator._limit, 7) self.assertEqual(iterator._offset, 8) class TestIterator(unittest2.TestCase): _DATASET = 'DATASET' _NAMESPACE = 'NAMESPACE' _KIND = 'KIND' _ID = 123 _START = b'\x00' _END = b'\xFF' def _getTargetClass(self): from gcloud.datastore.query import Iterator return Iterator def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) def _addQueryResults(self, connection, cursor=_END, more=False): from gcloud.datastore import _datastore_v1_pb2 as datastore_pb MORE = datastore_pb.QueryResultBatch.NOT_FINISHED NO_MORE = datastore_pb.QueryResultBatch.MORE_RESULTS_AFTER_LIMIT _ID = 123 entity_pb = datastore_pb.Entity() entity_pb.key.partition_id.dataset_id = self._DATASET path_element = entity_pb.key.path_element.add() path_element.kind = self._KIND path_element.id = _ID prop = entity_pb.property.add() prop.name = 'foo' prop.value.string_value = u'Foo' connection._results.append( ([entity_pb], cursor, MORE if more else NO_MORE)) def test_ctor_defaults(self): connection = _Connection() query = object() iterator = self._makeOne(query, connection) self.assertTrue(iterator._query is query) self.assertEqual(iterator._limit, None) self.assertEqual(iterator._offset, 0) def test_ctor_explicit(self): connection = _Connection() query = _Query() iterator = self._makeOne(query, connection, 13, 29) self.assertTrue(iterator._query is query) self.assertEqual(iterator._limit, 13) self.assertEqual(iterator._offset, 29) def test_next_page_no_cursors_no_more(self): from base64 import b64encode from gcloud.datastore.query import _pb_from_query connection = _Connection() query = _Query(self._DATASET, self._KIND, self._NAMESPACE) self._addQueryResults(connection) iterator = self._makeOne(query, connection) entities, more_results, cursor = iterator.next_page() self.assertEqual(cursor, b64encode(self._END)) self.assertFalse(more_results) self.assertFalse(iterator._more_results) self.assertEqual(len(entities), 1) self.assertEqual(entities[0].key.path, [{'kind': self._KIND, 'id': self._ID}]) self.assertEqual(entities[0]['foo'], u'Foo') qpb = _pb_from_query(query) qpb.offset = 0 EXPECTED = { 'dataset_id': self._DATASET, 'query_pb': qpb, 'namespace': self._NAMESPACE, 'transaction_id': None, } self.assertEqual(connection._called_with, [EXPECTED]) def test_next_page_no_cursors_no_more_w_offset_and_limit(self): from base64 import b64encode from gcloud.datastore.query import _pb_from_query connection = _Connection() query = _Query(self._DATASET, self._KIND, self._NAMESPACE) self._addQueryResults(connection) iterator = self._makeOne(query, connection, 13, 29) entities, more_results, cursor = iterator.next_page() self.assertEqual(cursor, b64encode(self._END)) self.assertFalse(more_results) self.assertFalse(iterator._more_results) self.assertEqual(len(entities), 1) self.assertEqual(entities[0].key.path, [{'kind': self._KIND, 'id': self._ID}]) self.assertEqual(entities[0]['foo'], u'Foo') qpb = _pb_from_query(query) qpb.limit = 13 qpb.offset = 29 EXPECTED = { 'dataset_id': self._DATASET, 'query_pb': qpb, 'namespace': self._NAMESPACE, 'transaction_id': None, } self.assertEqual(connection._called_with, [EXPECTED]) def test_next_page_w_cursors_w_more(self): from base64 import b64decode from base64 import b64encode from gcloud.datastore.query import _pb_from_query connection = _Connection() query = _Query(self._DATASET, self._KIND, self._NAMESPACE) self._addQueryResults(connection, cursor=self._END, more=True) iterator = self._makeOne(query, connection) iterator._start_cursor = self._START iterator._end_cursor = self._END entities, more_results, cursor = iterator.next_page() self.assertEqual(cursor, b64encode(self._END)) self.assertTrue(more_results) self.assertTrue(iterator._more_results) self.assertEqual(iterator._end_cursor, None) self.assertEqual(b64decode(iterator._start_cursor), self._END) self.assertEqual(len(entities), 1) self.assertEqual(entities[0].key.path, [{'kind': self._KIND, 'id': self._ID}]) self.assertEqual(entities[0]['foo'], u'Foo') qpb = _pb_from_query(query) qpb.offset = 0 qpb.start_cursor = b64decode(self._START) qpb.end_cursor = b64decode(self._END) EXPECTED = { 'dataset_id': self._DATASET, 'query_pb': qpb, 'namespace': self._NAMESPACE, 'transaction_id': None, } self.assertEqual(connection._called_with, [EXPECTED]) def test_next_page_w_cursors_w_bogus_more(self): connection = _Connection() query = _Query(self._DATASET, self._KIND, self._NAMESPACE) self._addQueryResults(connection, cursor=self._END, more=True) epb, cursor, _ = connection._results.pop() connection._results.append((epb, cursor, 4)) # invalid enum iterator = self._makeOne(query, connection) self.assertRaises(ValueError, iterator.next_page) def test___iter___no_more(self): from gcloud.datastore.query import _pb_from_query connection = _Connection() query = _Query(self._DATASET, self._KIND, self._NAMESPACE) self._addQueryResults(connection) iterator = self._makeOne(query, connection) entities = list(iterator) self.assertFalse(iterator._more_results) self.assertEqual(len(entities), 1) self.assertEqual(entities[0].key.path, [{'kind': self._KIND, 'id': self._ID}]) self.assertEqual(entities[0]['foo'], u'Foo') qpb = _pb_from_query(query) qpb.offset = 0 EXPECTED = { 'dataset_id': self._DATASET, 'query_pb': qpb, 'namespace': self._NAMESPACE, 'transaction_id': None, } self.assertEqual(connection._called_with, [EXPECTED]) def test___iter___w_more(self): from gcloud.datastore.query import _pb_from_query connection = _Connection() query = _Query(self._DATASET, self._KIND, self._NAMESPACE) self._addQueryResults(connection, cursor=self._END, more=True) self._addQueryResults(connection) iterator = self._makeOne(query, connection) entities = list(iterator) self.assertFalse(iterator._more_results) self.assertEqual(len(entities), 2) for entity in entities: self.assertEqual( entity.key.path, [{'kind': self._KIND, 'id': self._ID}]) self.assertEqual(entities[1]['foo'], u'Foo') qpb1 = _pb_from_query(query) qpb1.offset = 0 qpb2 = _pb_from_query(query) qpb2.offset = 0 qpb2.start_cursor = self._END EXPECTED1 = { 'dataset_id': self._DATASET, 'query_pb': qpb1, 'namespace': self._NAMESPACE, 'transaction_id': None, } EXPECTED2 = { 'dataset_id': self._DATASET, 'query_pb': qpb2, 'namespace': self._NAMESPACE, 'transaction_id': None, } self.assertEqual(len(connection._called_with), 2) self.assertEqual(connection._called_with[0], EXPECTED1) self.assertEqual(connection._called_with[1], EXPECTED2) class Test__pb_from_query(unittest2.TestCase): def _callFUT(self, query): from gcloud.datastore.query import _pb_from_query return _pb_from_query(query) def test_empty(self): from gcloud.datastore import _datastore_v1_pb2 as datastore_pb pb = self._callFUT(_Query()) self.assertEqual(list(pb.projection), []) self.assertEqual(list(pb.kind), []) self.assertEqual(list(pb.order), []) self.assertEqual(list(pb.group_by), []) self.assertEqual(pb.filter.property_filter.property.name, '') cfilter = pb.filter.composite_filter self.assertEqual(cfilter.operator, datastore_pb.CompositeFilter.AND) self.assertEqual(list(cfilter.filter), []) self.assertEqual(pb.start_cursor, b'') self.assertEqual(pb.end_cursor, b'') self.assertEqual(pb.limit, 0) self.assertEqual(pb.offset, 0) def test_projection(self): pb = self._callFUT(_Query(projection=['a', 'b', 'c'])) self.assertEqual([item.property.name for item in pb.projection], ['a', 'b', 'c']) def test_kind(self): pb = self._callFUT(_Query(kind='KIND')) self.assertEqual([item.name for item in pb.kind], ['KIND']) def test_ancestor(self): from gcloud.datastore import _datastore_v1_pb2 as datastore_pb from gcloud.datastore.key import Key from gcloud.datastore.helpers import _prepare_key_for_request ancestor = Key('Ancestor', 123, dataset_id='DATASET') pb = self._callFUT(_Query(ancestor=ancestor)) cfilter = pb.filter.composite_filter self.assertEqual(cfilter.operator, datastore_pb.CompositeFilter.AND) self.assertEqual(len(cfilter.filter), 1) pfilter = cfilter.filter[0].property_filter self.assertEqual(pfilter.property.name, '__key__') ancestor_pb = _prepare_key_for_request(ancestor.to_protobuf()) self.assertEqual(pfilter.value.key_value, ancestor_pb) def test_filter(self): from gcloud.datastore import _datastore_v1_pb2 as datastore_pb query = _Query(filters=[('name', '=', u'John')]) query.OPERATORS = { '=': datastore_pb.PropertyFilter.EQUAL, } pb = self._callFUT(query) cfilter = pb.filter.composite_filter self.assertEqual(cfilter.operator, datastore_pb.CompositeFilter.AND) self.assertEqual(len(cfilter.filter), 1) pfilter = cfilter.filter[0].property_filter self.assertEqual(pfilter.property.name, 'name') self.assertEqual(pfilter.value.string_value, u'John') def test_filter_key(self): from gcloud.datastore import _datastore_v1_pb2 as datastore_pb from gcloud.datastore.key import Key from gcloud.datastore.helpers import _prepare_key_for_request key = Key('Kind', 123, dataset_id='DATASET') query = _Query(filters=[('__key__', '=', key)]) query.OPERATORS = { '=': datastore_pb.PropertyFilter.EQUAL, } pb = self._callFUT(query) cfilter = pb.filter.composite_filter self.assertEqual(cfilter.operator, datastore_pb.CompositeFilter.AND) self.assertEqual(len(cfilter.filter), 1) pfilter = cfilter.filter[0].property_filter self.assertEqual(pfilter.property.name, '__key__') key_pb = _prepare_key_for_request(key.to_protobuf()) self.assertEqual(pfilter.value.key_value, key_pb) def test_order(self): from gcloud.datastore import _datastore_v1_pb2 as datastore_pb pb = self._callFUT(_Query(order=['a', '-b', 'c'])) self.assertEqual([item.property.name for item in pb.order], ['a', 'b', 'c']) self.assertEqual([item.direction for item in pb.order], [datastore_pb.PropertyOrder.ASCENDING, datastore_pb.PropertyOrder.DESCENDING, datastore_pb.PropertyOrder.ASCENDING]) def test_group_by(self): pb = self._callFUT(_Query(group_by=['a', 'b', 'c'])) self.assertEqual([item.name for item in pb.group_by], ['a', 'b', 'c']) class _Query(object): def __init__(self, dataset_id=None, kind=None, namespace=None, ancestor=None, filters=(), projection=(), order=(), group_by=()): self.dataset_id = dataset_id self.kind = kind self.namespace = namespace self.ancestor = ancestor self.filters = filters self.projection = projection self.order = order self.group_by = group_by class _Connection(object): _called_with = None _cursor = b'\x00' _skipped = 0 def __init__(self): self._results = [] self._called_with = [] def run_query(self, **kw): self._called_with.append(kw) result, self._results = self._results[0], self._results[1:] return result
lucemia/gcloud-python
gcloud/datastore/test_query.py
Python
apache-2.0
25,434
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.reef.runtime.common.evaluator.context; import com.google.protobuf.ByteString; import org.apache.reef.annotations.Provided; import org.apache.reef.annotations.audience.EvaluatorSide; import org.apache.reef.annotations.audience.Private; import org.apache.reef.proto.EvaluatorRuntimeProtocol; import org.apache.reef.proto.ReefServiceProtos; import org.apache.reef.runtime.common.evaluator.HeartBeatManager; import org.apache.reef.runtime.common.evaluator.task.TaskClientCodeException; import org.apache.reef.runtime.common.utils.ExceptionCodec; import org.apache.reef.tang.Configuration; import org.apache.reef.tang.InjectionFuture; import org.apache.reef.tang.exceptions.BindException; import org.apache.reef.tang.formats.ConfigurationSerializer; import org.apache.reef.util.Optional; import javax.inject.Inject; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Stack; import java.util.logging.Level; import java.util.logging.Logger; /** * Manages the stack of context in the Evaluator. */ @Private @EvaluatorSide @Provided public final class ContextManager implements AutoCloseable { private static final Logger LOG = Logger.getLogger(ContextManager.class.getName()); /** * The stack of context. */ private final Stack<ContextRuntime> contextStack = new Stack<>(); /** * Used to instantiate the root context. */ private final InjectionFuture<RootContextLauncher> launchContext; /** * Used for status reporting to the Driver. */ private final HeartBeatManager heartBeatManager; /** * To serialize Configurations. */ private final ConfigurationSerializer configurationSerializer; private final ExceptionCodec exceptionCodec; /** * @param launchContext to instantiate the root context. * @param heartBeatManager for status reporting to the Driver. * @param configurationSerializer * @param exceptionCodec */ @Inject ContextManager(final InjectionFuture<RootContextLauncher> launchContext, final HeartBeatManager heartBeatManager, final ConfigurationSerializer configurationSerializer, final ExceptionCodec exceptionCodec) { this.launchContext = launchContext; this.heartBeatManager = heartBeatManager; this.configurationSerializer = configurationSerializer; this.exceptionCodec = exceptionCodec; } /** * Start the context manager. This initiates the root context. * * @throws ContextClientCodeException if the root context can't be instantiated. */ public void start() throws ContextClientCodeException { synchronized (this.contextStack) { LOG.log(Level.FINEST, "Instantiating root context."); this.contextStack.push(this.launchContext.get().getRootContext()); if (this.launchContext.get().getInitialTaskConfiguration().isPresent()) { LOG.log(Level.FINEST, "Launching the initial Task"); try { this.contextStack.peek().startTask(this.launchContext.get().getInitialTaskConfiguration().get()); } catch (final TaskClientCodeException e) { this.handleTaskException(e); } } } } /** * Shuts down. This forecefully kills the Task if there is one and then shuts down all Contexts on the stack, * starting at the top. */ @Override public void close() { synchronized (this.contextStack) { if (!this.contextStackIsEmpty()) { this.contextStack.lastElement().close(); } } } /** * @return true if there is no context. */ public boolean contextStackIsEmpty() { synchronized (this.contextStack) { return this.contextStack.isEmpty(); } } /** * Processes the given ContextControlProto to launch / close / suspend Tasks and Contexts. * <p/> * This also triggers the HeartBeatManager to send a heartbeat with the result of this operation. * * @param controlMessage the message to process */ public void handleContextControlProtocol( final EvaluatorRuntimeProtocol.ContextControlProto controlMessage) { synchronized (this.heartBeatManager) { try { if (controlMessage.hasAddContext() && controlMessage.hasRemoveContext()) { throw new IllegalArgumentException( "Received a message with both add and remove context. This is unsupported."); } final byte[] message = controlMessage.hasTaskMessage() ? controlMessage.getTaskMessage().toByteArray() : null; if (controlMessage.hasAddContext()) { this.addContext(controlMessage.getAddContext()); if (controlMessage.hasStartTask()) { // We support submitContextAndTask() this.startTask(controlMessage.getStartTask()); } else { // We need to trigger a heartbeat here. // In other cases, the heartbeat will be triggered by the TaskRuntime // Therefore this call can not go into addContext. this.heartBeatManager.sendHeartbeat(); } } else if (controlMessage.hasRemoveContext()) { this.removeContext(controlMessage.getRemoveContext().getContextId()); } else if (controlMessage.hasStartTask()) { this.startTask(controlMessage.getStartTask()); } else if (controlMessage.hasStopTask()) { this.contextStack.peek().closeTask(message); } else if (controlMessage.hasSuspendTask()) { this.contextStack.peek().suspendTask(message); } else if (controlMessage.hasTaskMessage()) { this.contextStack.peek().deliverTaskMessage(message); } else if (controlMessage.hasContextMessage()) { final EvaluatorRuntimeProtocol.ContextMessageProto contextMessageProto = controlMessage.getContextMessage(); boolean deliveredMessage = false; for (final ContextRuntime context : this.contextStack) { if (context.getIdentifier().equals(contextMessageProto.getContextId())) { context.handleContextMessage(contextMessageProto.getMessage().toByteArray()); deliveredMessage = true; break; } } if (!deliveredMessage) { throw new IllegalStateException( "Sent message to unknown context " + contextMessageProto.getContextId()); } } else { throw new RuntimeException("Unknown task control message: " + controlMessage); } } catch (final TaskClientCodeException e) { this.handleTaskException(e); } catch (final ContextClientCodeException e) { this.handleContextException(e); } } } /** * @return the TaskStatusProto of the currently running task, if there is any */ public Optional<ReefServiceProtos.TaskStatusProto> getTaskStatus() { synchronized (this.contextStack) { if (this.contextStack.isEmpty()) { throw new RuntimeException( "Asked for a Task status while there isn't even a context running."); } return this.contextStack.peek().getTaskStatus(); } } /** * @return the status of all context in the stack. */ public Collection<ReefServiceProtos.ContextStatusProto> getContextStatusCollection() { synchronized (this.contextStack) { final List<ReefServiceProtos.ContextStatusProto> result = new ArrayList<>(this.contextStack.size()); for (final ContextRuntime contextRuntime : this.contextStack) { final ReefServiceProtos.ContextStatusProto contextStatusProto = contextRuntime.getContextStatus(); LOG.log(Level.FINEST, "Add context status: {0}", contextStatusProto); result.add(contextStatusProto); } return result; } } /** * Add a context to the stack. * * @param addContextProto * @throws ContextClientCodeException if there is a client code related issue. */ private void addContext( final EvaluatorRuntimeProtocol.AddContextProto addContextProto) throws ContextClientCodeException { synchronized (this.contextStack) { try { final ContextRuntime currentTopContext = this.contextStack.peek(); if (!currentTopContext.getIdentifier().equals(addContextProto.getParentContextId())) { throw new IllegalStateException("Trying to instantiate a child context on context with id `" + addContextProto.getParentContextId() + "` while the current top context id is `" + currentTopContext.getIdentifier() + "`"); } final Configuration contextConfiguration = this.configurationSerializer.fromString(addContextProto.getContextConfiguration()); final ContextRuntime newTopContext; if (addContextProto.hasServiceConfiguration()) { newTopContext = currentTopContext.spawnChildContext(contextConfiguration, this.configurationSerializer.fromString(addContextProto.getServiceConfiguration())); } else { newTopContext = currentTopContext.spawnChildContext(contextConfiguration); } this.contextStack.push(newTopContext); } catch (final IOException | BindException e) { throw new RuntimeException("Unable to read configuration.", e); } } } /** * Remove the context with the given ID from the stack. * * @throws IllegalStateException if the given ID does not refer to the top of stack. */ private void removeContext(final String contextID) { synchronized (this.contextStack) { if (!contextID.equals(this.contextStack.peek().getIdentifier())) { throw new IllegalStateException("Trying to close context with id `" + contextID + "`. But the top context has id `" + this.contextStack.peek().getIdentifier() + "`"); } this.contextStack.peek().close(); if (this.contextStack.size() > 1) { /* We did not close the root context. Therefore, we need to inform the * driver explicitly that this context is closed. The root context notification * is implicit in the Evaluator close/done notification. */ this.heartBeatManager.sendHeartbeat(); // Ensure Driver gets notified of context DONE state } this.contextStack.pop(); System.gc(); // TODO sure?? } } /** * Launch a Task. */ private void startTask( final EvaluatorRuntimeProtocol.StartTaskProto startTaskProto) throws TaskClientCodeException { synchronized (this.contextStack) { final ContextRuntime currentActiveContext = this.contextStack.peek(); final String expectedContextId = startTaskProto.getContextId(); if (!expectedContextId.equals(currentActiveContext.getIdentifier())) { throw new IllegalStateException("Task expected context `" + expectedContextId + "` but the active context has ID `" + currentActiveContext.getIdentifier() + "`"); } try { final Configuration taskConfig = this.configurationSerializer.fromString(startTaskProto.getConfiguration()); currentActiveContext.startTask(taskConfig); } catch (IOException | BindException e) { throw new RuntimeException("Unable to read configuration.", e); } } } /** * THIS ASSUMES THAT IT IS CALLED ON A THREAD HOLDING THE LOCK ON THE HeartBeatManager */ private void handleTaskException(final TaskClientCodeException e) { LOG.log(Level.SEVERE, "TaskClientCodeException", e); final ByteString exception = ByteString.copyFrom(this.exceptionCodec.toBytes(e.getCause())); final ReefServiceProtos.TaskStatusProto taskStatus = ReefServiceProtos.TaskStatusProto.newBuilder() .setContextId(e.getContextId()) .setTaskId(e.getTaskId()) .setResult(exception) .setState(ReefServiceProtos.State.FAILED) .build(); LOG.log(Level.SEVERE, "Sending heartbeat: {0}", taskStatus); this.heartBeatManager.sendTaskStatus(taskStatus); } /** * THIS ASSUMES THAT IT IS CALLED ON A THREAD HOLDING THE LOCK ON THE HeartBeatManager */ private void handleContextException(final ContextClientCodeException e) { LOG.log(Level.SEVERE, "ContextClientCodeException", e); final ByteString exception = ByteString.copyFrom(this.exceptionCodec.toBytes(e.getCause())); final ReefServiceProtos.ContextStatusProto.Builder contextStatusBuilder = ReefServiceProtos.ContextStatusProto.newBuilder() .setContextId(e.getContextID()) .setContextState(ReefServiceProtos.ContextStatusProto.State.FAIL) .setError(exception); if (e.getParentID().isPresent()) { contextStatusBuilder.setParentId(e.getParentID().get()); } final ReefServiceProtos.ContextStatusProto contextStatus = contextStatusBuilder.build(); LOG.log(Level.SEVERE, "Sending heartbeat: {0}", contextStatus); this.heartBeatManager.sendContextStatus(contextStatus); } }
beysims/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextManager.java
Java
apache-2.0
13,862
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // pretty-expanded FIXME #23616 pub fn increment(x: usize) -> usize { x + 1 } #[macro_export] macro_rules! increment { ($x:expr) => ({ use $crate::increment; increment($x) }) } fn main() { assert_eq!(increment!(3), 4); }
ebfull/rust
src/test/run-pass/macro-crate-use.rs
Rust
apache-2.0
723
/* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'image3', 'cy', { alt: 'Testun Amgen', btnUpload: 'Anfon i\'r Gweinydd', captioned: 'Delwedd â phennawd', captionPlaceholder: 'Caption', // MISSING infoTab: 'Gwyb Delwedd', lockRatio: 'Cloi Cymhareb', menu: 'Priodweddau Delwedd', pathName: 'delwedd', pathNameCaption: 'pennawd', resetSize: 'Ailosod Maint', resizer: 'Clicio a llusgo i ail-meintio', title: 'Priodweddau Delwedd', uploadTab: 'Lanlwytho', urlMissing: 'URL gwreiddiol y ddelwedd ar goll.', altMissing: 'Alternative text is missing.' // MISSING } );
thexerteproject/xerteonlinetoolkits
editor/js/vendor/ckeditor/plugins/image3/lang/cy.js
JavaScript
apache-2.0
697
/* * Copyright (C) 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.cloud.dataflow.sdk.options; import com.google.cloud.dataflow.sdk.annotations.Experimental; /** * Options for controlling Cloud Debugger. */ @Description("[Experimental] Used to configure the Cloud Debugger") @Experimental @Hidden public interface CloudDebuggerOptions { /** * Whether to enable the Cloud Debugger snapshot agent for the current job. */ @Description("Whether to enable the Cloud Debugger snapshot agent for the current job.") boolean getEnableCloudDebugger(); void setEnableCloudDebugger(boolean enabled); }
Test-Betta-Inc/musical-umbrella
sdk/src/main/java/com/google/cloud/dataflow/sdk/options/CloudDebuggerOptions.java
Java
apache-2.0
1,158
/* Copyright 2017-present the Material Components for iOS authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #import "MDCTextInputControllerDefault.h" /** Material Design compliant outlined background text field from 2017. The logic for 'automagic' error states changes: underline color, underline text color. https://www.google.com/design/spec/components/text-fields.html#text-fields-single-line-text-field The placeholder text is laid out inline. If floating is enabled, it will float to the top of the field when there is content or the field is being edited. The character count is below text. The Material Design guidelines call this 'Floating inline labels.' https://material.io/guidelines/components/text-fields.html#text-fields-labels The background is clear, the corners are rounded, there's a border, there is no underline, and the placeholder is centered vertically in the filled area but does NOT cross the border when floating. */ @interface MDCTextInputControllerOutlinedTextArea : MDCTextInputControllerDefault @end
ilap/MaterialComponentsXamarin
references/MaterialComponents.framework/Headers/MDCTextInputControllerOutlinedTextArea.h
C
apache-2.0
1,563
--- author: laurenta tags: [] layout: post slug: demonstration-torche-plasma date: 2016-04-17 title: "Démonstration torche plasma" comments: True --- L'achat d'une torche plasma est budgété et va être finalisé. ![](https://static.fablab-lannion.org/Plasma.jpg) Le support qui va l'accueillir avec sa CNC est déjà en place. Pour vous en donner un avant goût, une démonstration est proposée le mercredi 20 avril à partir de 20h30. Vous pouvez apporter vos morceaux de métal jusqu'à 8mm pour vous faire la main. N'oubliez pas vos lunettes de soleil !
colvert/colvert.github.io
_posts/2016-04-17-demonstration-torche-plasma.md
Markdown
apache-2.0
568
/* * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.jetbrains.python.inspections.quickfix; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.Function; import com.jetbrains.python.PyBundle; import com.jetbrains.python.psi.*; import org.jetbrains.annotations.NotNull; /** * User: catherine * * QuickFix to replace statement that has no effect with function call */ public class CompatibilityPrintCallQuickFix implements LocalQuickFix { @NotNull public String getName() { return PyBundle.message("QFIX.statement.effect"); } @NotNull public String getFamilyName() { return getName(); } public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement expression = descriptor.getPsiElement(); PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project); replacePrint(expression, elementGenerator); } private static void replacePrint(PsiElement expression, PyElementGenerator elementGenerator) { final StringBuilder stringBuilder = new StringBuilder("print("); final PyFile file = (PyFile)expression.getContainingFile(); final PyExpression[] target = PsiTreeUtil.getChildrenOfType(expression, PyExpression.class); if (target != null) { stringBuilder.append(StringUtil.join(target, o -> o.getText(), ", ")); } stringBuilder.append(")"); expression.replace(elementGenerator.createFromText(LanguageLevel.forElement(expression), PyExpression.class, stringBuilder.toString())); final PyFromImportStatement statement = elementGenerator.createFromText(LanguageLevel.forElement(expression), PyFromImportStatement.class, "from __future__ import print_function"); file.addBefore(statement, file.getStatements().get(0)); } }
michaelgallacher/intellij-community
python/src/com/jetbrains/python/inspections/quickfix/CompatibilityPrintCallQuickFix.java
Java
apache-2.0
2,690
/* Copyright (c) 2004-2006 Tomas Matousek and Ladislav Prosek. The use and distribution terms for this software are contained in the file named License.txt, which can be found in the root of the Phalanger distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice from this software. */ using System; using System.IO; using System.Text; using System.Threading; using System.Reflection; using System.Diagnostics; using System.Globalization; using System.Collections; using System.Collections.Generic; using System.Reflection.Emit; using System.Runtime.InteropServices; using System.Runtime.Remoting.Messaging; using System.ComponentModel; using PHP.Core.Emit; using PHP.Core.Reflection; using System.Configuration; #if SILVERLIGHT using PHP.CoreCLR; #endif namespace PHP.Core { #region ScriptInfo /// <summary> /// Holds information about an included script. Caches the MainHelper and allows to call the Main of the Script. /// </summary> [DebuggerNonUserCode] public class ScriptInfo { /// <summary> /// The script type. /// </summary> public readonly Type/*!*/Script; /// <summary> /// <see cref="MethodInfo"/> of the &lt;Main&gt; method. /// </summary> internal MethodInfo MainHelper { get { return mainHelper ?? (mainHelper = this.mainHelper = Script.GetMethod(ScriptModule.MainHelperName, ScriptModule.MainHelperArgTypes)); } set { mainHelper = value; } } private MethodInfo mainHelper = null; #region Statistics for preallocation Dictionaries /// <summary> /// Remember max count of declared functions from within this entering script. Used to prealocate <see cref="ScriptContext.DeclaredFunctions"/>. /// </summary> internal int MaxDeclaredFunctionsCount = 0; /// <summary> /// Remember max count of declared types from within this entering script. Used to prealocate <see cref="ScriptContext.DeclaredTypes"/>. /// </summary> internal int MaxDeclaredTypesCount = 0; /// <summary> /// Update <see cref="MaxDeclaredTypesCount"/> and <see cref="MaxDeclaredFunctionsCount"/>. /// </summary> /// <param name="context"></param> /// <remarks>Called at the end of request.</remarks> internal void SaveMaxCounts(ScriptContext/*!*/context) { Debug.Assert(context != null); if (MaxDeclaredFunctionsCount < context.DeclaredFunctions.Count) MaxDeclaredFunctionsCount = context.DeclaredFunctions.Count; if (MaxDeclaredTypesCount < context.DeclaredTypes.Count) MaxDeclaredTypesCount = context.DeclaredTypes.Count; } #endregion #region Constructors internal ScriptInfo(Type/*!*/script) { Debug.Assert(PhpScript.IsScriptType(script), "Given script type is not IPhpScript."); Script = script; } internal ScriptInfo(Type/*!*/script, MethodInfo/*!*/mainHelper) { // no check, for internal ScriptModule use only this.Script = script; this.mainHelper = mainHelper; } #endregion #region Delegates /// <summary> /// Get delegate that Invokes the Main helper method of the script. /// Unwraps any thrown <c>InnerException</c> of <c>PhpException</c>, <c>PhpUserException</c>, <c>ScriptDiedException</c> and <c>ThreadAbortException</c>. /// </summary> internal MainRoutineDelegate Main { get { return (ScriptContext context, Dictionary<string, object> variables, DObject self, DTypeDesc includer, bool isMain) => { try { return MainRoutine(context, variables, self, includer, isMain); } catch (TargetInvocationException e) { if (e.InnerException is PhpException || e.InnerException is PhpUserException || e.InnerException is ScriptDiedException || e.InnerException is System.Threading.ThreadAbortException) throw e.InnerException; throw; } }; } } /// <summary> /// The delegate to the Main method of the Script. Delegate is lazily /// </summary> private MainRoutineDelegate MainRoutine { get { return mainRoutine ?? (mainRoutine = (MainRoutineDelegate)Delegate.CreateDelegate(typeof(MainRoutineDelegate), MainHelper)); } } private MainRoutineDelegate mainRoutine = null; #endregion } #endregion #region ResolveTypeFlags /// <summary> /// Flags passed to <see cref="ScriptContext.ResolveType"/>. /// </summary> [Flags] public enum ResolveTypeFlags { None = 0, /// <summary>Tries to execute autoload when the class is not found.</summary> UseAutoload = 1, /// <summary>Throw an error if the class is not found.</summary> ThrowErrors = 2, /// <summary>Stack frame is preserved if autoload is called.</summary> PreserveFrame = 4, /// <summary><see cref="PhpStack.RemoveFrame"/> is called before throwing an error.</summary> RemoveFrame = 8, /// <summary> /// Whether not to interpret the full name as a generic name if it cannot be resolved otherwise. /// </summary> SkipGenericNameParsing = 16 } #endregion /// <summary> /// The context of an executing script. Contains data associated with a request. /// </summary> [DebuggerNonUserCode] public sealed partial class ScriptContext : MarshalByRefObject, IDisposable { #region DebugView internal class DebugView { private readonly ScriptContext/*!*/ context; public DebugView(ScriptContext/*!*/ context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; } [DebuggerDisplay("Count = {GlobalVariables.Count}", Name = "$GLOBALS", Type = "array")] public PhpArray/*!*/ GlobalVariables { get { return context.AutoGlobals.Globals.Value as PhpArray; } } [DebuggerDisplay("Count = {context.DeclaredFunctions.Count}", Name = "Constants", Type = "array")] public PhpHashEntryDebugView[]/*!*/ DefinedConstants { get { PhpHashEntryDebugView[] result = new PhpHashEntryDebugView[context.Constants.Count]; int i = 0; foreach (var entry in context.Constants) result[i++] = new PhpHashEntryDebugView(new IntStringKey(entry.Key), entry.Value); return result; } } [DebuggerDisplay("Count = {context.DeclaredFunctions.Count}", Name = "Functions", Type = "array")] public string[]/*!*/ DeclaredFunctions { get { string[] keys = new string[context.DeclaredFunctions.Count]; context.DeclaredFunctions.Keys.CopyTo(keys, 0); return keys; } } [DebuggerDisplay("Count = {context.DeclaredTypes.Count}", Name = "Types", Type = "array")] public string[]/*!*/ DeclaredTypes { get { string[] keys = new string[context.DeclaredTypes.Count]; context.DeclaredTypes.Keys.CopyTo(keys, 0); return keys; } } #if DEBUG public int OwningThread { get { return context.Owner.ManagedThreadId; } } #endif } #endregion #region Instance Fields & Properties public ApplicationContext/*!*/ ApplicationContext { get { return applicationContext; } } private readonly ApplicationContext/*!*/ applicationContext; /// <summary> /// List of <see cref="ScriptInfo"/>s included by the current script. Contains also the script itself. /// Used for resolving inclusions. /// </summary> private readonly Dictionary<string, ScriptInfo> scripts = new Dictionary<string, ScriptInfo>(FullPath.StringComparer); /// <summary> /// List currently included script files. /// </summary> /// <returns></returns> public IEnumerable<string> GetIncludedScripts() { return scripts.Keys; } /// <summary> /// A path to the source file of main script. /// </summary> public PhpSourceFile MainScriptFile { get { return mainScriptFile; } } private PhpSourceFile mainScriptFile; /// <summary> /// A <see cref="ScriptInfo"/> of main script (first script executed within the current <see cref="RequestContext"/>). /// </summary> internal ScriptInfo MainScriptInfo { get { return mainScriptInfo; } } private ScriptInfo mainScriptInfo; /// <summary> /// The configuration used by the class library and script functions and by objects which /// has this instance of <see cref="ScriptContext"/> associated with itself. /// </summary> public LocalConfiguration Config { get { return config; } set { config = (value == null) ? Configuration.DefaultLocal : value; } } private LocalConfiguration config; /// <summary> /// User functions declarators - delegates pointing on declared functions. /// </summary> public Dictionary<string, DRoutineDesc>/*!*/ DeclaredFunctions { get { if (_declaredFunctions == null) DeclaredFunctionsAllocate(29); // preallocate 29 by default, it is 6th prime number; see HashHelpers.GetPrime(int) return _declaredFunctions; } } private Dictionary<string, DRoutineDesc> _declaredFunctions; /// <summary> /// Allocate <see cref="_declaredFunctions"/> with given <paramref name="capacity"/>. /// </summary> /// <param name="capacity">Capacity hint.</param> private void DeclaredFunctionsAllocate(int capacity) { Debug.Assert(capacity >= 0); if (_declaredFunctions == null) _declaredFunctions = new Dictionary<string, DRoutineDesc>(capacity, StringComparer.OrdinalIgnoreCase); } /// <summary> /// Declarators of user classes. /// </summary> public Dictionary<string, DTypeDesc>/*!*/ DeclaredTypes { get { if (_declaredTypes == null) DeclaredTypesAllocate(29); // see DeclaredFunctions return _declaredTypes; } } private Dictionary<string, DTypeDesc> _declaredTypes; /// <summary> /// Allocate <see cref="_declaredTypes"/> with given <paramref name="capacity"/>. /// </summary> /// <param name="capacity">Capacity hint.</param> private void DeclaredTypesAllocate(int capacity) { Debug.Assert(capacity >= 0); if (_declaredTypes == null) _declaredTypes = new Dictionary<string, DTypeDesc>(capacity, StringComparer.OrdinalIgnoreCase); } /// <summary> /// Set of incomplete (deferred) types (their unique identifier) that were declared already in advance at the beginning of the script. /// These types was declared at the beginning of the script, because it was already possible. This simulates behaviour of PHP, /// since it "loads" type into the context if its base type is known at runtime (not at compile time like Phalanger does). /// </summary> private HashSet<string> IncompleteTypesInAdvance = null; /// <summary> /// Mapping of static local variables into their unique sequential ID. This allows efficient indexing into <see cref="staticLocals"/> array. /// The index starts from 1. /// The dictionary is used only when two or more static locals point to the same variable (e.g. when single eval() has different content sometimes). /// </summary> private static SynchronizedCache<string, int>/*!*/staticLocalsId = new SynchronizedCache<string, int>(id => staticLocalsId.Count + 1); /// <summary> /// User defined static locals for the current context. /// </summary> private List<PhpReference> staticLocals; /// <summary> /// Gets collection of script context properties used to store custom objects. Cannot be <c>null</c>. /// </summary> public PropertyCollectionClass/*!*/Properties { get { return this.properties; } } private readonly PropertyCollectionClass/*!*/properties = new PropertyCollectionClass(); /// <summary> /// The stack for performing indirect calls and calls to argument-aware functions. /// </summary> public readonly PhpStack Stack; /// <summary> /// Registered user stream wrappers per request. Initialized in a lazy manner. /// </summary> public Dictionary<string, StreamWrapper> UserStreamWrappers { get; set; } /// <summary> /// The current directory used as working one for PHP file system functions and for including scripts. /// </summary> public string WorkingDirectory { get { return workingDirectory; } set { workingDirectory = value; } } private string workingDirectory; /// <summary> /// Get the list of SPL autoload functions. This cannot be null. First call to this property will enable SPL autoload functions. /// </summary> public LinkedList<PhpCallback> SplAutoloadFunctions { get { return splAutoloadFunctions ?? (splAutoloadFunctions = new LinkedList<PhpCallback>()); } } private LinkedList<PhpCallback> splAutoloadFunctions; /// <summary> /// Stack of <see cref="DTypeDesc"/> representing type used to call currently evaluated method. /// </summary> public Stack<DTypeDesc> CurrentLateStaticBinding { get { return _currentLateStaticBinding ?? (_currentLateStaticBinding = new Stack<DTypeDesc>()); } } private Stack<DTypeDesc> _currentLateStaticBinding; /// <summary> /// Get the value indicating if SPL autoload functions are enabled. (If spl_autoload_register was used.) /// </summary> public bool IsSplAutoloadEnabled { get { return splAutoloadFunctions != null; } } /// <summary> /// List of SPL extensions used by spl_autoload() function. /// </summary> public string[] SplAutoloadExtensions { get { return splAutoloadExtensions ?? new string[] { ".php" }; } set { splAutoloadExtensions = value; } } private string[] splAutoloadExtensions; /// <summary> /// Lazily resolved and initialized __autoload() function. /// Initialized when needed in the first time in <c>ResolveTypeByAutoload</c>. /// </summary> private DRoutineDesc autoloadFunction; /// <summary> /// Lazily created list of types name being auto-loaded. /// Used as a recursion prevention of <b>autoload</b>. /// </summary> private List<string> pendingAutoloads; /// <summary> /// Set when the context started finalization. /// </summary> private bool disposed = false; /// <summary> /// Additional disposal action. /// </summary> internal event Action TryDispose; /// <summary> /// Additional disposal action processed in <c>finally</c> block. /// </summary> internal event Action FinallyDispose; #if DEBUG public Thread/*!*/ Owner { get { return owner; } } private readonly Thread/*!*/ owner; #endif #endregion #region Construction /// <summary> /// Creates an instance of <see cref="ScriptContext"/> initialized with dummy streams and /// a copy of the default local configuration. /// </summary> public ScriptContext(ApplicationContext/*!*/ appContext) : this(appContext, (LocalConfiguration)Configuration.DefaultLocal.DeepCopy(), TextWriter.Null, Stream.Null) { #if !SILVERLIGHT this.workingDirectory = Directory.GetCurrentDirectory(); #else this.workingDirectory = ""; #endif } /// <summary> /// Creates instance of <see cref="ScriptContext"/>. /// </summary> public ScriptContext(ApplicationContext/*!*/ appContext, LocalConfiguration/*!*/ config, TextWriter/*!*/ textSink, Stream/*!*/ streamSink) { if (textSink == null) throw new ArgumentNullException("textSink"); if (streamSink == null) throw new ArgumentNullException("streamSink"); if (config == null) throw new ArgumentNullException("config"); Debug.WriteLine("SC", "Created by thread #{0}", Thread.CurrentThread.ManagedThreadId); #if DEBUG this.owner = Thread.CurrentThread; #endif this.textSink = textSink; this.streamSink = streamSink; this.config = config; InitPlatformSpecific(); // stack: this.Stack = new PhpStack(this); // initializes output redirecting fields: this.IsOutputBuffered = false; this.applicationContext = appContext; } #endregion #region Current Context public ScriptContext/*!*/ Fork() { LocalConfiguration new_config = (LocalConfiguration)this.config.DeepCopy(); ScriptContext new_context = new ScriptContext(this.ApplicationContext, new_config, this.textSink, this.streamSink); new_context.WorkingDirectory = this.workingDirectory; // copy function declarators: Dictionary<string, DRoutineDesc> new_declared_functions = new_context.DeclaredFunctions; foreach (KeyValuePair<string, DRoutineDesc> entry in DeclaredFunctions) new_declared_functions[entry.Key] = entry.Value; // copy type declarators: Dictionary<string, DTypeDesc> new_declared_types = new_context.DeclaredTypes; foreach (KeyValuePair<string, DTypeDesc> entry in DeclaredTypes) new_declared_types[entry.Key] = entry.Value; // deep copy global variables: PhpArray new_globals = (PhpArray)this.GlobalVariables.DeepCopy(); new_context.AutoGlobals.Globals = new PhpReference(new_globals); // TODO: deep copy other super-globals (move copying to AutoGlobals already) // TODO: staticLocals, wrappers, scripts return CurrentContext = new_context; } #region Hokus pokus //private HttpContext lastContext; //private bool httpAttachPending; //private ScriptContext AttachToHttpApplication() //{ // ScriptContext script_context = this; // HttpContext context = HttpContext.Current; // if (context != null && context != lastContext) // { // Debug.WriteLine("ASP.NET", "Initializing request context"); // script_context = RequestContext.Initialize(context).ScriptContext; // script_context.lastContext = context; // script_context.httpAttachPending = true; // } // if (script_context.httpAttachPending) // { // if (context == null) // { // // we are not running in a web request context -> no attaching takes place // script_context.httpAttachPending = false; // } // else // { // HttpApplication app = context.ApplicationInstance; // if (app != null) // { // Debug.WriteLine("ASP.NET", "HttpApplication is non-null"); // // a HTTP application has already been initialized -> attach to it // try // { // // do we already have the session state? // HttpSessionState session_state = app.Session; // Debug.WriteLine("ASP.NET", "Session state already acquired"); // ApplicationInstance_PostAcquireRequestState(script_context, EventArgs.Empty); // } // catch (HttpException) // { // // session state not yet acquired // app.PostAcquireRequestState += new EventHandler(script_context.ApplicationInstance_PostAcquireRequestState); // } // app.PostRequestHandlerExecute += new EventHandler(script_context.ApplicationInstance_PostRequestHandlerExecute); // script_context.httpAttachPending = false; // } // } // } // return script_context; //} //private void ApplicationInstance_PostAcquireRequestState(object sender, EventArgs e) //{ // Debug.WriteLine("ASP.NET", "PostAcquireRequestState"); // RequestContext request_context = RequestContext.CurrentContext; // Debug.Assert(request_context != null); // if (Config.Session.AutoStart) request_context.StartSession(); //} //private void ApplicationInstance_PostRequestHandlerExecute(object sender, EventArgs e) //{ // Debug.WriteLine("ASP.NET", "PostRequestHandlerExecute"); // RequestContext.CurrentContext.Dispose(); // this.httpAttachPending = true; //} #endregion #endregion #region Http header handling #endregion #region Constants /// <summary> /// User defined constants. /// </summary> public DualDictionary<string, object>/*!*/ Constants { get { if (_constants == null) { _constants = new DualDictionary<string, object>(null, StringComparer.OrdinalIgnoreCase); // predefined run-time constants: InitConstants(_constants); // Used just to differentiate what is core constant and what is user constant _coreConstants = new DualDictionary<string, object>(null, StringComparer.OrdinalIgnoreCase); InitConstants(_coreConstants); } return _constants; } } private DualDictionary<string, object> _constants; /// <summary> /// Contain constants defined by runtime in ScriptContext (all of them are ignoreCase) /// </summary> /// <remarks>Actaully it is here just because of GetDefinedConstants(bool) library function</remarks> private DualDictionary<string, object> _coreConstants; /// <summary> /// Defines a user constant. /// </summary> /// <param name="name">The constant name. Compiler converts constant name to string before passing it to this method.</param> /// <param name="value">The constant value (should be either scalar or a <B>null</B> reference).</param> /// <returns>Whether the constant has been defined. Returns <B>false</B> if the constant is already defined.</returns> public bool DefineConstant(string name, object value) { return DefineConstant(name, value, false); } /// <summary> /// Defines a user constant. /// </summary> /// <param name="name">The constant name. Compiler converts constant name to string before passing it to this method.</param> /// <param name="value">The constant value (should be either scalar or a <B>null</B> reference).</param> /// <param name="ignoreCase">Whether the constant is case insensitive.</param> /// <returns>Whether the new constant has been defined.</returns> /// <exception cref="PhpException">Constant has already been defined (Notice).</exception> /// <exception cref="PhpException">Value is neither scalar not <B>null</B> (Warning).</exception> public bool DefineConstant(string name, object value, bool ignoreCase) { if (!PhpVariable.IsScalar(value) && value != null) { PhpException.Throw(PhpError.Warning, CoreResources.GetString("constant_value_neither_scalar_nor_null")); return false; } if (name == null) name = String.Empty; if (Constants.ContainsKey(name)) { PhpException.Throw(PhpError.Notice, CoreResources.GetString("constant_redefined", name)); return false; } Constants.Add(name, value, ignoreCase); return true; } [Emitted] public void DeclareConstant(string name, object value) { Constants[name, true] = value; // case sensitive } /// <summary> /// Retrieves a value of a constant (either user or library). /// </summary> /// <param name="name">The name of the constant.</param> /// <param name="fallbackName">The name of the constant tried if the first one does not exist.</param> /// <returns>Returns the value of the constant or its name it it is not defined.</returns> /// <exception cref="PhpException">Constant is not defined (Notice).</exception> [Emitted] public object GetConstantValue(string name, string fallbackName) { return GetConstantValue(name, fallbackName, false, true); } /// <summary> /// Tries to parse the <paramref name="fullname"/> as "typename::constantname", resolve the typename and tries to get the constantname. /// </summary> /// <param name="fullname">Full class constant name, in a form of "typename::constantname".</param> /// <param name="desc">Found constant if any. Otherwise will be null.</param> /// <param name="quiet">True to throw undefined class constant PHP error if fullname represents class constant name and the constant was not found.</param> /// <returns>True if given <paramref name="fullname"/> states for class constant name.</returns> /// <exception cref="PhpException">Undefined class constant (Fatal Error).</exception> /// <exception cref="PhpException">Class name could not be resolved (Fatal Error).</exception> private bool GetClassConstant(string fullname, out DConstantDesc desc, bool quiet) { desc = null; string typename, constname; if (Name.IsClassMemberSyntax(fullname, out typename, out constname)) { var flags = ResolveTypeFlags.UseAutoload; if (!quiet) flags |= ResolveTypeFlags.ThrowErrors; var type = ResolveType(typename, null, UnknownTypeDesc.Singleton, null, flags); if (type != null) { var result = type.GetConstant(new VariableName(constname), UnknownTypeDesc.Singleton, out desc); if (!quiet && desc == null) PhpException.Throw(PhpError.Error, CoreResources.GetString("undefined_class_constant", typename, constname)); } return true; // fullname is for class constant } return false; // gobal constant } /// <summary> /// Retrieves a value of a constant (either user or library). /// </summary> /// <param name="name">The name of the constant.</param> /// <param name="fallbackName">The name of constant tried if <paramref name="name"/> does not exist. (global constants only)</param> /// <param name="quiet">Whether to report a notice if the constant is not defined.</param> /// <param name="returnNameIfUndefined">True to return the <paramref name="name"/> instead of <c>null</c> when constant is not defined.</param> /// <returns>Returns the value of the constant. If constant is not defined, <c>null</c> or its name is returned.</returns> /// <exception cref="PhpException">Constant is not defined (Notice).</exception> /// <exception cref="PhpException">Constant is not defined (Warning).</exception> /// <exception cref="PhpException">Undefined class constant (Fatal Error).</exception> private object GetConstantValue(string name, string fallbackName, bool quiet, bool returnNameIfUndefined) { if (name == null) name = String.Empty; // global constant or class constant: DConstantDesc desc; if (GetClassConstant(name, out desc, quiet)) { if (desc != null) return PhpVariable.Dereference(desc.GetValue(this)); } else { // gets user constant first: object result; if (Constants.TryGetValue(name, out result)) return result; // gets system constant if user one is not defined: if (applicationContext.Constants.TryGetValue(name, out desc)) return desc.LiteralValue; if (fallbackName != null) { // try the same with fallbackName: if (Constants.TryGetValue(fallbackName, out result)) return result; if (applicationContext.Constants.TryGetValue(fallbackName, out desc)) return desc.LiteralValue; } } // constant is not defined: if (!quiet) { if (returnNameIfUndefined) PhpException.Throw(PhpError.Notice, CoreResources.GetString("undefined_constant", name)); else PhpException.Throw(PhpError.Warning, CoreResources.GetString("constant_not_found", name)); } // default value, if constant is not defined return returnNameIfUndefined ? name : null; } /// <summary> /// Retrieves a value of a constant (either user or library). /// </summary> /// <param name="name">The name of the constant.</param> /// <param name="quiet">Whether to report a notice if the constant is not defined.</param> /// <param name="returnNameIfUndefined">True to return the <paramref name="name"/> instead of <c>null</c> when constant is not defined.</param> /// <returns>Returns the value of the constant. If constant is not defined, <c>null</c> or its name is returned.</returns> /// <exception cref="PhpException">Constant is not defined (Notice).</exception> /// <exception cref="PhpException">Constant is not defined (Warning).</exception> /// <exception cref="PhpException">Undefined class constant (Fatal Error).</exception> public object GetConstantValue(string name, bool quiet, bool returnNameIfUndefined) { return GetConstantValue(name, null, quiet, returnNameIfUndefined); } /// <summary> /// Checks whether a constant of a specified name is defined. /// </summary> /// <param name="name">The name of the constant.</param> /// <returns>Whether user or library constant with <paramref name="name"/> name is defined.</returns> [Emitted] public bool IsConstantDefined(string name) { if (name == null) name = String.Empty; // global constant or class constant: DConstantDesc desc; if (GetClassConstant(name, out desc, true)) return desc != null; else return Constants.ContainsKey(name) || applicationContext.Constants.ContainsKey(name); } /// <summary> /// Retrieves all defined user and library constants. /// </summary> /// <exception cref="ArgumentNullException"><paramref name="result"/> is a <B>null</B> reference.</exception> public void GetDefinedConstants(IDictionary/*!*/ result) { if (result == null) throw new ArgumentNullException("result"); foreach (KeyValuePair<string, object> entry in Constants) result[entry.Key] = entry.Value; foreach (KeyValuePair<string, DConstantDesc> entry in applicationContext.Constants) result[entry.Key] = entry.Value.LiteralValue; } /// <summary> /// Retrieves the number of all defined user and library constants. /// </summary> /// <returns>The number of constants.</returns> public int GetDefinedConstantCount() { return applicationContext.Constants.Count + Constants.Count; } /// <summary> /// Retrieves the number of user defined constants. /// </summary> /// <returns>The number of constants.</returns> public int GetDefinedUserConstantCount() { return Constants.Count - _coreConstants.Count; } /// <summary> /// Retrieves all user defined constants. /// </summary> public void GetDefinedUserConstants(IDictionary/*!*/ result) { if (result == null) throw new ArgumentNullException("result"); foreach (KeyValuePair<string, object> entry in Constants) { if (!_coreConstants.ContainsKey(entry.Key)) // it is user constant result[entry.Key] = entry.Value; } } /// <summary> /// Retrieves all defined extension constants. /// </summary> /// <exception cref="ArgumentNullException"><paramref name="result"/> is a <B>null</B> reference.</exception> public void GetDefinedExtensionConstants(IDictionary/*!*/ result, string extensionName) { string actualLibraryName = null; GlobalConstant gConst; if (result == null) throw new ArgumentNullException("result"); if (extensionName == null) extensionName = "Core"; if (extensionName == "Core") { foreach (KeyValuePair<string, object> entry in _coreConstants) { result[entry.Key] = entry.Value; } } foreach (KeyValuePair<string, DConstantDesc> entry in applicationContext.Constants) { gConst = entry.Value.GlobalConstant; if (gConst == null) actualLibraryName = "Core"; else actualLibraryName = gConst.Extension; if (actualLibraryName == null) { actualLibraryName = "Core"; } if (actualLibraryName == extensionName) result[entry.Key] = entry.Value.LiteralValue; } } #endregion #region Functions /// <summary> /// Declares a PHP function. /// Emitted. /// </summary> /// <param name="function">The <see cref="PhpRoutineDesc"/> of the function. Contains ArgLess stub and modifiers. (new PhpRoutineDesc(Attributes, ArglessStub)).</param> /// <param name="fullName">The name of the function.</param> /// <exception cref="PhpException">A function of the given name has already been declared. (Error)</exception> [Emitted] public void DeclareFunction(PhpRoutineDesc/*!*/ function, string/*!*/ fullName) { Debug.Assert(function != null && fullName != null); try { DeclaredFunctions.Add(fullName, function); DeclareFunctionInMap(function.Index); } catch (ArgumentException) { if (!IsFunctionDeclared(function)) // since PHP 5.3 redeclaration is ok for the exact same function ? PhpException.Throw(PhpError.Error, CoreResources.GetString("function_redeclared", fullName)); } } /// <summary> /// Bit map of currently declared function. If we know the index of <see cref="DRoutineDesc"/>, we can check whether it is declared quickly. /// </summary> private BitArray/*!*/_declaredFunctionsMap = new BitArray(DRoutineDesc.LastIndex + 1, false); private void DeclareFunctionInMap(int index) { if (_declaredFunctionsMap.Length <= index) _declaredFunctionsMap.Length = index + 128; if (index >= 0) _declaredFunctionsMap[index] = true; } /// <summary> /// Check whether given <paramref name="desc"/> is declared on the current <see cref="ScriptContext"/> or not. /// </summary> /// <param name="desc"><see cref="DRoutineDesc"/> to check, if it is declared on the current <see cref="ScriptContext"/>.</param> /// <returns><c>true</c> iff <paramref name="desc"/> is declared.</returns> private bool IsFunctionDeclared(DRoutineDesc desc) { return desc != null && desc.Index >= 0 && desc.Index < _declaredFunctionsMap.Length && _declaredFunctionsMap[desc.Index]; } /// <summary> /// Declares a PHP lambda function. /// Operator. /// </summary> /// <param name="function">The <see cref="DRoutineDesc"/> of the function.</param> /// <return>The generated name for the function.</return> [Emitted] public string/*!*/ DeclareLambda(RoutineDelegate/*!*/ function) { Debug.Assert(function != null); string name = DynamicCode.GenerateLambdaName(); DeclaredFunctions[name] = new PhpRoutineDesc(PhpMemberAttributes.Public | PhpMemberAttributes.Static, function, false/*do not allocate an index for this, not preserved*/); return name; } /// <summary> /// Calls a function which is unknown at compile time. /// </summary> /// <param name="localVariables">Table of local variables if available.</param> /// <param name="namingContext">Naming context.</param> /// <param name="name">The name of the function. Case insensitive.</param> /// <param name="fallbackName">The name of the function tried if the first one does not exist.</param> /// <param name="context">The script context in which to do the call.</param> /// <param name="routineHint">Optional hint to skip function resolving.</param> /// <returns>The return value of the function called.</returns> /// <remarks> /// If a compile time unknown function is called all variables are expected to be of /// type <see cref="PhpReference"/>. If the result is passed to non reference target /// it is dereferenced. /// </remarks> [Emitted] public static PhpReference/*!*/ Call(Dictionary<string, object> localVariables, NamingContext namingContext, object name, string fallbackName, ref DRoutineDesc routineHint, ScriptContext/*!*/ context) { return PhpVariable.MakeReference( PhpVariable.Copy( CallInternal(localVariables, namingContext, name, fallbackName, ref routineHint, context), CopyReason.ReturnedByCopy)); } [Emitted] public static void CallVoid(Dictionary<string, object> localVariables, NamingContext namingContext, object name, string fallbackName, ref DRoutineDesc routineHint, ScriptContext/*!*/ context) { CallInternal(localVariables, namingContext, name, fallbackName, ref routineHint, context); } [Emitted] public static object CallValue(Dictionary<string, object> localVariables, NamingContext namingContext, object name, string fallbackName, ref DRoutineDesc routineHint, ScriptContext/*!*/ context) { return PhpVariable.Dereference( PhpVariable.Copy( CallInternal(localVariables, namingContext, name, fallbackName, ref routineHint, context), CopyReason.ReturnedByCopy)); } /// <summary> /// Calls a function which is unknown at compile time. Returns the value directly returned by <see cref="DRoutineDesc.Invoke"/>. /// </summary> private static object CallInternal(Dictionary<string, object> localVariables, NamingContext namingContext, object name, string fallbackName, ref DRoutineDesc routineHint, ScriptContext/*!*/ context) { // <name> should be a string: string function_name = PhpVariable.AsString(name); if (String.IsNullOrEmpty(function_name)) { var callback = Convert.ObjectToCallback(name, true); if (callback != null && (callback.IsBound || callback.Bind())) return callback.TargetRoutine.Invoke(callback.TargetInstance, context.Stack); // callback could not be resulved context.Stack.RemoveFrame(); PhpException.Throw(PhpError.Error, CoreResources.GetString("invalid_function_name")); } else { DRoutineDesc desc = context.ResolveFunctionWithHint(routineHint, function_name, null, true); if ((desc != null) || // we've found {function_name} (fallbackName != null && (desc = context.ResolveFunctionWithHint(routineHint, fallbackName, null, true)) != null) // or we've found {fallbackName} ) { routineHint = desc; // remember for the next time // the callee may need table of local variables and/or naming context: context.Stack.Variables = localVariables; context.Stack.NamingContext = namingContext; return desc.Invoke(null, context.Stack); } else { context.Stack.RemoveFrame(); PhpException.Throw(PhpError.Error, CoreResources.GetString("undefined_function_called", name)); } } return null; } /// <summary> /// Populates given list with names of user and library functions. /// </summary> public void GetDeclaredFunctions(IList/*!*/ userFunctions, IList/*!*/ libraryFunctions) { if (userFunctions == null) throw new ArgumentNullException("userFunctions"); if (libraryFunctions == null) throw new ArgumentNullException("libraryFunctions"); // all user functions have declarators: foreach (KeyValuePair<string, DRoutineDesc> entry in DeclaredFunctions) { if (entry.Value.DeclaringModule.Assembly is PhpLibraryAssembly) libraryFunctions.Add(entry.Key); else userFunctions.Add(entry.Key); } // all user functions have declarators: foreach (KeyValuePair<string, DRoutineDesc> entry in applicationContext.Functions) { if (entry.Value.DeclaringModule.Assembly is PhpLibraryAssembly) libraryFunctions.Add(entry.Key); else userFunctions.Add(entry.Key); } } #endregion #region Types /// <summary> /// Declares a PHP class or PHP interface. /// </summary> /// <param name="typeDesc">The <see cref="DTypeDesc"/> of the class/interface.</param> /// <param name="fullName">The name of the class.</param> /// <exception cref="PhpException">A class or interface of the given name has already been declared. (Error)</exception> [Emitted] public void DeclareType(PhpTypeDesc/*!*/ typeDesc, string/*!*/ fullName) { Debug.Assert(typeDesc != null && !typeDesc.IsGeneric && fullName != null); try { // the completion type needn't to be created for non-generic types DeclaredTypes.Add(fullName, typeDesc); } catch (ArgumentException) { // a class of this name has already been declared PhpException.Throw(PhpError.Error, CoreResources.GetString("type_redeclared", fullName)); } } public void DeclareGenericType(PhpTypeDesc/*!*/ typeDesc, string/*!*/ fullName) { Debug.Assert(typeDesc != null && typeDesc.IsGeneric && fullName != null); DTypeDesc existing; if (!DeclaredTypes.TryGetValue(fullName, out existing)) { bool old_throw = ThrowExceptionOnError; throwExceptionOnError = true; try { // TODO: optimize - we don't need completion if there are no resolved unknown types in the spec; // referring type is useless as the type/method parameters are not visible to the // conditional declaration: GenericParameterDesc[] gps = typeDesc.ReflectGenericParameters(null, null, new ResolverDelegate(ResolveType)); PhpTypeCompletionDesc completion = new PhpTypeCompletionDesc(typeDesc, gps); DeclaredTypes.Add(fullName, completion); } catch (PhpException) { if (old_throw) throw; } finally { throwExceptionOnError = old_throw; } return; } // a class of this name has already been declared PhpException.Throw(PhpError.Error, CoreResources.GetString("type_redeclared", existing.MakeFullName())); } /// <summary> /// Declares a generic PHP class or PHP interface. /// </summary> /// <param name="typeHandle">The <see cref="DTypeDesc"/> of the class/interface.</param> /// <param name="fullName">The name of the class.</param> /// <exception cref="PhpException">A class or interface of the given name has already been declared. (Error)</exception> [Emitted] public void DeclareType(RuntimeTypeHandle/*!*/ typeHandle, string/*!*/ fullName) { DeclareGenericType(PhpTypeDesc.Create(typeHandle), fullName); } public IList/*!*/ GetDeclaredClasses(IList/*!*/ result) { if (result == null) throw new ArgumentNullException("result"); // global interfaces: foreach (KeyValuePair<string, DTypeDesc> entry in applicationContext.Types) { if (!entry.Value.IsInterface) result.Add(entry.Key); } // local interfaces: foreach (KeyValuePair<string, DTypeDesc> entry in this.DeclaredTypes) { if (!entry.Value.IsInterface) result.Add(entry.Key); } return result; } public IList/*!*/ GetDeclaredInterfaces(IList/*!*/ result) { if (result == null) throw new ArgumentNullException("result"); // global interfaces: foreach (KeyValuePair<string, DTypeDesc> entry in applicationContext.Types) { if (entry.Value.IsInterface) result.Add(entry.Key); } // local interfaces: foreach (KeyValuePair<string, DTypeDesc> entry in this.DeclaredTypes) { if (entry.Value.IsInterface) result.Add(entry.Key); } return result; } /// <summary> /// Checks whether deferred type can be declared already at current point of execution. /// </summary> /// <param name="uid">Unique type identifier used in <see cref="IncompleteTypesInAdvance"/> hash table.</param> /// <param name="requiredBaseType">Type name required by this type declaration. If this is not declared yet, the type cannot be declared in advance.</param> /// <returns><c>True</c> iff preconditions are met and the type can be declared.</returns> [Emitted] public bool DeclareIncompleteTypeHelper(string/*!*/uid, string requiredBaseType) { Debug.Assert(!string.IsNullOrEmpty(uid)); if (requiredBaseType == null || this.ResolveType(requiredBaseType, null, null, null, ResolveTypeFlags.SkipGenericNameParsing) != null) { if (this.IncompleteTypesInAdvance == null) this.IncompleteTypesInAdvance = new HashSet<string>(); if (!this.IncompleteTypesInAdvance.Add(uid)) { // already declared! Debug.Fail("Deferred type already declared!"); // PHP Error will be thrown later when the type will be loaded into the context } return true; } else { return false; } } /// <summary> /// Checks whether specified incomplete type was already declared in the script beginning. /// </summary> /// <param name="uid">Unique type identifier used in <see cref="IncompleteTypesInAdvance"/> hash table.</param> /// <returns><c>True</c> iff the type was already declared and its declaration stub must not be called again.</returns> [Emitted] public bool IncompleteTypeDeclared(string/*!*/uid) { return this.IncompleteTypesInAdvance != null && this.IncompleteTypesInAdvance.Contains(uid); } #endregion #region Variables public PhpArray/*!*/ GlobalVariables { get { return (AutoGlobals.Globals.Value as PhpArray) ?? (PhpArray)(AutoGlobals.Globals.Value = new PhpArray()); } } /// <summary> /// Auto-global arrays. /// </summary> public readonly AutoGlobals AutoGlobals = new AutoGlobals(); #endregion #region Run-time Resolving /// <summary> /// Internally used for function lookup when we already have a candidate. /// </summary> /// <param name="routineHint">Hint.</param> /// <param name="fullName">Full name of the function to resolve.</param> /// <param name="nameContext">Current <see cref="NamingContext"/>.</param> /// <param name="quiet">Wheter to throw is the function cannot be resolved.</param> /// <returns><see cref="DRoutineDesc"/> or <c>null</c>.</returns> private DRoutineDesc ResolveFunctionWithHint(DRoutineDesc routineHint, string/*!*/ fullName, NamingContext nameContext, bool quiet) { if (IsFunctionDeclared(routineHint) && string.CompareOrdinal(routineHint.MakeFullName(), fullName) == 0) return routineHint; else return ResolveFunction(fullName, nameContext, quiet); } public DRoutineDesc ResolveFunction(string/*!*/ fullName, NamingContext nameContext, bool quiet) { DRoutineDesc result = SearchForName(DeclaredFunctions, applicationContext.Functions, fullName, nameContext); if (!quiet && result == null) PhpException.Throw(PhpError.Error, CoreResources.GetString("undefined_function_called", fullName)); return result; } public DRoutineDesc ResolveFunction(string/*!*/ fullName, NamingContext nameContext) { return ResolveFunction(fullName, nameContext, false); } /// <summary> /// Finds a PHP class or PHP interface (either user or system) of a given name. Resolves <c>self</c> and /// <c>parent</c> reserved class names. /// </summary> /// <param name="fullName">Name of the class to search for, without namespace prefix.</param> /// <returns>The <see cref="System.Type"/> or <B>null</B> if not found.</returns> public DTypeDesc ResolveType(string/*!*/ fullName) { return ResolveType(fullName, null, UnknownTypeDesc.Singleton, null, ResolveTypeFlags.UseAutoload | ResolveTypeFlags.PreserveFrame); } private DTypeDesc ResolveType(string/*!*/ fullName, NamingContext nameContext, DTypeDesc caller) { return ResolveType(fullName, nameContext, caller, null, ResolveTypeFlags.ThrowErrors | ResolveTypeFlags.SkipGenericNameParsing | ResolveTypeFlags.UseAutoload); } /// <summary> /// Finds a type (either user or system) of a given name. Resolves <c>self</c> and /// <c>parent</c> reserved class names. /// </summary> /// <param name="fullName">Name of the class/interface to search for, without namespace prefix, any case.</param> /// <param name="nameContext">Current naming context.</param> /// <param name="caller">Current class context.</param> /// <param name="genericArgs">Array of function type params. Stored in pairs in a form of [(string)name1,(DTypeDescs)type1, .., ..]. Can be null.</param> /// <param name="flags">Resolve type flags.</param> /// <returns>The <see cref="DTypeDesc"/> or <B>null</B> if not found.</returns> /// <exception cref="PhpException">The <paramref name="fullName"/> is <c>self</c> or <c>parent</c> but there is /// no class context. (Error)</exception> /// <exception cref="PhpException">The <paramref name="fullName"/> is <c>parent</c> but the current class has no parent. /// (Error)</exception> /// <exception cref="PhpException">The class is not found. (Error)</exception> public DTypeDesc ResolveType(string/*!*/ fullName, NamingContext nameContext, DTypeDesc caller, object[] genericArgs, ResolveTypeFlags flags) { if (fullName == null) throw new ArgumentNullException("fullName"); DTypeDesc type_desc; // self, parent: type_desc = ResolveSpecialTypeNames(/*lowercase_full_name*/fullName, caller, flags); if (type_desc != null) return type_desc; // type parameters (the requirement for exclamation mark prevents from misinterpreting // regular type name as a generic parameter name): if (fullName.Length > 0 && fullName[0] == '!') return ResolveGenericParameterType(fullName.Substring(1).ToLower(), caller, genericArgs); // regular types: type_desc = SearchForName(DeclaredTypes, applicationContext.Types, fullName, nameContext); if (type_desc != null) return type_desc; // try parse generic type name: if ((flags & ResolveTypeFlags.SkipGenericNameParsing) == 0) { type_desc = TryResolveGenericTypeName(fullName, nameContext, caller, genericArgs, flags); if (type_desc != null) return type_desc; } // try to invoke __autoload if ((flags & ResolveTypeFlags.UseAutoload) != 0) { if ((type_desc = ResolveTypeByAutoload(fullName, nameContext, caller, flags)) != null) return type_desc; } // Specified type could not be found if ((flags & ResolveTypeFlags.RemoveFrame) != 0) Stack.RemoveFrame(); if ((flags & ResolveTypeFlags.ThrowErrors) != 0) { PhpException.Throw(PhpError.Error, CoreResources.GetString("class_not_found", fullName)); } return null; } /// <summary> /// In case SPL autoload is enabled, invoke registered SPL autoload functions subsequently until /// specified type is declared. Otherwise try to invoke __autoload function to declare specified type. /// </summary> /// <param name="fullName">Name of the class/interface to search for, without namespace prefix, any case.</param> /// <param name="nameContext">Current naming context.</param> /// <param name="caller">Current class context.</param> /// <param name="flags">Resolve type flags.</param> /// <returns>The <see cref="DTypeDesc"/> or <B>null</B> if the class was not autoloaded.</returns> private DTypeDesc ResolveTypeByAutoload(string fullName, NamingContext nameContext, DTypeDesc caller, ResolveTypeFlags flags) { DTypeDesc resolved_type_desc = null; // result of the autoload if (pendingAutoloads == null) { this.pendingAutoloads = new List<string>(1); } else { if (this.pendingAutoloads.IndexOf(fullName, StringComparer.OrdinalIgnoreCase) >= 0) return null; // "Class '{0}' not found" } // recursion prevention this.pendingAutoloads.Add(fullName); // try to invoke autoload function and check fullName again if (IsSplAutoloadEnabled) { foreach (var callback in SplAutoloadFunctions) { if ((flags & ResolveTypeFlags.PreserveFrame) != 0) { PhpStack.CallState call_state = Stack.SaveCallState(); callback.Invoke(caller, new object[] { fullName }); Stack.RestoreCallState(call_state); } else { callback.Invoke(caller, new object[] { fullName }); } // search again if ((resolved_type_desc = SearchForName(DeclaredTypes, applicationContext.Types, fullName, nameContext)) != null) break; } } else { if (autoloadFunction == null) autoloadFunction = ResolveFunction(Name.AutoloadName.Value, null, true); if (autoloadFunction != null) { if ((flags & ResolveTypeFlags.PreserveFrame) != 0) { PhpStack.CallState call_state = Stack.SaveCallState(); Stack.AddFrame(fullName); autoloadFunction.Invoke(null, Stack); Stack.RestoreCallState(call_state); } else { Stack.AddFrame(fullName); autoloadFunction.Invoke(null, Stack); } // search again resolved_type_desc = SearchForName(DeclaredTypes, applicationContext.Types, fullName, nameContext); } } // recursion prevention end this.pendingAutoloads.RemoveLast(); // return found class description return resolved_type_desc; } /// <summary> /// Resolve generic parameter type. The type specified as a generic parameter. /// </summary> /// <param name="lowercaseFullName">The name of the generic parameter without the leading exclamation mark. The name is in lowercase.</param> /// <param name="caller">Current class context.</param> /// <param name="genericArgs">Array of function type params. Stored in pairs in a form of [(string)name1,(DTypeDescs)type1, .., ..]. Can be null.</param> /// <returns>The <see cref="DTypeDesc"/> or <B>null</B> if not found.</returns> private DTypeDesc ResolveGenericParameterType(string lowercaseFullName, DTypeDesc caller, object[] genericArgs) { // function/method params: if (genericArgs != null) { // get DTypeDesc from the function/method generic argument // it is faster to lookup in linear array in case of only few elements then to construct Dictionary for this for (int i = 0; i < genericArgs.Length; i += 2) { Debug.Assert(genericArgs[i] is string); Debug.Assert(genericArgs[i + 1] is DTypeDesc); if ((string)genericArgs[i] == lowercaseFullName) return (DTypeDesc)genericArgs[i + 1]; } } // type params: if (caller != null && caller.IsUnknown) caller = PhpStackTrace.GetClassContext(); // determine the caller if it was not known in compile time if (caller != null) return caller.GetGenericParameter(lowercaseFullName); // type could not be found return null; } /// <summary> /// Resolve <c>base</c> or <c>parent</c> class names in current class context. /// </summary> /// <param name="fullName">The name of class.</param> /// <param name="caller">Class context.</param> /// <param name="flags">Resolve type flags.</param> /// <returns>The <see cref="DTypeDesc"/> or <B>null</B> if the class was not autoloaded.</returns> /// <exception cref="PhpException">The <paramref name="fullName"/> is <c>self</c> or <c>parent</c> but there is /// no class context. (Error)</exception> /// <exception cref="PhpException">The <paramref name="fullName"/> is <c>parent</c> but the current class has no parent. /// (Error)</exception> private DTypeDesc ResolveSpecialTypeNames(string/*!*/ fullName, DTypeDesc caller, ResolveTypeFlags flags) { // check for 'self' reserved class name if (Name.SelfClassName.Equals(fullName)) { if (caller != null && caller.IsUnknown) caller = PhpStackTrace.GetClassContext(); // determine the caller if it was not known in compile time if (caller != null) return caller; // otherwise, caller is global code if ((flags & ResolveTypeFlags.RemoveFrame) != 0) Stack.RemoveFrame(); if ((flags & ResolveTypeFlags.ThrowErrors) != 0) { PhpException.Throw(PhpError.Error, CoreResources.GetString("self_accessed_out_of_class")); } return null; } // check for 'parent' reserved class name if (Name.ParentClassName.Equals(fullName)) { if (caller != null && caller.IsUnknown) caller = PhpStackTrace.GetClassContext(); // determine the caller if it was not known in compile time if (caller != null) { if (caller.Base != null) return caller.Base; // otherwise parent class accessed in parent-less class if ((flags & ResolveTypeFlags.RemoveFrame) != 0) Stack.RemoveFrame(); if ((flags & ResolveTypeFlags.ThrowErrors) != 0) { PhpException.Throw(PhpError.Error, CoreResources.GetString("parent_accessed_in_parentless_class")); } return null; } // otherwise, caller is global code if ((flags & ResolveTypeFlags.RemoveFrame) != 0) Stack.RemoveFrame(); if ((flags & ResolveTypeFlags.ThrowErrors) != 0) { PhpException.Throw(PhpError.Error, CoreResources.GetString("parent_accessed_out_of_class")); } return null; } return null; } /// <summary> /// Searches for a type in a given naming context. /// </summary> /// <param name="localTable"></param> /// <param name="globalTable"></param> /// <param name="fullName">Name of the type to search for.</param> /// <param name="nameContext">The naming context, in which the search should be performed.</param> /// <returns>The corresponding <see cref="DTypeDesc"/> or <B>null</B> if not found.</returns> private Desc SearchForName<Desc>( Dictionary<string, Desc>/*!*/ localTable, Dictionary<string, Desc>/*!*/ globalTable, string/*!*/ fullName, NamingContext nameContext) where Desc : DMemberDesc { Desc desc; // search in local and global tables: if (localTable.TryGetValue(fullName, out desc) || globalTable.TryGetValue(fullName, out desc)) return desc; //// if we have a naming context, use it //if (nameContext != null) //{ // bool debug_mode = Configuration.Application.Compiler.Debug; // Desc candidate; // string[] prefixes = nameContext.Prefixes; // for (int i = 0; i < prefixes.Length; i++) // { // string candidate_name = prefixes[i] + fullName; // // search in ClassDeclarators and application context // if (localTable.TryGetValue(candidate_name, out candidate) || // globalTable.TryGetValue(candidate_name, out candidate)) // { // if (debug_mode) // { // if (desc != null) // { // // ambiguity // PhpException.Throw(PhpError.Error, CoreResources.GetString("ambiguous_name_match", // fullName, desc.MakeFullName(), candidate_name)); // return null; // } // else desc = candidate; // } // else // { // // release mode: return the first candidate found // return candidate; // } // } // } //} return desc; } public DTypeDesc TryResolveGenericTypeName(string/*!*/ fullName, NamingContext nameContext, DTypeDesc caller, object[] genericArgs, ResolveTypeFlags flags) { if (!CheckGenericNameStructure(fullName)) return null; int i = 0; return ResolveGenericTypeName(ref i, fullName, nameContext, caller, genericArgs, flags); } /// <summary> /// <c>start</c> points to the first character of the substring to parse. /// <c>end</c> points to the one character behind the substring to parse. /// </summary> private DTypeDesc ResolveGenericTypeName(ref int i, string/*!*/ fullName, NamingContext nameContext, DTypeDesc caller, object[] genericArgs, ResolveTypeFlags flags) { int start = i; // find end of the type name: while (fullName[i] != '<' && fullName[i] != ',' && fullName[i] != '>') i++; if (fullName[i] == '>' && fullName[i - 1] == ':') i--; // resolve type name: DTypeDesc type_desc = ResolveType(fullName.Substring(start, i - start), nameContext, caller, genericArgs, flags | ResolveTypeFlags.SkipGenericNameParsing); if (type_desc == null || fullName[i] != '<') { if (type_desc != null && type_desc.IsGenericDefinition) return Operators.MakeGenericTypeInstantiation(type_desc, DTypeDesc.EmptyArray, 0); else return type_desc; } // skip '<' or '<:' i++; if (fullName[i] == ':') i++; // arguments: DTypeDesc[] args = new DTypeDesc[type_desc.GenericParameters.Length]; int arg_idx = 0; do { // a warning will be reported later, expand the array and go on: if (arg_idx == args.Length) Array.Resize(ref args, args.Length * 2 + 1); args[arg_idx] = ResolveGenericTypeName(ref i, fullName, nameContext, caller, genericArgs, flags); if (args[arg_idx] == null) return null; arg_idx++; } while (fullName[i++] == ','); Debug.Assert(fullName[i - 1] == ':' || fullName[i - 1] == '>'); // skip '>' or ':>' if (fullName[i - 1] == ':') i++; return Operators.MakeGenericTypeInstantiation(type_desc, args, arg_idx); } private bool CheckGenericNameStructure(string/*!*/ fullName) { int opens = 0; if (fullName.Length == 0 || fullName[fullName.Length - 1] != '>') return false; int i = 0; while (i < fullName.Length - 1) { if (fullName[i] == '<') { // invalid character preceding '<' if (i == 0 || (fullName[i - 1] == '<' || fullName[i - 1] == ':')) return false; opens++; } else if (fullName[i] == '>') { // invalid pairing: if (opens == 0) return false; // invalid character following the '>' if (fullName[i + 1] != '>' && fullName[i + 1] != ':' && fullName[i + 1] != ',') return false; opens--; } else if (fullName[i] == ':') { // namespace separator ':::' if (fullName[i + 1] == ':' && i + 2 < fullName.Length && fullName[i + 2] == ':') { i += 2; } else { // colon before first '<' if (opens == 0) return false; // either colon can be preceded by '<', or followed by '>' if (!((fullName[i - 1] == '<') ^ (fullName[i + 1] == '>'))) return false; } } else if (fullName[i] == ',') { // comma before first '<' or behind last '>' if (opens == 0) return false; } i++; } return opens == 1; } #endregion #region Error Reporting /// <summary> /// Whether to throw an exception on soft error (Notice, Warning, Strict). /// </summary> public bool ThrowExceptionOnError { get { return throwExceptionOnError; } set { throwExceptionOnError = value; } } private bool throwExceptionOnError = true; /// <summary> /// Gets whether error reporting is disabled or enabled. /// </summary> public bool ErrorReportingDisabled { get { return (errorReportingDisabled > 0) && !config.ErrorControl.IgnoreAtOperator; } } private int errorReportingDisabled = 0; /// <summary> /// Gets a value indicating a level of error reporting presented to user. /// </summary> public int ErrorReportingLevel { get { return ErrorReportingDisabled ? 0 : (int)config.ErrorControl.ReportErrors; } } /// <summary> /// Disables error reporting. Can be called for multiple times. To enable reporting again /// <see cref="EnableErrorReporting"/> should be called as many times as <see cref="DisableErrorReporting"/> was. /// </summary> [Emitted] public void DisableErrorReporting() { errorReportingDisabled++; } /// <summary> /// Enables error reporting disabled by a single call to <see cref="DisableErrorReporting"/>. /// </summary> [Emitted] public void EnableErrorReporting() { if (errorReportingDisabled > 0) errorReportingDisabled--; } /// <summary> /// Last error type set by the <see cref="PhpException.Throw"/>. /// </summary> public PhpError LastErrorType { get; internal set; } /// <summary> /// Last error message set by the <see cref="PhpException.Throw"/>. /// </summary> public string LastErrorMessage { get; internal set; } /// <summary> /// Last error file set by the <see cref="PhpException.Throw"/>. /// </summary> public string LastErrorFile { get; internal set; } /// <summary> /// Last error line set by the <see cref="PhpException.Throw"/>. /// </summary> public int LastErrorLine { get; internal set; } #endregion #region Output Control, Echo // sinks where buffered output is flushed: private TextWriter textSink; private Stream streamSink; /// <summary> /// Buffered output associated with the request. /// </summary> public BufferedOutput/*!*/BufferedOutput { get { // Initialize lazily as not buffered output by default. return bufferedOutput ?? (bufferedOutput = new BufferedOutput(false, this.textSink, this.streamSink, Configuration.Application.Globalization.PageEncoding)); } } /// <remarks>Is <c>null</c> reference until it is not used for the first time.</remarks> private BufferedOutput bufferedOutput; /// <summary> /// Stream where text output will be sent. /// </summary> public TextWriter Output { get { return output; } set { this.textSink = value; if (bufferedOutput != null) bufferedOutput.CharSink = value; if (!IsOutputBuffered) output = value; } } private TextWriter output; /// <summary> /// Stream where binary output will be sent. /// </summary> public Stream OutputStream { get { return binaryOutput; } set { this.streamSink = value; if (bufferedOutput != null) bufferedOutput.ByteSink = value; if (bufferedOutput == null || binaryOutput != bufferedOutput.Stream) // if output is not buffered binaryOutput = value; } } internal Stream binaryOutput; /// <summary> /// Specifies whether script output is passed through <see cref="BufferedOutput"/>. /// </summary> public bool IsOutputBuffered { get { return output == bufferedOutput; } set { if (value) { output = bufferedOutput ?? (bufferedOutput = new BufferedOutput(true, this.textSink, this.streamSink, Configuration.Application.Globalization.PageEncoding)); binaryOutput = bufferedOutput.Stream; } else { output = textSink; binaryOutput = streamSink; } } } #region Echo /// <summary> /// Writes data to the current output. /// </summary> /// <param name="value">Data to be written.</param> /// <param name="scriptcontext">Current script context.</param> [Emitted] public static void Echo(object value, ScriptContext scriptcontext) { if (value == null) return; if (value.GetType() == typeof(PhpBytes)) { Echo((PhpBytes)value, scriptcontext); } else { Echo(Convert.ObjectToString(value), scriptcontext); } } ///// <summary> ///// Writes data to the current output. ///// </summary> ///// <param name="values">An array of object to be written to output.</param> ///// <exception cref="ArgumentNullException"><paramref name="values"/> is a <B>null</B> reference.</exception> //[Emitted] //public static void Echo(params object[] values, ScriptContext scriptcontext) //{ // if (values == null) // throw new ArgumentNullException("values"); // for (int i = 0; i < values.Length; i++) // Echo(values[i]); //} /// <summary> /// Writes <see cref="PhpBytes" /> data to the current output. /// </summary> /// <param name="value">Data to be written.</param> /// <param name="scriptcontext">Current script context.</param> [Emitted] public static void Echo(PhpBytes value, ScriptContext/*!*/scriptcontext) { int length; if (value != null && (length = value.Length) > 0) scriptcontext.binaryOutput.Write(value.ReadonlyData, 0, length); } /// <summary> /// Writes <see cref="string" /> to the current output. /// </summary> /// <param name="value">The string to be written.</param> /// <param name="scriptcontext">Current script context.</param> [Emitted] public static void Echo(string value, ScriptContext/*!*/scriptcontext) { scriptcontext.output.Write(value); } /// <summary> /// Writes <see cref="bool" /> to the current output. /// </summary> /// <param name="value">The boolean to be written.</param> /// <param name="scriptcontext">Current script context.</param> [Emitted] public static void Echo(bool value, ScriptContext/*!*/scriptcontext) { if (value) scriptcontext.output.Write('1'); } /// <summary> /// Writes <see cref="int" /> to the current output. /// </summary> /// <param name="value">The integer to be written.</param> /// <param name="scriptcontext">Current script context.</param> [Emitted] public static void Echo(int value, ScriptContext/*!*/scriptcontext) { scriptcontext.output.Write(value.ToString()); } /// <summary> /// Writes <see cref="long"/> to the current output. /// </summary> /// <param name="value">The long integer to be written.</param> /// <param name="scriptcontext">Current script context.</param> [Emitted] public static void Echo(long value, ScriptContext/*!*/scriptcontext) { scriptcontext.output.Write(value.ToString()); } /// <summary> /// Writes <see cref="double"/> to the current output. /// </summary> /// <param name="value">The double to be written.</param> /// <param name="scriptcontext">Current script context.</param> [Emitted] public static void Echo(double value, ScriptContext/*!*/scriptcontext) { scriptcontext.output.Write(Convert.DoubleToString(value)); } #endregion /*#region Echo (static wrappers) [Emitted] public static void Echo(object value, ScriptContext scriptcontext) { scriptcontext.Echo(value); } [Emitted] public static void Echo(PhpBytes value, ScriptContext scriptcontext) { scriptcontext.Echo(value); } /// <summary> /// Writes <see cref="string"/> to the current output. /// </summary> /// <param name="value">The string to be written.</param> /// <param name="scriptcontext">Current ScriptContext to be used.</param> [Emitted] public static void Echo(string value, ScriptContext scriptcontext) { scriptcontext.Echo(value); } /// <summary> /// Writes <see cref="bool"/> to the current output. /// </summary> /// <param name="value">The boolean to be written.</param> /// <param name="scriptcontext">Current ScriptContext to be used.</param> [Emitted] public static void Echo(bool value, ScriptContext scriptcontext) { scriptcontext.Echo(value); } /// <summary> /// Writes <see cref="int"/> to the current output. /// </summary> /// <param name="value">The integer to be written.</param> /// <param name="scriptcontext">Current ScriptContext to be used.</param> [Emitted] public static void Echo(int value, ScriptContext scriptcontext) { scriptcontext.Echo(value); } /// <summary> /// Writes <see cref="long"/> to the current output. /// </summary> /// <param name="value">The long integer to be written.</param> /// <param name="scriptcontext">Current ScriptContext to be used.</param> [Emitted] public static void Echo(long value, ScriptContext scriptcontext) { scriptcontext.Echo(value); } /// <summary> /// Writes <see cref="double"/> to the current output. /// </summary> /// <param name="value">The double to be written.</param> /// <param name="scriptcontext">Current ScriptContext to be used.</param> [Emitted] public static void Echo(double value, ScriptContext scriptcontext) { scriptcontext.Echo(value); } #endregion*/ #endregion #region Script Termination, Timeouts, GuardedCall /// <summary> /// A timer used for timeouting the request in the manner of PHP. /// </summary> private Timer timer; /// <summary> /// Returns <B>true</B> if the main script code has been timed out. /// </summary> public bool ExecutionTimedOut { get { return executionTimedOut; } } private bool executionTimedOut = false; /// <summary> /// Updates a value of <see cref="LocalConfiguration.RequestControlSection.ExecutionTimeout"/> /// in the current configuration record and adjusts the active timer (if any). /// </summary> /// <param name="seconds">Timeout in seconds, non-positive values mean no timeout.</param> public void ApplyExecutionTimeout(int seconds) { config.RequestControl.ExecutionTimeout = seconds; if (timer != null) { timer.Change(config.RequestControl.ExecutionTimeoutForTimer, Timeout.Infinite); } } /// <summary> /// Calls a specified routine in limited time and termination exceptions being caught /// (i.e. <see cref="ScriptDiedException"/> and <see cref="ThreadAbortException"/>). /// </summary> /// <param name="routine">A routine to be called.</param> /// <param name="data">Data passed to the routine.</param> /// <param name="allowUserExceptions">Whether user exceptions are allowed to be thrown by the target.</param> /// <exception cref="PhpNetInternalException">Internal error.</exception> internal TResult GuardedCall<TData, TResult>(Converter<TData, TResult> routine, TData data, bool allowUserExceptions) { Library.SPL.Exception user_exception = null; try { // do not timeout script which is being debugged: if (Debugger.IsAttached) // TODO: long compilation time { return routine(data); } else { using (timer = new Timer(new TimerCallback(TimedOut), Thread.CurrentThread, config.RequestControl.ExecutionTimeoutForTimer, Timeout.Infinite)) { return routine(data); } } } catch (ScriptDiedException) { // die or exit has been called or connections has been aborted } catch (ThreadAbortException) { if (!executionTimedOut) throw; ThreadAbortedDueToTimeout(); } catch (PhpException) { // an error occurred -> we shell continue with execution } catch (PhpUserException e) { user_exception = e.UserException; } catch (Exception e) { throw new PhpNetInternalException("Guarded call", e); } finally { timer = null; } if (user_exception != null) { string str_exception = null; string error_id = null; // try execute user exception handler (if allowed and set): if (allowUserExceptions) { if (config.ErrorControl.UserExceptionHandler != null) { // calls uncaught-exception user handler: GuardedCall<Library.SPL.Exception, object>(CallUserExceptionHandler, user_exception, false); } else { error_id = "uncaught_exception"; // gets exception string representation: str_exception = GuardedCall<Library.SPL.Exception, string>(CallUserExceptionToString, user_exception, false); // null can be returned on time out or if there is an error during guarded call: if (str_exception == null) str_exception = user_exception.BaseToString(); } } else { error_id = "exception_cannot_be_thrown"; // does not call __toString to prevent infinite recursion: str_exception = user_exception.BaseToString(); } // reports an error (doesn't throw an exception since execution should continue): if (error_id != null) { bool old_throw = ThrowExceptionOnError; ThrowExceptionOnError = false; PhpException.Throw(PhpError.Error, CoreResources.GetString(error_id, str_exception)); ThrowExceptionOnError = old_throw; } } return default(TResult); } /// <summary> /// Calls user eception handler. /// </summary> private object CallUserExceptionHandler(PHP.Library.SPL.Exception/*!*/ e) { Debug.Assert(config.ErrorControl.UserExceptionHandler != null); config.ErrorControl.UserExceptionHandler.Invoke(e); return null; } /// <summary> /// Get user exception string representation. /// </summary> private string CallUserExceptionToString(Library.SPL.Exception/*!*/ e) { //Debug.Assert(e is Library.SPL.Exception); return (string)e.__toString(this); } // GENERICS: lambda private object GuardedMain(object/*!*/ mainRoutine) { RoutineDelegate user_main = mainRoutine as RoutineDelegate; if (user_main != null) { return user_main(null, this.Stack); } else { return ((MainRoutineDelegate)mainRoutine)( this, null, // no local variables null, // no object context (makes $this use illegal) null, // no class context (makes protected and private members of all classes inaccessible) true); } } /// <summary> /// Flushes all remaining data from output buffers. /// </summary> internal object FinalizeBufferedOutput(object _) { // flushes output, applies user defined output filter, and disables buffering: if (bufferedOutput != null) bufferedOutput.FlushAll(); // redirects sinks: IsOutputBuffered = false; return null; } /// <summary> /// Called when the execution has been timed out. /// </summary> private void ThreadAbortedDueToTimeout() { Debug.Assert(executionTimedOut); #if !SILVERLIGHT Thread.ResetAbort(); #endif bool old_throw = ThrowExceptionOnError; ThrowExceptionOnError = false; PhpException.Throw(PhpError.Error, CoreResources.GetString("execution_timed_out", config.RequestControl.ExecutionTimeout)); ThrowExceptionOnError = old_throw; } // GENERICS: Lambda private void TimedOut(object/*!*/ thread) { executionTimedOut = true; ((Thread)thread).Abort(); } /// <summary> /// Implements language construct exit/die. /// </summary> /// <param name="status">The status returned by script's Main() method. Can be a <B>null</B> reference.</param> /// <remarks> /// Prints the <paramref name="status"/> if it is of <see cref="string"/> type. /// </remarks> [Emitted] public void Die(object status) { // prints status (only if status is PHP string): PhpBytes bytes; if ((bytes = status as PhpBytes) != null) ScriptContext.Echo(bytes, this); else ScriptContext.Echo(PhpVariable.AsString(status), this); // terminates script execution: throw new ScriptDiedException(status); } #endregion #region Shutdown Callbacks /// <summary> /// User defined post-request callbacks. /// Can be a <B>null</B> reference which means no shutdown callback has ever been registered. /// </summary> private Queue shutdownCallbacks; // <PhpCallbackParameterized> /// <summary> /// Adds new user callback to the list of callbacks called on script termination. /// </summary> /// <param name="callback">The callback to register.</param> /// <param name="parameters">Parameters for the callback.</param> /// <exception cref="ArgumentNullException"><paramref name="callback"/> is a <B>null</B> reference.</exception> public void RegisterShutdownCallback(PhpCallback/*!*/ callback, params object[] parameters) { if (callback == null) throw new ArgumentNullException("callback"); if (shutdownCallbacks == null) shutdownCallbacks = new Queue(); shutdownCallbacks.Enqueue(new PhpCallbackParameterized(callback, parameters)); } /// <summary> /// Processes shutdown callbacks registered by a user. /// </summary> /// <exception cref="PhpException">An error occured during execution of the callbacks.</exception> /// <exception cref="PhpUserException">Uncaught exception has been raised by some callback.</exception> /// <exception cref="ScriptDiedException">Script died or exited.</exception> /// <exception cref="PhpNetInternalException">Internal error.</exception> public object ProcessShutdownCallbacks(object _) { if (shutdownCallbacks != null) { while (shutdownCallbacks.Count > 0) { ((PhpCallbackParameterized)shutdownCallbacks.Dequeue()).Invoke(null/*class context is null*/); } } return null; } #endregion #region PhpObject Finalization /// <summary> /// List of weak references to <see cref="DObject"/> instances that should be finalized when current request is over. /// Lazily constructed. /// </summary> /// <remarks> /// Objects are finalized as their memory is about to be reclaimed by the GC during the request/app /// processing. This list ensures that all instantiated objects are finalized before the request is /// finished. /// </remarks> private List<WeakReference> objectsToBeFinalized; private int finalizationCheckCounter; /// <summary> /// Registers a <see cref="DObject"/> instance for finalization. /// </summary> /// <param name="obj">The object.</param> [Emitted] public void RegisterDObjectForFinalization(DObject/*!*/ obj) { Debug.Assert(obj != null); #if SILVERLIGHT bool registerFinalizer = true; #else bool registerFinalizer = !System.Runtime.Remoting.RemotingServices.IsTransparentProxy(this); #endif if (registerFinalizer) { if (objectsToBeFinalized == null) objectsToBeFinalized = new List<WeakReference>(); objectsToBeFinalized.Add(new WeakReference(obj, true)); if (++finalizationCheckCounter > 65536) { finalizationCheckCounter = 0; int count = objectsToBeFinalized.Count; long list_memory = count * 3 * Marshal.SizeOf(typeof(IntPtr)); // don't let the list occupy more than 10% of allocated memory if (list_memory > GC.GetTotalMemory(false) / 10) { List<WeakReference> new_list = new List<WeakReference>(count / 4); for (int i = 0; i < count; i++) { WeakReference reference = objectsToBeFinalized[i]; if (reference.IsAlive) new_list.Add(reference); } objectsToBeFinalized = new_list; } } } } /// <summary> /// Calls <c>__destruct</c> on <see cref="DObject"/> instances that have been created in this context. /// </summary> /// <param name="_">Dummy.</param> internal object FinalizePhpObjects(object _) { if (objectsToBeFinalized != null) { for (int i = 0; i < objectsToBeFinalized.Count; i++) { WeakReference reference = objectsToBeFinalized[i]; // remove object from finalization list to prevent its repeated finalization // (for the case the finalization is interrupted by exception and resumed later): objectsToBeFinalized[i] = null; DObject obj = null; if (reference != null && reference.IsAlive) { try { obj = (DObject)reference.Target; } catch (InvalidOperationException) { } } if (obj != null) obj.Dispose(); } objectsToBeFinalized = null; } return null; } #endregion #region Graph Walking Callbacks /// <summary> /// Cached class context used when acquiring objects. /// </summary> private DTypeDesc classContext; /// <summary> /// If <see cref="classContext"/> has not been set, this field is <B>true</B> /// (<B>null</B> is a valid value for <see cref="classContext"/>). /// </summary> private bool classContextIsValid; /// <summary> /// Called for each object that implements the <see cref="IPhpObjectGraphNode"/> interface when /// releasing an object graph (e.g. when storing variables to InProc session). /// </summary> /// <param name="node">The object that should be released.</param> /// <param name="context">Current <see cref="ScriptContext"/>.</param> /// <returns>The released object (might be different from <paramref name="node"/>).</returns> internal object ReleaseObject(IPhpObjectGraphNode node, ScriptContext context) { DObject obj = node as DObject; if (obj != null) { bool sleep_called; if (!classContextIsValid) { classContext = PhpStackTrace.GetClassContext(); classContextIsValid = true; } PhpArray sleep_result = obj.Sleep(classContext, context, out sleep_called); // if __sleep does not return a valid array, the object dies completely if (sleep_called && sleep_result == null) return null; if (sleep_result != null) { // create a new instance DObject new_instance = (DObject)obj.TypeDesc.New(this); // copy values of the properties whose names have been returned by __sleep foreach (KeyValuePair<IntStringKey, object> pair in sleep_result) { string name = Convert.ObjectToString(pair.Value); string type_name; PhpMemberAttributes visibility; string field_name = Serialization.ParsePropertyName(name, out type_name, out visibility); DTypeDesc declarer; if (type_name == null) { declarer = obj.TypeDesc; } else { declarer = ResolveType(type_name); if (declarer == null) declarer = obj.TypeDesc; } // copy the field value object val = obj.GetProperty(field_name, declarer); new_instance.SetProperty(field_name, val, declarer); } return new_instance; } return obj; } // nullify resources PhpResource res = node as PhpResource; if (res != null) return 0; return node; } /// <summary> /// Called for each object that implements the <see cref="IPhpObjectGraphNode"/> interface when /// acquiring an object graph (e.g. when retrieving variables from InProc session). /// </summary> /// <param name="node">The object that should be acquired.</param> /// <param name="context">Current <see cref="ScriptContext"/>.</param> /// <returns>The acquired object (always <paramref name="node"/>).</returns> internal object AcquireObject(IPhpObjectGraphNode node, ScriptContext context) { DObject obj = node as DObject; if (obj != null) { if (!classContextIsValid) { classContext = PhpStackTrace.GetClassContext(); classContextIsValid = true; } obj.Wakeup(classContext, context); } return node; } /// <summary> /// Call <c>__wakeup</c> recursively on <see cref="PhpObject"/>s contained in the array. /// </summary> internal void AcquireArray(PhpArray array) { Debug.Assert(array != null); classContextIsValid = false; array.Walk(new PhpWalkCallback(AcquireObject), this); } /// <summary> /// Call <c>__sleep</c> recursively on <see cref="PhpObject"/>s contained in the array. /// </summary> internal void ReleaseArray(PhpArray array) { Debug.Assert(array != null); classContextIsValid = false; array.Walk(new PhpWalkCallback(ReleaseObject), this); } #endregion #region Static Locals /// <summary> /// Gets a value of a static local. For internal use only. /// </summary> /// <param name="id">The index of a static local. Index starts with 1.</param> /// <returns>Value of the local or <B>null</B>.</returns> [Emitted, EditorBrowsable(EditorBrowsableState.Never)] public PhpReference GetStaticLocal(int id) { return (staticLocals != null && id > 0 && id <= staticLocals.Count) ? staticLocals[id - 1] : null; } /// <summary> /// Get the index of specified local variable. /// </summary> /// <param name="id">Compound name of a static local (in format {simple function name}${local name index}).</param> /// <returns>The static local integer index.</returns> [Emitted, EditorBrowsable(EditorBrowsableState.Never)] public static int GetStaticLocalId(string/*!*/ id) { Debug.Assert(!string.IsNullOrEmpty(id)); return staticLocalsId.Get(id); } /// <summary> /// Adds a local into the static local table. For internal use only. /// </summary> /// <param name="id">The index of a static local. Index starts with 1.</param> /// <param name="value">A value of local (not a reference).</param> /// <returns>A reference containing the <paramref name="value"/>.</returns> [Emitted, EditorBrowsable(EditorBrowsableState.Never)] public PhpReference/*!*/ AddStaticLocal(int id, object value) { Debug.Assert(id > 0, "Uninitialized static local variable index!"); Debug.Assert(!(value is PhpReference)); Debug.Assert(id <= staticLocalsId.Count); // ensure the staticLocals if (staticLocals == null) staticLocals = new List<PhpReference>(staticLocalsId.Count); // ensure the Size while (id > staticLocals.Count) staticLocals.Add(null); // set the element on index id return (staticLocals[id - 1] = new PhpReference(value)); } #endregion #region Initialization of requests and applications /// <summary> /// Sets a main script of the application. /// </summary> /// <param name="script">The script related to the <c>sourceFile</c>.</param> /// <param name="sourceFile">The file path of the <c>script</c>.</param> private void DefineMainScript(ScriptInfo/*!*/ script, PhpSourceFile/*!*/ sourceFile) { Debug.Assert(mainScriptFile == null, "Main script redefined."); scripts.Add(sourceFile.FullPath.ToString(), script); mainScriptFile = sourceFile; mainScriptInfo = script; // preallocate ScriptContext's dictionaries: DeclaredFunctionsAllocate(script.MaxDeclaredFunctionsCount); DeclaredTypesAllocate(script.MaxDeclaredTypesCount); } #endregion #region Eval /// <summary> /// Contains captured line number. /// </summary> [Emitted] public int EvalLine = -1; /// <summary> /// Contains captured column number. /// </summary> [Emitted] public int EvalColumn = -1; /// <summary> /// Contains captured eval id. /// </summary> [Emitted] public int EvalId = -1; /// <summary> /// Contains captured relative source file packed path. /// </summary> [Emitted] public string EvalRelativeSourcePath; /// <summary> /// Gets captured eval info. Eval info on a script context is updated by /// a code injected to generated code by the compiler. /// </summary> /// <returns>The captured eval info.</returns> /// <remarks> /// Eval info is captured before a class library function call if it is implemented with option /// <see cref="FunctionImplOptions.CaptureEvalInfo"/> and a part of it (line, column) is updated /// in every sequence point in debug mode. Should be called on the beginning of the function implementetion. /// Can be called even if the info will not be needed eventually. /// </remarks> public SourceCodeDescriptor GetCapturedSourceCodeDescriptor() { return new SourceCodeDescriptor(EvalRelativeSourcePath, EvalId, EvalLine, EvalColumn); } /// <summary> /// Clears the info. /// </summary> internal void ClearCapturedSourceCodeDescriptor() { EvalLine = EvalColumn = EvalId = -1; EvalRelativeSourcePath = null; } #endregion #region Setter Chains /// <summary> /// A stack of <see cref="PhpRuntimeChain"/>s that are currently being processed. /// </summary> /// <remarks> /// <para> /// <see cref="PhpRuntimeChain"/>s are maintained in a stack in order to support nested operator chains. /// </para> /// <para> /// Every time the <see cref="Operators.EnsurePropertyIsArray"/> or <see cref="Operators.EnsurePropertyIsObject"/> /// is called on a system class with overloaded member access (<B>__set</B> and/or <B>__get</B>), a new /// <see cref="PhpRuntimeChain"/> is pushed to the stack (<see cref="BeginSetterChain"/>). /// </para> /// <para> /// If a setter chain has been created, the consequent chaining operators just record field and item names /// to it (<see cref="ExtendSetterChain"/>). The last operator calls <see cref="FinishSetterChain"/> which /// causes the recorded data to be passed to the <B>__set</B> handler and the <see cref="PhpRuntimeChain"/> /// popped from the stack. /// </para> /// </remarks> private Stack setterChainStack; // GENERICS: <SetterChain> /// <summary> /// Singleton instance of <see cref="PhpObject"/> passed among chaining operators to indicate that /// they are part of a setter chain. /// </summary> internal static PhpObject SetterChainSingletonObject = new Library.stdClass(null); /// <summary> /// Singleton instance of <see cref="PhpArray"/> passed among chaining operators to indicate that /// they are part of a setter chain. /// </summary> internal static PhpSetterChainArray SetterChainSingletonArray = new PhpSetterChainArray(); /// <summary> /// Creates a new setter chain. Called from <see cref="Operators.EnsurePropertyIsArray"/> and /// <see cref="Operators.EnsurePropertyIsObject"/> when a field of a system class with overloaded member /// access should be ensured. /// </summary> /// <param name="obj">The instance on which the setter chain is applied.</param> internal void BeginSetterChain(DObject obj) { PhpRuntimeChain chain = new PhpRuntimeChain(obj); if (setterChainStack == null) setterChainStack = new Stack(); setterChainStack.Push(chain); } /// <summary> /// Adds a new element to the current setter chain. Called from chaining operators that can follow /// <see cref="Operators.EnsurePropertyIsArray"/> or <see cref="Operators.EnsurePropertyIsObject"/> when /// they detect they are part of a setter chain. /// </summary> /// <param name="elem">The setter chain element to add.</param> internal void ExtendSetterChain(RuntimeChainElement elem) { PhpRuntimeChain chain = (PhpRuntimeChain)setterChainStack.Peek(); chain.Add(elem); } /// <summary> /// Pops the current setter chain without invoking the setter. /// </summary> /// <param name="quiet">Whether not to report an error.</param> internal void AbortSetterChain(bool quiet) { setterChainStack.Pop(); if (!quiet) PhpException.Throw(PhpError.Error, CoreResources.GetString("undefined_property_when_access_overloaded")); } /// <summary> /// Passes the current setter chain to the setter and pops the setter chain. Called from chaining /// operators that conclude the chain that might contain <see cref="Operators.EnsurePropertyIsArray"/> or /// <see cref="Operators.EnsurePropertyIsObject"/> when they detect they are part of a setter chain. /// </summary> /// <param name="value">The value that should be assigned to the field/item represented by the last /// setter chain element.</param> internal void FinishSetterChain(object value) { Debug.Assert(!(value is PhpReference)); PhpRuntimeChain chain = (PhpRuntimeChain)setterChainStack.Pop(); Debug.Assert(chain.Variable is PhpObject, "SetterChain must begin with a PhpObject"); PhpObject instance = (PhpObject)chain.Variable; if (!instance.InvokeSetter(chain.Chain, value)) { // if the setter could not be invoked, pretend that we didn't even try to arrange // this silly meat cube O:-] PhpException.Throw(PhpError.Error, CoreResources.GetString("undefined_property_when_access_overloaded")); } } #endregion #region Interop /// <summary> /// Calls a PHP function. Intended for use from other languages. /// </summary> /// <param name="functionName">Name of the function.</param> /// <param name="arguments">Arguments.</param> /// <returns>Function call result.</returns> public PhpReference/*!*/ Call(string/*!*/ functionName, params object[] arguments) { return Call(functionName, null, null, arguments); } /// <summary> /// Calls a PHP function. Intended for use from other languages. /// </summary> /// <param name="functionName">Name of the function.</param> /// <param name="namingContext">Naming context within which the name is resolved (namespaces and aliases). Can be <B>null</B>.</param> /// <param name="callerLocalVariables">Table of the caller's variables. Can be <B>null</B>.</param> /// <param name="arguments">Arguments.</param> /// <returns>Function call result.</returns> public PhpReference/*!*/ Call(string/*!*/ functionName, NamingContext namingContext, Dictionary<string, object> callerLocalVariables, params object[] arguments) { if (functionName == null) throw new ArgumentNullException("functionName"); if (arguments == null) throw new ArgumentNullException("arguments"); DRoutineDesc routineHint = null; Stack.AddFrame(arguments); return Call(callerLocalVariables, namingContext, functionName, null, ref routineHint, this); } /// <summary> /// Creates and instance of a PHP class. Intended for use from other languages. /// </summary> /// <param name="className">Name of the class to instantiate.</param> /// <param name="ctorArguments">Constructor arguments.</param> /// <returns>The new instance or <B>null</B> on error.</returns> public object NewObject(string/*!*/ className, params object[] ctorArguments) { return NewObject(className, null, ctorArguments); } /// <summary> /// Creates and instance of a PHP class. Intended for use from other languages. /// </summary> /// <param name="className">Name of the class to instantiate.</param> /// <param name="namingContext">Naming context within which the name is resolved (namespaces and aliases). Can be <B>null</B>.</param> /// <param name="ctorArguments">Constructor arguments.</param> /// <returns>The new instance or <B>null</B> on error.</returns> public object NewObject(string/*!*/ className, NamingContext namingContext, params object[] ctorArguments) { if (className == null) throw new ArgumentNullException("className"); if (ctorArguments == null) throw new ArgumentNullException("ctorArguments"); Stack.AddFrame(ctorArguments); return Operators.New(ResolveType(className), null, this, namingContext); } #endregion #region GlobalScope private Utilities.GlobalScope globalScope; public Utilities.GlobalScope Globals { get { if (globalScope == null) globalScope = new Utilities.GlobalScope(this); return globalScope; } } #endregion #region IDisposable /// <summary> /// Disposes this instance of <see cref="ScriptContext"/>, /// calls PHP shutdown functions, finalizes PHP objects and finalizes buffer output. /// </summary> void IDisposable.Dispose() { if (!disposed) { try { this.GuardedCall<object, object>(this.ProcessShutdownCallbacks, null, false); this.GuardedCall<object, object>(this.FinalizePhpObjects, null, false); this.GuardedCall<object, object>(this.FinalizeBufferedOutput, null, false); // additional disposal action if (this.TryDispose != null) this.TryDispose(); } finally { // additional disposal action if (this.FinallyDispose != null) this.FinallyDispose(); if (object.ReferenceEquals(this, CurrentContext)) CurrentContext = null; // remember the max capacity of dictionaries to preallocate next time: if (this.MainScriptInfo != null) this.MainScriptInfo.SaveMaxCounts(this); // clear context data this.Properties.ClearProperties(); // this.disposed = true; } } } #endregion } }
DEVSENSE/Phalanger
Source/Core/ScriptContext.cs
C#
apache-2.0
120,766
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * Reference counted string algorithms. * * These are used for various internal strings which get copied multiple times. * */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5RSprivate.h" /* Reference-counted strings */ /* Private typedefs & structs */ struct H5RS_str_t { char *s; /* String to be reference counted */ unsigned wrapped; /* Indicates that the string to be ref-counted is not copied */ unsigned n; /* Reference count of number of pointers sharing string */ }; /* Declare a free list to manage the H5RS_str_t struct */ H5FL_DEFINE_STATIC(H5RS_str_t); /* Declare the PQ free list for the wrapped strings */ H5FL_BLK_DEFINE(str_buf); /*-------------------------------------------------------------------------- NAME H5RS_xstrdup PURPOSE Duplicate the string being reference counted USAGE char *H5RS_xstrdup(s) const char *s; IN: String to duplicate RETURNS Returns a pointer to a new string on success, NULL on failure. DESCRIPTION Duplicate a string buffer being reference counted. Use this instead of [H5MM_][x]strdup, in order to use the free-list memory routines. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ static char * H5RS_xstrdup(const char *s) { char *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR if(s) { size_t len = HDstrlen(s) + 1; ret_value = (char *)H5FL_BLK_MALLOC(str_buf, len); HDassert(ret_value); HDstrncpy(ret_value, s, len); } /* end if */ else ret_value = NULL; FUNC_LEAVE_NOAPI(ret_value) } /* end H5RS_xstrdup() */ /*-------------------------------------------------------------------------- NAME H5RS_create PURPOSE Create a reference counted string USAGE H5RS_str_t *H5RS_create(s) const char *s; IN: String to initialize ref-counted string with RETURNS Returns a pointer to a new ref-counted string on success, NULL on failure. DESCRIPTION Create a reference counted string. The string passed in is copied into an internal buffer. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * H5RS_create(const char *s) { H5RS_str_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Allocate ref-counted string structure */ if(NULL == (ret_value = H5FL_MALLOC(H5RS_str_t))) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ ret_value->s = H5RS_xstrdup(s); ret_value->wrapped = 0; ret_value->n = 1; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5RS_create() */ /*-------------------------------------------------------------------------- NAME H5RS_wrap PURPOSE "Wrap" a reference counted string around an existing string USAGE H5RS_str_t *H5RS_wrap(s) const char *s; IN: String to wrap ref-counted string around RETURNS Returns a pointer to a new ref-counted string on success, NULL on failure. DESCRIPTION Wrap a reference counted string around an existing string, which is not duplicated, unless its reference count gets incremented. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * H5RS_wrap(const char *s) { H5RS_str_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Allocate ref-counted string structure */ if(NULL == (ret_value = H5FL_MALLOC(H5RS_str_t))) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ ret_value->s = (char *)s; ret_value->wrapped = 1; ret_value->n = 1; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5RS_wrap() */ /*-------------------------------------------------------------------------- NAME H5RS_own PURPOSE Transfer ownership of a regular string to a reference counted string USAGE H5RS_str_t *H5RS_own(s) const char *s; IN: String to transfer ownership of RETURNS Returns a pointer to a new ref-counted string on success, NULL on failure. DESCRIPTION Transfer ownership of a dynamically allocated string to a reference counted string. The routine which passed in the string should not attempt to free it, the reference counting string routines will do that when the reference count drops to zero. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * H5RS_own(char *s) { H5RS_str_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Allocate ref-counted string structure */ if(NULL == (ret_value = H5FL_MALLOC(H5RS_str_t))) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ ret_value->s = s; ret_value->wrapped = 0; ret_value->n = 1; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5RS_own() */ /*-------------------------------------------------------------------------- NAME H5RS_decr PURPOSE Decrement the reference count for a ref-counted string USAGE herr_t H5RS_decr(rs) H5RS_str_t *rs; IN/OUT: Ref-counted string to decrement count of RETURNS Non-negative on success/Negative on failure DESCRIPTION Decrement the reference count for a reference counted string. If the reference count drops to zero, the reference counted string is deleted. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ herr_t H5RS_decr(H5RS_str_t *rs) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(rs); HDassert(rs->n > 0); /* Decrement reference count for string */ if((--rs->n) == 0) { if(!rs->wrapped) rs->s = (char *)H5FL_BLK_FREE(str_buf, rs->s); rs = H5FL_FREE(H5RS_str_t, rs); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5RS_decr() */ /*-------------------------------------------------------------------------- NAME H5RS_incr PURPOSE Increment the reference count for a ref-counted string USAGE herr_t H5RS_incr(rs) H5RS_str_t *rs; IN/OUT: Ref-counted string to increment count of RETURNS Non-negative on success/Negative on failure DESCRIPTION Increment the reference count for a reference counted string. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ herr_t H5RS_incr(H5RS_str_t *rs) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(rs); HDassert(rs->n > 0); /* If the ref-counted string started life as a wrapper around an existing * string, duplicate the string now, so that the wrapped string can go out * scope appropriately. */ if(rs->wrapped) { rs->s = H5RS_xstrdup(rs->s); rs->wrapped = 0; } /* end if */ /* Increment reference count for string */ rs->n++; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5RS_incr() */ /*-------------------------------------------------------------------------- NAME H5RS_dup PURPOSE "Duplicate" a ref-counted string USAGE H5RS_str_t H5RS_dup(rs) H5RS_str_t *rs; IN/OUT: Ref-counted string to "duplicate" RETURNS Returns a pointer to ref-counted string on success, NULL on failure. DESCRIPTION Increment the reference count for the reference counted string and return a pointer to it. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * H5RS_dup(H5RS_str_t *ret_value) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check for valid reference counted string */ if(ret_value != NULL) /* Increment reference count for string */ ret_value->n++; FUNC_LEAVE_NOAPI(ret_value) } /* end H5RS_dup() */ /*-------------------------------------------------------------------------- NAME H5RS_dup_str PURPOSE "Duplicate" a regular string into a ref-counted string USAGE H5RS_str_t H5RS_dup_str(s) const char *s; IN: Regular string to duplicate RETURNS Returns a pointer to ref-counted string on success, NULL on failure. DESCRIPTION Duplicate a regular string into a ref-counted string. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * H5RS_dup_str(const char *s) { char *new_str; /* Duplicate of string */ size_t path_len; /* Length of the path */ H5RS_str_t *ret_value; FUNC_ENTER_NOAPI(NULL) /* Sanity check */ HDassert(s); /* Get the length of the string */ path_len = HDstrlen(s); /* Allocate space for the string */ if(NULL == (new_str = (char *)H5FL_BLK_MALLOC(str_buf, path_len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy name for full path */ HDstrncpy(new_str, s, (path_len + 1)); /* Create reference counted string for path */ ret_value = H5RS_own(new_str); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5RS_dup_str() */ /*-------------------------------------------------------------------------- NAME H5RS_cmp PURPOSE Compare two ref-counted strings USAGE int H5RS_cmp(rs1,rs2) const H5RS_str_t *rs1; IN: First Ref-counted string to compare const H5RS_str_t *rs2; IN: Second Ref-counted string to compare RETURNS Returns positive, negative or 0 for comparison of two r-strings [same as strcmp()] DESCRIPTION Compare two ref-counted strings and return a value indicating their sort order [same as strcmp()] GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ int H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2) { /* Can't return invalid value from this function */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(rs1); HDassert(rs1->s); HDassert(rs2); HDassert(rs2->s); FUNC_LEAVE_NOAPI(HDstrcmp(rs1->s, rs2->s)) } /* end H5RS_cmp() */ /*-------------------------------------------------------------------------- NAME H5RS_len PURPOSE Compute the length of a ref-counted string USAGE ssize_t H5RS_cmp(rs) const H5RS_str_t *rs; IN: Ref-counted string to compute length of RETURNS Returns non-negative value on success, negative value on failure DESCRIPTION Compute the length of a ref-counted string. [same as strlen()] GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ ssize_t H5RS_len(const H5RS_str_t *rs) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(rs); HDassert(rs->s); FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(rs->s)) } /* end H5RS_len() */ /*-------------------------------------------------------------------------- NAME H5RS_get_str PURPOSE Get a pointer to the internal string contained in a ref-counted string USAGE char *H5RS_get_str(rs) const H5RS_str_t *rs; IN: Ref-counted string to get internal string from RETURNS Returns a pointer to the internal string being ref-counted on success, NULL on failure. DESCRIPTION Gets a pointer to the internal string being reference counted. This pointer is volatile and might be invalid is further calls to the H5RS API are made. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ char * H5RS_get_str(const H5RS_str_t *rs) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(rs); HDassert(rs->s); FUNC_LEAVE_NOAPI(rs->s) } /* end H5RS_get_str() */ /*-------------------------------------------------------------------------- NAME H5RS_get_count PURPOSE Get the reference count for a ref-counted string USAGE unsigned H5RS_get_count(rs) const H5RS_str_t *rs; IN: Ref-counted string to get internal count from RETURNS Returns the number of references to the internal string being ref-counted on success, 0 on failure. DESCRIPTION Gets the count of references to the reference counted string. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ unsigned H5RS_get_count(const H5RS_str_t *rs) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(rs); HDassert(rs->n > 0); FUNC_LEAVE_NOAPI(rs->n) } /* end H5RS_get_count() */
vfonov/ITK
Modules/ThirdParty/HDF5/src/itkhdf5/src/H5RS.c
C
apache-2.0
14,230
package org.java_websocket.framing; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions; import java.nio.ByteBuffer; public class CloseFrameBuilder extends FramedataImpl1 implements CloseFrame { /** * Attribute for just an empty ByteBuffer */ static final ByteBuffer emptybytebuffer = ByteBuffer.allocate( 0 ); /** * The close code used in this close frame */ private int code; /** * The close message used in this close frame */ private String reason; /** * Constructor for a close frame * * Using opcode closing and fin = true */ public CloseFrameBuilder() { super( Opcode.CLOSING ); setFin( true ); } /** * Constructor for a close frame * * Using opcode closing and fin = true * * @param code The close code causing this close frame */ public CloseFrameBuilder( int code ) throws InvalidDataException { super( Opcode.CLOSING ); setFin( true ); setCodeAndMessage( code, "" ); } /** * Constructor for a close frame * * Using opcode closing and fin = true * * @param code The close code causing this close frame * @param m The close message explaining this close frame a bit more */ public CloseFrameBuilder( int code, String m ) throws InvalidDataException { super( Opcode.CLOSING ); setFin( true ); setCodeAndMessage( code, m ); } private void setCodeAndMessage( int code, String m ) throws InvalidDataException { if( m == null ) { m = ""; } // CloseFrame.TLS_ERROR is not allowed to be transfered over the wire if( code == CloseFrame.TLS_ERROR ) { code = CloseFrame.NOCODE; m = ""; } if( code == CloseFrame.NOCODE ) { if( 0 < m.length() ) { throw new InvalidDataException( PROTOCOL_ERROR, "A close frame must have a closecode if it has a reason" ); } return;// empty payload } //Intentional check for code != CloseFrame.TLS_ERROR just to make sure even if the code earlier changes if( ( code > CloseFrame.UNEXPECTED_CONDITION && code < 3000 && code != CloseFrame.TLS_ERROR ) ) { throw new InvalidDataException( PROTOCOL_ERROR, "Trying to send an illegal close code!" ); } byte[] by = Charsetfunctions.utf8Bytes( m ); ByteBuffer buf = ByteBuffer.allocate( 4 ); buf.putInt( code ); buf.position( 2 ); ByteBuffer pay = ByteBuffer.allocate( 2 + by.length ); pay.put( buf ); pay.put( by ); pay.rewind(); setPayload( pay ); } private void initCloseCode() throws InvalidFrameException { code = CloseFrame.NOCODE; ByteBuffer payload = super.getPayloadData(); payload.mark(); if( payload.remaining() >= 2 ) { ByteBuffer bb = ByteBuffer.allocate( 4 ); bb.position( 2 ); bb.putShort( payload.getShort() ); bb.position( 0 ); code = bb.getInt(); if( code == CloseFrame.ABNORMAL_CLOSE || code == CloseFrame.TLS_ERROR || code == CloseFrame.NOCODE || code > 4999 || code < 1000 || code == 1004 ) { throw new InvalidFrameException( "closecode must not be sent over the wire: " + code ); } } payload.reset(); } @Override public int getCloseCode() { return code; } private void initMessage() throws InvalidDataException { if( code == CloseFrame.NOCODE ) { reason = Charsetfunctions.stringUtf8( super.getPayloadData() ); } else { ByteBuffer b = super.getPayloadData(); int mark = b.position();// because stringUtf8 also creates a mark try { b.position( b.position() + 2 ); reason = Charsetfunctions.stringUtf8( b ); } catch ( IllegalArgumentException e ) { throw new InvalidFrameException( e ); } finally { b.position( mark ); } } } @Override public String getMessage() { return reason; } @Override public String toString() { return super.toString() + "code: " + code; } @Override public void setPayload( ByteBuffer payload ) throws InvalidDataException { super.setPayload( payload ); initCloseCode(); initMessage(); } @Override public ByteBuffer getPayloadData() { if( code == NOCODE ) return emptybytebuffer; return super.getPayloadData(); } }
cping/RipplePower
eclipse/jcoinlibs/src/org/java_websocket/framing/CloseFrameBuilder.java
Java
apache-2.0
4,123
/** * Copyright 2011-2019 Asakusa Framework Team. * * 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.asakusafw.workflow.executor.basic; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.EnumSet; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.asakusafw.workflow.executor.ExecutionConditionException; import com.asakusafw.workflow.executor.JobflowExecutor; import com.asakusafw.workflow.executor.TaskExecutionContext; import com.asakusafw.workflow.executor.TaskExecutor; import com.asakusafw.workflow.model.JobflowInfo; import com.asakusafw.workflow.model.TaskInfo; /** * Executes jobflows. * @since 0.10.0 */ public class BasicJobflowExecutor implements JobflowExecutor { static final Logger LOG = LoggerFactory.getLogger(BasicJobflowExecutor.class); private static final EnumSet<TaskInfo.Phase> BODY = EnumSet.of(TaskInfo.Phase.FINALIZE, TaskInfo.Phase.CLEANUP); private final List<TaskExecutor> taskExecutors; /** * Creates a new instance. * @param taskExecutors the task executors */ public BasicJobflowExecutor(Collection<? extends TaskExecutor> taskExecutors) { this.taskExecutors = new ArrayList<>(taskExecutors); } /** * Creates a new instance. * @param taskExecutors the task executors */ public BasicJobflowExecutor(TaskExecutor... taskExecutors) { this(Arrays.asList(taskExecutors)); } @Override public void execute(TaskExecutionContext context, JobflowInfo jobflow) throws IOException, InterruptedException { LOG.info("start jobflow: {} - {}", context.getBatchId(), context.getFlowId()); boolean finalized = false; try { for (TaskInfo.Phase phase : EnumSet.complementOf(BODY)) { executePhase(context, jobflow, phase); } finalized = true; executePhase(context, jobflow, TaskInfo.Phase.FINALIZE); } catch (Exception e) { if (finalized == false && jobflow.getTasks(TaskInfo.Phase.FINALIZE).isEmpty() == false) { LOG.error(MessageFormat.format( "batch \"{0}\" was failed. we try to execute finalize phase.", context.getBatchId()), e); try { executePhase(context, jobflow, TaskInfo.Phase.FINALIZE); } catch (Exception nested) { LOG.warn(MessageFormat.format( "error occurred while running finalize of batch \"{0}\".", context.getBatchId()), nested); e.addSuppressed(nested); } } throw e; } try { executePhase(context, jobflow, TaskInfo.Phase.CLEANUP); } catch (Exception e) { LOG.warn(MessageFormat.format( "error occurred while runnning cleanup of batch \"{0}\".", context.getBatchId()), e); } LOG.info("finish jobflow: {} - {}", context.getBatchId(), context.getFlowId()); } private void executePhase( TaskExecutionContext context, JobflowInfo jobflow, TaskInfo.Phase phase) throws InterruptedException, IOException { List<TaskInfo> tasks = Util.sort(jobflow.getTasks(phase)); if (tasks.isEmpty() == false) { LOG.info("start phase: {} ({} tasks)", phase, tasks.size()); } int count = 0; for (TaskInfo task : tasks) { if (LOG.isDebugEnabled()) { LOG.debug("starting task: {} ({}/{} in {})", task, ++count, tasks.size(), phase); } TaskExecutor executor = findExecutor(context, task) .orElseThrow(() -> new ExecutionConditionException(MessageFormat.format( "there are no suitable executor for task: task={0}, executors={1}", task, taskExecutors.stream() .map(it -> it.getClass().getSimpleName()) .collect(Collectors.joining(", ", "{", "}"))))); if (LOG.isDebugEnabled()) { LOG.debug("task executor \"{}\" is available: {}", executor, task); } executor.execute(context, task); } } private Optional<TaskExecutor> findExecutor(TaskExecutionContext context, TaskInfo task) { return taskExecutors.stream() .peek(it -> LOG.trace("testing task executor {}: {}", it, task)) .filter(it -> it.isSupported(context, task)).findFirst(); } }
akirakw/asakusafw
workflow/executor/src/main/java/com/asakusafw/workflow/executor/basic/BasicJobflowExecutor.java
Java
apache-2.0
5,357
<?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <table border="1"> <tr> <td style="vertical-align:top"> <img src="../image/table1.png" width="500.0" height="273.51097178683386" style="vertical-align:top"/> </td> <td width="500.0" style="vertical-align:top"> <div> <svg stroke="none" stroke-width="0.0" id="svg2" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="table1.svg" height="800.0" width="700.0" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"> <g transform="scale(1.0118006717061354) translate(-51.0,-449.765)"> <g class="metadata" id="metadata6654"> <g class="RDF"> <g class="Work" rdf:about="" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <g class="format">image/svg+xml</g> <g class="type" rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <title stroke="black" stroke-width="1.0"/> </g> </g> </g> <g class="namedview" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="760" inkscape:window-height="804" id="namedview6652" showgrid="false" inkscape:zoom="0.73980469" inkscape:cx="300" inkscape:cy="400" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2"/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5186" d="M51.024 463.732 L544.252 463.732 L544.252 464.299 L51.024 464.299 Z"/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5188" d="M51.024 463.732 L544.252 463.732 L544.252 464.299 L51.024 464.299 Z"/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5190" d="M544.252 687.499 L51.024 687.499 L51.024 686.932 L544.252 686.932 Z"/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5192" d="M544.252 687.499 L51.024 687.499 L51.024 686.932 L544.252 686.932 Z"/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5194" d="M232.838 514.698 L51.024 514.698 L51.024 514.131 L232.838 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5196" d="M232.838 514.698 L51.024 514.698 L51.024 514.131 L232.838 514.131 "/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5198" d="M280.8 514.698 L232.838 514.698 L232.838 514.131 L280.8 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5200" d="M280.8 514.698 L232.838 514.698 L232.838 514.131 L280.8 514.131 "/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5202" d="M331.2 514.698 L280.8 514.698 L280.8 514.131 L331.2 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5204" d="M331.2 514.698 L280.8 514.698 L280.8 514.131 L331.2 514.131 "/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5206" d="M376.724 514.698 L331.2 514.698 L331.2 514.131 L376.724 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5208" d="M376.724 514.698 L331.2 514.698 L331.2 514.131 L376.724 514.131 "/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5210" d="M427.181 514.698 L376.724 514.698 L376.724 514.131 L427.181 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5212" d="M427.181 514.698 L376.724 514.698 L376.724 514.131 L427.181 514.131 "/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5214" d="M476.844 514.698 L427.181 514.698 L427.181 514.131 L476.844 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5216" d="M476.844 514.698 L427.181 514.698 L427.181 514.131 L476.844 514.131 "/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5218" d="M527.244 514.698 L476.844 514.698 L476.844 514.131 L527.244 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5220" d="M527.244 514.698 L476.844 514.698 L476.844 514.131 L527.244 514.131 "/> <path stroke="black" clip-path="url(#clipPath1)" fill="#131313" stroke-width="0.0" id="path5222" d="M544.252 514.698 L527.244 514.698 L527.244 514.131 L544.252 514.131 "/> <path fill="none" clip-path="url(#clipPath1)" stroke="#131313" stroke-width="0.0" id="path5224" d="M544.252 514.698 L527.244 514.698 L527.244 514.131 L544.252 514.131 "/> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAB+RbxrnqAdvTTb8864ccf.B" svgx:width="666.0" x="51.024" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="bold" id="text5226" xmlns:svgx="http://www.xml-cml.org/schema/svgx">T</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAB+RbxrnqAdvTTb8864ccf.B" svgx:width="500.0" x="55.843" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="bold" id="text5228" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAB+RbxrnqAdvTTb8864ccf.B" svgx:width="552.0" x="60.078" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="bold" id="text5230" xmlns:svgx="http://www.xml-cml.org/schema/svgx">b</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAB+RbxrnqAdvTTb8864ccf.B" svgx:width="270.0" x="64.575" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="bold" id="text5232" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAB+RbxrnqAdvTTb8864ccf.B" svgx:width="437.0" x="66.863" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="bold" id="text5234" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAB+RbxrnqAdvTTb8864ccf.B" svgx:width="500.0" x="72.681" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="bold" id="text5236" xmlns:svgx="http://www.xml-cml.org/schema/svgx">1</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="87.479" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5238" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="92.003" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5240" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="94.291" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5242" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="98.374" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5244" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="102.61" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5246" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="108.921" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5248" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="113.156" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5250" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="117.198" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5252" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="119.486" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5254" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="121.621" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5256" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="123.757" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5258" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="127.993" y="458.233" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5260" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.836" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5262" xmlns:svgx="http://www.xml-cml.org/schema/svgx">V</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="238.789" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5264" xmlns:svgx="http://www.xml-cml.org/schema/svgx">1</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5266" xmlns:svgx="http://www.xml-cml.org/schema/svgx">V</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="286.753" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5268" xmlns:svgx="http://www.xml-cml.org/schema/svgx">2</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.719" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5270" xmlns:svgx="http://www.xml-cml.org/schema/svgx">V</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="382.799" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5272" xmlns:svgx="http://www.xml-cml.org/schema/svgx">3</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.839" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5274" xmlns:svgx="http://www.xml-cml.org/schema/svgx">V</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="482.792" y="477.109" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5276" xmlns:svgx="http://www.xml-cml.org/schema/svgx">4</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="937.0" x="232.836" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5278" xmlns:svgx="http://www.xml-cml.org/schema/svgx">W</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="240.66" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5280" xmlns:svgx="http://www.xml-cml.org/schema/svgx">1</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="937.0" x="280.798" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5282" xmlns:svgx="http://www.xml-cml.org/schema/svgx">W</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="288.622" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5284" xmlns:svgx="http://www.xml-cml.org/schema/svgx">2</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="937.0" x="331.199" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5286" xmlns:svgx="http://www.xml-cml.org/schema/svgx">W</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="339.133" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5288" xmlns:svgx="http://www.xml-cml.org/schema/svgx">4</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="937.0" x="376.722" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5290" xmlns:svgx="http://www.xml-cml.org/schema/svgx">W</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="384.546" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5292" xmlns:svgx="http://www.xml-cml.org/schema/svgx">8</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="937.0" x="427.183" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5294" xmlns:svgx="http://www.xml-cml.org/schema/svgx">W</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="435.006" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5296" xmlns:svgx="http://www.xml-cml.org/schema/svgx">1</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="439.24" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5298" xmlns:svgx="http://www.xml-cml.org/schema/svgx">0</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="937.0" x="476.846" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5300" xmlns:svgx="http://www.xml-cml.org/schema/svgx">W</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="484.67" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5302" xmlns:svgx="http://www.xml-cml.org/schema/svgx">1</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="488.903" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5304" xmlns:svgx="http://www.xml-cml.org/schema/svgx">4</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="937.0" x="527.246" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5306" xmlns:svgx="http://www.xml-cml.org/schema/svgx">W</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="535.18" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5308" xmlns:svgx="http://www.xml-cml.org/schema/svgx">1</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="539.21" y="487.084" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5310" xmlns:svgx="http://www.xml-cml.org/schema/svgx">8</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="51.024" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5312" xmlns:svgx="http://www.xml-cml.org/schema/svgx">O</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="57.104" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5314" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="61.169" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5316" xmlns:svgx="http://www.xml-cml.org/schema/svgx">-</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="63.777" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5318" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="67.037" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5320" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="69.163" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5322" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="71.313" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5324" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="77.207" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5326" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="81.441" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5328" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="84.973" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5330" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="87.581" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5332" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="89.867" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5334" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="92.001" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5336" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="95.575" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5338" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="97.861" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5340" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="101.926" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5342" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="105.627" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5344" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="109.632" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5346" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="111.918" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5348" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="232.836" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5350" xmlns:svgx="http://www.xml-cml.org/schema/svgx">P</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="237.375" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5352" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="240.102" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5354" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="243.607" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5356" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="280.8" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5358" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="285.339" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5360" xmlns:svgx="http://www.xml-cml.org/schema/svgx">w</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="291.419" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5362" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="293.561" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5364" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="331.202" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5366" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="337.283" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5368" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="376.728" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5370" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="381.402" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5372" xmlns:svgx="http://www.xml-cml.org/schema/svgx">w</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="387.27" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5374" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="389.557" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5376" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="427.181" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5378" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="433.134" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5380" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="476.847" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5382" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="481.386" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5384" xmlns:svgx="http://www.xml-cml.org/schema/svgx">w</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="487.466" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5386" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="489.609" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5388" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="527.25" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5390" xmlns:svgx="http://www.xml-cml.org/schema/svgx">F</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="531.924" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5392" xmlns:svgx="http://www.xml-cml.org/schema/svgx">/</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="534.05" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5394" xmlns:svgx="http://www.xml-cml.org/schema/svgx">U</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="540.003" y="497.009" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5396" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="51.024" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5398" xmlns:svgx="http://www.xml-cml.org/schema/svgx">D</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="57.104" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5400" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="59.187" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5402" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="62.447" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5404" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="64.573" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5406" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="68.146" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5408" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="72.38" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5410" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="76.767" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5412" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="81.001" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5414" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="84.532" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5416" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="87.141" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5418" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="89.427" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5420" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="91.561" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5422" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="95.134" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5424" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="97.421" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5426" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="101.486" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5428" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="105.186" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5430" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="109.251" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5432" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="111.402" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5434" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="232.836" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5436" xmlns:svgx="http://www.xml-cml.org/schema/svgx">P</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="237.375" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5438" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="240.102" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5440" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="243.607" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5442" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5444" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="286.753" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5446" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="331.202" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5448" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="337.283" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5450" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.728" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5452" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="382.808" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5454" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="427.181" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5456" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="433.134" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5458" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.847" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5460" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="482.8" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5462" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="527.25" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5464" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="533.33" y="506.985" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5466" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="51.024" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5468" xmlns:svgx="http://www.xml-cml.org/schema/svgx">B</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="56.663" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5470" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="60.152" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5472" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="64.386" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5474" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="67.918" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5476" xmlns:svgx="http://www.xml-cml.org/schema/svgx">v</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="72.152" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5478" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="74.269" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5480" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="78.503" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5482" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="82.542" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5484" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="85.15" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5486" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="88.851" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5488" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="93.255" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5490" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="96.828" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5492" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="101.062" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5494" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="107.371" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5496" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="111.605" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5498" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="115.136" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5500" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="121.538" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5502" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="125.772" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5504" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="129.812" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5506" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="132.539" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5508" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="136.044" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5510" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="140.278" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5512" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="144.318" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5514" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="146.604" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5516" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="152.422" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5518" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="158.824" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5520" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="162.524" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5522" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="166.081" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5524" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="169.197" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5526" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="173.431" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5528" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="175.997" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5530" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="179.571" y="527.511" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5532" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="59.475" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5534" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="64.149" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5536" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="66.275" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5538" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="68.883" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5540" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="73.117" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5542" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="76.648" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5544" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="78.935" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5546" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="83.0" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5548" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="85.608" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5550" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="89.308" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5552" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="95.643" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5554" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="97.929" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5556" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="101.994" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5558" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="104.145" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5560" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="107.845" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5562" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="110.377" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5564" xmlns:svgx="http://www.xml-cml.org/schema/svgx">v</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="114.611" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5566" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="116.728" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5568" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="120.429" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5570" xmlns:svgx="http://www.xml-cml.org/schema/svgx">w</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="128.635" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5572" xmlns:svgx="http://www.xml-cml.org/schema/svgx">(</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="131.243" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5574" xmlns:svgx="http://www.xml-cml.org/schema/svgx">D</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="137.323" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5576" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="885.0" x="141.786" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5578" xmlns:svgx="http://www.xml-cml.org/schema/svgx">M</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="151.482" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5580" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="157.562" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5582" xmlns:svgx="http://www.xml-cml.org/schema/svgx">D</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="163.447" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5584" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="169.528" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5586" xmlns:svgx="http://www.xml-cml.org/schema/svgx">D</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="177.733" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5588" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="180.46" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5590" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="183.966" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5592" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="186.252" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5594" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="188.386" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5596" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="192.468" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5598" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="196.702" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5600" xmlns:svgx="http://www.xml-cml.org/schema/svgx">)</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.836" y="540.214" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5602" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="59.475" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5604" xmlns:svgx="http://www.xml-cml.org/schema/svgx">C</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="65.115" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5606" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="69.171" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5608" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="73.405" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5610" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="77.444" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5612" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="81.679" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5614" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="84.244" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5616" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="89.689" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5618" xmlns:svgx="http://www.xml-cml.org/schema/svgx">P</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="94.228" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5620" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="97.929" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5622" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="100.461" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5624" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="104.162" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5626" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="108.226" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5628" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="112.706" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5630" xmlns:svgx="http://www.xml-cml.org/schema/svgx">R</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="118.346" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5632" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="121.835" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5634" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="124.121" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5636" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="126.255" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5638" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="130.489" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5640" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="136.798" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5642" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="141.472" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5644" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="144.961" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5646" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="148.662" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5648" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="150.804" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5650" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5652" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="331.202" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5654" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.728" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5656" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="427.181" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5658" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.847" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5660" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="527.25" y="552.916" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5662" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="59.475" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5664" xmlns:svgx="http://www.xml-cml.org/schema/svgx">G</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="65.555" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5666" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="67.698" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5668" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="71.932" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5670" xmlns:svgx="http://www.xml-cml.org/schema/svgx">b</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="75.971" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5672" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="79.545" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5674" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="84.024" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5676" xmlns:svgx="http://www.xml-cml.org/schema/svgx">C</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="89.664" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5678" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="91.79" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5680" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="94.076" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5682" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="98.081" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5684" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="100.368" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5686" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="103.924" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5688" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="107.498" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5690" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="111.978" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5692" xmlns:svgx="http://www.xml-cml.org/schema/svgx">I</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="114.704" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5694" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="121.047" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5696" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="125.281" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5698" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="127.847" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5700" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="131.421" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5702" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="134.681" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5704" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="137.772" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5706" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="140.058" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5708" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="144.123" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5710" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="150.525" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5712" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="153.785" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5714" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="157.274" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5716" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="160.975" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5718" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="163.117" y="565.618" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5720" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="166.677" y="561.811" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text5722" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="565.61" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5724" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.724" y="565.61" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5726" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.84" y="565.61" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5728" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="59.475" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5730" xmlns:svgx="http://www.xml-cml.org/schema/svgx">C</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="65.115" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5732" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="69.171" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5734" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="71.898" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5736" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="74.447" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5738" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="78.147" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5740" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="82.212" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5742" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="86.692" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5744" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="90.926" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5746" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="94.398" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5748" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="98.098" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5750" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="100.241" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5752" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="102.392" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5754" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="108.853" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5756" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="112.427" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5758" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="116.661" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5760" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="122.97" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5762" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="129.49" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5764" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="133.004" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5766" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="137.239" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5768" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="139.356" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5770" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="143.056" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5772" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="146.554" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5774" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="151.033" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5776" xmlns:svgx="http://www.xml-cml.org/schema/svgx">q</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="155.267" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5778" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="159.307" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5780" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="163.007" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5782" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="166.107" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5784" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="168.258" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5786" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="170.544" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5788" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="174.609" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5790" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="178.843" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5792" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="182.882" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5794" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="186.456" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5796" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="188.742" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5798" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="191.333" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5800" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.836" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5802" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5804" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="331.203" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5806" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.728" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5808" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="427.181" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5810" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.847" y="578.312" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5812" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="59.475" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5814" xmlns:svgx="http://www.xml-cml.org/schema/svgx">D</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="65.555" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5816" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="69.112" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5818" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="75.514" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5820" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="79.748" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5822" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="83.787" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5824" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="86.395" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5826" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="90.096" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5828" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="94.161" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5830" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="98.395" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5832" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="100.512" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5834" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="104.086" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5836" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="109.531" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5838" xmlns:svgx="http://www.xml-cml.org/schema/svgx">q</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="113.765" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5840" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="117.804" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5842" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="121.505" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5844" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="124.604" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5846" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="126.755" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5848" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="129.041" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5850" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="133.106" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5852" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="137.34" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5854" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="141.379" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5856" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="145.08" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5858" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="147.163" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5860" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="149.89" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5862" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.828" y="591.014" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5864" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="59.475" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5866" xmlns:svgx="http://www.xml-cml.org/schema/svgx">O</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="65.555" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5868" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="71.889" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5870" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="75.59" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5872" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="79.655" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5874" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="83.355" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5876" xmlns:svgx="http://www.xml-cml.org/schema/svgx">-</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="85.887" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5878" xmlns:svgx="http://www.xml-cml.org/schema/svgx">3</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="92.289" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5880" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="94.576" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5882" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="98.64" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5884" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="100.927" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5886" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="104.424" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5888" xmlns:svgx="http://www.xml-cml.org/schema/svgx">k</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="108.658" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5890" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="112.19" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5892" xmlns:svgx="http://www.xml-cml.org/schema/svgx">/</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="114.476" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5894" xmlns:svgx="http://www.xml-cml.org/schema/svgx">f</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="117.008" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5896" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="121.242" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5898" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="125.281" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5900" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="131.683" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5902" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="135.917" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5904" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="138.035" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5906" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="141.608" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5908" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="144.335" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5910" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.828" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5912" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.711" y="603.716" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5914" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="51.024" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5916" xmlns:svgx="http://www.xml-cml.org/schema/svgx">C</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="56.664" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5918" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="60.72" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5920" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="64.954" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5922" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="68.993" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5924" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="71.144" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5926" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="73.431" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5928" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="75.565" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5930" xmlns:svgx="http://www.xml-cml.org/schema/svgx">v</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="79.799" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5932" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="85.599" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5934" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="89.173" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5936" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="93.407" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5938" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="99.716" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5940" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="103.95" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5942" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="107.032" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5944" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="111.267" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5946" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="114.798" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5948" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="119.032" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5950" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="123.071" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5952" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="127.305" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5954" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="131.345" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5956" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="135.579" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5958" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="138.602" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5960" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="140.888" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5962" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="144.953" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5964" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="147.239" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5966" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="151.304" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5968" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="155.538" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5970" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="157.596" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5972" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="161.297" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5974" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="164.853" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5976" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="169.333" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5978" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="175.735" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5980" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="179.436" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5982" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="182.933" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5984" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="186.193" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5986" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="190.249" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5988" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="192.858" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5990" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="196.558" y="616.419" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5992" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="59.475" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5994" xmlns:svgx="http://www.xml-cml.org/schema/svgx">C</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="65.115" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5996" xmlns:svgx="http://www.xml-cml.org/schema/svgx">O</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="885.0" x="71.043" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text5998" xmlns:svgx="http://www.xml-cml.org/schema/svgx">M</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="78.41" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6000" xmlns:svgx="http://www.xml-cml.org/schema/svgx">P</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="82.322" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6002" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="88.275" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6004" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="92.95" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6006" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="99.724" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6008" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="103.425" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6010" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="107.49" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6012" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="111.724" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6014" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="115.712" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6016" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="117.999" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6018" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="120.133" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6020" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="122.419" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6022" xmlns:svgx="http://www.xml-cml.org/schema/svgx">v</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="126.484" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6024" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="132.327" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6026" xmlns:svgx="http://www.xml-cml.org/schema/svgx">b</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="136.561" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6028" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="140.092" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6030" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="142.379" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6032" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="144.453" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6034" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="148.154" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6036" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="150.745" y="629.121" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6038" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="154.828" y="625.364" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6040" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.838" y="629.105" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6042" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="629.105" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6044" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.721" y="629.105" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6046" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.841" y="629.105" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6048" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="59.468" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6050" xmlns:svgx="http://www.xml-cml.org/schema/svgx">T</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="64.007" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6052" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="67.581" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6054" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="70.841" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6056" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="75.236" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6058" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="79.47" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6060" xmlns:svgx="http://www.xml-cml.org/schema/svgx">f</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="84.306" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6062" xmlns:svgx="http://www.xml-cml.org/schema/svgx">V</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="89.403" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6064" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="92.977" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6066" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="95.704" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6068" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="97.855" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6070" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="101.428" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6072" xmlns:svgx="http://www.xml-cml.org/schema/svgx">b</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="105.662" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6074" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="107.779" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6076" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="111.48" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6078" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="116.849" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6080" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="121.083" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6082" xmlns:svgx="http://www.xml-cml.org/schema/svgx">f</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="125.859" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6084" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="131.939" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6086" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="134.082" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6088" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="136.233" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6090" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="139.933" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6092" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="143.998" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6094" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="146.284" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6096" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="148.359" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6098" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="152.593" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6100" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="158.961" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6102" xmlns:svgx="http://www.xml-cml.org/schema/svgx">(</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="161.569" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6104" xmlns:svgx="http://www.xml-cml.org/schema/svgx">T</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="166.498" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6106" xmlns:svgx="http://www.xml-cml.org/schema/svgx">O</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="172.578" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6108" xmlns:svgx="http://www.xml-cml.org/schema/svgx">V</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="177.439" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6110" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="183.392" y="641.808" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6112" xmlns:svgx="http://www.xml-cml.org/schema/svgx">)</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="186.066" y="638.063" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6114" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.838" y="641.805" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6116" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="641.805" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6118" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.721" y="641.805" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6120" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.841" y="641.805" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6122" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="59.468" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6124" xmlns:svgx="http://www.xml-cml.org/schema/svgx">B</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="65.108" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6126" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="67.691" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6128" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="71.925" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6130" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="75.964" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6132" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="79.538" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6134" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="885.0" x="84.018" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6136" xmlns:svgx="http://www.xml-cml.org/schema/svgx">M</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="91.512" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6138" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="95.585" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6140" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="99.819" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6142" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="106.128" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6144" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="110.803" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6146" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="114.291" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6148" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="117.992" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6150" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="120.135" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6152" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="125.978" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6154" xmlns:svgx="http://www.xml-cml.org/schema/svgx">(</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="128.704" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6156" xmlns:svgx="http://www.xml-cml.org/schema/svgx">B</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="134.2" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6158" xmlns:svgx="http://www.xml-cml.org/schema/svgx">R</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="139.84" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6160" xmlns:svgx="http://www.xml-cml.org/schema/svgx">U</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="885.0" x="145.708" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6162" xmlns:svgx="http://www.xml-cml.org/schema/svgx">M</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="153.203" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6164" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="157.725" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6166" xmlns:svgx="http://www.xml-cml.org/schema/svgx">)</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="232.838" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6168" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.802" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6170" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="331.196" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6172" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.721" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6174" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="427.175" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6176" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.84" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6178" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="527.243" y="654.507" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6180" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="59.468" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6182" xmlns:svgx="http://www.xml-cml.org/schema/svgx">E</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="64.583" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6184" xmlns:svgx="http://www.xml-cml.org/schema/svgx">E</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="69.503" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6186" xmlns:svgx="http://www.xml-cml.org/schema/svgx">G</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="77.777" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6188" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="80.503" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6190" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="84.009" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6192" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="87.269" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6194" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="89.395" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6196" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="91.681" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6198" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="95.746" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6200" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="102.148" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6202" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="105.408" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6204" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="107.475" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6206" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="111.175" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6208" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="113.318" y="667.209" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6210" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="116.901" y="663.461" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6212" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="667.203" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6214" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.724" y="667.203" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6216" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.84" y="667.203" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6218" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="59.475" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6220" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="64.149" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6222" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="66.275" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6224" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="69.849" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6226" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="73.549" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6228" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="77.614" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6230" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="81.848" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6232" xmlns:svgx="http://www.xml-cml.org/schema/svgx">-</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="84.363" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6234" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="87.623" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6236" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="89.749" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6238" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="93.449" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6240" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="95.533" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6242" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="101.426" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6244" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="103.713" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6246" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="107.778" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6248" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="112.012" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6250" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="116.051" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6252" xmlns:svgx="http://www.xml-cml.org/schema/svgx">g</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="120.285" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6254" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="122.8" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6256" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="126.501" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6258" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="130.566" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6260" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="134.8" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6262" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="141.108" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6264" xmlns:svgx="http://www.xml-cml.org/schema/svgx">(</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="666.0" x="143.717" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6266" xmlns:svgx="http://www.xml-cml.org/schema/svgx">C</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="149.356" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6268" xmlns:svgx="http://www.xml-cml.org/schema/svgx">P</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="153.862" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6270" xmlns:svgx="http://www.xml-cml.org/schema/svgx">T</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="158.172" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6272" xmlns:svgx="http://www.xml-cml.org/schema/svgx">-</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="160.899" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6274" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="166.793" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6276" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="172.873" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6278" xmlns:svgx="http://www.xml-cml.org/schema/svgx">E</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="177.793" y="679.906" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6280" xmlns:svgx="http://www.xml-cml.org/schema/svgx">)</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="180.454" y="676.161" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6282" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="280.8" y="679.902" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6284" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="376.724" y="679.902" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6286" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="476.84" y="679.902" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6288" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="51.024" y="696.457" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6290" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="55.219" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6292" xmlns:svgx="http://www.xml-cml.org/schema/svgx">T</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="60.207" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6294" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="64.441" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6296" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="67.972" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6298" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="71.232" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6300" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="76.982" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6302" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="79.269" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6304" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="81.403" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6306" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="84.976" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6308" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="91.497" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6310" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="96.882" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6312" xmlns:svgx="http://www.xml-cml.org/schema/svgx">w</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="102.963" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6314" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="106.46" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6316" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="109.187" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6318" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="115.021" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6320" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="119.255" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6322" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="123.295" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6324" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="127.774" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6326" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="131.348" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6328" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="135.582" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6330" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="141.95" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6332" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="146.032" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6334" xmlns:svgx="http://www.xml-cml.org/schema/svgx">l</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="148.318" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6336" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="151.875" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6338" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="154.026" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6340" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="157.726" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6342" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="164.061" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6344" xmlns:svgx="http://www.xml-cml.org/schema/svgx">b</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="168.295" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6346" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="174.663" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6348" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="176.814" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6350" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="181.048" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6352" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="183.165" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6354" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="186.865" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6356" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="189.287" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6358" xmlns:svgx="http://www.xml-cml.org/schema/svgx">-</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="192.014" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6360" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="195.13" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6362" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="197.281" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6364" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="200.982" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6366" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="203.124" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6368" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="209.018" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6370" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="213.252" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6372" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="216.724" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6374" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="219.451" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6376" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="221.543" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6378" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="223.829" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6380" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="227.386" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6382" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="229.537" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6384" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="233.771" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6386" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="237.302" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6388" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="241.536" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6390" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="243.653" y="700.198" font-size="8.468" font-family="TimesNewRoman" font-weight="normal" id="text6392" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="604.0" x="51.024" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6394" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="718.0" x="54.86" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6396" xmlns:svgx="http://www.xml-cml.org/schema/svgx">H</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="61.509" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6398" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="64.171" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6400" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="68.085" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6402" xmlns:svgx="http://www.xml-cml.org/schema/svgx">h</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="71.147" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6404" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="74.324" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6406" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="79.032" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6408" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="250.0" x="81.808" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6410" xmlns:svgx="http://www.xml-cml.org/schema/svgx">,</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="500.0" x="85.49" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6412" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="666.0" x="88.552" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6414" xmlns:svgx="http://www.xml-cml.org/schema/svgx">w</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="270.0" x="92.781" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6416" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="500.0" x="94.331" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6418" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="99.723" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6420" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="102.384" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6422" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="552.0" x="106.296" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6424" xmlns:svgx="http://www.xml-cml.org/schema/svgx">S</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="109.802" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6426" xmlns:svgx="http://www.xml-cml.org/schema/svgx">w</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="114.178" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6428" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="115.766" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6430" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="118.941" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6432" xmlns:svgx="http://www.xml-cml.org/schema/svgx">b</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="121.945" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6434" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="125.006" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6436" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="127.051" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6438" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="130.049" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6440" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="250.0" x="132.71" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6442" xmlns:svgx="http://www.xml-cml.org/schema/svgx">,</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="604.0" x="136.514" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6444" xmlns:svgx="http://www.xml-cml.org/schema/svgx">P</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="385.0" x="140.35" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6446" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="500.0" x="142.58" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6448" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="437.0" x="145.641" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6450" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="150.633" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6452" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="153.694" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6454" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="155.739" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6456" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="158.343" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6458" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="161.004" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6460" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="162.719" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6462" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="164.237" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6464" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="167.012" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6466" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="171.89" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6468" xmlns:svgx="http://www.xml-cml.org/schema/svgx">d</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="174.951" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6470" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="177.726" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6472" xmlns:svgx="http://www.xml-cml.org/schema/svgx">y</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="250.0" x="180.336" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6474" xmlns:svgx="http://www.xml-cml.org/schema/svgx">,</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="666.0" x="184.083" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6476" xmlns:svgx="http://www.xml-cml.org/schema/svgx">C</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="604.0" x="188.313" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6478" xmlns:svgx="http://www.xml-cml.org/schema/svgx">P</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="552.0" x="191.965" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6480" xmlns:svgx="http://www.xml-cml.org/schema/svgx">T</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="322.0" x="194.912" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6482" xmlns:svgx="http://www.xml-cml.org/schema/svgx">-</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="604.0" x="196.957" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6484" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="604.0" x="200.64" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6486" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNBD+KmwktxAdvTT50a2f13e.I" svgx:width="604.0" x="204.476" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" font-style="italic" id="text6488" xmlns:svgx="http://www.xml-cml.org/schema/svgx">E</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="210.389" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6490" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="213.057" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6492" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="216.118" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6494" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="219.293" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6496" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="220.824" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6498" xmlns:svgx="http://www.xml-cml.org/schema/svgx">i</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="222.539" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6500" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="225.53" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6502" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="228.591" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6504" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="231.767" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6506" xmlns:svgx="http://www.xml-cml.org/schema/svgx">u</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="234.771" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6508" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="239.42" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6510" xmlns:svgx="http://www.xml-cml.org/schema/svgx">p</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="242.481" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6512" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="245.142" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6514" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="247.187" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6516" xmlns:svgx="http://www.xml-cml.org/schema/svgx">f</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="249.054" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6518" xmlns:svgx="http://www.xml-cml.org/schema/svgx">o</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="252.115" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6520" xmlns:svgx="http://www.xml-cml.org/schema/svgx">r</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="770.0" x="254.16" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6522" xmlns:svgx="http://www.xml-cml.org/schema/svgx">m</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="258.86" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6524" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="261.636" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6526" xmlns:svgx="http://www.xml-cml.org/schema/svgx">n</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="264.64" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6528" xmlns:svgx="http://www.xml-cml.org/schema/svgx">c</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="267.301" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6530" xmlns:svgx="http://www.xml-cml.org/schema/svgx">e</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="270.0" x="272.286" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6532" xmlns:svgx="http://www.xml-cml.org/schema/svgx">t</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="437.0" x="273.874" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6534" xmlns:svgx="http://www.xml-cml.org/schema/svgx">a</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="385.0" x="276.649" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6536" xmlns:svgx="http://www.xml-cml.org/schema/svgx">s</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="500.0" x="278.917" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6538" xmlns:svgx="http://www.xml-cml.org/schema/svgx">k</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="322.0" x="281.978" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6540" xmlns:svgx="http://www.xml-cml.org/schema/svgx">-</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="284.023" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6542" xmlns:svgx="http://www.xml-cml.org/schema/svgx">A</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="718.0" x="288.443" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6544" xmlns:svgx="http://www.xml-cml.org/schema/svgx">X</text> <text stroke="none" fill="#131313" clip-path="url(#clipPath1)" svgx:fontName="NHJNAA+KyxfnhAdvTT3713a231" svgx:width="604.0" x="292.863" y="714.428" font-size="5.988" font-family="TimesNewRoman" font-weight="normal" id="text6546" xmlns:svgx="http://www.xml-cml.org/schema/svgx">E</text> <g class="sections" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"> <rect stroke="black" stroke-width="1.0" x="51.024" y="449.765" width="80.66951599999999" height="8.468000000000018" fill="yellow" opacity="0.2" class="table.title"> <title stroke="black" stroke-width="1.0">table.title</title> </rect> <rect stroke="black" stroke-width="1.0" x="51.024" y="468.64099999999996" width="493.2130000000001" height="38.34400000000005" fill="red" opacity="0.2" class="table.header"> <title stroke="black" stroke-width="1.0">table.header</title> </rect> <rect stroke="black" stroke-width="1.0" x="51.024" y="519.043" width="482.306024" height="160.86299999999994" fill="cyan" opacity="0.2" class="table.body"> <title stroke="black" stroke-width="1.0">table.body</title> </rect> <rect stroke="black" stroke-width="1.0" x="51.024" y="690.4689999999999" width="245.45575200000002" height="23.95900000000006" fill="blue" opacity="0.2" class="table.footer"> <title stroke="black" stroke-width="1.0">table.footer</title> </rect> </g> <g class="title.title" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"> <rect stroke="black" stroke-width="1.0" x="51.024" y="449.765" width="80.66951599999999" height="8.468000000000018" fill="yellow" opacity="0.2"> <title stroke="black" stroke-width="1.0">TITLE: {[TimesNewRoman x 2]}{[8.468 x 2]}{[normal, bold]}{[null x 2]} //Table 1 Study outline </title> </rect> </g> <g class="header.columnBoxes" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"> <rect stroke="black" stroke-width="1.0" x="51.0" y="468.64099999999996" width="64.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 0/On-site participants // Distant participants // </title> </rect> <rect stroke="black" stroke-width="1.0" x="232.0" y="468.64099999999996" width="15.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 1/V1 // W1 // Prac // Prac // </title> </rect> <rect stroke="black" stroke-width="1.0" x="280.0" y="468.64099999999996" width="17.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 2/V2 // W2 // Swin // AH // </title> </rect> <rect stroke="black" stroke-width="1.0" x="331.0" y="468.64099999999996" width="12.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 3/W4 // AH // AH // </title> </rect> <rect stroke="black" stroke-width="1.0" x="376.0" y="468.64099999999996" width="17.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 4/V3 // W8 // Swin // AH // </title> </rect> <rect stroke="black" stroke-width="1.0" x="427.0" y="468.64099999999996" width="16.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 5/W10 // AH // AH // </title> </rect> <rect stroke="black" stroke-width="1.0" x="476.0" y="468.64099999999996" width="17.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 6/V4 // W14 // Swin // AH // </title> </rect> <rect stroke="black" stroke-width="1.0" x="527.0" y="468.64099999999996" width="17.0" height="38.34400000000005" fill="green" opacity="0.2"> <title stroke="black" stroke-width="1.0">HEADERCOLUMN: 7/W18 // F/Up // AH // </title> </rect> </g> <g class="header.boxes" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"/> <g class="body.subtableBoxes" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"> <rect stroke="black" stroke-width="1.0" x="186.066" y="531.7460000000001" width="347.26402399999995" height="76.20499999999993" fill="yellow" opacity="0.2"/> <rect stroke="black" stroke-width="1.0" x="186.066" y="620.653" width="347.26402399999995" height="59.25299999999993" fill="red" opacity="0.2"/> </g> <g class="body.columnBoxes" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"> <rect stroke="black" stroke-width="1.0" x="51.0" y="519.043" width="148.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 0/Behavioural and demographic measures // Structured interview (DSM ADHD rating) // Connors Parent Rating Scale // // Global Clinical Impression scale // ^{a} // Current health and medical questionnaire // Demographics questionnaire // Omega-3 intake/food diary // Cognitive and psychophysiological measures // // COMPASS cognitive battery // ^{a} // // Test of Variables of Attention (TOVA) // ^{a} // Brunel Mood Scale (BRUMS) // // EEG resting state // ^{a} // // Steady-state topography (CPT-AXE) // ^{a} // </title> </rect> <rect stroke="black" stroke-width="1.0" x="232.0" y="519.043" width="6.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 1/ // X // // // // // X // X // X // // // X // // // X // // X // // // // // // // </title> </rect> <rect stroke="black" stroke-width="1.0" x="280.0" y="519.043" width="6.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 2/ // // X // // X // // X // // // // // X // // // X // // X // // X // // // X // // </title> </rect> <rect stroke="black" stroke-width="1.0" x="331.0" y="519.043" width="6.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 3/ // // X // // // // X // // // // // // // // // // X // // // // // // // </title> </rect> <rect stroke="black" stroke-width="1.0" x="376.0" y="519.043" width="6.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 4/ // // X // // X // // X // // X // // // X // // // X // // X // // X // // // X // // </title> </rect> <rect stroke="black" stroke-width="1.0" x="427.0" y="519.043" width="6.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 5/ // // X // // // // X // // // // // // // // // // X // // // // // // // </title> </rect> <rect stroke="black" stroke-width="1.0" x="476.0" y="519.043" width="6.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 6/ // // X // // X // // X // // // // // X // // // X // // X // // X // // // X // // </title> </rect> <rect stroke="black" stroke-width="1.0" x="527.0" y="519.043" width="6.0" height="160.86299999999994" fill="red" opacity="0.2"> <title stroke="black" stroke-width="1.0">BODYCOLUMN: 7/ // // X // // // // // // // // // // // // // // X // // // // // // // </title> </rect> </g> <g class="body.cellBoxes" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"> <g class="col.0"> <rect stroke="black" stroke-width="1.0" x="51.024" y="519.043" width="131.80718" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.0"> <title stroke="black" stroke-width="1.0">0.0/Behavioural and demographic measures</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="531.7460000000001" width="139.953696" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.1"> <title stroke="black" stroke-width="1.0">0.1/Structured interview (DSM ADHD rating)</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="544.4480000000001" width="95.029516" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.2"> <title stroke="black" stroke-width="1.0">0.2/Connors Parent Rating Scale</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="557.1500000000001" width="107.34251599999999" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.4"> <title stroke="black" stroke-width="1.0">0.4/Global Clinical Impression scale</title> </rect> <rect stroke="black" stroke-width="1.0" x="166.677" y="555.823" width="2.6167560000000094" height="5.988000000000056" fill="red" opacity="0.2" class="cell.0.5"> <title stroke="black" stroke-width="1.0">0.5/^{a}</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="569.844" width="135.558516" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.6"> <title stroke="black" stroke-width="1.0">0.6/Current health and medical questionnaire</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="582.546" width="94.11551599999999" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.7"> <title stroke="black" stroke-width="1.0">0.7/Demographics questionnaire</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="595.248" width="89.09400000000002" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.8"> <title stroke="black" stroke-width="1.0">0.8/Omega-3 intake/food diary</title> </rect> <rect stroke="black" stroke-width="1.0" x="51.024" y="607.951" width="148.79417999999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.9"> <title stroke="black" stroke-width="1.0">0.9/Cognitive and psychophysiological measures</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="620.653" width="95.50400000000002" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.11"> <title stroke="black" stroke-width="1.0">0.11/COMPASS cognitive battery</title> </rect> <rect stroke="black" stroke-width="1.0" x="154.828" y="619.376" width="2.6167560000000094" height="5.988000000000056" fill="red" opacity="0.2" class="cell.0.12"> <title stroke="black" stroke-width="1.0">0.12/^{a}</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.468" y="633.34" width="126.650696" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.14"> <title stroke="black" stroke-width="1.0">0.14/Test of Variables of Attention (TOVA)</title> </rect> <rect stroke="black" stroke-width="1.0" x="186.066" y="632.0749999999999" width="2.6167560000000094" height="5.988000000000056" fill="red" opacity="0.2" class="cell.0.15"> <title stroke="black" stroke-width="1.0">0.15/^{a}</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.468" y="646.039" width="100.983696" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.16"> <title stroke="black" stroke-width="1.0">0.16/Brunel Mood Scale (BRUMS)</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.468" y="658.741" width="57.55051599999999" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.18"> <title stroke="black" stroke-width="1.0">0.18/EEG resting state</title> </rect> <rect stroke="black" stroke-width="1.0" x="116.901" y="657.473" width="2.616755999999995" height="5.988000000000056" fill="red" opacity="0.2" class="cell.0.19"> <title stroke="black" stroke-width="1.0">0.19/^{a}</title> </rect> <rect stroke="black" stroke-width="1.0" x="59.475" y="671.438" width="121.04469600000002" height="8.467999999999961" fill="red" opacity="0.2" class="cell.0.21"> <title stroke="black" stroke-width="1.0">0.21/Steady-state topography (CPT-AXE)</title> </rect> <rect stroke="black" stroke-width="1.0" x="180.454" y="670.1729999999999" width="2.6167560000000094" height="5.988000000000056" fill="red" opacity="0.2" class="cell.0.22"> <title stroke="black" stroke-width="1.0">0.22/^{a}</title> </rect> </g> <g class="col.1"> <rect stroke="black" stroke-width="1.0" x="232.836" y="531.7460000000001" width="6.080024000000009" height="8.467999999999961" fill="red" opacity="0.2" class="cell.1.1"> <title stroke="black" stroke-width="1.0">1.1/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="232.836" y="569.844" width="6.080024000000009" height="8.467999999999961" fill="red" opacity="0.2" class="cell.1.6"> <title stroke="black" stroke-width="1.0">1.6/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="232.828" y="582.546" width="6.080024000000009" height="8.467999999999961" fill="red" opacity="0.2" class="cell.1.7"> <title stroke="black" stroke-width="1.0">1.7/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="232.828" y="595.248" width="6.080024000000009" height="8.467999999999961" fill="red" opacity="0.2" class="cell.1.8"> <title stroke="black" stroke-width="1.0">1.8/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="232.838" y="620.6370000000001" width="6.080024000000009" height="8.467999999999961" fill="red" opacity="0.2" class="cell.1.11"> <title stroke="black" stroke-width="1.0">1.11/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="232.838" y="633.337" width="6.080024000000009" height="8.467999999999961" fill="red" opacity="0.2" class="cell.1.14"> <title stroke="black" stroke-width="1.0">1.14/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="232.838" y="646.039" width="6.080024000000009" height="8.467999999999961" fill="red" opacity="0.2" class="cell.1.16"> <title stroke="black" stroke-width="1.0">1.16/X</title> </rect> </g> <g class="col.2"> <rect stroke="black" stroke-width="1.0" x="280.8" y="544.4480000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.2"> <title stroke="black" stroke-width="1.0">2.2/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="280.8" y="557.142" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.4"> <title stroke="black" stroke-width="1.0">2.4/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="280.8" y="569.844" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.6"> <title stroke="black" stroke-width="1.0">2.6/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="280.8" y="620.6370000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.11"> <title stroke="black" stroke-width="1.0">2.11/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="280.8" y="633.337" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.14"> <title stroke="black" stroke-width="1.0">2.14/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="280.802" y="646.039" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.16"> <title stroke="black" stroke-width="1.0">2.16/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="280.8" y="658.735" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.18"> <title stroke="black" stroke-width="1.0">2.18/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="280.8" y="671.4340000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.2.21"> <title stroke="black" stroke-width="1.0">2.21/X</title> </rect> </g> <g class="col.3"> <rect stroke="black" stroke-width="1.0" x="331.202" y="544.4480000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.3.2"> <title stroke="black" stroke-width="1.0">3.2/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="331.203" y="569.844" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.3.6"> <title stroke="black" stroke-width="1.0">3.6/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="331.196" y="646.039" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.3.16"> <title stroke="black" stroke-width="1.0">3.16/X</title> </rect> </g> <g class="col.4"> <rect stroke="black" stroke-width="1.0" x="376.728" y="544.4480000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.2"> <title stroke="black" stroke-width="1.0">4.2/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.724" y="557.142" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.4"> <title stroke="black" stroke-width="1.0">4.4/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.728" y="569.844" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.6"> <title stroke="black" stroke-width="1.0">4.6/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.711" y="595.248" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.8"> <title stroke="black" stroke-width="1.0">4.8/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.721" y="620.6370000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.11"> <title stroke="black" stroke-width="1.0">4.11/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.721" y="633.337" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.14"> <title stroke="black" stroke-width="1.0">4.14/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.721" y="646.039" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.16"> <title stroke="black" stroke-width="1.0">4.16/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.724" y="658.735" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.18"> <title stroke="black" stroke-width="1.0">4.18/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="376.724" y="671.4340000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.4.21"> <title stroke="black" stroke-width="1.0">4.21/X</title> </rect> </g> <g class="col.5"> <rect stroke="black" stroke-width="1.0" x="427.181" y="544.4480000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.5.2"> <title stroke="black" stroke-width="1.0">5.2/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="427.181" y="569.844" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.5.6"> <title stroke="black" stroke-width="1.0">5.6/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="427.175" y="646.039" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.5.16"> <title stroke="black" stroke-width="1.0">5.16/X</title> </rect> </g> <g class="col.6"> <rect stroke="black" stroke-width="1.0" x="476.847" y="544.4480000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.2"> <title stroke="black" stroke-width="1.0">6.2/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="476.84" y="557.142" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.4"> <title stroke="black" stroke-width="1.0">6.4/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="476.847" y="569.844" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.6"> <title stroke="black" stroke-width="1.0">6.6/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="476.841" y="620.6370000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.11"> <title stroke="black" stroke-width="1.0">6.11/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="476.841" y="633.337" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.14"> <title stroke="black" stroke-width="1.0">6.14/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="476.84" y="646.039" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.16"> <title stroke="black" stroke-width="1.0">6.16/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="476.84" y="658.735" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.18"> <title stroke="black" stroke-width="1.0">6.18/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="476.84" y="671.4340000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.6.21"> <title stroke="black" stroke-width="1.0">6.21/X</title> </rect> </g> <g class="col.7"> <rect stroke="black" stroke-width="1.0" x="527.25" y="544.4480000000001" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.7.2"> <title stroke="black" stroke-width="1.0">7.2/X</title> </rect> <rect stroke="black" stroke-width="1.0" x="527.243" y="646.039" width="6.08002399999998" height="8.467999999999961" fill="red" opacity="0.2" class="cell.7.16"> <title stroke="black" stroke-width="1.0">7.16/X</title> </rect> </g> </g> <g class="footer.title" transform="matrix(1.0,0.0,0.0,1.0,0.0,0.0)"> <rect stroke="black" stroke-width="1.0" x="51.024" y="690.4689999999999" width="245.45575200000002" height="23.95900000000006" fill="blue" opacity="0.2"> <title stroke="black" stroke-width="1.0">footer: footer.title: {[TimesNewRoman x 3]}{[5.988 x 2, 8.468]}{[normal x 3]}{[null x 2, italic]} //^{a} These items were not completed by inter-state participants AH at home, Swin at Swinburne, Prac practice day, CPT-AXE continuous performance task-AXE </title> </rect> </g> <rect x="51.0" y="449.765" width="494.16848000000005" height="264.663" stroke="black" stroke-width="2.0" fill="none"/> </g> </svg> </div> </td> </tr> </table> </html>
ContentMine/cm-ucl
corpus-oa-pmr/10.1007_s00213-016-4471-y/pdftable/doubleTable1.html
HTML
apache-2.0
224,004
/* * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.vision.v1p2beta1.model; /** * Response to a single file annotation request. A file may contain one or more images, which * individually have their own responses. * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Cloud Vision API. For a detailed explanation see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class GoogleCloudVisionV1p3beta1AnnotateFileResponse extends com.google.api.client.json.GenericJson { /** * Information about the file for which this response is generated. * The value may be {@code null}. */ @com.google.api.client.util.Key private GoogleCloudVisionV1p3beta1InputConfig inputConfig; /** * Individual responses to images found within the file. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<GoogleCloudVisionV1p3beta1AnnotateImageResponse> responses; /** * This field gives the total number of pages in the file. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.Integer totalPages; /** * Information about the file for which this response is generated. * @return value or {@code null} for none */ public GoogleCloudVisionV1p3beta1InputConfig getInputConfig() { return inputConfig; } /** * Information about the file for which this response is generated. * @param inputConfig inputConfig or {@code null} for none */ public GoogleCloudVisionV1p3beta1AnnotateFileResponse setInputConfig(GoogleCloudVisionV1p3beta1InputConfig inputConfig) { this.inputConfig = inputConfig; return this; } /** * Individual responses to images found within the file. * @return value or {@code null} for none */ public java.util.List<GoogleCloudVisionV1p3beta1AnnotateImageResponse> getResponses() { return responses; } /** * Individual responses to images found within the file. * @param responses responses or {@code null} for none */ public GoogleCloudVisionV1p3beta1AnnotateFileResponse setResponses(java.util.List<GoogleCloudVisionV1p3beta1AnnotateImageResponse> responses) { this.responses = responses; return this; } /** * This field gives the total number of pages in the file. * @return value or {@code null} for none */ public java.lang.Integer getTotalPages() { return totalPages; } /** * This field gives the total number of pages in the file. * @param totalPages totalPages or {@code null} for none */ public GoogleCloudVisionV1p3beta1AnnotateFileResponse setTotalPages(java.lang.Integer totalPages) { this.totalPages = totalPages; return this; } @Override public GoogleCloudVisionV1p3beta1AnnotateFileResponse set(String fieldName, Object value) { return (GoogleCloudVisionV1p3beta1AnnotateFileResponse) super.set(fieldName, value); } @Override public GoogleCloudVisionV1p3beta1AnnotateFileResponse clone() { return (GoogleCloudVisionV1p3beta1AnnotateFileResponse) super.clone(); } }
googleapis/google-api-java-client-services
clients/google-api-services-vision/v1p2beta1/1.27.0/com/google/api/services/vision/v1p2beta1/model/GoogleCloudVisionV1p3beta1AnnotateFileResponse.java
Java
apache-2.0
4,017
namespace GreenPipes.BenchmarkConsole { using System; using Internals.Extensions; /// <summary> /// Stores a single scope data value /// </summary> /// <typeparam name="TPayload"></typeparam> public class PayloadValue<TPayload> : IPayloadValue<TPayload> where TPayload : class { readonly TPayload _value; public PayloadValue(TPayload value) { if (value == default(TPayload)) throw new PayloadNotFoundException($"The payload was not found: {TypeCache<TPayload>.ShortName}"); _value = value; } Type IPayloadValue.ValueType => typeof(TPayload); TPayload IPayloadValue<TPayload>.Value => _value; bool IPayloadValue.Implements(Type type) { return type.IsInstanceOfType(_value); } bool IPayloadValue.TryGetValue<T>(out T value) { value = _value as T; return value != null; } } }
MassTransit/GreenPipes
tests/GreenPipes.BenchmarkConsole/PayloadValue.cs
C#
apache-2.0
1,005
import { Nullable } from "babylonjs/types"; import { Vector3 } from "babylonjs/Maths/math.vector"; import { Color3 } from 'babylonjs/Maths/math.color'; import { DirectionalLight } from "babylonjs/Lights/directionalLight"; import { PointLight } from "babylonjs/Lights/pointLight"; import { SpotLight } from "babylonjs/Lights/spotLight"; import { Light } from "babylonjs/Lights/light"; import { TransformNode } from "babylonjs/Meshes/transformNode"; import { IKHRLightsPunctual_LightType, IKHRLightsPunctual_LightReference, IKHRLightsPunctual_Light, IKHRLightsPunctual } from "babylonjs-gltf2interface"; import { INode } from "../glTFLoaderInterfaces"; import { IGLTFLoaderExtension } from "../glTFLoaderExtension"; import { GLTFLoader, ArrayItem } from "../glTFLoader"; const NAME = "KHR_lights_punctual"; /** * [Specification](https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_lights_punctual) */ export class KHR_lights implements IGLTFLoaderExtension { /** * The name of this extension. */ public readonly name = NAME; /** * Defines whether this extension is enabled. */ public enabled: boolean; private _loader: GLTFLoader; private _lights?: IKHRLightsPunctual_Light[]; /** @hidden */ constructor(loader: GLTFLoader) { this._loader = loader; this.enabled = this._loader.isExtensionUsed(NAME); } /** @hidden */ public dispose() { (this._loader as any) = null; delete this._lights; } /** @hidden */ public onLoading(): void { const extensions = this._loader.gltf.extensions; if (extensions && extensions[this.name]) { const extension = extensions[this.name] as IKHRLightsPunctual; this._lights = extension.lights; } } /** @hidden */ public loadNodeAsync(context: string, node: INode, assign: (babylonTransformNode: TransformNode) => void): Nullable<Promise<TransformNode>> { return GLTFLoader.LoadExtensionAsync<IKHRLightsPunctual_LightReference, TransformNode>(context, node, this.name, (extensionContext, extension) => { return this._loader.loadNodeAsync(context, node, (babylonMesh) => { let babylonLight: Light; const light = ArrayItem.Get(extensionContext, this._lights, extension.light); const name = light.name || babylonMesh.name; this._loader.babylonScene._blockEntityCollection = this._loader._forAssetContainer; switch (light.type) { case IKHRLightsPunctual_LightType.DIRECTIONAL: { babylonLight = new DirectionalLight(name, Vector3.Backward(), this._loader.babylonScene); break; } case IKHRLightsPunctual_LightType.POINT: { babylonLight = new PointLight(name, Vector3.Zero(), this._loader.babylonScene); break; } case IKHRLightsPunctual_LightType.SPOT: { const babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, this._loader.babylonScene); babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2; babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2; babylonLight = babylonSpotLight; break; } default: { this._loader.babylonScene._blockEntityCollection = false; throw new Error(`${extensionContext}: Invalid light type (${light.type})`); } } this._loader.babylonScene._blockEntityCollection = false; babylonLight.falloffType = Light.FALLOFF_GLTF; babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White(); babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity; babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range; babylonLight.parent = babylonMesh; this._loader._babylonLights.push(babylonLight); GLTFLoader.AddPointerMetadata(babylonLight, extensionContext); assign(babylonMesh); }); }); } } GLTFLoader.RegisterExtension(NAME, (loader) => new KHR_lights(loader));
NicolasBuecher/Babylon.js
loaders/src/glTF/2.0/Extensions/KHR_lights_punctual.ts
TypeScript
apache-2.0
4,565
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_21) on Fri Dec 02 11:53:58 IST 2011 --> <TITLE> Uses of Class com.invient.vaadin.charts.InvientChartsConfig.AxisBase.DateTimePlotLine </TITLE> <META NAME="date" CONTENT="2011-12-02"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.invient.vaadin.charts.InvientChartsConfig.AxisBase.DateTimePlotLine"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/invient/vaadin/charts//class-useInvientChartsConfig.AxisBase.DateTimePlotLine.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="InvientChartsConfig.AxisBase.DateTimePlotLine.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>com.invient.vaadin.charts.InvientChartsConfig.AxisBase.DateTimePlotLine</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#com.invient.vaadin.charts"><B>com.invient.vaadin.charts</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="com.invient.vaadin.charts"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A> in <A HREF="../../../../../com/invient/vaadin/charts/package-summary.html">com.invient.vaadin.charts</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/invient/vaadin/charts/package-summary.html">com.invient.vaadin.charts</A> that return types with arguments of type <A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.LinkedHashSet&lt;<A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A>&gt;</CODE></FONT></TD> <TD><CODE><B>InvientChartsConfig.DateTimeAxis.</B><B><A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.DateTimeAxis.html#getPlotLines()">getPlotLines</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../com/invient/vaadin/charts/package-summary.html">com.invient.vaadin.charts</A> with parameters of type <A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>InvientChartsConfig.DateTimeAxis.</B><B><A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.DateTimeAxis.html#addPlotLine(com.invient.vaadin.charts.InvientChartsConfig.AxisBase.DateTimePlotLine)">addPlotLine</A></B>(<A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A>&nbsp;plotLine)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>InvientChartsConfig.DateTimeAxis.</B><B><A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.DateTimeAxis.html#removePlotLine(com.invient.vaadin.charts.InvientChartsConfig.AxisBase.DateTimePlotLine)">removePlotLine</A></B>(<A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A>&nbsp;plotLine)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Method parameters in <A HREF="../../../../../com/invient/vaadin/charts/package-summary.html">com.invient.vaadin.charts</A> with type arguments of type <A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>InvientChartsConfig.DateTimeAxis.</B><B><A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.DateTimeAxis.html#setPlotLines(java.util.LinkedHashSet)">setPlotLines</A></B>(java.util.LinkedHashSet&lt;<A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts">InvientChartsConfig.AxisBase.DateTimePlotLine</A>&gt;&nbsp;plotLines)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/invient/vaadin/charts/InvientChartsConfig.AxisBase.DateTimePlotLine.html" title="class in com.invient.vaadin.charts"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/invient/vaadin/charts//class-useInvientChartsConfig.AxisBase.DateTimePlotLine.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="InvientChartsConfig.AxisBase.DateTimePlotLine.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
invient-cp/InvientCharts
doc/com/invient/vaadin/charts/class-use/InvientChartsConfig.AxisBase.DateTimePlotLine.html
HTML
apache-2.0
11,599
/** * Copyright 2015 LinkedIn Corp. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ package security; import javax.security.auth.Subject; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; import java.util.Map; /** * This LoginModule performs dummy authentication. * Any username and password can work for authentication */ public class DummyLoginModule implements LoginModule { public void initialize(final Subject subject, final CallbackHandler callbackHandler, final Map<String, ?> sharedState, final Map<String, ?> options) { } public boolean login() throws LoginException { return true; } public boolean commit() throws LoginException { return true; } public boolean abort() throws LoginException { return true; } public boolean logout() throws LoginException { return true; } }
alyiwang/WhereHows
wherehows-frontend/app/security/DummyLoginModule.java
Java
apache-2.0
1,354
package aQute.bnd.osgi.repository; import static java.util.Objects.requireNonNull; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Path; import java.util.Collection; import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; import org.osgi.resource.Resource; import aQute.bnd.annotation.ConsumerType; import aQute.bnd.osgi.Domain; import aQute.bnd.osgi.resource.ResourceBuilder; import aQute.lib.exceptions.Exceptions; import aQute.lib.io.IO; import aQute.libg.reporter.slf4j.Slf4jReporter; import aQute.service.reporter.Reporter; /** * Simple program to generate an index from a set of bundles. */ public class SimpleIndexer { /** * A functional interface providing an entry point for performing additional * analysis of indexed files. */ @ConsumerType @FunctionalInterface public interface FileAnalyzer { /** * <p> * This method is invoked for each file being indexed. Implementations * may inspect the requirements and capabilities already assembled from * the file. They may add zero or more capabilities and/or requirements * to the supplied resource builder possibly extracted as additional * metadata from the file. * </p> * <p> * The following operations on {@link ResourceBuilder resourceBuilder} * are reduced to a no-op: * <ul> * <li>{@link ResourceBuilder#build()} does nothing, returns null</li> * <li>{@link ResourceBuilder#addFile(File, URI)} does nothing, returns * false</li> * <li>{@link ResourceBuilder#addManifest(Domain)} does nothing, returns * false</li> * <li>{@link ResourceBuilder#getCapabilities()} returns immutable * list</li> * <li>{@link ResourceBuilder#getRequirements()} returns immutable * list</li> * </ul> * * @param file The current file * @param resourceBuilder the resource builder used to process the file */ void analyzeFile(File file, ResourceBuilder resourceBuilder) throws Exception; } private final Set<File> files = new LinkedHashSet<>(); private Path base; private boolean compress = false; private String name; private long increment = -1L; private FileAnalyzer analyzer; private Reporter reporter = new Slf4jReporter(SimpleIndexer.class); public SimpleIndexer() {} /** * Adds files to be indexed. * * @param files the files to include in the index */ public SimpleIndexer files(Collection<File> files) { this.files.addAll(requireNonNull(files)); return this; } /** * @param base the base URI from which the index urls are relative */ public SimpleIndexer base(URI base) { this.base = requireNonNull(base).getScheme() .equalsIgnoreCase("file") ? new File(base).toPath() .toAbsolutePath() : null; return this; } /** * @param compress compress with GZIP when true */ public SimpleIndexer compress(boolean compress) { this.compress = compress; return this; } /** * @param name an optional name for the index */ public SimpleIndexer name(String name) { this.name = name; return this; } /** * @param analyzer a resource analyzer */ public SimpleIndexer analyzer(FileAnalyzer analyzer) { this.analyzer = analyzer; return this; } /** * @param increment the timestamp of the index */ public SimpleIndexer increment(long increment) { this.increment = increment; return this; } /** * Generate the index to the specified output stream. * * @param outputStream the output stream to write the index file * @throws IOException if a file cannot be indexed */ public void index(OutputStream outputStream) throws IOException { repository().save(requireNonNull(outputStream)); } /** * Generate the index to the specified file. * * @param file the file to write the index file * @throws IOException if a file cannot be indexed */ public void index(File file) throws IOException { repository().save(requireNonNull(file)); } /** * Return the resources so far. * * @return the set of resources handled so far. */ public List<Resource> getResources() { List<Resource> resources = files.stream() .filter(f -> f.isFile() && !f.isHidden() && f.canRead()) .map(this::indexFile) .filter(Objects::nonNull) .collect(Collectors.toList()); return resources; } public SimpleIndexer reporter(Reporter reporter) { this.reporter = reporter; return this; } private XMLResourceGenerator repository() { XMLResourceGenerator repository = new XMLResourceGenerator(); List<Resource> resources = getResources(); repository.resources(resources); if (name != null) { repository.name(name); } if (increment > -1) { repository.increment(increment); } if (compress) { repository.compress(); } return repository; } private Resource indexFile(File file) { try { ResourceBuilder resourceBuilder = new ResourceBuilder(); if (resourceBuilder.addFile(file, relativize(file))) { if (analyzer != null) { analyzer.analyzeFile(file, resourceBuilder.safeResourceBuilder()); } return resourceBuilder.build(); } } catch (Exception e) { reporter.exception(e, "Could not index file %s", file); } return null; } private URI relativize(File file) { if (base == null) { return file.toURI(); } Path filePath = file.toPath() .toAbsolutePath(); Path relativePath = base.relativize(filePath); // Note that relativePath.toURI() gives the wrong answer for us! // We have to do some Windows related mashing here too :( String ssp = IO.normalizePath(relativePath); URI relativeURI; try { relativeURI = new URI(null, ssp, null); } catch (URISyntaxException e) { throw Exceptions.duck(e); } reporter.trace("Resolving %s relative to %s; Relative Path: %s, URI: %s", filePath, base, relativePath, relativeURI); return relativeURI; } }
psoreide/bnd
biz.aQute.bndlib/src/aQute/bnd/osgi/repository/SimpleIndexer.java
Java
apache-2.0
5,990
{% extends 'example/base.html' %} {% block title %} 搜索结果页面 {% endblock %} {% block contents %} {% load staticfiles %} <div class="row wrapper border-bottom white-bg page-heading"> <div class="col-lg-9"> <h2>搜索结果</h2> <ol class="breadcrumb"> <li> <a href="/example/">主页</a> </li> <li> 其他页面 </li> <li> <strong>搜索结果</strong> </li> </ol> </div> </div> <div class="wrapper wrapper-content animated fadeInRight"> <div class="row"> <div class="col-lg-12"> <div class="ibox float-e-margins"> <div class="ibox-content"> <h2> 为您找到相关结果约100,000,000个: <span class="text-navy">“后台主题”</span> </h2> <small>搜索用时 (0.23秒)</small> <div class="search-form"> <form action="/example/" method="get"> <div class="input-group"> <input type="text" placeholder="后台主题" name="search" class="form-control input-lg"> <div class="input-group-btn"> <button class="btn btn-lg btn-primary" type="submit"> 搜索 </button> </div> </div> </form> </div> <div class="hr-line-dashed"></div> <div class="search-result"> <h3><a href="/example/search_results/#">定制后台的主题目录(Theme)</a></h3> <a href="/example/search_results/#" class="search-link">koda.iteye.com/blog/10...</a> <p> 不像前台Theme目录的改变可以通过后台界面配置,后台的主题目录要自己修改相应的配置文件。 Theme目录的配置再Adminhtml模块,打开后台的配置文件 $MAGENO_DIR\app\code... </p> </div> <div class="hr-line-dashed"></div> <div class="search-result"> <h3><a href="/example/search_results/#">wordpress主题添加后台设置选项页面</a></h3> <a href="/example/search_results/#" class="search-link">www.ashuwp.com/courses...‎</a> <p> 如果你制作的主题,logo要用户自己去替换、首页调用了某个分类的文章,要更改的话得自己去改源码...这样不光用户用的不方便,有时候还得找你来帮忙,所以如果你的... </p> </div> <div class="hr-line-dashed"></div> <div class="search-result"> <h3><a href="/example/search_results/#">DiscuzX后台:主题回收站功能图文详解</a></h3> <a href="/example/search_results/#" class="search-link">www.moke8.com/article-...‎</a> <p> 主题回收站便能实现这个愿望,将前台删除的主题先放到主题回收站里,以便管理员进一步确认是否删除。 需要注意的是这个功能需要在后台开启才可以,首先这个功能是跟每个... </p> </div> <div class="hr-line-dashed"></div> <div class="search-result"> <h3><a href="/example/search_results/#">WordPress 主题后台选项简易添加(二) | 木木木木木</a></h3> <a href="/example/search_results/#" class="search-link">www.zi-han.net/wordpre... </a> <p> 此文接年初发的 《WordPress 主题选项简易添加》 ,那篇也仅放出了包含“统计代码”设置的functions代码。不过说回来,那段主题后台选项代码的扩展性还是相当不错的。... </p> </div> <div class="hr-line-dashed"></div> <div class="search-result"> <h3><a href="/example/search_results/#">[教程]wordpress主题后台设置框架Options Framework(中文版) </a></h3> <a href="/example/search_results/#" class="search-link">www.zi-han.net/wordpre... </a> <p> 对于很多刚开始写wordpress主题的新手来说,想给主题加上一些设置选项,方便使用者灵活选择和定制,这时候后台框架就成了一个绕不过的话题,一般方法无外乎两种,一种是... </p> </div> <div class="hr-line-dashed"></div> <div class="search-result"> <h3><a href="/example/search_results/#">WordPress后台主题插件:MP6 和 Bootstrap Admin | WordPress大学</a></h3> <a href="/example/search_results/#" class="search-link">www.wpdaxue.com/mp6-bo... ‎‎</a> <p> 2014年4月29日 - 倡萌之前推荐过 WordPress后台主题插件:WP Admin Theme lime ,今天在推荐两款 MP6 和 Bootstrap Admin。 MP6 MP6 是WordPress核心团队开发的Word... </p> </div> <div class="hr-line-dashed"></div> <div class="text-center"> <div class="btn-group"> <button class="btn btn-white" type="button"><i class="fa fa-chevron-left"></i> </button> <button class="btn btn-white">1</button> <button class="btn btn-white active">2</button> <button class="btn btn-white">3</button> <button class="btn btn-white">4</button> <button class="btn btn-white">5</button> <button class="btn btn-white">6</button> <button class="btn btn-white">7</button> <button class="btn btn-white" type="button"><i class="fa fa-chevron-right"></i> </button> </div> </div> </div> </div> </div> </div> </div> {% endblock %} {% block linkscriptend %} {% endblock %}
chenqi123/ipaas
example/templates/search_results.html
HTML
apache-2.0
8,070
/* * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.eventsimulator.core.simulator.randomdatafeedsimulation.bean; /** * PrimitiveBasedAttribute represents the Random data generator based on primitive data types * such as String,Integer,Float,Double,Long,Boolean * It extends FeedSimulationStreamAttributeDto abstract class * <p> * Constant value to represent to this type is "PRIMITIVEBASED" * <p> * Eg for json string for configuration * <p> * <p> * { * "type": "PRIMITIVEBASED", * "min": "2", * "max": "200", * "length": "2", * } * </p> */ public class PrimitiveBasedAttribute extends FeedSimulationStreamAttributeDto { /** * Minimum value for numeric values to be generate */ private Object min; /** * Maximum value for numeric values to be generated */ private Object max; /** * If attribute type is string length indicates length of the string to be generated * If attribute type is Float or Double length indicates no of digits after the decimal point */ private int length; /** * Initialize PrimitiveBasedAttribute with parent class * * @param type Random Data Generator type * @param min Minimum Value * @param max Maximum Value * @param length Length */ public PrimitiveBasedAttribute(String type, Object min, Object max, int length) { super(); this.min = min; this.max = max; this.length = length; } public Object getMin() { return min; } public void setMin(Object min) { this.min = min; } public Object getMax() { return max; } public void setMax(Object max) { this.max = max; } public int getLength() { return length; } public void setLength(int length) { this.length = length; } }
nirmal070125/product-bam
modules/components/org.wso2.carbon.event.simulator.core/src/main/java/org/wso2/eventsimulator/core/simulator/randomdatafeedsimulation/bean/PrimitiveBasedAttribute.java
Java
apache-2.0
2,502
package awsutil import ( "fmt" "os" "sort" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sts" "path" ) type sessionResult struct { accountName string accountId string awsSession *session.Session regions []string err error } func getCredentialsPath() string { return getAwsPath("AWS_CREDENTIAL_FILE", "credentials") } func getConfigPath() string { return getAwsPath("AWS_CONFIG_FILE", "config") } func getAwsPath(environ, fileName string) string { value := os.Getenv(environ) if value != "" { return value } home := os.Getenv("HOME") return path.Join(home, ".aws", fileName) } func (c *CredentialsOptions) setDefaults() *CredentialsOptions { if c.CredentialsPath == "" { c.CredentialsPath = *awsCredentialsFile } if c.ConfigPath == "" { c.ConfigPath = *awsConfigFile } return c } func tryLoadCredentialsWithOptions( options *CredentialsOptions) (*CredentialsStore, map[string]error, error) { accountNames, err := listAccountNames(options) if err != nil { return nil, nil, err } cs, unloadableAccounts := createCredentials(accountNames, options) return cs, unloadableAccounts, nil } func loadCredentials() (*CredentialsStore, error) { var options CredentialsOptions cs, unloadableAccounts, err := tryLoadCredentialsWithOptions( options.setDefaults()) if err != nil { return nil, err } for _, err := range unloadableAccounts { return nil, err } return cs, nil } func createCredentials( accountNames []string, options *CredentialsOptions) ( *CredentialsStore, map[string]error) { cs := &CredentialsStore{ sessionMap: make(map[string]*session.Session), accountIdToName: make(map[string]string), accountNameToId: make(map[string]string), accountRegions: make(map[string][]string), } resultsChannel := make(chan sessionResult, len(accountNames)) for _, accountName := range accountNames { go func(accountName string) { resultsChannel <- createSession(accountName, options) }(accountName) } unloadableAccounts := make(map[string]error) for range accountNames { result := <-resultsChannel if result.err != nil { unloadableAccounts[result.accountName] = result.err } else { cs.accountNames = append(cs.accountNames, result.accountName) cs.sessionMap[result.accountName] = result.awsSession cs.accountIdToName[result.accountId] = result.accountName cs.accountNameToId[result.accountName] = result.accountId cs.accountRegions[result.accountName] = result.regions } } close(resultsChannel) sort.Strings(cs.accountNames) return cs, unloadableAccounts } func createSession( accountName string, options *CredentialsOptions) sessionResult { awsSession, err := session.NewSessionWithOptions(session.Options{ Profile: accountName, SharedConfigState: session.SharedConfigEnable, SharedConfigFiles: []string{ options.CredentialsPath, options.ConfigPath, }, }) if err != nil { return sessionResult{ err: fmt.Errorf("session.NewSessionWithOptions: %s", err), accountName: accountName, } } stsService := sts.New(awsSession) inp := &sts.GetCallerIdentityInput{} var accountId string if out, err := stsService.GetCallerIdentity(inp); err != nil { return sessionResult{ err: fmt.Errorf("sts.GetCallerIdentity: %s", err), accountName: accountName, } } else { if arnV, err := arn.Parse(aws.StringValue(out.Arn)); err != nil { return sessionResult{err: err, accountName: accountName} } else { accountId = arnV.AccountID } } regions, err := listRegions(CreateService(awsSession, "us-east-1")) if err != nil { // Try the ec2::DescribeRegions call in other regions before giving // up and reporting the error. We may need to add to this list. otherRegions := []string{"cn-north-1"} for _, otherRegion := range otherRegions { regions, err := listRegions(CreateService(awsSession, otherRegion)) if err == nil { return sessionResult{ accountName: accountName, accountId: accountId, awsSession: awsSession, regions: regions, } } } // If no success with other regions return the original error return sessionResult{err: err, accountName: accountName} } return sessionResult{ accountName: accountName, accountId: accountId, awsSession: awsSession, regions: regions, } }
Symantec/Dominator
lib/awsutil/credentials.go
GO
apache-2.0
4,428
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>nested_attributes.rb</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="../../../../../../../../../../../../css/reset.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../../../../../../../../../css/main.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../../../../../../../../../css/github.css" type="text/css" media="screen" /> <script src="../../../../../../../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../../../../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div class="banner"> <span>Ruby on Rails 4.2.3</span><br /> <h1> nested_attributes.rb </h1> <ul class="files"> <li> ../../../../.rvm/gems/ruby-2.2.2@playme/gems/activerecord-4.2.3/lib/active_record/nested_attributes.rb </li> <li>Last modified: 2015-07-23 13:52:58 +0100</li> </ul> </div> <div id="bodyContent"> <div id="content"> <!-- File only: requires --> <div class="sectiontitle">Required Files</div> <ul> <li>active_support/core_ext/hash/except</li> <li>active_support/core_ext/object/try</li> <li>active_support/core_ext/hash/indifferent_access</li> </ul> <!-- Namespace --> <div class="sectiontitle">Namespace</div> <ul> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../../classes/ActiveRecord.html">ActiveRecord</a> </li> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../../classes/ActiveRecord/NestedAttributes.html">ActiveRecord::NestedAttributes</a> </li> <li> <span class="type">MODULE</span> <a href="../../../../../../../../../../../../classes/ActiveRecord/NestedAttributes/ClassMethods.html">ActiveRecord::NestedAttributes::ClassMethods</a> </li> <li> <span class="type">CLASS</span> <a href="../../../../../../../../../../../../classes/ActiveRecord/NestedAttributes/TooManyRecords.html">ActiveRecord::NestedAttributes::TooManyRecords</a> </li> </ul> <!-- Methods --> </div> </div> </body> </html>
l33z3r/playme
doc/api/files/__/__/__/__/_rvm/gems/ruby-2_2_2@playme/gems/activerecord-4_2_3/lib/active_record/nested_attributes_rb.html
HTML
apache-2.0
3,102
/* * ModeShape (http://www.modeshape.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.modeshape.example.logging.jdk; import org.junit.Test; public class ModeShapeExampleTest { @Test public void shouldRunApplication() throws Exception { String[] argv = new String[] {}; ModeShapeExample.main(argv); } }
stemig62/modeshape-examples
modeshape-jdk-logging-example/src/test/java/org/modeshape/example/logging/jdk/ModeShapeExampleTest.java
Java
apache-2.0
862
/* * Copyright 2015 data Artisans GmbH * * 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.dataartisans.flinktraining.exercises.datastream_java.utils; import com.dataartisans.flinktraining.exercises.datastream_java.datatypes.TaxiRide; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.java.typeutils.TypeExtractor; import org.apache.flink.streaming.util.serialization.DeserializationSchema; import org.apache.flink.streaming.util.serialization.SerializationSchema; /** * Implements a SerializationSchema and DeserializationSchema for TaxiRide for Kafka data sources and sinks. */ public class TaxiRideSchema implements DeserializationSchema<TaxiRide>, SerializationSchema<TaxiRide> { @Override public byte[] serialize(TaxiRide element) { return element.toString().getBytes(); } @Override public TaxiRide deserialize(byte[] message) { return TaxiRide.fromString(new String(message)); } @Override public boolean isEndOfStream(TaxiRide nextElement) { return false; } @Override public TypeInformation<TaxiRide> getProducedType() { return TypeExtractor.getForClass(TaxiRide.class); } }
kodizant/flink-training-exercises
src/main/java/com/dataartisans/flinktraining/exercises/datastream_java/utils/TaxiRideSchema.java
Java
apache-2.0
1,668
/* * Copyright 2018 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.thoughtworks.go.config; import com.google.gson.Gson; import com.thoughtworks.go.config.preprocessor.SkipParameterResolution; import com.thoughtworks.go.config.validation.NameTypeValidator; import com.thoughtworks.go.domain.ArtifactType; import com.thoughtworks.go.domain.ConfigErrors; import com.thoughtworks.go.domain.config.Configuration; import com.thoughtworks.go.domain.config.ConfigurationProperty; import com.thoughtworks.go.plugin.access.artifact.ArtifactMetadataStore; import com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo; import org.apache.commons.lang3.StringUtils; import java.util.Arrays; import java.util.HashMap; import java.util.List; import static org.apache.commons.lang3.StringUtils.isNotBlank; @AttributeAwareConfigTag(value = "artifact", attribute = "type", attributeValue = "external") public class PluggableArtifactConfig implements ArtifactConfig { private final ConfigErrors errors = new ConfigErrors(); @SkipParameterResolution @ConfigAttribute(value = "id", allowNull = true) protected String id; @ConfigAttribute(value = "storeId", allowNull = true) private String storeId; @ConfigSubtag private Configuration configuration = new Configuration(); public static final String ID = "id"; public static final String STORE_ID = "storeId"; public PluggableArtifactConfig() { } public PluggableArtifactConfig(String id, String storeId, ConfigurationProperty... configurationProperties) { this.configuration.addAll(Arrays.asList(configurationProperties)); this.id = id; this.storeId = storeId; } public Configuration getConfiguration() { return configuration; } public void setConfiguration(Configuration configuration) { this.configuration = configuration; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getStoreId() { return storeId; } public void setStoreId(String storeId) { this.storeId = storeId; } @Override public ArtifactType getArtifactType() { return ArtifactType.external; } @Override public String getArtifactTypeValue() { return "Pluggable Artifact"; } @Override public boolean validateTree(ValidationContext validationContext) { validate(validationContext); return !hasErrors(); } public void encryptSecureProperties(CruiseConfig preprocessedCruiseConfig, PluggableArtifactConfig preprocessedPluggableArtifactConfig) { if (storeId != null) { ArtifactStore artifactStore = preprocessedCruiseConfig.getArtifactStores().find(preprocessedPluggableArtifactConfig.getStoreId()); encryptSecureConfigurations(artifactStore); } } @Override public void validate(ValidationContext validationContext) { validateMandatoryAttributes(); configuration.validateUniqueness(getArtifactTypeValue()); if (!new NameTypeValidator().isNameValid(id)) { errors.add("id", NameTypeValidator.errorMessage("pluggable artifact id", id)); } if (validationContext.isWithinPipelines()) { if (isNotBlank(storeId)) { final ArtifactStore artifactStore = validationContext.artifactStores().find(storeId); if (artifactStore == null) { addError("storeId", String.format("Artifact store with id `%s` does not exist. Please correct the `storeId` attribute on pipeline `%s`.", storeId, validationContext.getPipeline().name())); } } } } private void validateMandatoryAttributes() { if (StringUtils.isBlank(this.id)) { errors.add("id", "\"Id\" is required for PluggableArtifact"); } if (StringUtils.isBlank(this.storeId)) { errors.add("storeId", "\"Store id\" is required for PluggableArtifact"); } } public boolean hasValidPluginAndStore(ArtifactStore artifactStore) { if (artifactStore == null) { return false; } ArtifactPluginInfo pluginInfo = ArtifactMetadataStore.instance().getPluginInfo(artifactStore.getPluginId()); return pluginInfo != null; } @Override public void validateUniqueness(List<ArtifactConfig> existingArtifactConfigList) { for (ArtifactConfig existingArtifactConfig : existingArtifactConfigList) { if (existingArtifactConfig instanceof PluggableArtifactConfig) { final PluggableArtifactConfig pluggableArtifactConfig = (PluggableArtifactConfig) existingArtifactConfig; if (this.getId().equalsIgnoreCase(pluggableArtifactConfig.getId())) { this.addError("id", String.format("Duplicate pluggable artifacts with id `%s` defined.", getId())); existingArtifactConfig.addError("id", String.format("Duplicate pluggable artifacts with id `%s` defined.", getId())); } if (this.getStoreId().equalsIgnoreCase(pluggableArtifactConfig.getStoreId())) { if (configuration.size() == pluggableArtifactConfig.getConfiguration().size() && this.configuration.containsAll(pluggableArtifactConfig.getConfiguration())) { this.addError("id", "Duplicate pluggable artifacts configuration defined."); existingArtifactConfig.addError("id", "Duplicate pluggable artifacts configuration defined."); } } return; } } existingArtifactConfigList.add(this); } public String toJSON() { final HashMap<String, Object> artifactStoreAsHashMap = new HashMap<>(); artifactStoreAsHashMap.put("id", getId()); artifactStoreAsHashMap.put("storeId", getStoreId()); artifactStoreAsHashMap.put("configuration", this.getConfiguration().getConfigurationAsMap(true)); return new Gson().toJson(artifactStoreAsHashMap); } @Override public ConfigErrors errors() { return errors; } public boolean hasErrors() { return !errors.isEmpty() || configuration.hasErrors(); } public List<ConfigErrors> getAllErrors() { return ErrorCollector.getAllErrors(this); } @Override public void addError(String fieldName, String message) { errors.add(fieldName, message); } private void encryptSecureConfigurations(ArtifactStore artifactStore) { if (artifactStore != null && hasPluginInfo(artifactStore)) { for (ConfigurationProperty configuration : getConfiguration()) { if (!(configuration.getValue() != null && configuration.getValue().contains("#{"))) { configuration.handleSecureValueConfiguration(isSecure(configuration.getConfigKeyName(), artifactStore)); } } } } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PluggableArtifactConfig that = (PluggableArtifactConfig) o; if (!id.equals(that.id)) return false; if (!storeId.equals(that.storeId)) return false; return configuration != null ? configuration.equals(that.configuration) : that.configuration == null; } @Override public int hashCode() { int result = id.hashCode(); result = 31 * result + getArtifactType().hashCode(); result = 31 * result + storeId.hashCode(); result = 31 * result + (configuration != null ? configuration.hashCode() : 0); return result; } @Override public String toString() { return "PluggableArtifactConfig{" + "id='" + id + '\'' + ", storeId='" + storeId + '\'' + '}'; } private boolean isSecure(String configKeyName, ArtifactStore artifactStore) { ArtifactPluginInfo pluginInfo = getPluginInfo(artifactStore); return pluginInfo != null && pluginInfo.getArtifactConfigSettings() != null && pluginInfo.getArtifactConfigSettings().getConfiguration(configKeyName) != null && pluginInfo.getArtifactConfigSettings().getConfiguration(configKeyName).isSecure(); } private boolean hasPluginInfo(ArtifactStore artifactStore) { return getPluginInfo(artifactStore) != null; } private ArtifactPluginInfo getPluginInfo(ArtifactStore artifactStore) { return ArtifactMetadataStore.instance().getPluginInfo(artifactStore.getPluginId()); } public void addConfigurations(List<ConfigurationProperty> configurationProperties) { this.getConfiguration().addAll(configurationProperties); } }
varshavaradarajan/gocd
config/config-api/src/main/java/com/thoughtworks/go/config/PluggableArtifactConfig.java
Java
apache-2.0
9,527
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from django.core.exceptions import ValidationError # noqa from django.core.urlresolvers import reverse from django.utils.http import urlencode from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from openstack_auth import utils as auth_utils from horizon import exceptions from horizon import forms from horizon import tables from keystoneclient.exceptions import Conflict # noqa from openstack_dashboard import api from openstack_dashboard import policy class RescopeTokenToProject(tables.LinkAction): name = "rescope" verbose_name = _("Set as Active Project") url = "switch_tenants" def allowed(self, request, project): # allow rescoping token to any project the user has a role on, # authorized_tenants, and that they are not currently scoped to return next((True for proj in request.user.authorized_tenants if proj.id == project.id and project.id != request.user.project_id), False) def get_link_url(self, project): # redirects to the switch_tenants url which then will redirect # back to this page dash_url = reverse("horizon:identity:projects:index") base_url = reverse(self.url, args=[project.id]) param = urlencode({"next": dash_url}) return "?".join([base_url, param]) class UpdateMembersLink(tables.LinkAction): name = "users" verbose_name = _("Manage Members") url = "horizon:identity:projects:update" classes = ("ajax-modal",) icon = "pencil" policy_rules = (("identity", "identity:list_users"), ("identity", "identity:list_roles")) def get_link_url(self, project): step = 'update_members' base_url = reverse(self.url, args=[project.id]) param = urlencode({"step": step}) return "?".join([base_url, param]) class UpdateGroupsLink(tables.LinkAction): name = "groups" verbose_name = _("Modify Groups") url = "horizon:identity:projects:update" classes = ("ajax-modal",) icon = "pencil" policy_rules = (("identity", "identity:list_groups"),) def allowed(self, request, project): return api.keystone.VERSIONS.active >= 3 def get_link_url(self, project): step = 'update_group_members' base_url = reverse(self.url, args=[project.id]) param = urlencode({"step": step}) return "?".join([base_url, param]) class UsageLink(tables.LinkAction): name = "usage" verbose_name = _("View Usage") url = "horizon:identity:projects:usage" icon = "stats" policy_rules = (("compute", "compute_extension:simple_tenant_usage:show"),) def allowed(self, request, project): return request.user.is_superuser class CreateProject(tables.LinkAction): name = "create" verbose_name = _("Create Project") url = "horizon:identity:projects:create" classes = ("ajax-modal",) icon = "plus" policy_rules = (('identity', 'identity:create_project'),) def allowed(self, request, project): return api.keystone.keystone_can_edit_project() class UpdateProject(tables.LinkAction): name = "update" verbose_name = _("Edit Project") url = "horizon:identity:projects:update" classes = ("ajax-modal",) icon = "pencil" policy_rules = (('identity', 'identity:update_project'),) def allowed(self, request, project): return api.keystone.keystone_can_edit_project() class ModifyQuotas(tables.LinkAction): name = "quotas" verbose_name = _("Modify Quotas") url = "horizon:identity:projects:update" classes = ("ajax-modal",) icon = "pencil" policy_rules = (('compute', "compute_extension:quotas:update"),) def get_link_url(self, project): step = 'update_quotas' base_url = reverse(self.url, args=[project.id]) param = urlencode({"step": step}) return "?".join([base_url, param]) class DeleteTenantsAction(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( u"Delete Project", u"Delete Projects", count ) @staticmethod def action_past(count): return ungettext_lazy( u"Deleted Project", u"Deleted Projects", count ) policy_rules = (("identity", "identity:delete_project"),) def allowed(self, request, project): return api.keystone.keystone_can_edit_project() def delete(self, request, obj_id): api.keystone.tenant_delete(request, obj_id) def handle(self, table, request, obj_ids): response = \ super(DeleteTenantsAction, self).handle(table, request, obj_ids) auth_utils.remove_project_cache(request.user.token.id) return response class TenantFilterAction(tables.FilterAction): def filter(self, table, tenants, filter_string): """Really naive case-insensitive search.""" # FIXME(gabriel): This should be smarter. Written for demo purposes. q = filter_string.lower() def comp(tenant): if q in tenant.name.lower(): return True return False return filter(comp, tenants) class UpdateRow(tables.Row): ajax = True def get_data(self, request, project_id): project_info = api.keystone.tenant_get(request, project_id, admin=True) return project_info class UpdateCell(tables.UpdateAction): def allowed(self, request, project, cell): policy_rule = (("identity", "identity:update_project"),) return ( (cell.column.name != 'enabled' or request.user.token.project['id'] != cell.datum.id) and api.keystone.keystone_can_edit_project() and policy.check(policy_rule, request)) def update_cell(self, request, datum, project_id, cell_name, new_cell_value): # inline update project info try: project_obj = datum # updating changed value by new value setattr(project_obj, cell_name, new_cell_value) api.keystone.tenant_update( request, project_id, name=project_obj.name, description=project_obj.description, enabled=project_obj.enabled) except Conflict: # Returning a nice error message about name conflict. The message # from exception is not that clear for the users. message = _("This name is already taken.") raise ValidationError(message) except Exception: exceptions.handle(request, ignore=True) return False return True class TenantsTable(tables.DataTable): name = tables.Column('name', verbose_name=_('Name'), form_field=forms.CharField(max_length=64), update_action=UpdateCell) description = tables.Column(lambda obj: getattr(obj, 'description', None), verbose_name=_('Description'), form_field=forms.CharField( widget=forms.Textarea(attrs={'rows': 4}), required=False), update_action=UpdateCell) id = tables.Column('id', verbose_name=_('Project ID')) enabled = tables.Column('enabled', verbose_name=_('Enabled'), status=True, form_field=forms.BooleanField( label=_('Enabled'), required=False), update_action=UpdateCell) class Meta: name = "tenants" verbose_name = _("Projects") row_class = UpdateRow row_actions = (UpdateMembersLink, UpdateGroupsLink, UpdateProject, UsageLink, ModifyQuotas, DeleteTenantsAction, RescopeTokenToProject) table_actions = (TenantFilterAction, CreateProject, DeleteTenantsAction) pagination_param = "tenant_marker"
CiscoSystems/avos
openstack_dashboard/dashboards/identity/projects/tables.py
Python
apache-2.0
8,769
/*************************************************************************************************/ /*! * \file * * \brief Interface to SMP event handler. * * Copyright (c) 2010-2018 Arm Ltd. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*************************************************************************************************/ #ifndef SMP_HANDLER_H #define SMP_HANDLER_H #include "wsf_os.h" #ifdef __cplusplus extern "C" { #endif /*! \addtogroup STACK_EVENT * \{ */ /** \name SMP Event Handling * Message passing interface to SMP from other tasks through WSF. */ /**@{*/ /************************************************************************************************** Function Declarations **************************************************************************************************/ /*************************************************************************************************/ /*! * \brief SMP handler init function called during system initialization. * * \param handlerId WSF handler ID for SMP. * * \return None. */ /*************************************************************************************************/ void SmpHandlerInit(wsfHandlerId_t handlerId); /*************************************************************************************************/ /*! * \brief WSF event handler for SMP. * * \param event WSF event mask. * \param pMsg WSF message. * * \return None. */ /*************************************************************************************************/ void SmpHandler(wsfEventMask_t event, wsfMsgHdr_t *pMsg); /**@}*/ /*! \} */ /* STACK_SMP_API */ #ifdef __cplusplus }; #endif #endif /* SMP_HANDLER_H */
c1728p9/mbed-os
features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/include/smp_handler.h
C
apache-2.0
2,273
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsBarProps.h" #include "nsCOMPtr.h" #include "nscore.h" #include "nsGlobalWindow.h" #include "nsStyleConsts.h" #include "nsIDocShell.h" #include "nsIScriptSecurityManager.h" #include "nsIScrollable.h" #include "nsIWebBrowserChrome.h" #include "nsIDOMWindow.h" #include "nsDOMClassInfoID.h" #include "nsContentUtils.h" // // Basic (virtual) BarProp class implementation // nsBarProp::nsBarProp(nsGlobalWindow *aWindow) { mDOMWindow = aWindow; nsISupports *supwin = static_cast<nsIScriptGlobalObject *>(aWindow); mDOMWindowWeakref = do_GetWeakReference(supwin); } nsBarProp::~nsBarProp() { } DOMCI_DATA(BarProp, nsBarProp) // QueryInterface implementation for BarProp NS_INTERFACE_MAP_BEGIN(nsBarProp) NS_INTERFACE_MAP_ENTRY(nsIDOMBarProp) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(BarProp) NS_INTERFACE_MAP_END NS_IMPL_ADDREF(nsBarProp) NS_IMPL_RELEASE(nsBarProp) NS_IMETHODIMP nsBarProp::GetVisibleByFlag(bool *aVisible, uint32_t aChromeFlag) { *aVisible = false; nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome(); NS_ENSURE_TRUE(browserChrome, NS_OK); uint32_t chromeFlags; NS_ENSURE_SUCCESS(browserChrome->GetChromeFlags(&chromeFlags), NS_ERROR_FAILURE); if (chromeFlags & aChromeFlag) *aVisible = true; return NS_OK; } NS_IMETHODIMP nsBarProp::SetVisibleByFlag(bool aVisible, uint32_t aChromeFlag) { nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetBrowserChrome(); NS_ENSURE_TRUE(browserChrome, NS_OK); if (!nsContentUtils::IsCallerChrome()) return NS_OK; uint32_t chromeFlags; NS_ENSURE_SUCCESS(browserChrome->GetChromeFlags(&chromeFlags), NS_ERROR_FAILURE); if (aVisible) chromeFlags |= aChromeFlag; else chromeFlags &= ~aChromeFlag; NS_ENSURE_SUCCESS(browserChrome->SetChromeFlags(chromeFlags), NS_ERROR_FAILURE); return NS_OK; } already_AddRefed<nsIWebBrowserChrome> nsBarProp::GetBrowserChrome() { // Check that the window is still alive. nsCOMPtr<nsIDOMWindow> domwin(do_QueryReferent(mDOMWindowWeakref)); if (!domwin) return nullptr; nsIWebBrowserChrome *browserChrome = nullptr; mDOMWindow->GetWebBrowserChrome(&browserChrome); return browserChrome; } // // MenubarProp class implementation // nsMenubarProp::nsMenubarProp(nsGlobalWindow *aWindow) : nsBarProp(aWindow) { } nsMenubarProp::~nsMenubarProp() { } NS_IMETHODIMP nsMenubarProp::GetVisible(bool *aVisible) { return nsBarProp::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR); } NS_IMETHODIMP nsMenubarProp::SetVisible(bool aVisible) { return nsBarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_MENUBAR); } // // ToolbarProp class implementation // nsToolbarProp::nsToolbarProp(nsGlobalWindow *aWindow) : nsBarProp(aWindow) { } nsToolbarProp::~nsToolbarProp() { } NS_IMETHODIMP nsToolbarProp::GetVisible(bool *aVisible) { return nsBarProp::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR); } NS_IMETHODIMP nsToolbarProp::SetVisible(bool aVisible) { return nsBarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_TOOLBAR); } // // LocationbarProp class implementation // nsLocationbarProp::nsLocationbarProp(nsGlobalWindow *aWindow) : nsBarProp(aWindow) { } nsLocationbarProp::~nsLocationbarProp() { } NS_IMETHODIMP nsLocationbarProp::GetVisible(bool *aVisible) { return nsBarProp::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR); } NS_IMETHODIMP nsLocationbarProp::SetVisible(bool aVisible) { return nsBarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_LOCATIONBAR); } // // PersonalbarProp class implementation // nsPersonalbarProp::nsPersonalbarProp(nsGlobalWindow *aWindow) : nsBarProp(aWindow) { } nsPersonalbarProp::~nsPersonalbarProp() { } NS_IMETHODIMP nsPersonalbarProp::GetVisible(bool *aVisible) { return nsBarProp::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR); } NS_IMETHODIMP nsPersonalbarProp::SetVisible(bool aVisible) { return nsBarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR); } // // StatusbarProp class implementation // nsStatusbarProp::nsStatusbarProp(nsGlobalWindow *aWindow) : nsBarProp(aWindow) { } nsStatusbarProp::~nsStatusbarProp() { } NS_IMETHODIMP nsStatusbarProp::GetVisible(bool *aVisible) { return nsBarProp::GetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_STATUSBAR); } NS_IMETHODIMP nsStatusbarProp::SetVisible(bool aVisible) { return nsBarProp::SetVisibleByFlag(aVisible, nsIWebBrowserChrome::CHROME_STATUSBAR); } // // ScrollbarsProp class implementation // nsScrollbarsProp::nsScrollbarsProp(nsGlobalWindow *aWindow) : nsBarProp(aWindow) { } nsScrollbarsProp::~nsScrollbarsProp() { } NS_IMETHODIMP nsScrollbarsProp::GetVisible(bool *aVisible) { *aVisible = true; // one assumes nsCOMPtr<nsIDOMWindow> domwin(do_QueryReferent(mDOMWindowWeakref)); if (domwin) { // dom window not deleted nsCOMPtr<nsIScrollable> scroller = do_QueryInterface(mDOMWindow->GetDocShell()); if (scroller) { int32_t prefValue; scroller->GetDefaultScrollbarPreferences( nsIScrollable::ScrollOrientation_Y, &prefValue); if (prefValue == nsIScrollable::Scrollbar_Never) // try the other way scroller->GetDefaultScrollbarPreferences( nsIScrollable::ScrollOrientation_X, &prefValue); if (prefValue == nsIScrollable::Scrollbar_Never) *aVisible = false; } } return NS_OK; } NS_IMETHODIMP nsScrollbarsProp::SetVisible(bool aVisible) { if (!nsContentUtils::IsCallerChrome()) return NS_OK; /* Scrollbars, unlike the other barprops, implement visibility directly rather than handing off to the superclass (and from there to the chrome window) because scrollbar visibility uniquely applies only to the window making the change (arguably. it does now, anyway.) and because embedding apps have no interface for implementing this themselves, and therefore the implementation must be internal. */ nsCOMPtr<nsIDOMWindow> domwin(do_QueryReferent(mDOMWindowWeakref)); if (domwin) { // dom window must still exist. use away. nsCOMPtr<nsIScrollable> scroller = do_QueryInterface(mDOMWindow->GetDocShell()); if (scroller) { int32_t prefValue; if (aVisible) { prefValue = nsIScrollable::Scrollbar_Auto; } else { prefValue = nsIScrollable::Scrollbar_Never; } scroller->SetDefaultScrollbarPreferences( nsIScrollable::ScrollOrientation_Y, prefValue); scroller->SetDefaultScrollbarPreferences( nsIScrollable::ScrollOrientation_X, prefValue); } } /* Notably absent is the part where we notify the chrome window using GetBrowserChrome()->SetChromeFlags(). Given the possibility of multiple DOM windows (multiple top-level windows, even) within a single chrome window, the historical concept of a single "has scrollbars" flag in the chrome is inapplicable, and we can't tell at this level whether we represent the particular DOM window that makes this decision for the chrome. So only this object (and its corresponding DOM window) knows whether scrollbars are visible. The corresponding chrome window will need to ask (one of) its DOM window(s) when it needs to know about scrollbar visibility, rather than caching its own copy of that information. */ return NS_OK; }
sergecodd/FireFox-OS
B2G/gecko/dom/base/nsBarProps.cpp
C++
apache-2.0
8,222
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.server.core.legacy; import java.io.InputStream; import java.net.URI; import java.util.LinkedList; import java.util.List; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.EdmProperty; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; import org.apache.olingo.server.api.ODataLibraryException; import org.apache.olingo.server.api.ODataServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.processor.ComplexCollectionProcessor; import org.apache.olingo.server.api.processor.ComplexProcessor; import org.apache.olingo.server.api.processor.CountComplexCollectionProcessor; import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor; import org.apache.olingo.server.api.processor.CountPrimitiveCollectionProcessor; import org.apache.olingo.server.api.processor.EntityCollectionProcessor; import org.apache.olingo.server.api.processor.EntityProcessor; import org.apache.olingo.server.api.processor.MediaEntityProcessor; import org.apache.olingo.server.api.processor.MetadataProcessor; import org.apache.olingo.server.api.processor.PrimitiveCollectionProcessor; import org.apache.olingo.server.api.processor.PrimitiveProcessor; import org.apache.olingo.server.api.processor.PrimitiveValueProcessor; import org.apache.olingo.server.api.processor.Processor; import org.apache.olingo.server.api.processor.ReferenceProcessor; import org.apache.olingo.server.api.processor.ServiceDocumentProcessor; import org.apache.olingo.server.core.ODataHandlerException; import org.apache.olingo.server.core.ServiceHandler; import org.apache.olingo.server.core.requests.ActionRequest; import org.apache.olingo.server.core.requests.DataRequest; import org.apache.olingo.server.core.requests.FunctionRequest; import org.apache.olingo.server.core.requests.MediaRequest; import org.apache.olingo.server.core.requests.MetadataRequest; import org.apache.olingo.server.core.requests.ServiceDocumentRequest; import org.apache.olingo.server.core.responses.CountResponse; import org.apache.olingo.server.core.responses.EntityResponse; import org.apache.olingo.server.core.responses.EntitySetResponse; import org.apache.olingo.server.core.responses.ErrorResponse; import org.apache.olingo.server.core.responses.MetadataResponse; import org.apache.olingo.server.core.responses.NoContentResponse; import org.apache.olingo.server.core.responses.PrimitiveValueResponse; import org.apache.olingo.server.core.responses.PropertyResponse; import org.apache.olingo.server.core.responses.ServiceDocumentResponse; import org.apache.olingo.server.core.responses.ServiceResponse; import org.apache.olingo.server.core.responses.ServiceResponseVisior; import org.apache.olingo.server.core.responses.StreamResponse; public class ProcessorServiceHandler implements ServiceHandler { private final List<Processor> processors = new LinkedList<Processor>(); private OData odata; private ServiceMetadata serviceMetadata; @Override public void init(OData odata, ServiceMetadata serviceMetadata) { this.odata = odata; this.serviceMetadata = serviceMetadata; } public void register(Processor processor) { this.processors.add(processor); processor.init(odata, serviceMetadata); } private <T extends Processor> T selectProcessor(final Class<T> cls) throws ODataHandlerException { for (final Processor processor : processors) { if (cls.isAssignableFrom(processor.getClass())) { processor.init(odata, serviceMetadata); return cls.cast(processor); } } throw new ODataHandlerException("Processor: " + cls.getSimpleName() + " not registered.", ODataHandlerException.MessageKeys.PROCESSOR_NOT_IMPLEMENTED, cls.getSimpleName()); } @Override public void readMetadata(MetadataRequest request, MetadataResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(MetadataProcessor.class).readMetadata(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void readServiceDocument(ServiceDocumentRequest request, ServiceDocumentResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(ServiceDocumentProcessor.class).readServiceDocument(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public <T extends ServiceResponse> void read(final DataRequest request, final T response) throws ODataLibraryException, ODataApplicationException { response.accepts(new ServiceResponseVisior() { @Override public void visit(CountResponse response) throws ODataLibraryException, ODataApplicationException { if (request.getUriResourceProperty() != null) { EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); if (edmProperty.isPrimitive()) { selectProcessor(CountPrimitiveCollectionProcessor.class).countPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } else { selectProcessor(CountComplexCollectionProcessor.class).countComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } } else { selectProcessor(CountEntityCollectionProcessor.class).countEntityCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } } @Override public void visit(EntityResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityProcessor.class).readEntity(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void visit(PrimitiveValueResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(PrimitiveValueProcessor.class).readPrimitiveValue( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void visit(PropertyResponse response) throws ODataLibraryException, ODataApplicationException { EdmProperty edmProperty = request.getUriResourceProperty().getProperty(); if (edmProperty.isPrimitive()) { if(edmProperty.isCollection()) { selectProcessor(PrimitiveCollectionProcessor.class).readPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(PrimitiveProcessor.class).readPrimitive( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } else { if(edmProperty.isCollection()) { selectProcessor(ComplexCollectionProcessor.class).readComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(ComplexProcessor.class).readComplex( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } } @Override public void visit(StreamResponse response) throws ODataLibraryException, ODataApplicationException { response.writeServerError(true); } @Override public void visit(EntitySetResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityCollectionProcessor.class).readEntityCollection(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } }); } @Override public void createEntity(DataRequest request, Entity entity, EntityResponse response) throws ODataLibraryException, ODataApplicationException { if (request.getEntitySet().getEntityType().hasStream()) { selectProcessor(MediaEntityProcessor.class).createMediaEntity( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(),request.getResponseContentType()); } else { selectProcessor(EntityProcessor.class).createEntity(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(), request.getResponseContentType()); } } @Override public void updateEntity(DataRequest request, Entity entity, boolean merge, String entityETag, EntityResponse response) throws ODataLibraryException, ODataApplicationException { if (request.getEntitySet().getEntityType().hasStream()) { selectProcessor(MediaEntityProcessor.class).updateMediaEntity( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(),request.getResponseContentType()); } else { selectProcessor(EntityProcessor.class).updateEntity(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(), request.getResponseContentType()); } } @Override public void deleteEntity(DataRequest request, String entityETag, EntityResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityProcessor.class).deleteEntity(request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } @Override public void updateProperty(DataRequest request, Property property, boolean rawValue, boolean merge, String entityETag, PropertyResponse response) throws ODataLibraryException, ODataApplicationException { if (property.isPrimitive()) { if (property.isCollection()) { selectProcessor(PrimitiveCollectionProcessor.class).updatePrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(), request.getResponseContentType()); } else { selectProcessor(PrimitiveProcessor.class).updatePrimitive( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(), request.getResponseContentType()); } } else { if (property.isCollection()) { selectProcessor(ComplexCollectionProcessor.class).updateComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(), request.getResponseContentType()); } else { selectProcessor(ComplexProcessor.class).updateComplex( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(), request.getResponseContentType()); } } } @Override public void upsertStreamProperty(DataRequest request, String entityETag, InputStream streamContent, NoContentResponse response) throws ODataLibraryException, ODataApplicationException { throw new ODataHandlerException("not implemented", ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED); } @Override public <T extends ServiceResponse> void invoke(final FunctionRequest request, HttpMethod method, final T response) throws ODataLibraryException, ODataApplicationException { if (method != HttpMethod.GET) { throw new ODataHandlerException("HTTP method " + method + " is not allowed.", ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString()); } response.accepts(new ServiceResponseVisior() { @Override public void visit(EntityResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityProcessor.class).readEntity(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void visit(PropertyResponse response) throws ODataLibraryException, ODataApplicationException { if (request.isReturnTypePrimitive()) { if(request.isCollection()) { selectProcessor(PrimitiveCollectionProcessor.class).readPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(PrimitiveProcessor.class).readPrimitive( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } else { if(request.isCollection()) { selectProcessor(ComplexCollectionProcessor.class).readComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(ComplexProcessor.class).readComplex( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } } @Override public void visit(EntitySetResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityCollectionProcessor.class).readEntityCollection(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } }); } @Override public <T extends ServiceResponse> void invoke(final ActionRequest request, String eTag, final T response) throws ODataLibraryException, ODataApplicationException { final HttpMethod method = request.getODataRequest().getMethod(); if (method != HttpMethod.POST) { throw new ODataHandlerException("HTTP method " + method + " is not allowed.", ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString()); } response.accepts(new ServiceResponseVisior() { @Override public void visit(EntityResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityProcessor.class).readEntity(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void visit(PropertyResponse response) throws ODataLibraryException, ODataApplicationException { if (request.isReturnTypePrimitive()) { if(request.isCollection()) { selectProcessor(PrimitiveCollectionProcessor.class).readPrimitiveCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(PrimitiveProcessor.class).readPrimitive( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } else { if(request.isCollection()) { selectProcessor(ComplexCollectionProcessor.class).readComplexCollection( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } else { selectProcessor(ComplexProcessor.class).readComplex( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } } } @Override public void visit(EntitySetResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(EntityCollectionProcessor.class).readEntityCollection(request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } }); } @Override public void readMediaStream(MediaRequest request, StreamResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(MediaEntityProcessor.class).readMediaEntity( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void upsertMediaStream(MediaRequest request, String entityETag, InputStream mediaContent, NoContentResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(MediaEntityProcessor.class).updateMediaEntity( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getRequestContentType(), request.getResponseContentType()); } @Override public void anyUnsupported(ODataRequest request, ODataResponse response) throws ODataLibraryException, ODataApplicationException { throw new ODataHandlerException("not implemented", ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED); } @Override public void addReference(DataRequest request, String entityETag, URI referenceId, NoContentResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(ReferenceProcessor.class).createReference( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void updateReference(DataRequest request, String entityETag, URI referenceId, NoContentResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(ReferenceProcessor.class).updateReference( request.getODataRequest(), response.getODataResponse(), request.getUriInfo(), request.getResponseContentType()); } @Override public void deleteReference(DataRequest request, URI deleteId, String entityETag, NoContentResponse response) throws ODataLibraryException, ODataApplicationException { selectProcessor(ReferenceProcessor.class).deleteReference( request.getODataRequest(), response.getODataResponse(), request.getUriInfo()); } @Override public String startTransaction() { return null; } @Override public void commit(String txnId) { } @Override public void rollback(String txnId) { } @Override public void crossJoin(DataRequest dataRequest, List<String> entitySetNames, ODataResponse response) throws ODataLibraryException, ODataApplicationException { throw new ODataHandlerException("not implemented", ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED); } @Override public void upsertEntity(DataRequest request, Entity entity, boolean merge, String entityETag, EntityResponse response) throws ODataLibraryException, ODataApplicationException { throw new ODataHandlerException("not implemented", ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED); } @Override public void apply(DataRequest dataRequest, ODataResponse response) throws ODataLibraryException, ODataApplicationException { throw new ODataHandlerException("not implemented", ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED); } @Override public boolean supportsDataIsolation() { return false; } @Override public void processError(ODataServerError error, ErrorResponse response) { response.writeError(error); } }
apache/olingo-odata4
lib/server-core-ext/src/main/java/org/apache/olingo/server/core/legacy/ProcessorServiceHandler.java
Java
apache-2.0
21,114
FROM balenalib/armv7hf-alpine:edge-build LABEL io.balena.device-type="zc702-zynq7" RUN apk add --update \ less \ nano \ net-tools \ ifupdown \ usbutils \ gnupg \ && rm -rf /var/cache/apk/* RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Alpine Linux edge \nVariant: build variant \nDefault variable(s): UDEV=off \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && ln -f /bin/sh /bin/sh.real \ && ln -f /bin/sh-shim /bin/sh
nghiant2710/base-images
balena-base-images/device-base/zc702-zynq7/alpine/edge/build/Dockerfile
Dockerfile
apache-2.0
1,020
<?php /* Smarty version 2.6.18, created on 2014-08-11 02:15:49 compiled from tpls/lvsecanyin/index.html */ ?> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => $this->_tpl_vars['header'], 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?> <div class="top"> <div class="big-pic big-pic<?php if ($this->_tpl_vars['focusCount']): ?><?php echo $this->_tpl_vars['focusCount']; ?> <?php endif; ?>"> <div class="big-pic-in"> <div class="pic-list" > <?php if ($this->_tpl_vars['channel_focus_contents']): ?> <?php $_from = $this->_tpl_vars['channel_focus_contents']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['a']): ?> <?php if ($this->_tpl_vars['k'] < 5): ?> <a href="<?php echo $this->_tpl_vars['a']['link']; ?> "><p><img src="<?php echo $this->_tpl_vars['a']['thumb']; ?> " width="100%"></p></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> </div> <div class="slide-dot"> <?php if ($this->_tpl_vars['channel_focus_contents']): ?> <?php $_from = $this->_tpl_vars['channel_focus_contents']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['a']): ?> <?php if ($this->_tpl_vars['k'] < 5): ?> <span<?php if ($this->_tpl_vars['k'] == 0): ?> class="slide-dot-cur"<?php endif; ?>></span> <?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> </div> </div> </div> <div class="logobox"> <center> <a href="<?php echo $this->_tpl_vars['homeUrl']; ?> " title="<?php echo $this->_tpl_vars['site']['name']; ?> " class="logo"><img src="<?php echo $this->_tpl_vars['site']['logourl']; ?> " class="logo" alt="<?php echo $this->_tpl_vars['site']['name']; ?> "></a> </center> </div> </div> <div class="indexicon"> <div class="iconleft"></div> <div class="iconright"> <p><a href="index.html" tppabs="<?php echo $this->_tpl_vars['homeUrl']; ?> " title="首页" class="iconhome"></a></p> <p><a href="javascript:void(0);" title="搜索" class="iconsearch"></a></p> <p><a href="javascript:void(0);" title="导航" class="iconnav"></a></p> </div> <ul class="pics"> <li> <?php if ($this->_tpl_vars['pictureContents']): ?> <?php $_from = $this->_tpl_vars['pictureContents']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['a']): ?> <?php if ($this->_tpl_vars['k'] < 1): ?> <a href="<?php echo $this->_tpl_vars['a']['link']; ?> " title=""><img src="<?php echo $this->_tpl_vars['a']['thumb']; ?> " alt="" class="ad<?php echo $this->_tpl_vars['k']+1; ?> "></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> </li> <li> <?php if ($this->_tpl_vars['pictureContents']): ?> <?php $_from = $this->_tpl_vars['pictureContents']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['a']): ?> <?php if ($this->_tpl_vars['k'] < 3 && $this->_tpl_vars['k'] > 0): ?> <a href="<?php echo $this->_tpl_vars['a']['link']; ?> " title=""><img src="<?php echo $this->_tpl_vars['a']['thumb']; ?> " alt="" class="ad<?php echo $this->_tpl_vars['k']+1; ?> "></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> </li> <li> <?php if ($this->_tpl_vars['pictureContents']): ?> <?php $_from = $this->_tpl_vars['pictureContents']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['a']): ?> <?php if ($this->_tpl_vars['k'] < 4 && $this->_tpl_vars['k'] > 2): ?> <a href="<?php echo $this->_tpl_vars['a']['link']; ?> " title=""><img src="<?php echo $this->_tpl_vars['a']['thumb']; ?> " alt="" class="ad<?php echo $this->_tpl_vars['k']+1; ?> "></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> </li> <li> <?php if ($this->_tpl_vars['pictureContents']): ?> <?php $_from = $this->_tpl_vars['pictureContents']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['a']): ?> <?php if ($this->_tpl_vars['k'] < 6 && $this->_tpl_vars['k'] > 3): ?> <a href="<?php echo $this->_tpl_vars['a']['link']; ?> " title=""><img src="<?php echo $this->_tpl_vars['a']['thumb']; ?> " alt="" class="ad<?php echo $this->_tpl_vars['k']+1; ?> "></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> <div class="clear"></div> </li> </ul> <div class="search"> <div> <form method="post" action="?m=site&c=home&a=search&token=<?php echo $this->_tpl_vars['token']; ?> "> <input type="text" class="text" name="SeaStr" id="SeaStr" placeholder="请输入搜索关键词"/> <input type="submit" class="button" value=""> </form> </div> </div> <div class="nav" id="nav"> <ul> <?php if ($this->_tpl_vars['navChannels']): ?> <?php $_from = $this->_tpl_vars['navChannels']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['n']): ?> <li><a href="<?php echo $this->_tpl_vars['n']['link']; ?> " title="<?php echo $this->_tpl_vars['n']['name']; ?> "><?php echo $this->_tpl_vars['n']['name']; ?> </a></li> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> </ul> <a href="#" class="backtop"><img src="smarty/templates/tpls/lvsecanyin/backtop.png" tppabs="3g/images/backtop.png" alt="返回顶部"></a> </div> </div> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => $this->_tpl_vars['footer'], 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?>
royalwang/saivi
cms/smarty/templates_c/%%22/226/22656919%%index.html.php
PHP
apache-2.0
6,461
//*************************************************** // 文件名(File Name): CancelRCPPresenter.cs // // 表(Tables): nothing // // 视图(Views): nothing // // 作者(Author): 曾翠玲 // // 日期(Create Date): 2013.1.26 // // 修改记录(Revision History): // R1: // 修改作者: // 修改日期: // 修改理由: // //*************************************************** using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; namespace CJia.PIVAS.Presenters { /// <summary> /// 退药查询业务层 /// </summary> public class CancelRCPPresenter:Tools.Presenter<Models.CancelRCPModel,Views.ICancelRCPView> { /// <summary> /// /// </summary> /// <param name="view"></param> public CancelRCPPresenter(Views.ICancelRCPView view) : base(view) { View.OnRefresh += View_OnRefresh; View.OnPrint += View_OnPrint; View.OnSelecteRCPId += View_OnSelecteRCPId; } /// <summary> /// 刷新事件(查询退药单) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void View_OnRefresh(object sender, Views.CancelRCPArgs e) { int labelStatus = 0; // 汇总显示 if (e.selectValue == "1") { DataTable dtTotalPharm = Model.QueryTotalCancelPharm(e.queryDate); if (dtTotalPharm != null) { View.ExeBindGridTotalCancelPharm(dtTotalPharm); } } else { if (e.selectValue == "") { labelStatus = 1000303; // 确认退药 } else if (e.selectValue == "2") { labelStatus = 1000305; // 拒绝退药 } DataTable dtRCPDetail = Model.QueryRCP(labelStatus, e.queryDate); if (dtRCPDetail != null) { // 绑定退药单药品详细信息 View.ExeBindGridRCPDetail(dtRCPDetail); } } // 绑定退药单号Id和退药时间 View.ExeBindGridRCPId(Model.QueryGridDisTinCancelRCPID(e.queryDate)); } /// <summary> /// 打印事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void View_OnPrint(object sender, Views.CancelRCPArgs e) { DataTable dtPrint = Model.QueryPrintCancelPharm(e.queryDate); if (dtPrint != null) { View.ExeBindPrintCancelPharm(dtPrint); } } /// <summary> /// 选择左侧gridControl单号绑定相应单号瓶贴数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void View_OnSelecteRCPId(object sender, Views.CancelRCPArgs e) { int labelStatus = 0; DataTable dtSelectedRCPId; if (e.selectValue == "1") { labelStatus = 1000303; // 确认退药 // 汇总 if (e.selectValue == "1") { dtSelectedRCPId = Model.QueryGridAllCancelRCPBySelectedId(labelStatus, e.queryDate, e.selectedRCPId); } else { dtSelectedRCPId = Model.QueryGridCancelRCPBySelectedId(labelStatus, e.queryDate, e.selectedRCPId); } } else { labelStatus = 1000305; // 拒绝退药 dtSelectedRCPId = Model.QueryGridCancelRCPBySelectedId(labelStatus, e.queryDate, e.selectedRCPId); } if (dtSelectedRCPId != null) { View.ExeBindGridRCPDetail(dtSelectedRCPId); } } } }
leborety/CJia
CJia.PIVASProject/CJia.PIVAS/Presenters/CancelRCPPresenter.cs
C#
apache-2.0
4,206
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Swensen.Ior.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Swensen.Ior.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// </summary> internal static System.Drawing.Icon Camera { get { object obj = ResourceManager.GetObject("Camera", resourceCulture); return ((System.Drawing.Icon)(obj)); } } } }
SwensenSoftware/im-only-resting
Ior/Properties/Resources.Designer.cs
C#
apache-2.0
3,236
package com.kcshu.ssdb.tabs; import java.util.ArrayList; import java.util.List; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.TreeItem; import org.nutz.ssdb4j.spi.Cmd; import org.nutz.ssdb4j.spi.Response; import com.kcshu.ssdb.Images; import com.kcshu.ssdb.domain.TabType; import com.kcshu.ssdb.tabs.editor.KeyValueEditorTab; /** * @author zhouhaichao(a)2008.sina.com * @version 1.0 & Nov 26, 2014 9:26:40 PM */ public class KeyValueTab extends ShowTab { public KeyValueTab(CTabFolder tabFolder, TreeItem item){ super(tabFolder, item); } @Override public void beforeInitView(){ String tabName = "键值对@" + treeItem.getParentItem().getText() ; self.setData(TAB_TYPE, TabType.HASH); self.setImage(Images.get("key")); self.setText(tabName); } @Override public List<String[]> getDataTask() { List<String[]> datas = new ArrayList<String[]>(); Cmd cmd = getSortOrder()?Cmd.scan:Cmd.rscan; Response scanRes = get(cmd,startKey,"",size); if(scanRes.ok()) { List<String> keys = scanRes.listString(); for (int i = 0; i < keys.size(); i+=2) { String key = keys.get(i); String value = keys.get(i+1); datas.add(new String[] {key,value,"1"}); } } return datas; } @Override public String[] getSingleTask(String key) { Response res = get(Cmd.get,key); if(res.ok()){ return new String[] {key,res.asString(),"1"}; }else{ return null; } } @Override public void deleteTask(List<String> delkeys) { for (String string : delkeys){ get(Cmd.del,string); } } @Override protected boolean showKeyValueTab(Composite kvCom, String key) { return new KeyValueEditorTab(this).showKeyValueTab(kvCom, key); } }
ihaiker/SSDBAdmin
src/main/java/com/kcshu/ssdb/tabs/KeyValueTab.java
Java
apache-2.0
2,108
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.rocketmq.client.consumer.listener; import java.util.List; import org.apache.rocketmq.common.message.MessageExt; /** * A MessageListenerOrderly object is used to receive messages orderly. One queue by one thread */ public interface MessageListenerOrderly extends MessageListener { /** * It is not recommend to throw exception,rather than returning ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT * if consumption failure * * @param msgs msgs.size() >= 1<br> DefaultMQPushConsumer.consumeMessageBatchMaxSize=1,you can modify here * @return The consume status */ ConsumeOrderlyStatus consumeMessage(final List<MessageExt> msgs, final ConsumeOrderlyContext context); }
Vansee/RocketMQ
client/src/main/java/org/apache/rocketmq/client/consumer/listener/MessageListenerOrderly.java
Java
apache-2.0
1,540
/* * Licensed to GraphHopper GmbH under one or more contributor * license agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. * * GraphHopper GmbH licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.graphhopper.storage.index; import com.carrotsearch.hppc.IntArrayList; import com.carrotsearch.hppc.IntHashSet; import com.graphhopper.geohash.SpatialKeyAlgo; import com.graphhopper.storage.DAType; import com.graphhopper.storage.DataAccess; import com.graphhopper.storage.Directory; import com.graphhopper.util.Helper; import com.graphhopper.util.shapes.BBox; import java.util.function.IntConsumer; public class LineIntIndex { private final int MAGIC_INT = Integer.MAX_VALUE / 22318; // do not start with 0 as a positive value means leaf and a negative means "entry with subentries" static final int START_POINTER = 1; final DataAccess dataAccess; private final BBox bounds; private int minResolutionInMeter = 300; private int size; private int leafs; private int checksum; private IndexStructureInfo indexStructureInfo; private int[] entries; private byte[] shifts; private boolean initialized = false; private SpatialKeyAlgo keyAlgo; public LineIntIndex(BBox bBox, Directory dir, String name) { this.bounds = bBox; this.dataAccess = dir.find(name, DAType.getPreferredInt(dir.getDefaultType())); } public boolean loadExisting() { if (initialized) throw new IllegalStateException("Call loadExisting only once"); if (!dataAccess.loadExisting()) return false; if (dataAccess.getHeader(0) != MAGIC_INT) throw new IllegalStateException("incorrect location index version, expected:" + MAGIC_INT); checksum = dataAccess.getHeader(1 * 4); minResolutionInMeter = dataAccess.getHeader(2 * 4); indexStructureInfo = IndexStructureInfo.create(bounds, minResolutionInMeter); keyAlgo = indexStructureInfo.getKeyAlgo(); entries = indexStructureInfo.getEntries(); shifts = indexStructureInfo.getShifts(); initialized = true; return true; } public void store(InMemConstructionIndex inMem) { indexStructureInfo = IndexStructureInfo.create(bounds, minResolutionInMeter); keyAlgo = indexStructureInfo.getKeyAlgo(); entries = indexStructureInfo.getEntries(); shifts = indexStructureInfo.getShifts(); dataAccess.create(64 * 1024); try { store(inMem.root, START_POINTER); } catch (Exception ex) { throw new IllegalStateException("Problem while storing location index. " + Helper.getMemInfo(), ex); } initialized = true; } private int store(InMemConstructionIndex.InMemEntry entry, int intPointer) { long pointer = (long) intPointer * 4; if (entry.isLeaf()) { InMemConstructionIndex.InMemLeafEntry leaf = ((InMemConstructionIndex.InMemLeafEntry) entry); IntArrayList entries = leaf.getResults(); int len = entries.size(); if (len == 0) { return intPointer; } size += len; intPointer++; leafs++; dataAccess.ensureCapacity((long) (intPointer + len + 1) * 4); if (len == 1) { // less disc space for single entries dataAccess.setInt(pointer, -entries.get(0) - 1); } else { for (int index = 0; index < len; index++, intPointer++) { dataAccess.setInt((long) intPointer * 4, entries.get(index)); } dataAccess.setInt(pointer, intPointer); } } else { InMemConstructionIndex.InMemTreeEntry treeEntry = ((InMemConstructionIndex.InMemTreeEntry) entry); int len = treeEntry.subEntries.length; intPointer += len; for (int subCounter = 0; subCounter < len; subCounter++, pointer += 4) { InMemConstructionIndex.InMemEntry subEntry = treeEntry.subEntries[subCounter]; if (subEntry == null) { continue; } dataAccess.ensureCapacity((long) (intPointer + 1) * 4); int prevIntPointer = intPointer; intPointer = store(subEntry, prevIntPointer); if (intPointer == prevIntPointer) { dataAccess.setInt(pointer, 0); } else { dataAccess.setInt(pointer, prevIntPointer); } } } return intPointer; } private void fillIDs(long keyPart, IntConsumer consumer) { int intPointer = START_POINTER; for (int depth = 0; depth < entries.length; depth++) { int offset = (int) (keyPart >>> (64 - shifts[depth])); int nextIntPointer = dataAccess.getInt((long) (intPointer + offset) * 4); if (nextIntPointer <= 0) { // empty cell return; } keyPart = keyPart << shifts[depth]; intPointer = nextIntPointer; } int data = dataAccess.getInt((long) intPointer * 4); if (data < 0) { // single data entries (less disc space) int edgeId = -(data + 1); consumer.accept(edgeId); } else { // "data" is index of last data item for (int leafIndex = intPointer + 1; leafIndex < data; leafIndex++) { int edgeId = dataAccess.getInt((long) leafIndex * 4); consumer.accept(edgeId); } } } public void query(BBox queryShape, final LocationIndex.Visitor function) { final IntHashSet set = new IntHashSet(); query(START_POINTER, queryShape, bounds.minLat, bounds.minLon, bounds.maxLat - bounds.minLat, bounds.maxLon - bounds.minLon, new LocationIndex.Visitor() { @Override public boolean isTileInfo() { return function.isTileInfo(); } @Override public void onTile(BBox bbox, int width) { function.onTile(bbox, width); } @Override public void onEdge(int edgeId) { if (set.add(edgeId)) function.onEdge(edgeId); } }, 0); } private void query(int intPointer, BBox queryBBox, double minLat, double minLon, double deltaLatPerDepth, double deltaLonPerDepth, LocationIndex.Visitor function, int depth) { long pointer = (long) intPointer * 4; if (depth == entries.length) { int nextIntPointer = dataAccess.getInt(pointer); if (nextIntPointer < 0) { // single data entries (less disc space) function.onEdge(-(nextIntPointer + 1)); } else { long maxPointer = (long) nextIntPointer * 4; // loop through every leaf entry => nextIntPointer is maxPointer for (long leafPointer = pointer + 4; leafPointer < maxPointer; leafPointer += 4) { // we could read the whole info at once via getBytes instead of getInt function.onEdge(dataAccess.getInt(leafPointer)); } } return; } int max = (1 << shifts[depth]); int factor = max == 4 ? 2 : 4; deltaLonPerDepth /= factor; deltaLatPerDepth /= factor; for (int cellIndex = 0; cellIndex < max; cellIndex++) { int nextIntPointer = dataAccess.getInt(pointer + cellIndex * 4); if (nextIntPointer <= 0) continue; int[] pixelXY = keyAlgo.decode(cellIndex); double tmpMinLon = minLon + deltaLonPerDepth * pixelXY[0]; double tmpMinLat = minLat + deltaLatPerDepth * pixelXY[1]; BBox bbox = (queryBBox != null || function.isTileInfo()) ? new BBox(tmpMinLon, tmpMinLon + deltaLonPerDepth, tmpMinLat, tmpMinLat + deltaLatPerDepth) : null; if (function.isTileInfo()) function.onTile(bbox, depth); if (queryBBox == null || queryBBox.contains(bbox)) { // fill without a restriction! query(nextIntPointer, null, tmpMinLat, tmpMinLon, deltaLatPerDepth, deltaLonPerDepth, function, depth + 1); } else if (queryBBox.intersects(bbox)) { query(nextIntPointer, queryBBox, tmpMinLat, tmpMinLon, deltaLatPerDepth, deltaLonPerDepth, function, depth + 1); } } } /** * This method collects edge ids from the neighborhood of a point and puts them into foundEntries. * * If it is called with iteration = 0, it just looks in the tile the query point is in. * If it is called with iteration = 0,1,2,.., it will look in additional tiles further and further * from the start tile. (In a square that grows by one pixel in all four directions per iteration). * * See discussion at issue #221. * <p> */ public void findEdgeIdsInNeighborhood(double queryLat, double queryLon, int iteration, IntConsumer foundEntries) { int x = keyAlgo.x(queryLon); int y = keyAlgo.y(queryLat); for (int yreg = -iteration; yreg <= iteration; yreg++) { int subqueryY = y + yreg; int subqueryXA = x - iteration; int subqueryXB = x + iteration; if (subqueryXA >= 0 && subqueryY >= 0) { // TODO: Also don't walk off the _other_ side of the grid. long keyPart = keyAlgo.encode(subqueryXA, subqueryY) << (64 - keyAlgo.getBits()); fillIDs(keyPart, foundEntries); } if (iteration > 0 && subqueryXB >= 0 && subqueryY >= 0) { long keyPart = keyAlgo.encode(subqueryXB, subqueryY) << (64 - keyAlgo.getBits()); fillIDs(keyPart, foundEntries); } } for (int xreg = -iteration + 1; xreg <= iteration - 1; xreg++) { int subqueryX = x + xreg; int subqueryYA = y - iteration; int subqueryYB = y + iteration; if (subqueryX >= 0 && subqueryYA >= 0) { long keyPart = keyAlgo.encode(subqueryX, subqueryYA) << (64 - keyAlgo.getBits()); fillIDs(keyPart, foundEntries); } if (subqueryX >= 0 && subqueryYB >= 0) { long keyPart = keyAlgo.encode(subqueryX, subqueryYB) << (64 - keyAlgo.getBits()); fillIDs(keyPart, foundEntries); } } } public int getChecksum() { return checksum; } public int getMinResolutionInMeter() { return minResolutionInMeter; } public void setMinResolutionInMeter(int minResolutionInMeter) { this.minResolutionInMeter = minResolutionInMeter; } public void flush() { dataAccess.setHeader(0, MAGIC_INT); dataAccess.setHeader(1 * 4, checksum); dataAccess.setHeader(2 * 4, minResolutionInMeter); // saving space not necessary: dataAccess.trimTo((lastPointer + 1) * 4); dataAccess.flush(); } public void close() { dataAccess.close(); } public boolean isClosed() { return dataAccess.isClosed(); } public long getCapacity() { return dataAccess.getCapacity(); } public void setChecksum(int checksum) { this.checksum = checksum; } public int getSize() { return size; } public int getLeafs() { return leafs; } }
routexl/graphhopper
core/src/main/java/com/graphhopper/storage/index/LineIntIndex.java
Java
apache-2.0
12,466
/* * Copyright 2015 - 2016 Nebula Bay. * * 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.tascape.qa.th.ws.driver; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; /** * * @author Linsong Wang */ public interface ResponseUpdater { public boolean matches(HttpRequest request); public void update(HttpResponse response); }
tascape/thx-webservice
src/main/java/com/tascape/qa/th/ws/driver/ResponseUpdater.java
Java
apache-2.0
885
# Copyright (c) 2012-2016 Seafile Ltd. import logging from rest_framework.authentication import SessionAuthentication from rest_framework.permissions import IsAdminUser from rest_framework.response import Response from rest_framework.views import APIView from rest_framework import status from django.template.defaultfilters import filesizeformat from django.utils.translation import ugettext as _ from seaserv import ccnet_api, seafile_api from seahub.api2.authentication import TokenAuthentication from seahub.api2.throttling import UserRateThrottle from seahub.api2.utils import api_error from seahub.base.accounts import User from seahub.signals import repo_deleted from seahub.views import get_system_default_repo_id from seahub.admin_log.signals import admin_operation from seahub.admin_log.models import REPO_CREATE, REPO_DELETE, REPO_TRANSFER from seahub.share.models import FileShare, UploadLinkShare from seahub.base.templatetags.seahub_tags import email2nickname, email2contact_email from seahub.group.utils import is_group_member, group_id_to_name from seahub.utils.repo import get_related_users_by_repo, normalize_repo_status_code, normalize_repo_status_str from seahub.utils import is_valid_dirent_name, is_valid_email from seahub.utils.timeutils import timestamp_to_isoformat_timestr from seahub.api2.endpoints.group_owned_libraries import get_group_id_by_repo_owner try: from seahub.settings import MULTI_TENANCY except ImportError: MULTI_TENANCY = False logger = logging.getLogger(__name__) def get_repo_info(repo): repo_owner = seafile_api.get_repo_owner(repo.repo_id) if not repo_owner: try: org_repo_owner = seafile_api.get_org_repo_owner(repo.repo_id) except Exception: org_repo_owner = None owner = repo_owner or org_repo_owner or '' result = {} result['id'] = repo.repo_id result['name'] = repo.repo_name result['owner'] = owner result['owner_email'] = owner result['owner_contact_email'] = email2contact_email(owner) result['size'] = repo.size result['size_formatted'] = filesizeformat(repo.size) result['encrypted'] = repo.encrypted result['file_count'] = repo.file_count result['status'] = normalize_repo_status_code(repo.status) result['last_modified'] = timestamp_to_isoformat_timestr(repo.last_modified) if '@seafile_group' in owner: group_id = get_group_id_by_repo_owner(owner) result['group_name'] = group_id_to_name(group_id) result['owner_name'] = group_id_to_name(group_id) else: result['owner_name'] = email2nickname(owner) return result class AdminLibraries(APIView): authentication_classes = (TokenAuthentication, SessionAuthentication) throttle_classes = (UserRateThrottle,) permission_classes = (IsAdminUser,) def get(self, request, format=None): """ List 'all' libraries (by name/owner/page) Permission checking: 1. only admin can perform this action. """ if not request.user.admin_permissions.can_manage_library(): return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.') order_by = request.GET.get('order_by', '').lower().strip() if order_by and order_by not in ('size', 'file_count'): error_msg = 'order_by invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) # search libraries (by name/owner) repo_name = request.GET.get('name', '') owner = request.GET.get('owner', '') repos = [] if repo_name and owner: # search by name and owner orgs = ccnet_api.get_orgs_by_user(owner) if orgs: org_id = orgs[0].org_id owned_repos = seafile_api.get_org_owned_repo_list(org_id, owner) else: owned_repos = seafile_api.get_owned_repo_list(owner) for repo in owned_repos: if not repo.name or repo.is_virtual: continue if repo_name in repo.name: repo_info = get_repo_info(repo) repos.append(repo_info) return Response({"name": repo_name, "owner": owner, "repos": repos}) elif repo_name: # search by name(keyword in name) repos_all = seafile_api.get_repo_list(-1, -1) for repo in repos_all: if not repo.name or repo.is_virtual: continue if repo_name in repo.name: repo_info = get_repo_info(repo) repos.append(repo_info) return Response({"name": repo_name, "owner": '', "repos": repos}) elif owner: # search by owner orgs = ccnet_api.get_orgs_by_user(owner) if orgs: org_id = orgs[0].org_id owned_repos = seafile_api.get_org_owned_repo_list(org_id, owner) else: owned_repos = seafile_api.get_owned_repo_list(owner) for repo in owned_repos: if repo.is_virtual: continue repo_info = get_repo_info(repo) repos.append(repo_info) return Response({"name": '', "owner": owner, "repos": repos}) # get libraries by page try: current_page = int(request.GET.get('page', '1')) per_page = int(request.GET.get('per_page', '100')) except ValueError: current_page = 1 per_page = 100 start = (current_page - 1) * per_page limit = per_page + 1 if order_by: repos_all = seafile_api.get_repo_list(start, limit, order_by) else: repos_all = seafile_api.get_repo_list(start, limit) if len(repos_all) > per_page: repos_all = repos_all[:per_page] has_next_page = True else: has_next_page = False default_repo_id = get_system_default_repo_id() repos_all = [r for r in repos_all if not r.is_virtual] repos_all = [r for r in repos_all if r.repo_id != default_repo_id] return_results = [] for repo in repos_all: repo_info = get_repo_info(repo) return_results.append(repo_info) page_info = { 'has_next_page': has_next_page, 'current_page': current_page } return Response({"page_info": page_info, "repos": return_results}) def post(self, request): """ Admin create library Permission checking: 1. only admin can perform this action. """ if not request.user.admin_permissions.can_manage_library(): return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.') repo_name = request.data.get('name', None) if not repo_name: error_msg = 'name invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) username = request.user.username repo_owner = request.data.get('owner', None) if repo_owner: try: User.objects.get(email=repo_owner) except User.DoesNotExist: error_msg = 'User %s not found.' % repo_owner return api_error(status.HTTP_404_NOT_FOUND, error_msg) else: repo_owner = username try: repo_id = seafile_api.create_repo(repo_name, '', repo_owner) except Exception as e: logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) # send admin operation log signal admin_op_detail = { "id": repo_id, "name": repo_name, "owner": repo_owner, } admin_operation.send(sender=None, admin_name=request.user.username, operation=REPO_CREATE, detail=admin_op_detail) repo = seafile_api.get_repo(repo_id) repo_info = get_repo_info(repo) return Response(repo_info) class AdminLibrary(APIView): authentication_classes = (TokenAuthentication, SessionAuthentication) throttle_classes = (UserRateThrottle,) permission_classes = (IsAdminUser,) def get(self, request, repo_id, format=None): """ get info of a library Permission checking: 1. only admin can perform this action. """ if not request.user.admin_permissions.can_manage_library(): return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.') repo = seafile_api.get_repo(repo_id) if not repo: error_msg = 'Library %s not found.' % repo_id return api_error(status.HTTP_404_NOT_FOUND, error_msg) repo_info = get_repo_info(repo) return Response(repo_info) def delete(self, request, repo_id, format=None): """ delete a library Permission checking: 1. only admin can perform this action. """ if not request.user.admin_permissions.can_manage_library(): return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.') if get_system_default_repo_id() == repo_id: error_msg = _('System library can not be deleted.') return api_error(status.HTTP_400_BAD_REQUEST, error_msg) repo = seafile_api.get_repo(repo_id) if not repo: # for case of `seafile-data` has been damaged # no `repo object` will be returned from seafile api # delete the database record anyway try: seafile_api.remove_repo(repo_id) except Exception as e: logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) return Response({'success': True}) repo_name = repo.name repo_owner = seafile_api.get_repo_owner(repo_id) if not repo_owner: repo_owner = seafile_api.get_org_repo_owner(repo_id) try: seafile_api.remove_repo(repo_id) try: org_id = seafile_api.get_org_id_by_repo_id(repo_id) related_usernames = get_related_users_by_repo(repo_id, org_id if org_id and org_id > 0 else None) except Exception as e: logger.error(e) org_id = -1 related_usernames = [] # send signal for seafevents repo_deleted.send(sender=None, org_id=-1, operator=request.user.username, usernames=related_usernames, repo_owner=repo_owner, repo_id=repo_id, repo_name=repo.name) except Exception as e: logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) # send admin operation log signal admin_op_detail = { "id": repo_id, "name": repo_name, "owner": repo_owner, } admin_operation.send(sender=None, admin_name=request.user.username, operation=REPO_DELETE, detail=admin_op_detail) return Response({'success': True}) def put(self, request, repo_id, format=None): """ update a library status, transfer a library, rename a library Permission checking: 1. only admin can perform this action. """ if not request.user.admin_permissions.can_manage_library(): return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.') # argument check new_status = request.data.get('status', None) if new_status: if new_status not in ('normal', 'read-only'): error_msg = 'status invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) new_repo_name = request.data.get('name', None) if new_repo_name: if not is_valid_dirent_name(new_repo_name): error_msg = 'name invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) new_owner = request.data.get('owner', None) if new_owner: if not is_valid_email(new_owner): error_msg = 'owner invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) # resource check repo = seafile_api.get_repo(repo_id) if not repo: error_msg = 'Library %s not found.' % repo_id return api_error(status.HTTP_404_NOT_FOUND, error_msg) if new_status: try: seafile_api.set_repo_status(repo_id, normalize_repo_status_str(new_status)) except Exception as e: logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) if new_repo_name: try: res = seafile_api.edit_repo(repo_id, new_repo_name, '', None) except Exception as e: logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) if res == -1: e = 'Admin rename failed: ID of library is %s, edit_repo api called failed.' % \ repo_id logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) if new_owner: try: new_owner_obj = User.objects.get(email=new_owner) except User.DoesNotExist: error_msg = 'User %s not found.' % new_owner return api_error(status.HTTP_404_NOT_FOUND, error_msg) if not new_owner_obj.permissions.can_add_repo(): error_msg = _('Transfer failed: role of %s is %s, can not add library.') % \ (new_owner, new_owner_obj.role) return api_error(status.HTTP_403_FORBIDDEN, error_msg) if MULTI_TENANCY: try: if seafile_api.get_org_id_by_repo_id(repo_id) > 0: error_msg = 'Can not transfer organization library.' return api_error(status.HTTP_403_FORBIDDEN, error_msg) if ccnet_api.get_orgs_by_user(new_owner): error_msg = 'Can not transfer library to organization user %s' % new_owner return api_error(status.HTTP_403_FORBIDDEN, error_msg) except Exception as e: logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) repo_owner = seafile_api.get_repo_owner(repo_id) if new_owner == repo_owner: error_msg = _("Library can not be transferred to owner.") return api_error(status.HTTP_400_BAD_REQUEST, error_msg) # get repo shared to user/group list shared_users = seafile_api.list_repo_shared_to( repo_owner, repo_id) shared_groups = seafile_api.list_repo_shared_group_by_user( repo_owner, repo_id) # get all pub repos pub_repos = [] if not request.cloud_mode: pub_repos = seafile_api.list_inner_pub_repos_by_owner(repo_owner) # transfer repo seafile_api.set_repo_owner(repo_id, new_owner) # reshare repo to user for shared_user in shared_users: shared_username = shared_user.user if new_owner == shared_username: continue seafile_api.share_repo(repo_id, new_owner, shared_username, shared_user.perm) # reshare repo to group for shared_group in shared_groups: shared_group_id = shared_group.group_id if not is_group_member(shared_group_id, new_owner): continue seafile_api.set_group_repo(repo_id, shared_group_id, new_owner, shared_group.perm) # reshare repo to links try: UploadLinkShare.objects.filter(username=repo_owner, repo_id=repo_id).update(username=new_owner) FileShare.objects.filter(username=repo_owner, repo_id=repo_id).update(username=new_owner) except Exception as e: logger.error(e) error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) # check if current repo is pub-repo # if YES, reshare current repo to public for pub_repo in pub_repos: if repo_id != pub_repo.id: continue seafile_api.add_inner_pub_repo(repo_id, pub_repo.permission) break # send admin operation log signal admin_op_detail = { "id": repo_id, "name": repo.name, "from": repo_owner, "to": new_owner, } admin_operation.send(sender=None, admin_name=request.user.username, operation=REPO_TRANSFER, detail=admin_op_detail) repo = seafile_api.get_repo(repo_id) repo_info = get_repo_info(repo) return Response(repo_info) class AdminSearchLibrary(APIView): authentication_classes = (TokenAuthentication, SessionAuthentication) throttle_classes = (UserRateThrottle,) permission_classes = (IsAdminUser,) def get(self, request, format=None): """ Search library by name. Permission checking: 1. only admin can perform this action. """ if not request.user.admin_permissions.can_manage_library(): return api_error(status.HTTP_403_FORBIDDEN, 'Permission denied.') query_str = request.GET.get('query', '').lower().strip() if not query_str: error_msg = 'query invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) repos = seafile_api.search_repos_by_name(query_str) default_repo_id = get_system_default_repo_id() repos = [r for r in repos if not r.is_virtual] repos = [r for r in repos if r.repo_id != default_repo_id] email_dict = {} name_dict = {} contact_email_dict = {} for repo in repos: # get owner email repo_id = repo.repo_id repo_owner = seafile_api.get_repo_owner(repo_id) if not repo_owner: try: org_repo_owner = seafile_api.get_org_repo_owner(repo_id) except Exception: org_repo_owner = '' owner_email = repo_owner or org_repo_owner or '' if repo_id not in email_dict: email_dict[repo_id] = owner_email # get owner name if repo_id not in name_dict: # is department library if '@seafile_group' in owner_email: group_id = get_group_id_by_repo_owner(owner_email) owner_name = group_id_to_name(group_id) else: owner_name = email2nickname(owner_email) name_dict[repo_id] = owner_name # get owner contact_email if repo_id not in contact_email_dict: if '@seafile_group' in owner_email: owner_contact_email = '' else: owner_contact_email = email2contact_email(owner_email) contact_email_dict[repo_id] = owner_contact_email result = [] for repo in repos: info = {} info['id'] = repo.repo_id info['name'] = repo.repo_name info['owner_email'] = email_dict.get(repo.repo_id, '') info['owner_name'] = name_dict.get(repo.repo_id, '') info['owner_contact_email'] = contact_email_dict.get(repo.repo_id, '') info['size'] = repo.size info['encrypted'] = repo.encrypted info['file_count'] = repo.file_count info['status'] = normalize_repo_status_code(repo.status) result.append(info) return Response({"repo_list": result})
miurahr/seahub
seahub/api2/endpoints/admin/libraries.py
Python
apache-2.0
20,715
# frozen_string_literal: true # # Author:: Joerg Herzinger <joerg.herzinger@oiml.at> # Author:: Phil Dibowitz <phil@ipom.com> # Copyright:: Copyright (c) 2011 GLOBAL 2000/Friends of the Earth Austria # Copyright:: Copyright (c) 2017 Facebook, Inc. # License:: Apache License, Version 2.0 # # 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. Ohai.plugin(:Lspci) do provides "pci" optional true collect_data(:linux) do devices = Mash.new h = /[0-9a-fA-F]/ # any hex digit hh = /#{h}#{h}/ # any 2 hex digits hhhh = /#{h}#{h}#{h}#{h}/ # any 4 hex digits d_id = "" # This identifies our pci devices def standard_form(devices, d_id, hhhh, tag, line) tmp = line.scan(/(.*)\s\[(#{hhhh})\]/)[0] devices[d_id]["#{tag}_name"] = tmp[0] devices[d_id]["#{tag}_id"] = tmp[1] end def standard_array(devices, d_id, tag, line) if !devices[d_id][tag].is_a?(Array) devices[d_id][tag] = [line] else devices[d_id][tag].push(line) end end shell_out("lspci -vnnmk").stdout.split("\n").each do |line| dev = line.scan(/^(.*):\s(.*)$/)[0] next if dev.nil? case dev[0] when "Device" # There are two different Device tags if ( tmp = dev[1].match(/(#{hh}:#{hh}.#{h})/) ) # We have a device id d_id = tmp[0] # From now on we will need this id devices[d_id] = Mash.new else standard_form(devices, d_id, hhhh, "device", dev[1]) end when "Class" standard_form(devices, d_id, hhhh, "class", dev[1]) when "Vendor" standard_form(devices, d_id, hhhh, "vendor", dev[1]) when "Driver" standard_array(devices, d_id, "driver", dev[1]) when "Module" standard_array(devices, d_id, "module", dev[1]) when "SDevice" standard_form(devices, d_id, hhhh, "sdevice", dev[1]) end end pci devices end end
chef/ohai
lib/ohai/plugins/linux/lspci.rb
Ruby
apache-2.0
2,426
define( //begin v1.x content { "LUF_symbol": "F", "LUF_decimal": ".", "LUF_group": "," } //end v1.x content );
abssi/poc-tijari
dojoLib/toolkit/dojo/dojo/cldr/nls/de-lu/currency.js
JavaScript
apache-2.0
113
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.gecko.sync.config; import java.io.FileOutputStream; import java.io.PrintStream; import org.mozilla.gecko.sync.ExtendedJSONObject; import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Utils; import org.mozilla.gecko.sync.setup.Constants; import org.mozilla.gecko.sync.setup.SyncAccounts; import org.mozilla.gecko.sync.setup.SyncAccounts.SyncAccountParameters; import android.accounts.Account; import android.content.Context; /** * Bug 768102: Android deletes Account objects when the Authenticator that owns * the Account disappears. This happens when an App is installed to the SD card * and the SD card is un-mounted or the device is rebooted. * <p> * Bug 769745: Work around this by pickling the current Sync account data every * sync. * <p> * Bug 735842: Work around this by un-pickling when we check if Sync accounts * exist (called from Fennec). * <p> * Android just doesn't support installing Apps that define long-lived Services * and/or own Account types onto the SD card. The documentation says not to do * it. There are hordes of developers who want to do it, and have tried to * register for almost every "package installation changed" broadcast intent * that Android supports. They all explicitly state that the package that has * changed does *not* receive the broadcast intent, thereby preventing an App * from re-establishing its state. * <p> * <a href="http://developer.android.com/guide/topics/data/install-location.html">Reference.</a> * <p> * <b>Quote</b>: Your AbstractThreadedSyncAdapter and all its sync functionality * will not work until external storage is remounted. * <p> * <b>Quote</b>: Your running Service will be killed and will not be restarted * when external storage is remounted. You can, however, register for the * ACTION_EXTERNAL_APPLICATIONS_AVAILABLE broadcast Intent, which will notify * your application when applications installed on external storage have become * available to the system again. At which time, you can restart your Service. * <p> * Problem: <a href="http://code.google.com/p/android/issues/detail?id=8485">that intent doesn't work</a>! */ public class AccountPickler { public static final String LOG_TAG = "AccountPickler"; public static final long VERSION = 1; /** * Remove Sync account persisted to disk. * * @param context Android context. * @param filename name of persisted pickle file; must not contain path separators. * @return <code>true</code> if given pickle existed and was successfully deleted. */ public static boolean deletePickle(final Context context, final String filename) { return context.deleteFile(filename); } /** * Persist Sync account to disk as a JSON object. * <p> * JSON object has keys: * <ul> * <li><code>Constants.JSON_KEY_ACCOUNT</code>: the Sync account's un-encoded username, * like "test@mozilla.com".</li> * * <li><code>Constants.JSON_KEY_PASSWORD</code>: the Sync account's password;</li> * * <li><code>Constants.JSON_KEY_SERVER</code>: the Sync account's server;</li> * * <li><code>Constants.JSON_KEY_SYNCKEY</code>: the Sync account's sync key;</li> * * <li><code>Constants.JSON_KEY_CLUSTER</code>: the Sync account's cluster (may be null);</li> * * <li><code>Constants.JSON_KEY_CLIENT_NAME</code>: the Sync account's client name (may be null);</li> * * <li><code>Constants.JSON_KEY_CLIENT_GUID</code>: the Sync account's client GUID (may be null);</li> * * <li><code>Constants.JSON_KEY_SYNC_AUTOMATICALLY</code>: true if the Android Account is syncing automically;</li> * * <li><code>Constants.JSON_KEY_VERSION</code>: version of this file;</li> * * <li><code>Constants.JSON_KEY_TIMESTAMP</code>: when this file was written.</li> * </ul> * * * @param context Android context. * @param filename name of file to persist to; must not contain path separators. * @param params the Sync account's parameters. * @param syncAutomatically whether the Android Account object is syncing automatically. */ public static void pickle(final Context context, final String filename, final SyncAccountParameters params, final boolean syncAutomatically) { final ExtendedJSONObject o = params.asJSON(); o.put(Constants.JSON_KEY_SYNC_AUTOMATICALLY, Boolean.valueOf(syncAutomatically)); o.put(Constants.JSON_KEY_VERSION, new Long(VERSION)); o.put(Constants.JSON_KEY_TIMESTAMP, new Long(System.currentTimeMillis())); PrintStream ps = null; try { final FileOutputStream fos = context.openFileOutput(filename, Context.MODE_PRIVATE); ps = new PrintStream(fos); ps.print(o.toJSONString()); Logger.debug(LOG_TAG, "Persisted " + o.keySet().size() + " account settings to " + filename + "."); } catch (Exception e) { Logger.warn(LOG_TAG, "Caught exception persisting account settings to " + filename + "; ignoring.", e); } finally { if (ps != null) { ps.close(); } } } /** * Create Android account from saved JSON object. * * @param context * Android context. * @param filename * name of file to read from; must not contain path separators. * @return created Android account, or null on error. */ public static Account unpickle(final Context context, final String filename) { final String jsonString = Utils.readFile(context, filename); if (jsonString == null) { Logger.info(LOG_TAG, "Pickle file '" + filename + "' not found; aborting."); return null; } ExtendedJSONObject json = null; try { json = ExtendedJSONObject.parseJSONObject(jsonString); } catch (Exception e) { Logger.warn(LOG_TAG, "Got exception reading pickle file '" + filename + "'; aborting.", e); return null; } SyncAccountParameters params = null; try { // Null checking of inputs is done in constructor. params = new SyncAccountParameters(context, null, json); } catch (IllegalArgumentException e) { Logger.warn(LOG_TAG, "Un-pickled data included null username, password, or serverURL; aborting.", e); return null; } // Default to syncing automatically. boolean syncAutomatically = true; if (json.containsKey(Constants.JSON_KEY_SYNC_AUTOMATICALLY)) { if (Boolean.FALSE.equals(json.get(Constants.JSON_KEY_SYNC_AUTOMATICALLY))) { syncAutomatically = false; } } final Account account = SyncAccounts.createSyncAccountPreservingExistingPreferences(params, syncAutomatically); if (account == null) { Logger.warn(LOG_TAG, "Failed to add Android Account; aborting."); return null; } Integer version = json.getIntegerSafely(Constants.JSON_KEY_VERSION); Integer timestamp = json.getIntegerSafely(Constants.JSON_KEY_TIMESTAMP); if (version == null || timestamp == null) { Logger.warn(LOG_TAG, "Did not find version or timestamp in pickle file; ignoring."); version = new Integer(-1); timestamp = new Integer(-1); } Logger.info(LOG_TAG, "Un-pickled Android account named " + params.username + " (version " + version + ", pickled at " + timestamp + ")."); return account; } }
sergecodd/FireFox-OS
B2G/gecko/mobile/android/base/sync/config/AccountPickler.java
Java
apache-2.0
7,466
from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from product_spiders.items import Product, ProductLoader class TigerChefSpider(BaseSpider): name = 'tigerchef.com' allowed_domains = ['tigerchef.com'] start_urls = ('http://www.tigerchef.com',) def parse(self, response): hxs = HtmlXPathSelector(response) #categories = hxs.select('//div[@class="sidebar_nav"]//li/a/@href').extract() categories = hxs.select('//div[@class="navigation"]/ul/li/a/@href').extract() categories += hxs.select('//ul[@class="cl_subs"]//a/@href').extract() loaded = False for category in categories: loaded = True yield Request(category) next_page = hxs.select('//a[@rel="next"]/@href').extract() if next_page: base_url = get_base_url(response) loaded = True yield Request(urljoin_rfc(base_url, next_page[0])) products = [product for product in self.parse_products(hxs)] for product in products: yield product if (not products or not loaded) and response.meta.get('retries', 0) < 3: yield Request(response.url, dont_filter=True, meta={'retries': response.meta.get('retries', 0) + 1}) def parse_products(self, hxs): products = hxs.select('//div[starts-with(@id, "product_")]') for product in products: product_loader = ProductLoader(Product(), product) product_loader.add_xpath('url', './/span[@class="description"]/a/@href') product_loader.add_xpath('name', './/span[@class="description"]/a/b/text()') #product_loader.add_xpath('price', './/label/text()') product_loader.add_xpath('price', './/div[@class="our_price"]/text()') product_loader.add_xpath('sku', './/span[@class="description"]', re='Model #:[\s(]*([\S^)]*)') yield product_loader.load_item()
0--key/lib
portfolio/Python/scrapy/tigerchef/tigerchefspider.py
Python
apache-2.0
2,126
import unittest from lib.data_structures.trees.parse_tree import ParseTree class TestParseTree(unittest.TestCase): def evaluate(self, expression, result): parser = ParseTree() parse_tree = parser.build_parse_tree(expression) self.assertEqual(parser.evaluate(parse_tree), result) print(parse_tree) def testParseTree(self): self.evaluate("( ( 5 + ( 2 * ( 100 / 2 ) ) ) - 5 )", 100) self.evaluate("( 10 + 5 )", 15) self.evaluate("( 10 / 2 )", 5) self.evaluate("( 5 * ( 5 * ( 5 * 5 ) ) ) )", 625) self.evaluate("( 10 / ( 5 + ( 3 + 2 ) ) )", 1) self.evaluate("( 1 + ( 10 - ( 5 + ( 3 + 2 ) ) ) )", 1)
anthonynsimon/python-data-structures-algorithms
tests/test_parse_tree.py
Python
apache-2.0
686
/* * * Copyright 2013 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.http4; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.netflix.client.config.ClientConfigFactory; import com.netflix.client.config.CommonClientConfigKey; import com.netflix.client.config.IClientConfig; import com.netflix.client.config.IClientConfigKey; import com.netflix.client.config.Property; import com.netflix.servo.annotations.DataSourceType; import com.netflix.servo.annotations.Monitor; import com.netflix.servo.monitor.Monitors; import com.netflix.servo.monitor.Stopwatch; import com.netflix.servo.monitor.Timer; import org.apache.http.Header; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.params.ClientPNames; import org.apache.http.client.params.HttpClientParams; import org.apache.http.client.utils.URIUtils; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.routing.HttpRoute; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; import org.apache.http.message.BasicHeader; import org.apache.http.params.HttpParams; import org.apache.http.params.HttpProtocolParams; import org.apache.http.protocol.HttpContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; /** * Netflix extension of Apache 4.0 HttpClient * Just so we can wrap around some features. * * @author stonse * */ public class NFHttpClient extends DefaultHttpClient { private static final Logger LOGGER = LoggerFactory.getLogger(NFHttpClient.class); private static IClientConfigKey<Integer> RETRIES = new CommonClientConfigKey<Integer>("%s.nfhttpclient.retries", 3) {}; private static IClientConfigKey<Integer> SLEEP_TIME_FACTOR_MS = new CommonClientConfigKey<Integer>("%s.nfhttpclient.sleepTimeFactorMs", 10) {}; private static IClientConfigKey<Integer> CONN_IDLE_EVICT_TIME_MILLIS = new CommonClientConfigKey<Integer>("%s.nfhttpclient.connIdleEvictTimeMilliSeconds", 30*1000) {}; protected static final String EXECUTE_TRACER = "HttpClient-ExecuteTimer"; private static ScheduledExecutorService connectionPoolCleanUpScheduler; private HttpHost httpHost = null; private HttpRoute httpRoute = null; private static AtomicInteger numNonNamedHttpClients = new AtomicInteger(); private final String name; ConnectionPoolCleaner connPoolCleaner; Property<Integer> connIdleEvictTimeMilliSeconds; private Property<Integer> retriesProperty; private Property<Integer> sleepTimeFactorMsProperty; private Timer tracer; private Property<Integer> maxTotalConnectionProperty; private Property<Integer> maxConnectionPerHostProperty; static { ThreadFactory factory = (new ThreadFactoryBuilder()).setDaemon(true) .setNameFormat("Connection pool clean up thread") .build(); connectionPoolCleanUpScheduler = Executors.newScheduledThreadPool(2, factory); } protected NFHttpClient(String host, int port){ super(new ThreadSafeClientConnManager()); this.name = "UNNAMED_" + numNonNamedHttpClients.incrementAndGet(); httpHost = new HttpHost(host, port); httpRoute = new HttpRoute(httpHost); init(createDefaultConfig(), false); } protected NFHttpClient(){ super(new ThreadSafeClientConnManager()); this.name = "UNNAMED_" + numNonNamedHttpClients.incrementAndGet(); init(createDefaultConfig(), false); } private static IClientConfig createDefaultConfig() { IClientConfig config = ClientConfigFactory.DEFAULT.newConfig(); config.loadProperties("default"); return config; } protected NFHttpClient(String name) { this(name, createDefaultConfig(), true); } protected NFHttpClient(String name, IClientConfig config) { this(name, config, true); } protected NFHttpClient(String name, IClientConfig config, boolean registerMonitor) { super(new MonitoredConnectionManager(name)); this.name = name; init(config, registerMonitor); } void init(IClientConfig config, boolean registerMonitor) { HttpParams params = getParams(); HttpProtocolParams.setContentCharset(params, "UTF-8"); params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, ThreadSafeClientConnManager.class.getName()); HttpClientParams.setRedirecting(params, config.get(CommonClientConfigKey.FollowRedirects, true)); // set up default headers List<Header> defaultHeaders = new ArrayList<Header>(); defaultHeaders.add(new BasicHeader("Netflix.NFHttpClient.Version", "1.0")); defaultHeaders.add(new BasicHeader("X-netflix-httpclientname", name)); params.setParameter(ClientPNames.DEFAULT_HEADERS, defaultHeaders); connPoolCleaner = new ConnectionPoolCleaner(name, this.getConnectionManager(), connectionPoolCleanUpScheduler); this.retriesProperty = config.getGlobalProperty(RETRIES.format(name)); this.sleepTimeFactorMsProperty = config.getGlobalProperty(SLEEP_TIME_FACTOR_MS.format(name)); setHttpRequestRetryHandler( new NFHttpMethodRetryHandler(this.name, this.retriesProperty.getOrDefault(), false, this.sleepTimeFactorMsProperty.getOrDefault())); tracer = Monitors.newTimer(EXECUTE_TRACER + "-" + name, TimeUnit.MILLISECONDS); if (registerMonitor) { Monitors.registerObject(name, this); } maxTotalConnectionProperty = config.getDynamicProperty(CommonClientConfigKey.MaxTotalHttpConnections); maxTotalConnectionProperty.onChange(newValue -> ((ThreadSafeClientConnManager) getConnectionManager()).setMaxTotal(newValue) ); maxConnectionPerHostProperty = config.getDynamicProperty(CommonClientConfigKey.MaxHttpConnectionsPerHost); maxConnectionPerHostProperty.onChange(newValue -> ((ThreadSafeClientConnManager) getConnectionManager()).setDefaultMaxPerRoute(newValue) ); connIdleEvictTimeMilliSeconds = config.getGlobalProperty(CONN_IDLE_EVICT_TIME_MILLIS.format(name)); } public void initConnectionCleanerTask(){ //set the Properties connPoolCleaner.setConnIdleEvictTimeMilliSeconds(getConnIdleEvictTimeMilliSeconds());// set FastProperty reference // for this named httpclient - so we can override it later if we want to //init the Timer Task //note that we can change the idletime settings after the start of the Thread connPoolCleaner.initTask(); } @Monitor(name = "HttpClient-ConnPoolCleaner", type = DataSourceType.INFORMATIONAL) public ConnectionPoolCleaner getConnPoolCleaner() { return connPoolCleaner; } @Monitor(name = "HttpClient-ConnIdleEvictTimeMilliSeconds", type = DataSourceType.INFORMATIONAL) public Property<Integer> getConnIdleEvictTimeMilliSeconds() { return connIdleEvictTimeMilliSeconds; } @Monitor(name="HttpClient-ConnectionsInPool", type = DataSourceType.GAUGE) public int getConnectionsInPool() { ClientConnectionManager connectionManager = this.getConnectionManager(); if (connectionManager != null) { return ((ThreadSafeClientConnManager)connectionManager).getConnectionsInPool(); } else { return 0; } } @Monitor(name = "HttpClient-MaxTotalConnections", type = DataSourceType.INFORMATIONAL) public int getMaxTotalConnnections() { ClientConnectionManager connectionManager = this.getConnectionManager(); if (connectionManager != null) { return ((ThreadSafeClientConnManager)connectionManager).getMaxTotal(); } else { return 0; } } @Monitor(name = "HttpClient-MaxConnectionsPerHost", type = DataSourceType.INFORMATIONAL) public int getMaxConnectionsPerHost() { ClientConnectionManager connectionManager = this.getConnectionManager(); if (connectionManager != null) { if(httpRoute == null) return ((ThreadSafeClientConnManager)connectionManager).getDefaultMaxPerRoute(); else return ((ThreadSafeClientConnManager)connectionManager).getMaxForRoute(httpRoute); } else { return 0; } } @Monitor(name = "HttpClient-NumRetries", type = DataSourceType.INFORMATIONAL) public int getNumRetries() { return this.retriesProperty.getOrDefault(); } public void setConnIdleEvictTimeMilliSeconds(Property<Integer> connIdleEvictTimeMilliSeconds) { this.connIdleEvictTimeMilliSeconds = connIdleEvictTimeMilliSeconds; } @Monitor(name = "HttpClient-SleepTimeFactorMs", type = DataSourceType.INFORMATIONAL) public int getSleepTimeFactorMs() { return this.sleepTimeFactorMsProperty.getOrDefault(); } // copied from httpclient source code private static HttpHost determineTarget(HttpUriRequest request) throws ClientProtocolException { // A null target may be acceptable if there is a default target. // Otherwise, the null target is detected in the director. HttpHost target = null; URI requestURI = request.getURI(); if (requestURI.isAbsolute()) { target = URIUtils.extractHost(requestURI); if (target == null) { throw new ClientProtocolException( "URI does not specify a valid host name: " + requestURI); } } return target; } @Override public <T> T execute( final HttpUriRequest request, final ResponseHandler<? extends T> responseHandler) throws IOException, ClientProtocolException { return this.execute(request, responseHandler, null); } @Override public <T> T execute( final HttpUriRequest request, final ResponseHandler<? extends T> responseHandler, final HttpContext context) throws IOException, ClientProtocolException { HttpHost target = null; if(httpHost == null) target = determineTarget(request); else target = httpHost; return this.execute(target, request, responseHandler, context); } @Override public <T> T execute( final HttpHost target, final HttpRequest request, final ResponseHandler<? extends T> responseHandler) throws IOException, ClientProtocolException { return this.execute(target, request, responseHandler, null); } @Override public <T> T execute( final HttpHost target, final HttpRequest request, final ResponseHandler<? extends T> responseHandler, final HttpContext context) throws IOException, ClientProtocolException { Stopwatch sw = tracer.start(); try{ // TODO: replaced method.getQueryString() with request.getRequestLine().getUri() LOGGER.debug("Executing HTTP method: {}, uri: {}", request.getRequestLine().getMethod(), request.getRequestLine().getUri()); return super.execute(target, request, responseHandler, context); }finally{ sw.stop(); } } public void shutdown() { if (connPoolCleaner != null) { connPoolCleaner.shutdown(); } getConnectionManager().shutdown(); } }
Netflix/ribbon
ribbon-httpclient/src/main/java/com/netflix/http4/NFHttpClient.java
Java
apache-2.0
11,591
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ 'use strict'; const models = require('./index'); /** * @class * Initializes a new instance of the ResourceMetricValue class. * @constructor * Value of resource metric. * * @member {string} [timestamp] Value timestamp. * * @member {number} [average] Value average. * * @member {number} [minimum] Value minimum. * * @member {number} [maximum] Value maximum. * * @member {number} [total] Value total. * * @member {number} [count] Value count. * * @member {array} [properties] Properties. * */ class ResourceMetricValue { constructor() { } /** * Defines the metadata of ResourceMetricValue * * @returns {object} metadata of ResourceMetricValue * */ mapper() { return { required: false, serializedName: 'ResourceMetricValue', type: { name: 'Composite', className: 'ResourceMetricValue', modelProperties: { timestamp: { required: false, readOnly: true, serializedName: 'timestamp', type: { name: 'String' } }, average: { required: false, readOnly: true, serializedName: 'average', type: { name: 'Number' } }, minimum: { required: false, readOnly: true, serializedName: 'minimum', type: { name: 'Number' } }, maximum: { required: false, readOnly: true, serializedName: 'maximum', type: { name: 'Number' } }, total: { required: false, readOnly: true, serializedName: 'total', type: { name: 'Number' } }, count: { required: false, readOnly: true, serializedName: 'count', type: { name: 'Number' } }, properties: { required: false, readOnly: true, serializedName: 'properties', type: { name: 'Sequence', element: { required: false, serializedName: 'ResourceMetricPropertyElementType', type: { name: 'Composite', className: 'ResourceMetricProperty' } } } } } } }; } } module.exports = ResourceMetricValue;
begoldsm/azure-sdk-for-node
lib/services/webSiteManagement2/lib/models/resourceMetricValue.js
JavaScript
apache-2.0
2,925
/** @file Handle on-disk format and volume structures in UDF/ECMA-167 file systems. Copyright (C) 2014-2017 Paulo Alcantara <pcacjr@zytor.com> Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "Udf.h" // // Vendor-Defined Device Path GUID for UDF file system // EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID; /** Find the anchor volume descriptor pointer. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[out] AnchorPoint Anchor volume descriptor pointer. @retval EFI_SUCCESS Anchor volume descriptor pointer found. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval other Anchor volume descriptor pointer not found. **/ EFI_STATUS FindAnchorVolumeDescriptorPointer ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint ) { EFI_STATUS Status; UINT32 BlockSize; EFI_LBA EndLBA; EFI_LBA DescriptorLBAs[4]; UINTN Index; UDF_DESCRIPTOR_TAG *DescriptorTag; BlockSize = BlockIo->Media->BlockSize; EndLBA = BlockIo->Media->LastBlock; DescriptorLBAs[0] = 256; DescriptorLBAs[1] = EndLBA - 256; DescriptorLBAs[2] = EndLBA; DescriptorLBAs[3] = 512; for (Index = 0; Index < ARRAY_SIZE (DescriptorLBAs); Index++) { Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, MultU64x32 (DescriptorLBAs[Index], BlockSize), sizeof (UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER), (VOID *)AnchorPoint ); if (EFI_ERROR (Status)) { return Status; } DescriptorTag = &AnchorPoint->DescriptorTag; // // Check if read LBA has a valid AVDP descriptor. // if (DescriptorTag->TagIdentifier == UdfAnchorVolumeDescriptorPointer) { return EFI_SUCCESS; } } // // No AVDP found. // return EFI_VOLUME_CORRUPTED; } /** Save the content of Logical Volume Descriptors and Partitions Descriptors in memory. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] AnchorPoint Anchor volume descriptor pointer. @param[out] Volume UDF volume information structure. @retval EFI_SUCCESS The descriptors were saved. @retval EFI_OUT_OF_RESOURCES The descriptors were not saved due to lack of resources. @retval other The descriptors were not saved due to ReadDisk error. **/ EFI_STATUS StartMainVolumeDescriptorSequence ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint, OUT UDF_VOLUME_INFO *Volume ) { EFI_STATUS Status; UINT32 BlockSize; UDF_EXTENT_AD *ExtentAd; EFI_LBA SeqStartBlock; EFI_LBA SeqEndBlock; BOOLEAN StopSequence; VOID *Buffer; UDF_DESCRIPTOR_TAG *DescriptorTag; UINT32 LogicalBlockSize; BlockSize = BlockIo->Media->BlockSize; ExtentAd = &AnchorPoint->MainVolumeDescriptorSequenceExtent; // // Allocate buffer for reading disk blocks // Buffer = AllocateZeroPool ((UINTN)BlockSize); if (Buffer == NULL) { return EFI_OUT_OF_RESOURCES; } // // The logical partition created by Partition driver is relative to the main // VDS extent location, so we start the Main Volume Descriptor Sequence at // LBA 0. // // We don't need to check again if we have valid Volume Descriptors here since // Partition driver already did. // SeqStartBlock = 0; SeqEndBlock = SeqStartBlock + DivU64x32 ((UINT64)ExtentAd->ExtentLength, BlockSize); StopSequence = FALSE; for (; SeqStartBlock < SeqEndBlock && !StopSequence; SeqStartBlock++) { // // Read disk block // Status = BlockIo->ReadBlocks ( BlockIo, BlockIo->Media->MediaId, SeqStartBlock, BlockSize, Buffer ); if (EFI_ERROR (Status)) { goto Out_Free; } DescriptorTag = Buffer; switch (DescriptorTag->TagIdentifier) { case UdfPartitionDescriptor: // // Save Partition Descriptor // CopyMem (&Volume->PartitionDesc, Buffer, sizeof (Volume->PartitionDesc)); break; case UdfLogicalVolumeDescriptor: // // Save Logical Volume Descriptor // CopyMem (&Volume->LogicalVolDesc, Buffer, sizeof (Volume->LogicalVolDesc)); break; case UdfTerminatingDescriptor: StopSequence = TRUE; break; default: ; } } // // Determine FE (File Entry) size // LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize; if (LogicalBlockSize >= UDF_LOGICAL_SECTOR_SIZE) { Volume->FileEntrySize = (UINTN)LogicalBlockSize; } else { Volume->FileEntrySize = UDF_LOGICAL_SECTOR_SIZE; } Status = EFI_SUCCESS; Out_Free: // // Free block read buffer // FreePool (Buffer); return Status; } /** Return a Partition Descriptor given a Long Allocation Descriptor. This is necessary to calculate the right extent (LongAd) offset which is added up with partition's starting location. @param[in] Volume Volume information pointer. @param[in] LongAd Long Allocation Descriptor pointer. @return A pointer to a Partition Descriptor. **/ UDF_PARTITION_DESCRIPTOR * GetPdFromLongAd ( IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *LongAd ) { UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc; UINT16 PartitionNum; LogicalVolDesc = &Volume->LogicalVolDesc; switch (LogicalVolDesc->DomainIdentifier.Suffix.Domain.UdfRevision) { case 0x0102: case 0x0150: case 0x0200: case 0x0201: case 0x0250: case 0x0260: // // UDF 1.02 specification: // // There shall be exactly one prevailing Logical Volume Descriptor recorded // per Volume Set. The Partition Maps field shall contain only Type 1 // Partition Maps. // // UDF 1.50 through 2.60 specs say: // // For the purpose of interchange partition maps shall be limited to // Partition Map type 1, except type 2 maps as described in the document. // // NOTE: Only one Type 1 (Physical) Partition is supported. It has been // checked already in Partition driver for existence of a single Type 1 // Partition map. Hence, the 'PartitionReferenceNumber' field (the index // used to access Partition Maps data within the Logical Volume Descriptor) // in the Long Allocation Descriptor should be 0 to indicate there is only // one partition. // if (LongAd->ExtentLocation.PartitionReferenceNumber != 0) { return NULL; } // // Since only one partition, get the first one directly. // PartitionNum = *(UINT16 *)((UINTN)&LogicalVolDesc->PartitionMaps[4]); break; default: // // Unsupported UDF revision // return NULL; } // // Check if partition number matches Partition Descriptor found in Main Volume // Descriptor Sequence. // if (Volume->PartitionDesc.PartitionNumber == PartitionNum) { return &Volume->PartitionDesc; } return NULL; } /** Return logical sector number of a given Long Allocation Descriptor. @param[in] Volume Volume information pointer. @param[in] LongAd Long Allocation Descriptor pointer. @param[out] Lsn Logical sector number pointer. @retval EFI_SUCCESS Logical sector number successfully returned. @retval EFI_UNSUPPORTED Logical sector number is not returned due to unrecognized format. **/ EFI_STATUS GetLongAdLsn ( IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *LongAd, OUT UINT64 *Lsn ) { UDF_PARTITION_DESCRIPTOR *PartitionDesc; PartitionDesc = GetPdFromLongAd (Volume, LongAd); if (PartitionDesc == NULL) { DEBUG (( DEBUG_ERROR, "%a: Fail to get the Partition Descriptor from the given Long Allocation Descriptor.\n", __FUNCTION__ )); return EFI_UNSUPPORTED; } *Lsn = (UINT64)PartitionDesc->PartitionStartingLocation - Volume->MainVdsStartLocation + LongAd->ExtentLocation.LogicalBlockNumber; return EFI_SUCCESS; } /** Return logical sector number of a given Short Allocation Descriptor. @param[in] Volume Volume pointer. @param[in] PartitionDesc Partition Descriptor pointer. @param[in] ShortAd Short Allocation Descriptor pointer. @return The logical sector number of a given Short Allocation Descriptor. **/ UINT64 GetShortAdLsn ( IN UDF_VOLUME_INFO *Volume, IN UDF_PARTITION_DESCRIPTOR *PartitionDesc, IN UDF_SHORT_ALLOCATION_DESCRIPTOR *ShortAd ) { return (UINT64)PartitionDesc->PartitionStartingLocation - Volume->MainVdsStartLocation + ShortAd->ExtentPosition; } /** Find File Set Descriptor of a given Logical Volume Descriptor. The found FSD will contain the extent (LogicalVolumeContentsUse) where our root directory is. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume Volume information pointer. @retval EFI_SUCCESS File Set Descriptor pointer found. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval other File Set Descriptor pointer not found. **/ EFI_STATUS FindFileSetDescriptor ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume ) { EFI_STATUS Status; UINT64 Lsn; UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc; UDF_DESCRIPTOR_TAG *DescriptorTag; LogicalVolDesc = &Volume->LogicalVolDesc; Status = GetLongAdLsn (Volume, &LogicalVolDesc->LogicalVolumeContentsUse, &Lsn); if (EFI_ERROR (Status)) { return Status; } // // As per UDF 2.60 specification: // // There shall be exactly one File Set Descriptor recorded per Logical // Volume. // // Read disk block // Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, MultU64x32 (Lsn, LogicalVolDesc->LogicalBlockSize), sizeof (Volume->FileSetDesc), &Volume->FileSetDesc ); if (EFI_ERROR (Status)) { return Status; } DescriptorTag = &Volume->FileSetDesc.DescriptorTag; // // Check if read block is a File Set Descriptor // if (DescriptorTag->TagIdentifier != UdfFileSetDescriptor) { return EFI_VOLUME_CORRUPTED; } return EFI_SUCCESS; } /** Read Volume and File Structure on an UDF file system. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[out] Volume Volume information pointer. @retval EFI_SUCCESS Volume and File Structure were read. @retval other Volume and File Structure were not read. **/ EFI_STATUS ReadVolumeFileStructure ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_VOLUME_INFO *Volume ) { EFI_STATUS Status; UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER AnchorPoint; UDF_EXTENT_AD *ExtentAd; // // Find Anchor Volume Descriptor Pointer // Status = FindAnchorVolumeDescriptorPointer ( BlockIo, DiskIo, &AnchorPoint ); if (EFI_ERROR (Status)) { return Status; } // // Save Main VDS start block number // ExtentAd = &AnchorPoint.MainVolumeDescriptorSequenceExtent; Volume->MainVdsStartLocation = (UINT64)ExtentAd->ExtentLocation; // // Start Main Volume Descriptor Sequence. // Status = StartMainVolumeDescriptorSequence ( BlockIo, DiskIo, &AnchorPoint, Volume ); if (EFI_ERROR (Status)) { return Status; } return Status; } /** Calculate length of a given File Identifier Descriptor. @param[in] FileIdentifierDesc File Identifier Descriptor pointer. @return The length of a given File Identifier Descriptor. **/ UINT64 GetFidDescriptorLength ( IN UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc ) { return (UINT64)( (INTN)((OFFSET_OF (UDF_FILE_IDENTIFIER_DESCRIPTOR, Data[0]) + 3 + FileIdentifierDesc->LengthOfFileIdentifier + FileIdentifierDesc->LengthOfImplementationUse) >> 2) << 2 ); } /** Duplicate a given File Identifier Descriptor. @param[in] FileIdentifierDesc File Identifier Descriptor pointer. @param[out] NewFileIdentifierDesc The duplicated File Identifier Descriptor. **/ VOID DuplicateFid ( IN UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc, OUT UDF_FILE_IDENTIFIER_DESCRIPTOR **NewFileIdentifierDesc ) { *NewFileIdentifierDesc = (UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool ( (UINTN) GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc); } /** Duplicate either a given File Entry or a given Extended File Entry. @param[in] BlockIo BlockIo interface. @param[in] Volume Volume information pointer. @param[in] FileEntry (Extended) File Entry pointer. @param[out] NewFileEntry The duplicated (Extended) File Entry. **/ VOID DuplicateFe ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN UDF_VOLUME_INFO *Volume, IN VOID *FileEntry, OUT VOID **NewFileEntry ) { *NewFileEntry = AllocateCopyPool (Volume->FileEntrySize, FileEntry); } /** Get raw data + length of a given File Entry or Extended File Entry. The file's recorded data can contain either real file content (inline) or a sequence of extents (or Allocation Descriptors) which tells where file's content is stored in. NOTE: The FE/EFE can be thought it was an inode. @attention This is boundary function that may receive untrusted input. @attention The input is from FileSystem. The (Extended) File Entry is external input, so this routine will do basic validation for (Extended) File Entry and report status. @param[in] FileEntryData (Extended) File Entry pointer. @param[in] FileEntrySize Size of the (Extended) File Entry specified by FileEntryData. @param[out] Data Buffer contains the raw data of a given (Extended) File Entry. @param[out] Length Length of the data in Buffer. @retval EFI_SUCCESS Raw data and size of the FE/EFE was read. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. **/ EFI_STATUS GetFileEntryData ( IN VOID *FileEntryData, IN UINTN FileEntrySize, OUT VOID **Data, OUT UINT64 *Length ) { UDF_DESCRIPTOR_TAG *DescriptorTag; UDF_EXTENDED_FILE_ENTRY *ExtendedFileEntry; UDF_FILE_ENTRY *FileEntry; DescriptorTag = FileEntryData; if (DescriptorTag->TagIdentifier == UdfExtendedFileEntry) { ExtendedFileEntry = (UDF_EXTENDED_FILE_ENTRY *)FileEntryData; *Length = ExtendedFileEntry->InformationLength; *Data = (VOID *)((UINT8 *)ExtendedFileEntry->Data + ExtendedFileEntry->LengthOfExtendedAttributes); } else if (DescriptorTag->TagIdentifier == UdfFileEntry) { FileEntry = (UDF_FILE_ENTRY *)FileEntryData; *Length = FileEntry->InformationLength; *Data = (VOID *)((UINT8 *)FileEntry->Data + FileEntry->LengthOfExtendedAttributes); } if ((*Length > FileEntrySize) || ((UINTN)FileEntryData > (UINTN)(*Data)) || ((UINTN)(*Data) - (UINTN)FileEntryData > FileEntrySize - *Length)) { return EFI_VOLUME_CORRUPTED; } return EFI_SUCCESS; } /** Get Allocation Descriptors' data information from a given FE/EFE. @attention This is boundary function that may receive untrusted input. @attention The input is from FileSystem. The (Extended) File Entry is external input, so this routine will do basic validation for (Extended) File Entry and report status. @param[in] FileEntryData (Extended) File Entry pointer. @param[in] FileEntrySize Size of the (Extended) File Entry specified by FileEntryData. @param[out] AdsData Buffer contains the Allocation Descriptors' data from a given FE/EFE. @param[out] Length Length of the data in AdsData. @retval EFI_SUCCESS The data and size of Allocation Descriptors were read from the FE/EFE. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. **/ EFI_STATUS GetAdsInformation ( IN VOID *FileEntryData, IN UINTN FileEntrySize, OUT VOID **AdsData, OUT UINT64 *Length ) { UDF_DESCRIPTOR_TAG *DescriptorTag; UDF_EXTENDED_FILE_ENTRY *ExtendedFileEntry; UDF_FILE_ENTRY *FileEntry; DescriptorTag = FileEntryData; if (DescriptorTag->TagIdentifier == UdfExtendedFileEntry) { ExtendedFileEntry = (UDF_EXTENDED_FILE_ENTRY *)FileEntryData; *Length = ExtendedFileEntry->LengthOfAllocationDescriptors; *AdsData = (VOID *)((UINT8 *)ExtendedFileEntry->Data + ExtendedFileEntry->LengthOfExtendedAttributes); } else if (DescriptorTag->TagIdentifier == UdfFileEntry) { FileEntry = (UDF_FILE_ENTRY *)FileEntryData; *Length = FileEntry->LengthOfAllocationDescriptors; *AdsData = (VOID *)((UINT8 *)FileEntry->Data + FileEntry->LengthOfExtendedAttributes); } if ((*Length > FileEntrySize) || ((UINTN)FileEntryData > (UINTN)(*AdsData)) || ((UINTN)(*AdsData) - (UINTN)FileEntryData > FileEntrySize - *Length)) { return EFI_VOLUME_CORRUPTED; } return EFI_SUCCESS; } /** Read next Long Allocation Descriptor from a given file's data. @param[in] Data File's data pointer. @param[in,out] Offset Starting offset of the File's data to read. @param[in] Length Length of the data to read. @param[out] FoundLongAd Long Allocation Descriptor pointer. @retval EFI_SUCCESS A Long Allocation Descriptor was found. @retval EFI_DEVICE_ERROR No more Long Allocation Descriptors. **/ EFI_STATUS GetLongAdFromAds ( IN VOID *Data, IN OUT UINT64 *Offset, IN UINT64 Length, OUT UDF_LONG_ALLOCATION_DESCRIPTOR **FoundLongAd ) { UDF_LONG_ALLOCATION_DESCRIPTOR *LongAd; UDF_EXTENT_FLAGS ExtentFlags; for (;;) { if (*Offset >= Length) { // // No more Long Allocation Descriptors. // return EFI_DEVICE_ERROR; } LongAd = (UDF_LONG_ALLOCATION_DESCRIPTOR *)((UINT8 *)Data + *Offset); // // If it's either an indirect AD (Extended Alllocation Descriptor) or an // allocated AD, then return it. // ExtentFlags = GET_EXTENT_FLAGS (LongAdsSequence, LongAd); if (ExtentFlags == ExtentIsNextExtent || ExtentFlags == ExtentRecordedAndAllocated) { break; } // // This AD is either not recorded but allocated, or not recorded and not // allocated. Skip it. // *Offset += AD_LENGTH (LongAdsSequence); } *FoundLongAd = LongAd; return EFI_SUCCESS; } /** Read next Short Allocation Descriptor from a given file's data. @param[in] Data File's data pointer. @param[in,out] Offset Starting offset of the File's data to read. @param[in] Length Length of the data to read. @param[out] FoundShortAd Short Allocation Descriptor pointer. @retval EFI_SUCCESS A Short Allocation Descriptor was found. @retval EFI_DEVICE_ERROR No more Short Allocation Descriptors. **/ EFI_STATUS GetShortAdFromAds ( IN VOID *Data, IN OUT UINT64 *Offset, IN UINT64 Length, OUT UDF_SHORT_ALLOCATION_DESCRIPTOR **FoundShortAd ) { UDF_SHORT_ALLOCATION_DESCRIPTOR *ShortAd; UDF_EXTENT_FLAGS ExtentFlags; for (;;) { if (*Offset >= Length) { // // No more Short Allocation Descriptors. // return EFI_DEVICE_ERROR; } ShortAd = (UDF_SHORT_ALLOCATION_DESCRIPTOR *)((UINT8 *)Data + *Offset); // // If it's either an indirect AD (Extended Alllocation Descriptor) or an // allocated AD, then return it. // ExtentFlags = GET_EXTENT_FLAGS (ShortAdsSequence, ShortAd); if (ExtentFlags == ExtentIsNextExtent || ExtentFlags == ExtentRecordedAndAllocated) { break; } // // This AD is either not recorded but allocated, or not recorded and not // allocated. Skip it. // *Offset += AD_LENGTH (ShortAdsSequence); } *FoundShortAd = ShortAd; return EFI_SUCCESS; } /** Get either a Short Allocation Descriptor or a Long Allocation Descriptor from file's data. @param[in] RecordingFlags Flag to indicate the type of descriptor. @param[in] Data File's data pointer. @param[in,out] Offset Starting offset of the File's data to read. @param[in] Length Length of the data to read. @param[out] FoundAd Allocation Descriptor pointer. @retval EFI_SUCCESS A Short Allocation Descriptor was found. @retval EFI_DEVICE_ERROR No more Allocation Descriptors. Invalid type of descriptor was given. **/ EFI_STATUS GetAllocationDescriptor ( IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Data, IN OUT UINT64 *Offset, IN UINT64 Length, OUT VOID **FoundAd ) { if (RecordingFlags == LongAdsSequence) { return GetLongAdFromAds ( Data, Offset, Length, (UDF_LONG_ALLOCATION_DESCRIPTOR **)FoundAd ); } else if (RecordingFlags == ShortAdsSequence) { return GetShortAdFromAds ( Data, Offset, Length, (UDF_SHORT_ALLOCATION_DESCRIPTOR **)FoundAd ); } // // Code should never reach here. // ASSERT (FALSE); return EFI_DEVICE_ERROR; } /** Return logical sector number of either Short or Long Allocation Descriptor. @param[in] RecordingFlags Flag to indicate the type of descriptor. @param[in] Volume Volume information pointer. @param[in] ParentIcb Long Allocation Descriptor pointer. @param[in] Ad Allocation Descriptor pointer. @param[out] Lsn Logical sector number pointer. @retval EFI_SUCCESS Logical sector number of the given Allocation Descriptor successfully returned. @retval EFI_UNSUPPORTED Logical sector number of the given Allocation Descriptor is not returned due to unrecognized format. **/ EFI_STATUS GetAllocationDescriptorLsn ( IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb, IN VOID *Ad, OUT UINT64 *Lsn ) { UDF_PARTITION_DESCRIPTOR *PartitionDesc; if (RecordingFlags == LongAdsSequence) { return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad, Lsn); } else if (RecordingFlags == ShortAdsSequence) { PartitionDesc = GetPdFromLongAd (Volume, ParentIcb); if (PartitionDesc == NULL) { return EFI_UNSUPPORTED; } *Lsn = GetShortAdLsn ( Volume, PartitionDesc, (UDF_SHORT_ALLOCATION_DESCRIPTOR *)Ad ); return EFI_SUCCESS; } // // Code should never reach here. // ASSERT (FALSE); return EFI_UNSUPPORTED; } /** Return offset + length of a given indirect Allocation Descriptor (AED). @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume Volume information pointer. @param[in] ParentIcb Long Allocation Descriptor pointer. @param[in] RecordingFlags Flag to indicate the type of descriptor. @param[in] Ad Allocation Descriptor pointer. @param[out] Offset Offset of a given indirect Allocation Descriptor. @param[out] Length Length of a given indirect Allocation Descriptor. @retval EFI_SUCCESS The offset and length were returned. @retval EFI_OUT_OF_RESOURCES The offset and length were not returned due to lack of resources. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval other The offset and length were not returned. **/ EFI_STATUS GetAedAdsOffset ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb, IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Ad, OUT UINT64 *Offset, OUT UINT64 *Length ) { EFI_STATUS Status; UINT32 ExtentLength; UINT64 Lsn; VOID *Data; UINT32 LogicalBlockSize; UDF_ALLOCATION_EXTENT_DESCRIPTOR *AllocExtDesc; UDF_DESCRIPTOR_TAG *DescriptorTag; ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad); Status = GetAllocationDescriptorLsn (RecordingFlags, Volume, ParentIcb, Ad, &Lsn); if (EFI_ERROR (Status)) { return Status; } Data = AllocatePool (ExtentLength); if (Data == NULL) { return EFI_OUT_OF_RESOURCES; } LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize; // // Read extent. // Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, MultU64x32 (Lsn, LogicalBlockSize), ExtentLength, Data ); if (EFI_ERROR (Status)) { goto Exit; } AllocExtDesc = (UDF_ALLOCATION_EXTENT_DESCRIPTOR *)Data; DescriptorTag = &AllocExtDesc->DescriptorTag; // // Check if read extent contains a valid tag identifier for AED. // if (DescriptorTag->TagIdentifier != UdfAllocationExtentDescriptor) { Status = EFI_VOLUME_CORRUPTED; goto Exit; } // // Get AED's block offset and its length. // *Offset = MultU64x32 (Lsn, LogicalBlockSize) + sizeof (UDF_ALLOCATION_EXTENT_DESCRIPTOR); *Length = AllocExtDesc->LengthOfAllocationDescriptors; Exit: FreePool (Data); return Status; } /** Read Allocation Extent Descriptor into memory. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume Volume information pointer. @param[in] ParentIcb Long Allocation Descriptor pointer. @param[in] RecordingFlags Flag to indicate the type of descriptor. @param[in] Ad Allocation Descriptor pointer. @param[out] Data Buffer that contains the Allocation Extent Descriptor. @param[out] Length Length of Data. @retval EFI_SUCCESS The Allocation Extent Descriptor was read. @retval EFI_OUT_OF_RESOURCES The Allocation Extent Descriptor was not read due to lack of resources. @retval other Fail to read the disk. **/ EFI_STATUS GetAedAdsData ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb, IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Ad, OUT VOID **Data, OUT UINT64 *Length ) { EFI_STATUS Status; UINT64 Offset; // // Get AED's offset + length. // Status = GetAedAdsOffset ( BlockIo, DiskIo, Volume, ParentIcb, RecordingFlags, Ad, &Offset, Length ); if (EFI_ERROR (Status)) { return Status; } // // Allocate buffer to read in AED's data. // *Data = AllocatePool ((UINTN) (*Length)); if (*Data == NULL) { return EFI_OUT_OF_RESOURCES; } return DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, Offset, (UINTN) (*Length), *Data ); } /** Function used to serialise reads of Allocation Descriptors. @param[in] RecordingFlags Flag to indicate the type of descriptor. @param[in] Ad Allocation Descriptor pointer. @param[in, out] Buffer Buffer to hold the next Allocation Descriptor. @param[in] Length Length of Buffer. @retval EFI_SUCCESS Buffer was grown to hold the next Allocation Descriptor. @retval EFI_OUT_OF_RESOURCES Buffer was not grown due to lack of resources. **/ EFI_STATUS GrowUpBufferToNextAd ( IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN VOID *Ad, IN OUT VOID **Buffer, IN UINT64 Length ) { UINT32 ExtentLength; ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad); if (*Buffer == NULL) { *Buffer = AllocatePool (ExtentLength); if (*Buffer == NULL) { return EFI_OUT_OF_RESOURCES; } } else { *Buffer = ReallocatePool ((UINTN) Length, (UINTN) (Length + ExtentLength), *Buffer); if (*Buffer == NULL) { return EFI_OUT_OF_RESOURCES; } } return EFI_SUCCESS; } /** Read data or size of either a File Entry or an Extended File Entry. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume Volume information pointer. @param[in] ParentIcb Long Allocation Descriptor pointer. @param[in] FileEntryData FE/EFE structure pointer. @param[in, out] ReadFileInfo Read file information pointer. @retval EFI_SUCCESS Data or size of a FE/EFE was read. @retval EFI_OUT_OF_RESOURCES Data or size of a FE/EFE was not read due to lack of resources. @retval EFI_INVALID_PARAMETER The read file flag given in ReadFileInfo is invalid. @retval EFI_UNSUPPORTED The FE recording flag given in FileEntryData is not supported. @retval other Data or size of a FE/EFE was not read. **/ EFI_STATUS ReadFile ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb, IN VOID *FileEntryData, IN OUT UDF_READ_FILE_INFO *ReadFileInfo ) { EFI_STATUS Status; UINT32 LogicalBlockSize; VOID *Data; VOID *DataBak; UINT64 Length; VOID *Ad; UINT64 AdOffset; UINT64 Lsn; BOOLEAN DoFreeAed; UINT64 FilePosition; UINT64 Offset; UINT64 DataOffset; UINT64 BytesLeft; UINT64 DataLength; BOOLEAN FinishedSeeking; UINT32 ExtentLength; UDF_FE_RECORDING_FLAGS RecordingFlags; LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize; DoFreeAed = FALSE; // // set BytesLeft to suppress incorrect compiler/analyzer warnings // BytesLeft = 0; DataOffset = 0; FilePosition = 0; FinishedSeeking = FALSE; Data = NULL; switch (ReadFileInfo->Flags) { case ReadFileGetFileSize: case ReadFileAllocateAndRead: // // Initialise ReadFileInfo structure for either getting file size, or // reading file's recorded data. // ReadFileInfo->ReadLength = 0; ReadFileInfo->FileData = NULL; break; case ReadFileSeekAndRead: // // About to seek a file and/or read its data. // Length = ReadFileInfo->FileSize - ReadFileInfo->FilePosition; if (ReadFileInfo->FileDataSize > Length) { // // About to read beyond the EOF -- truncate it. // ReadFileInfo->FileDataSize = Length; } // // Initialise data to start seeking and/or reading a file. // BytesLeft = ReadFileInfo->FileDataSize; DataOffset = 0; FilePosition = 0; FinishedSeeking = FALSE; break; } RecordingFlags = GET_FE_RECORDING_FLAGS (FileEntryData); switch (RecordingFlags) { case InlineData: // // There are no extents for this FE/EFE. All data is inline. // Status = GetFileEntryData (FileEntryData, Volume->FileEntrySize, &Data, &Length); if (EFI_ERROR (Status)) { return Status; } if (ReadFileInfo->Flags == ReadFileGetFileSize) { ReadFileInfo->ReadLength = Length; } else if (ReadFileInfo->Flags == ReadFileAllocateAndRead) { // // Allocate buffer for starting read data. // ReadFileInfo->FileData = AllocatePool ((UINTN) Length); if (ReadFileInfo->FileData == NULL) { return EFI_OUT_OF_RESOURCES; } // // Read all inline data into ReadFileInfo->FileData // CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length); ReadFileInfo->ReadLength = Length; } else if (ReadFileInfo->Flags == ReadFileSeekAndRead) { // // If FilePosition is non-zero, seek file to FilePosition, read // FileDataSize bytes and then updates FilePosition. // CopyMem ( ReadFileInfo->FileData, (VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition), (UINTN) ReadFileInfo->FileDataSize ); ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize; } else { ASSERT (FALSE); return EFI_INVALID_PARAMETER; } Status = EFI_SUCCESS; break; case LongAdsSequence: case ShortAdsSequence: // // This FE/EFE contains a run of Allocation Descriptors. Get data + size // for start reading them out. // Status = GetAdsInformation (FileEntryData, Volume->FileEntrySize, &Data, &Length); if (EFI_ERROR (Status)) { return Status; } AdOffset = 0; for (;;) { // // Read AD. // Status = GetAllocationDescriptor ( RecordingFlags, Data, &AdOffset, Length, &Ad ); if (Status == EFI_DEVICE_ERROR) { Status = EFI_SUCCESS; goto Done; } // // Check if AD is an indirect AD. If so, read Allocation Extent // Descriptor and its extents (ADs). // if (GET_EXTENT_FLAGS (RecordingFlags, Ad) == ExtentIsNextExtent) { DataBak = Data; Status = GetAedAdsData ( BlockIo, DiskIo, Volume, ParentIcb, RecordingFlags, Ad, &Data, &Length ); if (!DoFreeAed) { DoFreeAed = TRUE; } else { FreePool (DataBak); } if (EFI_ERROR (Status)) { goto Error_Get_Aed; } ASSERT (Data != NULL); AdOffset = 0; continue; } ExtentLength = GET_EXTENT_LENGTH (RecordingFlags, Ad); Status = GetAllocationDescriptorLsn (RecordingFlags, Volume, ParentIcb, Ad, &Lsn); if (EFI_ERROR (Status)) { goto Done; } switch (ReadFileInfo->Flags) { case ReadFileGetFileSize: ReadFileInfo->ReadLength += ExtentLength; break; case ReadFileAllocateAndRead: // // Increase FileData (if necessary) to read next extent. // Status = GrowUpBufferToNextAd ( RecordingFlags, Ad, &ReadFileInfo->FileData, ReadFileInfo->ReadLength ); if (EFI_ERROR (Status)) { goto Error_Alloc_Buffer_To_Next_Ad; } // // Read extent's data into FileData. // Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, MultU64x32 (Lsn, LogicalBlockSize), ExtentLength, (VOID *)((UINT8 *)ReadFileInfo->FileData + ReadFileInfo->ReadLength) ); if (EFI_ERROR (Status)) { goto Error_Read_Disk_Blk; } ReadFileInfo->ReadLength += ExtentLength; break; case ReadFileSeekAndRead: // // Seek file first before reading in its data. // if (FinishedSeeking) { Offset = 0; goto Skip_File_Seek; } if (FilePosition + ExtentLength < ReadFileInfo->FilePosition) { FilePosition += ExtentLength; goto Skip_Ad; } if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) { Offset = ReadFileInfo->FilePosition - FilePosition; } else { Offset = 0; } // // Done with seeking file. Start reading its data. // FinishedSeeking = TRUE; Skip_File_Seek: // // Make sure we don't read more data than really wanted. // if (ExtentLength - Offset > BytesLeft) { DataLength = BytesLeft; } else { DataLength = ExtentLength - Offset; } // // Read extent's data into FileData. // Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, Offset + MultU64x32 (Lsn, LogicalBlockSize), (UINTN) DataLength, (VOID *)((UINT8 *)ReadFileInfo->FileData + DataOffset) ); if (EFI_ERROR (Status)) { goto Error_Read_Disk_Blk; } // // Update current file's position. // DataOffset += DataLength; ReadFileInfo->FilePosition += DataLength; BytesLeft -= DataLength; if (BytesLeft == 0) { // // There is no more file data to read. // Status = EFI_SUCCESS; goto Done; } break; } Skip_Ad: // // Point to the next AD (extent). // AdOffset += AD_LENGTH (RecordingFlags); } break; case ExtendedAdsSequence: // FIXME: Not supported. Got no volume with it, yet. ASSERT (FALSE); Status = EFI_UNSUPPORTED; break; default: // // A flag value reserved by the ECMA-167 standard (3rd Edition - June // 1997); 14.6 ICB Tag; 14.6.8 Flags (RBP 18); was found. // Status = EFI_UNSUPPORTED; break; } Done: if (DoFreeAed) { FreePool (Data); } return Status; Error_Read_Disk_Blk: Error_Alloc_Buffer_To_Next_Ad: if (ReadFileInfo->Flags != ReadFileSeekAndRead) { FreePool (ReadFileInfo->FileData); } if (DoFreeAed) { FreePool (Data); } Error_Get_Aed: return Status; } /** Find a file by its filename from a given Parent file. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume Volume information pointer. @param[in] FileName File name string. @param[in] Parent Parent directory file. @param[in] Icb Long Allocation Descriptor pointer. @param[out] File Found file. @retval EFI_SUCCESS The file was found. @retval EFI_INVALID_PARAMETER One or more input parameters are invalid. @retval EFI_NOT_FOUND The file was not found. **/ EFI_STATUS InternalFindFile ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN CHAR16 *FileName, IN UDF_FILE_INFO *Parent, IN UDF_LONG_ALLOCATION_DESCRIPTOR *Icb, OUT UDF_FILE_INFO *File ) { EFI_STATUS Status; UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc; UDF_READ_DIRECTORY_INFO ReadDirInfo; BOOLEAN Found; CHAR16 FoundFileName[UDF_FILENAME_LENGTH]; VOID *CompareFileEntry; // // Check if both Parent->FileIdentifierDesc and Icb are NULL. // if ((Parent->FileIdentifierDesc == NULL) && (Icb == NULL)) { return EFI_INVALID_PARAMETER; } // // Check if parent file is really directory. // if (FE_ICB_FILE_TYPE (Parent->FileEntry) != UdfFileEntryDirectory) { return EFI_NOT_FOUND; } // // If FileName is current file or working directory, just duplicate Parent's // FE/EFE and FID descriptors. // if (StrCmp (FileName, L".") == 0) { if (Parent->FileIdentifierDesc == NULL) { return EFI_INVALID_PARAMETER; } DuplicateFe (BlockIo, Volume, Parent->FileEntry, &File->FileEntry); if (File->FileEntry == NULL) { return EFI_OUT_OF_RESOURCES; } DuplicateFid (Parent->FileIdentifierDesc, &File->FileIdentifierDesc); if (File->FileIdentifierDesc == NULL) { FreePool (File->FileEntry); return EFI_OUT_OF_RESOURCES; } return EFI_SUCCESS; } // // Start directory listing. // ZeroMem ((VOID *)&ReadDirInfo, sizeof (UDF_READ_DIRECTORY_INFO)); Found = FALSE; for (;;) { Status = ReadDirectoryEntry ( BlockIo, DiskIo, Volume, (Parent->FileIdentifierDesc != NULL) ? &Parent->FileIdentifierDesc->Icb : Icb, Parent->FileEntry, &ReadDirInfo, &FileIdentifierDesc ); if (EFI_ERROR (Status)) { if (Status == EFI_DEVICE_ERROR) { Status = EFI_NOT_FOUND; } break; } // // After calling function ReadDirectoryEntry(), if 'FileIdentifierDesc' is // NULL, then the 'Status' must be EFI_OUT_OF_RESOURCES. Hence, if the code // reaches here, 'FileIdentifierDesc' must be not NULL. // // The ASSERT here is for addressing a false positive NULL pointer // dereference issue raised from static analysis. // ASSERT (FileIdentifierDesc != NULL); if (FileIdentifierDesc->FileCharacteristics & PARENT_FILE) { // // This FID contains the location (FE/EFE) of the parent directory of this // directory (Parent), and if FileName is either ".." or "\\", then it's // the expected FID. // if (StrCmp (FileName, L"..") == 0 || StrCmp (FileName, L"\\") == 0) { Found = TRUE; break; } } else { Status = GetFileNameFromFid (FileIdentifierDesc, ARRAY_SIZE (FoundFileName), FoundFileName); if (EFI_ERROR (Status)) { break; } if (StrCmp (FileName, FoundFileName) == 0) { // // FID has been found. Prepare to find its respective FE/EFE. // Found = TRUE; break; } } FreePool ((VOID *)FileIdentifierDesc); } if (ReadDirInfo.DirectoryData != NULL) { // // Free all allocated resources for the directory listing. // FreePool (ReadDirInfo.DirectoryData); } if (Found) { Status = EFI_SUCCESS; File->FileIdentifierDesc = FileIdentifierDesc; // // If the requested file is root directory, then the FE/EFE was already // retrieved in UdfOpenVolume() function, thus no need to find it again. // // Otherwise, find FE/EFE from the respective FID. // if (StrCmp (FileName, L"\\") != 0) { Status = FindFileEntry ( BlockIo, DiskIo, Volume, &FileIdentifierDesc->Icb, &CompareFileEntry ); if (EFI_ERROR (Status)) { goto Error_Find_Fe; } // // Make sure that both Parent's FE/EFE and found FE/EFE are not equal. // if (CompareMem ((VOID *)Parent->FileEntry, (VOID *)CompareFileEntry, Volume->FileEntrySize) != 0) { File->FileEntry = CompareFileEntry; } else { FreePool ((VOID *)FileIdentifierDesc); FreePool ((VOID *)CompareFileEntry); Status = EFI_NOT_FOUND; } } } return Status; Error_Find_Fe: FreePool ((VOID *)FileIdentifierDesc); return Status; } /** Read volume information on a medium which contains a valid UDF file system. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[out] Volume UDF volume information structure. @retval EFI_SUCCESS Volume information read. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The volume was not read due to lack of resources. **/ EFI_STATUS ReadUdfVolumeInformation ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, OUT UDF_VOLUME_INFO *Volume ) { EFI_STATUS Status; // // Read all necessary UDF volume information and keep it private to the driver // Status = ReadVolumeFileStructure ( BlockIo, DiskIo, Volume ); if (EFI_ERROR (Status)) { return Status; } // // Find File Set Descriptor // Status = FindFileSetDescriptor (BlockIo, DiskIo, Volume); if (EFI_ERROR (Status)) { return Status; } return Status; } /** Find the root directory on an UDF volume. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[out] File Root directory file. @retval EFI_SUCCESS Root directory found. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The root directory was not found due to lack of resources. **/ EFI_STATUS FindRootDirectory ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, OUT UDF_FILE_INFO *File ) { EFI_STATUS Status; UDF_FILE_INFO Parent; Status = FindFileEntry ( BlockIo, DiskIo, Volume, &Volume->FileSetDesc.RootDirectoryIcb, &File->FileEntry ); if (EFI_ERROR (Status)) { return Status; } Parent.FileEntry = File->FileEntry; Parent.FileIdentifierDesc = NULL; Status = FindFile ( BlockIo, DiskIo, Volume, L"\\", NULL, &Parent, &Volume->FileSetDesc.RootDirectoryIcb, File ); if (EFI_ERROR (Status)) { FreePool (File->FileEntry); } return Status; } /** Find either a File Entry or a Extended File Entry from a given ICB. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[in] Icb ICB of the FID. @param[out] FileEntry File Entry or Extended File Entry. @retval EFI_SUCCESS File Entry or Extended File Entry found. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The FE/EFE entry was not found due to lack of resources. **/ EFI_STATUS FindFileEntry ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *Icb, OUT VOID **FileEntry ) { EFI_STATUS Status; UINT64 Lsn; UINT32 LogicalBlockSize; UDF_DESCRIPTOR_TAG *DescriptorTag; VOID *ReadBuffer; Status = GetLongAdLsn (Volume, Icb, &Lsn); if (EFI_ERROR (Status)) { return Status; } LogicalBlockSize = Volume->LogicalVolDesc.LogicalBlockSize; ReadBuffer = AllocateZeroPool (Volume->FileEntrySize); if (ReadBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } // // Read extent. // Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, MultU64x32 (Lsn, LogicalBlockSize), Volume->FileEntrySize, ReadBuffer ); if (EFI_ERROR (Status)) { goto Error_Read_Disk_Blk; } DescriptorTag = ReadBuffer; // // Check if the read extent contains a valid Tag Identifier for the expected // FE/EFE. // if (DescriptorTag->TagIdentifier != UdfFileEntry && DescriptorTag->TagIdentifier != UdfExtendedFileEntry) { Status = EFI_VOLUME_CORRUPTED; goto Error_Invalid_Fe; } *FileEntry = ReadBuffer; return EFI_SUCCESS; Error_Invalid_Fe: Error_Read_Disk_Blk: FreePool (ReadBuffer); return Status; } /** Find a file given its absolute path on an UDF volume. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[in] FilePath File's absolute path. @param[in] Root Root directory file. @param[in] Parent Parent directory file. @param[in] Icb ICB of Parent. @param[out] File Found file. @retval EFI_SUCCESS FilePath was found. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The FilePath file was not found due to lack of resources. **/ EFI_STATUS FindFile ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN CHAR16 *FilePath, IN UDF_FILE_INFO *Root, IN UDF_FILE_INFO *Parent, IN UDF_LONG_ALLOCATION_DESCRIPTOR *Icb, OUT UDF_FILE_INFO *File ) { EFI_STATUS Status; CHAR16 FileName[UDF_FILENAME_LENGTH]; CHAR16 *FileNamePointer; UDF_FILE_INFO PreviousFile; VOID *FileEntry; Status = EFI_NOT_FOUND; CopyMem ((VOID *)&PreviousFile, (VOID *)Parent, sizeof (UDF_FILE_INFO)); while (*FilePath != L'\0') { FileNamePointer = FileName; while (*FilePath != L'\0' && *FilePath != L'\\') { if ((((UINTN)FileNamePointer - (UINTN)FileName) / sizeof (CHAR16)) >= (ARRAY_SIZE (FileName) - 1)) { return EFI_NOT_FOUND; } *FileNamePointer++ = *FilePath++; } *FileNamePointer = L'\0'; if (FileName[0] == L'\0') { // // Open root directory. // if (Root == NULL) { // // There is no file found for the root directory yet. So, find only its // FID by now. // // See UdfOpenVolume() function. // Status = InternalFindFile (BlockIo, DiskIo, Volume, L"\\", &PreviousFile, Icb, File); } else { // // We've already a file pointer (Root) for the root directory. Duplicate // its FE/EFE and FID descriptors. // Status = EFI_SUCCESS; DuplicateFe (BlockIo, Volume, Root->FileEntry, &File->FileEntry); if (File->FileEntry == NULL) { Status = EFI_OUT_OF_RESOURCES; } else { // // File->FileEntry is not NULL. // DuplicateFid (Root->FileIdentifierDesc, &File->FileIdentifierDesc); if (File->FileIdentifierDesc == NULL) { FreePool (File->FileEntry); Status = EFI_OUT_OF_RESOURCES; } } } } else { // // No root directory. Find filename from the current directory. // Status = InternalFindFile (BlockIo, DiskIo, Volume, FileName, &PreviousFile, Icb, File); } if (EFI_ERROR (Status)) { return Status; } // // If the found file is a symlink, then find its respective FE/EFE and // FID descriptors. // if (FE_ICB_FILE_TYPE (File->FileEntry) == UdfFileEntrySymlink) { FreePool ((VOID *)File->FileIdentifierDesc); FileEntry = File->FileEntry; Status = ResolveSymlink (BlockIo, DiskIo, Volume, &PreviousFile, FileEntry, File); FreePool (FileEntry); if (EFI_ERROR (Status)) { return Status; } } if (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent, sizeof (UDF_FILE_INFO)) != 0) { CleanupFileInformation (&PreviousFile); } CopyMem ((VOID *)&PreviousFile, (VOID *)File, sizeof (UDF_FILE_INFO)); if (*FilePath != L'\0' && *FilePath == L'\\') { FilePath++; } } return Status; } /** Read a directory entry at a time on an UDF volume. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[in] ParentIcb ICB of the parent file. @param[in] FileEntryData FE/EFE of the parent file. @param[in, out] ReadDirInfo Next read directory listing structure information. @param[out] FoundFid File Identifier Descriptor pointer. @retval EFI_SUCCESS Directory entry read. @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The directory entry was not read due to lack of resources. **/ EFI_STATUS ReadDirectoryEntry ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb, IN VOID *FileEntryData, IN OUT UDF_READ_DIRECTORY_INFO *ReadDirInfo, OUT UDF_FILE_IDENTIFIER_DESCRIPTOR **FoundFid ) { EFI_STATUS Status; UDF_READ_FILE_INFO ReadFileInfo; UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc; if (ReadDirInfo->DirectoryData == NULL) { // // The directory's recorded data has not been read yet. So let's cache it // into memory and the next calls won't need to read it again. // ReadFileInfo.Flags = ReadFileAllocateAndRead; Status = ReadFile ( BlockIo, DiskIo, Volume, ParentIcb, FileEntryData, &ReadFileInfo ); if (EFI_ERROR (Status)) { return Status; } // // Fill in ReadDirInfo structure with the read directory's data information. // ReadDirInfo->DirectoryData = ReadFileInfo.FileData; ReadDirInfo->DirectoryLength = ReadFileInfo.ReadLength; } do { if (ReadDirInfo->FidOffset >= ReadDirInfo->DirectoryLength) { // // There are no longer FIDs for this directory. By returning // EFI_DEVICE_ERROR to the callee will indicate end of directory // listening. // return EFI_DEVICE_ERROR; } // // Get FID for this entry. // FileIdentifierDesc = GET_FID_FROM_ADS (ReadDirInfo->DirectoryData, ReadDirInfo->FidOffset); // // Update FidOffset to point to next FID. // ReadDirInfo->FidOffset += GetFidDescriptorLength (FileIdentifierDesc); } while (FileIdentifierDesc->FileCharacteristics & DELETED_FILE); DuplicateFid (FileIdentifierDesc, FoundFid); if (*FoundFid == NULL) { return EFI_OUT_OF_RESOURCES; } return EFI_SUCCESS; } /** Get a filename (encoded in OSTA-compressed format) from a File Identifier Descriptor on an UDF volume. @attention This is boundary function that may receive untrusted input. @attention The input is from FileSystem. The File Identifier Descriptor is external input, so this routine will do basic validation for File Identifier Descriptor and report status. @param[in] FileIdentifierDesc File Identifier Descriptor pointer. @param[in] CharMax The maximum number of FileName Unicode char, including terminating null char. @param[out] FileName Decoded filename. @retval EFI_SUCCESS Filename decoded and read. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_BUFFER_TOO_SMALL The string buffer FileName cannot hold the decoded filename. **/ EFI_STATUS GetFileNameFromFid ( IN UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc, IN UINTN CharMax, OUT CHAR16 *FileName ) { UINT8 *OstaCompressed; UINT8 CompressionId; UINT8 Length; UINTN Index; CHAR16 *FileNameBak; if (CharMax == 0) { return EFI_BUFFER_TOO_SMALL; } OstaCompressed = (UINT8 *)( (UINT8 *)FileIdentifierDesc->Data + FileIdentifierDesc->LengthOfImplementationUse ); CompressionId = OstaCompressed[0]; if (!IS_VALID_COMPRESSION_ID (CompressionId)) { return EFI_VOLUME_CORRUPTED; } FileNameBak = FileName; // // Decode filename. // Length = FileIdentifierDesc->LengthOfFileIdentifier; if (CompressionId == 16) { if (((UINTN)Length >> 1) > CharMax) { return EFI_BUFFER_TOO_SMALL; } } else { if ((Length != 0) && ((UINTN)Length - 1 > CharMax)) { return EFI_BUFFER_TOO_SMALL; } } for (Index = 1; Index < Length; Index++) { if (CompressionId == 16) { *FileName = OstaCompressed[Index++] << 8; } else { *FileName = 0; } if (Index < Length) { *FileName |= (CHAR16)(OstaCompressed[Index]); } FileName++; } Index = ((UINTN)FileName - (UINTN)FileNameBak) / sizeof (CHAR16); if (Index > CharMax - 1) { Index = CharMax - 1; } FileNameBak[Index] = L'\0'; return EFI_SUCCESS; } /** Resolve a symlink file on an UDF volume. @attention This is boundary function that may receive untrusted input. @attention The input is from FileSystem. The Path Component is external input, so this routine will do basic validation for Path Component and report status. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[in] Parent Parent file. @param[in] FileEntryData FE/EFE structure pointer. @param[out] File Resolved file. @retval EFI_SUCCESS Symlink file resolved. @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The symlink file was not resolved due to lack of resources. **/ EFI_STATUS ResolveSymlink ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_FILE_INFO *Parent, IN VOID *FileEntryData, OUT UDF_FILE_INFO *File ) { EFI_STATUS Status; UDF_READ_FILE_INFO ReadFileInfo; UINT8 *Data; UINT64 Length; UINT8 *EndData; UDF_PATH_COMPONENT *PathComp; UINT8 PathCompLength; CHAR16 FileName[UDF_FILENAME_LENGTH]; CHAR16 *Char; UINTN Index; UINT8 CompressionId; UDF_FILE_INFO PreviousFile; BOOLEAN NotParent; BOOLEAN NotFile; ZeroMem ((VOID *)File, sizeof (UDF_FILE_INFO)); // // Symlink files on UDF volumes do not contain so much data other than // Path Components which resolves to real filenames, so it's OK to read in // all its data here -- usually the data will be inline with the FE/EFE for // lower filenames. // ReadFileInfo.Flags = ReadFileAllocateAndRead; Status = ReadFile ( BlockIo, DiskIo, Volume, &Parent->FileIdentifierDesc->Icb, FileEntryData, &ReadFileInfo ); if (EFI_ERROR (Status)) { return Status; } Length = ReadFileInfo.ReadLength; Data = (UINT8 *)ReadFileInfo.FileData; EndData = Data + Length; CopyMem ((VOID *)&PreviousFile, (VOID *)Parent, sizeof (UDF_FILE_INFO)); for (;;) { PathComp = (UDF_PATH_COMPONENT *)Data; PathCompLength = PathComp->LengthOfComponentIdentifier; switch (PathComp->ComponentType) { case 1: // // This Path Component specifies the root directory hierarchy subject to // agreement between the originator and recipient of the medium. Skip it. // // Fall through. // case 2: // // "\\." of the current directory. Read next Path Component. // goto Next_Path_Component; case 3: // // ".." (parent directory). Go to it. // CopyMem ((VOID *)FileName, L"..", 6); break; case 4: // // "." (current file). Duplicate both FE/EFE and FID of this file. // DuplicateFe (BlockIo, Volume, PreviousFile.FileEntry, &File->FileEntry); if (File->FileEntry == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Error_Find_File; } DuplicateFid (PreviousFile.FileIdentifierDesc, &File->FileIdentifierDesc); if (File->FileIdentifierDesc == NULL) { FreePool (File->FileEntry); Status = EFI_OUT_OF_RESOURCES; goto Error_Find_File; } goto Next_Path_Component; case 5: // // This Path Component identifies an object, either a file or a // directory or an alias. // // Decode it from the compressed data in ComponentIdentifier and find // respective path. // CompressionId = PathComp->ComponentIdentifier[0]; if (!IS_VALID_COMPRESSION_ID (CompressionId)) { return EFI_VOLUME_CORRUPTED; } if ((UINTN)PathComp->ComponentIdentifier + PathCompLength > (UINTN)EndData) { return EFI_VOLUME_CORRUPTED; } Char = FileName; for (Index = 1; Index < PathCompLength; Index++) { if (CompressionId == 16) { *Char = *(UINT8 *)((UINT8 *)PathComp->ComponentIdentifier + Index) << 8; Index++; } else { if (Index > ARRAY_SIZE (FileName)) { return EFI_UNSUPPORTED; } *Char = 0; } if (Index < Length) { *Char |= (CHAR16)(*(UINT8 *)((UINT8 *)PathComp->ComponentIdentifier + Index)); } Char++; } Index = ((UINTN)Char - (UINTN)FileName) / sizeof (CHAR16); if (Index > ARRAY_SIZE (FileName) - 1) { Index = ARRAY_SIZE (FileName) - 1; } FileName[Index] = L'\0'; break; default: // // According to the ECMA-167 standard (3rd Edition - June 1997), Section // 14.16.1.1, all other values are reserved. // Status = EFI_VOLUME_CORRUPTED; goto Error_Find_File; } // // Find file from the read filename in symlink's file data. // Status = InternalFindFile ( BlockIo, DiskIo, Volume, FileName, &PreviousFile, NULL, File ); if (EFI_ERROR (Status)) { goto Error_Find_File; } Next_Path_Component: Data += sizeof (UDF_PATH_COMPONENT) + PathCompLength; if (Data >= EndData) { break; } // // Check the content in the file info pointed by File. // if ((File->FileEntry == NULL) || (File->FileIdentifierDesc == NULL)) { Status = EFI_VOLUME_CORRUPTED; goto Error_Find_File; } NotParent = (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent, sizeof (UDF_FILE_INFO)) != 0); NotFile = (CompareMem ((VOID *)&PreviousFile, (VOID *)File, sizeof (UDF_FILE_INFO)) != 0); if (NotParent && NotFile) { CleanupFileInformation (&PreviousFile); } if (NotFile) { CopyMem ((VOID *)&PreviousFile, (VOID *)File, sizeof (UDF_FILE_INFO)); } } // // Unmap the symlink file. // FreePool (ReadFileInfo.FileData); // // Check the content in the resolved file info. // if ((File->FileEntry == NULL) || (File->FileIdentifierDesc == NULL)) { return EFI_VOLUME_CORRUPTED; } return EFI_SUCCESS; Error_Find_File: if (CompareMem ((VOID *)&PreviousFile, (VOID *)Parent, sizeof (UDF_FILE_INFO)) != 0) { CleanupFileInformation (&PreviousFile); } FreePool (ReadFileInfo.FileData); return Status; } /** Clean up in-memory UDF file information. @param[in] File File information pointer. **/ VOID CleanupFileInformation ( IN UDF_FILE_INFO *File ) { if (File->FileEntry != NULL) { FreePool (File->FileEntry); } if (File->FileIdentifierDesc != NULL) { FreePool ((VOID *)File->FileIdentifierDesc); } ZeroMem ((VOID *)File, sizeof (UDF_FILE_INFO)); } /** Find a file from its absolute path on an UDF volume. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[in] File File information structure. @param[out] Size Size of the file. @retval EFI_SUCCESS File size calculated and set in Size. @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The file size was not calculated due to lack of resources. **/ EFI_STATUS GetFileSize ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_FILE_INFO *File, OUT UINT64 *Size ) { EFI_STATUS Status; UDF_READ_FILE_INFO ReadFileInfo; ReadFileInfo.Flags = ReadFileGetFileSize; Status = ReadFile ( BlockIo, DiskIo, Volume, &File->FileIdentifierDesc->Icb, File->FileEntry, &ReadFileInfo ); if (EFI_ERROR (Status)) { return Status; } *Size = ReadFileInfo.ReadLength; return EFI_SUCCESS; } /** Set information about a file on an UDF volume. @param[in] File File pointer. @param[in] FileSize Size of the file. @param[in] FileName Filename of the file. @param[in, out] BufferSize Size of the returned file infomation. @param[out] Buffer Data of the returned file information. @retval EFI_SUCCESS File information set. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The file information was not set due to lack of resources. **/ EFI_STATUS SetFileInfo ( IN UDF_FILE_INFO *File, IN UINT64 FileSize, IN CHAR16 *FileName, IN OUT UINTN *BufferSize, OUT VOID *Buffer ) { UINTN FileInfoLength; EFI_FILE_INFO *FileInfo; UDF_FILE_ENTRY *FileEntry; UDF_EXTENDED_FILE_ENTRY *ExtendedFileEntry; UDF_DESCRIPTOR_TAG *DescriptorTag; // // Calculate the needed size for the EFI_FILE_INFO structure. // FileInfoLength = sizeof (EFI_FILE_INFO) + ((FileName != NULL) ? StrSize (FileName) : sizeof (CHAR16)); if (*BufferSize < FileInfoLength) { // // The given Buffer has no size enough for EFI_FILE_INFO structure. // *BufferSize = FileInfoLength; return EFI_BUFFER_TOO_SMALL; } // // Buffer now contains room enough to store EFI_FILE_INFO structure. // Now, fill it in with all necessary information about the file. // FileInfo = (EFI_FILE_INFO *)Buffer; FileInfo->Size = FileInfoLength; FileInfo->Attribute &= ~EFI_FILE_VALID_ATTR; FileInfo->Attribute |= EFI_FILE_READ_ONLY; if (IS_FID_DIRECTORY_FILE (File->FileIdentifierDesc)) { FileInfo->Attribute |= EFI_FILE_DIRECTORY; } else if (IS_FID_NORMAL_FILE (File->FileIdentifierDesc)) { FileInfo->Attribute |= EFI_FILE_ARCHIVE; } if (IS_FID_HIDDEN_FILE (File->FileIdentifierDesc)) { FileInfo->Attribute |= EFI_FILE_HIDDEN; } DescriptorTag = File->FileEntry; if (DescriptorTag->TagIdentifier == UdfFileEntry) { FileEntry = (UDF_FILE_ENTRY *)File->FileEntry; // // Check if FE has the system attribute set. // if (FileEntry->IcbTag.Flags & (1 << 10)) { FileInfo->Attribute |= EFI_FILE_SYSTEM; } FileInfo->FileSize = FileSize; FileInfo->PhysicalSize = FileSize; FileInfo->CreateTime.Year = FileEntry->AccessTime.Year; FileInfo->CreateTime.Month = FileEntry->AccessTime.Month; FileInfo->CreateTime.Day = FileEntry->AccessTime.Day; FileInfo->CreateTime.Hour = FileEntry->AccessTime.Hour; FileInfo->CreateTime.Minute = FileEntry->AccessTime.Minute; FileInfo->CreateTime.Second = FileEntry->AccessTime.Second; FileInfo->CreateTime.Nanosecond = FileEntry->AccessTime.HundredsOfMicroseconds; FileInfo->LastAccessTime.Year = FileEntry->AccessTime.Year; FileInfo->LastAccessTime.Month = FileEntry->AccessTime.Month; FileInfo->LastAccessTime.Day = FileEntry->AccessTime.Day; FileInfo->LastAccessTime.Hour = FileEntry->AccessTime.Hour; FileInfo->LastAccessTime.Minute = FileEntry->AccessTime.Minute; FileInfo->LastAccessTime.Second = FileEntry->AccessTime.Second; FileInfo->LastAccessTime.Nanosecond = FileEntry->AccessTime.HundredsOfMicroseconds; } else if (DescriptorTag->TagIdentifier == UdfExtendedFileEntry) { ExtendedFileEntry = (UDF_EXTENDED_FILE_ENTRY *)File->FileEntry; // // Check if EFE has the system attribute set. // if (ExtendedFileEntry->IcbTag.Flags & (1 << 10)) { FileInfo->Attribute |= EFI_FILE_SYSTEM; } FileInfo->FileSize = FileSize; FileInfo->PhysicalSize = FileSize; FileInfo->CreateTime.Year = ExtendedFileEntry->CreationTime.Year; FileInfo->CreateTime.Month = ExtendedFileEntry->CreationTime.Month; FileInfo->CreateTime.Day = ExtendedFileEntry->CreationTime.Day; FileInfo->CreateTime.Hour = ExtendedFileEntry->CreationTime.Hour; FileInfo->CreateTime.Minute = ExtendedFileEntry->CreationTime.Second; FileInfo->CreateTime.Second = ExtendedFileEntry->CreationTime.Second; FileInfo->CreateTime.Nanosecond = ExtendedFileEntry->AccessTime.HundredsOfMicroseconds; FileInfo->LastAccessTime.Year = ExtendedFileEntry->AccessTime.Year; FileInfo->LastAccessTime.Month = ExtendedFileEntry->AccessTime.Month; FileInfo->LastAccessTime.Day = ExtendedFileEntry->AccessTime.Day; FileInfo->LastAccessTime.Hour = ExtendedFileEntry->AccessTime.Hour; FileInfo->LastAccessTime.Minute = ExtendedFileEntry->AccessTime.Minute; FileInfo->LastAccessTime.Second = ExtendedFileEntry->AccessTime.Second; FileInfo->LastAccessTime.Nanosecond = ExtendedFileEntry->AccessTime.HundredsOfMicroseconds; } FileInfo->CreateTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE; FileInfo->CreateTime.Daylight = EFI_TIME_ADJUST_DAYLIGHT; FileInfo->LastAccessTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE; FileInfo->LastAccessTime.Daylight = EFI_TIME_ADJUST_DAYLIGHT; CopyMem ((VOID *)&FileInfo->ModificationTime, (VOID *)&FileInfo->LastAccessTime, sizeof (EFI_TIME)); if (FileName != NULL) { StrCpyS (FileInfo->FileName, StrLen (FileName) + 1, FileName); } else { FileInfo->FileName[0] = '\0'; } *BufferSize = FileInfoLength; return EFI_SUCCESS; } /** Get volume label of an UDF volume. @attention This is boundary function that may receive untrusted input. @attention The input is from FileSystem. The File Set Descriptor is external input, so this routine will do basic validation for File Set Descriptor and report status. @param[in] Volume Volume information pointer. @param[in] CharMax The maximum number of Unicode char in String, including terminating null char. @param[out] String String buffer pointer to store the volume label. @retval EFI_SUCCESS Volume label is returned. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_BUFFER_TOO_SMALL The string buffer String cannot hold the volume label. **/ EFI_STATUS GetVolumeLabel ( IN UDF_VOLUME_INFO *Volume, IN UINTN CharMax, OUT CHAR16 *String ) { UDF_FILE_SET_DESCRIPTOR *FileSetDesc; UINTN Index; UINT8 *OstaCompressed; UINT8 CompressionId; CHAR16 *StringBak; FileSetDesc = &Volume->FileSetDesc; OstaCompressed = &FileSetDesc->LogicalVolumeIdentifier[0]; CompressionId = OstaCompressed[0]; if (!IS_VALID_COMPRESSION_ID (CompressionId)) { return EFI_VOLUME_CORRUPTED; } StringBak = String; for (Index = 1; Index < 128; Index++) { if (CompressionId == 16) { if ((Index >> 1) > CharMax) { return EFI_BUFFER_TOO_SMALL; } *String = *(UINT8 *)(OstaCompressed + Index) << 8; Index++; } else { if (Index > CharMax) { return EFI_BUFFER_TOO_SMALL; } *String = 0; } if (Index < 128) { *String |= (CHAR16)(*(UINT8 *)(OstaCompressed + Index)); } // // Unlike FID Identifiers, Logical Volume Identifier is stored in a // NULL-terminated OSTA compressed format, so we must check for the NULL // character. // if (*String == L'\0') { break; } String++; } Index = ((UINTN)String - (UINTN)StringBak) / sizeof (CHAR16); if (Index > CharMax - 1) { Index = CharMax - 1; } StringBak[Index] = L'\0'; return EFI_SUCCESS; } /** Get volume and free space size information of an UDF volume. @attention This is boundary function that may receive untrusted input. @attention The input is from FileSystem. The Logical Volume Descriptor and the Logical Volume Integrity Descriptor are external inputs, so this routine will do basic validation for both descriptors and report status. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[out] VolumeSize Volume size. @param[out] FreeSpaceSize Free space size. @retval EFI_SUCCESS Volume and free space size calculated. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The volume and free space size were not calculated due to lack of resources. **/ EFI_STATUS GetVolumeSize ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, OUT UINT64 *VolumeSize, OUT UINT64 *FreeSpaceSize ) { EFI_STATUS Status; UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc; UDF_EXTENT_AD *ExtentAd; UINT64 Lsn; UINT32 LogicalBlockSize; UDF_LOGICAL_VOLUME_INTEGRITY *LogicalVolInt; UDF_DESCRIPTOR_TAG *DescriptorTag; UINTN Index; UINTN Length; UINT32 LsnsNo; LogicalVolDesc = &Volume->LogicalVolDesc; ExtentAd = &LogicalVolDesc->IntegritySequenceExtent; if ((ExtentAd->ExtentLength == 0) || (ExtentAd->ExtentLength < sizeof (UDF_LOGICAL_VOLUME_INTEGRITY))) { return EFI_VOLUME_CORRUPTED; } LogicalVolInt = AllocatePool (ExtentAd->ExtentLength); if (LogicalVolInt == NULL) { return EFI_OUT_OF_RESOURCES; } // // Get location of Logical Volume Integrity Descriptor // Lsn = (UINT64)ExtentAd->ExtentLocation - Volume->MainVdsStartLocation; LogicalBlockSize = LogicalVolDesc->LogicalBlockSize; // // Read disk block // Status = DiskIo->ReadDisk ( DiskIo, BlockIo->Media->MediaId, MultU64x32 (Lsn, LogicalBlockSize), ExtentAd->ExtentLength, LogicalVolInt ); if (EFI_ERROR (Status)) { goto Out_Free; } DescriptorTag = &LogicalVolInt->DescriptorTag; // // Check if read block is a Logical Volume Integrity Descriptor // if (DescriptorTag->TagIdentifier != UdfLogicalVolumeIntegrityDescriptor) { Status = EFI_VOLUME_CORRUPTED; goto Out_Free; } if ((LogicalVolInt->NumberOfPartitions > MAX_UINT32 / sizeof (UINT32) / 2) || (LogicalVolInt->NumberOfPartitions * sizeof (UINT32) * 2 > ExtentAd->ExtentLength - sizeof (UDF_LOGICAL_VOLUME_INTEGRITY))) { Status = EFI_VOLUME_CORRUPTED; goto Out_Free; } *VolumeSize = 0; *FreeSpaceSize = 0; Length = LogicalVolInt->NumberOfPartitions; for (Index = 0; Index < Length; Index += sizeof (UINT32)) { LsnsNo = *(UINT32 *)((UINT8 *)LogicalVolInt->Data + Index); // // Check if size is not specified // if (LsnsNo == 0xFFFFFFFFUL) { continue; } // // Accumulate free space size // *FreeSpaceSize += MultU64x32 ((UINT64)LsnsNo, LogicalBlockSize); } Length = LogicalVolInt->NumberOfPartitions * sizeof (UINT32) * 2; for (; Index < Length; Index += sizeof (UINT32)) { LsnsNo = *(UINT32 *)((UINT8 *)LogicalVolInt->Data + Index); // // Check if size is not specified // if (LsnsNo == 0xFFFFFFFFUL) { continue; } // // Accumulate used volume space // *VolumeSize += MultU64x32 ((UINT64)LsnsNo, LogicalBlockSize); } Status = EFI_SUCCESS; Out_Free: // // Free Logical Volume Integrity Descriptor // FreePool (LogicalVolInt); return Status; } /** Seek a file and read its data into memory on an UDF volume. @param[in] BlockIo BlockIo interface. @param[in] DiskIo DiskIo interface. @param[in] Volume UDF volume information structure. @param[in] File File information structure. @param[in] FileSize Size of the file. @param[in, out] FilePosition File position. @param[in, out] Buffer File data. @param[in, out] BufferSize Read size. @retval EFI_SUCCESS File seeked and read. @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported. @retval EFI_NO_MEDIA The device has no media. @retval EFI_DEVICE_ERROR The device reported an error. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. @retval EFI_OUT_OF_RESOURCES The file's recorded data was not read due to lack of resources. **/ EFI_STATUS ReadFileData ( IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume, IN UDF_FILE_INFO *File, IN UINT64 FileSize, IN OUT UINT64 *FilePosition, IN OUT VOID *Buffer, IN OUT UINT64 *BufferSize ) { EFI_STATUS Status; UDF_READ_FILE_INFO ReadFileInfo; ReadFileInfo.Flags = ReadFileSeekAndRead; ReadFileInfo.FilePosition = *FilePosition; ReadFileInfo.FileData = Buffer; ReadFileInfo.FileDataSize = *BufferSize; ReadFileInfo.FileSize = FileSize; Status = ReadFile ( BlockIo, DiskIo, Volume, &File->FileIdentifierDesc->Icb, File->FileEntry, &ReadFileInfo ); if (EFI_ERROR (Status)) { return Status; } *BufferSize = ReadFileInfo.FileDataSize; *FilePosition = ReadFileInfo.FilePosition; return EFI_SUCCESS; } /** Check if ControllerHandle supports an UDF file system. @param[in] This Protocol instance pointer. @param[in] ControllerHandle Handle of device to test. @retval EFI_SUCCESS UDF file system found. @retval EFI_UNSUPPORTED UDF file system not found. **/ EFI_STATUS SupportUdfFileSystem ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle ) { EFI_STATUS Status; EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode; EFI_GUID *VendorDefinedGuid; // // Open Device Path protocol on ControllerHandle // Status = gBS->OpenProtocol ( ControllerHandle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath, This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } Status = EFI_UNSUPPORTED; // // Get last Device Path node // LastDevicePathNode = NULL; DevicePathNode = DevicePath; while (!IsDevicePathEnd (DevicePathNode)) { LastDevicePathNode = DevicePathNode; DevicePathNode = NextDevicePathNode (DevicePathNode); } // // Check if last Device Path node contains a Vendor-Defined Media Device Path // of an UDF file system. // if (LastDevicePathNode != NULL && DevicePathType (LastDevicePathNode) == MEDIA_DEVICE_PATH && DevicePathSubType (LastDevicePathNode) == MEDIA_VENDOR_DP) { VendorDefinedGuid = (EFI_GUID *)((UINTN)LastDevicePathNode + OFFSET_OF (VENDOR_DEVICE_PATH, Guid)); if (CompareGuid (VendorDefinedGuid, &gUdfDevPathGuid)) { Status = EFI_SUCCESS; } } // // Close Device Path protocol on ControllerHandle // gBS->CloseProtocol ( ControllerHandle, &gEfiDevicePathProtocolGuid, This->DriverBindingHandle, ControllerHandle ); return Status; }
google/google-ctf
third_party/edk2/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
C
apache-2.0
88,672
*{ margin: 0; padding: 0; font-family: 'helvetica neue', helvetica; } #sidebar{ background: url("../img/obrnuto.png"); background-size: cover; padding: 0px; overflow:auto; //added -webkit-overflow-scrolling:touch; //added } #sidet2{ padding-left: 80px !important; } #body { background: url("../img/index.png"); background-size: cover; padding:10px; } #indextexty{ color: white; z-index: 1000; margin-left: 0px; padding-left: 0px; margin-top: 0px; font-weight: bolder; letter-spacing: 5px; float: left; padding-top: 20px; padding-left: 20px; } header{ height: auto; background: url("../img/info.jpg") center center; background-size: cover; width: 100%; } .logoinfo{ padding-top: 35px; padding-left: 78px; } a{ font-weight: 700; font-size: 18px; letter-spacing: 5px; list-style: none; height: 125px; padding-left: 90px; } nav{ text-transform: uppercase; position: relative; /* da bi navigacija isla preko contenta */ z-index: 1000; /* da bi navigacija isla preko contenta */ background: rgba(0, 0, 0, 0.7); margin-top: 20px; } nav a{ list-style: none; padding-left: 15px; /* odmak od lijevog ruba */ margin-left: 0px; width: 100% !important; padding-bottom: 0px; /* da bude cijeli -li- clickable */ padding-top: 0px; /* da bude cijeli -li- clickable */ padding-left: 0px; padding-right: 0px; border-bottom: grey solid 1px; color: #FFF; text-decoration: none; display: block; padding-bottom: 50.5px; /* podešavanje visine klikabilnog podrucja*/ padding-top: 50.5px; /* podešavanje visine klikabilnog podrucja*/ } nav a:hover{ background-color: rgba(255, 0 , 0, 0.5); } #list1{ padding-left: 108px; padding-top: 50px; } #list2{ padding-left: 108px; padding-top: 50px; } h1{ font-size: 20px; color: rgb(215,245,250); text-transform: uppercase; letter-spacing: 0.05em; text-align: center; margin-bottom: 0px; clear: both; padding-top: 50px; } span{ display: inline-block; padding: 0.2em 0.5em; border: rgb(215,245,250) solid 10px; margin-bottom: 5%; } .kicker{ text-align: center; font-weight: 700; letter-spacing: 0.05em; color: rgb(215,245,250); padding-left: 10px; width: 330px; height: 350px; } div{ display: block; } .divtext{ margin-top: 20px; padding-top: 50px; padding-bottom: 50px; background-color: rgb(215,245,250); width: 95%; overflow: auto; } ::-webkit-overflow-scrolling:touch; .sub{ font-weight: 1000; color: #484848; text-align: center; } .text{ color: #484848; font-weight: bolder; text-align: center; } /*===============================FOOTER====================================*/ footer{ position: relative; clear: both; height: 50px; /*auto - automatski dodjeljiva visinu ovisno o sadržaju i njegovoj visini*/ width: 100% !important; left: 0px; bottom: 0px; /*margin-bottom:0px; za 480height*/ /*padding: 30px 30px;*/ /*dodati za 480px height*/ } .footer{ text-align: center; color: #ccc; float: left; margin-top: 5px; /*udaljenost texta od vrha footera*/ margin-bottom: 1px; /*udaljenost texta od dna*/ margin-left: 30%; /*margin left i right pomiču text od rubova footera*/ margin-right: 30%; } /*=================================MEDIA RESPONSIVE================================================*/
Perhpethua/Android-1.1
www/css/info.css
CSS
apache-2.0
3,235
package org.springframework.security.oauth.examples.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("marissa").password("wombat").roles("USER").and().withUser("sam") .password("kangaroo").roles("USER"); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/resources/**"); } @Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off http.authorizeRequests() .antMatchers("/sparklr/**","/facebook/**").hasRole("USER") .anyRequest().permitAll() .and() .logout() .logoutSuccessUrl("/login.jsp") .logoutUrl("/logout.do") .permitAll() .and() .formLogin() .loginPage("/login.jsp") .loginProcessingUrl("/login.do") .failureUrl("/login.jsp?authentication_error=true") .usernameParameter("j_username") .passwordParameter("j_password") .permitAll(); // @formatter:on } }
ahmadOwais/spring-security-oauth
samples/oauth2/tonr/src/main/java/org/springframework/security/oauth/examples/config/SecurityConfig.java
Java
apache-2.0
1,822
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #include <aws/s3/model/GetBucketLocationRequest.h> #include <aws/core/utils/xml/XmlSerializer.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> #include <utility> using namespace Aws::S3::Model; using namespace Aws::Utils::Xml; using namespace Aws::Utils; GetBucketLocationRequest::GetBucketLocationRequest() : m_bucketHasBeenSet(false) { } Aws::String GetBucketLocationRequest::SerializePayload() const { return ""; }
chiaming0914/awe-cpp-sdk
aws-cpp-sdk-s3/source/model/GetBucketLocationRequest.cpp
C++
apache-2.0
1,016
import { Nullable, IndicesArray } from "../types"; import { Logger } from "../Misc/logger"; import { ArrayTools } from "../Misc/arrayTools"; import { Vector3, Matrix, Quaternion } from "../Maths/math.vector"; import { TransformNode } from "../Meshes/transformNode"; import { AbstractMesh } from "../Meshes/abstractMesh"; import { Mesh } from "../Meshes/mesh"; import { Scene } from "../scene"; import { Bone } from "../Bones/bone"; import { BoundingInfo } from "../Culling/boundingInfo"; import { IPhysicsEngine } from "./IPhysicsEngine"; import { PhysicsJoint, PhysicsJointData } from "./physicsJoint"; import { Space } from "../Maths/math.axis"; /** * The interface for the physics imposter parameters * @see https://doc.babylonjs.com/how_to/using_the_physics_engine */ export interface PhysicsImpostorParameters { /** * The mass of the physics imposter */ mass: number; /** * The friction of the physics imposter */ friction?: number; /** * The coefficient of restitution of the physics imposter */ restitution?: number; /** * The native options of the physics imposter */ nativeOptions?: any; /** * Specifies if the parent should be ignored */ ignoreParent?: boolean; /** * Specifies if bi-directional transformations should be disabled */ disableBidirectionalTransformation?: boolean; /** * The pressure inside the physics imposter, soft object only */ pressure?: number; /** * The stiffness the physics imposter, soft object only */ stiffness?: number; /** * The number of iterations used in maintaining consistent vertex velocities, soft object only */ velocityIterations?: number; /** * The number of iterations used in maintaining consistent vertex positions, soft object only */ positionIterations?: number; /** * The number used to fix points on a cloth (0, 1, 2, 4, 8) or rope (0, 1, 2) only * 0 None, 1, back left or top, 2, back right or bottom, 4, front left, 8, front right * Add to fix multiple points */ fixedPoints?: number; /** * The collision margin around a soft object */ margin?: number; /** * The collision margin around a soft object */ damping?: number; /** * The path for a rope based on an extrusion */ path?: any; /** * The shape of an extrusion used for a rope based on an extrusion */ shape?: any; } /** * Interface for a physics-enabled object * @see https://doc.babylonjs.com/how_to/using_the_physics_engine */ export interface IPhysicsEnabledObject { /** * The position of the physics-enabled object */ position: Vector3; /** * The rotation of the physics-enabled object */ rotationQuaternion: Nullable<Quaternion>; /** * The scale of the physics-enabled object */ scaling: Vector3; /** * The rotation of the physics-enabled object */ rotation?: Vector3; /** * The parent of the physics-enabled object */ parent?: any; /** * The bounding info of the physics-enabled object * @returns The bounding info of the physics-enabled object */ getBoundingInfo(): BoundingInfo; /** * Computes the world matrix * @param force Specifies if the world matrix should be computed by force * @returns A world matrix */ computeWorldMatrix(force: boolean): Matrix; /** * Gets the world matrix * @returns A world matrix */ getWorldMatrix?(): Matrix; /** * Gets the child meshes * @param directDescendantsOnly Specifies if only direct-descendants should be obtained * @returns An array of abstract meshes */ getChildMeshes?(directDescendantsOnly?: boolean): Array<AbstractMesh>; /** * Gets the vertex data * @param kind The type of vertex data * @returns A nullable array of numbers, or a float32 array */ getVerticesData(kind: string): Nullable<Array<number> | Float32Array>; /** * Gets the indices from the mesh * @returns A nullable array of index arrays */ getIndices?(): Nullable<IndicesArray>; /** * Gets the scene from the mesh * @returns the indices array or null */ getScene?(): Scene; /** * Gets the absolute position from the mesh * @returns the absolute position */ getAbsolutePosition(): Vector3; /** * Gets the absolute pivot point from the mesh * @returns the absolute pivot point */ getAbsolutePivotPoint(): Vector3; /** * Rotates the mesh * @param axis The axis of rotation * @param amount The amount of rotation * @param space The space of the rotation * @returns The rotation transform node */ rotate(axis: Vector3, amount: number, space?: Space): TransformNode; /** * Translates the mesh * @param axis The axis of translation * @param distance The distance of translation * @param space The space of the translation * @returns The transform node */ translate(axis: Vector3, distance: number, space?: Space): TransformNode; /** * Sets the absolute position of the mesh * @param absolutePosition The absolute position of the mesh * @returns The transform node */ setAbsolutePosition(absolutePosition: Vector3): TransformNode; /** * Gets the class name of the mesh * @returns The class name */ getClassName(): string; } Mesh._PhysicsImpostorParser = function (scene: Scene, physicObject: IPhysicsEnabledObject, jsonObject: any): PhysicsImpostor { return new PhysicsImpostor( physicObject, jsonObject.physicsImpostor, { mass: jsonObject.physicsMass, friction: jsonObject.physicsFriction, restitution: jsonObject.physicsRestitution, }, scene ); }; /** * Represents a physics imposter * @see https://doc.babylonjs.com/how_to/using_the_physics_engine */ export class PhysicsImpostor { /** * The default object size of the imposter */ public static DEFAULT_OBJECT_SIZE: Vector3 = new Vector3(1, 1, 1); /** * The identity quaternion of the imposter */ public static IDENTITY_QUATERNION = Quaternion.Identity(); /** @hidden */ public _pluginData: any = {}; private _physicsEngine: Nullable<IPhysicsEngine>; //The native cannon/oimo/energy physics body object. private _physicsBody: any; private _bodyUpdateRequired: boolean = false; private _onBeforePhysicsStepCallbacks = new Array<(impostor: PhysicsImpostor) => void>(); private _onAfterPhysicsStepCallbacks = new Array<(impostor: PhysicsImpostor) => void>(); /** @hidden */ public _onPhysicsCollideCallbacks: Array<{ callback: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor, point: Nullable<Vector3>) => void; otherImpostors: Array<PhysicsImpostor> }> = []; private _deltaPosition: Vector3 = Vector3.Zero(); private _deltaRotation: Quaternion; private _deltaRotationConjugated: Quaternion; /** @hidden */ public _isFromLine: boolean; //If set, this is this impostor's parent private _parent: Nullable<PhysicsImpostor>; private _isDisposed = false; private static _tmpVecs: Vector3[] = ArrayTools.BuildArray(3, Vector3.Zero); private static _tmpQuat: Quaternion = Quaternion.Identity(); /** * Specifies if the physics imposter is disposed */ get isDisposed(): boolean { return this._isDisposed; } /** * Gets the mass of the physics imposter */ get mass(): number { return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0; } set mass(value: number) { this.setMass(value); } /** * Gets the coefficient of friction */ get friction(): number { return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0; } /** * Sets the coefficient of friction */ set friction(value: number) { if (!this._physicsEngine) { return; } this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value); } /** * Gets the coefficient of restitution */ get restitution(): number { return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0; } /** * Sets the coefficient of restitution */ set restitution(value: number) { if (!this._physicsEngine) { return; } this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value); } /** * Gets the pressure of a soft body; only supported by the AmmoJSPlugin */ get pressure(): number { if (!this._physicsEngine) { return 0; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.setBodyPressure) { return 0; } return plugin.getBodyPressure!(this); } /** * Sets the pressure of a soft body; only supported by the AmmoJSPlugin */ set pressure(value: number) { if (!this._physicsEngine) { return; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.setBodyPressure) { return; } plugin.setBodyPressure!(this, value); } /** * Gets the stiffness of a soft body; only supported by the AmmoJSPlugin */ get stiffness(): number { if (!this._physicsEngine) { return 0; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.getBodyStiffness) { return 0; } return plugin.getBodyStiffness!(this); } /** * Sets the stiffness of a soft body; only supported by the AmmoJSPlugin */ set stiffness(value: number) { if (!this._physicsEngine) { return; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.setBodyStiffness) { return; } plugin.setBodyStiffness!(this, value); } /** * Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin */ get velocityIterations(): number { if (!this._physicsEngine) { return 0; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.getBodyVelocityIterations) { return 0; } return plugin.getBodyVelocityIterations!(this); } /** * Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin */ set velocityIterations(value: number) { if (!this._physicsEngine) { return; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.setBodyVelocityIterations) { return; } plugin.setBodyVelocityIterations!(this, value); } /** * Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin */ get positionIterations(): number { if (!this._physicsEngine) { return 0; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.getBodyPositionIterations) { return 0; } return plugin.getBodyPositionIterations!(this); } /** * Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin */ set positionIterations(value: number) { if (!this._physicsEngine) { return; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.setBodyPositionIterations) { return; } plugin.setBodyPositionIterations!(this, value); } /** * The unique id of the physics imposter * set by the physics engine when adding this impostor to the array */ public uniqueId: number; /** * @hidden */ public soft: boolean = false; /** * @hidden */ public segments: number = 0; private _joints: Array<{ joint: PhysicsJoint; otherImpostor: PhysicsImpostor; }>; /** * Initializes the physics imposter * @param object The physics-enabled object used as the physics imposter * @param type The type of the physics imposter * @param _options The options for the physics imposter * @param _scene The Babylon scene */ constructor( /** * The physics-enabled object used as the physics imposter */ public object: IPhysicsEnabledObject, /** * The type of the physics imposter */ public type: number, private _options: PhysicsImpostorParameters = { mass: 0 }, private _scene?: Scene ) { //sanity check! if (!this.object) { Logger.Error("No object was provided. A physics object is obligatory"); return; } if (this.object.parent && _options.mass !== 0) { Logger.Warn("A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur."); } // Legacy support for old syntax. if (!this._scene && object.getScene) { this._scene = object.getScene(); } if (!this._scene) { return; } if (this.type > 100) { this.soft = true; } this._physicsEngine = this._scene.getPhysicsEngine(); if (!this._physicsEngine) { Logger.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."); } else { //set the object's quaternion, if not set if (!this.object.rotationQuaternion) { if (this.object.rotation) { this.object.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.object.rotation.y, this.object.rotation.x, this.object.rotation.z); } else { this.object.rotationQuaternion = new Quaternion(); } } //default options params this._options.mass = _options.mass === void 0 ? 0 : _options.mass; this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction; this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution; if (this.soft) { //softbody mass must be above 0; this._options.mass = this._options.mass > 0 ? this._options.mass : 1; this._options.pressure = _options.pressure === void 0 ? 200 : _options.pressure; this._options.stiffness = _options.stiffness === void 0 ? 1 : _options.stiffness; this._options.velocityIterations = _options.velocityIterations === void 0 ? 20 : _options.velocityIterations; this._options.positionIterations = _options.positionIterations === void 0 ? 20 : _options.positionIterations; this._options.fixedPoints = _options.fixedPoints === void 0 ? 0 : _options.fixedPoints; this._options.margin = _options.margin === void 0 ? 0 : _options.margin; this._options.damping = _options.damping === void 0 ? 0 : _options.damping; this._options.path = _options.path === void 0 ? null : _options.path; this._options.shape = _options.shape === void 0 ? null : _options.shape; } this._joints = []; //If the mesh has a parent, don't initialize the physicsBody. Instead wait for the parent to do that. if (!this.object.parent || this._options.ignoreParent) { this._init(); } else if (this.object.parent.physicsImpostor) { Logger.Warn("You must affect impostors to children before affecting impostor to parent."); } } } /** * This function will completly initialize this impostor. * It will create a new body - but only if this mesh has no parent. * If it has, this impostor will not be used other than to define the impostor * of the child mesh. * @hidden */ public _init() { if (!this._physicsEngine) { return; } this._physicsEngine.removeImpostor(this); this.physicsBody = null; this._parent = this._parent || this._getPhysicsParent(); if (!this._isDisposed && (!this.parent || this._options.ignoreParent)) { this._physicsEngine.addImpostor(this); } } private _getPhysicsParent(): Nullable<PhysicsImpostor> { if (this.object.parent instanceof AbstractMesh) { var parentMesh: AbstractMesh = <AbstractMesh>this.object.parent; return parentMesh.physicsImpostor; } return null; } /** * Should a new body be generated. * @returns boolean specifying if body initialization is required */ public isBodyInitRequired(): boolean { return this._bodyUpdateRequired || (!this._physicsBody && !this._parent); } /** * Sets the updated scaling * @param updated Specifies if the scaling is updated */ public setScalingUpdated() { this.forceUpdate(); } /** * Force a regeneration of this or the parent's impostor's body. * Use under cautious - This will remove all joints already implemented. */ public forceUpdate() { this._init(); if (this.parent && !this._options.ignoreParent) { this.parent.forceUpdate(); } } /*public get mesh(): AbstractMesh { return this._mesh; }*/ /** * Gets the body that holds this impostor. Either its own, or its parent. */ public get physicsBody(): any { return this._parent && !this._options.ignoreParent ? this._parent.physicsBody : this._physicsBody; } /** * Get the parent of the physics imposter * @returns Physics imposter or null */ public get parent(): Nullable<PhysicsImpostor> { return !this._options.ignoreParent && this._parent ? this._parent : null; } /** * Sets the parent of the physics imposter */ public set parent(value: Nullable<PhysicsImpostor>) { this._parent = value; } /** * Set the physics body. Used mainly by the physics engine/plugin */ public set physicsBody(physicsBody: any) { if (this._physicsBody && this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this); } this._physicsBody = physicsBody; this.resetUpdateFlags(); } /** * Resets the update flags */ public resetUpdateFlags() { this._bodyUpdateRequired = false; } /** * Gets the object extend size * @returns the object extend size */ public getObjectExtendSize(): Vector3 { if (this.object.getBoundingInfo) { let q = this.object.rotationQuaternion; const scaling = this.object.scaling.clone(); //reset rotation this.object.rotationQuaternion = PhysicsImpostor.IDENTITY_QUATERNION; //calculate the world matrix with no rotation const worldMatrix = this.object.computeWorldMatrix && this.object.computeWorldMatrix(true); if (worldMatrix) { worldMatrix.decompose(scaling, undefined, undefined); } const boundingInfo = this.object.getBoundingInfo(); // get the global scaling of the object const size = boundingInfo.boundingBox.extendSize.scale(2).multiplyInPlace(scaling); //bring back the rotation this.object.rotationQuaternion = q; //calculate the world matrix with the new rotation this.object.computeWorldMatrix && this.object.computeWorldMatrix(true); return size; } else { return PhysicsImpostor.DEFAULT_OBJECT_SIZE; } } /** * Gets the object center * @returns The object center */ public getObjectCenter(): Vector3 { if (this.object.getBoundingInfo) { let boundingInfo = this.object.getBoundingInfo(); return boundingInfo.boundingBox.centerWorld; } else { return this.object.position; } } /** * Get a specific parameter from the options parameters * @param paramName The object parameter name * @returns The object parameter */ public getParam(paramName: string): any { return (<any>this._options)[paramName]; } /** * Sets a specific parameter in the options given to the physics plugin * @param paramName The parameter name * @param value The value of the parameter */ public setParam(paramName: string, value: number) { (<any>this._options)[paramName] = value; this._bodyUpdateRequired = true; } /** * Specifically change the body's mass option. Won't recreate the physics body object * @param mass The mass of the physics imposter */ public setMass(mass: number) { if (this.getParam("mass") !== mass) { this.setParam("mass", mass); } if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().setBodyMass(this, mass); } } /** * Gets the linear velocity * @returns linear velocity or null */ public getLinearVelocity(): Nullable<Vector3> { return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this) : Vector3.Zero(); } /** * Sets the linear velocity * @param velocity linear velocity or null */ public setLinearVelocity(velocity: Nullable<Vector3>) { if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this, velocity); } } /** * Gets the angular velocity * @returns angular velocity or null */ public getAngularVelocity(): Nullable<Vector3> { return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this) : Vector3.Zero(); } /** * Sets the angular velocity * @param velocity The velocity or null */ public setAngularVelocity(velocity: Nullable<Vector3>) { if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this, velocity); } } /** * Execute a function with the physics plugin native code * Provide a function the will have two variables - the world object and the physics body object * @param func The function to execute with the physics plugin native code */ public executeNativeFunction(func: (world: any, physicsBody: any) => void) { if (this._physicsEngine) { func(this._physicsEngine.getPhysicsPlugin().world, this.physicsBody); } } /** * Register a function that will be executed before the physics world is stepping forward * @param func The function to execute before the physics world is stepped forward */ public registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void { this._onBeforePhysicsStepCallbacks.push(func); } /** * Unregister a function that will be executed before the physics world is stepping forward * @param func The function to execute before the physics world is stepped forward */ public unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void { var index = this._onBeforePhysicsStepCallbacks.indexOf(func); if (index > -1) { this._onBeforePhysicsStepCallbacks.splice(index, 1); } else { Logger.Warn("Function to remove was not found"); } } /** * Register a function that will be executed after the physics step * @param func The function to execute after physics step */ public registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void { this._onAfterPhysicsStepCallbacks.push(func); } /** * Unregisters a function that will be executed after the physics step * @param func The function to execute after physics step */ public unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void { var index = this._onAfterPhysicsStepCallbacks.indexOf(func); if (index > -1) { this._onAfterPhysicsStepCallbacks.splice(index, 1); } else { Logger.Warn("Function to remove was not found"); } } /** * register a function that will be executed when this impostor collides against a different body * @param collideAgainst Physics imposter, or array of physics imposters to collide against * @param func Callback that is executed on collision */ public registerOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor) => void): void { var collidedAgainstList: Array<PhysicsImpostor> = collideAgainst instanceof Array ? <Array<PhysicsImpostor>>collideAgainst : [<PhysicsImpostor>collideAgainst]; this._onPhysicsCollideCallbacks.push({ callback: func, otherImpostors: collidedAgainstList }); } /** * Unregisters the physics imposter on contact * @param collideAgainst The physics object to collide against * @param func Callback to execute on collision */ public unregisterOnPhysicsCollide(collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>, func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>) => void): void { var collidedAgainstList: Array<PhysicsImpostor> = collideAgainst instanceof Array ? <Array<PhysicsImpostor>>collideAgainst : [<PhysicsImpostor>collideAgainst]; var index = -1; let found = this._onPhysicsCollideCallbacks.some((cbDef, idx) => { if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) { // chcek the arrays match let sameList = cbDef.otherImpostors.every((impostor) => { return collidedAgainstList.indexOf(impostor) > -1; }); if (sameList) { index = idx; } return sameList; } return false; }); if (found) { this._onPhysicsCollideCallbacks.splice(index, 1); } else { Logger.Warn("Function to remove was not found"); } } //temp variables for parent rotation calculations //private _mats: Array<Matrix> = [new Matrix(), new Matrix()]; private _tmpQuat: Quaternion = new Quaternion(); private _tmpQuat2: Quaternion = new Quaternion(); /** * Get the parent rotation * @returns The parent rotation */ public getParentsRotation(): Quaternion { let parent = this.object.parent; this._tmpQuat.copyFromFloats(0, 0, 0, 1); while (parent) { if (parent.rotationQuaternion) { this._tmpQuat2.copyFrom(parent.rotationQuaternion); } else { Quaternion.RotationYawPitchRollToRef(parent.rotation.y, parent.rotation.x, parent.rotation.z, this._tmpQuat2); } this._tmpQuat.multiplyToRef(this._tmpQuat2, this._tmpQuat); parent = parent.parent; } return this._tmpQuat; } /** * this function is executed by the physics engine. */ public beforeStep = () => { if (!this._physicsEngine) { return; } this.object.translate(this._deltaPosition, -1); this._deltaRotationConjugated && this.object.rotationQuaternion && this.object.rotationQuaternion.multiplyToRef(this._deltaRotationConjugated, this.object.rotationQuaternion); this.object.computeWorldMatrix(false); if (this.object.parent && this.object.rotationQuaternion) { this.getParentsRotation(); this._tmpQuat.multiplyToRef(this.object.rotationQuaternion, this._tmpQuat); } else { this._tmpQuat.copyFrom(this.object.rotationQuaternion || new Quaternion()); } if (!this._options.disableBidirectionalTransformation) { this.object.rotationQuaternion && this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(this, /*bInfo.boundingBox.centerWorld*/ this.object.getAbsolutePosition(), this._tmpQuat); } this._onBeforePhysicsStepCallbacks.forEach((func) => { func(this); }); }; /** * this function is executed by the physics engine */ public afterStep = () => { if (!this._physicsEngine) { return; } this._onAfterPhysicsStepCallbacks.forEach((func) => { func(this); }); this._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(this); // object has now its world rotation. needs to be converted to local. if (this.object.parent && this.object.rotationQuaternion) { this.getParentsRotation(); this._tmpQuat.conjugateInPlace(); this._tmpQuat.multiplyToRef(this.object.rotationQuaternion, this.object.rotationQuaternion); } // take the position set and make it the absolute position of this object. this.object.setAbsolutePosition(this.object.position); this._deltaRotation && this.object.rotationQuaternion && this.object.rotationQuaternion.multiplyToRef(this._deltaRotation, this.object.rotationQuaternion); this.object.translate(this._deltaPosition, 1); }; /** * Legacy collision detection event support */ public onCollideEvent: Nullable<(collider: PhysicsImpostor, collidedWith: PhysicsImpostor) => void> = null; /** * event and body object due to cannon's event-based architecture. */ public onCollide = (e: { body: any; point: Nullable<Vector3> }) => { if (!this._onPhysicsCollideCallbacks.length && !this.onCollideEvent) { return; } if (!this._physicsEngine) { return; } var otherImpostor = this._physicsEngine.getImpostorWithPhysicsBody(e.body); if (otherImpostor) { // Legacy collision detection event support if (this.onCollideEvent) { this.onCollideEvent(this, otherImpostor); } this._onPhysicsCollideCallbacks .filter((obj) => { return obj.otherImpostors.indexOf(<PhysicsImpostor>otherImpostor) !== -1; }) .forEach((obj) => { obj.callback(this, <PhysicsImpostor>otherImpostor, e.point); }); } }; /** * Apply a force * @param force The force to apply * @param contactPoint The contact point for the force * @returns The physics imposter */ public applyForce(force: Vector3, contactPoint: Vector3): PhysicsImpostor { if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().applyForce(this, force, contactPoint); } return this; } /** * Apply an impulse * @param force The impulse force * @param contactPoint The contact point for the impulse force * @returns The physics imposter */ public applyImpulse(force: Vector3, contactPoint: Vector3): PhysicsImpostor { if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().applyImpulse(this, force, contactPoint); } return this; } /** * A help function to create a joint * @param otherImpostor A physics imposter used to create a joint * @param jointType The type of joint * @param jointData The data for the joint * @returns The physics imposter */ public createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): PhysicsImpostor { var joint = new PhysicsJoint(jointType, jointData); this.addJoint(otherImpostor, joint); return this; } /** * Add a joint to this impostor with a different impostor * @param otherImpostor A physics imposter used to add a joint * @param joint The joint to add * @returns The physics imposter */ public addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): PhysicsImpostor { this._joints.push({ otherImpostor: otherImpostor, joint: joint, }); if (this._physicsEngine) { this._physicsEngine.addJoint(this, otherImpostor, joint); } return this; } /** * Add an anchor to a cloth impostor * @param otherImpostor rigid impostor to anchor to * @param width ratio across width from 0 to 1 * @param height ratio up height from 0 to 1 * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little strech * @param noCollisionBetweenLinkedBodies when true collisions between cloth impostor and anchor are ignored; default false * @returns impostor the soft imposter */ public addAnchor(otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor { if (!this._physicsEngine) { return this; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.appendAnchor) { return this; } if (this._physicsEngine) { plugin.appendAnchor!(this, otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies); } return this; } /** * Add a hook to a rope impostor * @param otherImpostor rigid impostor to anchor to * @param length ratio across rope from 0 to 1 * @param influence the elasticity between rope impostor and anchor from 0, very stretchy to 1, little strech * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false * @returns impostor the rope imposter */ public addHook(otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor { if (!this._physicsEngine) { return this; } const plugin = this._physicsEngine.getPhysicsPlugin(); if (!plugin.appendAnchor) { return this; } if (this._physicsEngine) { plugin.appendHook!(this, otherImpostor, length, influence, noCollisionBetweenLinkedBodies); } return this; } /** * Will keep this body still, in a sleep mode. * @returns the physics imposter */ public sleep(): PhysicsImpostor { if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().sleepBody(this); } return this; } /** * Wake the body up. * @returns The physics imposter */ public wakeUp(): PhysicsImpostor { if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().wakeUpBody(this); } return this; } /** * Clones the physics imposter * @param newObject The physics imposter clones to this physics-enabled object * @returns A nullable physics imposter */ public clone(newObject: IPhysicsEnabledObject): Nullable<PhysicsImpostor> { if (!newObject) { return null; } return new PhysicsImpostor(newObject, this.type, this._options, this._scene); } /** * Disposes the physics imposter */ public dispose(/*disposeChildren: boolean = true*/) { //no dispose if no physics engine is available. if (!this._physicsEngine) { return; } this._joints.forEach((j) => { if (this._physicsEngine) { this._physicsEngine.removeJoint(this, j.otherImpostor, j.joint); } }); //dispose the physics body this._physicsEngine.removeImpostor(this); if (this.parent) { this.parent.forceUpdate(); } else { /*this._object.getChildMeshes().forEach(function(mesh) { if (mesh.physicsImpostor) { if (disposeChildren) { mesh.physicsImpostor.dispose(); mesh.physicsImpostor = null; } } })*/ } this._isDisposed = true; } /** * Sets the delta position * @param position The delta position amount */ public setDeltaPosition(position: Vector3) { this._deltaPosition.copyFrom(position); } /** * Sets the delta rotation * @param rotation The delta rotation amount */ public setDeltaRotation(rotation: Quaternion) { if (!this._deltaRotation) { this._deltaRotation = new Quaternion(); } this._deltaRotation.copyFrom(rotation); this._deltaRotationConjugated = this._deltaRotation.conjugate(); } /** * Gets the box size of the physics imposter and stores the result in the input parameter * @param result Stores the box size * @returns The physics imposter */ public getBoxSizeToRef(result: Vector3): PhysicsImpostor { if (this._physicsEngine) { this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this, result); } return this; } /** * Gets the radius of the physics imposter * @returns Radius of the physics imposter */ public getRadius(): number { return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getRadius(this) : 0; } /** * Sync a bone with this impostor * @param bone The bone to sync to the impostor. * @param boneMesh The mesh that the bone is influencing. * @param jointPivot The pivot of the joint / bone in local space. * @param distToJoint Optional distance from the impostor to the joint. * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone. */ public syncBoneWithImpostor(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion) { var tempVec = PhysicsImpostor._tmpVecs[0]; var mesh = <AbstractMesh>this.object; if (mesh.rotationQuaternion) { if (adjustRotation) { var tempQuat = PhysicsImpostor._tmpQuat; mesh.rotationQuaternion.multiplyToRef(adjustRotation, tempQuat); bone.setRotationQuaternion(tempQuat, Space.WORLD, boneMesh); } else { bone.setRotationQuaternion(mesh.rotationQuaternion, Space.WORLD, boneMesh); } } tempVec.x = 0; tempVec.y = 0; tempVec.z = 0; if (jointPivot) { tempVec.x = jointPivot.x; tempVec.y = jointPivot.y; tempVec.z = jointPivot.z; bone.getDirectionToRef(tempVec, boneMesh, tempVec); if (distToJoint === undefined || distToJoint === null) { distToJoint = jointPivot.length(); } tempVec.x *= distToJoint; tempVec.y *= distToJoint; tempVec.z *= distToJoint; } if (bone.getParent()) { tempVec.addInPlace(mesh.getAbsolutePosition()); bone.setAbsolutePosition(tempVec, boneMesh); } else { boneMesh.setAbsolutePosition(mesh.getAbsolutePosition()); boneMesh.position.x -= tempVec.x; boneMesh.position.y -= tempVec.y; boneMesh.position.z -= tempVec.z; } } /** * Sync impostor to a bone * @param bone The bone that the impostor will be synced to. * @param boneMesh The mesh that the bone is influencing. * @param jointPivot The pivot of the joint / bone in local space. * @param distToJoint Optional distance from the impostor to the joint. * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone. * @param boneAxis Optional vector3 axis the bone is aligned with */ public syncImpostorWithBone(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion, boneAxis?: Vector3) { var mesh = <AbstractMesh>this.object; if (mesh.rotationQuaternion) { if (adjustRotation) { var tempQuat = PhysicsImpostor._tmpQuat; bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, tempQuat); tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion); } else { bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, mesh.rotationQuaternion); } } var pos = PhysicsImpostor._tmpVecs[0]; var boneDir = PhysicsImpostor._tmpVecs[1]; if (!boneAxis) { boneAxis = PhysicsImpostor._tmpVecs[2]; boneAxis.x = 0; boneAxis.y = 1; boneAxis.z = 0; } bone.getDirectionToRef(boneAxis, boneMesh, boneDir); bone.getAbsolutePositionToRef(boneMesh, pos); if ((distToJoint === undefined || distToJoint === null) && jointPivot) { distToJoint = jointPivot.length(); } if (distToJoint !== undefined && distToJoint !== null) { pos.x += boneDir.x * distToJoint; pos.y += boneDir.y * distToJoint; pos.z += boneDir.z * distToJoint; } mesh.setAbsolutePosition(pos); } //Impostor types /** * No-Imposter type */ public static NoImpostor = 0; /** * Sphere-Imposter type */ public static SphereImpostor = 1; /** * Box-Imposter type */ public static BoxImpostor = 2; /** * Plane-Imposter type */ public static PlaneImpostor = 3; /** * Mesh-imposter type */ public static MeshImpostor = 4; /** * Capsule-Impostor type (Ammo.js plugin only) */ public static CapsuleImpostor = 6; /** * Cylinder-Imposter type */ public static CylinderImpostor = 7; /** * Particle-Imposter type */ public static ParticleImpostor = 8; /** * Heightmap-Imposter type */ public static HeightmapImpostor = 9; /** * ConvexHull-Impostor type (Ammo.js plugin only) */ public static ConvexHullImpostor = 10; /** * Custom-Imposter type (Ammo.js plugin only) */ public static CustomImpostor = 100; /** * Rope-Imposter type */ public static RopeImpostor = 101; /** * Cloth-Imposter type */ public static ClothImpostor = 102; /** * Softbody-Imposter type */ public static SoftbodyImpostor = 103; }
Kesshi/Babylon.js
src/Physics/physicsImpostor.ts
TypeScript
apache-2.0
44,875
/* * * Hands-On code of the book Introduction to Reliable Distributed Programming * by Christian Cachin, Rachid Guerraoui and Luis Rodrigues * Copyright (C) 2005-2011 Luis Rodrigues * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * * Contact * Address: * Rua Alves Redol 9, Office 605 * 1000-029 Lisboa * PORTUGAL * Email: * ler@ist.utl.pt * Web: * http://homepages.gsd.inesc-id.pt/~ler/ * */ package vanillacomm.protocols.utils; import java.io.Serializable; import java.net.SocketAddress; /** * A set of sample processes. * * @author nuno */ public class ProcessSet implements Serializable { private static final long serialVersionUID = -8520712350015155147L; SampleProcess[] processes; private int self; /** * Constructor of the class. * * @param n * number of processes. */ public ProcessSet(int n) { processes = new SampleProcess[n]; } /** * */ public ProcessSet() { processes = new SampleProcess[0]; } /** * Gets an array with all processes. * * @return Array with all processes */ public SampleProcess[] getAllProcesses() { return processes; } /** * Gets the number of processes. * * @return number of processes */ public int getSize() { return processes.length; } /** * Gets the rank of the specified process. * * @param addr * the address of the process * @return the rank of the process */ public int getRank(SocketAddress addr) { for (int i = 0; i < processes.length; i++) { if ((processes[i] != null) && processes[i].getSocketAddress().equals(addr)) return i; } return -1; } /** * Adds a process into the process set. * * @param process * the process to add. * @param pr * the rank of the process. */ public void addProcess(SampleProcess process, int pr) { if (pr >= processes.length) { SampleProcess[] temp = new SampleProcess[processes.length + 1]; for (int i = 0; i < processes.length; i++) temp[i] = processes[i]; processes = temp; } processes[pr] = process; if (process.isSelf()) self = pr; } /** * Sets the process specified by the rank "proc" to correct or crashed. * * @param proc * the process rank. * @param correct * true if the process is correct, false if the process crashed. */ public void setCorrect(int proc, boolean correct) { processes[proc].setCorrect(correct); } /** * Gets the process with rank "i" * * @param i * the process rank * @return the process */ public SampleProcess getProcess(int i) { return processes[i]; } /** * Gets the process with address "addr". * * @param addr * the process address * @return the process. */ public SampleProcess getProcess(SocketAddress addr) { int i = getRank(addr); if (i == -1) return null; else return processes[i]; } /** * Gets the self rank. * * @return My rank */ public int getSelfRank() { return self; } /** * Gets the self process. * * @return My process */ public SampleProcess getSelfProcess() { return processes[self]; } /** * Clones the process set. * * @return a clone of the process set. */ public ProcessSet cloneProcessSet() { ProcessSet set = new ProcessSet(getSize()); SampleProcess[] procs = getAllProcesses(); for (int i = 0; i < procs.length; i++) set.addProcess(procs[i].cloneProcess(), i); set.self = self; return set; } }
p158276/vanilladb-comm
src/vanilladbcomm/vanillacomm/protocols/utils/ProcessSet.java
Java
apache-2.0
4,742
if(CMAKE_VERSION VERSION_GREATER 2.8.7 AND NOT POLICY CMP0045 # XXX ignore warning 'get_target_property() called with non-existent target' ) include(CMakeExpandImportedTargets) else() include(${CMAKE_SOURCE_DIR}/cmake/CMakeExpandImportedTargets.cmake) endif() macro(python_platform_test var description srcfile invert) if(NOT DEFINED "${var}_COMPILED") message(STATUS "${description}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${var} ${CMAKE_REQUIRED_FLAGS}") if(CMAKE_REQUIRED_LIBRARIES) # this one translates potentially used imported library targets to their files on disk CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") else() set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) endif() if(CMAKE_REQUIRED_INCLUDES) set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") else() set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) endif() try_compile(${var}_COMPILED ${CMAKE_CURRENT_BINARY_DIR} ${srcfile} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" # OUTPUT_VARIABLE OUTPUT # Do NOT use to make cross-compiling easier ) if(${invert} MATCHES INVERT) if(${var}_COMPILED) message(STATUS "${description} - no") else(${var}_COMPILED) message(STATUS "${description} - yes") endif(${var}_COMPILED) else() if(${var}_COMPILED) message(STATUS "${description} - yes") else() message(STATUS "${description} - no") endif() endif() endif() if(${invert} MATCHES INVERT) if(${var}_COMPILED) SET(${var} 0) else() SET(${var} 1) endif() else() if(${var}_COMPILED) SET(${var} 1) else() SET(${var} 0) endif() endif() endmacro() macro(python_platform_test_run var description srcfile invert) if(NOT DEFINED "${var}") message(STATUS "${description}") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${var} ${CMAKE_REQUIRED_FLAGS}") if(CMAKE_REQUIRED_LIBRARIES) # this one translates potentially used imported library targets to their files on disk CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") else() set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) endif() if(CMAKE_REQUIRED_INCLUDES) set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") else() set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) endif() try_run(${var} ${var}_COMPILED ${CMAKE_CURRENT_BINARY_DIR} ${srcfile} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" # OUTPUT_VARIABLE OUTPUT # Do NOT use to make cross-compiling easier ) # Note that ${var} will be a 0 return value on success. if(NOT ${var}_COMPILED) set(${var} -1 CACHE INTERNAL "${description} failed to compile.") endif() if(${invert} MATCHES INVERT) if(${var}_COMPILED) if(${var}) message(STATUS "${description} - yes") else() message(STATUS "${description} - no") endif() else() message(STATUS "${description} - failed to compile") endif() else() if(${var}_COMPILED) if(${var}) message(STATUS "${description} - no") else() message(STATUS "${description} - yes") endif(${var}) else() message(STATUS "${description} - failed to compile") endif() endif() endif() if(${invert} MATCHES INVERT) if(${var}_COMPILED) if(${var}) SET(${var} 1) else() SET(${var} 0) endif() else() SET(${var} 1) endif() else() if(${var}_COMPILED) if(${var}) SET(${var} 0) else() SET(${var} 1) endif() else() SET(${var} 0) endif() endif() endmacro()
chuckatkins/python-cmake-buildsystem
cmake/PlatformTest.cmake
CMake
apache-2.0
4,733
package ru.shestakov.start; import ru.shestakov.models.Shop; import ru.shestakov.models.Trash; import ru.shestakov.models.Warehouse; public class Trade { public Warehouse[] warehouses = new Warehouse[10]; public Shop[] shops = new Shop[10]; public Trash[] trashes = new Trash[10]; public Warehouse[] getWarehouses() { return warehouses; } public Shop[] getShops() { return shops; } public Trash[] getTrashes() { return trashes; } }
savspit/java-a-to-z
Part III. Chapter 3. LSP/TradePart2/src/main/java/ru/shestakov/start/Trade.java
Java
apache-2.0
500
package com.twitter.finagle.http.service import org.jboss.netty.channel.local._ import org.jboss.netty.channel._ import org.jboss.netty.bootstrap.ServerBootstrap import com.twitter.util.TimeConversions._ import com.twitter.util.{Await, Throw, Try} import com.twitter.finagle.builder.ClientBuilder import com.twitter.finagle.http.{Http, Request, Response, Version, Method} import com.twitter.finagle.ChannelClosedException import org.junit.runner.RunWith import org.scalatest.FunSuite import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) class ClientTest extends FunSuite { def withServer(handler: ChannelHandler)(spec: ClientBuilder.Complete[Request, Response] => Unit) { val cf = new DefaultLocalServerChannelFactory() val bs = new ServerBootstrap(cf) bs.setPipelineFactory(new ChannelPipelineFactory { def getPipeline = { val pipeline = Channels.pipeline() pipeline.addLast("theHandler", handler) pipeline } }) val serverAddress = new LocalAddress("server") val serverChannel = bs.bind(serverAddress) val builder = ClientBuilder() .channelFactory(new DefaultLocalClientChannelFactory) .hosts(Seq(serverAddress)) .hostConnectionLimit(1) .codec(Http()) try { spec(builder) } finally { serverChannel.close().awaitUninterruptibly() } } var counter = 0 lazy val closingHandler = new SimpleChannelUpstreamHandler { override def messageReceived(ctx: ChannelHandlerContext, e: MessageEvent) { counter += 1 Channels.close(ctx.getChannel) } } test("report a closed connection when the server doesn't reply") { withServer(closingHandler) { clientBuilder => counter = 0 val client = clientBuilder.build() try { // No failures have happened yet. assert(client.isAvailable == true) val future = client(Request(Version.Http11, Method.Get, "/")) val resolved = Try(Await.result(future, 1.second)) assert(resolved.isThrow == true) val Throw(cause) = resolved intercept[ChannelClosedException] {throw cause} } finally client.close() } } test("report a closed connection when the server doesn't reply, without retrying") { withServer(closingHandler) { clientBuilder => counter = 0 val client = clientBuilder .retries(10) .build() try { val future = client(Request(Version.Http11, Method.Get, "/")) val resolved = Try(Await.result(future, 1.second)) assert(resolved.isThrow == true) val Throw(cause) = resolved intercept[ChannelClosedException] {throw cause} assert(counter == 1) } finally client.close() } } }
liamstewart/finagle
finagle-http/src/test/scala/com/twitter/finagle/http/service/ClientTest.scala
Scala
apache-2.0
2,769
require 'test_helper' class ScriptLevelTest < ActiveSupport::TestCase include Rails.application.routes.url_helpers def setup @script_level = create(:script_level) @script_level2 = create(:script_level) @stage = create(:stage) @stage2 = create(:stage) end test "setup should work" do assert_not_nil @script_level.script assert_not_nil @script_level.level end test "should get position when assigned to stage" do @script_level.update(stage: @stage) @script_level.move_to_bottom assert_equal 1, @script_level.position end test "should destroy when related level is destroyed" do @script_level = create(:script_level) @script_level.level.destroy assert_not ScriptLevel.exists?(@script_level.id) end test "destroying should not destroy related level" do @script_level = create(:script_level) level = @script_level.level @script_level.destroy assert Level.exists?(level.id) end test 'counts puzzle position and total in stage' do # default script sl = Script.twenty_hour_script.script_levels[1] assert_equal 1, sl.position assert_equal 20, sl.stage_total # new script sl = create(:script_level) sl2 = create(:script_level, stage: sl.stage, script: sl.script) assert_equal 1, sl.position assert_equal 2, sl.stage_total assert_equal 2, sl2.position assert_equal 2, sl2.stage_total end test 'summarize with default route' do sl = create(:script_level) sl2 = create(:script_level, stage: sl.stage, script: sl.script) summary = sl.summarize assert_match Regexp.new("^#{root_url.chomp('/')}/s/bogus_script_[0-9]+/stage/1/puzzle/1$"), summary[:url] assert_equal false, summary[:previous] assert_equal 1, summary[:position] assert_equal 'puzzle', summary[:kind] assert_equal 1, summary[:title] summary = sl2.summarize assert_match Regexp.new("^#{root_url.chomp('/')}/s/bogus_script_[0-9]+/stage/1/puzzle/2$"), summary[:url] assert_equal false, summary[:next] assert_equal 2, summary[:position] assert_equal 'puzzle', summary[:kind] assert_equal 2, summary[:title] end test 'summarize with custom route' do summary = Script.hoc_2014_script.script_levels.first.summarize assert_equal "#{root_url.chomp('/')}/hoc/1", summary[:url] # Make sure we use the canonical /hoc/1 URL. assert_equal false, summary[:previous] assert_equal 1, summary[:position] assert_equal 'puzzle', summary[:kind] assert_equal 1, summary[:title] end test 'calling next_level when next level is unplugged skips the level for script without stages' do last_20h_maze_1_level = ScriptLevel.find_by(level: Level.find_by_level_num('2_19'), script_id: 1) first_20h_artist_1_level = ScriptLevel.find_by(level: Level.find_by_level_num('1_1'), script_id: 1) assert_equal first_20h_artist_1_level, last_20h_maze_1_level.next_progression_level end test 'calling next_level when next level is not unplugged does not skip the level for script without stages' do first_20h_artist_1_level = ScriptLevel.find_by(level: Level.find_by_level_num('1_1'), script_id: 1) second_20h_artist_1_level = ScriptLevel.find_by(level: Level.find_by_level_num('1_2'), script_id: 1) assert_equal second_20h_artist_1_level, first_20h_artist_1_level.next_progression_level end test 'calling next_level when next level is unplugged skips the level' do script = create(:script, name: 's1') stage = create(:stage, script: script, position: 1) script_level_first = create(:script_level, script: script, stage: stage, position: 1) create(:script_level, level: create(:unplugged), script: script, stage: stage, position: 2) script_level_after = create(:script_level, script: script, stage: stage, position: 3) assert_equal script_level_after, script_level_first.next_progression_level end test 'calling next_level when next level is unplugged skips the entire unplugged stage' do script = create(:script, name: 's1') first_stage = create(:stage, script: script, position: 1) script_level_first = create(:script_level, script: script, stage: first_stage, position: 1, chapter: 1) unplugged_stage = create(:stage, script: script, position: 2) create(:script_level, level: create(:unplugged), script: script, stage: unplugged_stage, position: 1, chapter: 2) create(:script_level, level: create(:match), script: script, stage: unplugged_stage, position: 2, chapter: 3) create(:script_level, level: create(:match), script: script, stage: unplugged_stage, position: 3, chapter: 4) plugged_stage = create(:stage, script: script, position: 3) script_level_after = create(:script_level, script: script, stage: plugged_stage, position: 1, chapter: 5) # make sure everything is in the order we want it to be script.reload assert_equal [first_stage, unplugged_stage, plugged_stage], script.stages assert_equal script_level_first, script.script_levels.first assert_equal script_level_after, script.script_levels.last assert_equal script_level_after, script_level_first.next_progression_level end test 'calling next_level on an unplugged level works' do script = create(:script, name: 's1') stage = create(:stage, script: script, position: 1) script_level_unplugged = create(:script_level, level: create(:unplugged), script: script, stage: stage, position: 1, chapter: 1) script_level_after = create(:script_level, script: script, stage: stage, position: 2, chapter: 2) assert_equal script_level_after, script_level_unplugged.next_level end test 'end of stage' do script = Script.find_by_name('course1') assert script.stages[0].script_levels.last.end_of_stage? assert script.stages[1].script_levels.last.end_of_stage? assert script.stages[2].script_levels.last.end_of_stage? assert script.stages[3].script_levels.last.end_of_stage? assert !script.stages[3].script_levels.first.end_of_stage? assert !script.stages[3].script_levels[1].end_of_stage? end test 'cached_find' do script_level = ScriptLevel.cache_find(Script.twenty_hour_script.script_levels[0].id) assert_equal(Script.twenty_hour_script.script_levels[0], script_level) script_level2 = ScriptLevel.cache_find(Script.course1_script.script_levels.last.id) assert_equal(Script.course1_script.script_levels.last, script_level2) # Make sure that we can also locate a newly created level. script_level3 = create(:script_level) assert_equal(script_level3, ScriptLevel.cache_find(script_level3.id)) end end
rvarshney/code-dot-org
dashboard/test/models/script_level_test.rb
Ruby
apache-2.0
6,628
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.hyracks.control.nc.result; import java.nio.ByteBuffer; import org.apache.hyracks.api.comm.IFrameWriter; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.exceptions.HyracksException; import org.apache.hyracks.api.io.IWorkspaceFileFactory; import org.apache.hyracks.api.job.JobId; import org.apache.hyracks.api.partitions.ResultSetPartitionId; import org.apache.hyracks.api.result.IResultMetadata; import org.apache.hyracks.api.result.IResultPartitionManager; import org.apache.hyracks.api.result.ResultSetId; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class ResultPartitionWriter implements IFrameWriter { private static final Logger LOGGER = LogManager.getLogger(); private final IResultPartitionManager manager; private final JobId jobId; private final ResultSetId resultSetId; private final IResultMetadata metadata; private final int partition; private final int nPartitions; private final ResultMemoryManager resultMemoryManager; private final ResultSetPartitionId resultSetPartitionId; private final ResultState resultState; private boolean partitionRegistered; private boolean failed = false; public ResultPartitionWriter(IHyracksTaskContext ctx, IResultPartitionManager manager, JobId jobId, ResultSetId rsId, boolean asyncMode, IResultMetadata metadata, int partition, int nPartitions, ResultMemoryManager resultMemoryManager, IWorkspaceFileFactory fileFactory, long maxReads) { this.manager = manager; this.jobId = jobId; this.resultSetId = rsId; this.metadata = metadata; this.partition = partition; this.nPartitions = nPartitions; this.resultMemoryManager = resultMemoryManager; resultSetPartitionId = new ResultSetPartitionId(jobId, rsId, partition); resultState = new ResultState(resultSetPartitionId, asyncMode, ctx.getIoManager(), fileFactory, ctx.getInitialFrameSize(), maxReads); } public ResultState getResultState() { return resultState; } @Override public void open() { if (LOGGER.isTraceEnabled()) { LOGGER.trace("open(" + partition + ")"); } partitionRegistered = false; resultState.open(); } @Override public void nextFrame(ByteBuffer buffer) throws HyracksDataException { registerResultPartitionLocation(false); if (resultMemoryManager == null) { resultState.write(buffer); } else { resultState.write(resultMemoryManager, buffer); } } @Override public void fail() throws HyracksDataException { failed = true; resultState.closeAndDelete(); resultState.abort(); } @Override public void close() throws HyracksDataException { if (LOGGER.isTraceEnabled()) { LOGGER.trace("close(" + partition + ")"); } try { if (!failed) { registerResultPartitionLocation(true); } } finally { resultState.close(); } try { if (partitionRegistered) { manager.reportPartitionWriteCompletion(jobId, resultSetId, partition); } } catch (HyracksException e) { throw HyracksDataException.create(e); } } void registerResultPartitionLocation(boolean empty) throws HyracksDataException { try { if (!partitionRegistered) { manager.registerResultPartitionLocation(jobId, resultSetId, partition, nPartitions, metadata, empty); partitionRegistered = true; } } catch (HyracksException e) { throw HyracksDataException.create(e); } } }
apache/incubator-asterixdb
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/result/ResultPartitionWriter.java
Java
apache-2.0
4,756
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.pinot.controller.api.resources; public final class SuccessResponse { private final String _status; public SuccessResponse(String status) { _status = status; } public String getStatus() { return _status; } }
linkedin/pinot
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/SuccessResponse.java
Java
apache-2.0
1,056
package com.example.contactplusgroup.adapter; import android.content.Context; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.example.contactplusgroup.common.Comman; import com.example.contactplusgroup.common.ContactBean; import com.example.contactplusgroup.utils.ManagerTypeface; import com.mityung.contactdirectory.R; import java.util.ArrayList; public class AddToContactAdapter extends ArrayAdapter<ContactBean> { Context context; ArrayList<ContactBean> data = null; Comman comman = null; // declare the color generator and drawable builder /** * Contracter of this class * @param ncontext take input of this class * @param resource take input of related layout of this view * @param dataList take input of DataList to be show */ public AddToContactAdapter(Context ncontext, int resource, ArrayList<ContactBean> dataList) { super(ncontext, resource,dataList); // TODO Auto-generated constructor stub context = ncontext; data = dataList; comman = new Comman(); } class ViewHolder { TextView txtName, txtNum, txtemail; } /** * Main mathod used to display view in list */ @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder viewHolder = null; LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ContactBean tb = data.get(position); if(convertView == null){ viewHolder = new ViewHolder(); convertView = inflate.inflate(R.layout.addtocontact_item, null); viewHolder.txtName = (TextView)convertView.findViewById(R.id.txtContactName); viewHolder.txtNum = (TextView)convertView.findViewById(R.id.txtContactNumber); viewHolder.txtemail = (TextView)convertView.findViewById(R.id.txtContactEmail); viewHolder.txtName.setTypeface(ManagerTypeface.getTypeface(context, R.string.typeface_roboto_regular)); viewHolder.txtNum.setTypeface(ManagerTypeface.getTypeface(context, R.string.typeface_roboto_regular)); viewHolder.txtemail.setTypeface(ManagerTypeface.getTypeface(context, R.string.typeface_roboto_regular)); convertView.setTag(viewHolder); }else{ viewHolder = (ViewHolder)convertView.getTag(); } viewHolder.txtName.setText(Html.fromHtml(tb.getName())); String number = tb.getNumber(); StringBuffer sbNum = new StringBuffer(); if(number != null ){ if(number.length() != 0){ if(!number.equalsIgnoreCase("null")){ ArrayList<String> num = comman.splitString(number, "\\#"); for (String numberuser : num){ sbNum.append("\nNumber :"+numberuser); } viewHolder.txtNum.setText(sbNum); }else{ viewHolder.txtNum.setVisibility(View.GONE); } }else{ viewHolder.txtNum.setVisibility(View.GONE); } }else{ viewHolder.txtNum.setVisibility(View.GONE); } String emailId = tb.getEmail(); StringBuffer sb = new StringBuffer(); if(emailId != null ){ if(emailId.length() != 0){ if(!emailId.equalsIgnoreCase("null")){ ArrayList<String> email = comman.splitString(emailId, "\\#"); for (String emailID : email){ sb.append("\nEmail :"+emailID); } viewHolder.txtemail.setText(sb); }else{ viewHolder.txtemail.setVisibility(View.GONE); } }else{ viewHolder.txtemail.setVisibility(View.GONE); } }else{ viewHolder.txtemail.setVisibility(View.GONE); } return convertView; } }
mityung/XERUNG
Andriod/Xerung/Xerung/src/main/java/com/example/contactplusgroup/adapter/AddToContactAdapter.java
Java
apache-2.0
3,570
package com.example.charmer.moving.utils; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Rect; import android.util.DisplayMetrics; import android.view.View; import android.view.Window; import android.view.WindowManager; /** * 获得屏幕相关的辅助类 * * @author Phoenix * @date 2016-10-8 13:51 */ public class ScreenUtil { private ScreenUtil() {} /** * 获得屏幕宽度 * * @param context * @return */ public static int getScreenWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } /** * 获得屏幕高度 * * @param context * @return */ public static int getScreenHeight(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } /** * 获得状态栏的高度 * * @param context * @return */ public static int getStatusHeight(Context context) { int statusHeight = -1; try { Class<?> clazz = Class.forName("com.android.internal.R$dimen"); Object object = clazz.newInstance(); int height = Integer.parseInt(clazz.getField("status_bar_height").get(object).toString()); statusHeight = context.getResources().getDimensionPixelSize(height); } catch (Exception e) { e.printStackTrace(); } return statusHeight; } /** * 获得状态栏的高度 * * @param context * @return */ public static int getStatusBarHeight(Context context) { int result = 0; int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = context.getResources().getDimensionPixelSize(resourceId); } return result; } /** * 控制窗口背景的不透明度 * @param activity 上下文 * @param alpha 不透明度 */ public static void setWindowBackgroundAlpha(Activity activity, float alpha) { Window window = activity.getWindow(); WindowManager.LayoutParams layoutParams = window.getAttributes(); layoutParams.alpha = alpha; window.setAttributes(layoutParams); } /** * 获取状态栏高度+标题栏高度 * @param activity */ public static int getTopBarHeight(Activity activity) { return activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop(); } /** * 判断屏幕横屏/竖屏 * @param context * @return 返回true表示:横屏;返回false表示:竖屏 */ public static boolean isScreenOrientation(Context context) { //获取设置的配置信息 Configuration config = context.getResources().getConfiguration(); return (config.orientation == Configuration.ORIENTATION_LANDSCAPE) ? true : false; } /** * 获取当前屏幕截图,包含状态栏 * * @param activity * @return */ public static Bitmap snapShotWithStatusBar(Activity activity) { View view = activity.getWindow().getDecorView(); view.setDrawingCacheEnabled(true); view.buildDrawingCache(); Bitmap bmp = view.getDrawingCache(); int width = getScreenWidth(activity); int height = getScreenHeight(activity); Bitmap bp = null; bp = Bitmap.createBitmap(bmp, 0, 0, width, height); view.destroyDrawingCache(); return bp; } /** * 获取当前屏幕截图,不包含状态栏 * * @param activity * @return */ public static Bitmap snapShotWithoutStatusBar(Activity activity) { View view = activity.getWindow().getDecorView(); view.setDrawingCacheEnabled(true); view.buildDrawingCache(); Bitmap bmp = view.getDrawingCache(); Rect frame = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusBarHeight = frame.top; int width = getScreenWidth(activity); int height = getScreenHeight(activity); Bitmap bp = null; bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height - statusBarHeight); view.destroyDrawingCache(); return bp; } }
hellcharmer/REMOVING
app/src/main/java/com/example/charmer/moving/utils/ScreenUtil.java
Java
apache-2.0
4,255
/** * Copyright (C) 2012 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jbpm.formModeler.components.editor; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.jbpm.formModeler.api.model.FieldType; import org.jbpm.formModeler.core.config.FieldTypeManager; import org.jbpm.formModeler.core.processing.formRendering.FieldI18nResourceObtainer; import org.jbpm.formModeler.service.bb.mvc.taglib.formatter.Formatter; import org.slf4j.Logger; import org.jbpm.formModeler.service.bb.mvc.taglib.formatter.FormatterException; import org.jbpm.formModeler.api.model.Field; import org.jbpm.formModeler.api.model.Form; import org.slf4j.LoggerFactory; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Named("FieldEditionFormatter") public class FieldEditionFormatter extends Formatter { private Logger log = LoggerFactory.getLogger(FieldEditionFormatter.class); @Inject private FieldTypeManager fieldTypeManager; @Inject private WysiwygFormEditor wysiwygFormEditor; @Inject protected FieldI18nResourceObtainer fieldI18nResourceObtainer; private List<String> htmlEditorFields = new ArrayList<String>( ); @PostConstruct protected void init() { htmlEditorFields.add( "HTMLLabel" ); } public void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws FormatterException { try { Field field = wysiwygFormEditor.getCurrentEditField(); if (field == null) return; Form formToEdit = wysiwygFormEditor.getFormForFieldEdition(field); if (formToEdit != null) renderFieldUsingForm(field, formToEdit); } catch (Exception e) { log.error("Error:", e); } } protected void renderFieldUsingForm(Field field, Form formToEdit) throws Exception { String fieldName = field.getFieldName(); boolean isDecorator = field.getFieldName().startsWith(":"); if (isDecorator) fieldName = "{" + fieldName + "}"; String label = fieldI18nResourceObtainer.getFieldLabel(field); if(StringUtils.isEmpty(label)){ fieldName = label; } setAttribute("fieldName", fieldName); setAttribute("isDecorator", isDecorator); renderFragment("outputStart"); setAttribute("namespace", getParameter("namespace")); setAttribute("form", formToEdit); setAttribute("editClass", Field.class.getName()); setAttribute("editId", field.getId()); FieldType type = field.getFieldType(); String memoryType = getFieldTypeToView(); if (memoryType != null) { type = fieldTypeManager.getTypeByCode(memoryType); } setAttribute("fieldType", type); renderFragment("fieldCustomForm"); if (htmlEditorFields.contains( wysiwygFormEditor.getCurrentEditField().getFieldType().getCode() )) renderFragment( "outputApplyButton" ); setAttribute("fieldName", wysiwygFormEditor.getChangedField()); renderFragment("outputEnd"); } protected String getFieldTypeToView() { return wysiwygFormEditor.getFieldTypeToView(); } }
etirelli/jbpm-form-modeler
jbpm-form-modeler-core/jbpm-form-modeler-service/jbpm-form-modeler-form-editor/src/main/java/org/jbpm/formModeler/components/editor/FieldEditionFormatter.java
Java
apache-2.0
3,911
/* * Copyright 2022 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.thoughtworks.go.plugin.access; import com.thoughtworks.go.plugin.infra.PluginPostLoadHook; import com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Arrays; import java.util.Collections; import java.util.stream.Collectors; import java.util.stream.Stream; import static com.thoughtworks.go.plugin.domain.common.PluginConstants.AUTHORIZATION_EXTENSION; import static com.thoughtworks.go.plugin.domain.common.PluginConstants.ELASTIC_AGENT_EXTENSION; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class PluginExtensionsAndVersionValidatorImplTest { private static final String PLUGIN_ID = "Some-Plugin-Id"; @Mock(lenient = true) private ExtensionsRegistry extensionsRegistry; @Mock(lenient = true) private GoPluginDescriptor descriptor; private PluginExtensionsAndVersionValidatorImpl pluginExtensionsAndVersionValidator; @BeforeEach void setUp() { when(descriptor.id()).thenReturn(PLUGIN_ID); when(extensionsRegistry.allRegisteredExtensions()) .thenReturn(Stream.of(ELASTIC_AGENT_EXTENSION, AUTHORIZATION_EXTENSION).collect(Collectors.toSet())); when(extensionsRegistry.gocdSupportedExtensionVersions(ELASTIC_AGENT_EXTENSION)) .thenReturn(Arrays.asList("1.0", "2.0")); when(extensionsRegistry.gocdSupportedExtensionVersions(AUTHORIZATION_EXTENSION)) .thenReturn(singletonList("2.0")); pluginExtensionsAndVersionValidator = new PluginExtensionsAndVersionValidatorImpl(extensionsRegistry); } @Test void shouldNotAddErrorOnSuccessfulValidation() { final PluginPostLoadHook.Result validationResult = pluginExtensionsAndVersionValidator.run(descriptor, Collections.singletonMap(ELASTIC_AGENT_EXTENSION, singletonList("2.0"))); assertThat(validationResult.isAFailure()).isFalse(); assertThat(validationResult.getMessage()).isNull(); } @Test void shouldAddErrorAndReturnValidationResultWhenPluginRequiredExtensionIsNotSupportedByGoCD() { final PluginPostLoadHook.Result validationResult = pluginExtensionsAndVersionValidator.run(descriptor, Collections.singletonMap("some-invalid-extension", singletonList("2.0"))); assertThat(validationResult.isAFailure()).isTrue(); assertThat(validationResult.getMessage()).isEqualTo("Extension incompatibility detected between plugin(Some-Plugin-Id) and GoCD:\n" + " Extension(s) [some-invalid-extension] used by the plugin is not supported. GoCD Supported extensions are [authorization, elastic-agent]."); } @Test void shouldAddErrorAndReturnValidationResultWhenPluginRequiredExtensionVersionIsNotSupportedByGoCD() { final PluginPostLoadHook.Result validationResult = pluginExtensionsAndVersionValidator.run(descriptor, Collections.singletonMap(ELASTIC_AGENT_EXTENSION, singletonList("3.0"))); assertThat(validationResult.isAFailure()).isTrue(); assertThat(validationResult.getMessage()) .isEqualTo("Extension incompatibility detected between plugin(Some-Plugin-Id) and GoCD:\n" + " Expected elastic-agent extension version(s) [3.0] by plugin is unsupported. GoCD Supported versions are [1.0, 2.0]."); } @Test void shouldConsiderPluginValidWhenOneOfTheExtensionVersionUsedByThePluginIsSupportedByGoCD() { final PluginPostLoadHook.Result validationResult = pluginExtensionsAndVersionValidator.run(descriptor, Collections.singletonMap(ELASTIC_AGENT_EXTENSION, Arrays.asList("a.b", "2.0"))); assertThat(validationResult.isAFailure()).isFalse(); } }
Skarlso/gocd
plugin-infra/go-plugin-access/src/test/java/com/thoughtworks/go/plugin/access/PluginExtensionsAndVersionValidatorImplTest.java
Java
apache-2.0
4,591
package org.vaadin.viritin.fluency.ui; public interface FluentAbstractComponentContainer<S extends FluentAbstractComponentContainer<S>> extends FluentAbstractComponent<S>, FluentComponentContainer<S> { }
viritin/viritin
viritin/src/main/java/org/vaadin/viritin/fluency/ui/FluentAbstractComponentContainer.java
Java
apache-2.0
214