text:
package org.drools.compiler.rule.builder;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class XpathAnalysis implements Iterable<XpathAnalysis.XpathPart> {

    private final List<XpathPart> parts;

    public XpathAnalysis(List<XpathPart> parts) {
        this.parts = parts;
    }

    @Override
    public Iterator<XpathPart> iterator() {
        return parts.iterator();
    }

    public static class XpathPart {
        private final String field;
        private final boolean iterate;
        private final List<String> constraints;
        private final String inlineCast;
        private final int index;

        public XpathPart(String field, boolean iterate, List<String> constraints, String inlineCast, int index) {
            this.field = field;
            this.iterate = iterate;
            this.constraints = constraints;
            this.inlineCast = inlineCast;
            this.index = index;
        }

        public String getField() {
            return field;
        }

        public boolean isIterate() {
            return iterate;
        }

        public List<String> getConstraints() {
            return constraints;
        }

        public String getInlineCast() {
            return inlineCast;
        }

        public int getIndex() {
            return index;
        }

        public void addInlineCastConstraint(Class<?> clazz) {
            constraints.add(0, "this instanceof " + clazz.getCanonicalName());
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder( field );
            if (index >= 0) {
                sb.append( "[" ).append( index ).append( "]" );
            }
            if (!constraints.isEmpty()) {
                sb.append( "{" );
                sb.append( constraints.get(0) );
                for (int i = 1; i < constraints.size(); i++) {
                    sb.append( ", " ).append( constraints.get( i ) );
                }
                sb.append( "}" );
            }
            return sb.toString();
        }
    }

    public static XpathAnalysis analyze(String xpath) {
        if (xpath.charAt(0) != '/') return null;

        boolean iterate = true;
        List<XpathPart> parts = new ArrayList<XpathPart>();

        List<String> constraints = new ArrayList<String>();
        String inlineCast = null;
        int index = -1;

        int lastStart = 1;
        int nestedParam = 0;
        int nestedCurly = 0;
        int nestedSquare = 0;
        boolean isQuoted = false;
        String field = null;

        for (int i = 1; i < xpath.length(); i++) {
            switch (xpath.charAt(i)) {
                case '/':
                case '.':
                    if (!isQuoted && nestedParam == 0 && nestedCurly == 0 && nestedSquare == 0) {
                        if (field == null) {
                            field = xpath.substring(lastStart, i).trim();
                        }
                        parts.add(new XpathPart(field, iterate, constraints, inlineCast, index));

                        iterate = xpath.charAt(i) == '/';
                        constraints = new ArrayList<String>();
                        inlineCast = null;
                        index = -1;
                        lastStart = i + 1;
                        field = null;
                    }
                    break;
                case '(':
                    if (!isQuoted) {
                        nestedParam++;
                    }
                    break;
                case ')':
                    if (!isQuoted) {
                        nestedParam--;
                        if (nestedParam < 0) {
                            return null;
                        }
                    }
                    break;
                case '[':
                    if (!isQuoted && nestedParam == 0 && nestedCurly == 0) {
                        if (nestedSquare == 0) {
                            if (field == null) {
                                field = xpath.substring( lastStart, i ).trim();
                            }
                            lastStart = i+1;
                        }
                        nestedSquare++;
                    }
                    break;
                case ']':
                    if (!isQuoted && nestedParam == 0 && nestedCurly == 0) {
                        nestedSquare--;
                        if (nestedSquare == 0) {
                            try {
                                index = Integer.parseInt( xpath.substring( lastStart, i ).trim() );
                            } catch (Exception e) {
                                return null;
                            }
                        } else if (nestedSquare < 0) {
                            return null;
                        }
                    }
                    break;
                case '{':
                    if (!isQuoted && nestedParam == 0 && nestedSquare == 0) {
                        if (nestedCurly == 0) {
                            if (field == null) {
                                field = xpath.substring( lastStart, i ).trim();
                            }
                            lastStart = i+1;
                        }
                        nestedCurly++;
                    }
                    break;
                case '}':
                    if (!isQuoted && nestedParam == 0 && nestedSquare == 0) {
                        nestedCurly--;
                        if (nestedCurly == 0) {
                            String constraint = xpath.substring(lastStart, i).trim();
                            if (constraint.startsWith("#")) {
                                inlineCast = constraint.substring(1);
                            } else {
                                constraints.add(constraint);
                            }
                        } else if (nestedCurly < 0) {
                            return null;
                        }
                    }
                    break;
                case ',':
                    if (!isQuoted && nestedParam == 0 && nestedCurly == 1) {
                        String constraint = xpath.substring(lastStart, i).trim();
                        if (constraint.startsWith("#")) {
                            inlineCast = constraint.substring(1);
                        } else {
                            constraints.add(constraint);
                        }
                        lastStart = i+1;
                    }
                    break;
                case '"':
                case '\'':
                    isQuoted = !isQuoted;
                    break;
            }
        }

        if (field == null) {
            field = xpath.substring(lastStart).trim();
        }
        parts.add(new XpathPart(field, iterate, constraints, inlineCast, index));

        return new XpathAnalysis(parts);
    }
}


text:
export class StorageService {
    public static TOKEN: string = "aurelia_token";
    public static USER: string = "aurelia_user";

    public clear(): void {
        localStorage.clear();
    }

    public has(key: string): boolean {
        return localStorage.getItem(key) !== undefined;
    }

    public get<T>(key: string): T | undefined {
        let item = localStorage.getItem(key);
        let json;
        try {
            json = JSON.parse(item) as T;
        } catch (error) {
            json = item;
        }
        return (!item) ? undefined : json;
    }

    public key(index: number): string {
        return localStorage.key(index) as string;
    }

    public remove(key: string): void {
        return localStorage.removeItem(key);
    }

    public set(key: string, data: string): void {
        localStorage.setItem(key, JSON.stringify(data));
    }
}

redpajama_set_name: RedPajamaGithub


text:
<resources>

    <!-- Base application theme. -->

    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"/>

    <style name="AppTheme" parent="AppTheme.Base">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimary</item>
        <item name="colorAccent">@color/colorAccent</item>

    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

    <style name="DrawerView">
        <item name="android:layout_width">match_parent</item>
        <item name ="android:layout_height">@dimen/navigation_drawer_item_height</item>

        <item name="android:background">@drawable/drawer_item_background</item>
    </style>
    <style name="DrawerIcon">
        <item name="android:layout_width">24dp</item>
        <item name ="android:layout_height">24dp</item>
        <item name="android:layout_centerVertical">true</item>
        <item name="android:layout_marginLeft">16dp</item>
        <item name="android:scaleType">fitXY</item>
    </style>
    <style name="DrawerTextView">
        <item name="android:layout_width">match_parent</item>
        <item name ="android:layout_height">wrap_content</item>
        <item name="android:layout_centerVertical">true</item>
        <item name="android:layout_marginLeft">72dp</item>
        <item name="android:textColor">@drawable/drawer_text_color</item>
        <item name="android:textSize">16sp</item>
    </style>

    <style name="MyToolbarTextStyle" parent="@android:style/TextAppearance.DeviceDefault">
        <item name="android:textSize">18sp</item>
    </style>

    <style name="AppTheme.TransparentActivity" parent="AppTheme.NoActionBar">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowIsTranslucent">true</item>
    </style>

    <style name="AboutToolbarTextStyle" parent="@android:style/TextAppearance.DeviceDefault">
        <item name="android:textSize">16sp</item>
        <item name="android:textColor">@android:color/transparent</item>
    </style>

</resources>


text:
PoshWix is an opinionated and trivially simple tool to produce MSI packages from PowerShell modules

# Getting started

Ensure the WIX toolset is installed (see http://wixtoolset.org/)

Install the PoshWix module and, in a PowerShell module source directory create
a WIX specification with the same name as your module (for instance `FooBar.wxs`). You can use
the current module's `PoshWix.wxs` file as a sample (juste ensure you change the
UpgradeCode to something else). Then execute:

    Write-WixModulePackage

You should get a nice MSI that will install your module in `C:\Windows\system32\WindowsPowerShell\v1.0\Modules`

# Documentation

    help Write-WixModulePackage

# TODO

1. Validate version number format to allow for smooth upgrades.

# Disclaimer

This is a work in progress. It is provided without warranty,
even the implied warranty of merchantability, satisfaction or
fitness for a particular use.


text:
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.components.messages;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withChild;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import androidx.test.filters.MediumTest;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

import org.chromium.base.test.BaseActivityTestRule;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.components.browser_ui.widget.listmenu.ListMenuButton.PopupMenuShownListener;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.ui.modelutil.PropertyModel;
import org.chromium.ui.modelutil.PropertyModelChangeProcessor;
import org.chromium.ui.test.util.BlankUiTestActivity;
import org.chromium.ui.test.util.DisableAnimationsTestRule;

/**
 * Instrumentation tests for MessageBannerView.
 */
@RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class MessageBannerViewTest {
    private static final String SECONDARY_BUTTON_MENU_TEXT = "SecondaryActionText";

    @ClassRule
    public static DisableAnimationsTestRule sDisableAnimationsRule =
            new DisableAnimationsTestRule();

    @ClassRule
    public static BaseActivityTestRule<BlankUiTestActivity> sActivityTestRule =
            new BaseActivityTestRule<>(BlankUiTestActivity.class);

    private static Activity sActivity;
    private static ViewGroup sContentView;

    @Rule
    public MockitoRule mMockitoRule = MockitoJUnit.rule();

    @Mock
    Runnable mSecondaryActionCallback;

    MessageBannerView mMessageBannerView;

    @BeforeClass
    public static void setupSuite() {
        sActivityTestRule.launchActivity(null);
        TestThreadUtils.runOnUiThreadBlocking(() -> {
            sActivity = sActivityTestRule.getActivity();
            sContentView = new FrameLayout(sActivity);
            sActivity.setContentView(sContentView);
        });
    }

    @Before
    public void setupTest() throws Exception {
        TestThreadUtils.runOnUiThreadBlocking(() -> {
            sContentView.removeAllViews();
            mMessageBannerView = (MessageBannerView) LayoutInflater.from(sActivity).inflate(
                    R.layout.message_banner_view, sContentView, false);
            sContentView.addView(mMessageBannerView);
        });
    }

    /**
     * Tests that, when SECONDARY_BUTTON_MENU_TEXT is not specified, clicking on secondary button
     * triggers ON_SECONDARY_ACTION callback invocation.
     */
    @Test
    @MediumTest
    public void testSecondaryActionDirectCallback() {
        TestThreadUtils.runOnUiThreadBlocking(() -> {
            PropertyModel propertyModel =
                    new PropertyModel.Builder(MessageBannerProperties.ALL_KEYS)
                            .with(MessageBannerProperties.MESSAGE_IDENTIFIER,
                                    MessageIdentifier.TEST_MESSAGE)
                            .with(MessageBannerProperties.SECONDARY_ICON_RESOURCE_ID,
                                    android.R.drawable.ic_menu_add)
                            .with(MessageBannerProperties.ON_SECONDARY_BUTTON_CLICK,
                                    mSecondaryActionCallback)
                            .build();
            PropertyModelChangeProcessor.create(
                    propertyModel, mMessageBannerView, MessageBannerViewBinder::bind);
        });
        onView(withId(R.id.message_secondary_button)).perform(click());
        Mockito.verify(mSecondaryActionCallback).run();
    }

    /**
     * Tests that clicking on secondary button opens a menu with an item with
     * SECONDARY_BUTTON_MENU_TEXT. Clicking on this item triggers ON_SECONDARY_ACTION callback
     * invocation.
     */
    @Test
    @MediumTest
    public void testSecondaryActionMenu() {
        TestThreadUtils.runOnUiThreadBlocking(() -> {
            PropertyModel propertyModel =
                    new PropertyModel.Builder(MessageBannerProperties.ALL_KEYS)
                            .with(MessageBannerProperties.MESSAGE_IDENTIFIER,
                                    MessageIdentifier.TEST_MESSAGE)
                            .with(MessageBannerProperties.SECONDARY_ICON_RESOURCE_ID,
                                    android.R.drawable.ic_menu_add)
                            .with(MessageBannerProperties.SECONDARY_BUTTON_MENU_TEXT,
                                    SECONDARY_BUTTON_MENU_TEXT)
                            .with(MessageBannerProperties.ON_SECONDARY_BUTTON_CLICK,
                                    mSecondaryActionCallback)
                            .build();
            PropertyModelChangeProcessor.create(
                    propertyModel, mMessageBannerView, MessageBannerViewBinder::bind);
        });
        onView(withId(R.id.message_secondary_button)).perform(click());
        onView(withText(SECONDARY_BUTTON_MENU_TEXT)).perform(click());
        Mockito.verify(mSecondaryActionCallback).run();
    }

    /**
     * Tests that clicking on the secondary button opens a menu with an item with
     * SECONDARY_BUTTON_MENU_TEXT, the message auto-dismiss timer is cancelled at this time and the
     * message banner is shown as long as the menu is open. When the menu is dismissed, the message
     * auto-dismiss timer is (re)started with expected parameters.
     */
    @Test
    @MediumTest
    public void testSecondaryActionMenuInvokesPopupMenuEventHandlers() {
        PopupMenuShownListener listener = Mockito.spy(PopupMenuShownListener.class);
        TestThreadUtils.runOnUiThreadBlocking(() -> {
            PropertyModel propertyModel =
                    new PropertyModel.Builder(MessageBannerProperties.ALL_KEYS)
                            .with(MessageBannerProperties.MESSAGE_IDENTIFIER,
                                    MessageIdentifier.TEST_MESSAGE)
                            .with(MessageBannerProperties.SECONDARY_ICON_RESOURCE_ID,
                                    android.R.drawable.ic_menu_add)
                            .with(MessageBannerProperties.SECONDARY_BUTTON_MENU_TEXT,
                                    SECONDARY_BUTTON_MENU_TEXT)
                            .with(MessageBannerProperties.ON_SECONDARY_BUTTON_CLICK,
                                    mSecondaryActionCallback)
                            .build();
            PropertyModelChangeProcessor.create(
                    propertyModel, mMessageBannerView, MessageBannerViewBinder::bind);
            // Simulate the invocation of #setPopupMenuShownListener by the MessageBannerCoordinator
            // ctor.
            mMessageBannerView.setPopupMenuShownListener(listener);
        });

        // Click on the secondary icon to open the popup menu, verify that #onPopupMenuShown is
        // invoked.
        onView(withId(R.id.message_secondary_button)).perform(click());
        Mockito.verify(listener).onPopupMenuShown();

        // Click on the message banner view holding the popup menu to dismiss the menu, verify that
        // #onPopupMenuDismissed is invoked.
        onView(withChild(withText(SECONDARY_BUTTON_MENU_TEXT))).perform(click());
        Mockito.verify(listener).onPopupMenuDismissed();
    }
}


text:
import { Storage } from "./interface/Persistency";

class MemoryStorage implements Storage {
    public map: Record<string, any> = {};
    /**
     * MemoryStorage has the same Interface as LocalStorage and is used when persistency is disabled,
     * but the logic relies on the persistency.
     * @constructor
     */
    public constructor() {
        // do nothing
    }

    public setItem(key: string, value: any): void {
        this.map[key] = value;
    }

    public getItem(key: string): any {
        return this.map[key];
    }

    public removeItem(key: string): void {
        delete this.map[key];
    }

    public clear(): void {
        this.map = {};
    }
}

export = MemoryStorage;


text:
from nose.tools import with_setup
from GPy.models import GradientChecker
from GPy.likelihoods.noise_models import gp_transformations
import inspect
import unittest
import numpy as np

class TestTransformations(object):
    """
    Generic transformations checker
    """
    def setUp(self):
        N = 30
        self.fs = [np.random.rand(N, 1), float(np.random.rand(1))]

    def tearDown(self):
        self.fs = None

    def test_transformations(self):
        self.setUp()
        transformations = [gp_transformations.Identity(),
                           gp_transformations.Log(),
                           gp_transformations.Probit(),
                           gp_transformations.Log_ex_1(),
                           gp_transformations.Reciprocal(),
                           ]

        for transformation in transformations:
            for f in self.fs:
                yield self.t_dtransf_df, transformation, f
                yield self.t_d2transf_df2, transformation, f
                yield self.t_d3transf_df3, transformation, f

    @with_setup(setUp, tearDown)
    def t_dtransf_df(self, transformation, f):
        print "\n{}".format(inspect.stack()[0][3])
        grad = GradientChecker(transformation.transf, transformation.dtransf_df, f, 'f')
        grad.randomize()
        grad.checkgrad(verbose=1)
        assert grad.checkgrad()

    @with_setup(setUp, tearDown)
    def t_d2transf_df2(self, transformation, f):
        print "\n{}".format(inspect.stack()[0][3])
        grad = GradientChecker(transformation.dtransf_df, transformation.d2transf_df2, f, 'f')
        grad.randomize()
        grad.checkgrad(verbose=1)
        assert grad.checkgrad()

    @with_setup(setUp, tearDown)
    def t_d3transf_df3(self, transformation, f):
        print "\n{}".format(inspect.stack()[0][3])
        grad = GradientChecker(transformation.d2transf_df2, transformation.d3transf_df3, f, 'f')
        grad.randomize()
        grad.checkgrad(verbose=1)
        assert grad.checkgrad()

#if __name__ == "__main__":
    #print "Running unit tests"
    #unittest.main()


text:
import requests

job_name = 'build_helloworld'
response = requests.get('http://localhost:8080/job/{job}/config.xml'
                        .format(job=job_name))

if not response.status_code == requests.codes.ok:
    print 'Error reading job configuration: %s' % response.status_code
else:
    config = response.text

    with open('%s_config.xml' % job_name, 'w+') as config_file:
        config_file.write(config)


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
DoubleUtils.RoundingScheme (SuanShu 1.3.1 API Documentation)
</TITLE>

<META NAME="date" CONTENT="2011-04-26">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Index
      Help

                SuanShu, a Java numerical and statistical library

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD

DETAIL: ENUM CONSTANTS | FIELD | METHOD

com.numericalmethod.suanshu.number

Enum DoubleUtils.RoundingScheme

java.lang.Object
  java.lang.Enum<DoubleUtils.RoundingScheme>
      com.numericalmethod.suanshu.number.DoubleUtils.RoundingScheme

All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<DoubleUtils.RoundingScheme>

Enclosing class:
DoubleUtils

public static enum DoubleUtils.RoundingScheme
extends java.lang.Enum<DoubleUtils.RoundingScheme>

the schemes available to round a number.

Enum Constant Summary

DEFAULT

          Use the scheme as in Math.round(float).

DOWN

          Always round down.

UP

          Always round up.

Method Summary

static DoubleUtils.RoundingScheme
valueOf(java.lang.String name)

          Returns the enum constant of this type with the specified name.

static DoubleUtils.RoundingScheme[]
values()

          Returns an array containing the constants of this enum type, in
the order they are declared.

Methods inherited from class java.lang.Enum

clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Enum Constant Detail

DEFAULT

public static final DoubleUtils.RoundingScheme DEFAULT

Use the scheme as in Math.round(float). That is,
 returning the closest long to the argument.
 The result is rounded to an integer by adding 1/2, taking the floor of the result,
 and casting the result to type <tt>long</tt>.

UP

public static final DoubleUtils.RoundingScheme UP

Always round up.
 This is done by taking the ceiling of the value after subtracting a very tiny number.

DOWN

public static final DoubleUtils.RoundingScheme DOWN

Always round down.
 This is done by taking the floor of the value after adding a very tiny number.

Method Detail

values

public static DoubleUtils.RoundingScheme[] values()

Returns an array containing the constants of this enum type, in
the order they are declared.  This method may be used to iterate
over the constants as follows:

for (DoubleUtils.RoundingScheme c : DoubleUtils.RoundingScheme.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in
the order they are declared

valueOf

public static DoubleUtils.RoundingScheme valueOf(java.lang.String name)

Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type.  (Extraneous whitespace characters are
not permitted.)

Parameters:
name - the name of the enum constant to be returned.

Returns:
the enum constant with the specified name

Throws:

java.lang.IllegalArgumentException - if this enum type has no constant
with the specified name

java.lang.NullPointerException - if the argument is null

      Overview
      Package
    Class
      Tree
      Index
      Help

                SuanShu, a Java numerical and statistical library

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD

DETAIL: ENUM CONSTANTS | FIELD | METHOD

                Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.


text:
<?php

namespace CL\Slack\Tests\Payload;

use CL\Slack\Payload\UsersSetPresencePayload;
use CL\Slack\Payload\PayloadInterface;

/**
 * @author Cas Leentfaar <info@casleentfaar.com>
 */
class UsersSetPresencePayloadTest extends AbstractPayloadTest
{
    /**
     * {@inheritdoc}
     */
    protected function createPayload()
    {
        $payload = new UsersSetPresencePayload();
        $payload->setPresence('my');

        return $payload;
    }

    /**
     * {@inheritdoc}
     *
     * @param UsersSetPresencePayload $payload
     */
    protected function getExpectedPayloadData(PayloadInterface $payload)
    {
        return [
            'presence' => $payload->getPresence(),
        ];
    }
}


text:
package bssopenapi

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// TagResources invokes the bssopenapi.TagResources API synchronously
func (client *Client) TagResources(request *TagResourcesRequest) (response *TagResourcesResponse, err error) {
	response = CreateTagResourcesResponse()
	err = client.DoAction(request, response)
	return
}

// TagResourcesWithChan invokes the bssopenapi.TagResources API asynchronously
func (client *Client) TagResourcesWithChan(request *TagResourcesRequest) (<-chan *TagResourcesResponse, <-chan error) {
	responseChan := make(chan *TagResourcesResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.TagResources(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// TagResourcesWithCallback invokes the bssopenapi.TagResources API asynchronously
func (client *Client) TagResourcesWithCallback(request *TagResourcesRequest, callback func(response *TagResourcesResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *TagResourcesResponse
		var err error
		defer close(result)
		response, err = client.TagResources(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// TagResourcesRequest is the request struct for api TagResources
type TagResourcesRequest struct {
	*requests.RpcRequest
	ResourceId   *[]string          `position:"Query" name:"ResourceId"  type:"Repeated"`
	Tag          *[]TagResourcesTag `position:"Query" name:"Tag"  type:"Repeated"`
	ResourceType string             `position:"Query" name:"ResourceType"`
}

// TagResourcesTag is a repeated param struct in TagResourcesRequest
type TagResourcesTag struct {
	Value string `name:"Value"`
	Key   string `name:"Key"`
}

// TagResourcesResponse is the response struct for api TagResources
type TagResourcesResponse struct {
	*responses.BaseResponse
	Code      string `json:"Code" xml:"Code"`
	Message   string `json:"Message" xml:"Message"`
	Data      bool   `json:"Data" xml:"Data"`
	RequestId string `json:"RequestId" xml:"RequestId"`
	Success   bool   `json:"Success" xml:"Success"`
}

// CreateTagResourcesRequest creates a request to invoke TagResources API
func CreateTagResourcesRequest() (request *TagResourcesRequest) {
	request = &TagResourcesRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("BssOpenApi", "2017-12-14", "TagResources", "", "")
	request.Method = requests.POST
	return
}

// CreateTagResourcesResponse creates a response to parse from TagResources response
func CreateTagResourcesResponse() (response *TagResourcesResponse) {
	response = &TagResourcesResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
package com.intellij.projectView;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import javax.swing.ListModel;

import org.jetbrains.annotations.NonNls;
import com.intellij.ide.projectView.ViewSettings;
import com.intellij.ide.projectView.impl.AbstractProjectTreeStructure;
import com.intellij.ide.projectView.impl.ClassesTreeStructureProvider;
import com.intellij.ide.projectView.impl.nodes.PackageElementNode;
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.ProjectViewTestUtil;
import com.intellij.testFramework.TestSourceBasedTestCase;
import com.intellij.util.Function;

public abstract class BaseProjectViewTestCase extends TestSourceBasedTestCase {
  protected TestProjectTreeStructure myStructure;

  protected Queryable.PrintInfo myPrintInfo;

  @Override
  protected void setUp() throws Exception {
    super.setUp();

    myStructure = new TestProjectTreeStructure(myProject, myTestRootDisposable);
  }

  @Override
  protected void tearDown() throws Exception {
    myStructure = null;
    super.tearDown();
  }

  protected void assertStructureEqual(PsiDirectory packageDirectory, @NonNls String expected) {
    assertStructureEqual(packageDirectory, expected, 17, myStructure);
  }

  protected void assertStructureEqual(PsiDirectory packageDirectory, @NonNls String expected, int maxRowCount) {
    assertStructureEqual(packageDirectory, expected, maxRowCount, myStructure);
  }

  protected void useStandardProviders() {
    getProjectTreeStructure().setProviders(new ClassesTreeStructureProvider(myProject));
  }

  protected AbstractProjectTreeStructure getProjectTreeStructure() {
    return myStructure;
  }

  private void assertStructureEqual(PsiDirectory root, String expected, int maxRowCount, AbstractTreeStructure structure) {
    assertNotNull(root);
    PsiDirectoryNode rootNode = new PsiDirectoryNode(myProject, root, (ViewSettings)structure);
    ProjectViewTestUtil.assertStructureEqual(myStructure, expected, maxRowCount, PlatformTestUtil.createComparator(myPrintInfo), rootNode, myPrintInfo);
  }

  protected static void assertListsEqual(ListModel model, String expected) {
    assertEquals(expected, PlatformTestUtil.print(model));
  }

  public static void checkContainsMethod(final Object rootElement, final AbstractTreeStructure structure) {
    ProjectViewTestUtil.checkContainsMethod(rootElement, structure, new Function<AbstractTreeNode, VirtualFile[]>() {
      @Override
      public VirtualFile[] fun(AbstractTreeNode kid) {
        if (kid instanceof PackageElementNode) {
          return ((PackageElementNode)kid).getVirtualFiles();
        }
        return null;
      }
    });
  }

  @Override
  protected String getTestPath() {
    return "projectView";
  }

  protected static String getPackageRelativePath() {
    return "com/package1";
  }

  protected PsiDirectory getPackageDirectory() {
    return getPackageDirectory(getPackageRelativePath());
  }

  @Override
  protected String getTestDataPath() {
    return "/";
  }

  @Override
  protected boolean isRunInWriteAction() {
    return false;
  }
}


text:
#ifndef OOKIEDOKIE_FIND_H_
#define OOKIEDOKIE_FIND_H_

#include <stdio.h>

/**
 * Search for a file by name and open it if it is found
 *
 * @param[in]   open_mode   Required. fopen() mode string.
 * @param[in]   name_prefix Optional - may be NULL. Prefix to prepend to name.
 * @param[in]   name        Required. File name.
 * @param[in]   extension   Optional - may be NULL. File extension, including
 *                          dot.
 * @return file handle on success, NULL if not found (or upon failure)
 */
FILE * find_file(const char *open_mode, const char *name_prefix,
                 const char *name, const char *extension);

/**
 * Search for a device file
 *
 * @param[in]   device  Device file name, without the .json extension
 *
 * @return file handle on success, NULL if not found (or upon failure)
 */
FILE * find_device_file(const char *device);

/**
 * Search for a filter of the specified name
 *
 * @param[in]   name    Filter name, without the .filt extension
 *
 * @return file handle on success, NULL if not found (or upon failure)
 */
FILE * find_filter_file(const char *name);

#endif


text:
package org.kie.dmn.feel.runtime.functions;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.temporal.TemporalAccessor;

import org.junit.Before;
import org.junit.Test;
import org.kie.dmn.feel.runtime.events.InvalidParametersEvent;

public class DateFunctionTest {

    private DateFunction dateFunction;

    @Before
    public void setUp() {
        dateFunction = new DateFunction();
    }

    @Test
    public void invokeParamStringNull() {
        FunctionTestUtil.assertResultError(dateFunction.invoke((String) null), InvalidParametersEvent.class);
    }

    @Test
    public void invokeParamStringNotDateOrTime() {
        FunctionTestUtil.assertResultError(dateFunction.invoke("test"), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke("2017-09-test"), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke("2017-09-89"), InvalidParametersEvent.class);
    }

    @Test
    public void invokeParamStringDate() {
        FunctionTestUtil.assertResult(dateFunction.invoke("2017-09-07"), LocalDate.of(2017, 9, 7));
    }

    @Test
    public void invokeParamStringPaddingYearsDate() {
        FunctionTestUtil.assertResult(dateFunction.invoke("0001-12-31"), LocalDate.of(1, 12, 31));
        FunctionTestUtil.assertResult(dateFunction.invoke("0012-12-31"), LocalDate.of(12, 12, 31));
        FunctionTestUtil.assertResult(dateFunction.invoke("0123-12-31"), LocalDate.of(123, 12, 31));
        FunctionTestUtil.assertResult(dateFunction.invoke("1234-12-31"), LocalDate.of(1234, 12, 31));
        FunctionTestUtil.assertResultError(dateFunction.invoke("01211-12-31"), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke("012117-12-31"), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke("001211-12-31"), InvalidParametersEvent.class);
    }

    @Test
    public void invokeParamYearMonthDayNulls() {
        FunctionTestUtil.assertResultError(dateFunction.invoke(null, null, null), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(10, null, null), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(null, 10, null), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(null, null, 10), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(10, 10, null), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(10, null, 10), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(null, 10, 10), InvalidParametersEvent.class);
    }

    @Test
    public void invokeParamYearMonthDayInvalidDate() {
        FunctionTestUtil.assertResultError(dateFunction.invoke(2017, 6, 59), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(2017, 59, 12), InvalidParametersEvent.class);
        FunctionTestUtil.assertResultError(dateFunction.invoke(Integer.MAX_VALUE, 6, 12), InvalidParametersEvent.class);
    }

    @Test
    public void invokeParamYearMonthDay() {
        FunctionTestUtil.assertResult(dateFunction.invoke(2017, 6, 12), LocalDate.of(2017, 6, 12));
    }

    @Test
    public void invokeParamTemporalNull() {
        FunctionTestUtil.assertResultError(dateFunction.invoke((TemporalAccessor) null), InvalidParametersEvent.class);
    }

    @Test
    public void invokeParamTemporalWrongTemporal() {
        FunctionTestUtil.assertResultError(dateFunction.invoke(DayOfWeek.MONDAY), InvalidParametersEvent.class);
    }

    @Test
    public void invokeParamTemporal() {
        FunctionTestUtil.assertResult(dateFunction.invoke(LocalDate.of(2017, 6, 12)), LocalDate.of(2017, 6, 12));
    }
}


text:
using LiNGS.Common;
using LiNGS.Common.GameCycle;
using LiNGS.Common.GameLogic;
using LiNGS.Common.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace LiNGS.Client.Synchronization
{
    internal class Synchronizer: IUpdatable
    {
        private LiNGSClient client;
        private Dictionary<string, SynchronizedObject> SynchronizedObjects;

        internal Synchronizer(LiNGSClient client)
        {
            this.client = client;
            this.SynchronizedObjects = new Dictionary<string, SynchronizedObject>();
        }

        internal void RemoveObject(INetworkedObject networkedObject, bool deleteFromServer = true)
        {
            List<String> objectKeys = SynchronizedObjects.Where(kv => kv.Value.Object.OriginalObject == networkedObject).Select(kv => kv.Key).ToList();
            foreach (var item in objectKeys)
            {
                SynchronizedObjects.Remove(item);

                if (deleteFromServer)
                {
                    NetworkMessage networkMessage = new NetworkMessage() { NeedsAck = true, Type = NetworkMessage.MessageType.Data };
                    networkMessage.Data.Add(new MessageData() { Object = LiNGSMarkers.DestroyObject, Value = item });
                    client.Manager.SendMessage(networkMessage);
                }
            }
        }

        #region IUpdatable Members

        public void Update(TimeSpan timeSinceLastUpdate)
        {
            NetworkMessage serverMessage = new NetworkMessage(NetworkMessage.MessageType.Data);
            bool anyChange = false;

            foreach (var item in client.ClientLogicProcessor.NetworkedLocalObjects.Keys)
            {
                if (SynchronizedObjects.ContainsKey(item))
                {
                    List<String> keys = SynchronizedObjects[item].FieldsValue.Keys.ToList();
                    foreach (var key in keys)
                    {
                        FieldInfo field = client.ClientLogicProcessor.NetworkedLocalObjects[item].Fields[int.Parse(key)];
                        string fieldValue = field.GetValue(client.ClientLogicProcessor.NetworkedLocalObjects[item].OriginalObject) != null ? field.GetValue(client.ClientLogicProcessor.NetworkedLocalObjects[item].OriginalObject).ToString() : null;

                        if (SynchronizedObjects[item].FieldsValue[key] != fieldValue)
                        {
                            SynchronizedObjects[item].FieldsValue[key] = fieldValue;

                            MessageData data = new MessageData() { Object = item, Property = key, Value = SynchronizedObjects[item].FieldsValue[key] };
                            serverMessage.Data.Add(data);
                            anyChange = true;
                        }
                    }
                }
                else
                {
                    SynchronizedObjects.Add(item, new SynchronizedObject(item, client.ClientLogicProcessor.NetworkedLocalObjects[item]));

                    serverMessage.NeedsAck = true;
                    serverMessage.Data.Add(new MessageData() { Object = LiNGSMarkers.CreateObject, Property = item, Value = client.ClientLogicProcessor.NetworkedLocalObjects[item].OriginalObject.GetType().ToString() });

                    foreach (var kv in SynchronizedObjects[item].FieldsValue)
                    {
                        MessageData data = new MessageData() { Object = item, Property = kv.Key, Value = kv.Value };
                        serverMessage.Data.Add(data);
                        anyChange = true;
                    }

                }
            }

            if (anyChange)
            {
                client.Manager.SendMessage(serverMessage);
            }

        }

        #endregion

    }
}


text:
var _ = require('underscore'),
    path = require('path'),
    db = require(path.resolve(__dirname, '../../lib/db')),
    response = require(path.resolve(__dirname, 'response')),
    apitools = require(path.resolve(__dirname, '../../lib/api-tools'));

function search(parsedQuery, res) {
    db.searchQuery(parsedQuery, function(doc) {
        response.setResponse(res, doc);
    });
}

function post(data, res) {
    db.post(data, function() {
        response.setResponse(res, {message: "ok"});
    })
}

module.exports.init = function(app, apiConfig) {
    apiConfig.apis.forEach(function(api) {
        api.operations.forEach(function(apiClass) {
            if (apiClass.httpMethod === "GET") {
                app.get(apiConfig.resourcePath + api.path, function(req, res) {
                    var parameters = apiClass.parameters,
                        required = apitools.selectRequired(parameters),
                        parsedQuery = apitools.parseQuery(req.query, parameters);

                    if (required.length != 0) {
                        required.forEach(function(reqm) {
                            if (!_.contains(_.keys(parsedQuery), reqm)) {
                                response.errorResponse(res, reqm);
                            } else {
                                search(parsedQuery, res);
                            }
                        });
                    } else {
                        search(parsedQuery, res);
                    }
                });
            } else if (apiClass.httpMethod === "POST") {
                app.post(apiConfig.resourcePath + api.path, function(req, res) {
                    post(req.query, res);
                });
            }
        });
    });
}


text:
using System.Runtime.Serialization;

namespace Docker.DotNet.Models
{
    [DataContract]
    public class ContainerStatsParameters // (main.ContainerStatsParameters)
    {
        [QueryStringParameter("stream", true, typeof(BoolQueryStringConverter))]
        public bool Stream { get; set; } = true;
    }
}


text:
package com.verifalia.api.rest.security;

import com.verifalia.api.exceptions.VerifaliaException;
import com.verifalia.api.rest.RestClient;
import lombok.Getter;
import lombok.Setter;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

import java.io.IOException;

/**
 * Base class for classes which can authenticate a REST client against the Verifalia API.
 */
@Getter
@Setter
public abstract class AuthenticationProvider {
    public void decorateRequest(RestClient client, HttpRequestBase request) throws VerifaliaException {
    }

    public CloseableHttpClient buildClient(RestClient client) throws IOException {
        return HttpClients.createDefault();
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>

Coverage Report - org.jsimpledb.core.SnapshotTransaction

  Classes in this File	  Line Coverage	  Branch Coverage	  Complexity

SnapshotTransaction

45%

5/11

50%

1/2

	1.7142857142857142;1.714

   1

   2

   7

   8

 package org.jsimpledb.core;

   9

   10

 /**

   11

  * An initially empty, in-memory {@link Transaction} that persists indefinitely.

   12

  *

   13

  * <p>

   14

  * {@link SnapshotTransaction}s hold a "snapshot" some portion of the state of a {@link Transaction} for later use.

   15

  * Each {@link SnapshotTransaction}s contains its own set of "snapshot" objects that are copies of

   16

  * corresponding "real" database objects (as of the time they were copied).

   17

  * </p>

   18

  *

   19

  * <p>

   20

  * {@link SnapshotTransaction}s can never be closed (i.e., committed or rolled-back); they persist in memory until

   21

  * no longer referenced. {@link Transaction.Callback}s may be registered but they will never be invoked.

   22

  * </p>

   23

  *

   24

  * @see Transaction#createSnapshotTransaction

   25

  */

   26

 public class SnapshotTransaction extends Transaction {

   27

   28

     SnapshotTransaction(Transaction parent) {

   29	   17
         super(parent.db, new SnapshotKVTransaction(parent), parent.schemas, parent.schema);

   30	   17
     }

   31

   32

     /**

   33

      * Delete all objects contained in this snapshot transaction and reset it back to its initial empty state.

   34

      *

   35

      * <p>

   36

      * It will contain schema meta-data but no objects.

   37

      * </p>

   38

      */

   39

     public void reset() {

   40

   41

         // Sanity check

   42	   6
         if (this.stale)

   43	   0
             throw new StaleTransactionException(this);

   44

   45

         // Delete all object and index keys

   46	   6
         this.db.reset(this);

   47	   6
     }

   48

   49

     /**

   50

      * Commit this transaction.

   51

      *

   52

      * <p>

   53

      * {@link SnapshotTransaction}s do not support this method and will always throw {@link UnsupportedOperationException}.

   54

      * </p>

   55

      *

   56

      * @throws UnsupportedOperationException always

   57

      */

   58

     @Override

   59

     public void commit() {

   60	   0
         throw new UnsupportedOperationException("snapshot transaction");

   61

     }

   62

   63

     /**

   64

      * Roll back this transaction.

   65

      *

   66

      * <p>

   67

      * {@link SnapshotTransaction}s do not support this method and will always throw {@link UnsupportedOperationException}.

   68

      * </p>

   69

      *

   70

      * @throws UnsupportedOperationException always

   71

      */

   72

     @Override

   73

     public void rollback() {

   74	   0
         throw new UnsupportedOperationException("snapshot transaction");

   75

     }

   76

   77

     /**

   78

      * Mark this transaction for rollback only.

   79

      *

   80

      * <p>

   81

      * {@link SnapshotTransaction}s do not support this method and will always throw {@link UnsupportedOperationException}.

   82

      * </p>

   83

      *

   84

      * @throws UnsupportedOperationException always

   85

      */

   86

     @Override

   87

     public void setRollbackOnly() {

   88	   0
         throw new UnsupportedOperationException("snapshot transaction");

   89

     }

   90

   91

     /**

   92

      * Register a transaction callback to be invoked when this transaction completes.

   93

      *

   94

      * <p>

   95

      * {@link Transaction.Callback}s registered with a {@link SnapshotTransaction} will by definition never be invoked.

   96

      * Therefore, this method simply discards {@code callback}.

   97

      * </p>

   98

      */

   99

     @Override

   100

     public void addCallback(Callback callback) {

   101	   0
     }

   102

   103

     /**

   104

      * Determine whether this transaction is still valid.

   105

      *

   106

      * <p>

   107

      * {@link SnapshotTransaction}s are always valid.

   108

      * </p>

   109

      *

   110

      * @return true always

   111

      */

   112

     @Override

   113

     public boolean isValid() {

   114	   0
         return super.isValid();

   115

     }

   116

 }

   117

Report generated by Cobertura 2.0.3 on 4/16/15 8:30 PM.


text:
package org.elasticsearch.action.admin.indices.settings.put;

import org.elasticsearch.common.settings.Settings;

public class UpdateSettingsRequestAccessor {

    public static String[] indices(UpdateSettingsRequest request) {
        return request.indices();
    }

    public static Settings settings(UpdateSettingsRequest request) {
        return request.settings();
    }
}


text:
<?php

namespace Mbcraft\Laravel\Http\Controllers\Behaviours;

use Redirect;
use Input;
use Validator;

/**
 * This trait is used to get the create behaviour on an entity controller.
 * It defines two methods : getCreate and postCreate.
 * It also provides two methods for tuning the entity creation process :
 * beforeEntityCreate and afterEntityCreate.
 */
trait Create {

    /**
     * Adds the getCreate method to the controller for showing the page for collecting
     * all the data required for creating an entity.
     *
     * Returns the page for the entity create form.
     *
     * @param string $view_name The view name to use, defaults to 'create'.
     * @return View The created view
     */
    public function getCreate($view_name='create') {

        $view_params = array_merge(Input::all(),$this->getDetailsAdditionalEntities());

        // Return the right view with its parameters

        return $this->getViewFor($view_name, $view_params);

    }

    /**
     * Adds the postCreate method to the controller for creating entities with all
     * the required parameters submitted with a form.
     *
     * @return Redirect The redirect to follow after the operation
     */
    public function postCreate() {
        $validationRules = $this->getPreparedValidationRules(Input::all());

        $model_class = self::MODEL_CLASS;

        \Log::debug("Validating new " . $model_class::one_entity() . " ...");
        // Create a new validator instance from our validation rules
        $validator = Validator::make(Input::all(), $validationRules);

        // If validation fails, we'll exit the operation now.
        if ($validator->fails()) {
            \Log::debug("Validation failed");
            // Ooops.. something went wrong
            return Redirect::back()->withInput()->withErrors($validator);
        }

        $p_create_data = [];
        foreach (Input::all() as $key => $value) {
            if (isset($validationRules[$key])) {
                $p_create_data[$key] = $value;
            }
        }

        list($before_create_result, $create_data) = $this->beforeEntityCreate($p_create_data);

        if ($before_create_result != null) {
            return $before_create_result;
        }

        try {
            // Create the entity
            $entity = $model_class::create($create_data);
        } catch (Exception $ex) {
            // Prepare the error message
            $error = $this->LMessage->error_created();

            // Redirect to the entity index page with all the input parameters and an error message
            return $this->getRedirectFor('index')->withInput()->with('error', $error);
        }
        \Log::debug("Entity creation successful");

        $after_create_result = $this->afterEntityCreate($entity);
        if ($after_create_result != null) {
            return $after_create_result;
        }

        // Redirect to the index page with success message
        return $this->getRedirectFor('index')->with('success', $this->LMessage->success_created());
    }

    /**
     * Default behavior for 'before entity create' hook.
     *
     */
    protected function defaultBeforeEntityCreate($create_data) {
        return array(null,$create_data);
    }

    /**
     * Hook method called before entity creation with all the fetched input data.
     */
    protected function beforeEntityCreate($create_data) {
        return $this->defaultBeforeEntityCreate($create_data);
    }

    /**
     * Default behavior for 'after entity create' hook.
     *
     */
    protected function defaultAfterEntityCreate($entity) {
        return null;
    }

    /**
     * Hook method called after the entity is created.
     */
    protected function afterEntityCreate($entity) {
        return $this->defaultAfterEntityCreate($entity);
    }

}


text:
/* globals $, columnChart,showTour, Tour, google, lineChart, pieChart, stackedColumnChart, areaChart */

$(function () {
    "use strict";
    // do chart JS stuff.
    drawChart();
    if (showTour) {
        $.getJSON('json/tour').done(function (data) {
            var tour = new Tour(
                {
                    steps: data.steps,
                    template: data.template,
                    onEnd: endTheTour
                });
            // Initialize the tour
            tour.init();
            // Start the tour
            tour.start();
        }).fail(function () {
            console.log('Already had tour.');
        });
    }

});

function endTheTour() {
    "use strict";
    $.post('json/end-tour', {_token: token});

}

function drawChart() {
    "use strict";
    areaChart('chart/account/frontpage', 'accounts-chart');
    pieChart('chart/bill/frontpage', 'bills-chart');
    stackedColumnChart('chart/budget/frontpage', 'budgets-chart', {beforeDraw: beforeDrawIsEmpty});
    columnChart('chart/category/frontpage', 'categories-chart', {beforeDraw: beforeDrawIsEmpty});
    columnChart('chart/account/expense', 'expense-accounts-chart', {beforeDraw: beforeDrawIsEmpty});

    getBoxAmounts();
}

/**
 * Removes a chart container if there is nothing for the chart to draw.
 *
 * @param data
 * @param options
 * @returns {boolean}
 */
function beforeDrawIsEmpty(data, options) {
    "use strict";

    // check if chart holds data.
    if (data.labels.length === 0) {
        // remove the chart container + parent
        console.log(options.container + ' appears empty. Removed.');
        $('#' + options.container).parent().parent().remove();

        // return false so script stops.
        return false;
    }
    return true;
}

function getBoxAmounts() {
    "use strict";
    var boxes = ['in', 'out', 'bills-unpaid', 'bills-paid'];
    for (var x in boxes) {
        var box = boxes[x];
        $.getJSON('json/box/' + box).done(putData).fail(failData);
    }
}

function putData(data) {
    "use strict";
    $('#box-' + data.box).html(data.amount);
}

function failData() {
    "use strict";
    console.log('Failed to get box!');
}


text:
package org.apache.ambari.server.controller.logging;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.ambari.server.AmbariService;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.AmbariManagementController;
import org.apache.ambari.server.controller.AmbariServer;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.AbstractService;
import com.google.inject.Inject;
import com.google.inject.Injector;

/**
 * The {@link LogSearchDataRetrievalService} is an Ambari Service that
 *   is used by the Ambari LogSearch integration code to obtain response
 *   data from the LogSearch server.
 *
 * In order to improve the performance of the LogSearch integration layer in
 *   Ambari, this service implements the following:
 *
 *

 *
A cache for LogSearch data that typically is returned by the LogSearch REST API

 *
Implements the remote request for LogSearch data not found in the cache on a separate
 *        thread, which keeps the request from affecting the overall performance of the
 *        Ambari REST API

 *

 *
 *  As with other services annotated with {@link AmbariService}, this class may be
 *    injected in order to obtain cached access to the LogSearch responses.
 *
 *  Caches are initially empty in this implementation, and a remote request
 *    to the LogSearch server will be made upon the first request for a given
 *    response.
 *
 *
 */
@AmbariService
public class LogSearchDataRetrievalService extends AbstractService {

  private static Logger LOG = LoggerFactory.getLogger(LogSearchDataRetrievalService.class);

  /**
   * Maximum number of failed attempts that the LogSearch integration code will attempt for
   *   a given component before treating the component as failed and skipping the request.
   *
   */
  private static int MAX_RETRIES_FOR_FAILED_METADATA_REQUEST = 10;

  /**
   * Factory instance used to handle URL string generation requests on the
   *   main request thread.
   */
  @Inject
  private LoggingRequestHelperFactory loggingRequestHelperFactory;

  @Inject
  private Injector injector;

  @Inject
  private Configuration ambariServerConfiguration;

  /**
   * A Cache of host+component names to a set of log files associated with
   *  that Host/Component combination.  This data is retrieved from the
   *  LogSearch server, but cached here for better performance.
   */
  private Cache<String, Set<String>> logFileNameCache;

  /**
   * A Cache of host+component names to a generated URI that
   *  can be used to access the "tail" of a given log file.
   *
   * This data is generated by ambari-server, but cached here to
   *  avoid re-creating these strings upon multiple calls to the
   *  associated HostComponent resource.
   */
  private Cache<String, String> logFileTailURICache;

  /**
   * A set that maintains the current requests being made,
   *  but not yet completed.  This Set will be used to
   *  keep multiple requests from being made for the same
   *  host/component combination.
   *
   */
  private final Set<String> currentRequests = Sets.newConcurrentHashSet();

  /**
   * A map that maintains the set of failure counts for logging
   * metadata requests on a per-component basis.  This map should
   * be consulted prior to making a metadata request to the LogSearch
   * service.  If LogSearch has already returned an empty list for the given
   * component, or any other error has occurred for a certain number of attempts,
   * the request should not be attempted further.
   *
   */
  private final Map<String, AtomicInteger> componentRequestFailureCounts =
    Maps.newConcurrentMap();

  /**
   * Executor instance to be used to run REST queries against
   * the LogSearch service.
   */
  private Executor executor;

  @Override
  protected void doStart() {

    LOG.debug("Initializing caches");

    // obtain the max cache expire time from the ambari configuration
    final int maxTimeoutForCacheInHours =
      ambariServerConfiguration.getLogSearchMetadataCacheExpireTimeout();

    LOG.debug("Caches configured with a max expire timeout of " + maxTimeoutForCacheInHours + " hours.");

    // initialize the log file name cache
    logFileNameCache = CacheBuilder.newBuilder().expireAfterWrite(maxTimeoutForCacheInHours, TimeUnit.HOURS).build();
    // initialize the log file tail URI cache
    logFileTailURICache = CacheBuilder.newBuilder().expireAfterWrite(maxTimeoutForCacheInHours, TimeUnit.HOURS).build();

    // initialize the Executor
    executor = Executors.newSingleThreadExecutor();
  }

  @Override
  protected void doStop() {
    LOG.debug("Invalidating LogSearch caches");
    // invalidate the caches
    logFileNameCache.invalidateAll();

    logFileTailURICache.invalidateAll();
  }

  /**
   * This method attempts to obtain the log file names for the specified component
   *   on the specified host.  A cache lookup is first attempted. If the cache does not contain
   *   this data, an asynchronous task is launched in order to make the REST request to
   *   the LogSearch server to obtain this data.
   *
   * Once the data is available in the cache, subsequent calls for a given Host/Component
   *   combination should return non-null.
   *
   * @param component the component name
   * @param host the host name
   * @param cluster the cluster name
   *
   * @return a Set<String> that includes the log file names associated with this Host/Component
   *         combination, or null if that object does not exist in the cache.
   */
  public Set<String> getLogFileNames(String component, String host, String cluster) {
    final String key = generateKey(component, host);

    // check cache for data
    Set<String> cacheResult =
      logFileNameCache.getIfPresent(key);

    if (cacheResult != null) {
      LOG.debug("LogFileNames result for key = {} found in cache", key);
      return cacheResult;
    } else {
      if (!componentRequestFailureCounts.containsKey(component) || componentRequestFailureCounts.get(component).get() < MAX_RETRIES_FOR_FAILED_METADATA_REQUEST) {
        // queue up a thread to create the LogSearch REST request to obtain this information
        if (currentRequests.contains(key)) {
          LOG.debug("LogFileNames request has been made for key = {}, but not completed yet", key);
        } else {
          LOG.debug("LogFileNames result for key = {} not in cache, queueing up remote request", key);
          // add request key to queue, to keep multiple copies of the same request from
          // being submitted
          currentRequests.add(key);
          startLogSearchFileNameRequest(host, component, cluster);
        }
      } else {
        LOG.debug("Too many failures occurred while attempting to obtain log file metadata for component = {}, Ambari will ignore this component for LogSearch Integration", component);
      }
    }

    return null;
  }

  public String getLogFileTailURI(String baseURI, String component, String host, String cluster) {
    String key = generateKey(component, host);

    String result = logFileTailURICache.getIfPresent(key);
    if (result != null) {
      // return cached result
      return result;
    } else {
      // create URI and add to cache before returning
      if (loggingRequestHelperFactory != null) {
        LoggingRequestHelper helper =
          loggingRequestHelperFactory.getHelper(getController(), cluster);

        if (helper != null) {
          String tailFileURI =
            helper.createLogFileTailURI(baseURI, component, host);

          if (tailFileURI != null) {
            logFileTailURICache.put(key, tailFileURI);
            return tailFileURI;
          }
        }
      } else {
        LOG.debug("LoggingRequestHelperFactory not set on the retrieval service, this probably indicates an error in setup of this service.");
      }
    }

    return null;
  }

  protected void setLoggingRequestHelperFactory(LoggingRequestHelperFactory loggingRequestHelperFactory) {
    this.loggingRequestHelperFactory = loggingRequestHelperFactory;
  }

  /**
   * Package-level setter to facilitate simpler unit testing
   *
   * @param injector
   */
  void setInjector(Injector injector) {
    this.injector = injector;
  }

  /**
   * This protected method provides a way for unit-tests to insert a
   * mock executor for simpler unit-testing.
   *
   * @param executor an Executor instance
   */
  protected void setExecutor(Executor executor) {
    this.executor = executor;
  }

  /**
   * Package-level setter to facilitate simpler unit testing
   *
   * @param ambariServerConfiguration
   */
  void setConfiguration(Configuration ambariServerConfiguration) {
    this.ambariServerConfiguration = ambariServerConfiguration;
  }

  /**
   * This protected method allows for simpler unit tests.
   *
   * @return the Set of current Requests that are not yet completed
   */
  protected Set<String> getCurrentRequests() {
    return currentRequests;
  }

  /**
   * This protected method allows for simpler unit tests.
   *
   * @return the Map of failure counts on a per-component basis
   */
  protected Map<String, AtomicInteger> getComponentRequestFailureCounts() {
    return componentRequestFailureCounts;
  }

  private void startLogSearchFileNameRequest(String host, String component, String cluster) {
    // Create a separate instance of LoggingRequestHelperFactory for
    // each task launched, since these tasks will occur on a separate thread
    // TODO: In a future patch, this should be refactored, to either remove the need
    // TODO: for the separate factory instance at the level of this class, or to make
    // TODO: the LoggingRequestHelperFactory implementation thread-safe, so that
    // TODO: a single factory instance can be shared across multiple threads safely
    executor.execute(new LogSearchFileNameRequestRunnable(host, component, cluster, logFileNameCache, currentRequests,
                                                          injector.getInstance(LoggingRequestHelperFactory.class), componentRequestFailureCounts));
  }

  private AmbariManagementController getController() {
    return AmbariServer.getController();
  }

  private static String generateKey(String component, String host) {
    return component + "+" + host;
  }

  /**
   * A {@link Runnable} used to make requests to the remote LogSearch server's
   *   REST API.
   *
   * This implementation will update a cache shared with the {@link LogSearchDataRetrievalService},
   *   which can then be used for subsequent requests for the same data.
   *
   */
  static class LogSearchFileNameRequestRunnable implements Runnable {

    private final String host;

    private final String component;

    private final String cluster;

    private final Set<String> currentRequests;

    private final Cache<String, Set<String>> logFileNameCache;

    private LoggingRequestHelperFactory loggingRequestHelperFactory;

    private final Map<String, AtomicInteger> componentRequestFailureCounts;

    private AmbariManagementController controller;

    LogSearchFileNameRequestRunnable(String host, String component, String cluster, Cache<String, Set<String>> logFileNameCache, Set<String> currentRequests, LoggingRequestHelperFactory loggingRequestHelperFactory,
                                     Map<String, AtomicInteger> componentRequestFailureCounts) {
      this(host, component, cluster, logFileNameCache, currentRequests, loggingRequestHelperFactory, componentRequestFailureCounts, AmbariServer.getController());
    }

    LogSearchFileNameRequestRunnable(String host, String component, String cluster, Cache<String, Set<String>> logFileNameCache, Set<String> currentRequests,
                                               LoggingRequestHelperFactory loggingRequestHelperFactory, Map<String, AtomicInteger> componentRequestFailureCounts, AmbariManagementController controller) {
      this.host  = host;
      this.component = component;
      this.cluster = cluster;
      this.logFileNameCache = logFileNameCache;
      this.currentRequests = currentRequests;
      this.loggingRequestHelperFactory = loggingRequestHelperFactory;
      this.componentRequestFailureCounts = componentRequestFailureCounts;
      this.controller = controller;
    }

    @Override
    public void run() {
      LOG.debug("LogSearchFileNameRequestRunnable: starting...");
      try {
        LoggingRequestHelper helper =
          loggingRequestHelperFactory.getHelper(controller, cluster);

        if (helper != null) {
          // make request to LogSearch service
          Set<String> logFileNamesResult =
            helper.sendGetLogFileNamesRequest(component, host);

          // update the cache if result is available
          if (CollectionUtils.isNotEmpty(logFileNamesResult)) {
            LOG.debug("LogSearchFileNameRequestRunnable: request was successful, updating cache");
            final String key = generateKey(component, host);
            // update cache with returned result
            logFileNameCache.put(key, logFileNamesResult);
          } else {
            LOG.debug("LogSearchFileNameRequestRunnable: remote request was not successful for component = {} on host ={}", component, host);
            if (!componentRequestFailureCounts.containsKey(component)) {
              componentRequestFailureCounts.put(component, new AtomicInteger());
            }

            // increment the failure count for this component
            componentRequestFailureCounts.get(component).incrementAndGet();
          }
        } else {
          LOG.debug("LogSearchFileNameRequestRunnable: request helper was null.  This may mean that LogSearch is not available, or could be a potential connection problem.");
        }
      } finally {
        // since request has completed (either successfully or not),
        // remove this host/component key from the current requests
        currentRequests.remove(generateKey(component, host));
      }
    }

    protected void setLoggingRequestHelperFactory(LoggingRequestHelperFactory loggingRequestHelperFactory) {
      this.loggingRequestHelperFactory = loggingRequestHelperFactory;
    }

    protected void setAmbariManagementController(AmbariManagementController controller) {
      this.controller = controller;
    }

  }

}


text:
/*
 * $Id: XTemplateSerializer.hpp 678409 2008-07-21 13:08:10Z borisk $
 */

#if !defined(XERCESC_INCLUDE_GUARD_XTEMPLATE_SERIALIZER_HPP)
#define XERCESC_INCLUDE_GUARD_XTEMPLATE_SERIALIZER_HPP

#include <xercesc/util/ValueVectorOf.hpp>
#include <xercesc/util/RefArrayVectorOf.hpp>
#include <xercesc/util/RefVectorOf.hpp>
#include <xercesc/util/RefHashTableOf.hpp>
#include <xercesc/util/RefHash2KeysTableOf.hpp>
#include <xercesc/util/RefHash3KeysIdPool.hpp>
#include <xercesc/util/NameIdPool.hpp>

#include <xercesc/framework/XMLNotationDecl.hpp>
#include <xercesc/framework/XMLRefInfo.hpp>
#include <xercesc/util/XMLNumber.hpp>
#include <xercesc/validators/common/ContentSpecNode.hpp>
#include <xercesc/validators/DTD/DTDAttDef.hpp>
#include <xercesc/validators/DTD/DTDElementDecl.hpp>
#include <xercesc/validators/DTD/DTDEntityDecl.hpp>
#include <xercesc/validators/schema/SchemaAttDef.hpp>
#include <xercesc/validators/schema/SchemaElementDecl.hpp>
#include <xercesc/validators/schema/XercesGroupInfo.hpp>
#include <xercesc/validators/schema/XercesAttGroupInfo.hpp>
#include <xercesc/validators/schema/SchemaGrammar.hpp>
#include <xercesc/validators/schema/identity/IC_Field.hpp>
#include <xercesc/validators/schema/identity/IdentityConstraint.hpp>
#include <xercesc/validators/schema/identity/XercesXPath.hpp>
#include <xercesc/framework/psvi/XSAnnotation.hpp>

XERCES_CPP_NAMESPACE_BEGIN

class XMLUTIL_EXPORT XTemplateSerializer
{
public:

    /**********************************************************
     *
     * ValueVectorOf
     *
     *   SchemaElementDecl*
     *   unsigned int
     *
     ***********************************************************/
    static void           storeObject(ValueVectorOf<SchemaElementDecl*>* const tempObjToWrite
                                    , XSerializeEngine&                        serEng);

    static void           loadObject(ValueVectorOf<SchemaElementDecl*>**       tempObjToRead
                                   , int                                       initSize
                                   , bool                                      toCallDestructor
                                   , XSerializeEngine&                         serEng);

    static void           storeObject(ValueVectorOf<unsigned int>* const tempObjToWrite
                                    , XSerializeEngine&                  serEng);

    static void           loadObject(ValueVectorOf<unsigned int>**       tempObjToRead
                                   , int                                 initSize
                                   , bool                                toCallDestructor
                                   , XSerializeEngine&                   serEng);

    /**********************************************************
     *
     * RefArrayVectorOf
     *
     *   XMLCh
     *
     ***********************************************************/
    static void           storeObject(RefArrayVectorOf<XMLCh>* const tempObjToWrite
                                    , XSerializeEngine&              serEng);

    static void           loadObject(RefArrayVectorOf<XMLCh>**       tempObjToRead
                                   , int                             initSize
                                   , bool                            toAdopt
                                   , XSerializeEngine&               serEng);

    /**********************************************************
     *
     * RefVectorOf
     *
     *   SchemaAttDef
     *   SchemaElementDecl
     *   ContentSpecNode
     *   IC_Field
     *   DatatypeValidator
     *   IdentityConstraint
     *   XMLNumber
     *   XercesLocationPath
     *   XercesStep
     *
     ***********************************************************/
    static void           storeObject(RefVectorOf<SchemaAttDef>* const tempObjToWrite
                                    , XSerializeEngine&                serEng);

    static void           loadObject(RefVectorOf<SchemaAttDef>**       tempObjToRead
                                   , int                               initSize
                                   , bool                              toAdopt
                                   , XSerializeEngine&                 serEng);

    static void           storeObject(RefVectorOf<SchemaElementDecl>* const tempObjToWrite
                                    , XSerializeEngine&                     serEng);

    static void           loadObject(RefVectorOf<SchemaElementDecl>**       tempObjToRead
                                   , int                                    initSize
                                   , bool                                   toAdopt
                                   , XSerializeEngine&                      serEng);

    static void           storeObject(RefVectorOf<ContentSpecNode>* const tempObjToWrite
                                    , XSerializeEngine&                   serEng);

    static void           loadObject(RefVectorOf<ContentSpecNode>**       tempObjToRead
                                   , int                                  initSize
                                   , bool                                 toAdopt
                                   , XSerializeEngine&                    serEng);

    static void           storeObject(RefVectorOf<IC_Field>* const tempObjToWrite
                                    , XSerializeEngine&            serEng);

    static void           loadObject(RefVectorOf<IC_Field>**       tempObjToRead
                                   , int                           initSize
                                   , bool                          toAdopt
                                   , XSerializeEngine&             serEng);

    static void           storeObject(RefVectorOf<DatatypeValidator>* const tempObjToWrite
                                    , XSerializeEngine&                     serEng);

    static void           loadObject(RefVectorOf<DatatypeValidator>**       tempObjToRead
                                   , int                                    initSize
                                   , bool                                   toAdopt
                                   , XSerializeEngine&                      serEng);

    static void           storeObject(RefVectorOf<IdentityConstraint>* const tempObjToWrite
                                    , XSerializeEngine&                      serEng);

    static void           loadObject(RefVectorOf<IdentityConstraint>**       tempObjToRead
                                   , int                                     initSize
                                   , bool                                    toAdopt
                                   , XSerializeEngine&                       serEng);

    static void           storeObject(RefVectorOf<XMLNumber>* const tempObjToWrite
                                    , XSerializeEngine&             serEng);

    static void           loadObject(RefVectorOf<XMLNumber>**       tempObjToRead
                                   , int                            initSize
                                   , bool                           toAdopt
                                   , XMLNumber::NumberType          numType
                                   , XSerializeEngine&              serEng);

    static void           storeObject(RefVectorOf<XercesLocationPath>* const tempObjToWrite
                                    , XSerializeEngine&                      serEng);

    static void           loadObject(RefVectorOf<XercesLocationPath>**       tempObjToRead
                                   , int                                     initSize
                                   , bool                                    toAdopt
                                   , XSerializeEngine&                       serEng);

    static void           storeObject(RefVectorOf<XercesStep>* const tempObjToWrite
                                    , XSerializeEngine&              serEng);

    static void           loadObject(RefVectorOf<XercesStep>**       tempObjToRead
                                   , int                             initSize
                                   , bool                            toAdopt
                                   , XSerializeEngine&               serEng);

    /**********************************************************
     *
     * RefHashTableOf
     *
     *   KVStringPair
     *   XMLAttDef
     *   DTDAttDef
     *   ComplexTypeInfo
     *   XercesGroupInfo
     *   XercesAttGroupInfo
     *   XMLRefInfo
     *   DatatypeValidator
     *   Grammar
     *   XSAnnotation
     *
     ***********************************************************/
    static void           storeObject(RefHashTableOf<KVStringPair>* const tempObjToWrite
                                    , XSerializeEngine&                   serEng);

    static void           loadObject(RefHashTableOf<KVStringPair>**       tempObjToRead
                                   , int                                  initSize
                                   , bool                                 toAdopt
                                   , XSerializeEngine&                    serEng);

    static void           storeObject(RefHashTableOf<XMLAttDef>* const tempObjToWrite
                                    , XSerializeEngine&                serEng);

    static void           loadObject(RefHashTableOf<XMLAttDef>**       tempObjToRead
                                   , int                               initSize
                                   , bool                              toAdopt
                                   , XSerializeEngine&                 serEng);

    static void           storeObject(RefHashTableOf<DTDAttDef>* const tempObjToWrite
                                    , XSerializeEngine&                serEng);

    static void           loadObject(RefHashTableOf<DTDAttDef>**       tempObjToRead
                                   , int                               initSize
                                   , bool                              toAdopt
                                   , XSerializeEngine&                 serEng);

    static void           storeObject(RefHashTableOf<ComplexTypeInfo>* const tempObjToWrite
                                    , XSerializeEngine&                      serEng);

    static void           loadObject(RefHashTableOf<ComplexTypeInfo>**       tempObjToRead
                                   , int                                     initSize
                                   , bool                                    toAdopt
                                   , XSerializeEngine&                       serEng);

    static void           storeObject(RefHashTableOf<XercesGroupInfo>* const tempObjToWrite
                                    , XSerializeEngine&                      serEng);

    static void           loadObject(RefHashTableOf<XercesGroupInfo>**       tempObjToRead
                                   , int                                     initSize
                                   , bool                                    toAdopt
                                   , XSerializeEngine&                       serEng);

    static void           storeObject(RefHashTableOf<XercesAttGroupInfo>* const tempObjToWrite
                                    , XSerializeEngine&                         serEng);

    static void           loadObject(RefHashTableOf<XercesAttGroupInfo>**       tempObjToRead
                                   , int                                        initSize
                                   , bool                                       toAdopt
                                   , XSerializeEngine&                          serEng);

    static void           storeObject(RefHashTableOf<XMLRefInfo>* const tempObjToWrite
                                    , XSerializeEngine&                 serEng);

    static void           loadObject(RefHashTableOf<XMLRefInfo>**       tempObjToRead
                                   , int                                initSize
                                   , bool                               toAdopt
                                   , XSerializeEngine&                  serEng);

    static void           storeObject(RefHashTableOf<DatatypeValidator>* const tempObjToWrite
                                    , XSerializeEngine&                        serEng);

    static void           loadObject(RefHashTableOf<DatatypeValidator>**       tempObjToRead
                                   , int                                       initSize
                                   , bool                                      toAdopt
                                   , XSerializeEngine&                         serEng);

    static void           storeObject(RefHashTableOf<Grammar>* const tempObjToWrite
                                    , XSerializeEngine&              serEng);

    static void           loadObject(RefHashTableOf<Grammar>**       tempObjToRead
                                   , int                             initSize
                                   , bool                            toAdopt
                                   , XSerializeEngine&               serEng);

    static void           storeObject(RefHashTableOf<XSAnnotation, PtrHasher>* const tempObjToWrite
                                    , XSerializeEngine&                   serEng);

    static void           loadObject(RefHashTableOf<XSAnnotation, PtrHasher>**  tempObjToRead
                                   , int                             initSize
                                   , bool                            toAdopt
                                   , XSerializeEngine&               serEng);

    /**********************************************************
     *
     * RefHash2KeysTableOf
     *
     *   SchemaAttDef
     *   ElemVector
     *
     ***********************************************************/
    static void           storeObject(RefHash2KeysTableOf<SchemaAttDef>* const tempObjToWrite
                                    , XSerializeEngine&                        serEng);

    static void           loadObject(RefHash2KeysTableOf<SchemaAttDef>**       tempObjToRead
                                   , int                                       initSize
                                   , bool                                      toAdopt
                                   , XSerializeEngine&                         serEng);

    static void           storeObject(RefHash2KeysTableOf<ElemVector>* const tempObjToWrite
                                    , XSerializeEngine&                      serEng);

    static void           loadObject(RefHash2KeysTableOf<ElemVector>**       tempObjToRead
                                   , int                                     initSize
                                   , bool                                    toAdopt
                                   , XSerializeEngine&                       serEng);

    /**********************************************************
     *
     * RefHash3KeysIdPool
     *
     *   SchemaElementDecl
     *
     ***********************************************************/
    static void           storeObject(RefHash3KeysIdPool<SchemaElementDecl>* const tempObjToWrite
                                    , XSerializeEngine&                            serEng);

    static void           loadObject(RefHash3KeysIdPool<SchemaElementDecl>**       tempObjToRead
                                   , int                                           initSize
                                   , bool                                          toAdopt
                                   , int                                           initSize2
                                   , XSerializeEngine&                             serEng);

    /**********************************************************
     *
     * NameIdPool
     *
     *   DTDElementDecl
     *   DTDEntityDecl
     *   XMLNotationDecl
     *
     ***********************************************************/
    static void           storeObject(NameIdPool<DTDElementDecl>* const tempObjToWrite
                                    , XSerializeEngine&                 serEng);

    static void           loadObject(NameIdPool<DTDElementDecl>**       tempObjToRead
                                   , int                                initSize
                                   , int                                initSize2
                                   , XSerializeEngine&                  serEng);

    static void           storeObject(NameIdPool<DTDEntityDecl>* const tempObjToWrite
                                    , XSerializeEngine&                serEng);

    static void           loadObject(NameIdPool<DTDEntityDecl>**       tempObjToRead
                                   , int                               initSize
                                   , int                               initSize2
                                   , XSerializeEngine&                 serEng);

    static void           storeObject(NameIdPool<XMLNotationDecl>* const tempObjToWrite
                                    , XSerializeEngine&                  serEng);

    static void           loadObject(NameIdPool<XMLNotationDecl>**      tempObjToRead
                                   , int                                initSize
                                   , int                                initSize2
                                   , XSerializeEngine&                  serEng);

private:
    // -----------------------------------------------------------------------
    //  Unimplemented constructors and operators
    // -----------------------------------------------------------------------
	~XTemplateSerializer();
    XTemplateSerializer();
    XTemplateSerializer(const XTemplateSerializer&);
	XTemplateSerializer& operator=(const XTemplateSerializer&);

};

XERCES_CPP_NAMESPACE_END

#endif